![]() |
Jo Engine 2026.11.1
Jo Sega Saturn Engine
|
Jo Engine Function prototypes for audio. More...
Go to the source code of this file.
Data Structures | |
| struct | jo_sound |
Macros | |
| #define | JO_SOUND_MAX_CHANNEL |
| Channels of sounds (2 slots of the SCSP each; the slots 16 and 17 take the CD audio). | |
| #define | JO_DEFAULT_AUDIO_VOLUME |
| Default audio volume. | |
| #define | JO_MAX_AUDIO_VOLUME |
| Max audio volume available for jo_audio_set_volume(). | |
| #define | JO_MIN_AUDIO_VOLUME |
| Min audio volume available for jo_audio_set_volume(). | |
| #define | JO_AUDIO_CD_VOLUME_MAX |
| Maximum level of the CD audio (see jo_audio_set_cd_volume()), the default. | |
Enumerations | |
| enum | jo_sound_mode { JoSoundMono8Bit , JoSoundMono16Bit , JoSoundStereo8Bit , JoSoundStereo16Bit } |
Functions | |
| void | jo_audio_play_cd_track (const int from_track, const int to_track, const bool repeat_infinitely) |
| Play a track from the CD. | |
| void | jo_audio_stop_cd (void) |
| Stop playing audio track. | |
| void | jo_audio_pause_cd (void) |
| Pause the audio track played by jo_audio_play_cd_track(). | |
| void | jo_audio_resume_cd (void) |
| Resume the audio track paused by jo_audio_pause_cd(). | |
| bool | jo_audio_is_cd_paused (void) |
| Check if the CD audio is paused (see jo_audio_pause_cd()). | |
| bool | jo_audio_is_cd_playing (void) |
| Check if the CD drive is playing. | |
| void | jo_audio_set_volume (const unsigned char vol) |
| Set the audio volume. | |
| void | jo_audio_set_cd_volume (const unsigned char level) |
| Set the level of the CD audio in the mix (the music tracks of the CD, see jo_audio_play_cd_track()). | |
| bool | jo_audio_is_channel_playing (const unsigned char channel) |
| Checks whether a given audio channel is currently playing a sound. | |
| void | jo_audio_play_sound_on_channel (jo_sound *const sound, const unsigned char channel) |
| Play a sound on a specific channel. | |
| void | jo_audio_play_sound_loop_on_channel (jo_sound *const sound, const unsigned char channel) |
| Play a sound again and again on a specific channel, until the channel is stopped (an engine for instance). | |
| void | jo_audio_set_channel_sample_rate (const unsigned char channel, const unsigned short sample_rate) |
| Change the sampling rate of the sound played on a channel (its pitch: a faster engine for instance). | |
| void | jo_audio_set_channel_volume (const unsigned char channel, const unsigned char volume) |
| Change the volume of the sound played on a channel. | |
| void | jo_audio_set_channel_reverb (const unsigned char channel, const unsigned char level) |
| Change the send of the sound played on a channel to the reverberation (JO_COMPILE_WITH_AUDIO_DSP_MODULE). | |
| void | jo_audio_play_sound (jo_sound *const sound) |
| Play a sound on first available channel. | |
| void | jo_audio_stop_sound (const jo_sound *const sound) |
| Stop a sound. | |
| void | jo_audio_stop_channel (const unsigned char channel) |
| Stop the sound played on a channel. | |
| bool | jo_audio_load_pcm (const char *const filename, const jo_sound_mode mode, jo_sound *sound) |
| Load PCM file from CD. | |
| bool | jo_audio_load_pcm_async (const char *const filename, const jo_sound_mode mode, jo_sound *sound) |
| Load PCM file from CD asynchronously. | |
| bool | jo_audio_load_wav (const char *const filename, jo_sound *sound) |
| Load a WAV file from CD (PCM, 8 or 16 bits, mono or stereo, any sample rate: the sound gets its mode and its sample rate from the file). | |
| bool | jo_audio_make_resident (jo_sound *sound) |
| Keep a sound in the sound RAM (512 KB) and free its copy in the work RAM (the jo_malloc() memory). | |
| void | jo_audio_free_resident (void) |
| Forget all the resident sounds (a new level): their room in the sound RAM is free again. | |
| void | jo_audio_free_pcm (jo_sound *sound) |
| Free pcm sound loaded with jo_audio_load_pcm(). | |
| int | jo_audio_usage_percent (void) |
| Get audio channel usage. | |
Jo Engine Function prototypes for audio.
| struct jo_sound |
| Data Fields | ||
|---|---|---|
| unsigned char | current_playing_channel | |
| char * | data | |
| unsigned int | data_length | |
| jo_sound_mode | mode | |
| char | pan | |
| unsigned int | resident | |
| unsigned char | reverb | |
| unsigned short | sample_rate | |
| unsigned char | volume | |
| #define JO_AUDIO_CD_VOLUME_MAX |
Maximum level of the CD audio (see jo_audio_set_cd_volume()), the default.
| #define JO_DEFAULT_AUDIO_VOLUME |
Default audio volume.
| #define JO_MAX_AUDIO_VOLUME |
Max audio volume available for jo_audio_set_volume().
| #define JO_MIN_AUDIO_VOLUME |
Min audio volume available for jo_audio_set_volume().
| #define JO_SOUND_MAX_CHANNEL |
Channels of sounds (2 slots of the SCSP each; the slots 16 and 17 take the CD audio).
| enum jo_sound_mode |
| void jo_audio_free_pcm | ( | jo_sound * | sound | ) |
Free pcm sound loaded with jo_audio_load_pcm().
| sound | Sound definition |
| void jo_audio_free_resident | ( | void | ) |
Forget all the resident sounds (a new level): their room in the sound RAM is free again.
| bool jo_audio_is_cd_paused | ( | void | ) |
Check if the CD audio is paused (see jo_audio_pause_cd()).
| bool jo_audio_is_cd_playing | ( | void | ) |
Check if the CD drive is playing.
| bool jo_audio_is_channel_playing | ( | const unsigned char | channel | ) |
Checks whether a given audio channel is currently playing a sound.
| channel | Channel to check (0 to JO_SOUND_MAX_CHANNEL - 1) |
| bool jo_audio_load_pcm | ( | const char *const | filename, |
| const jo_sound_mode | mode, | ||
| jo_sound * | sound ) |
Load PCM file from CD.
| filename | Pcm filename (example: A.PCM) |
| mode | PCM audio mode (JoSoundMono16Bit, etc) |
| sound | Sound definition (output) |
| bool jo_audio_load_pcm_async | ( | const char *const | filename, |
| const jo_sound_mode | mode, | ||
| jo_sound * | sound ) |
Load PCM file from CD asynchronously.
| filename | Pcm filename (example: A.PCM) |
| mode | PCM audio mode (JoSoundMono16Bit, etc) |
| sound | Sound definition (output) |
| bool jo_audio_load_wav | ( | const char *const | filename, |
| jo_sound * | sound ) |
Load a WAV file from CD (PCM, 8 or 16 bits, mono or stereo, any sample rate: the sound gets its mode and its sample rate from the file).
| filename | WAV filename (example: SHOT.WAV) |
| sound | Sound definition (output) |
| bool jo_audio_make_resident | ( | jo_sound * | sound | ) |
Keep a sound in the sound RAM (512 KB) and free its copy in the work RAM (the jo_malloc() memory).
| sound | Sound loaded (jo_audio_load_pcm(), jo_audio_load_wav()) |
| void jo_audio_pause_cd | ( | void | ) |
Pause the audio track played by jo_audio_play_cd_track().
| void jo_audio_play_cd_track | ( | const int | from_track, |
| const int | to_track, | ||
| const bool | repeat_infinitely ) |
Play a track from the CD.
| from_track | First track index to play |
| to_track | Last track index to play |
| repeat_infinitely | Play tracks infinitely or not |
| void jo_audio_play_sound | ( | jo_sound *const | sound | ) |
Play a sound on first available channel.
| sound | Sound definition |
| void jo_audio_play_sound_loop_on_channel | ( | jo_sound *const | sound, |
| const unsigned char | channel ) |
Play a sound again and again on a specific channel, until the channel is stopped (an engine for instance).
| sound | Sound definition |
| channel | Channel (0 to JO_SOUND_MAX_CHANNEL - 1) |
| void jo_audio_play_sound_on_channel | ( | jo_sound *const | sound, |
| const unsigned char | channel ) |
Play a sound on a specific channel.
| sound | Sound definition |
| channel | Channel (0 to JO_SOUND_MAX_CHANNEL - 1) |
| void jo_audio_resume_cd | ( | void | ) |
Resume the audio track paused by jo_audio_pause_cd().
| void jo_audio_set_cd_volume | ( | const unsigned char | level | ) |
Set the level of the CD audio in the mix (the music tracks of the CD, see jo_audio_play_cd_track()).
| level | 0 (silent) to JO_AUDIO_CD_VOLUME_MAX (7, the default): each step halves the volume (-6 dB) |
| void jo_audio_set_channel_reverb | ( | const unsigned char | channel, |
| const unsigned char | level ) |
Change the send of the sound played on a channel to the reverberation (JO_COMPILE_WITH_AUDIO_DSP_MODULE).
| channel | Channel (0 to JO_SOUND_MAX_CHANNEL - 1) |
| level | 0 (none), 1 to 7 (-36 to 0 dB, 6 dB steps) |
| void jo_audio_set_channel_sample_rate | ( | const unsigned char | channel, |
| const unsigned short | sample_rate ) |
Change the sampling rate of the sound played on a channel (its pitch: a faster engine for instance).
| channel | Channel (0 to JO_SOUND_MAX_CHANNEL - 1) |
| sample_rate | Sampling rate (Hz, 1378 to 88200: 44100 / 32 to 44100 x 2) |
| void jo_audio_set_channel_volume | ( | const unsigned char | channel, |
| const unsigned char | volume ) |
Change the volume of the sound played on a channel.
| channel | Channel (0 to JO_SOUND_MAX_CHANNEL - 1) |
| volume | Volume: 0 (JO_MIN_AUDIO_VOLUME) to 127 (JO_MAX_AUDIO_VOLUME) |
| void jo_audio_set_volume | ( | const unsigned char | vol | ) |
Set the audio volume.
| vol | Volume level from 0 to 127 |
| void jo_audio_stop_cd | ( | void | ) |
Stop playing audio track.
| void jo_audio_stop_channel | ( | const unsigned char | channel | ) |
Stop the sound played on a channel.
| channel | Channel (0 to JO_SOUND_MAX_CHANNEL - 1) |
| void jo_audio_stop_sound | ( | const jo_sound *const | sound | ) |
Stop a sound.
| sound | Sound definition |
| int jo_audio_usage_percent | ( | void | ) |
Get audio channel usage.