//the Pascal translation of libctru 1.0.0 headers files for the nintendo 3ds platform // // Copyright (c) 2016 Kenny D. Lee // all rights reserved // {* * @file channel.h * @brief Functions for interacting with DSP audio channels. } {$ifdef 3dsintf} {/ Supported sample encodings. } type NDSP_Enc = (NDSP_ENCODING_PCM8 := 0,NDSP_ENCODING_PCM16 := 1, NDSP_ENCODING_ADPCM := 2); mixer= array[0..11] of double; coefficients=array[0..15] of u16; { Specifies the number of channels used in a sample. } function NDSP_CHANNELS(n : longint) : u32; { Specifies the encoding used in a sample. } { was #define dname(params) para_def_expr } function NDSP_ENCODING(n : longint) : longint; {/ Channel format flags for use with ndspChnSetFormat. } const NDSP_FORMAT_MONO_PCM8 = 1; //< Buffer contains Mono PCM8. NDSP_FORMAT_MONO_PCM16 = 5; //< Buffer contains Mono PCM16. NDSP_FORMAT_MONO_ADPCM = 9; //< Buffer contains Mono ADPCM. NDSP_FORMAT_STEREO_PCM8 = 2; //< Buffer contains Stereo PCM8. NDSP_FORMAT_STEREO_PCM16 = 6; //< Buffer contains Stereo PCM16. NDSP_FORMAT_PCM8 = NDSP_FORMAT_MONO_PCM8; //< (Alias) Buffer contains Mono PCM8. NDSP_FORMAT_PCM16 = NDSP_FORMAT_MONO_PCM16; //< (Alias) Buffer contains Mono PCM16. NDSP_FORMAT_ADPCM = NDSP_FORMAT_MONO_ADPCM; //< (Alias) Buffer contains Mono ADPCM. { Flags } NDSP_FRONT_BYPASS = 1 shl 4; //< Front bypass. } NDSP_3D_SURROUND_PREPROCESSED = 1 shl 6; //< (?) Unknown, under research } type ndspInterpType = (NDSP_INTERP_POLYPHASE := 0,NDSP_INTERP_LINEAR := 1, NDSP_INTERP_NONE := 2); {/@ } {/@name Basic channel operation } {/@ } {* * @brief Resets a channel. * @param id ID of the channel (0..23). } procedure ndspChnReset(id:cint);cdecl;external; {* * @brief Initializes the parameters of a channel. * @param id ID of the channel (0..23). } procedure ndspChnInitParams(id:cint);cdecl;external; {* * @brief Checks whether a channel is currently playing. * @param id ID of the channel (0..23). * @return Whether the channel is currently playing. } function ndspChnIsPlaying(id:cint):bool;cdecl;external; {* * @brief Gets the current sample position of a channel. * @param id ID of the channel (0..23). * @return The channel's sample position. } function ndspChnGetSamplePos(id:cint):u32;cdecl;external; {* * @brief Gets the sequence ID of the wave buffer that is currently playing in a channel. * @param id ID of the channel (0..23). * @return The sequence ID of the wave buffer. } function ndspChnGetWaveBufSeq(id:cint):u16;cdecl;external; {* * @brief Checks whether a channel is currently paused. * @param id ID of the channel (0..23). * @return Whether the channel is currently paused. } function ndspChnIsPaused(id:cint):bool;cdecl;external; {* * @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). } procedure ndspChnSetPaused(id:cint; paused:bool);cdecl;external; {/@ } {/@name Configuration } {/@ } {* * @brief Sets the format of a channel. * @param id ID of the channel (0..23). * @param format Format to use. } procedure ndspChnSetFormat(id:cint; format:u16);cdecl;external; {* * @brief Sets the interpolation type of a channel. * @param id ID of the channel (0..23). * @param type Interpolation type to use. } procedure ndspChnSetInterp(id:cint; _type:ndspInterpType);cdecl;external; {* * @brief Sets the sample rate of a channel. * @param id ID of the channel (0..23). * @param rate Sample rate to use. } procedure ndspChnSetRate(id:cint; rate:double);cdecl;external; {* * @brief Sets the mix parameters (volumes) of a channel. * @param id ID of the channel (0..23). * @param mix Mix parameters to use. Working hypothesis: * - 0: Front left volume. * - 1: Front right volume. * - 2: Back left volume: * - 3: Back right volume: * - 4..7: Same as 0..3, but for auxiliary output 0. * - 8..11: Same as 0..3, but for auxiliary output 1.} procedure ndspChnSetMix(id:cint; mix:mixer);cdecl;external; {* * @brief Sets the DSPADPCM coefficients of a channel. * @param id ID of the channel (0..23). * @param coefs DSPADPCM coefficients to use. } procedure ndspChnSetAdpcmCoefs(id:cint; coefs:coefficients);cdecl;external; {/@ } {/@name Wave buffers } {/@ } {* * @brief Clears the wave buffer queue of a channel and stops playback. * @param id ID of the channel (0..23). } procedure ndspChnWaveBufClear(id:cint);cdecl;external; {* * @brief Adds a wave buffer to the wave buffer queue of a channel. * @remark If the channel's wave buffer queue was empty before the use of this function, playback is started. * @param id ID of the channel (0..23). * @param buf Wave buffer to add. } procedure ndspChnWaveBufAdd(id:cint; buf:PndspWaveBuf);cdecl;external; // pointer {/@ } {/@name IIR filters } {/@ } {* * @brief Configures whether the IIR monopole filter of a channel is enabled. * @param id ID of the channel (0..23). * @param enable Whether to enable the IIR monopole filter. } procedure ndspChnIirMonoSetEnable(id:cint; enable:bool);cdecl;external; {* * @brief Manually sets up the parameters on monopole filter * @param id ID of the channel (0..23). * @param enable Whether to enable the IIR monopole filter. } function ndspChnIirMonoSetParamsCustomFilter(id:cint; a0:double; a1:double; b0:double):bool;cdecl;external; {* * @brief Sets the monopole to be a low pass filter. (Note: This is a lower-quality filter than the biquad one.) * @param id ID of the channel (0..23). * @param f0 Low pass cut-off frequency. } function ndspChnIirMonoSetParamsLowPassFilter(id:cint; f0:double):bool;cdecl;external; {* * @brief Sets the monopole to be a high pass filter. (Note: This is a lower-quality filter than the biquad one.) * @param id ID of the channel (0..23). * @param f0 High pass cut-off frequency. } function ndspChnIirMonoSetParamsHighPassFilter(id:cint; f0:double):bool;cdecl;external; {* * @brief Configures whether the IIR biquad filter of a channel is enabled. * @param id ID of the channel (0..23). * @param enable Whether to enable the IIR biquad filter. } procedure ndspChnIirBiquadSetEnable(id:cint; enable:bool);cdecl;external; {* * @brief Manually sets up the parameters of the biquad filter * @param id ID of the channel (0..23). } function ndspChnIirBiquadSetParamsCustomFilter(id:cint; a0:double; a1:double; a2:double; b0:double; b1:double; b2:double):bool;cdecl;external; {* * @brief Sets the biquad to be a low pass filter. * @param id ID of the channel (0..23). * @param f0 Low pass cut-off frequency. * @param Q "Quality factor", typically should be sqrt(2)/2 (i.e. 0.7071). } function ndspChnIirBiquadSetParamsLowPassFilter(id:cint; f0:double; Q:double):bool;cdecl;external; {* * @brief Sets the biquad to be a high pass filter. * @param id ID of the channel (0..23). * @param f0 High pass cut-off frequency. * @param Q "Quality factor", typically should be sqrt(2)/2 (i.e. 0.7071). } function ndspChnIirBiquadSetParamsHighPassFilter(id:cint; f0:double; Q:double):bool;cdecl;external; {* * @brief Sets the biquad to be a band pass filter. * @param id ID of the channel (0..23). * @param f0 Mid-frequency. * @param Q "Quality factor", typically should be sqrt(2)/2 (i.e. 0.7071). } function ndspChnIirBiquadSetParamsBandPassFilter(id:cint; f0:double; Q:double):bool;cdecl;external; {* * @brief Sets the biquad to be a notch filter. * @param id ID of the channel (0..23). * @param f0 Notch frequency. * @param Q "Quality factor", typically should be sqrt(2)/2 (i.e. 0.7071). } function ndspChnIirBiquadSetParamsNotchFilter(id:cint; f0:double; Q:double):bool;cdecl;external; {* * @brief Sets the biquad to be a peaking equalizer. * @param id ID of the channel (0..23). * @param f0 Central frequency. * @param Q "Quality factor", typically should be sqrt(2)/2 (i.e. 0.7071). * @param gain Amount of gain (raw value = 10 ^ dB/40) } function ndspChnIirBiquadSetParamsPeakingEqualizer(id:cint; f0:double; Q:double; gain:double):bool;cdecl;external; {$endif 3dsintf} {$ifdef 3dsimpl} function NDSP_CHANNELS(n : longint) : u32; begin NDSP_CHANNELS:=u32(n and 3); end; function NDSP_ENCODING(n : longint) : longint; begin NDSP_ENCODING:=(u32 (n and 3) shl 2); // NDSP_ENCODING:=(u32(n(@(3)))) shl 2; end; {$endif 3dsimpl}