Commit Graph

3 Commits

Author SHA1 Message Date
Jonathan Thomas
186a4ca5c1 Refactoring Audio Device detection (don't crash on Windows, find actual sample rate and device details) (#883)
* Close down ZMQ context to stop the zmq threads (related to sentry bug: OPENSHOT-3X)

* Add Support for Windows 7/8.1 (#881)

Adding protection around getting current sample rate for win 7, if audio device not found. Also added mutex for Singleton method. Also, making whitespace consistent on AudioPlaybackThread.cpp

* Big refactor of audio device opening - with multiple sample rates attempted, for better recovery from a missing or unsupported sample rate. Debug logs added for testing.

* Additional failure logging for windows audio device init

* Refactor of Audio Device Initialization (#882)

* Huge refactor of audio device initialization:
- Attempt requested audio device first, and then iterate through all known audio types and devices, and common sample rates. The idea is to ignore an invalid default or invalid requested device, and keep looking until we find a valid one
- New public method to return active, open audio device
- Added methods for AudioDeviceInfo struct, to make it callable from Python
- Some code clean-up and whitespace fixes
- New unit tests for AudioDeviceManagerSingleton

* Ignore audio device unit tests on systems with "No Driver" returned in the audio error message

* Ignore audio device unit tests if any error is found during initialization (i.e. build servers don't have audio cards)

* Trying to update GitHub libomp errors during build checks

* Remove zmq context shutdown call, due to the method missing on newer versions of zmq.hpp

* Downgrading GitHub Ubuntu latest image to Ubuntu 20.04, for compatibility with Catchv2

* Initialize all audio device manager variables correctly, and ignore unit test on low or missing sample rate systems (i.e. GitHub build servers)
2022-12-19 13:15:43 -06:00
Jonathan Thomas
ac3762923d Updating licensing for reuse compliance 2021-12-02 22:10:08 -06:00
FeRD (Frank Dana)
6aab6fd957 Audio: New device name lookup
- A new AudioDevices class replaces the AudioDeviceInfo struct.
  It has a single method, getNames(), which:
  * creates an AudioDeviceManager (NOT using the singleton)
  * scans for available devices
  * returns the results as a std::vector containing
    std::pair<std::string, std::string> objects

  (The AudioDevices device manager is never initialize()d, so
  no devices are opened; it should be safe to use even DURING
  playback, without disruption.)

  By using STL containers (rather than a custom struct) to return
  the results, Python is able to consume the output as a native
  list of tuples.

  AudioDeviceInfo is still present for compatibility, but deprecated.

- Eliminated some unnecessary conversions (like):
  * calls to std::string::c_str, when passing to juce::String.
    juce::String accepts std::string directly.
  * calls to juce::String::toRawUTF8, when creating std::string.
    There's a juce::String::ToStdString, which is better.
2021-08-24 13:11:00 -04:00