add various ndspGet* methods (#505)

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

View File

@ -118,24 +118,48 @@ u32 ndspGetFrameCount(void);
*/ */
void ndspSetMasterVol(float volume); void ndspSetMasterVol(float volume);
/**
* @brief Gets the master volume.
* @return The master volume.
*/
float ndspGetMasterVol(void);
/** /**
* @brief Sets the output mode. * @brief Sets the output mode.
* @param mode Output mode to set. Defaults to NDSP_OUTPUT_STEREO. * @param mode Output mode to set. Defaults to NDSP_OUTPUT_STEREO.
*/ */
void ndspSetOutputMode(ndspOutputMode mode); void ndspSetOutputMode(ndspOutputMode mode);
/**
* @brief Gets the output mode.
* @return The output mode.
*/
ndspOutputMode ndspGetOutputMode(void);
/** /**
* @brief Sets the clipping mode. * @brief Sets the clipping mode.
* @param mode Clipping mode to set. Defaults to NDSP_CLIP_SOFT. * @param mode Clipping mode to set. Defaults to NDSP_CLIP_SOFT.
*/ */
void ndspSetClippingMode(ndspClippingMode mode); void ndspSetClippingMode(ndspClippingMode mode);
/**
* @brief Gets the clipping mode.
* @return The clipping mode.
*/
ndspClippingMode ndspGetClippingMode(void);
/** /**
* @brief Sets the output count. * @brief Sets the output count.
* @param count Output count to set. Defaults to 2. * @param count Output count to set. Defaults to 2.
*/ */
void ndspSetOutputCount(int count); void ndspSetOutputCount(int count);
/**
* @brief Gets the output count.
* @return The output count.
*/
int ndspGetOutputCount(void);
/** /**
* @brief Sets the wave buffer to capture audio to. * @brief Sets the wave buffer to capture audio to.
* @param capture Wave buffer to capture to. * @param capture Wave buffer to capture to.
@ -158,17 +182,35 @@ void ndspSetCallback(ndspCallback callback, void* data);
*/ */
void ndspSurroundSetDepth(u16 depth); void ndspSurroundSetDepth(u16 depth);
/**
* @brief Gets the surround sound depth.
* @return The surround sound depth.
*/
u16 ndspSurroundGetDepth(void);
/** /**
* @brief Sets the surround sound position. * @brief Sets the surround sound position.
* @param pos Position to set. Defaults to NDSP_SPKPOS_SQUARE. * @param pos Position to set. Defaults to NDSP_SPKPOS_SQUARE.
*/ */
void ndspSurroundSetPos(ndspSpeakerPos pos); void ndspSurroundSetPos(ndspSpeakerPos pos);
/**
* @brief Gets the surround sound position.
* @return The surround sound speaker position.
*/
ndspSpeakerPos ndspSurroundGetPos(void);
/** /**
* @brief Sets the surround sound rear ratio. * @brief Sets the surround sound rear ratio.
* @param ratio Rear ratio to set. Defaults to 0x8000. * @param ratio Rear ratio to set. Defaults to 0x8000.
*/ */
void ndspSurroundSetRearRatio(u16 ratio); void ndspSurroundSetRearRatio(u16 ratio);
/**
* @brief Gets the surround sound rear ratio.
* @return The rear ratio.
*/
u16 ndspSurroundGetRearRatio(void);
///@} ///@}
///@name Auxiliary output ///@name Auxiliary output
@ -180,6 +222,13 @@ void ndspSurroundSetRearRatio(u16 ratio);
*/ */
void ndspAuxSetEnable(int id, bool enable); void ndspAuxSetEnable(int id, bool enable);
/**
* @brief Gets whether auxiliary output is enabled.
* @param id ID of the auxiliary output.
* @return Whether auxiliary output is enabled.
*/
bool ndspAuxIsEnabled(int id);
/** /**
* @brief Configures whether an auxiliary output should use front bypass. * @brief Configures whether an auxiliary output should use front bypass.
* @param id ID of the auxiliary output. * @param id ID of the auxiliary output.
@ -187,6 +236,13 @@ void ndspAuxSetEnable(int id, bool enable);
*/ */
void ndspAuxSetFrontBypass(int id, bool bypass); void ndspAuxSetFrontBypass(int id, bool bypass);
/**
* @brief Gets whether auxiliary output front bypass is enabled.
* @param id ID of the auxiliary output.
* @return Whether auxiliary output front bypass is enabled.
*/
bool ndspAuxGetFrontBypass(int id);
/** /**
* @brief Sets the volume of an auxiliary output. * @brief Sets the volume of an auxiliary output.
* @param id ID of the auxiliary output. * @param id ID of the auxiliary output.
@ -194,6 +250,13 @@ void ndspAuxSetFrontBypass(int id, bool bypass);
*/ */
void ndspAuxSetVolume(int id, float volume); void ndspAuxSetVolume(int id, float volume);
/**
* @brief Gets the volume of an auxiliary output.
* @param id ID of the auxiliary output.
* @return Volume of the auxiliary output.
*/
float ndspAuxGetVolume(int id);
/** /**
* @brief Sets the callback of an auxiliary output. * @brief Sets the callback of an auxiliary output.
* @param id ID of the auxiliary output. * @param id ID of the auxiliary output.

View File

@ -612,6 +612,11 @@ void ndspSetMasterVol(float volume)
LightLock_Unlock(&ndspMaster.lock); LightLock_Unlock(&ndspMaster.lock);
} }
void ndspGetMasterVol(void)
{
return ndspMaster.masterVol;
}
void ndspSetOutputMode(ndspOutputMode mode) void ndspSetOutputMode(ndspOutputMode mode)
{ {
LightLock_Lock(&ndspMaster.lock); LightLock_Lock(&ndspMaster.lock);
@ -620,6 +625,11 @@ void ndspSetOutputMode(ndspOutputMode mode)
LightLock_Unlock(&ndspMaster.lock); LightLock_Unlock(&ndspMaster.lock);
} }
ndspOutputMode ndspGetOutputMode(void)
{
return ndspMaster.outputMode;
}
void ndspSetClippingMode(ndspClippingMode mode) void ndspSetClippingMode(ndspClippingMode mode)
{ {
LightLock_Lock(&ndspMaster.lock); LightLock_Lock(&ndspMaster.lock);
@ -628,6 +638,11 @@ void ndspSetClippingMode(ndspClippingMode mode)
LightLock_Unlock(&ndspMaster.lock); LightLock_Unlock(&ndspMaster.lock);
} }
ndspClippingMode ndspGetClippingMode(void)
{
return ndspMaster.clippingMode;
}
void ndspSetOutputCount(int count) void ndspSetOutputCount(int count)
{ {
LightLock_Lock(&ndspMaster.lock); LightLock_Lock(&ndspMaster.lock);
@ -636,6 +651,11 @@ void ndspSetOutputCount(int count)
LightLock_Unlock(&ndspMaster.lock); LightLock_Unlock(&ndspMaster.lock);
} }
int ndspGetOutputCount(void)
{
return ndspMaster.outputCount;
}
void ndspSetCapture(ndspWaveBuf* capture) void ndspSetCapture(ndspWaveBuf* capture)
{ {
ndspMaster.capture = capture; ndspMaster.capture = capture;
@ -655,6 +675,11 @@ void ndspSurroundSetDepth(u16 depth)
LightLock_Unlock(&ndspMaster.lock); LightLock_Unlock(&ndspMaster.lock);
} }
u16 ndspSurroundGetDepth(void)
{
return ndspMaster.surround.depth;
}
void ndspSurroundSetPos(ndspSpeakerPos pos) void ndspSurroundSetPos(ndspSpeakerPos pos)
{ {
LightLock_Lock(&ndspMaster.lock); LightLock_Lock(&ndspMaster.lock);
@ -663,6 +688,11 @@ void ndspSurroundSetPos(ndspSpeakerPos pos)
LightLock_Unlock(&ndspMaster.lock); LightLock_Unlock(&ndspMaster.lock);
} }
ndspSpeakerPos ndspSurroundGetPos(void)
{
return ndspMaster.surround.pos;
}
void ndspSurroundSetRearRatio(u16 ratio) void ndspSurroundSetRearRatio(u16 ratio)
{ {
LightLock_Lock(&ndspMaster.lock); LightLock_Lock(&ndspMaster.lock);
@ -671,6 +701,11 @@ void ndspSurroundSetRearRatio(u16 ratio)
LightLock_Unlock(&ndspMaster.lock); LightLock_Unlock(&ndspMaster.lock);
} }
u16 ndspSurroundGetRearRatio(void)
{
return ndspMaster.surround.rearRatio;
}
void ndspAuxSetEnable(int id, bool enable) void ndspAuxSetEnable(int id, bool enable)
{ {
LightLock_Lock(&ndspMaster.lock); LightLock_Lock(&ndspMaster.lock);
@ -679,6 +714,11 @@ void ndspAuxSetEnable(int id, bool enable)
LightLock_Unlock(&ndspMaster.lock); LightLock_Unlock(&ndspMaster.lock);
} }
bool ndspAuxIsEnabled(int id)
{
return ndspMaster.aux[id].enable;
}
void ndspAuxSetFrontBypass(int id, bool bypass) void ndspAuxSetFrontBypass(int id, bool bypass)
{ {
LightLock_Lock(&ndspMaster.lock); LightLock_Lock(&ndspMaster.lock);
@ -687,6 +727,11 @@ void ndspAuxSetFrontBypass(int id, bool bypass)
LightLock_Unlock(&ndspMaster.lock); LightLock_Unlock(&ndspMaster.lock);
} }
bool ndspGetFrontBypass(int id)
{
return ndspMaster.aux[id].frontBypass;
}
void ndspAuxSetVolume(int id, float volume) void ndspAuxSetVolume(int id, float volume)
{ {
LightLock_Lock(&ndspMaster.lock); LightLock_Lock(&ndspMaster.lock);
@ -695,6 +740,11 @@ void ndspAuxSetVolume(int id, float volume)
LightLock_Unlock(&ndspMaster.lock); LightLock_Unlock(&ndspMaster.lock);
} }
float ndspAuxGetVolume(int id)
{
return ndspMaster.aux[id].volume;
}
void ndspAuxSetCallback(int id, ndspAuxCallback callback, void* data) void ndspAuxSetCallback(int id, ndspAuxCallback callback, void* data)
{ {
ndspMaster.aux[id].callback = callback; ndspMaster.aux[id].callback = callback;