|
@@ -31,6 +31,9 @@ void Device::unsubscribe(Port* port) { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
void Device::processBuffer(const float* input, int inputStride, float* output, int outputStride, int frames) { |
|
|
void Device::processBuffer(const float* input, int inputStride, float* output, int outputStride, int frames) { |
|
|
|
|
|
// Zero output since Ports might not write to all elements, or no Ports exist |
|
|
|
|
|
std::fill_n(output, frames * outputStride, 0.f); |
|
|
|
|
|
|
|
|
std::lock_guard<std::mutex> lock(processMutex); |
|
|
std::lock_guard<std::mutex> lock(processMutex); |
|
|
for (Port* port : subscribed) { |
|
|
for (Port* port : subscribed) { |
|
|
// 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. |
|
|
// 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. |
|
@@ -45,11 +48,6 @@ void Device::processBuffer(const float* input, int inputStride, float* output, i |
|
|
contextSet(port->context); |
|
|
contextSet(port->context); |
|
|
port->processOutput(output + port->outputOffset, outputStride, frames); |
|
|
port->processOutput(output + port->outputOffset, outputStride, frames); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if (subscribed.empty()) { |
|
|
|
|
|
// Clear output if no Port writes values to it. |
|
|
|
|
|
std::fill_n(output, frames * outputStride, 0.f); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
void Device::onStartStream() { |
|
|
void Device::onStartStream() { |
|
|