Microsoft DirectX 9.0

CMusicScript Sample Class

The CMusicScript sample class represents a script, and contains methods for getting and setting variables and calling routines.

class CMusicScript
{
protected:
    IDirectMusicScript8*      m_pScript;
    IDirectMusicLoader8*      m_pLoader;
    IDirectMusicPerformance8* m_pPerformance;

public:
    CMusicScript(IDirectMusicPerformance8* pPerformance, 
                  IDirectMusicLoader8* pLoader,
                  IDirectMusicScript8* pScript);
    virtual ~CMusicScript();

    inline  IDirectMusicScript8* GetScript() { return m_pScript; }
    HRESULT CallRoutine(TCHAR* strRoutine);
    HRESULT SetVariableNumber(TCHAR* strVariable, LONG lValue);
    HRESULT GetVariableNumber(TCHAR* strVariable, LONG* plValue);
    HRESULT SetVariableObject(TCHAR* strVariable, IUnknown *punkValue);
    HRESULT GetVariableObject(TCHAR* strVariable, REFIID riid, 
        LPVOID FAR *ppv);
};

Constructor

The constructor stores pointers to the loader, performance, and script objects.

Public Methods

The class contains the following public methods, in alphabetical order.

Method Description
CallRoutine Calls IDirectMusicScript8::CallRoutine, after doing any necessary string type conversion.
GetScript Returns the IDirectMusicScript8 interface pointer.
GetVariableNumber Calls IDirectMusicScript8::GetVariableNumber, after doing any necessary string type conversion.
GetVariableObject Calls IDirectMusicScript8::GetVariableObject, after doing any necessary string type conversion.
SetVariableNumber Calls IDirectMusicScript8::SetVariableNumber, after doing any necessary string type conversion.
SetVariableObject Calls IDirectMusicScript8::SetVariableObject, after doing any necessary string type conversion.

The class is implemented in (SDK root)\samples\C++\Common\Src\Dmutil.cpp.

See Also