Add ndspChnIsPaused/ndspChnSetPaused (untested)
This commit is contained in:
parent
27b6134bf2
commit
8cd37c627c
@ -81,6 +81,21 @@ u32 ndspChnGetSamplePos(int id);
|
|||||||
* @return The sequence ID of the wave buffer.
|
* @return The sequence ID of the wave buffer.
|
||||||
*/
|
*/
|
||||||
u16 ndspChnGetWaveBufSeq(int id);
|
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
|
///@name Configuration
|
||||||
|
@ -24,7 +24,7 @@ typedef struct
|
|||||||
ndspWaveBuf* waveBuf;
|
ndspWaveBuf* waveBuf;
|
||||||
u16 wavBufCount, wavBufIdNext;
|
u16 wavBufCount, wavBufIdNext;
|
||||||
|
|
||||||
bool playing;
|
bool playing, paused;
|
||||||
u8 interpType, iirFilterType;
|
u8 interpType, iirFilterType;
|
||||||
|
|
||||||
u16 format;
|
u16 format;
|
||||||
@ -52,6 +52,7 @@ void ndspChnReset(int id)
|
|||||||
chn->wavBufIdNext = 0;
|
chn->wavBufIdNext = 0;
|
||||||
chn->wavBufSeq = 0;
|
chn->wavBufSeq = 0;
|
||||||
chn->playing = false;
|
chn->playing = false;
|
||||||
|
chn->paused = false;
|
||||||
chn->interpType = 0;
|
chn->interpType = 0;
|
||||||
chn->iirFilterType = 0;
|
chn->iirFilterType = 0;
|
||||||
chn->format = NDSP_FORMAT_PCM16;
|
chn->format = NDSP_FORMAT_PCM16;
|
||||||
@ -89,6 +90,20 @@ void ndspChnSetFormat(int id, u16 format)
|
|||||||
ndspChn[id].format = 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)
|
void ndspChnSetInterp(int id, ndspInterpType type)
|
||||||
{
|
{
|
||||||
ndspChnSt* chn = &ndspChn[id];
|
ndspChnSt* chn = &ndspChn[id];
|
||||||
@ -336,7 +351,7 @@ void ndspiUpdateChn(void)
|
|||||||
if (flags & CFLAG_PLAYSTATUS)
|
if (flags & CFLAG_PLAYSTATUS)
|
||||||
{
|
{
|
||||||
u16 playStatus = st->playStatus &~ 0xFF;
|
u16 playStatus = st->playStatus &~ 0xFF;
|
||||||
if (chn->playing)
|
if (chn->playing && !chn->paused)
|
||||||
playStatus |= 1;
|
playStatus |= 1;
|
||||||
st->playStatus = playStatus;
|
st->playStatus = playStatus;
|
||||||
stflags |= 0x10000;
|
stflags |= 0x10000;
|
||||||
|
Loading…
Reference in New Issue
Block a user