Commit bbe19f20 authored by Huw Davies's avatar Huw Davies Committed by Alexandre Julliard

wineoss: Add a temporary midi_out_fm_patch syscall.

parent e37bf4e9
...@@ -723,40 +723,18 @@ typedef struct sFMextra { ...@@ -723,40 +723,18 @@ typedef struct sFMextra {
*/ */
} sFMextra; } sFMextra;
extern const unsigned char midiFMInstrumentPatches[16 * 128];
extern const unsigned char midiFMDrumsPatches [16 * 128];
/************************************************************************** /**************************************************************************
* modFMLoad [internal] * modFMLoad [internal]
*/ */
static int modFMLoad(int dev, int fd) static int modFMLoad(WORD dev, int fd)
{ {
int i; struct midi_out_fm_load_params params;
struct sbi_instrument sbi;
sbi.device = dev;
sbi.key = FM_PATCH;
memset(sbi.operators + 16, 0, 16); params.dev_id = dev;
for (i = 0; i < 128; i++) { params.fd = fd;
sbi.channel = i; OSS_CALL(midi_out_fm_load, &params);
memcpy(sbi.operators, midiFMInstrumentPatches + i * 16, 16);
if (write(fd, &sbi, sizeof(sbi)) == -1) {
WARN("Couldn't write patch for instrument %d, errno %d (%s)!\n", sbi.channel, errno, strerror(errno));
return -1;
}
}
for (i = 0; i < 128; i++) {
sbi.channel = 128 + i;
memcpy(sbi.operators, midiFMDrumsPatches + i * 16, 16);
if (write(fd, &sbi, sizeof(sbi)) == -1) { return params.ret;
WARN("Couldn't write patch for drum %d, errno %d (%s)!\n", sbi.channel, errno, strerror(errno));
return -1;
}
}
return 0;
} }
/************************************************************************** /**************************************************************************
......
...@@ -24,6 +24,10 @@ ...@@ -24,6 +24,10 @@
* Eric POUECH : MIDI FM patches for GM instruments * Eric POUECH : MIDI FM patches for GM instruments
*/ */
#if 0
#pragma makedep unix
#endif
#define NOT_DEFINED 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, #define NOT_DEFINED 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
const unsigned char midiFMInstrumentPatches[128 * 16] = { const unsigned char midiFMInstrumentPatches[128 * 16] = {
......
...@@ -1408,4 +1408,5 @@ unixlib_entry_t __wine_unix_call_funcs[] = ...@@ -1408,4 +1408,5 @@ unixlib_entry_t __wine_unix_call_funcs[] =
midi_init, midi_init,
midi_seq_open, midi_seq_open,
midi_out_fm_load,
}; };
...@@ -345,3 +345,46 @@ wrapup: ...@@ -345,3 +345,46 @@ wrapup:
return STATUS_SUCCESS; return STATUS_SUCCESS;
} }
extern const unsigned char midiFMInstrumentPatches[16 * 128];
extern const unsigned char midiFMDrumsPatches[16 * 128];
NTSTATUS midi_out_fm_load(void *args)
{
struct midi_out_fm_load_params *params = args;
WORD dev_id = params->dev_id;
int fd = params->fd;
struct sbi_instrument sbi;
int i;
sbi.device = dev_id;
sbi.key = FM_PATCH;
memset(sbi.operators + 16, 0, 16);
for (i = 0; i < 128; i++)
{
sbi.channel = i;
memcpy(sbi.operators, midiFMInstrumentPatches + i * 16, 16);
if (write(fd, &sbi, sizeof(sbi)) == -1)
{
WARN("Couldn't write patch for instrument %d, errno %d (%s)!\n", sbi.channel, errno, strerror(errno));
params->ret = -1;
return STATUS_SUCCESS;
}
}
for (i = 0; i < 128; i++)
{
sbi.channel = 128 + i;
memcpy(sbi.operators, midiFMDrumsPatches + i * 16, 16);
if (write(fd, &sbi, sizeof(sbi)) == -1)
{
WARN("Couldn't write patch for drum %d, errno %d (%s)!\n", sbi.channel, errno, strerror(errno));
params->ret = -1;
return STATUS_SUCCESS;
}
}
params->ret = 0;
return STATUS_SUCCESS;
}
...@@ -252,6 +252,13 @@ struct midi_seq_open_params ...@@ -252,6 +252,13 @@ struct midi_seq_open_params
int fd; int fd;
}; };
struct midi_out_fm_load_params
{
WORD dev_id;
int fd;
int ret;
};
enum oss_funcs enum oss_funcs
{ {
oss_test_connect, oss_test_connect,
...@@ -280,10 +287,12 @@ enum oss_funcs ...@@ -280,10 +287,12 @@ enum oss_funcs
oss_midi_init, oss_midi_init,
oss_midi_seq_open, /* temporary */ oss_midi_seq_open, /* temporary */
oss_midi_out_fm_load,
}; };
NTSTATUS midi_init(void *args) DECLSPEC_HIDDEN; NTSTATUS midi_init(void *args) DECLSPEC_HIDDEN;
NTSTATUS midi_seq_open(void *args) DECLSPEC_HIDDEN; NTSTATUS midi_seq_open(void *args) DECLSPEC_HIDDEN;
NTSTATUS midi_out_fm_load(void *args) DECLSPEC_HIDDEN;
extern unixlib_handle_t oss_handle; extern unixlib_handle_t oss_handle;
......
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