D:/Zythum/DinoKod/Sound/SoundDS.h

00001 //---------------------------------------------------------------------------------------------
00002 //      This file is a part of "DinoKod".
00003 //      Copyright © 2003 Dino Productions. All Rights Reserved.
00004 //      
00005 //      File                    : SoundDS.h
00006 //      Author                  : Sebastien LEIX        sebastien.leix@wanadoo.fr
00007 //      Date                    : 09/09/2002
00008 //      Modification    :
00009 //
00010 //---------------------------------------------------------------------------------------------
00011 #ifndef __SOUNDDS_H__
00012 #define __SOUNDDS_H__
00013 
00014 #include "Sound/SoundDll.h"
00015 #include <dsound.h>
00016 #include <dxerr9.h>
00017 
00018 #include "Common/Types.h"
00019 #include "Common/Thread.h"
00020 #include "Common/Mutex.h"
00021 #include "Sound/TrackDS.h"
00022 #include "Sound/StreamTrackDS.h"
00023 
00024 class KTrackBank;
00025 class KStreamTrackBank;
00026 
00027 //---------------------------------------------------------------------------------------------
00028 class SOUND_API KSound : public KThread
00029 {
00030 protected:
00031         HINSTANCE                                       m_hInstance;
00032         HWND                                            m_hWnd;
00033         IDirectSound8*                          m_pDS;
00034         IDirectSoundBuffer*                     m_pDSPrimary;
00035         IDirectSound3DListener8*        m_pDSL;
00036         KTrackBank*                                     m_pTrackBank;
00037         KStreamTrackBank*                       m_pStreamTrackBank;
00038         KMutex                                          m_StreamTrackBankMutex;
00039         float                                           m_fVolume ;
00040 
00041 
00042         virtual u32                                     ThreadProc();
00043 
00044 public:
00045                                                                 KSound( HINSTANCE hInstance, HWND hWnd );
00046                                                                 ~KSound();
00047 
00048         bool                                            Init();
00049         bool                                            End();
00050 
00051         // Track
00052         bool                                            Play( KTRACK TrackId, bool bLooping = false );
00053         bool                                            Stop( KTRACK TrackId );
00054         KTRACK                                          LoadTrack( KStr& sFileName, KSTRACKTYPE TrackType = KSTT_SOUND );
00055         bool                                            UnloadTrack( KTRACK& Track );
00056 
00057         // Stream Track
00058         bool                                            PlayStreamTrack( KSTREAMTRACK TrackId, bool bFadeIn = false, KTIME FadeTime = KSTREAMTRACK_FADE_TIME );
00059         bool                                            StopStreamTrack( KSTREAMTRACK TrackId, bool bFadeOut = false, KTIME FadeTime = KSTREAMTRACK_FADE_TIME );
00060         bool                                            ProcessStreamTrack();
00061         KSTREAMTRACK                            LoadStreamTrack( KStr& sFileName );
00062         bool                                            UnloadStreamTrack( KSTREAMTRACK& Track );
00063         KStreamTrackBank*                       LockStreamTrackBank();
00064         void                                            UnlockStreamTrackBank( KStreamTrackBank** pStreamTrackBank );
00065 
00066         IDirectSound8*                          GetDirectSound()                { return m_pDS;                         }
00067         void                                            SetPosition( KVector& Position );
00068         void                                            SetOrientation( KVector& Front, KVector& Top );
00069 
00070         void                                            SetPosition( KTRACK TrackId, KVector& Position );
00071         void                                            SetDistance( KTRACK TrackId, float Min, float Max );
00072         void                                            Manage3DSound( KVector& Position, KVector& Front, KVector& Top );
00073         bool                                            IsPlaying();
00074 
00075         void                                            SetVolume( float Volume );
00076         float                                           GetVolume() {return m_fVolume ;}
00077 };
00078 
00079 #endif  __SOUNDDS_H__

Generated on Sun Mar 25 20:02:16 2007 for Zythum Project by  doxygen 1.5.1-p1