mirror of
https://github.com/love2d/love.git
synced 2026-08-17 11:00:31 +02:00
Make love.sound.newDecoder accept FileData, and make File->read return FileData
This commit is contained in:
@@ -51,10 +51,9 @@ const char *Sound::getName() const
|
||||
return "love.sound.lullaby";
|
||||
}
|
||||
|
||||
sound::Decoder *Sound::newDecoder(love::filesystem::File *file, int bufferSize)
|
||||
sound::Decoder *Sound::newDecoder(love::filesystem::FileData *data, int bufferSize)
|
||||
{
|
||||
Data *data = file->read();
|
||||
std::string ext = file->getExtension();
|
||||
std::string ext = data->getExtension();
|
||||
|
||||
sound::Decoder *decoder = 0;
|
||||
|
||||
@@ -76,8 +75,6 @@ sound::Decoder *Sound::newDecoder(love::filesystem::File *file, int bufferSize)
|
||||
|
||||
// else if (OtherDecoder::accept(ext))
|
||||
|
||||
data->release();
|
||||
|
||||
return decoder;
|
||||
}
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@ public:
|
||||
const char *getName() const;
|
||||
|
||||
/// @copydoc love::sound::Sound::newDecoder
|
||||
sound::Decoder *newDecoder(love::filesystem::File *file, int bufferSize);
|
||||
sound::Decoder *newDecoder(love::filesystem::FileData *file, int bufferSize);
|
||||
|
||||
}; // Sound
|
||||
|
||||
@@ -67,4 +67,4 @@ public:
|
||||
} // sound
|
||||
} // love
|
||||
|
||||
#endif // LOVE_SOUND_LULLABY_SOUND_H
|
||||
#endif // LOVE_SOUND_LULLABY_SOUND_H
|
||||
|
||||
Reference in New Issue
Block a user