Jo Engine  9
Jo Sega Saturn Engine
Data Structures | Macros | Enumerations | Functions
audio.h File Reference

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
 
#define JO_DEFAULT_AUDIO_VOLUME
 Default audio volume. More...
 
#define JO_MAX_AUDIO_VOLUME
 Max audio volume available for jo_audio_set_volume() More...
 
#define JO_MIN_AUDIO_VOLUME
 Min audio volume available for jo_audio_set_volume() More...
 

Enumerations

enum  jo_sound_mode { JoSoundMono8Bit, JoSoundMono16Bit, JoSoundStereo8Bit, JoSoundStereo16Bit }
 

Functions

void jo_audio_play_cd_track (const int fromTrack, const int totrack, const int loop)
 Play a track from the CD. More...
 
void jo_audio_set_volume (const unsigned char vol)
 Set the audio volume. More...
 
void jo_audio_stop_cd (void)
 Stop playing audio track. More...
 
void jo_audio_play_sound_on_channel (jo_sound *const sound, const unsigned char channel)
 Play a sound on a specific channel. More...
 
void jo_audio_play_sound (jo_sound *const sound)
 Play a sound on first available channel. More...
 
void jo_audio_stop_sound (const jo_sound *const sound)
 Stop a sound. More...
 
bool jo_audio_load_pcm (const char *const filename, const jo_sound_mode mode, jo_sound *sound)
 Load PCM file from CD. More...
 
void jo_audio_free_pcm (jo_sound *sound)
 Free pcm sound loaded with jo_audio_load_pcm() More...
 
int jo_audio_usage_percent (void)
 Get audio channel usage. More...
 

Detailed Description

Jo Engine Function prototypes for audio.

Author
Johannes Fetz
Bug:
No known bugs.

Data Structure Documentation

struct jo_sound
Data Fields
unsigned char current_playing_channel
char * data
unsigned int data_length
jo_sound_mode mode

Macro Definition Documentation

#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

Enumeration Type Documentation

Enumerator
JoSoundMono8Bit 
JoSoundMono16Bit 
JoSoundStereo8Bit 
JoSoundStereo16Bit 

Function Documentation

void jo_audio_free_pcm ( jo_sound sound)

Free pcm sound loaded with jo_audio_load_pcm()

Parameters
soundSound definition
bool jo_audio_load_pcm ( const char *const  filename,
const jo_sound_mode  mode,
jo_sound sound 
)

Load PCM file from CD.

Parameters
filenamePcm filename (example: A.PCM)
modePCM audio mode (JoSoundMono16Bit, etc)
soundSound definition (output)
Remarks
To convert any audio file to PCM under Linux or Windows => http://ffmpeg.org
ffmpeg -i A.WAV -f s8 -ar 44100 A.PCM
ffmpeg -i A.MP3 -f s8 -ac 1 -ar 8000 A.PCM
Returns
true if succeed otherwise false
void jo_audio_play_cd_track ( const int  fromTrack,
const int  totrack,
const int  loop 
)

Play a track from the CD.

Parameters
fromTrackFirst track index to play
totrackLast track index to play
loop1 to enable repeat mode or 0
void jo_audio_play_sound ( jo_sound *const  sound)

Play a sound on first available channel.

Parameters
soundSound definition
void jo_audio_play_sound_on_channel ( jo_sound *const  sound,
const unsigned char  channel 
)

Play a sound on a specific channel.

Parameters
soundSound definition
channelChannel (0 to 6)
void jo_audio_set_volume ( const unsigned char  vol)

Set the audio volume.

Parameters
volVolume level from 0 to 127
void jo_audio_stop_cd ( void  )

Stop playing audio track.

void jo_audio_stop_sound ( const jo_sound *const  sound)

Stop a sound.

Parameters
soundSound definition
int jo_audio_usage_percent ( void  )

Get audio channel usage.

Returns
Audio channel usage percent
Remarks
jo_printf(0, 0, "Audio channel usage: %d%% ", jo_audio_usage_percent());