/*---------------------------------------------------------------------------* Project: NintendoWare File: snd_BasicSoundPlayer.h Copyright (C)2009-2011 Nintendo/HAL Laboratory, Inc. All rights reserved. These coded instructions, statements, and computer programs contain proprietary information of Nintendo and/or its licensed developers and are protected by national and international copyright laws. They may not be disclosed to third parties or copied or duplicated in any form, in whole or in part, without the prior written consent of Nintendo. The content herein is highly confidential and should be handled accordingly. $Revision: 31311 $ *---------------------------------------------------------------------------*/ #ifndef NW_SND_BASIC_SOUND_PLAYER_H_ #define NW_SND_BASIC_SOUND_PLAYER_H_ #include #include #include namespace nw { namespace snd { namespace internal { namespace driver { /* ======================================================================== class definition ======================================================================== */ // ------------------------------------------------------------------------ // プレイヤーパラメータセット struct PlayerParamSet { float volume; float pitch; float pan; float surroundPan; float lpfFreq; float biquadValue; u8 biquadType; u8 padding; bool isFrontBypass; float mainSend; PanMode panMode; PanCurve panCurve; float fxSend[ AUX_BUS_NUM ]; PlayerParamSet() { Initialize(); } void Initialize(); }; class BasicSoundPlayer { public: BasicSoundPlayer(); virtual ~BasicSoundPlayer() {}; virtual void Initialize(); virtual void Finalize(); virtual void Start() = 0; virtual void Stop() = 0; virtual void Pause( bool flag ) = 0; bool IsActive() const { return m_ActiveFlag; } bool IsStarted() const { return m_StartedFlag; } bool IsPause() const { return m_PauseFlag; } bool IsPlayFinished() const { return m_FinishFlag; } void UpdateStatus(); //------------------------------------------------------------------ // プレイヤーパラメータ void SetVolume( float volume ) { m_PlayerParamSet.volume = volume; } void SetPitch( float pitch ) { m_PlayerParamSet.pitch = pitch; } void SetPan( float pan ) { m_PlayerParamSet.pan = pan; } void SetLpfFreq( float lpfFreq ) { m_PlayerParamSet.lpfFreq = lpfFreq; } void SetBiquadFilter( int type, float value ); void SetPanMode( PanMode panMode ) { m_PlayerParamSet.panMode = panMode; } void SetPanCurve( PanCurve panCurve ) { m_PlayerParamSet.panCurve = panCurve; } void SetSurroundPan( float surroundPan ) { m_PlayerParamSet.surroundPan = surroundPan; } void SetFrontBypass( bool frontBypass ) { m_PlayerParamSet.isFrontBypass = frontBypass; } float GetVolume() const { return m_PlayerParamSet.volume; } float GetPitch() const { return m_PlayerParamSet.pitch; } float GetPan() const { return m_PlayerParamSet.pan; } float GetLpfFreq() const { return m_PlayerParamSet.lpfFreq; } int GetBiquadFilterType() const { return m_PlayerParamSet.biquadType; } float GetBiquadFilterValue() const { return m_PlayerParamSet.biquadValue; } PanMode GetPanMode() const { return m_PlayerParamSet.panMode; } PanCurve GetPanCurve() const { return m_PlayerParamSet.panCurve; } float GetSurroundPan() const { return m_PlayerParamSet.surroundPan; } bool IsFrontBypass() const { return m_PlayerParamSet.isFrontBypass; } //------------------------------------------------------------------ // 出力パラメータ void SetMainSend( float send ) { m_PlayerParamSet.mainSend = send; } void SetFxSend( AuxBus bus, float send ); float GetMainSend() const { return m_PlayerParamSet.mainSend; } float GetFxSend( AuxBus bus ) const; bool TryWaitInstanceFree() { return m_Event.TryWait(); } void WaitInstanceFree() { m_Event.Wait(); } void SetPlayerHeapDataManager( const PlayerHeapDataManager* mgr ) { m_pPlayerHeapDataManager = mgr; } const PlayerHeapDataManager* GetPlayerHeapDataManager() const { return m_pPlayerHeapDataManager; } protected: nn::os::LightEvent m_Event; bool m_ActiveFlag; // ディスポースコールバック登録されているかどうか bool m_StartedFlag; // プレイヤーコールバック登録されているかどうか bool m_PauseFlag; bool m_FinishFlag; private: PlayerParamSet m_PlayerParamSet; const PlayerHeapDataManager* m_pPlayerHeapDataManager; // SEQ/WSD で利用される }; } // namespace nw::snd::internal::driver } // namespace nw::snd::internal } // namespace nw::snd } // namespace nw #endif /* NW_SND_BASIC_SOUND_PLAYER_H_ */