| 259 | } |
| 260 | |
| 261 | void 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 | |
| 277 | Context & dasAudio_mixerContext ( Context * context, LineInfoArg * at ) { |
| 278 | if ( !g_mixer_context ) context->throw_error_at(at,"sound mixer is not initialized"); |
nothing calls this directly
no test coverage detected