mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
AudioDeviceSelectorComponent: Avoid assertions when recreating AudioDeviceSettingsPanel
This commit is contained in:
parent
3ee03cadd9
commit
42100c9341
1 changed files with 93 additions and 98 deletions
|
|
@ -213,8 +213,9 @@ class AudioDeviceSettingsPanel : public Component,
|
|||
{
|
||||
public:
|
||||
AudioDeviceSettingsPanel (AudioIODeviceType& t, AudioDeviceSetupDetails& setupDetails,
|
||||
const bool hideAdvancedOptionsWithButton)
|
||||
: type (t), setup (setupDetails)
|
||||
const bool hideAdvancedOptionsWithButton,
|
||||
AudioDeviceSelectorComponent& p)
|
||||
: type (t), setup (setupDetails), parent (p)
|
||||
{
|
||||
if (hideAdvancedOptionsWithButton)
|
||||
{
|
||||
|
|
@ -237,13 +238,11 @@ public:
|
|||
}
|
||||
|
||||
void resized() override
|
||||
{
|
||||
if (auto* parent = findParentComponentOfClass<AudioDeviceSelectorComponent>())
|
||||
{
|
||||
Rectangle<int> r (proportionOfWidth (0.35f), 0, proportionOfWidth (0.6f), 3000);
|
||||
|
||||
const int maxListBoxHeight = 100;
|
||||
const int h = parent->getItemHeight();
|
||||
const int h = parent.getItemHeight();
|
||||
const int space = h / 4;
|
||||
|
||||
if (outputDeviceDropDown != nullptr)
|
||||
|
|
@ -348,11 +347,6 @@ public:
|
|||
|
||||
setSize (getWidth(), r.getY());
|
||||
}
|
||||
else
|
||||
{
|
||||
jassertfalse;
|
||||
}
|
||||
}
|
||||
|
||||
void updateConfig (bool updateOutputDevice, bool updateInputDevice, bool updateSampleRate, bool updateBufferSize)
|
||||
{
|
||||
|
|
@ -542,6 +536,7 @@ public:
|
|||
private:
|
||||
AudioIODeviceType& type;
|
||||
const AudioDeviceSetupDetails setup;
|
||||
AudioDeviceSelectorComponent& parent;
|
||||
|
||||
std::unique_ptr<ComboBox> outputDeviceDropDown, inputDeviceDropDown, sampleRateDropDown, bufferSizeDropDown;
|
||||
std::unique_ptr<Label> outputDeviceLabel, inputDeviceLabel, sampleRateLabel, bufferSizeLabel, inputChanLabel, outputChanLabel;
|
||||
|
|
@ -1156,7 +1151,7 @@ void AudioDeviceSelectorComponent::updateAllControls()
|
|||
details.maxNumOutputChannels = maxOutputChannels;
|
||||
details.useStereoPairs = showChannelsAsStereoPairs;
|
||||
|
||||
audioDeviceSettingsComp = std::make_unique<AudioDeviceSettingsPanel> (*type, details, hideAdvancedOptionsWithButton);
|
||||
audioDeviceSettingsComp = std::make_unique<AudioDeviceSettingsPanel> (*type, details, hideAdvancedOptionsWithButton, *this);
|
||||
addAndMakeVisible (audioDeviceSettingsComp.get());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue