From 1ad959ba6b4253a8e4e70a19b78f170b1c1dceeb Mon Sep 17 00:00:00 2001 From: TurtleP Date: Sun, 28 Aug 2022 16:49:31 -0400 Subject: [PATCH] add various ndspChnGet* functions --- libctru/include/3ds/ndsp/channel.h | 24 +++++++++++++++++++++++- libctru/source/ndsp/ndsp-channel.c | 18 ++++++++++++++++++ 2 files changed, 41 insertions(+), 1 deletion(-) diff --git a/libctru/include/3ds/ndsp/channel.h b/libctru/include/3ds/ndsp/channel.h index 764c32a..7cadd2d 100644 --- a/libctru/include/3ds/ndsp/channel.h +++ b/libctru/include/3ds/ndsp/channel.h @@ -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). @@ -137,7 +159,7 @@ void ndspChnSetMix(int id, float mix[12]); /** * @brief Gets the mix parameters (volumes) of a channel. * @param id ID of the channel (0..23) - * @return The mix parameters. + * @return The mix parameters. See \ref ndspChnSetMix. */ float* ndspChnGetMix(int id); diff --git a/libctru/source/ndsp/ndsp-channel.c b/libctru/source/ndsp/ndsp-channel.c index 3253dee..b2ac176 100644 --- a/libctru/source/ndsp/ndsp-channel.c +++ b/libctru/source/ndsp/ndsp-channel.c @@ -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,12 @@ void ndspChnSetMix(int id, float mix[12]) LightLock_Unlock(&chn->lock); } +float* ndspChnGetMix(int id) +{ + ndspChnSt* chn = &ndspChn[id]; + return chn->mix; +} + void ndspChnSetAdpcmCoefs(int id, u16 coefs[16]) { ndspChnSt* chn = &ndspChn[id];