Sega Saturn Development > General Jo Engine Help

A few questions about PCM functionality

(1/3) > >>

Hello, first thing I'd like to say is that this is a great engine for people wanting to create programs on the Sega Saturn but, who don't have much knowledge about how the hardware works (like myself).

One question I'd like to ask though is is there anyway to play a PCM file depending on which button you press?

I've been using the audio demo to see if I could load 3 different PCM files depending on which button I press but, it seems like I can only do 2. I've just started to learn C so maybe I'm doing something wrong?  Also it seems I can only get 44100hz PCM files to play right. Every other frequency plays too fast. Do I have to edit  jo_sound_mode for it to correctly play lower frequencies?

My last question is is there any way to loop PCM audio?

Nice to know that the different frequencies didn't play nice for you since I now know I'm not alone!
For the audio, there is no overflow check AFAIK, so if you specify a channel to play on you will probably get crashes.
I also can't play more than 2 audio files at the same time, but I know Johannes wants to fully modify the audio implementation, so maybe you can try the SGL functions for the time being.

Whew! Good to know I wasn't doing something wrong.  :D

Just to be clear I wasn't trying to play 2 PCM files once. I was trying to make it so that if I presses A "A.PCM" would play then if I pressed B "A.PCM" would be cleared from memory and then "B.PCM" would play but like I said I couldn't get it to work properly.

Also for some reason CD playback only seems to play in mono even if the Wav file itself is stereo. Is this also an issue you have been having?

Hi, you can't play multiple sound on the same channel, but you can play 8 sounds on the same time using jo_audio_play_sound which plays the sound on the first available channel.

See documentation here:

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?

--- Code: ---
#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))


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)

--- End code ---


[0] Message Index

[#] Next page

Sitemap 1 2 3 4 5 6 7 8 9 10 
Go to full version