MCPcopy Create free account
hub / github.com/GaijinEntertainment/daScript / data_callback

Function data_callback

modules/dasAudio/src/dasAudio.cpp:261–275  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

259}
260
261void data_callback(ma_device*, void* pOutput, const void*, ma_uint32 frameCount) {
262 float fdt = 1.0f / float(g_rate);
263 Array buffer;
264 array_mark_locked(buffer, pOutput, frameCount * g_channels);
265 lock_guard<recursive_mutex> guard(*g_mixer_context->contextMutex);
266 auto saved = daScriptEnvironment::exchangeBound(g_mixer_env);
267 g_mixer_context->restart();
268 if ( !g_mixer_context.get()->runWithCatch([&](){
269 das_invoke_function<void>::invoke<Array&,int32_t,int32_t>(g_mixer_context.get(),nullptr,g_mixer_function,buffer,g_channels,g_rate,fdt);
270 }) ) {
271 g_mixer_context->to_err(&g_mixer_context->exceptionAt, g_mixer_context->getException());
272 g_mixer_context->clearException();
273 }
274 daScriptEnvironment::setBound(saved);
275}
276
277Context & dasAudio_mixerContext ( Context * context, LineInfoArg * at ) {
278 if ( !g_mixer_context ) context->throw_error_at(at,"sound mixer is not initialized");

Callers

nothing calls this directly

Calls 4

array_mark_lockedFunction · 0.85
runWithCatchMethod · 0.80
clearExceptionMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected