Mema
Memory Matrix — multi-channel audio matrix monitor and router
Loading...
Searching...
No Matches
AudioSelectComponent.cpp
Go to the documentation of this file.
1/* Copyright (c) 2024, Christian Ahrens
2 *
3 * This file is part of Mema <https://github.com/ChristianAhrens/Mema>
4 *
5 * This tool is free software; you can redistribute it and/or modify it under
6 * the terms of the GNU Lesser General Public License version 3.0 as published
7 * by the Free Software Foundation.
8 *
9 * This tool is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12 * details.
13 *
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with this tool; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17 */
18
20
21namespace Mema
22{
23
24//==============================================================================
25AudioSelectComponent::AudioSelectComponent(juce::AudioDeviceManager *deviceManager,
26 int minAudioInputChannels,
27 int maxAudioInputChannels,
28 int minAudioOutputChannels,
29 int maxAudioOutputChannels,
30 bool showMidiInputOptions,
31 bool showMidiOutputSelector,
32 bool showChannelsAsStereoPairs,
33 bool hideAdvancedOptionsWithButton)
34 : juce::AudioDeviceSelectorComponent(*deviceManager,
35 minAudioInputChannels,
36 maxAudioInputChannels,
37 minAudioOutputChannels,
38 maxAudioOutputChannels,
39 showMidiInputOptions,
40 showMidiOutputSelector,
41 showChannelsAsStereoPairs,
42 hideAdvancedOptionsWithButton)
43{
44 if (deviceManager)
45 m_selectedAudioDeviceWhenSelectionStarted = RelevantDeviceCharacteristics(deviceManager->getCurrentAudioDevice());
46}
47
51
53{
54 if (m_selectedAudioDeviceWhenSelectionStarted != RelevantDeviceCharacteristics(deviceManager.getCurrentAudioDevice()))
55 {
58
59 m_selectedAudioDeviceWhenSelectionStarted = RelevantDeviceCharacteristics(deviceManager.getCurrentAudioDevice());
60 }
61}
62
64{
65 g.fillAll(getLookAndFeel().findColour(juce::ResizableWindow::backgroundColourId).darker());
66
67 g.setColour(juce::Colours::grey);
68 g.drawRect(getLocalBounds(), 1); // draw an outline around the component
69
70 juce::AudioDeviceSelectorComponent::paint(g);
71}
72
74{
75 juce::AudioDeviceSelectorComponent::resized();
76}
77
79{
80 if (!isVisible()) // has changed to invisible after editing
82}
83
84}
std::function< void()> onAudioDeviceChangedDuringAudioSelection
AudioSelectComponent(juce::AudioDeviceManager *deviceManager, int minAudioInputChannels, int maxAudioInputChannels, int minAudioOutputChannels, int maxAudioOutputChannels, bool showMidiInputOptions, bool showMidiOutputSelector, bool showChannelsAsStereoPairs, bool hideAdvancedOptionsWithButton)
void paint(juce::Graphics &) override
Definition Mema.cpp:27
Snapshot of the currently selected device's relevant characteristics used to detect changes.