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

Function sampleBuffer

TheForceEngine/TFE_Audio/audioSystem.cpp:444–455  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

442 }
443
444 f32 sampleBuffer(u32 index, SoundDataType type, const u8* data)
445 {
446 f32 sampleValue = 0.0f;
447 switch (type)
448 {
449 case SOUND_DATA_8BIT: { sampleValue = (f32)data[index]; } break;
450 case SOUND_DATA_16BIT: { sampleValue = (f32)(*((u16*)data + index)); } break;
451 case SOUND_DATA_FLOAT: { sampleValue = *((f32*)data + index); } break;
452 };
453
454 return sampleValue * c_scale[type] + c_offset[type];
455 }
456
457 // Audio callback
458 static void audioCallback(void* userData, unsigned char* outputBuffer, int bufsize)

Callers 1

audioCallbackFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected