Richard Boegli's CnC_Generals_Zero_Hour Fork WIP
This is documentation of Richard Boegil's Zero Hour Fork
 
Loading...
Searching...
No Matches
simpleplayer.h
Go to the documentation of this file.
1/*
2** Command & Conquer Generals Zero Hour(tm)
3** Copyright 2025 Electronic Arts Inc.
4**
5** This program is free software: you can redistribute it and/or modify
6** it under the terms of the GNU General Public License as published by
7** the Free Software Foundation, either version 3 of the License, or
8** (at your option) any later version.
9**
10** This program is distributed in the hope that it will be useful,
11** but WITHOUT ANY WARRANTY; without even the implied warranty of
12** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13** GNU General Public License for more details.
14**
15** You should have received a copy of the GNU General Public License
16** along with this program. If not, see <http://www.gnu.org/licenses/>.
17*/
18
19
20#ifndef SIMPLEPLAYER_H
21#define SIMPLEPLAYER_H
22
23#include "wmsdk.h"
24
25//
26// we preserve a list of "ready-to-free" list of wave headers for the
27// caller to unprepare and free
28//
29typedef struct WAVEHDR_LIST {
30 LPWAVEHDR pwh;
33
34#define SIMPLE_PLAYER_OPEN_EVENT _T( "45ab58e0-382e-4d1c-ac50-88a5f9601851" )
35#define SIMPLE_PLAYER_CLOSE_EVENT _T( "276095fa-a8e0-48e6-ac61-8b0002345607" )
36#define WMAPLAY_EVENT _T( "9e828a72-64f3-48f0-9de8-13dafd0cbd3a" )
38class CSimplePlayer : public IWMReaderCallback
39{
40public:
41 CSimplePlayer( HRESULT* phr );
43
44 virtual HRESULT Play( LPCWSTR pszUrl, DWORD dwSecDuration, HANDLE hCompletionEvent, HRESULT *phrCompletion );
45
46//
47// IUnknown Implemenation
48//
49public:
50 virtual HRESULT STDMETHODCALLTYPE QueryInterface(
51 REFIID riid,
52 void **ppvObject );
53
54 virtual ULONG STDMETHODCALLTYPE AddRef();
55 virtual ULONG STDMETHODCALLTYPE Release();
56
57//
58// IWMReaderCallback Implemenation
59//
60public:
61 virtual HRESULT STDMETHODCALLTYPE OnSample(
62 /* [in] */ DWORD dwOutputNum,
63 /* [in] */ QWORD cnsSampleTime,
64 /* [in] */ QWORD cnsSampleDuration,
65 /* [in] */ DWORD dwFlags,
66 /* [in] */ INSSBuffer __RPC_FAR *pSample,
67 /* [in] */ void __RPC_FAR *pvContext);
68
69 virtual HRESULT STDMETHODCALLTYPE OnStatus(
70 /* [in] */ WMT_STATUS Status,
71 /* [in] */ HRESULT hr,
72 /* [in] */ WMT_ATTR_DATATYPE dwType,
73 /* [in] */ BYTE __RPC_FAR *pValue,
74 /* [in] */ void __RPC_FAR *pvContext);
75
76//
77// Helper Methods
78//
79protected:
80
81 HRESULT Close();
82
83 void OnWaveOutMsg( UINT uMsg, DWORD dwParam1, DWORD dwParam2 );
84
85 static void CALLBACK WaveProc(
86 HWAVEOUT hwo,
87 UINT uMsg,
88 DWORD dwInstance,
89 DWORD dwParam1,
90 DWORD dwParam2 );
91
92 HRESULT AddWaveHeader( LPWAVEHDR pwh );
93 void RemoveWaveHeaders( void );
94
95 CRITICAL_SECTION m_CriSec;
97
98 LONG m_cRef;
102
103 IWMReader *m_pReader;
104 IWMHeaderInfo *m_pHeader;
105 HWAVEOUT m_hwo;
106
108
109 HRESULT m_hrOpen;
112
113 union
114 {
115 WAVEFORMATEX m_wfx;
117 };
118
119 LPWSTR m_pszUrl;
120
121};
122
123#endif // SIMPLEPLAYER_H
unsigned int UINT
Definition bittype.h:63
unsigned char BYTE
Definition bittype.h:59
unsigned long DWORD
Definition bittype.h:57
unsigned long ULONG
Definition bittype.h:64
#define BOOL
Definition Wnd_File.h:57
HANDLE m_hOpenEvent
IWMReader * m_pReader
HRESULT AddWaveHeader(LPWAVEHDR pwh)
virtual ULONG STDMETHODCALLTYPE Release()
CSimplePlayer(HRESULT *phr)
void OnWaveOutMsg(UINT uMsg, DWORD dwParam1, DWORD dwParam2)
LONG m_cBuffersOutstanding
HANDLE m_hCloseEvent
IWMHeaderInfo * m_pHeader
virtual HRESULT Play(LPCWSTR pszUrl, DWORD dwSecDuration, HANDLE hCompletionEvent, HRESULT *phrCompletion)
virtual ULONG STDMETHODCALLTYPE AddRef()
static void CALLBACK WaveProc(HWAVEOUT hwo, UINT uMsg, DWORD dwInstance, DWORD dwParam1, DWORD dwParam2)
HRESULT * m_phrCompletion
WAVEFORMATEX m_wfx
virtual HRESULT STDMETHODCALLTYPE OnStatus(WMT_STATUS Status, HRESULT hr, WMT_ATTR_DATATYPE dwType, BYTE __RPC_FAR *pValue, void __RPC_FAR *pvContext)
CRITICAL_SECTION m_CriSec
void RemoveWaveHeaders(void)
WAVEHDR_LIST * m_whdrHead
HANDLE m_hCompletionEvent
BYTE m_WfxBuf[1024]
virtual HRESULT STDMETHODCALLTYPE OnSample(DWORD dwOutputNum, QWORD cnsSampleTime, QWORD cnsSampleDuration, DWORD dwFlags, INSSBuffer __RPC_FAR *pSample, void __RPC_FAR *pvContext)
virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void **ppvObject)
struct WAVEHDR_LIST * next
LPWAVEHDR pwh