| 16 | using namespace lab; |
| 17 | |
| 18 | void lab::pull_graph(AudioContext * ctx, AudioNodeInput * required_inlet, AudioBus * src, AudioBus * dst, int frames, |
| 19 | const SamplingInfo & info, AudioHardwareInput * optional_hardware_input) |
| 20 | { |
| 21 | // The audio system might still be invoking callbacks during shutdown, so bail out if so. |
| 22 | if (!ctx) |
| 23 | return; |
| 24 | |
| 25 | // bail if shutting down. |
| 26 | auto ac = ctx->audioContextInterface().lock(); |
| 27 | if (!ac) |
| 28 | return; |
| 29 | |
| 30 | ASSERT(required_inlet); |
| 31 | |
| 32 | ContextRenderLock renderLock(ctx, "lab::pull_graph"); |
| 33 | if (!renderLock.context()) return; // return if couldn't acquire lock |
| 34 | |
| 35 | if (!ctx->isInitialized()) |
| 36 | { |
| 37 | if (dst) |
| 38 | dst->zero(); |
| 39 | return; |
| 40 | } |
| 41 | |
| 42 | // Denormals can slow down audio processing. |
| 43 | // Use an RAII object to protect all AudioNodes processed within this scope. |
| 44 | |
| 45 | /// @TODO under what circumstance do they arise? |
| 46 | /// If they come from input data such as loaded WAV files, they should be corrected |
| 47 | /// at source. If they can result from signal processing; again, where? The |
| 48 | /// signal processing should not produce denormalized values. |
| 49 | |
| 50 | DenormalDisabler denormalDisabler; |
| 51 | |
| 52 | // Let the context take care of any business at the start of each render quantum. |
| 53 | ctx->handlePreRenderTasks(renderLock); |
| 54 | |
| 55 | // Prepare the local audio input provider for this render quantum. |
| 56 | if (optional_hardware_input && src) |
| 57 | { |
| 58 | optional_hardware_input->set(src); |
| 59 | } |
| 60 | |
| 61 | // process the graph by pulling the inputs, which will recurse the entire processing graph. |
| 62 | AudioBus * renderedBus = required_inlet->pull(renderLock, dst, frames); |
| 63 | |
| 64 | if (dst) { |
| 65 | if (!renderedBus) |
| 66 | { |
| 67 | dst->zero(); |
| 68 | } |
| 69 | else if (renderedBus != dst) |
| 70 | { |
| 71 | // in-place processing was not possible - so copy |
| 72 | dst->copyFrom(*renderedBus); |
| 73 | } |
| 74 | } |
| 75 |
nothing calls this directly
no test coverage detected