diff --git a/src/modules/sound/SoundData.cpp b/src/modules/sound/SoundData.cpp index 8c680f77d..ee622be96 100644 --- a/src/modules/sound/SoundData.cpp +++ b/src/modules/sound/SoundData.cpp @@ -36,16 +36,10 @@ namespace sound SoundData::SoundData(Decoder * decoder) : data(0), size(0), sampleRate(Decoder::DEFAULT_SAMPLE_RATE), bits(0), channels(0) { + int decoded = decoder->decode(); - // Decode all data here. - while(!decoder->isFinished()) + while(decoded > 0) { - int decoded = decoder->decode(); - - // If this returns 0, then we're probably at EOF. - if(decoded <= 0) - break; - // Expand or allocate buffer. Note that realloc may move // memory to other locations. data = (char*)realloc(data, size + decoder->getSize()); @@ -55,6 +49,8 @@ namespace sound // Keep this up to date. size += decoded; + + decoded = decoder->decode(); } channels = decoder->getChannels(); diff --git a/src/modules/sound/lullaby/ModPlugDecoder.cpp b/src/modules/sound/lullaby/ModPlugDecoder.cpp index 898081b3c..576843f49 100644 --- a/src/modules/sound/lullaby/ModPlugDecoder.cpp +++ b/src/modules/sound/lullaby/ModPlugDecoder.cpp @@ -45,6 +45,8 @@ namespace lullaby // Load the module. plug = ModPlug_Load(data->getData(), data->getSize()); + ModPlug_SetMasterVolume(plug, 512); + if(plug == 0) throw love::Exception("Could not load file with ModPlug."); } diff --git a/src/modules/sound/lullaby/VorbisDecoder.cpp b/src/modules/sound/lullaby/VorbisDecoder.cpp index 032f4da63..4d66921bb 100644 --- a/src/modules/sound/lullaby/VorbisDecoder.cpp +++ b/src/modules/sound/lullaby/VorbisDecoder.cpp @@ -272,7 +272,6 @@ namespace lullaby int VorbisDecoder::getBits() const { - //return vorbisInfo->bitrate_nominal / 10000; return 16; }