diff options
author | Yoann Lopes <yoann.lopes@qt.io> | 2016-07-20 13:09:39 +0200 |
---|---|---|
committer | Yoann Lopes <yoann.lopes@qt.io> | 2016-08-15 10:06:56 +0000 |
commit | c7ae48c5fb5005efae05f2cabdeee7117f6f72fa (patch) | |
tree | df7dffbe8cd8442bf1502247a90b99dcbeb09421 /src/multimedia/audio/qsoundeffect_pulse_p.h | |
parent | 57b1dc867cc29e0a7fb28ee6701cfa3e1b2257d2 (diff) | |
download | qtmultimedia-c7ae48c5fb5005efae05f2cabdeee7117f6f72fa.tar.gz |
PulseAudio: flush stream before loading a new source in a sound effect
When loading a new QSoundEffect source, the data in the stream must
be flushed to avoid that the old source plays right before the new one.
Task-number: QTBUG-48982
Change-Id: Iff14884edb2fb4851f93e67ff8191b77ebb16359
Reviewed-by: Christian Stromme <christian.stromme@qt.io>
Diffstat (limited to 'src/multimedia/audio/qsoundeffect_pulse_p.h')
-rw-r--r-- | src/multimedia/audio/qsoundeffect_pulse_p.h | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/multimedia/audio/qsoundeffect_pulse_p.h b/src/multimedia/audio/qsoundeffect_pulse_p.h index 0f16b98a2..2eb20695a 100644 --- a/src/multimedia/audio/qsoundeffect_pulse_p.h +++ b/src/multimedia/audio/qsoundeffect_pulse_p.h @@ -111,7 +111,7 @@ private Q_SLOTS: void underRun(); void prepare(); void streamReady(); - void emptyComplete(void *stream); + void emptyComplete(void *stream, bool reload); void handleAvailabilityChanged(bool available); @@ -119,7 +119,12 @@ private: void playAvailable(); void playSample(); - void emptyStream(); + enum EmptyStreamOption { + ReloadSampleWhenDone = 0x1 + }; + Q_DECLARE_FLAGS(EmptyStreamOptions, EmptyStreamOption) + void emptyStream(EmptyStreamOptions options = EmptyStreamOptions()); + void createPulseStream(); void unloadPulseStream(); @@ -134,6 +139,7 @@ private: static void stream_underrun_callback(pa_stream *s, void *userdata); static void stream_cork_callback(pa_stream *s, int success, void *userdata); static void stream_flush_callback(pa_stream *s, int success, void *userdata); + static void stream_flush_reload_callback(pa_stream *s, int success, void *userdata); static void stream_write_done_callback(void *p); static void stream_adjust_prebuffer_callback(pa_stream *s, int success, void *userdata); static void stream_reset_buffer_callback(pa_stream *s, int success, void *userdata); |