Hello,
Thanks, but that was not the issue I having.
The problem happens when I try to load 2 PCM files at the same time that together are over the memory limit of the saturn. I've tried using jo_audio_free_pcm but it doesn't seem to work properly. Is my code is wrong?
#include <jo/jo.h>
#include <jo/audio.h>
static jo_sound blop;
static jo_sound cop;
void my_draw(void)
{
jo_printf(0, 0, jo_get_last_error());
jo_printf(0, 1, "Press A to play PCM sound");
jo_printf(0, 2, "Press B to play CD music");
jo_printf(0, 3, "Press C to play PCM2 music");
jo_printf(0, 4, "Audio channel usage: %d%% ", jo_audio_usage_percent());
}
void my_gamepad(void)
{
static int is_cd_playing = 0;
if (!jo_is_pad1_available())
return ;
if (jo_is_pad1_key_pressed(JO_KEY_A))
jo_audio_play_sound_on_channel(&blop, 0);
if (jo_is_pad1_key_pressed(JO_KEY_B) && !is_cd_playing)
{
/* the first track is reserved for the game binary so the first track is 2 */
jo_audio_play_cd_track(2, 2, 1);
is_cd_playing = 1;
}
if (jo_is_pad1_key_pressed(JO_KEY_C))
jo_audio_play_sound(&cop);
}
void load_blop_sound(void)
{
jo_audio_load_pcm("A.PCM",JoSoundMono8Bit,& blop);
}
void load_cop_sound(void)
{
jo_audio_free_pcm(& blop);
jo_audio_load_pcm("B.PCM",JoSoundMono8Bit,& cop);
}
void jo_main(void)
{
jo_core_init(JO_COLOR_Black);
load_blop_sound();
load_cop_sound();
jo_core_add_callback(my_draw);
jo_core_add_callback(my_gamepad);
jo_core_run();
}
/*
** END OF FILE
*/