Commit 6c9b097f authored by Rok Mandeljc's avatar Rok Mandeljc Committed by Alexandre Julliard

Added framework for file loading.

parent 018e3cc6
......@@ -20,7 +20,8 @@ C_SRCS = \
dmusic_port.c \
dmusic_segment.c \
dmusic_style.c \
dmusic_synth.c
dmusic_synth.c \
helper.c
RC_SRCS = version.rc
......
......@@ -312,18 +312,48 @@ HRESULT WINAPI IDirectMusicLoader8Impl_LoadObjectFromFile (LPDIRECTMUSICLOADER8
WCHAR* pwzFilePath,
void** ppObject)
{
HANDLE fd;
ICOM_THIS(IDirectMusicLoader8Impl,iface);
FIXME("(%p, %s, %s, %s, %p): stub\n", This, debugstr_guid(rguidClassID), debugstr_guid(iidInterfaceID), debugstr_w(pwzFilePath), ppObject);
if (IsEqualGUID(iidInterfaceID, &CLSID_DirectSoundWave)) {
FIXME("wanted 'wav'\n");
} else if (IsEqualGUID(iidInterfaceID, &CLSID_DirectMusicScript)) {
FIXME("wanted 'spt'\n");
} else if (IsEqualGUID(iidInterfaceID, &CLSID_DirectMusicContainer)) {
fd = CreateFileW (pwzFilePath, GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
if (!fd) {
WARN ("could not load file\n");
return DMUS_E_LOADER_FAILEDOPEN;
}
if (IsEqualGUID(rguidClassID, &CLSID_DirectMusicAudioPathConfig)) {
FIXME("wanted 'aud'\n");
} else if (IsEqualGUID(rguidClassID, &CLSID_DirectMusicBand)) {
FIXME("wanted 'bnd'\n");
DMUSIC_FillBandFromFileHandle (NULL, fd);
} else if (IsEqualGUID(rguidClassID, &CLSID_DirectMusicContainer)) {
FIXME("wanted 'con'\n");
} else if (IsEqualGUID(rguidClassID, &CLSID_DirectMusicCollection)) {
FIXME("wanted 'dls'\n");
} else if (IsEqualGUID(rguidClassID, &CLSID_DirectMusicChordMap)) {
FIXME("wanted 'cdm'\n");
} else if (IsEqualGUID(rguidClassID, &CLSID_DirectMusicSegment)) {
FIXME("wanted 'sgt'\n");
DMUSIC_FillSegmentFromFileHandle (NULL, fd);
} else if (IsEqualGUID(rguidClassID, &CLSID_DirectMusicScript)) {
FIXME("wanted 'spt'\n");
} else if (IsEqualGUID(rguidClassID, &CLSID_DirectMusicSong)) {
FIXME("wanted 'sng'\n");
} else if (IsEqualGUID(rguidClassID, &CLSID_DirectMusicStyle)) {
FIXME("wanted 'sty'\n");
} else if (IsEqualGUID(rguidClassID, &CLSID_DirectMusicSegment)) {
FIXME("wanted 'tpl'\n");
} else if (IsEqualGUID(rguidClassID, &CLSID_DirectMusicGraph)) {
FIXME("wanted 'tgr'\n");
} else if (IsEqualGUID(rguidClassID, &CLSID_DirectSoundWave)) {
FIXME("wanted 'wav'\n");
}
CloseHandle (fd);
if (IsEqualGUID(iidInterfaceID, &IID_IDirectMusicSegment) ||
IsEqualGUID(iidInterfaceID, &IID_IDirectMusicSegment8)) {
IDirectMusicSegment8Impl* segment;
......@@ -331,6 +361,7 @@ HRESULT WINAPI IDirectMusicLoader8Impl_LoadObjectFromFile (LPDIRECTMUSICLOADER8
segment->lpVtbl = &DirectMusicSegment8_Vtbl;
segment->ref = 1;
*ppObject = segment;
return S_OK;
} else if (IsEqualGUID(iidInterfaceID, &IID_IDirectMusicContainer)) {
IDirectMusicContainerImpl* container;
container = HeapAlloc(GetProcessHeap(), 0, sizeof(IDirectMusicContainerImpl));
......
......@@ -1029,8 +1029,8 @@ HRESULT WINAPI IDirectMusicPerformance8ImplInitAudio (LPDIRECTMUSICPERFORMANCE8
IDirectMusicPerformance8Impl_Init(iface, ppDirectMusic, This->dsound, hWnd);
/* Init increases the ref count of the dsound object. Decremente it if the app don't want a pointer to the object. */
if (!ppDirectSound)
IDirectSound_Release(*ppDirectSound);
/*if (!ppDirectSound)
IDirectSound_Release(*ppDirectSound);*/
/* as seen in msdn we need params init before audio path creation */
if (NULL != pParams) {
......
......@@ -152,6 +152,56 @@ typedef struct DMUSIC_PRIVATE_CHANNEL_GROUP_
DMUSIC_PRIVATE_MCHANNEL channel[16]; /* 16 channels in a group */
} DMUSIC_PRIVATE_CHANNEL_GROUP, *LPDMUSIC_PRIVATE_CHANNEL_GROUP;
/* used for loading chunks of data from files */
typedef struct _rawChunk
{
FOURCC id; /* FOURCC */
DWORD size; /* size of chunk_riff */
/* BYTE* data; */ /* chunk_riff data */
} rawChunk;
/* struct in which UNFO data is stored */
typedef struct _UNFO_List
{
WCHAR* name;
WCHAR* artist;
WCHAR* copyright;
WCHAR* version;
WCHAR* subject;
WCHAR* comment;
} UNFO_List;
typedef struct _ChordData
{
DMUS_IO_CHORD chord;
DWORD nrofsubchords;
DMUS_IO_SUBCHORD *subchord;
} ChordData;
typedef struct _Reference
{
DMUS_IO_REFERENCE header;
GUID guid;
FILETIME date;
WCHAR* name;
WCHAR* file;
WCHAR* category;
DMUS_IO_VERSION version;
} Reference;
typedef struct _BandTrack
{
DMUS_IO_BAND_TRACK_HEADER header;
GUID guid;
DMUS_IO_VERSION version;
UNFO_List UNFO;
DMUS_IO_BAND_ITEM_HEADER header1;
DMUS_IO_BAND_ITEM_HEADER2 header2;
/* IDirectMusicBandImpl **band; */
} BandTrack;
/*****************************************************************************
* IDirectMusicImpl implementation structure
......@@ -1323,5 +1373,11 @@ extern HRESULT WINAPI IDirectMusicSongImpl_EnumSegment (LPDIRECTMUSICSONG iface,
* Helper Functions
*/
void register_waveport (LPGUID lpGUID, LPCSTR lpszDesc, LPCSTR lpszDrvName, LPVOID lpContext);
/* Loader Helper Functions */
HRESULT WINAPI DMUSIC_FillSegmentFromFileHandle (IDirectMusicSegmentImpl *segment, HANDLE fd);
HRESULT WINAPI DMUSIC_FillTrackFromFileHandle (IDirectMusicTrackImpl *segment, HANDLE fd);
HRESULT WINAPI DMUSIC_FillReferenceFromFileHandle (Reference reference, HANDLE fd);
HRESULT WINAPI DMUSIC_FillUNFOFromFileHandle (UNFO_List UNFO, HANDLE fd);
HRESULT WINAPI DMUSIC_FillBandFromFileHandle (IDirectMusicBandImpl *band, HANDLE fd);
#endif /* __WINE_DMUSIC_PRIVATE_H */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment