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
This commit is contained in:
parent
e2eef1703b
commit
731ba0cec2
4
hw/gus.c
4
hw/gus.c
|
@ -58,7 +58,7 @@ typedef struct GUSState {
|
||||||
QEMUSoundCard card;
|
QEMUSoundCard card;
|
||||||
int freq;
|
int freq;
|
||||||
int pos, left, shift, irqs;
|
int pos, left, shift, irqs;
|
||||||
uint16_t *mixbuf;
|
GUSsample *mixbuf;
|
||||||
uint8_t himem[1024 * 1024 + 32 + 4096];
|
uint8_t himem[1024 * 1024 + 32 + 4096];
|
||||||
int samples;
|
int samples;
|
||||||
SWVoiceOut *voice;
|
SWVoiceOut *voice;
|
||||||
|
@ -198,7 +198,7 @@ void GUS_dmarequest (GUSEmuState *der)
|
||||||
int GUS_read_DMA (void *opaque, int nchan, int dma_pos, int dma_len)
|
int GUS_read_DMA (void *opaque, int nchan, int dma_pos, int dma_len)
|
||||||
{
|
{
|
||||||
GUSState *s = opaque;
|
GUSState *s = opaque;
|
||||||
int8_t tmpbuf[4096];
|
char tmpbuf[4096];
|
||||||
int pos = dma_pos, mode, left = dma_len - dma_pos;
|
int pos = dma_pos, mode, left = dma_len - dma_pos;
|
||||||
|
|
||||||
ldebug ("read DMA %#x %d\n", dma_pos, dma_len);
|
ldebug ("read DMA %#x %d\n", dma_pos, dma_len);
|
||||||
|
|
|
@ -32,12 +32,14 @@
|
||||||
typedef unsigned short GUSword;
|
typedef unsigned short GUSword;
|
||||||
typedef unsigned int GUSdword;
|
typedef unsigned int GUSdword;
|
||||||
typedef signed char GUSchar;
|
typedef signed char GUSchar;
|
||||||
|
typedef signed short GUSsample;
|
||||||
#else
|
#else
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
typedef int8_t GUSchar;
|
typedef int8_t GUSchar;
|
||||||
typedef uint8_t GUSbyte;
|
typedef uint8_t GUSbyte;
|
||||||
typedef uint16_t GUSword;
|
typedef uint16_t GUSword;
|
||||||
typedef uint32_t GUSdword;
|
typedef uint32_t GUSdword;
|
||||||
|
typedef int16_t GUSsample;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
typedef struct _GUSEmuState
|
typedef struct _GUSEmuState
|
||||||
|
@ -91,7 +93,7 @@ void gus_dma_transferdata(GUSEmuState *state, char *dma_addr, unsigned int count
|
||||||
/* If the interrupts are asynchronous, it may be needed to use a separate thread mixing into a temporary */
|
/* If the interrupts are asynchronous, it may be needed to use a separate thread mixing into a temporary */
|
||||||
/* audio buffer in order to avoid quality loss caused by large numsamples and elapsed_time values. */
|
/* audio buffer in order to avoid quality loss caused by large numsamples and elapsed_time values. */
|
||||||
|
|
||||||
void gus_mixvoices(GUSEmuState *state, unsigned int playback_freq, unsigned int numsamples, short *bufferpos);
|
void gus_mixvoices(GUSEmuState *state, unsigned int playback_freq, unsigned int numsamples, GUSsample *bufferpos);
|
||||||
/* recommended range: 10 < numsamples < 100 */
|
/* recommended range: 10 < numsamples < 100 */
|
||||||
/* lower values may result in increased rounding error, higher values often cause audible timing delays */
|
/* lower values may result in increased rounding error, higher values often cause audible timing delays */
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@
|
||||||
|
|
||||||
/* samples are always 16bit stereo (4 bytes each, first right then left interleaved) */
|
/* 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,
|
void gus_mixvoices(GUSEmuState * state, unsigned int playback_freq, unsigned int numsamples,
|
||||||
short *bufferpos)
|
GUSsample *bufferpos)
|
||||||
{
|
{
|
||||||
/* note that byte registers are stored in the upper half of each voice register! */
|
/* note that byte registers are stored in the upper half of each voice register! */
|
||||||
GUSbyte *gusptr;
|
GUSbyte *gusptr;
|
||||||
|
@ -170,8 +170,8 @@ void gus_mixvoices(GUSEmuState * state, unsigned int playback_freq, unsigned int
|
||||||
}
|
}
|
||||||
|
|
||||||
/* mix samples into buffer */
|
/* mix samples into buffer */
|
||||||
*(bufferpos + 2 * sample) += (short) ((sample1 * PanningPos) >> 4); /* right */
|
*(bufferpos + 2 * sample) += (GUSsample) ((sample1 * PanningPos) >> 4); /* right */
|
||||||
*(bufferpos + 2 * sample + 1) += (short) ((sample1 * (15 - PanningPos)) >> 4); /* left */
|
*(bufferpos + 2 * sample + 1) += (GUSsample) ((sample1 * (15 - PanningPos)) >> 4); /* left */
|
||||||
}
|
}
|
||||||
/* write back voice and volume */
|
/* write back voice and volume */
|
||||||
GUSvoice(wVSRCurrVol) = Volume32 / 32;
|
GUSvoice(wVSRCurrVol) = Volume32 / 32;
|
||||||
|
|
Reference in New Issue