From 367ff06ea458a58c16accb4172629366eb04ac30 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Fri, 7 May 2004 07:54:28 +0000 Subject: [PATCH] * fhandler_dsp.cc (fhandler_dev_dsp::Audio_out::stop): Move delete of bigwavebuffer_ so that it is always cleaned, also in child processes. (fhandler_dev_dsp::Audio_in::stop): Ditto. (fhandler_dev_dsp::close): Stop audio play immediately in case of abnormal exit. --- winsup/cygwin/ChangeLog | 8 ++++++++ winsup/cygwin/fhandler_dsp.cc | 25 +++++++++++++++---------- 2 files changed, 23 insertions(+), 10 deletions(-) diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 6c5d202e3..20c7419da 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,11 @@ +2004-05-07 Gerd Spalink + + * fhandler_dsp.cc (fhandler_dev_dsp::Audio_out::stop): Move delete of + bigwavebuffer_ so that it is always cleaned, also in child processes. + (fhandler_dev_dsp::Audio_in::stop): Ditto. + (fhandler_dev_dsp::close): Stop audio play immediately in case of + abnormal exit. + 2004-05-07 Corinna Vinschen Revert code reversion from 2004-04-03. So, revert to async I/O again. diff --git a/winsup/cygwin/fhandler_dsp.cc b/winsup/cygwin/fhandler_dsp.cc index a2ddef4f2..a872c231e 100644 --- a/winsup/cygwin/fhandler_dsp.cc +++ b/winsup/cygwin/fhandler_dsp.cc @@ -457,12 +457,12 @@ fhandler_dev_dsp::Audio_out::stop (bool immediately) debug_printf ("waveOutClose rc=%d", rc); clearOwner (); + } - if (bigwavebuffer_) - { - delete[] bigwavebuffer_; - bigwavebuffer_ = NULL; - } + if (bigwavebuffer_) + { + delete[] bigwavebuffer_; + bigwavebuffer_ = NULL; } } @@ -859,12 +859,12 @@ fhandler_dev_dsp::Audio_in::stop () debug_printf ("waveInClose rc=%d", rc); clearOwner (); + } - if (bigwavebuffer_) - { - delete[] bigwavebuffer_; - bigwavebuffer_ = NULL; - } + if (bigwavebuffer_) + { + delete[] bigwavebuffer_; + bigwavebuffer_ = NULL; } } @@ -1207,6 +1207,11 @@ fhandler_dev_dsp::close (void) } if (audio_out_) { + if (exit_state != ES_NOT_EXITING) + { // emergency close due to call to exit() or Ctrl-C: + // do not wait for all pending audio to be played + audio_out_->stop (true); + } delete audio_out_; audio_out_ = NULL; }