Skip to content

Commit 45ef10f

Browse files
committed
Attempt to improve types between audio_cb and Sound_Callback
1 parent 8bfa3b8 commit 45ef10f

File tree

3 files changed

+9
-7
lines changed

3 files changed

+9
-7
lines changed

libretro/core-mapper.c

+6-4
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ unsigned long Ktime=0 , LastFPSTime=0;
2626
#endif
2727

2828
//SOUND
29-
unsigned char SNDBUF[1024*2*2];
29+
UBYTE SNDBUF[1024*2*2];
3030
int snd_sampler_pal = 44100 / 50;
3131
int snd_sampler_ntsc = 44100 / 60;
3232

@@ -155,9 +155,11 @@ void retro_sound_update(void)
155155

156156
if (! UI_is_active)
157157
{
158-
Sound_Callback(SNDBUF, 1024*2*2);
159-
for(x=0;x<stop*2;x+=2)
160-
retro_audio_cb(SNDBUF[x],SNDBUF[x+2]);
158+
uint16_t *p = (uint16_t *)SNDBUF;
159+
160+
Sound_Callback(SNDBUF, sizeof SNDBUF);
161+
for (x = 0; x < stop; p += 2, x++)
162+
retro_audio_cb(*p, *p + 1);
161163

162164
}
163165
}

libretro/libretro-core.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ extern int ToggleTV;
135135
extern int CURRENT_TV;
136136

137137
extern int SHIFTON, pauseg, SND;
138-
extern unsigned char SNDBUF[];
138+
extern UBYTE SNDBUF[];
139139

140140
char RPATH[512];
141141
char RETRO_DIR[512];
@@ -1164,7 +1164,7 @@ void retro_set_video_refresh(retro_video_refresh_t cb)
11641164
video_cb = cb;
11651165
}
11661166

1167-
void retro_audio_cb(short l, short r)
1167+
void retro_audio_cb(uint16_t l, uint16_t r)
11681168
{
11691169
audio_cb(l, r);
11701170
}

libretro/libretro-core.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -83,5 +83,5 @@ extern int pauseg;
8383
#define JOY_5200_CENTER 114
8484

8585
void retro_message(const char* text, unsigned int frames, int alt);
86-
void retro_audio_cb(short l, short r);
86+
void retro_audio_cb(uint16_t l, uint16_t r);
8787
#endif

0 commit comments

Comments
 (0)