audio: moved output to its own high priority thread

macOS audio playback failed due to audio being processed in the main thread.
Now all audio playback has been placed into its own high priority thread to
always keep up better with the operating system's demands.
This commit is contained in:
itsmattkc
2020-04-21 19:31:29 +10:00
parent 05eae1e28a
commit 412a6dfdc2
6 changed files with 133 additions and 166 deletions
+13 -9
View File
@@ -40,12 +40,13 @@ public:
virtual ~AudioOutputManager() override;
bool OutputIsSet();
void SetOutputDevice(QAudioDeviceInfo info, QAudioFormat format);
// Thread-safe
void Push(const QByteArray &samples);
public slots:
// Queued
void SetOutputDevice(QAudioDeviceInfo info, QAudioFormat format);
/**
* @brief Connect a QIODevice (e.g. QFile) to start sending to the audio output
*
@@ -54,12 +55,14 @@ public:
*/
void PullFromDevice(const QString &filename, qint64 offset, int playback_speed);
// Queued
void ResetToPushMode();
void SetParameters(const AudioRenderingParams& params);
public slots:
// Queued
void SetParameters(OLIVE_NAMESPACE::AudioRenderingParams params);
// Queued
void Close();
signals:
void OutputNotified();
@@ -68,8 +71,9 @@ private:
QAudioOutput* output_;
QIODevice* push_device_;
QByteArray pushed_samples_;
int pushed_sample_index_;
QMutex push_sample_lock_;
QByteArray push_samples_;
int push_sample_index_;
AudioOutputDeviceProxy device_proxy_;