//the Pascal translation of libctru 1.0.0 headers files for the nintendo 3ds platform // // Copyright (c) 2016 Kenny D. Lee // all rights reserved // type ndspOutputMode = (NDSP_OUTPUT_MONO := 0,NDSP_OUTPUT_STEREO := 1, NDSP_OUTPUT_SURROUND := 2); ndspClippingMode = (NDSP_CLIP_NORMAL := 0,NDSP_CLIP_SOFT := 1 ); ndspSpeakerPos = (NDSP_SPKPOS_SQUARE := 0,NDSP_SPKPOS_WIDE := 1, NDSP_SPKPOS_NUM := 2); {/ ADPCM data. } {/< Current predictor index } {/< Last outputted PCM16 sample. } {/< Second to last outputted PCM16 sample. } ndspAdpcmData = record index : u16; history0 : s16; history1 : s16; end; {/ Wave buffer status. } const NDSP_WBUF_FREE = 0; //< The wave buffer is not queued. NDSP_WBUF_QUEUED = 1; //< The wave buffer is queued and has not been played yet. NDSP_WBUF_PLAYING = 2; //< The wave buffer is playing right now. NDSP_WBUF_DONE = 3; //< The wave buffer has finished being played. {/ Wave buffer struct. } type pcm_ptr = record case longint of 0 : ( data_pcm8 : ^s8 ); 1 : ( data_pcm16 : ^s16 ); 2 : ( data_adpcm : ^u8 ); 3 : ( data_vaddr : pointer ); end; PndspWaveBuf = ^ndspWaveBuf; ndspWaveBuf = record pcm: pcm_ptr; nsamples: u32; adpcm_data: ^ndspAdpcmData; offset:u32; // Buffer offset. Only used for capture. looping:boolean; // Whether to loop the buffer. status:u8; // Queuing/playback status. sequence_id: u16; ///< Sequence ID. Assigned automatically by ndspChnWaveBufAdd. next: PndspWaveBuf; ///< Next buffer to play. Used internally, do not modify. end; {/ Sound frame callback function. (data = User provided data) } ndspCallback = procedure(data:pointer);cdecl; {/ Auxiliary output callback function. (data = User provided data, nsamples = Number of samples, samples = Sample data) } samplePtr = array[0..3] of pointer; ndspAuxCallback = procedure (data:pointer; nsamples:cint; samples:samplePtr);cdecl; {/@ } {/@ Initialization and basic operations } {/@ } {* * @brief Sets up the DSP component. * @param binary DSP binary to load. * @param size Size of the DSP binary. * @param progMask Program RAM block mask to load the binary to. * @param dataMask Data RAM block mask to load the binary to. } procedure ndspUseComponent(binary:pointer; size:u32; progMask:u16; dataMask:u16);cdecl;external; {/ Initializes NDSP. } function ndspInit:s32;cdecl;external; {/ Exits NDSP. } procedure ndspExit;cdecl;external; {* * @brief Gets the number of dropped sound frames. * @return The number of dropped sound frames. } function ndspGetDroppedFrames:u32;cdecl;external; {* * @brief Gets the total sound frame count. * @return The total sound frame count. } function ndspGetFrameCount:u32;cdecl;external; {/@ } {/@name General parameters } {/@ } {* * @brief Sets the master volume. * @param volume Volume to set. Defaults to 1.0f. } procedure ndspSetMasterVol(volume:double);cdecl;external; {* * @brief Sets the output mode. * @param mode Output mode to set. Defaults to NDSP_OUTPUT_STEREO. } procedure ndspSetOutputMode(mode:ndspOutputMode);cdecl;external; {* * @brief Sets the clipping mode. * @param mode Clipping mode to set. Defaults to NDSP_CLIP_SOFT. } procedure ndspSetClippingMode(mode:ndspClippingMode);cdecl;external; {* * @brief Sets the output count. * @param count Output count to set. Defaults to 2. } procedure ndspSetOutputCount(count:cint);cdecl;external; {* * @brief Sets the wave buffer to capture audio to. * @param capture Wave buffer to capture to. } procedure ndspSetCapture(capture:PndspWaveBuf);cdecl;external; {* * @brief Sets the sound frame callback. * @param callback Callback to set. * @param data User-defined data to pass to the callback. } procedure ndspSetCallback(callback:ndspCallback; data:pointer);cdecl;external; {/@ } {/@name Surround } {/@ } {* * @brief Sets the surround sound depth. * @param depth Depth to set. Defaults to 0x7FFF. } procedure ndspSurroundSetDepth(depth:u16);cdecl;external; {* * @brief Sets the surround sound position. * @param pos Position to set. Defaults to NDSP_SPKPOS_SQUARE. } procedure ndspSurroundSetPos(pos:ndspSpeakerPos);cdecl;external; {* * @brief Sets the surround sound rear ratio. * @param ratio Rear ratio to set. Defaults to 0x8000. } procedure ndspSurroundSetRearRatio(ratio:u16);cdecl;external; {/@ } {/@name Auxiliary output } {/@ } {* * @brief Configures whether an auxiliary output is enabled. * @param id ID of the auxiliary output. * @param enable Whether to enable the auxiliary output. } procedure ndspAuxSetEnable(id:cint; enable:bool);cdecl;external; {* * @brief Configures whether an auxiliary output should use front bypass. * @param id ID of the auxiliary output. * @param bypass Whether to use front bypass. } procedure ndspAuxSetFrontBypass(id:cint; bypass:bool);cdecl;external; {* * @brief Sets the volume of an auxiliary output. * @param id ID of the auxiliary output. * @param volume Volume to set. } procedure ndspAuxSetVolume(id:cint; volume:double);cdecl;external; {* * @brief Sets the callback of an auxiliary output. * @param id ID of the auxiliary output. * @param callback Callback to set. * @param data User-defined data to pass to the callback. } procedure ndspAuxSetCallback(id:cint; callback:ndspAuxCallback; data:pointer);cdecl;external;