diff options
author | Max Horn | 2007-04-14 18:51:38 +0000 |
---|---|---|
committer | Max Horn | 2007-04-14 18:51:38 +0000 |
commit | 2aeb84f12a8c5f585399be8a4b4087f45ce27e13 (patch) | |
tree | c8b176489c37b8238ed225c07dbee0d0a1fb6028 | |
parent | adb0f89ae3632df1ce27f4304ea74861de749274 (diff) | |
download | scummvm-rg350-2aeb84f12a8c5f585399be8a4b4087f45ce27e13.tar.gz scummvm-rg350-2aeb84f12a8c5f585399be8a4b4087f45ce27e13.tar.bz2 scummvm-rg350-2aeb84f12a8c5f585399be8a4b4087f45ce27e13.zip |
Got rid of the last traces of DigitalTrackInfo
svn-id: r26477
-rw-r--r-- | sound/audiocd.h | 9 | ||||
-rw-r--r-- | sound/flac.cpp | 90 | ||||
-rw-r--r-- | sound/flac.h | 3 | ||||
-rw-r--r-- | sound/mp3.cpp | 87 | ||||
-rw-r--r-- | sound/mp3.h | 3 | ||||
-rw-r--r-- | sound/vorbis.cpp | 80 | ||||
-rw-r--r-- | sound/vorbis.h | 3 |
7 files changed, 0 insertions, 275 deletions
diff --git a/sound/audiocd.h b/sound/audiocd.h index 6b5184532f..281bf1b1b4 100644 --- a/sound/audiocd.h +++ b/sound/audiocd.h @@ -32,15 +32,6 @@ namespace Audio { -class DigitalTrackInfo { -public: - virtual ~DigitalTrackInfo() {} - - virtual void play(Mixer *mixer, SoundHandle *handle, int numLoops, int startFrame, int duration) = 0; -// virtual void stop(); -}; - - class AudioCDManager : public Common::Singleton<AudioCDManager> { public: struct Status { diff --git a/sound/flac.cpp b/sound/flac.cpp index 61e8800c31..215ccee26e 100644 --- a/sound/flac.cpp +++ b/sound/flac.cpp @@ -770,96 +770,6 @@ AudioStream *makeFlacStream( return input; } - -#pragma mark - -#pragma mark --- Flac Audio CD emulation --- -#pragma mark - - - -class FlacTrackInfo : public DigitalTrackInfo { -private: - Common::String _filename; - bool _errorFlag; - -public: - FlacTrackInfo(const char *filename); - bool error() { return _errorFlag; } - void play(Mixer *mixer, SoundHandle *handle, int numLoops, int startFrame, int duration); -}; - -FlacTrackInfo::FlacTrackInfo(const char *filename) : - _filename(filename), - _errorFlag(false) { - - // Try to open the file - Common::File file; - if (!file.open(_filename)) { - _errorFlag = true; - return; - } - - // Next, try to create a FlacInputStream from it - FlacInputStream *tempStream = new FlacInputStream(&file, false); - - // If initialising the stream fails, we set the error flag - if (!tempStream || !tempStream->isStreamDecoderReady()) - _errorFlag = true; - - delete tempStream; -} - -void FlacTrackInfo::play(Mixer *mixer, SoundHandle *handle, int numLoops, int startFrame, int duration) { - assert(!_errorFlag); - - if (error()) { - debug(1, "FlacTrackInfo::play: invalid state, method should not been called"); - } - - // Open the file - Common::File *file = new Common::File(); - if (!file || !file->open(_filename)) { - warning("FlacTrackInfo::play: failed to open '%s'", _filename.c_str()); - delete file; - return; - } - - // Convert startFrame & duration from frames (1/75 s) to milliseconds (1/1000s) - uint start = startFrame * 1000 / 75; - uint end = duration ? ((startFrame + duration) * 1000 / 75) : 0; - - // ... create an AudioStream ... - FlacInputStream *input = new FlacInputStream(file, true, start, end, numLoops); - if (!input->isStreamDecoderReady()) { - delete input; - return; - } - - // ... and play it - mixer->playInputStream(Audio::Mixer::kMusicSoundType, handle, input); -} - -DigitalTrackInfo* getFlacTrack(int track) { - assert(track >= 1); - char trackName[4][32]; - - sprintf(trackName[0], "track%d.flac", track); - sprintf(trackName[1], "track%02d.flac", track); - sprintf(trackName[2], "track%d.fla", track); - sprintf(trackName[3], "track%02d.fla", track); - - for (int i = 0; i < 4; ++i) { - if (Common::File::exists(trackName[i])) { - FlacTrackInfo *trackInfo = new FlacTrackInfo(trackName[i]); - if (!trackInfo->error()) - return trackInfo; - delete trackInfo; - } - } - - return NULL; -} - - } // End of namespace Audio #endif // #ifdef USE_FLAC diff --git a/sound/flac.h b/sound/flac.h index 787a8ad79c..4b4acb3228 100644 --- a/sound/flac.h +++ b/sound/flac.h @@ -36,9 +36,6 @@ namespace Common { namespace Audio { class AudioStream; -class DigitalTrackInfo; - -DigitalTrackInfo *getFlacTrack(int track); /** * Create a new AudioStream from the FLAC data in the given diff --git a/sound/mp3.cpp b/sound/mp3.cpp index ff0e3d61dd..f9efdc4e8c 100644 --- a/sound/mp3.cpp +++ b/sound/mp3.cpp @@ -339,93 +339,6 @@ AudioStream *makeMP3Stream( return new MP3InputStream(stream, disposeAfterUse, start, end, numLoops); } - -#pragma mark - -#pragma mark --- MP3 Audio CD emulation --- -#pragma mark - - - -class MP3TrackInfo : public DigitalTrackInfo { -private: - Common::String _filename; - bool _errorFlag; - -public: - MP3TrackInfo(const char *filename); - bool error() { return _errorFlag; } - void play(Mixer *mixer, SoundHandle *handle, int numLoops, int startFrame, int duration); -}; - -MP3TrackInfo::MP3TrackInfo(const char *filename) : - _filename(filename), - _errorFlag(false) { - - // Try to open the file - Common::File file; - if (!file.open(_filename)) { - _errorFlag = true; - return; - } - - // Next, try to create an MP3InputStream from it - MP3InputStream *tempStream = new MP3InputStream(&file, false); - - // If we see EOS here then that means that not (enough) valid input - // data was given. - _errorFlag = tempStream->endOfData(); - - // Clean up again - delete tempStream; -} - -void MP3TrackInfo::play(Mixer *mixer, SoundHandle *handle, int numLoops, int startFrame, int duration) { - assert(!_errorFlag); - - mad_timer_t start; - mad_timer_t end; - - // Both startFrame and duration are given in frames, where 75 frames are one second. - // Calculate the appropriate mad_timer_t values from them. - mad_timer_set(&start, startFrame / 75, startFrame % 75, 75); - if (duration == 0) { - end = mad_timer_zero; - } else { - int endFrame = startFrame + duration; - mad_timer_set(&end, endFrame / 75, endFrame % 75, 75); - } - - // Open the file - Common::File *file = new Common::File(); - if (!file || !file->open(_filename)) { - warning("MP3TrackInfo::play: failed to open '%s'", _filename.c_str()); - delete file; - return; - } - - // ... create an AudioStream ... - MP3InputStream *input = new MP3InputStream(file, true, start, end, numLoops); - - // ... and play it - mixer->playInputStream(Audio::Mixer::kMusicSoundType, handle, input); -} - -DigitalTrackInfo *getMP3Track(int track) { - char trackName[2][32]; - - sprintf(trackName[0], "track%d.mp3", track); - sprintf(trackName[1], "track%02d.mp3", track); - - for (int i = 0; i < 2; ++i) { - if (Common::File::exists(trackName[i])) { - MP3TrackInfo *trackInfo = new MP3TrackInfo(trackName[i]); - if (!trackInfo->error()) - return trackInfo; - delete trackInfo; - } - } - return NULL; -} - } // End of namespace Audio #endif // #ifdef USE_MAD diff --git a/sound/mp3.h b/sound/mp3.h index 354e880404..d4992ce10f 100644 --- a/sound/mp3.h +++ b/sound/mp3.h @@ -36,9 +36,6 @@ namespace Common { namespace Audio { class AudioStream; -class DigitalTrackInfo; - -DigitalTrackInfo *getMP3Track(int track); /** * Create a new AudioStream from the MP3 data in the given diff --git a/sound/vorbis.cpp b/sound/vorbis.cpp index 9b88020974..7e9d9dc286 100644 --- a/sound/vorbis.cpp +++ b/sound/vorbis.cpp @@ -293,86 +293,6 @@ AudioStream *makeVorbisStream( } -#pragma mark - -#pragma mark --- Ogg Vorbis Audio CD emulation --- -#pragma mark - - - -class VorbisTrackInfo : public DigitalTrackInfo { -private: - Common::String _filename; - bool _errorFlag; - -public: - VorbisTrackInfo(const char *filename); - bool error() { return _errorFlag; } - void play(Mixer *mixer, SoundHandle *handle, int numLoops, int startFrame, int duration); -}; - -VorbisTrackInfo::VorbisTrackInfo(const char *filename) : - _filename(filename), - _errorFlag(false) { - - - // Try to open the file - Common::File file; - if (!file.open(_filename)) { - _errorFlag = true; - return; - } - - // Next, try to create a VorbisInputStream from it - VorbisInputStream *tempStream = new VorbisInputStream(&file, false); - - // If an error occured... - // TODO: add an error or init method to VorbisInputStream - _errorFlag = tempStream->endOfData(); - - // Clean up again - delete tempStream; -} - -void VorbisTrackInfo::play(Mixer *mixer, SoundHandle *handle, int numLoops, int startFrame, int duration) { - assert(!_errorFlag); - - // Open the file - Common::File *file = new Common::File(); - if (!file || !file->open(_filename)) { - warning("VorbisTrackInfo::play: failed to open '%s'", _filename.c_str()); - delete file; - return; - } - - // Convert startFrame & duration from frames (1/75 s) to milliseconds (1/1000s), - // i.e. multiply with a factor of 1000/75 = 40/3. - uint start = startFrame * 40 / 3; - uint end = duration ? ((startFrame + duration) * 40 / 3) : 0; - - // ... create an AudioStream ... - VorbisInputStream *input = new VorbisInputStream(file, true, start, end, numLoops); - - // ... and play it - mixer->playInputStream(Audio::Mixer::kMusicSoundType, handle, input); -} - -DigitalTrackInfo *getVorbisTrack(int track) { - char trackName[2][32]; - - sprintf(trackName[0], "track%d.ogg", track); - sprintf(trackName[1], "track%02d.ogg", track); - - for (int i = 0; i < 2; ++i) { - if (Common::File::exists(trackName[i])) { - VorbisTrackInfo *trackInfo = new VorbisTrackInfo(trackName[i]); - if (!trackInfo->error()) - return trackInfo; - delete trackInfo; - } - } - return NULL; -} - - } // End of namespace Audio #endif // #ifdef USE_VORBIS diff --git a/sound/vorbis.h b/sound/vorbis.h index 9d702172df..88ef913360 100644 --- a/sound/vorbis.h +++ b/sound/vorbis.h @@ -36,9 +36,6 @@ namespace Common { namespace Audio { class AudioStream; -class DigitalTrackInfo; - -DigitalTrackInfo *getVorbisTrack(int track); /** * Create a new AudioStream from the Ogg Vorbis data in the given |