aboutsummaryrefslogtreecommitdiff
path: root/audio/wavaudio.c
diff options
context:
space:
mode:
authorbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>2004-11-11 16:55:09 +0000
committerbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>2004-11-11 16:55:09 +0000
commit7372f88dc171775c2918b3a874edf0a1d5266b19 (patch)
tree4b2eda389460737de0b50228f6b80c0bf2d97a68 /audio/wavaudio.c
parentd7382233d8408b2b32809f3783a5083cce14f291 (diff)
audio fixes (malc)
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1133 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'audio/wavaudio.c')
-rw-r--r--audio/wavaudio.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/audio/wavaudio.c b/audio/wavaudio.c
index f8d6acb4a2..5680161c72 100644
--- a/audio/wavaudio.c
+++ b/audio/wavaudio.c
@@ -55,7 +55,6 @@ static void wav_hw_run (HWVoice *hw)
int64_t now = qemu_get_clock (vm_clock);
int64_t ticks = now - wav->old_ticks;
int64_t bytes = (ticks * hw->bytes_per_second) / ticks_per_sec;
- wav->old_ticks = now;
if (bytes > INT_MAX)
samples = INT_MAX >> hw->shift;
@@ -66,6 +65,7 @@ static void wav_hw_run (HWVoice *hw)
if (live <= 0)
return;
+ wav->old_ticks = now;
decr = audio_MIN (live, samples);
samples = decr;
rpos = hw->rpos;
@@ -94,7 +94,6 @@ static int wav_hw_write (SWVoice *sw, void *buf, int len)
return pcm_hw_write (sw, buf, len);
}
-
/* VICE code: Store number as little endian. */
static void le_store (uint8_t *buf, uint32_t val, int len)
{
@@ -145,6 +144,8 @@ static int wav_hw_init (HWVoice *hw, int freq, int nchannels, audfmt_e fmt)
if (!wav->f) {
dolog ("failed to open wave file `%s'\nReason: %s\n",
conf.wav_path, strerror (errno));
+ qemu_free (wav->pcm_buf);
+ wav->pcm_buf = NULL;
return -1;
}
@@ -175,6 +176,9 @@ static void wav_hw_fini (HWVoice *hw)
fclose (wav->f);
wav->f = NULL;
+
+ qemu_free (wav->pcm_buf);
+ wav->pcm_buf = NULL;
}
static int wav_hw_ctl (HWVoice *hw, int cmd, ...)