#ifndef TDx9_MusicH #define TDx9_MusicH // ========================================================================== // File: TDx9_Music.H // Authors: BCB_Code_Generator v2.00, // Darren Dwyer (source code, documentation, demos, website), // Hugh Edwards (documentation, icons) // Description: This file defines the TDx9_Music Component // // "TDx9_Music_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_Music_Library_Defns.H" #include "TDx9_Music_Library_Functions.H" // -------------------------------------------------------------------------- // external classes used by TDx9_Music methods. class TDMus_BufferDesc; class TDMus_ClockInfo; class TDMus_PortCaps; class TDx_Sound; // -------------------------------------------------------------------------- // ========================================================================== // Class: TDx9_Music // Description: The TDx9_Music object is used to ... // ========================================================================== #if (__BORLANDC__ >= 0x0530) // BCB Version 3 + class PACKAGE TDx9_Music : public TComponent { // -------------------------------------------------------------------------- #else // BCB Version 1 class TDx9_Music : public TComponent { #endif // ========================================================================== __published: // ========================================================================== // ---------------------------------------------------------------------- // Event: OnCreate() // Description: The OnCreate() event is triggered by the // TDx9_Music::Create() method after it has successfully // created the internal LPIDIRECTMUSIC used within the // TDx9_Music 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 LPIDIRECTMUSIC interface. // // For example, you could retrieve the TDx9_Music // component's capabilities, Create() dependant components, // allocate memory, etc. // // When used in conjunction with the TDx9_Music::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_Music::Destroy() method, just before the TDx9_Music // internal LPIDIRECTMUSIC interface is destroyed. // // Note: This event is an ideal place to place code that // reverses the results of the TDx9_Music::OnCreate() event. // For example, assume you have already setup the // TDx9_Music::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_Music::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_Music component. // ---------------------------------------------------------------------- __property TDx_Error OnError = {read=FOnError, write=FOnError, nodefault}; // ========================================================================== public: // ========================================================================== // ---------------------------------------------------------------------- // Property: Created // Description: The Created property is true if the internal // LPIDIRECTMUSIC used in this component has been // successfully created, otherwise Created is false. // // To create the internal LPIDIRECTMUSIC, call the // TDx9_Music::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_Music method or fget/fset. // eg. S_OK or DDERR_SURFACELOST or TDX_ERROR // ---------------------------------------------------------------------- __property HRESULT ErrorValue = { read=FGetErrorValue, write=FSetErrorValue, default=S_OK }; // ---------------------------------------------------------------------- // Method: Activate() // Description: The Activate method is used to ... // Params: pEnable - // The Enable parameter ... // ---------------------------------------------------------------------- virtual bool __fastcall Activate( bool pEnable ); // ---------------------------------------------------------------------- // Method: Create() // Description: The Create() method is used to automatically create the // internal LPIDIRECTMUSIC interface used in the TDx9_Music // component and must be called before any methods of the // TDx9_Music component will function. // ---------------------------------------------------------------------- virtual bool __fastcall Create(); // ---------------------------------------------------------------------- // Method: CreateMusicBuffer() // Description: The CreateMusicBuffer method is used to ... // Params: pBufferDesc - // The BufferDesc parameter ... // p - // The parameter ... // pUnkOuter - // The UnkOuter parameter ... // ---------------------------------------------------------------------- virtual bool __fastcall CreateMusicBuffer( TDMus_BufferDesc* pBufferDesc, LPDIRECTMUSICBUFFER*..ppBuffer p, LPUNKNOWN pUnkOuter ); // ---------------------------------------------------------------------- // Method: CreatePort() // Description: The CreatePort method is used to ... // Params: pPort - // The Port parameter ... // pPortParams - // The PortParams parameter ... // pUnkOuter - // The UnkOuter parameter ... // ---------------------------------------------------------------------- // ---------------------------------------------------------------------- // Method: Destroy() // Description: The Destroy() method is used to automatically destroy the // internal LPIDIRECTMUSIC interface used in the TDx9_Music // 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: EnumMasterClock() // Description: The EnumMasterClock method is used to ... // Params: pIndex - // The Index parameter ... // pClockInfo - // The ClockInfo parameter ... // ---------------------------------------------------------------------- virtual bool __fastcall EnumMasterClock( dword pIndex, TDMus_ClockInfo* pClockInfo ); // ---------------------------------------------------------------------- // Method: EnumPort() // Description: The EnumPort method is used to ... // Params: pIndex - // The Index parameter ... // pPortCaps - // The PortCaps parameter ... // ---------------------------------------------------------------------- virtual bool __fastcall EnumPort( dword pIndex, TDMus_PortCaps* pPortCaps ); // ---------------------------------------------------------------------- // Method: GetDefaultPort() // Description: The GetDefaultPort method is used to ... // Params: pPort - // The Port parameter ... // ---------------------------------------------------------------------- virtual bool __fastcall GetDefaultPort( GUID* pPort ); // ---------------------------------------------------------------------- // Method: GetMasterClock() // Description: The GetMasterClock method is used to ... // Params: pClock - // The Clock parameter ... // pReferenceClock - // The ReferenceClock parameter ... // ---------------------------------------------------------------------- virtual bool __fastcall GetMasterClock( GUID* pClock, IReferenceClock** pReferenceClock ); // ---------------------------------------------------------------------- // Method: SetDirectSound() // Description: The SetDirectSound method is used to ... // Params: pDirectSound - // The DirectSound parameter ... // pWnd - // The Wnd parameter ... // ---------------------------------------------------------------------- virtual bool __fastcall SetDirectSound( TDx_Sound* pDirectSound, HWND pWnd ); // ---------------------------------------------------------------------- // Method: SetExternalMasterClock() // Description: The SetExternalMasterClock method is used to ... // Params: pClock - // The Clock parameter ... // ---------------------------------------------------------------------- virtual bool __fastcall SetExternalMasterClock( IReferenceClock* pClock ); // ---------------------------------------------------------------------- // Method: SetMasterClock() // Description: The SetMasterClock method is used to ... // Params: pClock - // The Clock parameter ... // ---------------------------------------------------------------------- virtual bool __fastcall SetMasterClock( REFGUID pClock ); // ---------------------------------------------------------------------- // Constructor() and Destructor() // ---------------------------------------------------------------------- __fastcall TDx9_Music(TComponent* Owner); virtual __fastcall ~TDx9_Music(); // ---------------------------------------------------------------------- // The following properties and methods are used internally by // TDx9_Music_Library and should not be used. // ---------------------------------------------------------------------- __property LPIDIRECTMUSIC Internal_LPIDIRECTMUSIC = { read=FGetInternal_LPIDIRECTMUSIC, write=FSetInternal_LPIDIRECTMUSIC, nodefault }; __property LPIDIRECTMUSIC* Internal_LPIDIRECTMUSIC_Ptr = { read=FGetInternal_LPIDIRECTMUSIC_Ptr, nodefault }; void __fastcall Internal_LPIDIRECTMUSIC_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 // ---------------------------------------------------------------------- LPIDIRECTMUSIC __fastcall FGetInternal_LPIDIRECTMUSIC(); void __fastcall FSetInternal_LPIDIRECTMUSIC( LPIDIRECTMUSIC pLPIDIRECTMUSIC ); LPIDIRECTMUSIC* __fastcall FGetInternal_LPIDIRECTMUSIC_Ptr(); // ---------------------------------------------------------------------- // Property Variables // ---------------------------------------------------------------------- bool fCreated; HRESULT fErrorValue; // ---------------------------------------------------------------------- // Interface Variables // ---------------------------------------------------------------------- LPIDIRECTMUSIC fLPIDIRECTMUSIC; // ---------------------------------------------------------------------- // Event Variables // ---------------------------------------------------------------------- TDx_Event FOnCreate; TDx_Event FOnDestroy; TDx_Error FOnError; }; // -------------------------------------------------------------------------- #endif // --------------------------------------------------------------------------