MCPcopy Create free account
hub / github.com/TheForceEngine/TheForceEngine / addSoundData

Function addSoundData

TheForceEngine/TFE_Asset/vocAsset.cpp:178–194  ·  view source on GitHub ↗

Each sound block can have a different sampleRate but Dark Forces does not use this capability. Dark Forces requires the 8 bit codec to be used.

Source from the content-addressed store, hash-verified

176 // Each sound block can have a different sampleRate but Dark Forces does not use this capability.
177 // Dark Forces requires the 8 bit codec to be used.
178 void addSoundData(SoundBuffer* voc, s32 sampleRate, u8 codec, const u8* soundData, u32 size)
179 {
180 // Some mods have sounds with codec == 13 which is invalid, reset to 8 bits in that case.
181 if (codec == 13)
182 {
183 codec = CODEC_8BITS;
184 }
185 assert(codec == CODEC_8BITS);
186 voc->sampleRate = sampleRate;
187 // For some reason Dark Forces VOCs specify 10989Hz sample rate but are played back by the engine at 11025Hz
188 // So just change it here so the sound system doesn't try to resample.
189 if (voc->sampleRate == 10989)
190 {
191 voc->sampleRate = 11025;
192 }
193 continueSoundData(voc, soundData, size);
194 }
195
196 void addSilence(SoundBuffer* voc, s32 sampleRate, u32 silenceLen)
197 {

Callers 1

parseVocFunction · 0.85

Calls 1

continueSoundDataFunction · 0.85

Tested by

no test coverage detected