2012-05-14 08:06:30 +02:00
|
|
|
/*
|
|
|
|
* DirectMusic Private Include
|
2003-03-21 01:42:38 +01:00
|
|
|
*
|
2004-01-20 01:21:40 +01:00
|
|
|
* Copyright (C) 2003-2004 Rok Mandeljc
|
2012-09-18 23:13:41 +02:00
|
|
|
* Copyright (C) 2012 Christian Costa
|
2003-03-21 01:42:38 +01:00
|
|
|
*
|
2007-05-30 12:54:07 +02:00
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
2003-03-21 01:42:38 +01:00
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
2007-05-30 12:54:07 +02:00
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
2003-03-21 01:42:38 +01:00
|
|
|
*
|
2007-05-30 12:54:07 +02:00
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
2003-03-21 01:42:38 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __WINE_DMUSIC_PRIVATE_H
|
|
|
|
#define __WINE_DMUSIC_PRIVATE_H
|
|
|
|
|
2003-09-06 01:08:26 +02:00
|
|
|
#include <stdarg.h>
|
|
|
|
|
2004-08-11 21:43:45 +02:00
|
|
|
#define COBJMACROS
|
2017-05-11 09:35:33 +02:00
|
|
|
#define NONAMELESSUNION
|
|
|
|
#define NONAMELESSSTRUCT
|
2004-08-11 21:43:45 +02:00
|
|
|
|
2003-03-21 01:42:38 +01:00
|
|
|
#include "windef.h"
|
|
|
|
#include "winbase.h"
|
|
|
|
#include "winnt.h"
|
2003-09-06 01:08:26 +02:00
|
|
|
#include "wingdi.h"
|
2004-01-20 01:21:40 +01:00
|
|
|
#include "winuser.h"
|
|
|
|
|
|
|
|
#include "wine/debug.h"
|
|
|
|
#include "wine/list.h"
|
|
|
|
#include "winreg.h"
|
2004-08-22 23:38:46 +02:00
|
|
|
#include "objbase.h"
|
2004-01-20 01:21:40 +01:00
|
|
|
|
2003-04-08 23:42:00 +02:00
|
|
|
#include "dmusici.h"
|
|
|
|
#include "dmusicf.h"
|
2004-01-20 01:21:40 +01:00
|
|
|
#include "dmusics.h"
|
2016-10-05 10:36:59 +02:00
|
|
|
#include "dmksctrl.h"
|
2003-03-21 01:42:38 +01:00
|
|
|
|
|
|
|
/*****************************************************************************
|
|
|
|
* Interfaces
|
|
|
|
*/
|
|
|
|
typedef struct IDirectMusic8Impl IDirectMusic8Impl;
|
|
|
|
typedef struct IDirectMusicBufferImpl IDirectMusicBufferImpl;
|
|
|
|
typedef struct IDirectMusicDownloadedInstrumentImpl IDirectMusicDownloadedInstrumentImpl;
|
|
|
|
typedef struct IDirectMusicDownloadImpl IDirectMusicDownloadImpl;
|
2003-07-22 00:10:14 +02:00
|
|
|
typedef struct IReferenceClockImpl IReferenceClockImpl;
|
2003-04-08 23:42:00 +02:00
|
|
|
|
2004-01-20 01:21:40 +01:00
|
|
|
typedef struct IDirectMusicInstrumentImpl IDirectMusicInstrumentImpl;
|
|
|
|
|
2003-06-07 02:39:18 +02:00
|
|
|
/*****************************************************************************
|
|
|
|
* Some stuff to make my life easier :=)
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* some sort of aux. midi channel: big fake at the moment; accepts only priority
|
|
|
|
changes... more coming soon */
|
2004-01-20 01:21:40 +01:00
|
|
|
typedef struct DMUSIC_PRIVATE_MCHANNEL_ {
|
2003-06-07 02:39:18 +02:00
|
|
|
DWORD priority;
|
|
|
|
} DMUSIC_PRIVATE_MCHANNEL, *LPDMUSIC_PRIVATE_MCHANNEL;
|
|
|
|
|
|
|
|
/* some sort of aux. channel group: collection of 16 midi channels */
|
2004-01-20 01:21:40 +01:00
|
|
|
typedef struct DMUSIC_PRIVATE_CHANNEL_GROUP_ {
|
2003-06-07 02:39:18 +02:00
|
|
|
DMUSIC_PRIVATE_MCHANNEL channel[16]; /* 16 channels in a group */
|
|
|
|
} DMUSIC_PRIVATE_CHANNEL_GROUP, *LPDMUSIC_PRIVATE_CHANNEL_GROUP;
|
|
|
|
|
2012-09-16 20:24:10 +02:00
|
|
|
typedef struct port_info {
|
|
|
|
DMUS_PORTCAPS caps;
|
2017-05-10 14:44:01 +02:00
|
|
|
HRESULT (*create)(IDirectMusic8Impl *parent, DMUS_PORTPARAMS *port_params,
|
|
|
|
DMUS_PORTCAPS *port_caps, IDirectMusicPort **port);
|
2012-09-16 20:24:10 +02:00
|
|
|
ULONG device;
|
|
|
|
} port_info;
|
|
|
|
|
2012-12-21 10:27:38 +01:00
|
|
|
typedef struct instrument_region {
|
|
|
|
RGNHEADER header;
|
|
|
|
WAVELINK wave_link;
|
|
|
|
WSMPL wave_sample;
|
|
|
|
WLOOP wave_loop;
|
|
|
|
BOOL loop_present;
|
|
|
|
} instrument_region;
|
2003-06-30 20:28:52 +02:00
|
|
|
|
2013-01-22 08:35:56 +01:00
|
|
|
typedef struct instrument_articulation {
|
|
|
|
CONNECTIONLIST connections_list;
|
|
|
|
CONNECTION *connections;
|
|
|
|
} instrument_articulation;
|
|
|
|
|
2003-03-21 01:42:38 +01:00
|
|
|
/*****************************************************************************
|
2003-06-27 21:43:13 +02:00
|
|
|
* ClassFactory
|
2003-07-22 00:10:14 +02:00
|
|
|
*/
|
2012-04-23 21:25:53 +02:00
|
|
|
|
|
|
|
/* CLSID */
|
2011-05-13 17:00:59 +02:00
|
|
|
extern HRESULT WINAPI DMUSIC_CreateDirectMusicImpl (LPCGUID lpcGUID, LPVOID* ppobj, LPUNKNOWN pUnkOuter) DECLSPEC_HIDDEN;
|
2012-04-23 21:25:53 +02:00
|
|
|
extern HRESULT WINAPI DMUSIC_CreateDirectMusicCollectionImpl(LPCGUID lpcGUID, LPVOID* ppobj, LPUNKNOWN pUnkOuter) DECLSPEC_HIDDEN;
|
|
|
|
|
|
|
|
/* Internal */
|
2012-04-24 11:37:20 +02:00
|
|
|
extern HRESULT DMUSIC_CreateDirectMusicBufferImpl(LPDMUS_BUFFERDESC desc, LPVOID* ret_iface) DECLSPEC_HIDDEN;
|
|
|
|
extern HRESULT DMUSIC_CreateDirectMusicDownloadImpl (LPCGUID lpcGUID, LPVOID* ppobj, LPUNKNOWN pUnkOuter) DECLSPEC_HIDDEN;
|
|
|
|
extern HRESULT DMUSIC_CreateReferenceClockImpl (LPCGUID lpcGUID, LPVOID* ppobj, LPUNKNOWN pUnkOuter) DECLSPEC_HIDDEN;
|
|
|
|
extern HRESULT DMUSIC_CreateDirectMusicInstrumentImpl (LPCGUID lpcGUID, LPVOID* ppobj, LPUNKNOWN pUnkOuter) DECLSPEC_HIDDEN;
|
2003-08-23 01:53:27 +02:00
|
|
|
|
2003-03-21 01:42:38 +01:00
|
|
|
/*****************************************************************************
|
|
|
|
* IDirectMusic8Impl implementation structure
|
|
|
|
*/
|
2004-01-20 01:21:40 +01:00
|
|
|
struct IDirectMusic8Impl {
|
2012-05-01 10:06:58 +02:00
|
|
|
IDirectMusic8 IDirectMusic8_iface;
|
|
|
|
LONG ref;
|
2017-05-10 15:13:19 +02:00
|
|
|
IDirectSound *dsound;
|
2019-06-14 18:42:44 +02:00
|
|
|
IReferenceClock *master_clock;
|
2017-05-10 14:43:59 +02:00
|
|
|
IDirectMusicPort **ports;
|
|
|
|
int num_ports;
|
|
|
|
port_info *system_ports;
|
|
|
|
int num_system_ports;
|
2003-03-21 01:42:38 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
/*****************************************************************************
|
|
|
|
* IDirectMusicBufferImpl implementation structure
|
|
|
|
*/
|
2004-01-20 01:21:40 +01:00
|
|
|
struct IDirectMusicBufferImpl {
|
2012-04-23 21:25:53 +02:00
|
|
|
/* IUnknown fields */
|
2012-04-23 21:26:02 +02:00
|
|
|
IDirectMusicBuffer IDirectMusicBuffer_iface;
|
2012-04-23 21:25:53 +02:00
|
|
|
LONG ref;
|
|
|
|
|
|
|
|
/* IDirectMusicBufferImpl fields */
|
|
|
|
GUID format;
|
|
|
|
DWORD size;
|
|
|
|
LPBYTE data;
|
2012-04-26 08:08:34 +02:00
|
|
|
DWORD write_pos;
|
2012-04-26 08:08:51 +02:00
|
|
|
REFERENCE_TIME start_time;
|
2003-03-21 01:42:38 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
/*****************************************************************************
|
|
|
|
* IDirectMusicDownloadedInstrumentImpl implementation structure
|
|
|
|
*/
|
2004-01-20 01:21:40 +01:00
|
|
|
struct IDirectMusicDownloadedInstrumentImpl {
|
2012-12-24 09:46:10 +01:00
|
|
|
/* IUnknown fields */
|
|
|
|
IDirectMusicDownloadedInstrument IDirectMusicDownloadedInstrument_iface;
|
|
|
|
LONG ref;
|
2003-03-21 01:42:38 +01:00
|
|
|
|
2012-12-24 09:46:10 +01:00
|
|
|
/* IDirectMusicDownloadedInstrumentImpl fields */
|
2012-12-24 09:46:18 +01:00
|
|
|
BOOL downloaded;
|
|
|
|
void *data;
|
2003-03-21 01:42:38 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
/*****************************************************************************
|
|
|
|
* IDirectMusicDownloadImpl implementation structure
|
|
|
|
*/
|
2004-01-20 01:21:40 +01:00
|
|
|
struct IDirectMusicDownloadImpl {
|
2013-01-09 10:22:55 +01:00
|
|
|
/* IUnknown fields */
|
|
|
|
IDirectMusicDownload IDirectMusicDownload_iface;
|
|
|
|
LONG ref;
|
2003-03-21 01:42:38 +01:00
|
|
|
|
2013-01-09 10:22:55 +01:00
|
|
|
/* IDirectMusicDownloadImpl fields */
|
2003-03-21 01:42:38 +01:00
|
|
|
};
|
|
|
|
|
2005-11-29 10:43:18 +01:00
|
|
|
/** Internal factory */
|
2017-05-10 14:44:01 +02:00
|
|
|
extern HRESULT synth_port_create(IDirectMusic8Impl *parent, DMUS_PORTPARAMS *port_params,
|
|
|
|
DMUS_PORTCAPS *port_caps, IDirectMusicPort **port) DECLSPEC_HIDDEN;
|
|
|
|
extern HRESULT midi_out_port_create(IDirectMusic8Impl *parent, DMUS_PORTPARAMS *port_params,
|
|
|
|
DMUS_PORTCAPS *port_caps, IDirectMusicPort **port) DECLSPEC_HIDDEN;
|
|
|
|
extern HRESULT midi_in_port_create(IDirectMusic8Impl *parent, DMUS_PORTPARAMS *port_params,
|
|
|
|
DMUS_PORTCAPS *port_caps, IDirectMusicPort **port) DECLSPEC_HIDDEN;
|
2003-03-21 01:42:38 +01:00
|
|
|
|
2003-04-08 23:42:00 +02:00
|
|
|
/*****************************************************************************
|
2003-07-22 00:10:14 +02:00
|
|
|
* IReferenceClockImpl implementation structure
|
2003-04-08 23:42:00 +02:00
|
|
|
*/
|
2004-01-20 01:21:40 +01:00
|
|
|
struct IReferenceClockImpl {
|
2012-05-14 08:06:22 +02:00
|
|
|
/* IUnknown fields */
|
|
|
|
IReferenceClock IReferenceClock_iface;
|
|
|
|
LONG ref;
|
2003-04-08 23:42:00 +02:00
|
|
|
|
2012-05-14 08:06:22 +02:00
|
|
|
/* IReferenceClockImpl fields */
|
|
|
|
REFERENCE_TIME rtTime;
|
|
|
|
DMUS_CLOCKINFO pClockInfo;
|
2003-04-08 23:42:00 +02:00
|
|
|
};
|
|
|
|
|
2004-01-20 01:21:40 +01:00
|
|
|
typedef struct _DMUS_PRIVATE_INSTRUMENT_ENTRY {
|
|
|
|
struct list entry; /* for listing elements */
|
|
|
|
IDirectMusicInstrument* pInstrument;
|
|
|
|
} DMUS_PRIVATE_INSTRUMENTENTRY, *LPDMUS_PRIVATE_INSTRUMENTENTRY;
|
|
|
|
|
|
|
|
typedef struct _DMUS_PRIVATE_POOLCUE {
|
|
|
|
struct list entry; /* for listing elements */
|
|
|
|
} DMUS_PRIVATE_POOLCUE, *LPDMUS_PRIVATE_POOLCUE;
|
|
|
|
|
2003-08-23 01:53:27 +02:00
|
|
|
/*****************************************************************************
|
2004-01-20 01:21:40 +01:00
|
|
|
* IDirectMusicInstrumentImpl implementation structure
|
2003-08-23 01:53:27 +02:00
|
|
|
*/
|
2004-01-20 01:21:40 +01:00
|
|
|
struct IDirectMusicInstrumentImpl {
|
2012-12-21 10:27:38 +01:00
|
|
|
/* IUnknown fields */
|
|
|
|
IDirectMusicInstrument IDirectMusicInstrument_iface;
|
|
|
|
LONG ref;
|
2003-08-23 01:53:27 +02:00
|
|
|
|
2012-12-21 10:27:38 +01:00
|
|
|
/* IDirectMusicInstrumentImpl fields */
|
|
|
|
LARGE_INTEGER liInstrumentPosition; /* offset in a stream where instrument chunk can be found */
|
|
|
|
ULONG length; /* Length of the instrument in the stream */
|
2012-12-21 10:27:46 +01:00
|
|
|
GUID id;
|
|
|
|
INSTHEADER header;
|
2012-12-21 10:27:38 +01:00
|
|
|
WCHAR wszName[DMUS_MAX_NAME];
|
|
|
|
/* instrument data */
|
|
|
|
BOOL loaded;
|
|
|
|
instrument_region *regions;
|
2013-01-22 08:35:56 +01:00
|
|
|
ULONG nb_articulations;
|
|
|
|
instrument_articulation *articulations;
|
2003-08-23 01:53:27 +02:00
|
|
|
};
|
|
|
|
|
2012-05-04 20:51:30 +02:00
|
|
|
static inline IDirectMusicInstrumentImpl *impl_from_IDirectMusicInstrument(IDirectMusicInstrument *iface)
|
|
|
|
{
|
|
|
|
return CONTAINING_RECORD(iface, IDirectMusicInstrumentImpl, IDirectMusicInstrument_iface);
|
|
|
|
}
|
|
|
|
|
2004-01-20 01:21:40 +01:00
|
|
|
/* custom :) */
|
2012-12-19 09:58:03 +01:00
|
|
|
extern HRESULT IDirectMusicInstrumentImpl_CustomLoad(IDirectMusicInstrument *iface, IStream *stream) DECLSPEC_HIDDEN;
|
2003-08-23 01:53:27 +02:00
|
|
|
|
2005-01-26 20:41:43 +01:00
|
|
|
/**********************************************************************
|
|
|
|
* Dll lifetime tracking declaration for dmusic.dll
|
|
|
|
*/
|
2011-05-13 17:00:59 +02:00
|
|
|
extern LONG DMUSIC_refCount DECLSPEC_HIDDEN;
|
2005-06-20 16:18:03 +02:00
|
|
|
static inline void DMUSIC_LockModule(void) { InterlockedIncrement( &DMUSIC_refCount ); }
|
|
|
|
static inline void DMUSIC_UnlockModule(void) { InterlockedDecrement( &DMUSIC_refCount ); }
|
2003-08-23 01:53:27 +02:00
|
|
|
|
2004-01-20 01:21:40 +01:00
|
|
|
|
|
|
|
/*****************************************************************************
|
|
|
|
* Misc.
|
|
|
|
*/
|
2017-05-12 16:11:22 +02:00
|
|
|
void dmusic_remove_port(IDirectMusic8Impl *dmusic, IDirectMusicPort *port) DECLSPEC_HIDDEN;
|
|
|
|
|
2004-01-20 01:21:40 +01:00
|
|
|
/* for simpler reading */
|
|
|
|
typedef struct _DMUS_PRIVATE_CHUNK {
|
|
|
|
FOURCC fccID; /* FOURCC ID of the chunk */
|
|
|
|
DWORD dwSize; /* size of the chunk */
|
|
|
|
} DMUS_PRIVATE_CHUNK, *LPDMUS_PRIVATE_CHUNK;
|
|
|
|
|
2004-02-25 02:30:03 +01:00
|
|
|
/* used for generic dumping (copied from ddraw) */
|
|
|
|
typedef struct {
|
|
|
|
DWORD val;
|
|
|
|
const char* name;
|
|
|
|
} flag_info;
|
2004-01-20 01:21:40 +01:00
|
|
|
|
2004-02-25 02:30:03 +01:00
|
|
|
typedef struct {
|
|
|
|
const GUID *guid;
|
|
|
|
const char* name;
|
|
|
|
} guid_info;
|
2004-01-20 01:21:40 +01:00
|
|
|
|
2004-02-25 02:30:03 +01:00
|
|
|
#define FE(x) { x, #x }
|
|
|
|
#define GE(x) { &x, #x }
|
2004-01-20 01:21:40 +01:00
|
|
|
|
2004-02-25 02:30:03 +01:00
|
|
|
/* dwPatch from MIDILOCALE */
|
2011-05-13 17:00:59 +02:00
|
|
|
extern DWORD MIDILOCALE2Patch (const MIDILOCALE *pLocale) DECLSPEC_HIDDEN;
|
2004-02-25 02:30:03 +01:00
|
|
|
/* MIDILOCALE from dwPatch */
|
2011-05-13 17:00:59 +02:00
|
|
|
extern void Patch2MIDILOCALE (DWORD dwPatch, LPMIDILOCALE pLocale) DECLSPEC_HIDDEN;
|
2004-01-20 01:21:40 +01:00
|
|
|
|
2004-02-25 02:30:03 +01:00
|
|
|
/* check whether the given DWORD is even (return 0) or odd (return 1) */
|
2011-05-13 17:00:59 +02:00
|
|
|
extern int even_or_odd (DWORD number) DECLSPEC_HIDDEN;
|
2004-02-25 02:30:03 +01:00
|
|
|
/* FOURCC to string conversion for debug messages */
|
2011-05-13 17:00:59 +02:00
|
|
|
extern const char *debugstr_fourcc (DWORD fourcc) DECLSPEC_HIDDEN;
|
2004-02-25 02:30:03 +01:00
|
|
|
/* returns name of given GUID */
|
2011-05-13 17:00:59 +02:00
|
|
|
extern const char *debugstr_dmguid (const GUID *id) DECLSPEC_HIDDEN;
|
2012-04-10 22:30:21 +02:00
|
|
|
/* Dump whole DMUS_OBJECTDESC struct */
|
|
|
|
extern void dump_DMUS_OBJECTDESC(LPDMUS_OBJECTDESC desc) DECLSPEC_HIDDEN;
|
2012-04-10 22:30:29 +02:00
|
|
|
/* Dump whole DMUS_PORTPARAMS struct */
|
|
|
|
extern void dump_DMUS_PORTPARAMS(LPDMUS_PORTPARAMS params) DECLSPEC_HIDDEN;
|
2004-01-20 01:21:40 +01:00
|
|
|
|
2012-04-10 22:30:21 +02:00
|
|
|
#endif /* __WINE_DMUSIC_PRIVATE_H */
|