Skip to content

Commit

Permalink
DeviceManager: Avoided some unnecessary calls to rebuildWaveDeviceList()
Browse files Browse the repository at this point in the history
  • Loading branch information
drowaudio committed Jan 17, 2024
1 parent d627283 commit d59559c
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions modules/tracktion_engine/playback/tracktion_DeviceManager.cpp
Expand Up @@ -77,7 +77,7 @@ static juce::StringArray getMidiDeviceNames (juce::Array<juce::MidiDeviceInfo> d
deviceNames.add (d.name);

deviceNames.appendNumbersToDuplicates (true, false);

return deviceNames;
}

Expand Down Expand Up @@ -134,7 +134,7 @@ struct DeviceManager::WaveDeviceList
for (int i = 0; i < channelNames.size(); ++i)
{
const bool canBeStereo = i < channelNames.size() - 1;

if (canBeStereo && (isInput ? dm.isDeviceInChannelStereo (i) : dm.isDeviceOutChannelStereo (i)))
{
descriptions.push_back (WaveDeviceDescription (mergeTwoNames (channelNames[i], channelNames[i + 1]),
Expand Down Expand Up @@ -330,10 +330,10 @@ void DeviceManager::initialiseMidi()
TRACKTION_LOG ("Finding MIDI I/O");
if (openHardwareMidi)
lastMidiInNames = getMidiDeviceNames (juce::MidiInput::getAvailableDevices());

if (openHardwareMidi)
lastMidiOutNames = getMidiDeviceNames (juce::MidiOutput::getAvailableDevices());

int enabledMidiIns = 0, enabledMidiOuts = 0;

// create all the devices before initialising them..
Expand Down Expand Up @@ -912,7 +912,9 @@ void DeviceManager::setDeviceInChannelStereo (int chan, bool isStereoPair)
{
chan &= ~1;

if (inStereoChans[chan / 2] != isStereoPair)
if (inStereoChans[chan / 2] == isStereoPair)
return;

{
inStereoChans.setBit (chan / 2, isStereoPair);

Expand Down Expand Up @@ -1250,7 +1252,7 @@ void DeviceManager::audioDeviceAboutToStart (juce::AudioIODevice* device)
cpuAvgCounter = cpuReportingInterval = 1;

jassert (currentSampleRate > 0.0);

#if JUCE_ANDROID
steadyLoadContext.setSampleRate (device->getCurrentSampleRate());
#endif
Expand Down

0 comments on commit d59559c

Please sign in to comment.