diff options
Diffstat (limited to 'sound/vorbis.cpp')
-rw-r--r-- | sound/vorbis.cpp | 80 |
1 files changed, 0 insertions, 80 deletions
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 |