1 /*---------------------------------------------------------------------------* 2 Project: NintendoWare 3 File: snd_WaveSound.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: 28274 $ 14 *---------------------------------------------------------------------------*/ 15 16 #ifndef NW_SND_WAVE_SOUND_H_ 17 #define NW_SND_WAVE_SOUND_H_ 18 19 #include <nw/snd/snd_BasicSound.h> 20 #include <nw/snd/snd_WaveSoundPlayer.h> 21 #include <nw/snd/snd_SoundInstanceManager.h> 22 #include <nw/snd/snd_Debug.h> 23 24 namespace nw { 25 namespace snd { 26 27 /* ======================================================================== 28 type declarataion 29 ======================================================================== */ 30 31 class WaveSoundHandle; 32 33 /* ======================================================================== 34 class definition 35 ======================================================================== */ 36 37 namespace internal { 38 39 class WaveSound; 40 41 typedef SoundInstanceManager<WaveSound, driver::WaveSoundPlayer> WaveSoundInstanceManager; 42 43 class WaveSound : public BasicSound 44 { 45 friend class WaveSoundHandle; 46 47 public: 48 NW_UT_RUNTIME_TYPEINFO; // ダウンキャスト用の実行時型情報を埋め込みます 49 50 /* ------------------------------------------------------------------------ 51 class member 52 ------------------------------------------------------------------------ */ 53 public: 54 WaveSound( WaveSoundInstanceManager& manager ); 55 56 void Prepare( 57 const void* waveSoundBase, 58 s32 waveSoundOffset, 59 driver::WaveSoundPlayer::StartOffsetType startOffsetType, 60 s32 offset, 61 const driver::WaveSoundPlayer::WaveSoundCallback* callback, 62 u32 callbackData 63 ); 64 virtual void Initialize(); 65 virtual void Finalize(); IsPrepared()66 virtual bool IsPrepared() const { return m_PreparedFlag; } 67 68 // パラメータ設定 69 void SetChannelPriority( int priority ); 70 void SetReleasePriorityFix( bool fix ); 71 72 // パラメータ取得 73 bool ReadWaveSoundDataInfo( WaveSoundDataInfo* info ) const; 74 long GetPlaySamplePosition() const; 75 76 // デバッグ関数 GetSoundType()77 DebugSoundType GetSoundType() const { return DEBUG_SOUND_TYPE_WAVESOUND; } 78 79 protected: 80 virtual bool IsAttachedTempSpecialHandle(); 81 virtual void DetachTempSpecialHandle(); 82 GetBasicSoundPlayerHandle()83 virtual driver::BasicSoundPlayer* GetBasicSoundPlayerHandle() { return &m_WaveSoundPlayerInstance; } 84 85 virtual void OnUpdatePlayerPriority(); 86 87 private: 88 driver::WaveSoundPlayer m_WaveSoundPlayerInstance; 89 WaveSoundHandle* m_pTempSpecialHandle; 90 WaveSoundInstanceManager& m_pManager; 91 bool m_PreparedFlag; 92 bool m_InitializeFlag; 93 }; 94 95 } // namespace nw::snd::internal 96 } // namespace nw::snd 97 } // namespace nw 98 99 100 #endif /* NW_SND_WAVE_SOUND_H_ */ 101 102