Sega Saturn Development > General Jo Engine Help

A few questions about PCM functionality

(1/3) > >>

LackofTrack:
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?

XL2:
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.

LackofTrack:
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?

mindslight:
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:
http://jo-engine.org/doxygen/audio_8h.html

LackofTrack:
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?



--- 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))
        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
*/
--- End code ---

Navigation

[0] Message Index

[#] Next page

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