Fix audio not playing
This commit is contained in:
parent
ff847d5812
commit
3dbd536edd
|
@ -35,7 +35,7 @@ static Device *devctrl, *devsystem, *devconsole, *devscreen, *devaudio0;
|
||||||
unsigned int palette[3];
|
unsigned int palette[3];
|
||||||
static Uint8 framebuffer[LCD_HEIGHT * LCD_WIDTH * 4];
|
static Uint8 framebuffer[LCD_HEIGHT * LCD_WIDTH * 4];
|
||||||
static fb_data *lcd_fb = NULL;
|
static fb_data *lcd_fb = NULL;
|
||||||
int audio_buf[AUDIO_BUF_SIZE];
|
char audio_buf[AUDIO_BUF_SIZE];
|
||||||
|
|
||||||
static unsigned long starttick;
|
static unsigned long starttick;
|
||||||
static long sleeptime;
|
static long sleeptime;
|
||||||
|
@ -220,17 +220,11 @@ apu_finished_handler(Apu *c)
|
||||||
}
|
}
|
||||||
|
|
||||||
void audio_callback(const void** start, size_t *size) {
|
void audio_callback(const void** start, size_t *size) {
|
||||||
int high = 32000;
|
|
||||||
int low = 0;
|
|
||||||
for (size_t i = 0; i < AUDIO_BUF_SIZE; i++) {
|
for (size_t i = 0; i < AUDIO_BUF_SIZE; i++) {
|
||||||
if (i & 1) {
|
audio_buf[i] = i;
|
||||||
audio_buf[i] = high;
|
|
||||||
} else {
|
|
||||||
audio_buf[i] = low;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
*start = &audio_buf;
|
*start = audio_buf;
|
||||||
*size = AUDIO_BUF_SIZE;
|
*size = AUDIO_BUF_SIZE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -373,6 +367,7 @@ enum plugin_status plugin_start(const void* parameter)
|
||||||
rb->audio_set_output_source(AUDIO_SRC_PLAYBACK);
|
rb->audio_set_output_source(AUDIO_SRC_PLAYBACK);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
rb->pcmbuf_fade(false, true);
|
||||||
rb->pcm_play_stop();
|
rb->pcm_play_stop();
|
||||||
rb->mixer_set_frequency(44100);
|
rb->mixer_set_frequency(44100);
|
||||||
rb->mixer_channel_play_data(PCM_MIXER_CHAN_PLAYBACK, audio_callback, NULL, 0);
|
rb->mixer_channel_play_data(PCM_MIXER_CHAN_PLAYBACK, audio_callback, NULL, 0);
|
||||||
|
|
Loading…
Reference in New Issue