Commit 731ba0cec2ae7071da75902a8071ac718c86cb14
1 parent
e2eef170
Fix some signedness issues caught by gcc 4.3
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4696 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
3 changed files
with
8 additions
and
6 deletions
hw/gus.c
... | ... | @@ -58,7 +58,7 @@ typedef struct GUSState { |
58 | 58 | QEMUSoundCard card; |
59 | 59 | int freq; |
60 | 60 | int pos, left, shift, irqs; |
61 | - uint16_t *mixbuf; | |
61 | + GUSsample *mixbuf; | |
62 | 62 | uint8_t himem[1024 * 1024 + 32 + 4096]; |
63 | 63 | int samples; |
64 | 64 | SWVoiceOut *voice; |
... | ... | @@ -198,7 +198,7 @@ void GUS_dmarequest (GUSEmuState *der) |
198 | 198 | int GUS_read_DMA (void *opaque, int nchan, int dma_pos, int dma_len) |
199 | 199 | { |
200 | 200 | GUSState *s = opaque; |
201 | - int8_t tmpbuf[4096]; | |
201 | + char tmpbuf[4096]; | |
202 | 202 | int pos = dma_pos, mode, left = dma_len - dma_pos; |
203 | 203 | |
204 | 204 | ldebug ("read DMA %#x %d\n", dma_pos, dma_len); | ... | ... |
hw/gusemu.h
... | ... | @@ -32,12 +32,14 @@ |
32 | 32 | typedef unsigned short GUSword; |
33 | 33 | typedef unsigned int GUSdword; |
34 | 34 | typedef signed char GUSchar; |
35 | + typedef signed short GUSsample; | |
35 | 36 | #else |
36 | 37 | #include <stdint.h> |
37 | 38 | typedef int8_t GUSchar; |
38 | 39 | typedef uint8_t GUSbyte; |
39 | 40 | typedef uint16_t GUSword; |
40 | 41 | typedef uint32_t GUSdword; |
42 | + typedef int16_t GUSsample; | |
41 | 43 | #endif |
42 | 44 | |
43 | 45 | typedef struct _GUSEmuState |
... | ... | @@ -91,7 +93,7 @@ void gus_dma_transferdata(GUSEmuState *state, char *dma_addr, unsigned int count |
91 | 93 | /* If the interrupts are asynchronous, it may be needed to use a separate thread mixing into a temporary */ |
92 | 94 | /* audio buffer in order to avoid quality loss caused by large numsamples and elapsed_time values. */ |
93 | 95 | |
94 | -void gus_mixvoices(GUSEmuState *state, unsigned int playback_freq, unsigned int numsamples, short *bufferpos); | |
96 | +void gus_mixvoices(GUSEmuState *state, unsigned int playback_freq, unsigned int numsamples, GUSsample *bufferpos); | |
95 | 97 | /* recommended range: 10 < numsamples < 100 */ |
96 | 98 | /* lower values may result in increased rounding error, higher values often cause audible timing delays */ |
97 | 99 | ... | ... |
hw/gusemu_mixer.c
... | ... | @@ -33,7 +33,7 @@ |
33 | 33 | |
34 | 34 | /* samples are always 16bit stereo (4 bytes each, first right then left interleaved) */ |
35 | 35 | void gus_mixvoices(GUSEmuState * state, unsigned int playback_freq, unsigned int numsamples, |
36 | - short *bufferpos) | |
36 | + GUSsample *bufferpos) | |
37 | 37 | { |
38 | 38 | /* note that byte registers are stored in the upper half of each voice register! */ |
39 | 39 | GUSbyte *gusptr; |
... | ... | @@ -170,8 +170,8 @@ void gus_mixvoices(GUSEmuState * state, unsigned int playback_freq, unsigned int |
170 | 170 | } |
171 | 171 | |
172 | 172 | /* mix samples into buffer */ |
173 | - *(bufferpos + 2 * sample) += (short) ((sample1 * PanningPos) >> 4); /* right */ | |
174 | - *(bufferpos + 2 * sample + 1) += (short) ((sample1 * (15 - PanningPos)) >> 4); /* left */ | |
173 | + *(bufferpos + 2 * sample) += (GUSsample) ((sample1 * PanningPos) >> 4); /* right */ | |
174 | + *(bufferpos + 2 * sample + 1) += (GUSsample) ((sample1 * (15 - PanningPos)) >> 4); /* left */ | |
175 | 175 | } |
176 | 176 | /* write back voice and volume */ |
177 | 177 | GUSvoice(wVSRCurrVol) = Volume32 / 32; | ... | ... |