sgdk
snd_dpcm2.h File Reference

Z80_DRIVER_DPCM2 sound driver API. More...

Go to the source code of this file.

Defines

#define SND_isPlaying_2ADPCM   _Pragma("GCC error \"This method is deprecated, use SND_DPCM2_isPlaying instead.\"")
#define SND_startPlay_2ADPCM   _Pragma("GCC error \"This method is deprecated, use SND_DPCM2_startPlay instead.\"")
#define SND_stopPlay_2ADPCM   _Pragma("GCC error \"This method is deprecated, use SND_DPCM2_stopPlay instead.\"")

Functions

void SND_DPCM2_loadDriver (const bool waitReady)
 Load the Z80_DRIVER_DPCM2 sound driver.
void SND_DPCM2_unloadDriver (void)
 Unload the Z80_DRIVER_DPCM2 sound driver.
bool SND_DPCM2_isPlaying (const u16 channel_mask)
 Return play status of specified channel (2 channels ADPCM player driver).
void SND_DPCM2_startPlay (const u8 *sample, const u32 len, const SoundPCMChannel channel, const bool loop)
 Start playing a sample on specified channel (2 channels ADPCM player driver).
If a sample was currently playing on this channel then it's stopped and the new sample is played instead.
void SND_DPCM2_stopPlay (const SoundPCMChannel channel)
 Stop playing the specified channel (2 channels ADPCM player driver).
No effect if no sample was currently playing on this channel.

Detailed Description

Z80_DRIVER_DPCM2 sound driver API.

Author:
Stephane Dallongeville
Date:
08/2011

This unit provides playback method for the Z80_DRIVER_DPCM2 sound driver.
Sound driver description:
2 channels 4 bits DPCM sample driver, it can mix up to 2 DCPM samples at a fixed 22050 Hz Khz rate.
Address and size of samples have to be 256 bytes boundary.

Note that SGDK sound drivers may not fit your needs so it's important to know
that some alternatives sound drivers exist (see SGDK readme.md for more info)


Function Documentation

bool SND_DPCM2_isPlaying ( const u16  channel_mask)

Return play status of specified channel (2 channels ADPCM player driver).

Parameters:
channel_maskChannel(s) we want to retrieve play state.
SOUND_PCM_CH1_MSK = channel 1
SOUND_PCM_CH2_MSK = channel 2

You can combine mask to retrieve state of severals channels at once:
isPlaying_2ADPCM(SOUND_PCM_CH1_MSK | SOUND_PCM_CH2_MSK)
will actually return play state for channel 1 and channel 2.
Returns:
Return TRUE if specified channel(s) is(are) playing.
void SND_DPCM2_loadDriver ( const bool  waitReady)

Load the Z80_DRIVER_DPCM2 sound driver.

Don't use this method directly, use Z80_loadDriver(..) instead.

void SND_DPCM2_startPlay ( const u8 sample,
const u32  len,
const SoundPCMChannel  channel,
const bool  loop 
)

Start playing a sample on specified channel (2 channels ADPCM player driver).
If a sample was currently playing on this channel then it's stopped and the new sample is played instead.

Parameters:
sampleSample address, should be 128 bytes boundary aligned
SGDK automatically align resource as needed
lenSize of sample in bytes, should be a multiple of 128
SGDK automatically adjust resource size as needed
channelChannel where we want to play sample, accepted values are:
SOUND_PCM_CH_AUTO = auto selection from current channel usage
SOUND_PCM_CH1 = channel 1
SOUND_PCM_CH2 = channel 2
loopLoop flag.
If TRUE then the sample will be played in loop (else sample is played only once).
void SND_DPCM2_stopPlay ( const SoundPCMChannel  channel)

Stop playing the specified channel (2 channels ADPCM player driver).
No effect if no sample was currently playing on this channel.

Parameters:
channelChannel we want to stop, accepted values are:
SOUND_PCM_CH1 = channel 1
SOUND_PCM_CH2 = channel 2
void SND_DPCM2_unloadDriver ( void  )

Unload the Z80_DRIVER_DPCM2 sound driver.

Don't use this method directly, use Z80_unloadDriver(..) instead.

 All Classes Files Functions Variables Typedefs Enumerations Enumerator Defines