mirror of
git://source.winehq.org/git/wine.git
synced 2024-10-01 18:58:29 +00:00
winealsa.drv: Allocate the MIDI device array dynamically.
This commit is contained in:
parent
818385e176
commit
533823ed2a
|
@ -80,8 +80,8 @@ static pthread_mutex_t seq_mutex = PTHREAD_MUTEX_INITIALIZER;
|
||||||
static pthread_mutex_t in_buffer_mutex = PTHREAD_MUTEX_INITIALIZER;
|
static pthread_mutex_t in_buffer_mutex = PTHREAD_MUTEX_INITIALIZER;
|
||||||
|
|
||||||
static unsigned int num_dests, num_srcs;
|
static unsigned int num_dests, num_srcs;
|
||||||
static struct midi_dest dests[MAX_MIDIOUTDRV];
|
static struct midi_dest *dests;
|
||||||
static struct midi_src srcs[MAX_MIDIINDRV];
|
static struct midi_src *srcs;
|
||||||
static snd_seq_t *midi_seq;
|
static snd_seq_t *midi_seq;
|
||||||
static unsigned int seq_refs;
|
static unsigned int seq_refs;
|
||||||
static int port_in = -1;
|
static int port_in = -1;
|
||||||
|
@ -298,12 +298,12 @@ static void port_add(snd_seq_client_info_t* cinfo, snd_seq_port_info_t* pinfo, u
|
||||||
snd_seq_port_info_get_name(pinfo),
|
snd_seq_port_info_get_name(pinfo),
|
||||||
type);
|
type);
|
||||||
|
|
||||||
if (num_dests >= MAX_MIDIOUTDRV)
|
|
||||||
return;
|
|
||||||
if (!type)
|
if (!type)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
dests = realloc( dests, (num_dests + 1) * sizeof(*dests) );
|
||||||
dest = dests + num_dests;
|
dest = dests + num_dests;
|
||||||
|
memset( dest, 0, sizeof(*dest) );
|
||||||
dest->addr = *snd_seq_port_info_get_addr(pinfo);
|
dest->addr = *snd_seq_port_info_get_addr(pinfo);
|
||||||
|
|
||||||
/* Manufac ID. We do not have access to this with soundcard.h
|
/* Manufac ID. We do not have access to this with soundcard.h
|
||||||
|
@ -373,12 +373,12 @@ static void port_add(snd_seq_client_info_t* cinfo, snd_seq_port_info_t* pinfo, u
|
||||||
snd_seq_port_info_get_name(pinfo),
|
snd_seq_port_info_get_name(pinfo),
|
||||||
type);
|
type);
|
||||||
|
|
||||||
if (num_srcs >= MAX_MIDIINDRV)
|
|
||||||
return;
|
|
||||||
if (!type)
|
if (!type)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
srcs = realloc( srcs, (num_srcs + 1) * sizeof(*srcs) );
|
||||||
src = srcs + num_srcs;
|
src = srcs + num_srcs;
|
||||||
|
memset( src, 0, sizeof(*src) );
|
||||||
src->addr = *snd_seq_port_info_get_addr(pinfo);
|
src->addr = *snd_seq_port_info_get_addr(pinfo);
|
||||||
|
|
||||||
/* Manufac ID. We do not have access to this with soundcard.h
|
/* Manufac ID. We do not have access to this with soundcard.h
|
||||||
|
@ -505,11 +505,7 @@ static UINT midi_out_open(WORD dev_id, MIDIOPENDESC *midi_desc, UINT flags, stru
|
||||||
WARN("Invalid Parameter !\n");
|
WARN("Invalid Parameter !\n");
|
||||||
return MMSYSERR_INVALPARAM;
|
return MMSYSERR_INVALPARAM;
|
||||||
}
|
}
|
||||||
if (dev_id >= num_dests)
|
if (dev_id >= num_dests) return MMSYSERR_BADDEVICEID;
|
||||||
{
|
|
||||||
TRACE("MAX_MIDIOUTDRV reached !\n");
|
|
||||||
return MMSYSERR_BADDEVICEID;
|
|
||||||
}
|
|
||||||
dest = dests + dev_id;
|
dest = dests + dev_id;
|
||||||
if (dest->midiDesc.hMidi != 0)
|
if (dest->midiDesc.hMidi != 0)
|
||||||
{
|
{
|
||||||
|
|
|
@ -30,14 +30,6 @@
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define MAX_MIDIINDRV (16)
|
|
||||||
/* For now I'm making 16 the maximum number of midi devices one can
|
|
||||||
* have. This should be more than enough for everybody. But as a purist,
|
|
||||||
* I intend to make it unbounded in the future, as soon as I figure
|
|
||||||
* a good way to do so.
|
|
||||||
*/
|
|
||||||
#define MAX_MIDIOUTDRV (16)
|
|
||||||
|
|
||||||
/* ==================================
|
/* ==================================
|
||||||
* Multimedia DDK compatible part
|
* Multimedia DDK compatible part
|
||||||
* ================================== */
|
* ================================== */
|
||||||
|
|
Loading…
Reference in a new issue