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     void*                       m_pBufferAddress;   // ストリームデータバッファ
35 
36     DspAdpcmParam               m_AdpcmParam;       // 整理したら CTRWIN のみにできそう
37     DspAdpcmLoopParam           m_AdpcmLoopParam;
38 
39 #ifdef NW_PLATFORM_CTRWIN
40     u16                         m_AdpcmPredScale;
41 #else
42     // CTR_SDK 向けでは「1 StreamChannel = 1 NW Voice = 5 SDK Voice」の関係になる
43     static const int WAVE_BUFFER_MAX = 5;
44 
45     enum AdpcmContextType
46     {
47         ADPCM_CONTEXT_HEAD, // 波形先頭のもの
48         ADPCM_CONTEXT_LOOP, // ループ時のもの
49         ADPCM_CONTEXT_NUM
50     };
51 
52     Voice*   m_pVoice;
53     nn::snd::WaveBuffer         m_WaveBuffer[WAVE_BUFFER_MAX];
54     nn::snd::AdpcmContext       m_AdpcmContext[ADPCM_CONTEXT_NUM];
55 
56     void AppendWaveBuffer( nn::snd::WaveBuffer* pBuffer, bool lastFlag );
57 #endif
58 };
59 
60 
61 struct StreamTrack
62 {
63 public:
64     bool m_ActiveFlag;
65 #ifdef NW_PLATFORM_CTRWIN
66     Voice* m_pVoice;
67 #else
68     StreamChannel* m_pChannels[Voice::CHANNEL_MAX];
69 #endif
70     StreamSoundFileReader::TrackInfo m_TrackInfo;
71     f32 m_Volume;
72     f32 m_Pan;
73     f32 m_SurroundPan;
74 };
75 
76 
77 
78 } // namespace nw::snd::internal::driver
79 } // namespace nw::snd::internal
80 } // namespace nw::snd
81 } // namespace nw
82 
83 
84 #endif /* NW_SND_STREAM_TRACK_H_ */
85 
86