~ubuntu-branches/debian/jessie/scummvm/jessie

« back to all changes in this revision

Viewing changes to sound/decoders/voc.h

  • Committer: Bazaar Package Importer
  • Author(s): Moritz Muehlenhoff
  • Date: 2011-05-25 19:02:23 UTC
  • mto: This revision was merged to the branch mainline in revision 23.
  • Revision ID: james.westby@ubuntu.com-20110525190223-fiqm0oaec714xk31
Tags: upstream-1.3.0
ImportĀ upstreamĀ versionĀ 1.3.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* ScummVM - Graphic Adventure Engine
2
 
 *
3
 
 * ScummVM is the legal property of its developers, whose names
4
 
 * are too numerous to list here. Please refer to the COPYRIGHT
5
 
 * file distributed with this source distribution.
6
 
 *
7
 
 * This program is free software; you can redistribute it and/or
8
 
 * modify it under the terms of the GNU General Public License
9
 
 * as published by the Free Software Foundation; either version 2
10
 
 * of the License, or (at your option) any later version.
11
 
 
12
 
 * This program is distributed in the hope that it will be useful,
13
 
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
 
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
 
 * GNU General Public License for more details.
16
 
 
17
 
 * You should have received a copy of the GNU General Public License
18
 
 * along with this program; if not, write to the Free Software
19
 
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20
 
 *
21
 
 * $URL: https://scummvm.svn.sourceforge.net/svnroot/scummvm/scummvm/tags/release-1-2-1/sound/decoders/voc.h $
22
 
 * $Id: voc.h 49843 2010-06-15 12:33:20Z fingolfin $
23
 
 *
24
 
 */
25
 
 
26
 
/**
27
 
 * @file
28
 
 * Sound decoder used in engines:
29
 
 *  - agos
30
 
 *  - drascula
31
 
 *  - kyra
32
 
 *  - made
33
 
 *  - saga
34
 
 *  - scumm
35
 
 *  - touche
36
 
 */
37
 
 
38
 
#ifndef SOUND_VOC_H
39
 
#define SOUND_VOC_H
40
 
 
41
 
#include "common/scummsys.h"
42
 
#include "common/types.h"
43
 
 
44
 
namespace Common { class ReadStream; }
45
 
namespace Common { class SeekableReadStream; }
46
 
 
47
 
namespace Audio {
48
 
 
49
 
class AudioStream;
50
 
class SeekableAudioStream;
51
 
 
52
 
 
53
 
#include "common/pack-start.h"  // START STRUCT PACKING
54
 
 
55
 
struct VocFileHeader {
56
 
        uint8 desc[20];
57
 
        uint16 datablock_offset;
58
 
        uint16 version;
59
 
        uint16 id;
60
 
} PACKED_STRUCT;
61
 
 
62
 
struct VocBlockHeader {
63
 
        uint8 blocktype;
64
 
        uint8 size[3];
65
 
        uint8 sr;
66
 
        uint8 pack;
67
 
} PACKED_STRUCT;
68
 
 
69
 
#include "common/pack-end.h"    // END STRUCT PACKING
70
 
 
71
 
/**
72
 
 * Take a sample rate parameter as it occurs in a VOC sound header, and
73
 
 * return the corresponding sample frequency.
74
 
 *
75
 
 * This method has special cases for the standard rates of 11025 and 22050 kHz,
76
 
 * which due to limitations of the format, cannot be encoded exactly in a VOC
77
 
 * file. As a consequence, many game files have sound data sampled with those
78
 
 * rates, but the VOC marks them incorrectly as 11111 or 22222 kHz. This code
79
 
 * works around that and "unrounds" the sampling rates.
80
 
 */
81
 
extern int getSampleRateFromVOCRate(int vocSR);
82
 
 
83
 
/**
84
 
 * Try to load a VOC from the given stream. Returns a pointer to memory
85
 
 * containing the PCM sample data (allocated with malloc). It is the callers
86
 
 * responsibility to dellocate that data again later on! Currently this
87
 
 * function only supports uncompressed raw PCM data.
88
 
 */
89
 
extern byte *loadVOCFromStream(Common::ReadStream &stream, int &size, int &rate);
90
 
 
91
 
/**
92
 
 * Try to load a VOC from the given seekable stream and create an AudioStream
93
 
 * from that data. Currently this function only supports uncompressed raw PCM
94
 
 * data. Optionally supports (infinite) looping of a portion of the data.
95
 
 *
96
 
 * This function uses loadVOCFromStream() internally.
97
 
 */
98
 
AudioStream *makeVOCStream(Common::SeekableReadStream *stream, byte flags = 0, uint loopStart = 0, uint loopEnd = 0, DisposeAfterUse::Flag disposeAfterUse = DisposeAfterUse::NO);
99
 
 
100
 
/**
101
 
 * This does not use any of the looping features of VOC files!
102
 
 */
103
 
SeekableAudioStream *makeVOCStream(Common::SeekableReadStream *stream, byte flags, DisposeAfterUse::Flag disposeAfterUse);
104
 
 
105
 
} // End of namespace Audio
106
 
 
107
 
#endif