/*---------------------------------------------------------------------------* Project: NintendoWare File: snd_StreamSound.h Copyright (C)2009-2010 Nintendo Co., Ltd./HAL Laboratory, Inc. All rights reserved. These coded instructions, statements, and computer programs contain proprietary information of Nintendo of America Inc. and/or Nintendo Company Ltd., and are protected by Federal copyright law. 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. $Revision: 21480 $ *---------------------------------------------------------------------------*/ #ifndef NW_SND_STREAM_SOUND_H_ #define NW_SND_STREAM_SOUND_H_ #include #include #include #include #include namespace nw { namespace snd { class StreamSoundHandle; namespace internal { class StreamSound; typedef SoundInstanceManager StreamSoundInstanceManager; class StreamSound : public BasicSound { friend class StreamSoundHandle; public: NW_UT_RUNTIME_TYPEINFO; // ダウンキャスト用の実行時型情報を埋め込みます static const int FILE_STREAM_BUFFER_SIZE = 512; /* ------------------------------------------------------------------------ class member ------------------------------------------------------------------------ */ public: StreamSound( StreamSoundInstanceManager& manager ); void Setup( driver::StreamBufferPool* pBufferPool, int allocChannelCount, u16 allocTrackFlag ); void Prepare( driver::StreamSoundPlayer::StartOffsetType startOffsetType, s32 offset, io::FileStream* pFileStream ); virtual void Initialize(); virtual void Finalize(); virtual bool IsPrepared() const; bool IsSuspendByLoadingDelay() const; void* GetFileStreamBuffer() { return m_FileStreamBuffer; } long GetFileStreamBufferSize() { return FILE_STREAM_BUFFER_SIZE; } // トラックパラメータ void SetTrackVolume( unsigned long trackBitFlag, float volume, int frames = 0 ); void SetTrackPan( unsigned long trackBitFlag, float pan ); void SetTrackSurroundPan( unsigned long trackBitFlag, float span ); // 情報取得 bool ReadStreamDataInfo( StreamDataInfo* info ) const; long GetPlayLoopCount() const; long GetPlaySamplePosition() const; float GetFilledBufferPercentage() const; // const driver::StreamSoundPlayer& GetStreamSoundPlayer() const { return m_StreamSoundPlayer; } // デバッグ関数 DebugSoundType GetSoundType() const { return DEBUG_SOUND_TYPE_STRMSOUND; } protected: virtual bool IsAttachedTempSpecialHandle(); virtual void DetachTempSpecialHandle(); virtual void UpdateMoveValue(); virtual void UpdateParam(); virtual driver::BasicSoundPlayer* GetBasicSoundPlayerHandle() { return &m_StreamSoundPlayerInstance; } virtual void OnUpdatePlayerPriority(); private: driver::StreamSoundPlayer m_StreamSoundPlayerInstance; StreamSoundHandle* m_pTempSpecialHandle; StreamSoundInstanceManager& m_Manager; MoveValue m_TrackVolume[ driver::StreamSoundPlayer::STRM_TRACK_NUM ]; io::FileStream* m_pFileStream; int m_FileStreamBuffer[ FILE_STREAM_BUFFER_SIZE/sizeof(int) ]; u16 m_AllocTrackFlag; bool m_InitializeFlag; }; } // namespace nw::snd::internal } // namespace nw::snd } // namespace nw #endif /* NW_SND_STREAM_SOUND_H_ */