1 /*---------------------------------------------------------------------------*
2   Project:  NintendoWare
3   File:     snd_StreamTrack.h
4 
5   Copyright (C)2009-2010 Nintendo Co., Ltd./HAL Laboratory, Inc.  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   $Revision: $
14  *---------------------------------------------------------------------------*/
15 
16 #ifndef NW_SND_STREAM_TRACK_H_
17 #define NW_SND_STREAM_TRACK_H_
18 
19 #include <nn/snd.h>
20 #include <nw/snd/snd_StreamSoundFileReader.h>
21 
22 #ifdef NW_PLATFORM_CTR
23 #include <nw/snd/snd_Voice.h>   // nw::snd::Voice::CHANNEL_MAX
24 #include <nw/snd/snd_Global.h>  // nw::snd::VOICE_OUT_MAX
25 #endif
26 
27 namespace nw {
28 namespace snd {
29 namespace internal {
30 namespace driver {
31 
32 struct StreamChannel
33 {
34     // 定数
35     static const int WAVE_BUFFER_MULTIPLYING_FACTOR = 4;
36 #ifdef NW_PLATFORM_CTR
37     static const int WAVE_BUFFER_MAX = 5 * WAVE_BUFFER_MULTIPLYING_FACTOR;
38 #endif
39 
40     // 列挙体
41 #ifdef NW_PLATFORM_CTR
42     enum AdpcmContextType
43     {
44         ADPCM_CONTEXT_HEAD, // 波形先頭のもの
45         ADPCM_CONTEXT_LOOP, // ループ時のもの
46         ADPCM_CONTEXT_NUM
47     };
48 #endif
49 
50     // 関数
51 #ifdef NW_PLATFORM_CTR
52     void AppendWaveBuffer( nn::snd::WaveBuffer* pBuffer, bool lastFlag );
53 #endif
54 
55     // データ
56     void*                       m_pBufferAddress;   // ストリームデータバッファ
57     DspAdpcmParam               m_AdpcmParam;       // 整理したら CTRWIN のみにできそう
58     DspAdpcmLoopParam           m_AdpcmLoopParam;
59 #ifdef NW_PLATFORM_CTRWIN
60     u16                         m_AdpcmPredScale;
61 #else
62     Voice*   m_pVoice;
63     nn::snd::WaveBuffer         m_WaveBuffer[WAVE_BUFFER_MAX];
64     nn::snd::AdpcmContext       m_AdpcmContext[ADPCM_CONTEXT_NUM];
65 #endif
66 };
67 
68 
69 struct StreamTrack
70 {
71 public:
72     bool m_ActiveFlag;
73 #ifdef NW_PLATFORM_CTRWIN
74     Voice* m_pVoice;
75 #else
76     StreamChannel* m_pChannels[Voice::CHANNEL_MAX];
77 #endif
78     StreamSoundFileReader::TrackInfo m_TrackInfo;
79     f32 m_Volume;
80     f32 m_Pan;
81     f32 m_SurroundPan;
82 };
83 
84 
85 
86 } // namespace nw::snd::internal::driver
87 } // namespace nw::snd::internal
88 } // namespace nw::snd
89 } // namespace nw
90 
91 
92 #endif /* NW_SND_STREAM_TRACK_H_ */
93 
94