#ifndef TDx9_SoundH #define TDx9_SoundH // ========================================================================== // File: TDx9_Sound.H // Authors: BCB_Code_Generator v2.00, // Darren Dwyer (source code, documentation, demos, website), // Hugh Edwards (documentation, icons) // Description: This file defines the TDx9_Sound Component // // "TDx9_Sound_Library v1.00" // (c) 2005 BCB-Tools.com Pty. Ltd., Sydney, Australia. // All Rights Reserved. // // Refer to the 'Licence.Txt' file for licencing & copyright information. // ========================================================================== // -------------------------------------------------------------------------- #include "TDx_Library_Defns.H" #include "TDx_Library_Functions.H" // -------------------------------------------------------------------------- #include "TDx9_Sound_Library_Defns.H" #include "TDx9_Sound_Library_Functions.H" // -------------------------------------------------------------------------- // external classes used by TDx9_Sound methods. class TDSBufferDesc; class TDx_SoundBuffer; class TDSCaps; // -------------------------------------------------------------------------- // ========================================================================== // Class: TDx9_Sound // Description: The TDx9_Sound object is used to ... // ========================================================================== #if (__BORLANDC__ >= 0x0530) // BCB Version 3 + class PACKAGE TDx9_Sound : public TComponent { // -------------------------------------------------------------------------- #else // BCB Version 1 class TDx9_Sound : public TComponent { #endif // ========================================================================== __published: // ========================================================================== // ---------------------------------------------------------------------- // Event: OnCreate() // Description: The OnCreate() event is triggered by the // TDx9_Sound::Create() method after it has successfully // created the internal LPIDIRECTSOUND8 used within the // TDx9_Sound component. // // Note that since this event is only called upon successful // creation, this event is an ideal place for code that is // to be activated only once, immediately upon the // successful creation of the LPIDIRECTSOUND8 interface. // // For example, you could retrieve the TDx9_Sound // component's capabilities, Create() dependant components, // allocate memory, etc. // // When used in conjunction with the TDx9_Sound::OnDestroy() // event, you can fully automate and insulate your code on a // per-component basis. // ---------------------------------------------------------------------- __property TDx_Event OnCreate = {read=FOnCreate, write=FOnCreate, nodefault}; // ---------------------------------------------------------------------- // Event: OnDestroy() // Description: The OnDestroy() event is triggered by the // TDx9_Sound::Destroy() method, just before the TDx9_Sound // internal LPIDIRECTSOUND8 interface is destroyed. // // Note: This event is an ideal place to place code that // reverses the results of the TDx9_Sound::OnCreate() event. // For example, assume you have already setup the // TDx9_Sound::OnCreate() event to retrieve the component's // capabilities, Create() a dependant component and allocate // some memory; // You can then fully automate and insulate your code on a // per-component basis by placing code in the // TDx9_Sound::OnDestroy() event to deallocate memory, // Destroy() the dependant components and, when required, // destroy the capabilities component. // ---------------------------------------------------------------------- __property TDx_Event OnDestroy = {read=FOnDestroy, write=FOnDestroy, nodefault}; // ---------------------------------------------------------------------- // Event: OnError() // Description: The OnError event is called when an error occurs in the // TDx9_Sound component. // ---------------------------------------------------------------------- __property TDx_Error OnError = {read=FOnError, write=FOnError, nodefault}; // ========================================================================== public: // ========================================================================== // ---------------------------------------------------------------------- // Property: Created // Description: The Created property is true if the internal // LPIDIRECTSOUND8 used in this component has been // successfully created, otherwise Created is false. // // To create the internal LPIDIRECTSOUND8, call the // TDx9_Sound::Create() method. // ---------------------------------------------------------------------- __property bool Created = { read=FGetCreated, write=FSetCreated, default=false }; // ---------------------------------------------------------------------- // Property: ErrorValue // Description: The ErrorValue property contains the last error value // returned from a call to a TDx9_Sound method or fget/fset. // eg. DS_OK or DDERR_SURFACELOST or TDX_ERROR // ---------------------------------------------------------------------- __property HRESULT ErrorValue = { read=FGetErrorValue, write=FSetErrorValue, default=DS_OK }; // ---------------------------------------------------------------------- // Method: Compact() // Description: The Compact method is used to ... // ---------------------------------------------------------------------- virtual bool __fastcall Compact(); // ---------------------------------------------------------------------- // Method: Create() // Description: The Create() method is used to automatically create the // internal LPIDIRECTSOUND8 interface used in the TDx9_Sound // component and must be called before any methods of the // TDx9_Sound component will function. // ---------------------------------------------------------------------- virtual bool __fastcall Create(); // ---------------------------------------------------------------------- // Method: CreateSoundBuffer() // Description: The CreateSoundBuffer method is used to ... // Params: pDSBufferDesc - // The DSBufferDesc parameter ... // pDSBuffer - // The DSBuffer parameter ... // pUnkOuter - // The UnkOuter parameter ... // ---------------------------------------------------------------------- virtual bool __fastcall CreateSoundBuffer( TDSBufferDesc* pDSBufferDesc, TDx_SoundBuffer* pDSBuffer, LPUNKNOWN pUnkOuter ); // ---------------------------------------------------------------------- // Method: Destroy() // Description: The Destroy() method is used to automatically destroy the // internal LPIDIRECTSOUND8 interface used in the TDx9_Sound // component and should be called when the internal // interface is no longer required. // // Note: This method is called by the component's // destructor. // ---------------------------------------------------------------------- virtual bool __fastcall Destroy(); // ---------------------------------------------------------------------- // Method: DuplicateSoundBuffer() // Description: The DuplicateSoundBuffer method is used to ... // Params: pDSBufferOriginal - // The DSBufferOriginal parameter ... // pDSBufferDuplicate - // The DSBufferDuplicate parameter ... // ---------------------------------------------------------------------- virtual bool __fastcall DuplicateSoundBuffer( TDx_SoundBuffer* pDSBufferOriginal, TDx_SoundBuffer* pDSBufferDuplicate ); // ---------------------------------------------------------------------- // Method: GetCaps() // Description: The GetCaps method is used to ... // Params: pDSCaps - // The DSCaps parameter ... // ---------------------------------------------------------------------- virtual bool __fastcall GetCaps( TDSCaps* pDSCaps ); // ---------------------------------------------------------------------- // Method: GetSpeakerConfig() // Description: The GetSpeakerConfig method is used to ... // Params: pSpeakerConfig - // The SpeakerConfig parameter ... // ---------------------------------------------------------------------- virtual bool __fastcall GetSpeakerConfig( dword* pSpeakerConfig ); // ---------------------------------------------------------------------- // Method: Initialize() // Description: The Initialize method is used to ... // Params: pGuidDevice - // The GuidDevice parameter ... // ---------------------------------------------------------------------- virtual bool __fastcall Initialize( const GUID* pGuidDevice ); // ---------------------------------------------------------------------- // Method: SetCooperativeLevel() // Description: The SetCooperativeLevel method is used to ... // Params: phwnd - // The hwnd parameter ... // pLevel - // The Level parameter ... // ---------------------------------------------------------------------- virtual bool __fastcall SetCooperativeLevel( HWND phwnd, dword pLevel ); // ---------------------------------------------------------------------- // Method: SetSpeakerConfig() // Description: The SetSpeakerConfig method is used to ... // Params: pSpeakerConfig - // The SpeakerConfig parameter ... // ---------------------------------------------------------------------- virtual bool __fastcall SetSpeakerConfig( dword pSpeakerConfig ); // ---------------------------------------------------------------------- // Method: VerifyCertification() // Description: The VerifyCertification method is used to ... // Params: pCertified - // The Certified parameter ... // ---------------------------------------------------------------------- virtual bool __fastcall VerifyCertification( dword* pCertified ); // ---------------------------------------------------------------------- // Constructor() and Destructor() // ---------------------------------------------------------------------- __fastcall TDx9_Sound(TComponent* Owner); virtual __fastcall ~TDx9_Sound(); // ---------------------------------------------------------------------- // The following properties and methods are used internally by // TDx9_Sound_Library and should not be used. // ---------------------------------------------------------------------- __property LPIDIRECTSOUND8 Internal_LPIDIRECTSOUND8 = { read=FGetInternal_LPIDIRECTSOUND8, write=FSetInternal_LPIDIRECTSOUND8, nodefault }; __property LPIDIRECTSOUND8* Internal_LPIDIRECTSOUND8_Ptr = { read=FGetInternal_LPIDIRECTSOUND8_Ptr, nodefault }; void __fastcall Internal_LPIDIRECTSOUND8_Update(); // ========================================================================== protected: // ========================================================================== // ---------------------------------------------------------------------- // Property Access Methods // ---------------------------------------------------------------------- bool __fastcall FGetCreated(); void __fastcall FSetCreated( bool pCreated ); HRESULT __fastcall FGetErrorValue(); void __fastcall FSetErrorValue( HRESULT pErrorValue ); // ========================================================================== private: // ========================================================================== // ---------------------------------------------------------------------- // Internal Interface Access // ---------------------------------------------------------------------- LPIDIRECTSOUND8 __fastcall FGetInternal_LPIDIRECTSOUND8(); void __fastcall FSetInternal_LPIDIRECTSOUND8( LPIDIRECTSOUND8 pLPIDIRECTSOUND8 ); LPIDIRECTSOUND8* __fastcall FGetInternal_LPIDIRECTSOUND8_Ptr(); // ---------------------------------------------------------------------- // Property Variables // ---------------------------------------------------------------------- bool fCreated; HRESULT fErrorValue; // ---------------------------------------------------------------------- // Interface Variables // ---------------------------------------------------------------------- LPIDIRECTSOUND8 fLPIDIRECTSOUND8; // ---------------------------------------------------------------------- // Event Variables // ---------------------------------------------------------------------- TDx_Event FOnCreate; TDx_Event FOnDestroy; TDx_Error FOnError; }; // -------------------------------------------------------------------------- #endif // --------------------------------------------------------------------------