From: Huw Davies huw@codeweavers.com
Signed-off-by: Huw Davies huw@codeweavers.com Signed-off-by: Andrew Eikum aeikum@codeweavers.com --- dlls/wineoss.drv/midi.c | 34 +++++----------------------- dlls/wineoss.drv/midipatch.c | 4 ++++ dlls/wineoss.drv/oss.c | 1 + dlls/wineoss.drv/ossmidi.c | 43 ++++++++++++++++++++++++++++++++++++ dlls/wineoss.drv/unixlib.h | 9 ++++++++ 5 files changed, 63 insertions(+), 28 deletions(-)
diff --git a/dlls/wineoss.drv/midi.c b/dlls/wineoss.drv/midi.c index 58047380639..3d2552007cd 100644 --- a/dlls/wineoss.drv/midi.c +++ b/dlls/wineoss.drv/midi.c @@ -723,40 +723,18 @@ typedef struct sFMextra { */ } sFMextra;
-extern const unsigned char midiFMInstrumentPatches[16 * 128]; -extern const unsigned char midiFMDrumsPatches [16 * 128]; - /************************************************************************** * modFMLoad [internal] */ -static int modFMLoad(int dev, int fd) +static int modFMLoad(WORD dev, int fd) { - int i; - struct sbi_instrument sbi; + struct midi_out_fm_load_params params;
- sbi.device = dev; - sbi.key = FM_PATCH; + params.dev_id = dev; + params.fd = fd; + OSS_CALL(midi_out_fm_load, ¶ms);
- 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)); - 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) { - WARN("Couldn't write patch for drum %d, errno %d (%s)!\n", sbi.channel, errno, strerror(errno)); - return -1; - } - } - return 0; + return params.ret; }
/************************************************************************** diff --git a/dlls/wineoss.drv/midipatch.c b/dlls/wineoss.drv/midipatch.c index 41d8e07b99a..4ff48623260 100644 --- a/dlls/wineoss.drv/midipatch.c +++ b/dlls/wineoss.drv/midipatch.c @@ -24,6 +24,10 @@ * 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,
const unsigned char midiFMInstrumentPatches[128 * 16] = { diff --git a/dlls/wineoss.drv/oss.c b/dlls/wineoss.drv/oss.c index ac8847920b0..2fc6c81e560 100644 --- a/dlls/wineoss.drv/oss.c +++ b/dlls/wineoss.drv/oss.c @@ -1408,4 +1408,5 @@ unixlib_entry_t __wine_unix_call_funcs[] = midi_init,
midi_seq_open, + midi_out_fm_load, }; diff --git a/dlls/wineoss.drv/ossmidi.c b/dlls/wineoss.drv/ossmidi.c index a0a0b1caad2..ba5dbca7e4f 100644 --- a/dlls/wineoss.drv/ossmidi.c +++ b/dlls/wineoss.drv/ossmidi.c @@ -345,3 +345,46 @@ wrapup:
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; +} diff --git a/dlls/wineoss.drv/unixlib.h b/dlls/wineoss.drv/unixlib.h index 68d41e41f74..4dab53f5148 100644 --- a/dlls/wineoss.drv/unixlib.h +++ b/dlls/wineoss.drv/unixlib.h @@ -252,6 +252,13 @@ struct midi_seq_open_params int fd; };
+struct midi_out_fm_load_params +{ + WORD dev_id; + int fd; + int ret; +}; + enum oss_funcs { oss_test_connect, @@ -280,10 +287,12 @@ enum oss_funcs oss_midi_init,
oss_midi_seq_open, /* temporary */ + oss_midi_out_fm_load, };
NTSTATUS midi_init(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;
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=112951
Your paranoid android.
=== debian11 (build log) ===
/home/winetest/tools/testbot/var/wine-win32/../wine/dlls/wineoss.drv/ossmidi.c:364: undefined reference to `midiFMInstrumentPatches' /usr/bin/ld: /home/winetest/tools/testbot/var/wine-win32/../wine/dlls/wineoss.drv/ossmidi.c:364: undefined reference to `midiFMDrumsPatches' collect2: error: ld returned 1 exit status Task: The win32 Wine build failed
=== debian11 (build log) ===
/home/winetest/tools/testbot/var/wine-wow64/../wine/dlls/wineoss.drv/ossmidi.c:361: undefined reference to `midiFMInstrumentPatches' /usr/bin/ld: /home/winetest/tools/testbot/var/wine-wow64/../wine/dlls/wineoss.drv/ossmidi.c:371: undefined reference to `midiFMDrumsPatches' collect2: error: ld returned 1 exit status Task: The wow64 Wine build failed