mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-22 08:04:49 -05:00
Fix audio sink/source mapping
This commit is contained in:
parent
556cc8ad45
commit
32aee52ab3
@ -339,11 +339,17 @@ void AudioDeviceManager::addAudioSink(AudioFifo* audioFifo, MessageQueue *sample
|
|||||||
|
|
||||||
if (audioOutputDeviceIndex != outputDeviceIndex) // change of audio device
|
if (audioOutputDeviceIndex != outputDeviceIndex) // change of audio device
|
||||||
{
|
{
|
||||||
removeAudioSink(audioFifo); // remove from current
|
// remove from current
|
||||||
|
m_audioOutputs[audioOutputDeviceIndex]->removeFifo(audioFifo);
|
||||||
|
if ((audioOutputDeviceIndex != -1) && (m_audioOutputs[audioOutputDeviceIndex]->getNbFifos() == 0)) {
|
||||||
|
stopAudioOutput(audioOutputDeviceIndex);
|
||||||
|
}
|
||||||
|
|
||||||
m_audioOutputs[outputDeviceIndex]->addFifo(audioFifo); // add to new
|
m_audioOutputs[outputDeviceIndex]->addFifo(audioFifo); // add to new
|
||||||
m_audioSinkFifos[audioFifo] = outputDeviceIndex; // new index
|
m_audioSinkFifos[audioFifo] = outputDeviceIndex; // new index
|
||||||
m_outputDeviceSinkMessageQueues[audioOutputDeviceIndex].removeOne(sampleSinkMessageQueue);
|
m_outputDeviceSinkMessageQueues[audioOutputDeviceIndex].removeOne(m_audioFifoToSinkMessageQueues[audioFifo]);
|
||||||
m_outputDeviceSinkMessageQueues[outputDeviceIndex].append(sampleSinkMessageQueue);
|
m_outputDeviceSinkMessageQueues[outputDeviceIndex].append(sampleSinkMessageQueue);
|
||||||
|
m_audioFifoToSinkMessageQueues[audioFifo] = sampleSinkMessageQueue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -416,6 +422,9 @@ void AudioDeviceManager::addAudioSource(AudioFifo* audioFifo, MessageQueue *samp
|
|||||||
if (m_audioSourceFifos.find(audioFifo) == m_audioSourceFifos.end()) // new FIFO
|
if (m_audioSourceFifos.find(audioFifo) == m_audioSourceFifos.end()) // new FIFO
|
||||||
{
|
{
|
||||||
m_audioInputs[inputDeviceIndex]->addFifo(audioFifo);
|
m_audioInputs[inputDeviceIndex]->addFifo(audioFifo);
|
||||||
|
m_audioSourceFifos[audioFifo] = inputDeviceIndex; // register audio FIFO
|
||||||
|
m_audioFifoToSourceMessageQueues[audioFifo] = sampleSourceMessageQueue;
|
||||||
|
m_inputDeviceSourceMessageQueues[inputDeviceIndex].append(sampleSourceMessageQueue);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -423,14 +432,19 @@ void AudioDeviceManager::addAudioSource(AudioFifo* audioFifo, MessageQueue *samp
|
|||||||
|
|
||||||
if (audioInputDeviceIndex != inputDeviceIndex) // change of audio device
|
if (audioInputDeviceIndex != inputDeviceIndex) // change of audio device
|
||||||
{
|
{
|
||||||
removeAudioSource(audioFifo); // remove from current
|
// remove from current
|
||||||
m_audioInputs[inputDeviceIndex]->addFifo(audioFifo); // add to new
|
m_audioInputs[audioInputDeviceIndex]->removeFifo(audioFifo);
|
||||||
}
|
if ((audioInputDeviceIndex != -1) && (m_audioInputs[audioInputDeviceIndex]->getNbFifos() == 0)) {
|
||||||
|
stopAudioInput(audioInputDeviceIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_audioSourceFifos[audioFifo] = inputDeviceIndex; // register audio FIFO
|
m_audioInputs[inputDeviceIndex]->addFifo(audioFifo); // add to new
|
||||||
|
m_audioSourceFifos[audioFifo] = inputDeviceIndex; // new index
|
||||||
|
m_outputDeviceSinkMessageQueues[audioInputDeviceIndex].removeOne(m_audioFifoToSourceMessageQueues[audioFifo]);
|
||||||
|
m_inputDeviceSourceMessageQueues[inputDeviceIndex].append(sampleSourceMessageQueue);
|
||||||
m_audioFifoToSourceMessageQueues[audioFifo] = sampleSourceMessageQueue;
|
m_audioFifoToSourceMessageQueues[audioFifo] = sampleSourceMessageQueue;
|
||||||
m_outputDeviceSinkMessageQueues[inputDeviceIndex].append(sampleSourceMessageQueue);
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void AudioDeviceManager::removeAudioSource(AudioFifo* audioFifo)
|
void AudioDeviceManager::removeAudioSource(AudioFifo* audioFifo)
|
||||||
|
Loading…
Reference in New Issue
Block a user