diff options
| author | Max Horn | 2006-04-29 22:33:31 +0000 |
|---|---|---|
| committer | Max Horn | 2006-04-29 22:33:31 +0000 |
| commit | 27307acd7c6f9f9083bdcad38ba54f18d4f080b7 (patch) | |
| tree | fd7360382a19b07dcca9b711080b3f6c8f64fd38 /sound | |
| parent | ac0ae13bee890b78442788abe6b87e514c9928a0 (diff) | |
| download | scummvm-rg350-27307acd7c6f9f9083bdcad38ba54f18d4f080b7.tar.gz scummvm-rg350-27307acd7c6f9f9083bdcad38ba54f18d4f080b7.tar.bz2 scummvm-rg350-27307acd7c6f9f9083bdcad38ba54f18d4f080b7.zip | |
Moved the AudioCDManager as well as class AudioStream and its (standard) subclasses to namespace Audio
svn-id: r22231
Diffstat (limited to 'sound')
| -rw-r--r-- | sound/adpcm.cpp | 4 | ||||
| -rw-r--r-- | sound/adpcm.h | 4 | ||||
| -rw-r--r-- | sound/audiocd.cpp | 4 | ||||
| -rw-r--r-- | sound/audiocd.h | 7 | ||||
| -rw-r--r-- | sound/audiostream.cpp | 6 | ||||
| -rw-r--r-- | sound/audiostream.h | 7 | ||||
| -rw-r--r-- | sound/flac.cpp | 4 | ||||
| -rw-r--r-- | sound/flac.h | 9 | ||||
| -rw-r--r-- | sound/mixer.h | 2 | ||||
| -rw-r--r-- | sound/mp3.cpp | 6 | ||||
| -rw-r--r-- | sound/mp3.h | 12 | ||||
| -rw-r--r-- | sound/softsynth/emumidi.h | 2 | ||||
| -rw-r--r-- | sound/voc.cpp | 4 | ||||
| -rw-r--r-- | sound/voc.h | 8 | ||||
| -rw-r--r-- | sound/vorbis.cpp | 22 | ||||
| -rw-r--r-- | sound/vorbis.h | 12 | ||||
| -rw-r--r-- | sound/wave.cpp | 4 | ||||
| -rw-r--r-- | sound/wave.h | 7 |
18 files changed, 97 insertions, 27 deletions
diff --git a/sound/adpcm.cpp b/sound/adpcm.cpp index 5d213842e6..2b447d6b0f 100644 --- a/sound/adpcm.cpp +++ b/sound/adpcm.cpp @@ -28,6 +28,8 @@ #include "sound/audiostream.h" +namespace Audio { + // TODO: Switch from a SeekableReadStream to a plain ReadStream. This requires // some internal refactoring but is definitely possible and will increase the // flexibility of this code. @@ -353,3 +355,5 @@ int16 ADPCMInputStream::decodeMS(ADPCMChannelStatus *c, byte code) { AudioStream *makeADPCMStream(Common::SeekableReadStream *stream, uint32 size, typesADPCM type, int rate, int channels, uint32 blockAlign) { return new ADPCMInputStream(stream, size, type, rate, channels, blockAlign); } + +} // End of namespace Audio diff --git a/sound/adpcm.h b/sound/adpcm.h index 6db3acae00..deab1f8e1c 100644 --- a/sound/adpcm.h +++ b/sound/adpcm.h @@ -27,6 +27,9 @@ #include "common/scummsys.h" #include "common/stream.h" + +namespace Audio { + class AudioStream; enum typesADPCM { @@ -37,5 +40,6 @@ enum typesADPCM { AudioStream *makeADPCMStream(Common::SeekableReadStream *stream, uint32 size, typesADPCM type, int rate = 22050, int channels = 2, uint32 blockAlign = 0); +} // End of namespace Audio #endif diff --git a/sound/audiocd.cpp b/sound/audiocd.cpp index c204ff4fd4..1487f4491a 100644 --- a/sound/audiocd.cpp +++ b/sound/audiocd.cpp @@ -31,6 +31,8 @@ #include "common/util.h" #include "common/system.h" +namespace Audio { + struct TrackFormat { /** Decodername */ const char* decoderName; @@ -165,3 +167,5 @@ int AudioCDManager::getCachedTrack(int track) { debug(2, "Track %d not available in compressed format", track); return -1; } + +} // End of namespace Audio diff --git a/sound/audiocd.h b/sound/audiocd.h index c829daafaa..c7d5fd15e0 100644 --- a/sound/audiocd.h +++ b/sound/audiocd.h @@ -28,6 +28,9 @@ #include "common/singleton.h" #include "sound/mixer.h" + +namespace Audio { + class DigitalTrackInfo { public: virtual bool error() = 0; @@ -82,6 +85,8 @@ private: }; /** Shortcut for accessing the audio CD manager. */ -#define AudioCD AudioCDManager::instance() +#define AudioCD Audio::AudioCDManager::instance() + +} // End of namespace Audio #endif diff --git a/sound/audiostream.cpp b/sound/audiostream.cpp index 2af01f66e6..07115390e8 100644 --- a/sound/audiostream.cpp +++ b/sound/audiostream.cpp @@ -31,6 +31,9 @@ #include "sound/vorbis.h" #include "sound/flac.h" + +namespace Audio { + struct StreamFileFormat { /** Decodername */ const char* decoderName; @@ -209,3 +212,6 @@ AudioStream *makeLinearInputStream(int rate, byte flags, const byte *ptr, uint32 } } } + + +} // End of namespace Audio diff --git a/sound/audiostream.h b/sound/audiostream.h index 88d5339f5a..078c8506c5 100644 --- a/sound/audiostream.h +++ b/sound/audiostream.h @@ -28,6 +28,8 @@ #include "common/scummsys.h" +namespace Audio { + /** * Generic input stream for the resampling code. */ @@ -116,11 +118,10 @@ AudioStream *makeLinearInputStream(int rate, byte flags, const byte *ptr, uint32 // us to go with the macro approach. So far this is // the only template function that MSVC6 seemed to // compile incorrectly. Knock on wood. -#define READSAMPLE(is16Bit, isUnsigned, ptr) \ - ((is16Bit ? READ_BE_UINT16(ptr) : (*ptr << 8)) ^ (isUnsigned ? 0x8000 : 0)) - #define READ_ENDIAN_SAMPLE(is16Bit, isUnsigned, ptr, isLE) \ ((is16Bit ? (isLE ? READ_LE_UINT16(ptr) : READ_BE_UINT16(ptr)) : (*ptr << 8)) ^ (isUnsigned ? 0x8000 : 0)) +} // End of namespace Audio + #endif diff --git a/sound/flac.cpp b/sound/flac.cpp index 5380e85faf..7f206ae562 100644 --- a/sound/flac.cpp +++ b/sound/flac.cpp @@ -37,6 +37,8 @@ using Common::File; +namespace Audio { + #pragma mark - #pragma mark --- Flac stream --- #pragma mark - @@ -849,4 +851,6 @@ AudioStream *makeFlacStream(File *file, uint32 length) } +} // End of namespace Audio + #endif // #ifdef USE_FLAC diff --git a/sound/flac.h b/sound/flac.h index fa2eaa077f..a916db9df0 100644 --- a/sound/flac.h +++ b/sound/flac.h @@ -28,12 +28,15 @@ #ifdef USE_FLAC -class AudioStream; -class DigitalTrackInfo; namespace Common { class File; } +namespace Audio { + +class AudioStream; +class DigitalTrackInfo; + DigitalTrackInfo *getFlacTrack(int track); /** @@ -44,5 +47,7 @@ DigitalTrackInfo *getFlacTrack(int track); */ AudioStream *makeFlacStream(Common::File *file, uint32 size); +} // End of namespace Audio + #endif // #ifdef USE_FLAC #endif // #ifndef SOUND_FLAC_H diff --git a/sound/mixer.h b/sound/mixer.h index 347f0c409b..f1cbc0586c 100644 --- a/sound/mixer.h +++ b/sound/mixer.h @@ -29,12 +29,12 @@ #include "common/mutex.h" -class AudioStream; class OSystem; namespace Audio { +class AudioStream; class Channel; class Mixer; diff --git a/sound/mp3.cpp b/sound/mp3.cpp index 855d2c25a3..f2ba7e9b26 100644 --- a/sound/mp3.cpp +++ b/sound/mp3.cpp @@ -36,6 +36,8 @@ using Common::File; +namespace Audio { + #pragma mark - #pragma mark --- MP3 (MAD) stream --- #pragma mark - @@ -487,4 +489,6 @@ DigitalTrackInfo *getMP3Track(int track) { } -#endif +} // End of namespace Audio + +#endif // #ifdef USE_MAD diff --git a/sound/mp3.h b/sound/mp3.h index db4f0cec6d..4f31337fcf 100644 --- a/sound/mp3.h +++ b/sound/mp3.h @@ -28,12 +28,15 @@ #ifdef USE_MAD -class AudioStream; -class DigitalTrackInfo; namespace Common { class File; } +namespace Audio { + +class AudioStream; +class DigitalTrackInfo; + DigitalTrackInfo *getMP3Track(int track); /** @@ -44,6 +47,7 @@ DigitalTrackInfo *getMP3Track(int track); */ AudioStream *makeMP3Stream(Common::File *file, uint32 size); -#endif +} // End of namespace Audio -#endif +#endif // #ifdef USE_MAD +#endif // #ifndef SOUND_MP3_H diff --git a/sound/softsynth/emumidi.h b/sound/softsynth/emumidi.h index b77d55dc6e..89124b8024 100644 --- a/sound/softsynth/emumidi.h +++ b/sound/softsynth/emumidi.h @@ -26,7 +26,7 @@ #define FIXP_SHIFT 16 -class MidiDriver_Emulated : public AudioStream, public MidiDriver { +class MidiDriver_Emulated : public Audio::AudioStream, public MidiDriver { protected: bool _isOpen; Audio::Mixer *_mixer; diff --git a/sound/voc.cpp b/sound/voc.cpp index 86abca3ce2..0fc224521e 100644 --- a/sound/voc.cpp +++ b/sound/voc.cpp @@ -31,6 +31,8 @@ #include "sound/voc.h" +namespace Audio { + int getSampleRateFromVOCRate(int vocSR) { if (vocSR == 0xa5 || vocSR == 0xa6) { return 11025; @@ -140,3 +142,5 @@ AudioStream *makeVOCStream(Common::ReadStream &stream) { return makeLinearInputStream(rate, Audio::Mixer::FLAG_AUTOFREE | Audio::Mixer::FLAG_UNSIGNED, data, size, 0, 0); } + +} // End of namespace Audio diff --git a/sound/voc.h b/sound/voc.h index 59ddc305ec..d53fcedcdf 100644 --- a/sound/voc.h +++ b/sound/voc.h @@ -27,9 +27,13 @@ #include "common/stdafx.h" #include "common/scummsys.h" -class AudioStream; namespace Common { class ReadStream; } +namespace Audio { + +class AudioStream; + + #if !defined(__GNUC__) #pragma START_PACK_STRUCTS #endif @@ -81,4 +85,6 @@ extern byte *loadVOCFromStream(Common::ReadStream &stream, int &size, int &rate) */ AudioStream *makeVOCStream(Common::ReadStream &stream); +} // End of namespace Audio + #endif diff --git a/sound/vorbis.cpp b/sound/vorbis.cpp index 7a8748b28b..002d75c170 100644 --- a/sound/vorbis.cpp +++ b/sound/vorbis.cpp @@ -44,6 +44,8 @@ using Common::File; +namespace Audio { + static AudioStream *makeVorbisStream(OggVorbis_File *file, int duration); #pragma mark - @@ -134,7 +136,7 @@ static int seek_wrap(void *datasource, ogg_int64_t offset, int whence) { f->curr_pos = f->file->pos() - f->start; #ifdef __SYMBIAN32__ - // For symbian we now store the last read position and then close the file + // For symbian we now store the last read position and then close the file if (f->file) { f->file->close(); } @@ -208,7 +210,7 @@ bool VorbisTrackInfo::openTrack() { #ifndef __SYMBIAN32__ _file->incRef(); #endif - } + } return err; } @@ -233,7 +235,7 @@ void VorbisTrackInfo::play(Audio::Mixer *mixer, Audio::SoundHandle *handle, int ov_time_seek(&_ov_file, (ogg_int64_t)(startFrame / 75.0 * 1000)); #endif #else - ov_time_seek(&_ov_file, startFrame / 75.0); + ov_time_seek(&_ov_file, startFrame / 75.0); #endif AudioStream *input = makeVorbisStream(&_ov_file, duration * ov_info(&_ov_file, -1)->rate / 75); @@ -392,7 +394,7 @@ AudioStream *makeVorbisStream(File *file, uint32 size) { #else f->file = file; #endif - f->start = file->pos(); + f->start = file->pos(); f->len = size; f->curr_pos = 0; @@ -400,12 +402,16 @@ AudioStream *makeVorbisStream(File *file, uint32 size) { warning("Invalid file format"); delete ov_file; delete f; - return 0; - } else { + return 0; + } else { #ifndef __SYMBIAN32__ file->incRef(); #endif return new VorbisInputStream(ov_file, 0, true); - } } -#endif +} + + +} // End of namespace Audio + +#endif // #ifdef USE_VORBIS diff --git a/sound/vorbis.h b/sound/vorbis.h index ee8943cdde..205f578e34 100644 --- a/sound/vorbis.h +++ b/sound/vorbis.h @@ -28,12 +28,15 @@ #ifdef USE_VORBIS -class AudioStream; -class DigitalTrackInfo; namespace Common { class File; } +namespace Audio { + +class AudioStream; +class DigitalTrackInfo; + DigitalTrackInfo *getVorbisTrack(int track); /** @@ -44,6 +47,7 @@ DigitalTrackInfo *getVorbisTrack(int track); */ AudioStream *makeVorbisStream(Common::File *file, uint32 size); -#endif +} // End of namespace Audio -#endif +#endif // #ifdef USE_VORBIS +#endif // #ifndef SOUND_VORBIS_H diff --git a/sound/wave.cpp b/sound/wave.cpp index dbee606a39..0256d23226 100644 --- a/sound/wave.cpp +++ b/sound/wave.cpp @@ -29,6 +29,8 @@ #include "sound/wave.h" #include "sound/adpcm.h" +namespace Audio { + bool loadWAVFromStream(Common::SeekableReadStream &stream, int &size, int &rate, byte &flags, uint16 *wavType, int *blockAlign_) { const uint32 initialPos = stream.pos(); byte buf[4+1]; @@ -181,3 +183,5 @@ AudioStream *makeWAVStream(Common::SeekableReadStream &stream) { return makeLinearInputStream(rate, flags, data, size, 0, 0); } + +} // End of namespace Audio diff --git a/sound/wave.h b/sound/wave.h index f0aca0c9fc..4c4c4ce644 100644 --- a/sound/wave.h +++ b/sound/wave.h @@ -26,9 +26,12 @@ #include "common/stdafx.h" #include "common/scummsys.h" -class AudioStream; namespace Common { class SeekableReadStream; } +namespace Audio { + +class AudioStream; + /** * Try to load a WAVE from the given seekable stream. Returns true if * successful. In that case, the stream's seek position will be set to the @@ -47,4 +50,6 @@ extern bool loadWAVFromStream(Common::SeekableReadStream &stream, int &size, int */ AudioStream *makeWAVStream(Common::SeekableReadStream &stream); +} // End of namespace Audio + #endif |
