Fix GCC errors

This commit is contained in:
Natt Akuma 2022-05-18 21:46:14 +07:00
parent 0ae0c6f703
commit 4551c55818
2 changed files with 7 additions and 8 deletions

View file

@ -106,7 +106,7 @@ static void compute_tables()
int ymz280b_device::generate_adpcm(struct YMZ280BVoice *voice, s16 *buffer, int samples) int ymz280b_device::generate_adpcm(struct YMZ280BVoice *voice, s16 *buffer, int samples)
{ {
int position = voice->position; u32 position = voice->position;
int signal = voice->signal; int signal = voice->signal;
int step = voice->step; int step = voice->step;
int val; int val;
@ -218,7 +218,7 @@ int ymz280b_device::generate_adpcm(struct YMZ280BVoice *voice, s16 *buffer, int
int ymz280b_device::generate_pcm8(struct YMZ280BVoice *voice, s16 *buffer, int samples) int ymz280b_device::generate_pcm8(struct YMZ280BVoice *voice, s16 *buffer, int samples)
{ {
int position = voice->position; u32 position = voice->position;
int val; int val;
/* two cases: first cases is non-looping */ /* two cases: first cases is non-looping */
@ -288,7 +288,7 @@ int ymz280b_device::generate_pcm8(struct YMZ280BVoice *voice, s16 *buffer, int s
int ymz280b_device::generate_pcm16(struct YMZ280BVoice *voice, s16 *buffer, int samples) int ymz280b_device::generate_pcm16(struct YMZ280BVoice *voice, s16 *buffer, int samples)
{ {
int position = voice->position; u32 position = voice->position;
int val; int val;
/* two cases: first cases is non-looping */ /* two cases: first cases is non-looping */
@ -425,8 +425,8 @@ void ymz280b_device::sound_stream_update(s16 **outputs, int samples)
/* if there are leftovers, ramp back to 0 */ /* if there are leftovers, ramp back to 0 */
int base = new_samples - samples_left; int base = new_samples - samples_left;
int i, t = (base == 0) ? curr : m_scratch[base - 1]; int t = (base == 0) ? curr : m_scratch[base - 1];
for (i = 0; i < samples_left; i++) for (u32 i = 0; i < samples_left; i++)
{ {
if (t < 0) t = -((-t * 15) >> 4); if (t < 0) t = -((-t * 15) >> 4);
else if (t > 0) t = (t * 15) >> 4; else if (t > 0) t = (t * 15) >> 4;

View file

@ -70,12 +70,11 @@ void DivPlatformYMZ280B::acquire(short* bufL, short* bufR, size_t start, size_t
buf[0],buf[1],buf[2],buf[3],buf[4],buf[5],buf[6],buf[7], buf[0],buf[1],buf[2],buf[3],buf[4],buf[5],buf[6],buf[7],
buf[8],buf[9],buf[10],buf[11],buf[12],buf[13],buf[14],buf[15] buf[8],buf[9],buf[10],buf[11],buf[12],buf[13],buf[14],buf[15]
}; };
int dataL,dataR;
size_t pos=start; size_t pos=start;
while (len > 0) { while (len > 0) {
size_t blockLen = MIN(len, 256); size_t blockLen = MIN(len, 256);
ymz280b.sound_stream_update(bufPtrs, blockLen); ymz280b.sound_stream_update(bufPtrs, blockLen);
for (int i=0; i<blockLen; i++) { for (size_t i=0; i<blockLen; i++) {
int dataL=0; int dataL=0;
int dataR=0; int dataR=0;
for (int j=0; j<8; j++) { for (int j=0; j<8; j++) {
@ -409,7 +408,7 @@ void DivPlatformYMZ280B::renderSamples() {
DivSample* s=parent->song.sample[i]; DivSample* s=parent->song.sample[i];
int length=s->getCurBufLen(); int length=s->getCurBufLen();
unsigned char* src=(unsigned char*)s->getCurBuf(); unsigned char* src=(unsigned char*)s->getCurBuf();
int actualLength=MIN(getSampleMemCapacity()-memPos-length,length); int actualLength=MIN((int)(getSampleMemCapacity()-memPos)-length,length);
if (actualLength>0) { if (actualLength>0) {
memcpy(&sampleMem[memPos],src,actualLength); memcpy(&sampleMem[memPos],src,actualLength);
s->offYMZ280B=memPos; s->offYMZ280B=memPos;