sgdk
|
Z80_DRIVER_PCM4 sound driver API. More...
Go to the source code of this file.
Defines | |
#define | SND_isPlaying_4PCM_ENV _Pragma("GCC error \"This method is deprecated, use SND_PCM4_isPlaying instead.\"") |
#define | SND_startPlay_4PCM_ENV _Pragma("GCC error \"This method is deprecated, use SND_PCM4_startPlay instead.\"") |
#define | SND_stopPlay_4PCM_ENV _Pragma("GCC error \"This method is deprecated, use SND_PCM4_stopPlay instead.\"") |
#define | SND_getVolume_4PCM_ENV _Pragma("GCC error \"This method is deprecated, use SND_PCM4_getVolume instead.\"") |
#define | SND_setVolume_4PCM_ENV _Pragma("GCC error \"This method is deprecated, use SND_PCM4_setVolume instead.\"") |
#define | SND_isPlaying_4PCM _Pragma("GCC error \"This method is deprecated, use SND_PCM4_isPlaying instead.\"") |
#define | SND_startPlay_4PCM _Pragma("GCC error \"This method is deprecated, use SND_PCM4_startPlay instead.\"") |
#define | SND_stopPlay_4PCM _Pragma("GCC error \"This method is deprecated, use SND_PCM4_stopPlay instead.\"") |
#define | SND_getVolume_4PCM _Pragma("GCC error \"This method is deprecated, use SND_PCM4_getVolume instead.\"") |
#define | SND_setVolume_4PCM _Pragma("GCC error \"This method is deprecated, use SND_PCM4_setVolume instead.\"") |
Functions | |
void | SND_PCM4_loadDriver (const bool waitReady) |
Load the Z80_DRIVER_PCM4 sound driver. | |
void | SND_PCM4_unloadDriver (void) |
Unload the Z80_DRIVER_PCM4 sound driver. | |
bool | SND_PCM4_isPlaying (const u16 channel_mask) |
Return play status of specified channel (4 channels PCM player driver). | |
void | SND_PCM4_startPlay (const u8 *sample, const u32 len, const SoundPCMChannel channel, const bool loop) |
Start playing a sample on specified channel (4 channels PCM player driver). If a sample was currently playing on this channel then it's stopped and the new sample is played instead. | |
void | SND_PCM4_stopPlay (const SoundPCMChannel channel) |
Stop playing the specified channel (4 channels PCM player driver). No effect if no sample was currently playing on this channel. | |
void | SND_PCM4_setVolume (const SoundPCMChannel channel, const u8 volume) |
Change envelop / volume of specified channel (4 channels PCM player driver). | |
u8 | SND_PCM4_getVolume (const SoundPCMChannel channel) |
Return envelop / volume level of specified channel (4 channels PCM player driver). |
Z80_DRIVER_PCM4 sound driver API.
This unit provides playback method for the Z80_DRIVER_PCM4 sound driver.
Sound driver description:
4 channels 8 bits signed sample driver with volume support.
It can mix up to 4 samples (8 bit signed) at a fixed 16 Khz rate.
with volume support (16 levels du to memory limitation).
Address and size of samples have to be 256 bytes boundary.
The driver does support "cutoff" when mixing so you can use true 8 bits samples :)
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)
u8 SND_PCM4_getVolume | ( | const SoundPCMChannel | channel | ) |
Return envelop / volume level of specified channel (4 channels PCM player driver).
channel | Channel we want to retrieve envelop level, accepted values are: SOUND_PCM_CH1 = channel 1 SOUND_PCM_CH2 = channel 2 SOUND_PCM_CH3 = channel 3 SOUND_PCM_CH4 = channel 4 |
Return play status of specified channel (4 channels PCM player driver).
channel_mask | Channel(s) we want to retrieve play state. SOUND_PCM_CH1_MSK = channel 1 SOUND_PCM_CH2_MSK = channel 2 SOUND_PCM_CH3_MSK = channel 3 SOUND_PCM_CH4_MSK = channel 4 You can combine mask to retrieve state of severals channels at once: SND_PCM4_isPlaying(SOUND_PCM_CH1_MSK | SOUND_PCM_CH2_MSK) will actually return play state for channel 1 and channel 2. |
void SND_PCM4_loadDriver | ( | const bool | waitReady | ) |
Load the Z80_DRIVER_PCM4 sound driver.
Don't use this method directly, use Z80_loadDriver(..) instead.
void SND_PCM4_setVolume | ( | const SoundPCMChannel | channel, |
const u8 | volume | ||
) |
Change envelop / volume of specified channel (4 channels PCM player driver).
channel | Channel we want to set envelop, accepted values are: SOUND_PCM_CH1 = channel 1 SOUND_PCM_CH2 = channel 2 SOUND_PCM_CH3 = channel 3 SOUND_PCM_CH4 = channel 4 |
volume | Volume to set: 16 possible level from 0 (minimum) to 15 (maximum). |
void SND_PCM4_startPlay | ( | const u8 * | sample, |
const u32 | len, | ||
const SoundPCMChannel | channel, | ||
const bool | loop | ||
) |
Start playing a sample on specified channel (4 channels PCM player driver).
If a sample was currently playing on this channel then it's stopped and the new sample is played instead.
sample | Sample address, should be 256 bytes boundary aligned SGDK automatically align resource as needed |
len | Size of sample in bytes, should be a multiple of 256 SGDK automatically adjust resource size as needed |
channel | Channel 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 SOUND_PCM_CH3 = channel 3 SOUND_PCM_CH4 = channel 4 |
loop | Loop flag. If TRUE then the sample will be played in loop (else sample is played only once). |
void SND_PCM4_stopPlay | ( | const SoundPCMChannel | channel | ) |
Stop playing the specified channel (4 channels PCM player driver).
No effect if no sample was currently playing on this channel.
channel | Channel we want to stop, accepted values are: SOUND_PCM_CH1 = channel 1 SOUND_PCM_CH2 = channel 2 SOUND_PCM_CH3 = channel 3 SOUND_PCM_CH4 = channel 4 |
void SND_PCM4_unloadDriver | ( | void | ) |
Unload the Z80_DRIVER_PCM4 sound driver.
Don't use this method directly, use Z80_unloadDriver(..) instead.