add various ndspChnGet* methods (#506)

This commit is contained in:
TurtleP 2022-09-14 13:35:11 -04:00 committed by GitHub
parent e6fcbef36c
commit ef806d5bd8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 49 additions and 0 deletions

View File

@ -107,6 +107,14 @@ void ndspChnSetPaused(int id, bool paused);
*/
void ndspChnSetFormat(int id, u16 format);
/**
*
* @brief Gets the format of a channel.
* @param id ID of the channel (0..23).
* @return The format of the channel.
*/
u16 ndspChnGetFormat(int id);
/**
* @brief Sets the interpolation type of a channel.
* @param id ID of the channel (0..23).
@ -114,6 +122,13 @@ void ndspChnSetFormat(int id, u16 format);
*/
void ndspChnSetInterp(int id, ndspInterpType type);
/**
* @brief Gets the interpolation type of a channel.
* @param id ID of the channel (0..23).
* @return The interpolation type of the channel.
*/
ndspInterpType ndspChnGetInterp(int id);
/**
* @brief Sets the sample rate of a channel.
* @param id ID of the channel (0..23).
@ -121,6 +136,13 @@ void ndspChnSetInterp(int id, ndspInterpType type);
*/
void ndspChnSetRate(int id, float rate);
/**
* @brief Gets the sample rate of a channel.
* @param id ID of the channel (0..23).
* @return The sample rate of the channel.
*/
float ndspChnGetRate(int id);
/**
* @brief Sets the mix parameters (volumes) of a channel.
* @param id ID of the channel (0..23).
@ -134,6 +156,13 @@ void ndspChnSetRate(int id, float rate);
*/
void ndspChnSetMix(int id, float mix[12]);
/**
* @brief Gets the mix parameters (volumes) of a channel.
* @param id ID of the channel (0..23)
* @param mix Mix parameters to write out to. See \ref ndspChnSetMix.
*/
void ndspChnGetMix(int id, float* mix[12]);
/**
* @brief Sets the DSPADPCM coefficients of a channel.
* @param id ID of the channel (0..23).

View File

@ -123,6 +123,12 @@ void ndspChnSetInterp(int id, ndspInterpType type)
LightLock_Unlock(&chn->lock);
}
ndspInterpType ndspChnGetInterp(int id)
{
ndspChnSt* chn = &ndspChn[id];
return chn->interpType;
}
void ndspChnSetRate(int id, float rate)
{
ndspChnSt* chn = &ndspChn[id];
@ -132,6 +138,12 @@ void ndspChnSetRate(int id, float rate)
LightLock_Unlock(&chn->lock);
}
float ndspChnGetRate(int id)
{
ndspChnSt* chn = &ndspChn[id];
return chn->rate;
}
void ndspChnSetMix(int id, float mix[12])
{
ndspChnSt* chn = &ndspChn[id];
@ -141,6 +153,14 @@ void ndspChnSetMix(int id, float mix[12])
LightLock_Unlock(&chn->lock);
}
void ndspChnGetMix(int id, float out_mix[12])
{
ndspChnSt* chn = &ndspChn[id];
LightLock_Lock(&chn->lock);
memcpy(out_mix, chn->mix, sizeof(ndspChn[id].mix));
LightLock_Unlock(&chn->lock);
}
void ndspChnSetAdpcmCoefs(int id, u16 coefs[16])
{
ndspChnSt* chn = &ndspChn[id];