- implemented some more port related-functions

- fixed warnings (reported by Gerald Pfeifer)
This commit is contained in:
Rok Mandeljc 2003-05-06 00:14:31 +00:00 committed by Alexandre Julliard
parent 643e8740d5
commit 8d54728696
4 changed files with 96 additions and 39 deletions

View file

@ -87,7 +87,6 @@ HRESULT WINAPI IDirectMusicImpl_EnumPort (LPDIRECTMUSIC iface, DWORD dwIndex, LP
TRACE("(%p, %ld, %p)\n", This, dwIndex, pPortCaps);
TRACE("1 software synth. + %i WAVE + %i MIDI available\n", numWAVE, numMIDI);
/* i guess the first port shown is always software synthesizer */
if (dwIndex == 0)
{
@ -105,7 +104,6 @@ HRESULT WINAPI IDirectMusicImpl_EnumPort (LPDIRECTMUSIC iface, DWORD dwIndex, LP
MultiByteToWideChar (CP_ACP, 0, "Microsotf Synthesizer", -1, pPortCaps->wszDescription, sizeof(pPortCaps->wszDescription)/sizeof(WCHAR));
return S_OK;
}
/* then return digital sound ports */
for (i = 1; i <= numWAVE; i++)
{
@ -116,7 +114,6 @@ HRESULT WINAPI IDirectMusicImpl_EnumPort (LPDIRECTMUSIC iface, DWORD dwIndex, LP
return S_OK;
}
}
/* finally, list all *real* MIDI ports*/
for (i = numWAVE+1; i <= numWAVE + numMIDI; i++)
{
@ -137,50 +134,91 @@ HRESULT WINAPI IDirectMusicImpl_CreateMusicBuffer (LPDIRECTMUSIC iface, LPDMUS_B
HRESULT WINAPI IDirectMusicImpl_CreatePort (LPDIRECTMUSIC iface, REFCLSID rclsidPort, LPDMUS_PORTPARAMS pPortParams, LPDIRECTMUSICPORT* ppPort, LPUNKNOWN pUnkOuter)
{
ICOM_THIS(IDirectMusicImpl,iface);
FIXME("(%p, %s, %p, %p, %p): stub\n", This, debugstr_guid(rclsidPort), pPortParams, ppPort, pUnkOuter);
return E_OUTOFMEMORY;
int i;
DMUS_PORTCAPS PortCaps;
TRACE("(%p, %s, %p, %p, %p)\n", This, debugstr_guid(rclsidPort), pPortParams, ppPort, pUnkOuter);
for (i = 0; IDirectMusicImpl_EnumPort (iface, i, &PortCaps) != S_FALSE; i++)
{
if (IsEqualGUID(rclsidPort, &PortCaps.guidPort))
{
This->ports = HeapReAlloc(GetProcessHeap(),0,This->ports,sizeof(LPDIRECTMUSICPORT)*This->nrofports);
if (NULL == This->ports[This->nrofports])
{
*ppPort = (LPDIRECTMUSICPORT)NULL;
return E_OUTOFMEMORY;
}
This->ports[This->nrofports]->lpVtbl = &DirectMusicPort_Vtbl;
This->ports[This->nrofports]->ref = 0;
This->ports[This->nrofports]->active = FALSE;
This->ports[This->nrofports]->caps = &PortCaps;
This->ports[This->nrofports]->params = pPortParams;
*ppPort = (LPDIRECTMUSICPORT)This->ports[This->nrofports];
IDirectMusicPortImpl_AddRef ((LPDIRECTMUSICPORT)This->ports[This->nrofports]);
This->nrofports ++;
return S_OK;
}
}
/* FIXME: place correct error here */
return E_NOINTERFACE;
}
HRESULT WINAPI IDirectMusicImpl_EnumMasterClock (LPDIRECTMUSIC iface, DWORD dwIndex, LPDMUS_CLOCKINFO lpClockInfo)
{
FIXME("stub\n");
return DS_OK;
ICOM_THIS(IDirectMusicImpl,iface);
FIXME("(%p, %ld, %p): stub\n", This, dwIndex, lpClockInfo);
return S_OK;
}
HRESULT WINAPI IDirectMusicImpl_GetMasterClock (LPDIRECTMUSIC iface, LPGUID pguidClock, IReferenceClock** ppReferenceClock)
{
FIXME("stub\n");
return DS_OK;
ICOM_THIS(IDirectMusicImpl,iface);
FIXME("(%p, %s, %p): stub\n", This, debugstr_guid (pguidClock), ppReferenceClock);
return S_OK;
}
HRESULT WINAPI IDirectMusicImpl_SetMasterClock (LPDIRECTMUSIC iface, REFGUID rguidClock)
{
FIXME("stub\n");
return DS_OK;
ICOM_THIS(IDirectMusicImpl,iface);
FIXME("(%p, %s): stub\n", This, debugstr_guid(rguidClock));
return S_OK;
}
HRESULT WINAPI IDirectMusicImpl_Activate (LPDIRECTMUSIC iface, BOOL fEnable)
{
FIXME("stub\n");
return DS_OK;
ICOM_THIS(IDirectMusicImpl,iface);
int i;
TRACE("(%p, %i)", This, fEnable);
for (i = 0; i < This->nrofports; i++)
{
This->ports[i]->active = fEnable;
}
return S_OK;
}
HRESULT WINAPI IDirectMusicImpl_GetDefaultPort (LPDIRECTMUSIC iface, LPGUID pguidPort)
{
ICOM_THIS(IDirectMusicImpl,iface);
HKEY hkGUID;
DWORD returnTypeGUID, sizeOfReturnBuffer = 50;
char returnBuffer[51];
GUID defaultPortGUID;
WCHAR buff[51];
if (RegOpenKeyExA (HKEY_LOCAL_MACHINE, "Software\\Microsoft\\DirectMusic\\Defaults" , 0, KEY_READ, &hkGUID) != ERROR_SUCCESS)
TRACE("(%p, %p)\n", This, pguidPort);
if ((RegOpenKeyExA (HKEY_LOCAL_MACHINE, "Software\\Microsoft\\DirectMusic\\Defaults" , 0, KEY_READ, &hkGUID) != ERROR_SUCCESS) || (RegQueryValueExA (hkGUID, "DefaultOutputPort", NULL, &returnTypeGUID, returnBuffer, &sizeOfReturnBuffer) != ERROR_SUCCESS))
{
ERR(": registry entry missing\n" );
}
if (RegQueryValueExA (hkGUID, "DefaultOutputPort", NULL, &returnTypeGUID, returnBuffer, &sizeOfReturnBuffer) != ERROR_SUCCESS)
{
ERR(": missing GUID registry data members\n" );
WARN(": registry entry missing\n" );
*pguidPort = CLSID_DirectMusicSynth;
return S_OK;
}
/* FIXME: Check return types to ensure we're interpreting data right */
MultiByteToWideChar (CP_ACP, 0, returnBuffer, -1, buff, sizeof(buff)/sizeof(WCHAR));
@ -192,8 +230,11 @@ HRESULT WINAPI IDirectMusicImpl_GetDefaultPort (LPDIRECTMUSIC iface, LPGUID pgui
HRESULT WINAPI IDirectMusicImpl_SetDirectSound (LPDIRECTMUSIC iface, LPDIRECTSOUND pDirectSound, HWND hWnd)
{
FIXME("stub\n");
return DS_OK;
ICOM_THIS(IDirectMusicImpl,iface);
FIXME("(%p, %p, %p): stub\n", This, pDirectSound, hWnd);
return S_OK;
}
ICOM_VTABLE(IDirectMusic) DirectMusic_Vtbl =
@ -219,7 +260,6 @@ HRESULT WINAPI DMUSIC_CreateDirectMusic (LPCGUID lpcGUID, LPDIRECTMUSIC *ppDM, L
IDirectMusicImpl *dmusic;
TRACE("(%p,%p,%p)\n",lpcGUID, ppDM, pUnkOuter);
if (IsEqualGUID(lpcGUID, &IID_IDirectMusic))
{
dmusic = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicImpl));
@ -228,14 +268,13 @@ HRESULT WINAPI DMUSIC_CreateDirectMusic (LPCGUID lpcGUID, LPDIRECTMUSIC *ppDM, L
*ppDM = (LPDIRECTMUSIC)NULL;
return E_OUTOFMEMORY;
}
dmusic->lpVtbl = &DirectMusic_Vtbl;
dmusic->ref = 1;
*ppDM = (LPDIRECTMUSIC)dmusic;
return S_OK;
}
WARN("No interface found\n");
return E_NOINTERFACE;
}

View file

@ -73,8 +73,8 @@ HRESULT WINAPI IDirectMusicPerformanceImpl_Init (LPDIRECTMUSICPERFORMANCE iface,
{
TRACE("App provides DirectMusic\n");
/* FIXME: is this correct? */
memcpy(This->dmusic, *ppDirectMusic, sizeof(*ppDirectMusic));
IDirectMusic_AddRef(This->dmusic);
memcpy((LPDIRECTMUSIC)This->dmusic, *ppDirectMusic, sizeof(*ppDirectMusic));
IDirectMusicImpl_AddRef((LPDIRECTMUSIC)This->dmusic);
/* app is supposed to be in charge of everything else */
return S_OK;
}
@ -83,10 +83,10 @@ HRESULT WINAPI IDirectMusicPerformanceImpl_Init (LPDIRECTMUSICPERFORMANCE iface,
{
TRACE("DirectMusic to be created; needed\n");
if (!This->dmusic)
DMUSIC_CreateDirectMusic(&IID_IDirectMusic, &This->dmusic, NULL);
*ppDirectMusic = This->dmusic;
DMUSIC_CreateDirectMusic(&IID_IDirectMusic, (LPDIRECTMUSIC*)&This->dmusic, NULL);
*ppDirectMusic = (LPDIRECTMUSIC)This->dmusic;
if (*ppDirectMusic)
IDirectMusic_AddRef(*ppDirectMusic);
IDirectMusicImpl_AddRef(*ppDirectMusic);
}
/* app allows the performance to initialise itself and does not need a pointer to object*/
if (!ppDirectMusic)
@ -100,7 +100,7 @@ HRESULT WINAPI IDirectMusicPerformanceImpl_Init (LPDIRECTMUSICPERFORMANCE iface,
HRESULT WINAPI IDirectMusicPerformanceImpl_PlaySegment (LPDIRECTMUSICPERFORMANCE iface, IDirectMusicSegment* pSegment, DWORD dwFlags, __int64 i64StartTime, IDirectMusicSegmentState** ppSegmentState)
{
FIXME("stub\n");
return DS_OK;
return S_OK;
}
HRESULT WINAPI IDirectMusicPerformanceImpl_Stop (LPDIRECTMUSICPERFORMANCE iface, IDirectMusicSegment* pSegment, IDirectMusicSegmentState* pSegmentState, MUSIC_TIME mtTime, DWORD dwFlags)
@ -219,8 +219,11 @@ HRESULT WINAPI IDirectMusicPerformanceImpl_RemoveNotificationType (LPDIRECTMUSIC
HRESULT WINAPI IDirectMusicPerformanceImpl_AddPort (LPDIRECTMUSICPERFORMANCE iface, IDirectMusicPort* pPort)
{
FIXME("stub\n");
return DS_OK;
ICOM_THIS(IDirectMusicPerformanceImpl,iface);
FIXME("(%p, %p): stub\n", This, pPort);
return DMUS_E_CANNOT_OPEN_PORT;
}
HRESULT WINAPI IDirectMusicPerformanceImpl_RemovePort (LPDIRECTMUSICPERFORMANCE iface, IDirectMusicPort* pPort)
@ -231,8 +234,11 @@ HRESULT WINAPI IDirectMusicPerformanceImpl_RemovePort (LPDIRECTMUSICPERFORMANCE
HRESULT WINAPI IDirectMusicPerformanceImpl_AssignPChannelBlock (LPDIRECTMUSICPERFORMANCE iface, DWORD dwBlockNum, IDirectMusicPort* pPort, DWORD dwGroup)
{
FIXME("stub\n");
return DS_OK;
ICOM_THIS(IDirectMusicPerformanceImpl,iface);
FIXME("(%p, %ld, %p, %ld): stub\n", This, dwBlockNum, pPort, dwGroup);
return E_INVALIDARG;
}
HRESULT WINAPI IDirectMusicPerformanceImpl_AssignPChannel (LPDIRECTMUSICPERFORMANCE iface, DWORD dwPChannel, IDirectMusicPort* pPort, DWORD dwGroup, DWORD dwMChannel)

View file

@ -107,8 +107,12 @@ HRESULT WINAPI IDirectMusicPortImpl_GetRunningStats (LPDIRECTMUSICPORT iface, LP
HRESULT WINAPI IDirectMusicPortImpl_GetCaps (LPDIRECTMUSICPORT iface, LPDMUS_PORTCAPS pPortCaps)
{
FIXME("stub\n");
return DS_OK;
ICOM_THIS(IDirectMusicPortImpl,iface);
TRACE("(%p, %p)\n", This, pPortCaps);
pPortCaps = This->caps;
return S_OK;
}
HRESULT WINAPI IDirectMusicPortImpl_DeviceIoControl (LPDIRECTMUSICPORT iface, DWORD dwIoControlCode, LPVOID lpInBuffer, DWORD nInBufferSize, LPVOID lpOutBuffer, DWORD nOutBufferSize, LPDWORD lpBytesReturned, LPOVERLAPPED lpOverlapped)

View file

@ -133,6 +133,8 @@ struct IDirectMusicImpl
DWORD ref;
/* IDirectMusicImpl fields */
IDirectMusicPortImpl** ports;
int nrofports;
};
/* IUnknown: */
@ -324,6 +326,9 @@ struct IDirectMusicPortImpl
DWORD ref;
/* IDirectMusicPortImpl fields */
BOOL active;
LPDMUS_PORTCAPS caps;
LPDMUS_PORTPARAMS params;
};
/* IUnknown: */
@ -704,6 +709,8 @@ extern HRESULT WINAPI IDirectMusicLoader8Impl_EnumObject (LPDIRECTMUSICLOADER8 i
extern void WINAPI IDirectMusicLoader8Impl_CollectGarbage (LPDIRECTMUSICLOADER8 iface);
extern HRESULT WINAPI IDirectMusicLoader8Impl_ReleaseObjectByUnknown (LPDIRECTMUSICLOADER8 iface, IUnknown* pObject);
extern HRESULT WINAPI IDirectMusicLoader8Impl_LoadObjectFromFile (LPDIRECTMUSICLOADER8 iface, REFGUID rguidClassID, REFIID iidInterfaceID, WCHAR* pwzFilePath, void** ppObject);
/* ClassFactory */
extern HRESULT WINAPI DMUSIC_CreateDirectMusicLoader8 (LPCGUID lpcGUID, LPDIRECTMUSICLOADER8 *ppDMLoad8, LPUNKNOWN pUnkOuter);
/*****************************************************************************
* IDirectMusicGetLoaderImpl implementation structure
@ -893,7 +900,7 @@ struct IDirectMusicPerformanceImpl
DWORD ref;
/* IDirectMusicPerformanceImpl fields */
IDirectMusic *dmusic;
IDirectMusicImpl *dmusic;
IDirectSound *dsound;
};
@ -943,7 +950,6 @@ extern HRESULT WINAPI IDirectMusicPerformanceImpl_MIDIToMusic (LPDIRECTMUSICPERF
extern HRESULT WINAPI IDirectMusicPerformanceImpl_MusicToMIDI (LPDIRECTMUSICPERFORMANCE iface, WORD wMusicValue, DMUS_CHORD_KEY* pChord, BYTE bPlayMode, BYTE bChordLevel, BYTE* pbMIDIValue);
extern HRESULT WINAPI IDirectMusicPerformanceImpl_TimeToRhythm (LPDIRECTMUSICPERFORMANCE iface, MUSIC_TIME mtTime, DMUS_TIMESIGNATURE* pTimeSig, WORD* pwMeasure, BYTE* pbBeat, BYTE* pbGrid, short* pnOffset);
extern HRESULT WINAPI IDirectMusicPerformanceImpl_RhythmToTime (LPDIRECTMUSICPERFORMANCE iface, WORD wMeasure, BYTE bBeat, BYTE bGrid, short nOffset, DMUS_TIMESIGNATURE* pTimeSig, MUSIC_TIME* pmtTime);
/* ClassFactory */
extern HRESULT WINAPI DMUSIC_CreateDirectMusicPerformance (LPCGUID lpcGUID, LPDIRECTMUSICPERFORMANCE *ppDMPerf, LPUNKNOWN pUnkOuter);
@ -1015,6 +1021,8 @@ extern HRESULT WINAPI IDirectMusicPerformance8ImplCreateStandardAudioPath (LPDIR
extern HRESULT WINAPI IDirectMusicPerformance8ImplSetDefaultAudioPath (LPDIRECTMUSICPERFORMANCE8 iface, IDirectMusicAudioPath* pAudioPath);
extern HRESULT WINAPI IDirectMusicPerformance8ImplGetDefaultAudioPath (LPDIRECTMUSICPERFORMANCE8 iface, IDirectMusicAudioPath** ppAudioPath);
extern HRESULT WINAPI IDirectMusicPerformance8ImplGetParamEx (LPDIRECTMUSICPERFORMANCE8 iface, REFGUID rguidType, DWORD dwTrackID, DWORD dwGroupBits, DWORD dwIndex, MUSIC_TIME mtTime, MUSIC_TIME* pmtNext, void* pParam);
/* ClassFactory */
extern HRESULT WINAPI DMUSIC_CreateDirectMusicPerformance8 (LPCGUID lpcGUID, LPDIRECTMUSICPERFORMANCE8 *ppDMPerf8, LPUNKNOWN pUnkOuter);
/*****************************************************************************
* IDirectMusicGraphImpl implementation structure