diff options
author | Takashi Yano <takashi.yano@nifty.ne.jp> | 2023-02-25 04:28:34 +0300 |
---|---|---|
committer | Takashi Yano <takashi.yano@nifty.ne.jp> | 2023-02-25 04:37:43 +0300 |
commit | 77f324ae03547c82b724ef5a35bd72b2ecf09e61 (patch) | |
tree | be7cfc507c394424037e3da3fc6a39def0b759e8 | |
parent | 2fd459c3b180def80b0db4b6c91e4f088e779cc1 (diff) |
Cygwin: dsp: Fix SNDCTL_DSP_{POST,SYNC} ioctl() behaviour.
Previously, SNDCTL_DSP_POST and SNDCTL_DSP_SYNC were implemented
wrongly. Due to this issue, module-oss of pulseaudio generates
choppy sound when SNDCTL_DSP_POST is called. This patch fixes that.
Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
-rw-r--r-- | winsup/cygwin/fhandler/dsp.cc | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/winsup/cygwin/fhandler/dsp.cc b/winsup/cygwin/fhandler/dsp.cc index cfbf6bec7..db7b2550e 100644 --- a/winsup/cygwin/fhandler/dsp.cc +++ b/winsup/cygwin/fhandler/dsp.cc @@ -133,6 +133,8 @@ class fhandler_dev_dsp::Audio_out: public Audio int freq_; int bits_; int channels_; + + friend fhandler_dev_dsp; }; static void CALLBACK waveIn_callback (HWAVEIN hWave, UINT msg, @@ -1417,11 +1419,16 @@ fhandler_dev_dsp::_ioctl (unsigned int cmd, void *buf) return 0; CASE (SNDCTL_DSP_POST) + if (audio_out_) + audio_out_->sendcurrent (); // force out last block whatever size.. + return 0; + CASE (SNDCTL_DSP_SYNC) - // Stop audio out device - close_audio_out (); - // Stop audio in device - close_audio_in (); + if (audio_out_) + { + audio_out_->sendcurrent (); // force out last block whatever size.. + audio_out_->waitforallsent (); // block till finished.. + } return 0; default: |