hpi-swa-teaching / GameMecha

A library providing implementations for common patterns in Squeak/Smalltalk game development.
MIT License
12 stars 2 forks source link

Sometimes Error in SoundLoader storeResourceInMethod[...] #77

Open ekrebs5 opened 5 years ago

ekrebs5 commented 5 years ago

Sometimes a MixedSound is created instead of a SampledSound, causing the method to fail. In this case, all sounds in the MixedSound should be serialized and a method created that combines them.

JoeAtHPI commented 4 years ago

This defect can be reproduced when the audio file has two channels. In this case, a MixedSound instead a SampledSound is returned This can be found in SampledSound >> fromWaveStream: fileStream:

channels = 2 ifTrue: [
        leftAndRight := data splitStereo.
        ^ MixedSound new
            add: (self samples: leftAndRight first samplingRate: samplingRate) pan: 0.0;
            add: (self samples: leftAndRight last samplingRate: samplingRate) pan: 1.0;
            yourself].