libmsx
C library for MSX
Loading...
Searching...
No Matches

SNDDRV APIs. More...

+ Collaboration diagram for SNDDRV APIs:

Macros

#define SND_SPEED_1X   (16)
 The value of the playback speed multiplier for 1.0x speed.
 

Functions

uint8_t snd_get_bgm_frequency (void)
 MSX Returns default frequency of the background music.
 
uint8_t snd_get_player_frequency (void)
 MSX Returns current player frequency of the background music.
 
void snd_set_player_frequency (uint8_t freq)
 MSX Force player frequency of the background music.
 
void snd_set_speed (uint8_t multiplier)
 MSX Sets the playback speed multiplier for background music.
 
void snd_set_repeat (bool repeat)
 MSX Turn on/off the auto-repeat of the BGM.
 
void snd_set_bgm (uint8_t index, const snd_SoundAssets *sa)
 MSX Sets the specified music as BGM in the sound driver.
 
void snd_set_sfx (uint8_t index, const snd_SoundAssets *sa)
 MSX Sets the specified music as SFX (sound effects) in the sound driver.
 
void snd_set_sfx_with_priority (uint8_t index, const snd_SoundAssets *sa, uint8_t priority)
 MSX Sets the specified music as SFX (sound effects) in the sound driver.
 
bool snd_is_playing (void)
 MSX Return whether BGM and/or SFX is playing or not.
 
bool snd_is_playing_bgm (void)
 MSX Return whether BGM is playing or not.
 
bool snd_is_playing_sfx (void)
 MSX Return whether SFX is playing or not.
 
void snd_init (void)
 MSX Initialize the PSG and the sound driver.
 
void snd_start (void)
 MSX Start / Resume music.
 
void snd_pause (void)
 MSX Pause music.
 
bool snd_is_paused (void)
 MSX Return whether paused or not.
 
void snd_stop (void)
 MSX Stop music.
 
void snd_play (void)
 MSX Main routine of the sound driver.
 

Variables

const AudioDecoder SND_BGM_DECODER
 
const AudioDecoder SND_SFX_DECODER
 

Detailed Description

SNDDRV APIs.

Macro Definition Documentation

◆ SND_SPEED_1X

#define SND_SPEED_1X   (16)

The value of the playback speed multiplier for 1.0x speed.

See also
snd_set_speed()

Definition at line 65 of file snddrv.h.

Function Documentation

◆ snd_get_bgm_frequency()

uint8_t snd_get_bgm_frequency ( void  )

MSX Returns default frequency of the background music.

Returns
frequency in Hz.
See also
snd_set_speed()
audio_get_bgm_frequency()
audio_set_bgm_frequency()

◆ snd_get_player_frequency()

uint8_t snd_get_player_frequency ( void  )

MSX Returns current player frequency of the background music.

Returns
frequency in Hz.
Deprecated:
Use audio_get_bgm_frequency() instead.
See also
The libmsx audio replayer.

◆ snd_set_player_frequency()

void snd_set_player_frequency ( uint8_t  freq)

MSX Force player frequency of the background music.

Parameters
freqfrequency in Hz.
See also
snd_get_bgm_frequency()
snd_set_speed()
Note
When a music is set by snd_set_bgm(), the player frequency is calculated regarding to the default frequency of the music and the speed set by snd_set_speed().
Deprecated:
Use audio_set_bgm_frequency() instead.
See also
The libmsx audio replayer.

◆ snd_set_speed()

void snd_set_speed ( uint8_t  multiplier)

MSX Sets the playback speed multiplier for background music.

This function is used to control the playback speed of background music.

The playback speed multiplier is specified by a value of 16 times. For example, a value of 16 means a playback speed of 1.0x, and a value of 24 means 1.5x. (i.e. Speed multiplier values are fixed-point numbers with a 4-bit integer part and a 4-bit decimal part.)

snd_set_speed(SND_SPEED_1X * 2); // 2.0x faster playback
snd_set_speed(SND_SPEED_1X / 4); // 1/4x slower playback
void snd_set_speed(uint8_t multiplier)
MSX Sets the playback speed multiplier for background music.
#define SND_SPEED_1X
The value of the playback speed multiplier for 1.0x speed.
Definition snddrv.h:65
Parameters
multiplierthe playback speed multiplier
See also
SND_SPEED_1X
snd_get_bgm_frequency()
audio_get_bgm_frequency()
audio_set_bgm_frequency()

◆ snd_set_repeat()

void snd_set_repeat ( bool  repeat)

MSX Turn on/off the auto-repeat of the BGM.

Parameters
repeattrue: turn on, false: turn off
Deprecated:
Use audio_set_repeat() instead.
See also
The libmsx audio replayer.

◆ snd_set_bgm()

void snd_set_bgm ( uint8_t  index,
const snd_SoundAssets sa 
)

MSX Sets the specified music as BGM in the sound driver.

Parameters
indexNumber of a music to be played as BGM.
saPointer to the sound assets that contains the music.

◆ snd_set_sfx()

void snd_set_sfx ( uint8_t  index,
const snd_SoundAssets sa 
)

MSX Sets the specified music as SFX (sound effects) in the sound driver.

Parameters
indexNumber of a music to be played as SFX.
saPointer to the sound assets that contains the music.
Note
Same as snd_set_sfx_with_priority(index, sa, 0).

◆ snd_set_sfx_with_priority()

void snd_set_sfx_with_priority ( uint8_t  index,
const snd_SoundAssets sa,
uint8_t  priority 
)

MSX Sets the specified music as SFX (sound effects) in the sound driver.

If a SFX is not being played, or if the given priority is higher than or equal to that of the currently playing SFX, the specified SFX will be played. Otherwise, nothing will be done.

Parameters
indexNumber of a music to be played as SFX.
saPointer to the sound assets that contains the music.
priorityPriority of the SFX.

◆ snd_is_playing()

bool snd_is_playing ( void  )

MSX Return whether BGM and/or SFX is playing or not.

Returns
true if BGM and/or SFX is playing.
Deprecated:
Use audio_is_playing() instead.
See also
The libmsx audio replayer.

◆ snd_is_playing_bgm()

bool snd_is_playing_bgm ( void  )

MSX Return whether BGM is playing or not.

Returns
true if BGM is playing.
Deprecated:
Use audio_is_playing_bgm() instead.
See also
The libmsx audio replayer.

◆ snd_is_playing_sfx()

bool snd_is_playing_sfx ( void  )

MSX Return whether SFX is playing or not.

Returns
true if SFX is playing.
Deprecated:
Use audio_is_playing_sfx() instead.
See also
The libmsx audio replayer.

◆ snd_init()

void snd_init ( void  )

MSX Initialize the PSG and the sound driver.

Deprecated:
Use audio_init() instead.
See also
The libmsx audio replayer.

◆ snd_start()

void snd_start ( void  )

MSX Start / Resume music.

Deprecated:
Use audio_start() instead.
See also
The libmsx audio replayer.

◆ snd_pause()

void snd_pause ( void  )

MSX Pause music.

Deprecated:
Use audio_pause() instead.
See also
The libmsx audio replayer.

◆ snd_is_paused()

bool snd_is_paused ( void  )

MSX Return whether paused or not.

Deprecated:
Use audio_is_paused() instead.
See also
The libmsx audio replayer.

◆ snd_stop()

void snd_stop ( void  )

MSX Stop music.

Deprecated:
Use audio_stop() instead.
See also
The libmsx audio replayer.

◆ snd_play()

void snd_play ( void  )

MSX Main routine of the sound driver.

Deprecated:
Use audio_play() instead.
See also
The libmsx audio replayer.

Variable Documentation

◆ SND_BGM_DECODER

const AudioDecoder SND_BGM_DECODER
extern

◆ SND_SFX_DECODER

const AudioDecoder SND_SFX_DECODER
extern