1 /*---------------------------------------------------------------------------* 2 Project: NintendoWare 3 File: snd_BasicSoundPlayer.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: 31311 $ 16 *---------------------------------------------------------------------------*/ 17 18 #ifndef NW_SND_BASIC_SOUND_PLAYER_H_ 19 #define NW_SND_BASIC_SOUND_PLAYER_H_ 20 21 #include <nn/types.h> 22 #include <nw/snd/snd_Global.h> 23 #include <nw/snd/snd_PlayerHeapDataManager.h> 24 25 namespace nw { 26 namespace snd { 27 namespace internal { 28 namespace driver { 29 30 /* ======================================================================== 31 class definition 32 ======================================================================== */ 33 34 // ------------------------------------------------------------------------ 35 // プレイヤーパラメータセット 36 struct PlayerParamSet 37 { 38 float volume; 39 float pitch; 40 float pan; 41 float surroundPan; 42 float lpfFreq; 43 float biquadValue; 44 u8 biquadType; 45 u8 padding; 46 bool isFrontBypass; 47 float mainSend; 48 PanMode panMode; 49 PanCurve panCurve; 50 float fxSend[ AUX_BUS_NUM ]; 51 PlayerParamSetPlayerParamSet52 PlayerParamSet() { Initialize(); } 53 void Initialize(); 54 }; 55 56 class BasicSoundPlayer 57 { 58 public: 59 BasicSoundPlayer(); ~BasicSoundPlayer()60 virtual ~BasicSoundPlayer() {}; 61 62 virtual void Initialize(); 63 virtual void Finalize(); 64 65 virtual void Start() = 0; 66 virtual void Stop() = 0; 67 virtual void Pause( bool flag ) = 0; 68 IsActive()69 bool IsActive() const { return m_ActiveFlag; } IsStarted()70 bool IsStarted() const { return m_StartedFlag; } IsPause()71 bool IsPause() const { return m_PauseFlag; } IsPlayFinished()72 bool IsPlayFinished() const { return m_FinishFlag; } 73 74 void UpdateStatus(); 75 76 //------------------------------------------------------------------ 77 // プレイヤーパラメータ SetVolume(float volume)78 void SetVolume( float volume ) { m_PlayerParamSet.volume = volume; } SetPitch(float pitch)79 void SetPitch( float pitch ) { m_PlayerParamSet.pitch = pitch; } SetPan(float pan)80 void SetPan( float pan ) { m_PlayerParamSet.pan = pan; } SetLpfFreq(float lpfFreq)81 void SetLpfFreq( float lpfFreq ) { m_PlayerParamSet.lpfFreq = lpfFreq; } 82 void SetBiquadFilter( int type, float value ); SetPanMode(PanMode panMode)83 void SetPanMode( PanMode panMode ) { m_PlayerParamSet.panMode = panMode; } SetPanCurve(PanCurve panCurve)84 void SetPanCurve( PanCurve panCurve ) { m_PlayerParamSet.panCurve = panCurve; } SetSurroundPan(float surroundPan)85 void SetSurroundPan( float surroundPan ) { m_PlayerParamSet.surroundPan = surroundPan; } SetFrontBypass(bool frontBypass)86 void SetFrontBypass( bool frontBypass ) { m_PlayerParamSet.isFrontBypass = frontBypass; } 87 GetVolume()88 float GetVolume() const { return m_PlayerParamSet.volume; } GetPitch()89 float GetPitch() const { return m_PlayerParamSet.pitch; } GetPan()90 float GetPan() const { return m_PlayerParamSet.pan; } GetLpfFreq()91 float GetLpfFreq() const { return m_PlayerParamSet.lpfFreq; } GetBiquadFilterType()92 int GetBiquadFilterType() const { return m_PlayerParamSet.biquadType; } GetBiquadFilterValue()93 float GetBiquadFilterValue() const { return m_PlayerParamSet.biquadValue; } GetPanMode()94 PanMode GetPanMode() const { return m_PlayerParamSet.panMode; } GetPanCurve()95 PanCurve GetPanCurve() const { return m_PlayerParamSet.panCurve; } GetSurroundPan()96 float GetSurroundPan() const { return m_PlayerParamSet.surroundPan; } IsFrontBypass()97 bool IsFrontBypass() const { return m_PlayerParamSet.isFrontBypass; } 98 99 //------------------------------------------------------------------ 100 // 出力パラメータ SetMainSend(float send)101 void SetMainSend( float send ) { m_PlayerParamSet.mainSend = send; } 102 void SetFxSend( AuxBus bus, float send ); 103 GetMainSend()104 float GetMainSend() const { return m_PlayerParamSet.mainSend; } 105 float GetFxSend( AuxBus bus ) const; 106 TryWaitInstanceFree()107 bool TryWaitInstanceFree() { return m_Event.TryWait(); } WaitInstanceFree()108 void WaitInstanceFree() { m_Event.Wait(); } 109 SetPlayerHeapDataManager(const PlayerHeapDataManager * mgr)110 void SetPlayerHeapDataManager( const PlayerHeapDataManager* mgr ) 111 { 112 m_pPlayerHeapDataManager = mgr; 113 } GetPlayerHeapDataManager()114 const PlayerHeapDataManager* GetPlayerHeapDataManager() const 115 { 116 return m_pPlayerHeapDataManager; 117 } 118 119 protected: 120 nn::os::LightEvent m_Event; 121 bool m_ActiveFlag; // ディスポースコールバック登録されているかどうか 122 bool m_StartedFlag; // プレイヤーコールバック登録されているかどうか 123 bool m_PauseFlag; 124 bool m_FinishFlag; 125 126 private: 127 PlayerParamSet m_PlayerParamSet; 128 const PlayerHeapDataManager* m_pPlayerHeapDataManager; // SEQ/WSD で利用される 129 }; 130 131 } // namespace nw::snd::internal::driver 132 } // namespace nw::snd::internal 133 } // namespace nw::snd 134 } // namespace nw 135 136 137 #endif /* NW_SND_BASIC_SOUND_PLAYER_H_ */ 138 139