1 /*---------------------------------------------------------------------------*
2   Project:  Horizon
3   File:     snd_Const.h
4 
5   Copyright (C)2009-2012 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: 46347 $
14  *---------------------------------------------------------------------------*/
15 
16 #ifndef NN_SND_CTR_COMMON_SND_CONST_H_
17 #define NN_SND_CTR_COMMON_SND_CONST_H_
18 
19 // Clock
20 #define NN_SND_HW_BASE_CLOCK                (16756991)
21 #define NN_SND_HW_SYSTEM_CLOCK              (NN_SND_HW_BASE_CLOCK * 16)
22 #define NN_SND_HW_I2S_MCLK_32KH             (NN_SND_HW_SYSTEM_CLOCK /  32)
23 #define NN_SND_HW_I2S_CLOCK_32KHZ           (NN_SND_HW_SYSTEM_CLOCK / (32 * 256))
24 #define NN_SND_HW_I2S_MCLK_48KH             (NN_SND_HW_SYSTEM_CLOCK /  22)
25 #define NN_SND_HW_I2S_CLOCK_48KHZ           (NN_SND_HW_SYSTEM_CLOCK / (22 * 256))
26 
27 #define NN_SND_HW_BASE_CLOCK_F32            (16756991.0)
28 #define NN_SND_HW_SYSTEM_CLOCK_F32          (NN_SND_HW_BASE_CLOCK * 16)
29 #define NN_SND_HW_I2S_MCLK_32KH_F32         (NN_SND_HW_SYSTEM_CLOCK /  32)
30 #define NN_SND_HW_I2S_CLOCK_32KHZ_F32       (NN_SND_HW_SYSTEM_CLOCK / (32 * 256))
31 #define NN_SND_HW_I2S_MCLK_48KH_F32         (NN_SND_HW_SYSTEM_CLOCK /  22)
32 #define NN_SND_HW_I2S_CLOCK_48KHZ_F32       (NN_SND_HW_SYSTEM_CLOCK / (22 * 256))
33 
34 // Buffer length
35 #define NN_SND_BTDMP_OUTPUT_FRAME_TRIG_FREQ (20)
36 #define NN_SND_BTDMP_OUTPUT_FIFO_SIZE       (16)
37 #define NN_SND_OUTPUT_RINGBUF_LOADUNIT      (NN_SND_BTDMP_OUTPUT_FIFO_SIZE * NN_SND_BTDMP_OUTPUT_FRAME_TRIG_FREQ)
38 
39 // Data samples per frame
40 #define NN_SND_SAMPLES_PER_FRAME            (NN_SND_OUTPUT_RINGBUF_LOADUNIT / 2)
41 #define NN_SND_USECS_PER_FRAME              ((NN_SND_SAMPLES_PER_FRAME * 1000000) / NN_SND_HW_I2S_CLOCK_32KHZ)
42 
43 // Upper limit of voice
44 #define NN_SND_VOICE_NUM                    (24)
45 
46 // Number of buffer jumps that can be executed in one frame
47 #define NN_SND_NEXT_BUFFER_NUM              (4)
48 
49 // Monaural/stereo
50 #define NN_SND_PCM_ACOUS_MONAURAL           (1)
51 #define NN_SND_PCM_ACOUS_STEREO             (2)
52 
53 // Playback argument related
54 #define NN_SND_VOLUME_EQUIV                 ((u16)0x1 << NN_SND_VOLUME_SHIFT)
55 #define NN_SND_VOLUME_DEFAULT               NN_SND_VOLUME_EQUIV
56 #define NN_SND_VOLUME_MAX                   (0xffff)
57 #define NN_SND_VOLUME_MIN                   (0x0000)
58 #define NN_SND_VOLUME_SHIFT                 (15)
59 
60 #define NN_SND_TIMER_EQUIV                  ((u32)1 << NN_SND_TIMER_SHIFT)
61 #define NN_SND_TIMER_DEFAULT                NN_SND_TIMER_EQUIV
62 #define NN_SND_TIMER_MAX                    (0xffffffff)
63 #define NN_SND_TIMER_MIN                    (0x00000010)
64 #define NN_SND_TIMER_SHIFT                  (24)
65 
66 // Sound depth
67 #define NN_SND_SURROUND_DEPTH_MIN           (0.0f)
68 #define NN_SND_SURROUND_DEPTH_MAX           (1.0f)
69 
70 // The following is for debugging
71 #define NN_SND_DEBUG_3DS_SPEAKER            (0)
72 #define NN_SND_DEBUG_3DS_HEADPHONE          (1)
73 
74 #endif // NN_SND_CTR_COMMON_SND_CONST_H_
75