1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-16 11:33:03 +01:00

Fix flac decoding

This commit is contained in:
Ted John
2022-05-17 22:43:10 +01:00
parent 03d7bb0995
commit 5be41b65f4
2 changed files with 11 additions and 2 deletions

View File

@@ -276,10 +276,11 @@ namespace OpenRCT2::Audio
// Allocate room on decode buffer
auto& decodeBuffer = self->_decodeBuffer;
auto oldSize = decodeBuffer.size();
decodeBuffer.resize(decodeBuffer.size() + frameSize);
// Copy decoded data to buffer
auto dst0 = reinterpret_cast<int16_t*>(decodeBuffer.data());
auto dst0 = reinterpret_cast<int16_t*>(decodeBuffer.data() + oldSize);
for (int32_t i = 0; i < channels; i++)
{
auto* dst = dst0 + i;

View File

@@ -18,6 +18,11 @@
namespace OpenRCT2::Audio
{
#ifdef __WARN_SUGGEST_FINAL_METHODS__
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wsuggest-final-methods"
# pragma GCC diagnostic ignored "-Wsuggest-final-types"
#endif
class SDLAudioSource : public IAudioSource
{
private:
@@ -26,7 +31,7 @@ namespace OpenRCT2::Audio
public:
void Release() override;
int32_t GetBytesPerSecond() const override;
bool IsReleased() const;
bool IsReleased() const override;
std::unique_ptr<SDLAudioSource> ToMemory(const AudioFormat& target);
virtual AudioFormat GetFormat() const = 0;
@@ -34,6 +39,9 @@ namespace OpenRCT2::Audio
protected:
virtual void Unload() = 0;
};
#ifdef __WARN_SUGGEST_FINAL_METHODS__
# pragma GCC diagnostic pop
#endif
std::unique_ptr<SDLAudioSource> CreateAudioSource(SDL_RWops* rw);
std::unique_ptr<SDLAudioSource> CreateAudioSource(SDL_RWops* rw, uint32_t cssIndex);