Add ndspChnIsPaused/ndspChnSetPaused (untested)

This commit is contained in:
fincs 2016-01-28 23:46:03 +01:00
parent 27b6134bf2
commit 8cd37c627c
2 changed files with 32 additions and 2 deletions

View File

@ -81,6 +81,21 @@ u32 ndspChnGetSamplePos(int id);
* @return The sequence ID of the wave buffer.
*/
u16 ndspChnGetWaveBufSeq(int id);
/**
* @brief Checks whether a channel is currently paused.
* @param id ID of the channel (0..23).
* @return Whether the channel is currently paused.
*/
bool ndspChnIsPaused(int id);
/**
* @brief Sets the pause status of a channel.
* @param id ID of the channel (0..23).
* @param paused Whether the channel is to be paused (true) or unpaused (false).
*/
void ndspChnSetPaused(int id, bool paused);
///@}
///@name Configuration

View File

@ -24,7 +24,7 @@ typedef struct
ndspWaveBuf* waveBuf;
u16 wavBufCount, wavBufIdNext;
bool playing;
bool playing, paused;
u8 interpType, iirFilterType;
u16 format;
@ -52,6 +52,7 @@ void ndspChnReset(int id)
chn->wavBufIdNext = 0;
chn->wavBufSeq = 0;
chn->playing = false;
chn->paused = false;
chn->interpType = 0;
chn->iirFilterType = 0;
chn->format = NDSP_FORMAT_PCM16;
@ -89,6 +90,20 @@ void ndspChnSetFormat(int id, u16 format)
ndspChn[id].format = format;
}
bool ndspChnIsPaused(int id)
{
return ndspChn[id].paused;
}
void ndspChnSetPaused(int id, bool paused)
{
ndspChnSt* chn = &ndspChn[id];
LightLock_Lock(&chn->lock);
chn->paused = paused;
chn->flags |= CFLAG_PLAYSTATUS;
LightLock_Unlock(&chn->lock);
}
void ndspChnSetInterp(int id, ndspInterpType type)
{
ndspChnSt* chn = &ndspChn[id];
@ -336,7 +351,7 @@ void ndspiUpdateChn(void)
if (flags & CFLAG_PLAYSTATUS)
{
u16 playStatus = st->playStatus &~ 0xFF;
if (chn->playing)
if (chn->playing && !chn->paused)
playStatus |= 1;
st->playStatus = playStatus;
stflags |= 0x10000;