diff options
| author | Stefan Hajnoczi <stefanha@redhat.com> | 2017-05-05 16:46:51 +0100 |
|---|---|---|
| committer | Stefan Hajnoczi <stefanha@redhat.com> | 2017-05-05 16:47:16 +0100 |
| commit | bc56fd3a23c94302937ed023d33e17a2de1a1b2a (patch) | |
| tree | b337e9ef5cbd6ffa34750a09d6f6c48d4b72ae5c /hw/audio/gusemu_mixer.c | |
| parent | dd76c10f9fa25f1117d28bca09c6bce0c53d2a3f (diff) | |
| parent | 9ea5ada76f34a0ef048b131c3a166d8564199bdb (diff) | |
| download | focaccia-qemu-bc56fd3a23c94302937ed023d33e17a2de1a1b2a.tar.gz focaccia-qemu-bc56fd3a23c94302937ed023d33e17a2de1a1b2a.zip | |
Merge remote-tracking branch 'kraxel/tags/pull-audio-20170504-1' into staging
audio: cleanups, bugfixes (memory leaks). # gpg: Signature made Thu 04 May 2017 08:16:50 AM BST # gpg: using RSA key 0x4CB6D8EED3E87138 # gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>" # gpg: aka "Gerd Hoffmann <gerd@kraxel.org>" # gpg: aka "Gerd Hoffmann (private) <kraxel@gmail.com>" # Primary key fingerprint: A032 8CFF B93A 17A7 9901 FE7D 4CB6 D8EE D3E8 7138 * kraxel/tags/pull-audio-20170504-1: (30 commits) audio: Use ARRAY_SIZE from qemu/osdep.h audio: un-export OPLResetChip audio: Remove unused typedefs audio: UpdateHandler is not used anymore audio: IRQHandler is not used anymore audio: OPLSetUpdateHandler is not used anywhere audio: OPLSetIRQHandler is not used anywhere audio: GUSsample is int16_t audio: GUSword is uint16_t audio: GUSword is uint16_t audio: remove GUSchar audio: GUSbyte is uint8_t audio: Remove unused fields audio: Remove type field audio: Remove Unused OPL_TYPE_* audio: Unfold OPLSAMPLE audio: Remove INT32 audio: remove INT16 audio: Remove INT8 audio: remove UINT32 ... Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'hw/audio/gusemu_mixer.c')
| -rw-r--r-- | hw/audio/gusemu_mixer.c | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/hw/audio/gusemu_mixer.c b/hw/audio/gusemu_mixer.c index 701e8fb0ed..00b9861b92 100644 --- a/hw/audio/gusemu_mixer.c +++ b/hw/audio/gusemu_mixer.c @@ -27,26 +27,26 @@ #include "gustate.h" #define GUSregb(position) (* (gusptr+(position))) -#define GUSregw(position) (*(GUSword *) (gusptr+(position))) -#define GUSregd(position) (*(GUSdword *)(gusptr+(position))) +#define GUSregw(position) (*(uint16_t *) (gusptr+(position))) +#define GUSregd(position) (*(uint16_t *)(gusptr+(position))) -#define GUSvoice(position) (*(GUSword *)(voiceptr+(position))) +#define GUSvoice(position) (*(uint16_t *)(voiceptr+(position))) /* samples are always 16bit stereo (4 bytes each, first right then left interleaved) */ void gus_mixvoices(GUSEmuState * state, unsigned int playback_freq, unsigned int numsamples, - GUSsample *bufferpos) + int16_t *bufferpos) { /* note that byte registers are stored in the upper half of each voice register! */ - GUSbyte *gusptr; + uint8_t *gusptr; int Voice; - GUSword *voiceptr; + uint16_t *voiceptr; unsigned int count; for (count = 0; count < numsamples * 2; count++) *(bufferpos + count) = 0; /* clear */ gusptr = state->gusdatapos; - voiceptr = (GUSword *) gusptr; + voiceptr = (uint16_t *) gusptr; if (!(GUSregb(GUS4cReset) & 0x01)) /* reset flag active? */ return; @@ -85,16 +85,16 @@ void gus_mixvoices(GUSEmuState * state, unsigned int playback_freq, unsigned int if (GUSvoice(wVSRControl) & 0x400) /* 16bit */ { int offset = ((CurrPos >> 9) & 0xc0000) + (((CurrPos >> 9) & 0x1ffff) << 1); - GUSchar *adr; - adr = (GUSchar *) state->himemaddr + offset; + int8_t *adr; + adr = (int8_t *) state->himemaddr + offset; sample1 = (*adr & 0xff) + (*(adr + 1) * 256); sample2 = (*(adr + 2) & 0xff) + (*(adr + 2 + 1) * 256); } else /* 8bit */ { int offset = (CurrPos >> 9) & 0xfffff; - GUSchar *adr; - adr = (GUSchar *) state->himemaddr + offset; + int8_t *adr; + adr = (int8_t *) state->himemaddr + offset; sample1 = (*adr) * 256; sample2 = (*(adr + 1)) * 256; } @@ -171,8 +171,8 @@ void gus_mixvoices(GUSEmuState * state, unsigned int playback_freq, unsigned int } /* mix samples into buffer */ - *(bufferpos + 2 * sample) += (GUSsample) ((sample1 * PanningPos) >> 4); /* right */ - *(bufferpos + 2 * sample + 1) += (GUSsample) ((sample1 * (15 - PanningPos)) >> 4); /* left */ + *(bufferpos + 2 * sample) += (int16_t) ((sample1 * PanningPos) >> 4); /* right */ + *(bufferpos + 2 * sample + 1) += (int16_t) ((sample1 * (15 - PanningPos)) >> 4); /* left */ } /* write back voice and volume */ GUSvoice(wVSRCurrVol) = Volume32 / 32; @@ -187,7 +187,7 @@ void gus_irqgen(GUSEmuState * state, unsigned int elapsed_time) /* time given in microseconds */ { int requestedIRQs = 0; - GUSbyte *gusptr; + uint8_t *gusptr; gusptr = state->gusdatapos; if (GUSregb(TimerDataReg2x9) & 1) /* start timer 1 (80us decrement rate) */ { |