1
/* ScummVM - Graphic Adventure Engine
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.
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.
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.
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.
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 $
28
* Sound decoder used in engines:
41
#include "common/scummsys.h"
42
#include "common/types.h"
44
namespace Common { class ReadStream; }
45
namespace Common { class SeekableReadStream; }
50
class SeekableAudioStream;
53
#include "common/pack-start.h" // START STRUCT PACKING
55
struct VocFileHeader {
57
uint16 datablock_offset;
62
struct VocBlockHeader {
69
#include "common/pack-end.h" // END STRUCT PACKING
72
* Take a sample rate parameter as it occurs in a VOC sound header, and
73
* return the corresponding sample frequency.
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.
81
extern int getSampleRateFromVOCRate(int vocSR);
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.
89
extern byte *loadVOCFromStream(Common::ReadStream &stream, int &size, int &rate);
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.
96
* This function uses loadVOCFromStream() internally.
98
AudioStream *makeVOCStream(Common::SeekableReadStream *stream, byte flags = 0, uint loopStart = 0, uint loopEnd = 0, DisposeAfterUse::Flag disposeAfterUse = DisposeAfterUse::NO);
101
* This does not use any of the looping features of VOC files!
103
SeekableAudioStream *makeVOCStream(Common::SeekableReadStream *stream, byte flags, DisposeAfterUse::Flag disposeAfterUse);
105
} // End of namespace Audio