Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Demo app: Fix Windows device detection #132

Merged
merged 2 commits into from
Nov 11, 2021

Conversation

ferdnyc
Copy link
Contributor

@ferdnyc ferdnyc commented Aug 22, 2021

Since the test app is built as a MinGW console app, it won't detect any Windows audio devices. But it will still try, and JUCE normally makes those the default device type, meaning it won't automatically find a default device. To avoid this, we subclass the AudioDeviceManager class and override its createAudioDeviceTypes() method, avoiding any WASAPI probing at all.

The test app is also enhanced to show the current default device (if one is detected), and to display some parameters about it. Sample output on Linux:

build/src/openshot-audio-demo 
Initialising audio playback device.
Audio device probe results:
Type ALSA:
  - Default ALSA Output (currently PulseAudio Sound Server)
  - PulseAudio Sound Server
  - Default Audio Device
  - PipeWire Sound Server
  - USB Audio Device, USB Audio; Front output / input
  - USB Audio Device, USB Audio; 2.1 Surround output to Front and Subwoofer speakers
  - USB Audio Device, USB Audio; 4.0 Surround output to Front and Rear speakers
  - USB Audio Device, USB Audio; 4.1 Surround output to Front, Rear and Subwoofer speakers
  - USB Audio Device, USB Audio; 5.0 Surround output to Front, Center and Rear speakers
  - USB Audio Device, USB Audio; 5.1 Surround output to Front, Center, Rear and Subwoofer speakers
  - USB Audio Device, USB Audio; 7.1 Surround output to Front, Center, Side, Rear and Woofer speakers
  - USB Audio Device, USB Audio; IEC958 (S/PDIF) Digital Audio Output
  - USB Audio Device, USB Audio #1; IEC958 (S/PDIF) Digital Audio Output
  - HDA Intel PCH, ALC662 rev1 Analog; Front output / input
  - HDA Intel PCH, ALC662 rev1 Analog; 2.1 Surround output to Front and Subwoofer speakers
  - HDA Intel PCH, ALC662 rev1 Analog; 4.0 Surround output to Front and Rear speakers
  - HDA Intel PCH, ALC662 rev1 Analog; 4.1 Surround output to Front, Rear and Subwoofer speakers
  - HDA Intel PCH, ALC662 rev1 Analog; 5.0 Surround output to Front, Center and Rear speakers
  - HDA Intel PCH, ALC662 rev1 Analog; 5.1 Surround output to Front, Center, Rear and Subwoofer speakers
  - HDA Intel PCH, ALC662 rev1 Analog; 7.1 Surround output to Front, Center, Side, Rear and Woofer speakers
  - HDA NVidia, HDMI 0; HDMI Audio Output
  - HDA NVidia, HDMI 1; HDMI Audio Output
  - HDA NVidia, HDMI 2; HDMI Audio Output
  - HDA NVidia, HDMI 3; HDMI Audio Output
  - HDA NVidia, HDMI 4; HDMI Audio Output
Discovered 25 total audio devices.

Current audio device: ALSA - "Default ALSA Output (currently PulseAudio Sound Server)"
Sample rate: 44100 Hz
Block size: 512 samples
Bit depth: 32

You should hear five test tones, precisely 2 seconds apart.
1... 2... 3... 4... 5.
Demo complete. Shutting down device manager.

Fixes #130

Since the test app is built as a MinGW console app, it won't detect any
Windows audio devices. But it will still try, and JUCE normally makes
them the default device type. To avoid this, we subclass the
AudioDeviceManager class and override its createAudioDeviceTypes method.
@ferdnyc
Copy link
Contributor Author

ferdnyc commented Aug 22, 2021

(It's arguably a bug that, absent any other configuration, JUCE sets the default device to the first device from the first available type — not the first device from the first type that contains devices. So, if the first detected device type contains no devices, you're SOL.)

@jonoomph
Copy link
Member

LG, merging this also

@jonoomph jonoomph merged commit 0fb4ab0 into OpenShot:develop Nov 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

I don't hear five test tones
2 participants