Browse Source

Get numInputs, numOutputs, and sampleRate each audio block in Audio, instead of when the stream opens.

tags/v2.0.0
Andrew Belt 3 years ago
parent
commit
faaaa7f620
1 changed files with 5 additions and 4 deletions
  1. +5
    -4
      src/core/Audio.cpp

+ 5
- 4
src/core/Audio.cpp View File

@@ -52,6 +52,10 @@ struct AudioPort : audio::Port {
} }


void processInput(const float* input, int inputStride, int frames) override { void processInput(const float* input, int inputStride, int frames) override {
deviceNumInputs = std::min(getNumInputs(), NUM_AUDIO_OUTPUTS);
deviceNumOutputs = std::min(getNumOutputs(), NUM_AUDIO_INPUTS);
deviceSampleRate = getSampleRate();

// DEBUG("%p: new device block ____________________________", this); // DEBUG("%p: new device block ____________________________", this);
// Claim master module if there is none // Claim master module if there is none
if (!APP->engine->getMasterModule()) { if (!APP->engine->getMasterModule()) {
@@ -159,12 +163,9 @@ struct AudioPort : audio::Port {
} }


void onStartStream() override { void onStartStream() override {
deviceNumInputs = std::min(getNumInputs(), NUM_AUDIO_OUTPUTS);
deviceNumOutputs = std::min(getNumOutputs(), NUM_AUDIO_INPUTS);
deviceSampleRate = getSampleRate();
engineInputBuffer.clear(); engineInputBuffer.clear();
engineOutputBuffer.clear(); engineOutputBuffer.clear();
// DEBUG("onStartStream %d %d %f", deviceNumInputs, deviceNumOutputs, deviceSampleRate);
// DEBUG("onStartStream");
} }


void onStopStream() override { void onStopStream() override {


Loading…
Cancel
Save