1 /*---------------------------------------------------------------------------* 2 Project: Horizon 3 File: snd_Adpcm.h 4 5 Copyright (C)2009 Nintendo Co., Ltd. All rights reserved. 6 7 These coded instructions, statements, and computer programs contain 8 proprietary information of Nintendo of America Inc. and/or Nintendo 9 Company Ltd., and are protected by Federal copyright law. They may 10 not be disclosed to third parties or copied or duplicated in any form, 11 in whole or in part, without the prior written consent of Nintendo. 12 13 $Rev: 25089 $ 14 *---------------------------------------------------------------------------*/ 15 16 #ifndef NN_SND_ADPCM_H_ 17 #define NN_SND_ADPCM_H_ 18 19 #if !defined(_I386) 20 #include <nn/dsp/CTR/Common/dsp_Types.h> 21 #endif // #if !defined(_I386)) 22 23 #ifndef CTR_DSP 24 namespace nn { namespace snd { namespace CTR { 25 #endif // CTR_DSP 26 27 #define NN_SND_ADPCM_DOL_PS_SIZE_IN_NIB (2) 28 #define NN_SND_ADPCM_DOL_DATA_NUM_IN_BLOCK (14) 29 #define NN_SND_ADPCM_DOL_NIBL_NUM_IN_BLOCK (16) 30 31 // 動作環境に依存する定数。 32 #ifdef NN_PROCESSOR_ARM11MPCORE 33 #define NN_SND_ADPCM_DOL_BLOCK_SIZE (8) //!< Adpcm の1 ブロックのサイズ(バイト単位) 34 #else // #ifdef NN_PROCESSOR_ARM11MPCORE 35 #define NN_SND_ADPCM_DOL_BLOCK_SIZE (4) //!< Adpcm の1 ブロックのサイズ(DSP ワード単位) 36 #endif // #ifdef NN_PROCESSOR_ARM11MPCORE 37 38 typedef struct 39 { 40 s16 a[8][2]; 41 42 u16 gain; 43 u16 pred_scale; 44 s16 yn1; 45 s16 yn2; 46 47 // loop context 48 u16 loop_pred_scale; 49 s16 loop_yn1; 50 s16 loop_yn2; 51 52 u16 pad[1]; 53 } DspsndAdpcmState; 54 55 typedef struct 56 { 57 u32 num_samples; 58 u32 num_adpcm_nibbles; 59 u32 sample_rate; 60 61 u16 loop_flag; 62 u16 format; 63 u32 sa; // loop start address 64 u32 ea; // loop end address 65 u32 ca; // current address 66 67 DspsndAdpcmState state; 68 69 u16 pad[10]; 70 71 } DspsndAdpcmHeader; 72 73 /*! 74 @brief Adpcm の係数を格納する構造体です。 75 */ 76 struct AdpcmParam 77 { 78 u16 coef[16]; //!< Adpcm の係数 79 }; // AdpcmParam 80 81 82 /*! 83 @brief Adpcm のコンテクストを格納する構造体です。 84 */ 85 struct AdpcmContext 86 { 87 u16 pred_scale; //!< Adpcm の予測値(4bit)、スケール値(4bit)を格納します。上位8 ビットは参照されません。 88 s16 yn1; //!< 履歴データ(1 つ前のサンプル値) 89 s16 yn2; //!< 履歴データ(2 つ前のサンプル値) 90 }; 91 92 #ifndef CTR_DSP 93 }}} // namespace nn::snd::CTR 94 #endif // CTR_DSP 95 96 #endif // #ifndef NN_SND_ADPCM_H_ 97