1 /*---------------------------------------------------------------------------*
2   Project:  NintendoWare
3   File:     snd_StreamTrack.h
4 
5   Copyright (C)2009-2011 Nintendo/HAL Laboratory, Inc.  All rights reserved.
6 
7   These coded instructions, statements, and computer programs contain proprietary
8   information of Nintendo and/or its licensed developers and are protected by
9   national and international copyright laws. They may not be disclosed to third
10   parties or copied or duplicated in any form, in whole or in part, without the
11   prior written consent of Nintendo.
12 
13   The content herein is highly confidential and should be handled accordingly.
14 
15   $Revision: $
16  *---------------------------------------------------------------------------*/
17 
18 #ifndef NW_SND_STREAM_TRACK_H_
19 #define NW_SND_STREAM_TRACK_H_
20 
21 #include <nn/snd.h>
22 #include <nw/snd/snd_StreamSoundFileReader.h>
23 
24 #ifdef NW_PLATFORM_CTR
25 #include <nw/snd/snd_Voice.h>   // nw::snd::Voice::CHANNEL_MAX
26 #include <nw/snd/snd_Global.h>  // nw::snd::VOICE_OUT_MAX
27 #endif
28 
29 namespace nw {
30 namespace snd {
31 namespace internal {
32 namespace driver {
33 
34 struct StreamChannel
35 {
36     // 定数
37     static const int WAVE_BUFFER_MULTIPLYING_FACTOR = 4;
38 #ifdef NW_PLATFORM_CTR
39     static const int WAVE_BUFFER_MAX = 5 * WAVE_BUFFER_MULTIPLYING_FACTOR;
40 #endif
41 
42     // 列挙体
43 #ifdef NW_PLATFORM_CTR
44     enum AdpcmContextType
45     {
46         ADPCM_CONTEXT_HEAD, // 波形先頭のもの
47         ADPCM_CONTEXT_LOOP, // ループ時のもの
48         ADPCM_CONTEXT_NUM
49     };
50 #endif
51 
52     // 関数
53 #ifdef NW_PLATFORM_CTR
54     void AppendWaveBuffer( nn::snd::WaveBuffer* pBuffer, bool lastFlag );
55 #endif
56 
57     // データ
58     void*                       m_pBufferAddress;   // ストリームデータバッファ
59     DspAdpcmParam               m_AdpcmParam;       // 整理したら CTRWIN のみにできそう
60     DspAdpcmLoopParam           m_AdpcmLoopParam;
61 #ifdef NW_PLATFORM_CTRWIN
62     u16                         m_AdpcmPredScale;
63 #else
64     Voice*   m_pVoice;
65     nn::snd::WaveBuffer         m_WaveBuffer[WAVE_BUFFER_MAX];
66     nn::snd::AdpcmContext       m_AdpcmContext[ADPCM_CONTEXT_NUM];
67 #endif
68 };
69 
70 
71 struct StreamTrack
72 {
73 public:
74     bool m_ActiveFlag;
75 #ifdef NW_PLATFORM_CTRWIN
76     Voice* m_pVoice;
77 #else
78     StreamChannel* m_pChannels[Voice::CHANNEL_MAX];
79 #endif
80     StreamSoundFileReader::TrackInfo m_TrackInfo;
81     f32 m_Volume;
82     f32 m_Pan;
83     f32 m_SurroundPan;
84 };
85 
86 
87 
88 } // namespace nw::snd::internal::driver
89 } // namespace nw::snd::internal
90 } // namespace nw::snd
91 } // namespace nw
92 
93 
94 #endif /* NW_SND_STREAM_TRACK_H_ */
95 
96