1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
|
//-----------------------------------------------------------------------------
// File: DMUtil.h
//
// Desc:
//
// Copyright (c) 1999-2001 Microsoft Corp. All rights reserved.
//-----------------------------------------------------------------------------
#ifndef DMUTIL_H
#define DMUTIL_H
#include <dmusicc.h>
#include <dmusici.h>
#include <dsound.h>
//-----------------------------------------------------------------------------
// Classes used by this header
//-----------------------------------------------------------------------------
class CMusicManager;
class CMusicSegment;
class CMusicScript;
//-----------------------------------------------------------------------------
// Name: class CMusicManager
// Desc:
//-----------------------------------------------------------------------------
class CMusicManager
{
protected:
BOOL m_bCleanupCOM;
IDirectMusicLoader8* m_pLoader;
IDirectMusicPerformance8* m_pPerformance;
public:
CMusicManager();
~CMusicManager();
inline IDirectMusicLoader8* GetLoader() { return m_pLoader; }
inline IDirectMusicPerformance8* GetPerformance() { return m_pPerformance; }
IDirectMusicAudioPath8* GetDefaultAudioPath();
HRESULT Initialize( HWND hWnd, DWORD dwPChannels = 128, DWORD dwDefaultPathType = DMUS_APATH_DYNAMIC_STEREO );
HRESULT SetSearchDirectory( const TCHAR* strMediaPath );
VOID CollectGarbage();
HRESULT CreateSegmentFromFile( CMusicSegment** ppSegment, TCHAR* strFileName,
BOOL bDownloadNow = TRUE, BOOL bIsMidiFile = FALSE );
HRESULT CreateScriptFromFile( CMusicScript** ppScript, TCHAR* strFileName );
HRESULT CreateChordMapFromFile( IDirectMusicChordMap8** ppChordMap, TCHAR* strFileName );
HRESULT CreateStyleFromFile( IDirectMusicStyle8** ppStyle, TCHAR* strFileName );
HRESULT GetMotifFromStyle( IDirectMusicSegment8** ppMotif, TCHAR* strStyle, TCHAR* wstrMotif );
HRESULT CreateSegmentFromResource( CMusicSegment** ppSegment, TCHAR* strResource, TCHAR* strResourceType,
BOOL bDownloadNow = TRUE, BOOL bIsMidiFile = FALSE );
};
//-----------------------------------------------------------------------------
// Name: class CMusicSegment
// Desc: Encapsulates functionality of an IDirectMusicSegment
//-----------------------------------------------------------------------------
class CMusicSegment
{
protected:
IDirectMusicSegment8* m_pSegment;
IDirectMusicLoader8* m_pLoader;
IDirectMusicPerformance8* m_pPerformance;
IDirectMusicAudioPath8* m_pEmbeddedAudioPath;
BOOL m_bDownloaded;
public:
CMusicSegment( IDirectMusicPerformance8* pPerformance,
IDirectMusicLoader8* pLoader,
IDirectMusicSegment8* pSegment );
virtual ~CMusicSegment();
inline IDirectMusicSegment8* GetSegment() { return m_pSegment; }
HRESULT GetStyle( IDirectMusicStyle8** ppStyle, DWORD dwStyleIndex = 0 );
HRESULT SetRepeats( DWORD dwRepeats );
HRESULT Play( DWORD dwFlags = DMUS_SEGF_SECONDARY, IDirectMusicAudioPath8* pAudioPath = NULL );
HRESULT Stop( DWORD dwFlags = 0 );
HRESULT Download( IDirectMusicAudioPath8* pAudioPath = NULL );
HRESULT Unload( IDirectMusicAudioPath8* pAudioPath = NULL );
BOOL IsPlaying();
};
//-----------------------------------------------------------------------------
// Name: class CMusicScript
// Desc: Encapsulates functionality of an IDirectMusicScript
//-----------------------------------------------------------------------------
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 );
};
#endif // DMUTIL_H
|