| 31 | } |
| 32 | |
| 33 | void Device::processBuffer(const float* input, int inputStride, float* output, int outputStride, int frames) { |
| 34 | // Zero output since Ports might not write to all elements, or no Ports exist |
| 35 | std::fill_n(output, frames * outputStride, 0.f); |
| 36 | |
| 37 | std::lock_guard<std::mutex> lock(processMutex); |
| 38 | for (Port* port : subscribed) { |
| 39 | // Setting the thread context should probably be the responsibility of Port, but because processInput() etc are overridden, this is the only good place for it. |
| 40 | contextSet(port->context); |
| 41 | port->processInput(input + port->inputOffset, inputStride, frames); |
| 42 | } |
| 43 | for (Port* port : subscribed) { |
| 44 | contextSet(port->context); |
| 45 | port->processBuffer(input + port->inputOffset, inputStride, output + port->outputOffset, outputStride, frames); |
| 46 | } |
| 47 | for (Port* port : subscribed) { |
| 48 | contextSet(port->context); |
| 49 | port->processOutput(output + port->outputOffset, outputStride, frames); |
| 50 | } |
| 51 | } |
| 52 | |
| 53 | void Device::onStartStream() { |
| 54 | for (Port* port : subscribed) { |
no test coverage detected