diff options
Diffstat (limited to 'sound/mp3.cpp')
-rw-r--r-- | sound/mp3.cpp | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/sound/mp3.cpp b/sound/mp3.cpp index 556a43cdb3..27938b7aa0 100644 --- a/sound/mp3.cpp +++ b/sound/mp3.cpp @@ -261,7 +261,7 @@ int MP3InputStream::readBuffer(int16 *buffer, const int numSamples) { return samples; } -AudioStream *makeMP3Stream(File *file, uint size) { +AudioStream *makeMP3Stream(File *file, uint32 size) { return new MP3InputStream(file, mad_timer_zero, size); } @@ -385,8 +385,21 @@ MP3TrackInfo::~MP3TrackInfo() { _file->close(); } -DigitalTrackInfo *makeMP3TrackInfo(File *file) { - return new MP3TrackInfo(file); +DigitalTrackInfo *getMP3Track(int track) { + char track_name[32]; + File *file = new File(); + + sprintf(track_name, "track%d.mp3", track); + file->open(track_name); + + if (file->isOpen()) { + MP3TrackInfo *trackInfo = new MP3TrackInfo(file); + if (!trackInfo->error()) + return trackInfo; + delete trackInfo; + } + delete file; + return NULL; } |