winehq.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2025
February
January
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
January
2003
December
November
October
September
August
July
June
May
April
March
February
January
2002
December
November
October
September
August
July
June
May
April
March
February
January
2001
December
November
October
September
August
July
June
May
April
March
February
List overview
wine-commits
November 2021
----- 2025 -----
February 2025
January 2025
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
January 2004
----- 2003 -----
December 2003
November 2003
October 2003
September 2003
August 2003
July 2003
June 2003
May 2003
April 2003
March 2003
February 2003
January 2003
----- 2002 -----
December 2002
November 2002
October 2002
September 2002
August 2002
July 2002
June 2002
May 2002
April 2002
March 2002
February 2002
January 2002
----- 2001 -----
December 2001
November 2001
October 2001
September 2001
August 2001
July 2001
June 2001
May 2001
April 2001
March 2001
February 2001
wine-commits@winehq.org
2 participants
951 discussions
Start a n
N
ew thread
Huw Davies : winecoreaudio: Move midi_out_prepare and midi_out_unprepare to the unixlib.
by Alexandre Julliard
26 Nov '21
26 Nov '21
Module: wine Branch: master Commit: 15e30a492e4e51587e4e908dd6b8680221410188 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=15e30a492e4e51587e4e908d…
Author: Huw Davies <huw(a)codeweavers.com> Date: Thu Nov 25 11:03:43 2021 +0000 winecoreaudio: Move midi_out_prepare and midi_out_unprepare to the unixlib. While these could be left on the user-side, it seems simplest to move everything across. Signed-off-by: Huw Davies <huw(a)codeweavers.com> Signed-off-by: Andrew Eikum <aeikum(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/winecoreaudio.drv/coremidi.c | 36 +++++++++++++++++++++++++++++++++++ dlls/winecoreaudio.drv/midi.c | 40 --------------------------------------- 2 files changed, 36 insertions(+), 40 deletions(-) diff --git a/dlls/winecoreaudio.drv/coremidi.c b/dlls/winecoreaudio.drv/coremidi.c index d80b8c1711b..3a560c21d74 100644 --- a/dlls/winecoreaudio.drv/coremidi.c +++ b/dlls/winecoreaudio.drv/coremidi.c @@ -565,6 +565,36 @@ static DWORD midi_out_long_data(WORD dev_id, MIDIHDR *hdr, DWORD hdr_size, struc return MMSYSERR_NOERROR; } +static DWORD midi_out_prepare(WORD dev_id, MIDIHDR *hdr, DWORD hdr_size) +{ + TRACE("dev_id = %d midi_hdr = %p hdr_size = %d\n", dev_id, hdr, hdr_size); + + if (hdr_size < offsetof(MIDIHDR, dwOffset) || !hdr || !hdr->lpData) + return MMSYSERR_INVALPARAM; + if (hdr->dwFlags & MHDR_PREPARED) + return MMSYSERR_NOERROR; + + hdr->lpNext = 0; + hdr->dwFlags |= MHDR_PREPARED; + hdr->dwFlags &= ~(MHDR_DONE | MHDR_INQUEUE); + return MMSYSERR_NOERROR; +} + +static DWORD midi_out_unprepare(WORD dev_id, MIDIHDR *hdr, DWORD hdr_size) +{ + TRACE("dev_id = %d midi_hdr = %p hdr_size = %d\n", dev_id, hdr, hdr_size); + + if (hdr_size < offsetof(MIDIHDR, dwOffset) || !hdr || !hdr->lpData) + return MMSYSERR_INVALPARAM; + if (!(hdr->dwFlags & MHDR_PREPARED)) + return MMSYSERR_NOERROR; + if (hdr->dwFlags & MHDR_INQUEUE) + return MIDIERR_STILLPLAYING; + + hdr->dwFlags &= ~MHDR_PREPARED; + return MMSYSERR_NOERROR; +} + NTSTATUS midi_out_message(void *args) { struct midi_out_message_params *params = args; @@ -591,6 +621,12 @@ NTSTATUS midi_out_message(void *args) case MODM_LONGDATA: *params->err = midi_out_long_data(params->dev_id, (MIDIHDR *)params->param_1, params->param_2, params->notify); break; + case MODM_PREPARE: + *params->err = midi_out_prepare(params->dev_id, (MIDIHDR *)params->param_1, params->param_2); + break; + case MODM_UNPREPARE: + *params->err = midi_out_unprepare(params->dev_id, (MIDIHDR *)params->param_1, params->param_2); + break; default: TRACE("Unsupported message\n"); *params->err = MMSYSERR_NOTSUPPORTED; diff --git a/dlls/winecoreaudio.drv/midi.c b/dlls/winecoreaudio.drv/midi.c index 589a08e0907..71bd7afebdf 100644 --- a/dlls/winecoreaudio.drv/midi.c +++ b/dlls/winecoreaudio.drv/midi.c @@ -155,42 +155,6 @@ static void MIDI_NotifyClient(UINT wDevID, WORD wMsg, DWORD_PTR dwParam1, DWORD_ DriverCallback(dwCallBack, uFlags, hDev, wMsg, dwInstance, dwParam1, dwParam2); } -/************************************************************************** - * MIDIOut_Prepare [internal] - */ -static DWORD MIDIOut_Prepare(WORD wDevID, LPMIDIHDR lpMidiHdr, DWORD dwSize) -{ - TRACE("wDevID=%d lpMidiHdr=%p dwSize=%d\n", wDevID, lpMidiHdr, dwSize); - - if (dwSize < offsetof(MIDIHDR,dwOffset) || lpMidiHdr == 0 || lpMidiHdr->lpData == 0) - return MMSYSERR_INVALPARAM; - if (lpMidiHdr->dwFlags & MHDR_PREPARED) - return MMSYSERR_NOERROR; - - lpMidiHdr->lpNext = 0; - lpMidiHdr->dwFlags |= MHDR_PREPARED; - lpMidiHdr->dwFlags &= ~(MHDR_DONE|MHDR_INQUEUE); /* flags cleared since w2k */ - return MMSYSERR_NOERROR; -} - -/************************************************************************** - * MIDIOut_Unprepare [internal] - */ -static DWORD MIDIOut_Unprepare(WORD wDevID, LPMIDIHDR lpMidiHdr, DWORD dwSize) -{ - TRACE("wDevID=%d lpMidiHdr=%p dwSize=%d\n", wDevID, lpMidiHdr, dwSize); - - if (dwSize < offsetof(MIDIHDR,dwOffset) || lpMidiHdr == 0 || lpMidiHdr->lpData == 0) - return MMSYSERR_INVALPARAM; - if (!(lpMidiHdr->dwFlags & MHDR_PREPARED)) - return MMSYSERR_NOERROR; - if (lpMidiHdr->dwFlags & MHDR_INQUEUE) - return MIDIERR_STILLPLAYING; - - lpMidiHdr->dwFlags &= ~MHDR_PREPARED; - return MMSYSERR_NOERROR; -} - static DWORD MIDIOut_GetDevCaps(WORD wDevID, LPMIDIOUTCAPSW lpCaps, DWORD dwSize) { TRACE("wDevID=%d lpCaps=%p dwSize=%d\n", wDevID, lpCaps, dwSize); @@ -642,10 +606,6 @@ DWORD WINAPI CoreAudio_modMessage(UINT wDevID, UINT wMsg, DWORD_PTR dwUser, DWOR TRACE("%d %08x %08lx %08lx %08lx\n", wDevID, wMsg, dwUser, dwParam1, dwParam2); switch (wMsg) { - case MODM_PREPARE: - return MIDIOut_Prepare(wDevID, (LPMIDIHDR)dwParam1, dwParam2); - case MODM_UNPREPARE: - return MIDIOut_Unprepare(wDevID, (LPMIDIHDR)dwParam1, dwParam2); case MODM_GETDEVCAPS: return MIDIOut_GetDevCaps(wDevID, (LPMIDIOUTCAPSW) dwParam1, dwParam2); case MODM_GETNUMDEVS:
1
0
0
0
Huw Davies : winecoreaudio: Move midi_out_long_data to the unixlib.
by Alexandre Julliard
26 Nov '21
26 Nov '21
Module: wine Branch: master Commit: 47c698fc14d6df4a032344209e97bc85240b952c URL:
https://source.winehq.org/git/wine.git/?a=commit;h=47c698fc14d6df4a03234420…
Author: Huw Davies <huw(a)codeweavers.com> Date: Thu Nov 25 11:03:42 2021 +0000 winecoreaudio: Move midi_out_long_data to the unixlib. Signed-off-by: Huw Davies <huw(a)codeweavers.com> Signed-off-by: Andrew Eikum <aeikum(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/winecoreaudio.drv/audiounit.c | 12 ------ dlls/winecoreaudio.drv/coremidi.c | 59 ++++++++++++++++++++++++++ dlls/winecoreaudio.drv/coremidi.h | 7 ---- dlls/winecoreaudio.drv/midi.c | 85 -------------------------------------- 4 files changed, 59 insertions(+), 104 deletions(-) diff --git a/dlls/winecoreaudio.drv/audiounit.c b/dlls/winecoreaudio.drv/audiounit.c index d3c53926c59..137b1e93bcf 100644 --- a/dlls/winecoreaudio.drv/audiounit.c +++ b/dlls/winecoreaudio.drv/audiounit.c @@ -83,15 +83,3 @@ int AudioUnit_GetVolume(AudioUnit au, float *left, float *right) *right = *left; return 1; } - -void MIDIOut_Send(MIDIPortRef port, MIDIEndpointRef dest, UInt8 *buffer, unsigned length) -{ - Byte packetBuff[512]; - MIDIPacketList *packetList = (MIDIPacketList *)packetBuff; - - MIDIPacket *packet = MIDIPacketListInit(packetList); - - packet = MIDIPacketListAdd(packetList, sizeof(packetBuff), packet, mach_absolute_time(), length, buffer); - if (packet) - MIDISend(port, dest, packetList); -} diff --git a/dlls/winecoreaudio.drv/coremidi.c b/dlls/winecoreaudio.drv/coremidi.c index 4dc4166dda1..d80b8c1711b 100644 --- a/dlls/winecoreaudio.drv/coremidi.c +++ b/dlls/winecoreaudio.drv/coremidi.c @@ -509,6 +509,62 @@ static DWORD midi_out_data(WORD dev_id, DWORD data) return MMSYSERR_NOERROR; } +static DWORD midi_out_long_data(WORD dev_id, MIDIHDR *hdr, DWORD hdr_size, struct notify_context *notify) +{ + struct midi_dest *dest; + OSStatus sc; + + TRACE("dev_id = %d midi_hdr = %p hdr_size = %d\n", dev_id, hdr, hdr_size); + + if (dev_id >= num_dests) + { + WARN("bad device ID : %d\n", dev_id); + return MMSYSERR_BADDEVICEID; + } + if (!hdr) + { + WARN("Invalid Parameter\n"); + return MMSYSERR_INVALPARAM; + } + if (!hdr->lpData || !(hdr->dwFlags & MHDR_PREPARED)) + return MIDIERR_UNPREPARED; + + if (hdr->dwFlags & MHDR_INQUEUE) + return MIDIERR_STILLPLAYING; + + hdr->dwFlags &= ~MHDR_DONE; + hdr->dwFlags |= MHDR_INQUEUE; + + if ((UInt8)hdr->lpData[0] != 0xf0) + /* System Exclusive */ + ERR("Add missing 0xf0 marker at the beginning of system exclusive byte stream\n"); + + if ((UInt8)hdr->lpData[hdr->dwBufferLength - 1] != 0xF7) + /* Send end of System Exclusive */ + ERR("Add missing 0xf7 marker at the end of system exclusive byte stream\n"); + + dest = dests + dev_id; + + if (dest->caps.wTechnology == MOD_SYNTH) /* FIXME */ + { + sc = MusicDeviceSysEx(dest->synth, (const UInt8 *)hdr->lpData, hdr->dwBufferLength); + if (sc != noErr) + { + ERR("MusicDeviceSysEx returns %s\n", wine_dbgstr_fourcc(sc)); + return MMSYSERR_ERROR; + } + } + else if (dest->caps.wTechnology == MOD_MIDIPORT) + midi_send(midi_out_port, dest->dest, (UInt8 *)hdr->lpData, hdr->dwBufferLength); + + hdr->dwFlags &= ~MHDR_INQUEUE; + hdr->dwFlags |= MHDR_DONE; + + set_out_notify(notify, dest, dev_id, MOM_DONE, (DWORD_PTR)hdr, 0); + + return MMSYSERR_NOERROR; +} + NTSTATUS midi_out_message(void *args) { struct midi_out_message_params *params = args; @@ -532,6 +588,9 @@ NTSTATUS midi_out_message(void *args) case MODM_DATA: *params->err = midi_out_data(params->dev_id, params->param_1); break; + case MODM_LONGDATA: + *params->err = midi_out_long_data(params->dev_id, (MIDIHDR *)params->param_1, params->param_2, params->notify); + break; default: TRACE("Unsupported message\n"); *params->err = MMSYSERR_NOTSUPPORTED; diff --git a/dlls/winecoreaudio.drv/coremidi.h b/dlls/winecoreaudio.drv/coremidi.h index ca669db7db1..f764bad45aa 100644 --- a/dlls/winecoreaudio.drv/coremidi.h +++ b/dlls/winecoreaudio.drv/coremidi.h @@ -67,13 +67,6 @@ extern int AudioUnit_SetVolume(AudioUnit au, float left, float right); extern int AudioUnit_GetVolume(AudioUnit au, float *left, float *right); #endif -/* coremidi.c */ -extern MIDIClientRef CoreMIDI_CreateClient(CFStringRef name); -extern void CoreMIDI_GetObjectName(MIDIObjectRef obj, char *name, int size); -extern void MIDIIn_ReadProc(const MIDIPacketList *pktlist, void *refCon, void *connRefCon); - -extern void MIDIOut_Send(MIDIPortRef port, MIDIEndpointRef dest, UInt8 *buffer, unsigned length); - /* midi.c */ typedef struct midi_dest { diff --git a/dlls/winecoreaudio.drv/midi.c b/dlls/winecoreaudio.drv/midi.c index 98b0a17a147..589a08e0907 100644 --- a/dlls/winecoreaudio.drv/midi.c +++ b/dlls/winecoreaudio.drv/midi.c @@ -135,14 +135,6 @@ static void MIDI_NotifyClient(UINT wDevID, WORD wMsg, DWORD_PTR dwParam1, DWORD_ TRACE("wDevID=%d wMsg=%d dwParm1=%04lX dwParam2=%04lX\n", wDevID, wMsg, dwParam1, dwParam2); switch (wMsg) { - case MOM_DONE: - case MOM_POSITIONCB: - dwCallBack = destinations[wDevID].midiDesc.dwCallback; - uFlags = destinations[wDevID].wFlags; - hDev = destinations[wDevID].midiDesc.hMidi; - dwInstance = destinations[wDevID].midiDesc.dwInstance; - break; - case MIM_OPEN: case MIM_CLOSE: case MIM_DATA: @@ -163,81 +155,6 @@ static void MIDI_NotifyClient(UINT wDevID, WORD wMsg, DWORD_PTR dwParam1, DWORD_ DriverCallback(dwCallBack, uFlags, hDev, wMsg, dwInstance, dwParam1, dwParam2); } -static DWORD MIDIOut_LongData(WORD wDevID, LPMIDIHDR lpMidiHdr, DWORD dwSize) -{ - LPBYTE lpData; - OSStatus err = noErr; - - TRACE("wDevID=%d lpMidiHdr=%p dwSize=%d\n", wDevID, lpMidiHdr, dwSize); - - /* Note: MS doc does not say much about the dwBytesRecorded member of the MIDIHDR structure - * but it seems to be used only for midi input. - * Taking a look at the WAVEHDR structure (which is quite similar) confirms this assumption. - */ - - if (wDevID >= MIDIOut_NumDevs) { - WARN("bad device ID : %d\n", wDevID); - return MMSYSERR_BADDEVICEID; - } - - if (lpMidiHdr == NULL) { - WARN("Invalid Parameter\n"); - return MMSYSERR_INVALPARAM; - } - - lpData = (LPBYTE) lpMidiHdr->lpData; - - if (lpData == NULL) - return MIDIERR_UNPREPARED; - if (!(lpMidiHdr->dwFlags & MHDR_PREPARED)) - return MIDIERR_UNPREPARED; - if (lpMidiHdr->dwFlags & MHDR_INQUEUE) - return MIDIERR_STILLPLAYING; - lpMidiHdr->dwFlags &= ~MHDR_DONE; - lpMidiHdr->dwFlags |= MHDR_INQUEUE; - - /* FIXME: MS doc is not 100% clear. Will lpData only contain system exclusive - * data, or can it also contain raw MIDI data, to be split up and sent to - * modShortData() ? - * If the latter is true, then the following WARNing will fire up - */ - if (lpData[0] != 0xF0 || lpData[lpMidiHdr->dwBufferLength - 1] != 0xF7) { - WARN("The allegedly system exclusive buffer is not correct\n\tPlease report with MIDI file\n"); - } - - TRACE("dwBufferLength=%u !\n", lpMidiHdr->dwBufferLength); - TRACE(" %02X %02X %02X ... %02X %02X %02X\n", - lpData[0], lpData[1], lpData[2], lpData[lpMidiHdr->dwBufferLength-3], - lpData[lpMidiHdr->dwBufferLength-2], lpData[lpMidiHdr->dwBufferLength-1]); - - - if (lpData[0] != 0xF0) { - /* System Exclusive */ - ERR("Add missing 0xF0 marker at the beginning of system exclusive byte stream\n"); - } - if (lpData[lpMidiHdr->dwBufferLength - 1] != 0xF7) { - /* Send end of System Exclusive */ - ERR("Add missing 0xF7 marker at the end of system exclusive byte stream\n"); - } - if (destinations[wDevID].caps.wTechnology == MOD_SYNTH) /* FIXME */ - { - err = MusicDeviceSysEx(destinations[wDevID].synth, (const UInt8 *) lpData, lpMidiHdr->dwBufferLength); - if (err != noErr) - { - ERR("MusicDeviceSysEx(%p, %p, %d) return %s\n", destinations[wDevID].synth, lpData, lpMidiHdr->dwBufferLength, wine_dbgstr_fourcc(err)); - return MMSYSERR_ERROR; - } - } - else if (destinations[wDevID].caps.wTechnology == MOD_MIDIPORT) { - MIDIOut_Send(MIDIOutPort, destinations[wDevID].dest, lpData, lpMidiHdr->dwBufferLength); - } - - lpMidiHdr->dwFlags &= ~MHDR_INQUEUE; - lpMidiHdr->dwFlags |= MHDR_DONE; - MIDI_NotifyClient(wDevID, MOM_DONE, (DWORD_PTR)lpMidiHdr, 0L); - return MMSYSERR_NOERROR; -} - /************************************************************************** * MIDIOut_Prepare [internal] */ @@ -725,8 +642,6 @@ DWORD WINAPI CoreAudio_modMessage(UINT wDevID, UINT wMsg, DWORD_PTR dwUser, DWOR TRACE("%d %08x %08lx %08lx %08lx\n", wDevID, wMsg, dwUser, dwParam1, dwParam2); switch (wMsg) { - case MODM_LONGDATA: - return MIDIOut_LongData(wDevID, (LPMIDIHDR)dwParam1, dwParam2); case MODM_PREPARE: return MIDIOut_Prepare(wDevID, (LPMIDIHDR)dwParam1, dwParam2); case MODM_UNPREPARE:
1
0
0
0
Huw Davies : winecoreaudio: Move midi_out_data to the unixlib.
by Alexandre Julliard
26 Nov '21
26 Nov '21
Module: wine Branch: master Commit: 1a1ef23079151840e1a44ad5fe7ba563cf2ab971 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=1a1ef23079151840e1a44ad5…
Author: Huw Davies <huw(a)codeweavers.com> Date: Thu Nov 25 11:03:41 2021 +0000 winecoreaudio: Move midi_out_data to the unixlib. Signed-off-by: Huw Davies <huw(a)codeweavers.com> Signed-off-by: Andrew Eikum <aeikum(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/winecoreaudio.drv/coremidi.c | 49 +++++++++++++++++++++++++++++++++++++++ dlls/winecoreaudio.drv/midi.c | 40 -------------------------------- 2 files changed, 49 insertions(+), 40 deletions(-) diff --git a/dlls/winecoreaudio.drv/coremidi.c b/dlls/winecoreaudio.drv/coremidi.c index 6fddbd7d88a..4dc4166dda1 100644 --- a/dlls/winecoreaudio.drv/coremidi.c +++ b/dlls/winecoreaudio.drv/coremidi.c @@ -463,6 +463,52 @@ static DWORD midi_out_close(WORD dev_id, struct notify_context *notify) return MMSYSERR_NOERROR; } +static void midi_send(MIDIPortRef port, MIDIEndpointRef dest, UInt8 *buffer, unsigned len) +{ + Byte packet_buf[512]; + MIDIPacketList *packet_list = (MIDIPacketList *)packet_buf; + MIDIPacket *packet = MIDIPacketListInit(packet_list); + + packet = MIDIPacketListAdd(packet_list, sizeof(packet_buf), packet, mach_absolute_time(), len, buffer); + if (packet) MIDISend(port, dest, packet_list); +} + +static DWORD midi_out_data(WORD dev_id, DWORD data) +{ + struct midi_dest *dest; + UInt8 bytes[3]; + OSStatus sc; + + TRACE("dev_id = %d data = %08x\n", dev_id, data); + + if (dev_id >= num_dests) + { + WARN("bad device ID : %d\n", dev_id); + return MMSYSERR_BADDEVICEID; + } + + bytes[0] = data & 0xff; + bytes[1] = (data >> 8) & 0xff; + bytes[2] = (data >> 16) & 0xff; + + dest = dests + dev_id; + if (dest->caps.wTechnology == MOD_SYNTH) + { + sc = MusicDeviceMIDIEvent(dest->synth, bytes[0], bytes[1], bytes[2], 0); + if (sc != noErr) + { + ERR("MusicDeviceMIDIEvent returns %s\n", wine_dbgstr_fourcc(sc)); + return MMSYSERR_ERROR; + } + } + else + { + midi_send(midi_out_port, dest->dest, bytes, sizeof(bytes)); + } + + return MMSYSERR_NOERROR; +} + NTSTATUS midi_out_message(void *args) { struct midi_out_message_params *params = args; @@ -483,6 +529,9 @@ NTSTATUS midi_out_message(void *args) case MODM_CLOSE: *params->err = midi_out_close(params->dev_id, params->notify); break; + case MODM_DATA: + *params->err = midi_out_data(params->dev_id, params->param_1); + break; default: TRACE("Unsupported message\n"); *params->err = MMSYSERR_NOTSUPPORTED; diff --git a/dlls/winecoreaudio.drv/midi.c b/dlls/winecoreaudio.drv/midi.c index e2418645968..98b0a17a147 100644 --- a/dlls/winecoreaudio.drv/midi.c +++ b/dlls/winecoreaudio.drv/midi.c @@ -163,44 +163,6 @@ static void MIDI_NotifyClient(UINT wDevID, WORD wMsg, DWORD_PTR dwParam1, DWORD_ DriverCallback(dwCallBack, uFlags, hDev, wMsg, dwInstance, dwParam1, dwParam2); } -static DWORD MIDIOut_Data(WORD wDevID, DWORD dwParam) -{ - WORD evt = LOBYTE(LOWORD(dwParam)); - UInt8 chn = (evt & 0x0F); - - TRACE("wDevID=%d dwParam=%08X\n", wDevID, dwParam); - - if (wDevID >= MIDIOut_NumDevs) { - WARN("bad device ID : %d\n", wDevID); - return MMSYSERR_BADDEVICEID; - } - - if (destinations[wDevID].caps.wTechnology == MOD_SYNTH) - { - WORD d1 = HIBYTE(LOWORD(dwParam)); - WORD d2 = LOBYTE(HIWORD(dwParam)); - OSStatus err = noErr; - - err = MusicDeviceMIDIEvent(destinations[wDevID].synth, (evt & 0xF0) | chn, d1, d2, 0); - if (err != noErr) - { - ERR("MusicDeviceMIDIEvent(%p, %04x, %04x, %04x, %d) return %s\n", destinations[wDevID].synth, (evt & 0xF0) | chn, d1, d2, 0, wine_dbgstr_fourcc(err)); - return MMSYSERR_ERROR; - } - } - else - { - UInt8 buffer[3]; - buffer[0] = (evt & 0xF0) | chn; - buffer[1] = HIBYTE(LOWORD(dwParam)); - buffer[2] = LOBYTE(HIWORD(dwParam)); - - MIDIOut_Send(MIDIOutPort, destinations[wDevID].dest, buffer, 3); - } - - return MMSYSERR_NOERROR; -} - static DWORD MIDIOut_LongData(WORD wDevID, LPMIDIHDR lpMidiHdr, DWORD dwSize) { LPBYTE lpData; @@ -763,8 +725,6 @@ DWORD WINAPI CoreAudio_modMessage(UINT wDevID, UINT wMsg, DWORD_PTR dwUser, DWOR TRACE("%d %08x %08lx %08lx %08lx\n", wDevID, wMsg, dwUser, dwParam1, dwParam2); switch (wMsg) { - case MODM_DATA: - return MIDIOut_Data(wDevID, dwParam1); case MODM_LONGDATA: return MIDIOut_LongData(wDevID, (LPMIDIHDR)dwParam1, dwParam2); case MODM_PREPARE:
1
0
0
0
Huw Davies : winecoreaudio: Move midi_out_close to the unixlib.
by Alexandre Julliard
26 Nov '21
26 Nov '21
Module: wine Branch: master Commit: bf502e36851674c98698f381d82db7ab8f703dcf URL:
https://source.winehq.org/git/wine.git/?a=commit;h=bf502e36851674c98698f381…
Author: Huw Davies <huw(a)codeweavers.com> Date: Thu Nov 25 11:03:40 2021 +0000 winecoreaudio: Move midi_out_close to the unixlib. Signed-off-by: Huw Davies <huw(a)codeweavers.com> Signed-off-by: Andrew Eikum <aeikum(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/winecoreaudio.drv/audiounit.c | 23 ------------------ dlls/winecoreaudio.drv/coremidi.c | 50 ++++++++++++++++++++++++++++++++++++++ dlls/winecoreaudio.drv/midi.c | 28 --------------------- 3 files changed, 50 insertions(+), 51 deletions(-) diff --git a/dlls/winecoreaudio.drv/audiounit.c b/dlls/winecoreaudio.drv/audiounit.c index d155bda7be3..d3c53926c59 100644 --- a/dlls/winecoreaudio.drv/audiounit.c +++ b/dlls/winecoreaudio.drv/audiounit.c @@ -49,7 +49,6 @@ #include "wine/debug.h" WINE_DEFAULT_DEBUG_CHANNEL(wave); -WINE_DECLARE_DEBUG_CHANNEL(midi); int AudioUnit_SetVolume(AudioUnit au, float left, float right) { @@ -85,28 +84,6 @@ int AudioUnit_GetVolume(AudioUnit au, float *left, float *right) return 1; } - -int SynthUnit_Close(AUGraph graph) -{ - OSStatus err = noErr; - - err = AUGraphStop(graph); - if (err != noErr) - { - ERR_(midi)("AUGraphStop(%p) return %s\n", graph, wine_dbgstr_fourcc(err)); - return 0; - } - - err = DisposeAUGraph(graph); - if (err != noErr) - { - ERR_(midi)("DisposeAUGraph(%p) return %s\n", graph, wine_dbgstr_fourcc(err)); - return 0; - } - - return 1; -} - void MIDIOut_Send(MIDIPortRef port, MIDIEndpointRef dest, UInt8 *buffer, unsigned length) { Byte packetBuff[512]; diff --git a/dlls/winecoreaudio.drv/coremidi.c b/dlls/winecoreaudio.drv/coremidi.c index a7b84f0a41e..6fddbd7d88a 100644 --- a/dlls/winecoreaudio.drv/coremidi.c +++ b/dlls/winecoreaudio.drv/coremidi.c @@ -356,6 +356,27 @@ static BOOL synth_unit_init(AudioUnit synth, AUGraph graph) return TRUE; } +static BOOL synth_unit_close(AUGraph graph) +{ + OSStatus sc; + + sc = AUGraphStop(graph); + if (sc != noErr) + { + ERR("AUGraphStop(%p) returns %s\n", graph, wine_dbgstr_fourcc(sc)); + return FALSE; + } + + sc = DisposeAUGraph(graph); + if (sc != noErr) + { + ERR("DisposeAUGraph(%p) returns %s\n", graph, wine_dbgstr_fourcc(sc)); + return FALSE; + } + + return TRUE; +} + static void set_out_notify(struct notify_context *notify, struct midi_dest *dest, WORD dev_id, WORD msg, DWORD_PTR param_1, DWORD_PTR param_2) { @@ -416,6 +437,32 @@ static DWORD midi_out_open(WORD dev_id, MIDIOPENDESC *midi_desc, DWORD flags, st return MMSYSERR_NOERROR; } +static DWORD midi_out_close(WORD dev_id, struct notify_context *notify) +{ + struct midi_dest *dest; + + TRACE("dev_id = %d\n", dev_id); + + if (dev_id >= num_dests) + { + WARN("bad device ID : %d\n", dev_id); + return MMSYSERR_BADDEVICEID; + } + + dest = dests + dev_id; + + if (dest->caps.wTechnology == MOD_SYNTH) + synth_unit_close(dest->graph); + dest->graph = 0; + dest->synth = 0; + + set_out_notify(notify, dest, dev_id, MOM_CLOSE, 0, 0); + + dest->midiDesc.hMidi = 0; + + return MMSYSERR_NOERROR; +} + NTSTATUS midi_out_message(void *args) { struct midi_out_message_params *params = args; @@ -433,6 +480,9 @@ NTSTATUS midi_out_message(void *args) case MODM_OPEN: *params->err = midi_out_open(params->dev_id, (MIDIOPENDESC *)params->param_1, params->param_2, params->notify); break; + case MODM_CLOSE: + *params->err = midi_out_close(params->dev_id, params->notify); + break; default: TRACE("Unsupported message\n"); *params->err = MMSYSERR_NOTSUPPORTED; diff --git a/dlls/winecoreaudio.drv/midi.c b/dlls/winecoreaudio.drv/midi.c index 575a8bf6813..e2418645968 100644 --- a/dlls/winecoreaudio.drv/midi.c +++ b/dlls/winecoreaudio.drv/midi.c @@ -64,8 +64,6 @@ static MIDIPortRef MIDIOutPort = NULL; MIDIDestination *destinations; MIDISource *sources; -extern int SynthUnit_Close(AUGraph graph); - static void notify_client(struct notify_context *notify) { TRACE("dev_id=%d msg=%d param1=%04lX param2=%04lX\n", notify->dev_id, notify->msg, notify->param_1, notify->param_2); @@ -137,7 +135,6 @@ static void MIDI_NotifyClient(UINT wDevID, WORD wMsg, DWORD_PTR dwParam1, DWORD_ TRACE("wDevID=%d wMsg=%d dwParm1=%04lX dwParam2=%04lX\n", wDevID, wMsg, dwParam1, dwParam2); switch (wMsg) { - case MOM_CLOSE: case MOM_DONE: case MOM_POSITIONCB: dwCallBack = destinations[wDevID].midiDesc.dwCallback; @@ -166,29 +163,6 @@ static void MIDI_NotifyClient(UINT wDevID, WORD wMsg, DWORD_PTR dwParam1, DWORD_ DriverCallback(dwCallBack, uFlags, hDev, wMsg, dwInstance, dwParam1, dwParam2); } -static DWORD MIDIOut_Close(WORD wDevID) -{ - DWORD ret = MMSYSERR_NOERROR; - - TRACE("wDevID=%d\n", wDevID); - - if (wDevID >= MIDIOut_NumDevs) { - WARN("bad device ID : %d\n", wDevID); - return MMSYSERR_BADDEVICEID; - } - - if (destinations[wDevID].caps.wTechnology == MOD_SYNTH) - SynthUnit_Close(destinations[wDevID].graph); - - destinations[wDevID].graph = 0; - destinations[wDevID].synth = 0; - - MIDI_NotifyClient(wDevID, MOM_CLOSE, 0L, 0L); - destinations[wDevID].midiDesc.hMidi = 0; - - return ret; -} - static DWORD MIDIOut_Data(WORD wDevID, DWORD dwParam) { WORD evt = LOBYTE(LOWORD(dwParam)); @@ -789,8 +763,6 @@ DWORD WINAPI CoreAudio_modMessage(UINT wDevID, UINT wMsg, DWORD_PTR dwUser, DWOR TRACE("%d %08x %08lx %08lx %08lx\n", wDevID, wMsg, dwUser, dwParam1, dwParam2); switch (wMsg) { - case MODM_CLOSE: - return MIDIOut_Close(wDevID); case MODM_DATA: return MIDIOut_Data(wDevID, dwParam1); case MODM_LONGDATA:
1
0
0
0
Huw Davies : winecoreaudio: Move midi_out_open to the unixlib.
by Alexandre Julliard
26 Nov '21
26 Nov '21
Module: wine Branch: master Commit: ec9d2a7773fa0ad74cad8d4ee3f673e219753f8d URL:
https://source.winehq.org/git/wine.git/?a=commit;h=ec9d2a7773fa0ad74cad8d4e…
Author: Huw Davies <huw(a)codeweavers.com> Date: Thu Nov 25 11:03:39 2021 +0000 winecoreaudio: Move midi_out_open to the unixlib. Notifications are filled out by the unixlib and returned to the user-side for dispatch. Signed-off-by: Huw Davies <huw(a)codeweavers.com> Signed-off-by: Andrew Eikum <aeikum(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/winecoreaudio.drv/audiounit.c | 90 ------------------- dlls/winecoreaudio.drv/coreaudio.c | 1 + dlls/winecoreaudio.drv/coremidi.c | 177 +++++++++++++++++++++++++++++++++++++ dlls/winecoreaudio.drv/midi.c | 87 ++++++------------ dlls/winecoreaudio.drv/unixlib.h | 27 ++++++ 5 files changed, 231 insertions(+), 151 deletions(-) Diff:
https://source.winehq.org/git/wine.git/?a=commitdiff;h=ec9d2a7773fa0ad74cad…
1
0
0
0
Huw Davies : winecoreaudio: Move midi_init and midi_release to the unixlib.
by Alexandre Julliard
26 Nov '21
26 Nov '21
Module: wine Branch: master Commit: e506d99ceb72f60bd81ba54cde099712d9c54aca URL:
https://source.winehq.org/git/wine.git/?a=commit;h=e506d99ceb72f60bd81ba54c…
Author: Huw Davies <huw(a)codeweavers.com> Date: Thu Nov 25 11:03:38 2021 +0000 winecoreaudio: Move midi_init and midi_release to the unixlib. midi_init temporarily returns unix-side info, which will eventually be removed. Signed-off-by: Huw Davies <huw(a)codeweavers.com> Signed-off-by: Andrew Eikum <aeikum(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/winecoreaudio.drv/coreaudio.c | 2 + dlls/winecoreaudio.drv/coremidi.c | 233 ++++++++++++++++++++++++++++++++----- dlls/winecoreaudio.drv/coremidi.h | 28 ++++- dlls/winecoreaudio.drv/midi.c | 153 +++++------------------- dlls/winecoreaudio.drv/unixlib.h | 13 +++ 5 files changed, 276 insertions(+), 153 deletions(-) Diff:
https://source.winehq.org/git/wine.git/?a=commitdiff;h=e506d99ceb72f60bd81b…
1
0
0
0
Huw Davies : winecoreaudio: Combine MIDIIn_SendMessage into MIDIIn_ReadProc.
by Alexandre Julliard
26 Nov '21
26 Nov '21
Module: wine Branch: master Commit: dcbbe185197b6c81b5a9cd9fdcdb9cfd64c4aab7 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=dcbbe185197b6c81b5a9cd9f…
Author: Huw Davies <huw(a)codeweavers.com> Date: Thu Nov 25 11:03:37 2021 +0000 winecoreaudio: Combine MIDIIn_SendMessage into MIDIIn_ReadProc. Signed-off-by: Huw Davies <huw(a)codeweavers.com> Signed-off-by: Andrew Eikum <aeikum(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/winecoreaudio.drv/coremidi.c | 31 ++++++++++++++++++------- dlls/winecoreaudio.drv/coremidi.h | 8 ++++++- dlls/winecoreaudio.drv/midi.c | 48 +++++---------------------------------- 3 files changed, 36 insertions(+), 51 deletions(-) diff --git a/dlls/winecoreaudio.drv/coremidi.c b/dlls/winecoreaudio.drv/coremidi.c index 6d54d89cfac..92f52c972d3 100644 --- a/dlls/winecoreaudio.drv/coremidi.c +++ b/dlls/winecoreaudio.drv/coremidi.c @@ -1,7 +1,11 @@ /* - * Wine Midi driver for Mac OS X + * MIDI driver for macOS (unixlib) * - * Copyright 2006 Emmanuel Maillard + * Copyright 1994 Martin Ayotte + * Copyright 1998 Luiz Otavio L. Zorzella + * Copyright 1998, 1999 Eric POUECH + * Copyright 2005, 2006 Emmanuel Maillard + * Copyright 2021 Huw Davies * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -56,14 +60,25 @@ void CoreMIDI_GetObjectName(MIDIObjectRef obj, char *name, int size) */ void MIDIIn_ReadProc(const MIDIPacketList *pktlist, void *refCon, void *connRefCon) { - unsigned int i; - + CFMessagePortRef msg_port = CFMessagePortCreateRemote(kCFAllocatorDefault, MIDIInThreadPortName); MIDIPacket *packet = (MIDIPacket *)pktlist->packet; - for (i = 0; i < pktlist->numPackets; ++i) { - UInt16 devID = *((UInt16 *)connRefCon); - - MIDIIn_SendMessage(devID, packet->data, packet->length); + CFMutableDataRef data; + MIDIMessage msg; + unsigned int i; + for (i = 0; i < pktlist->numPackets; ++i) + { + msg.devID = *(UInt16 *)connRefCon; + msg.length = packet->length; + data = CFDataCreateMutable(kCFAllocatorDefault, sizeof(msg) + packet->length); + if (data) + { + CFDataAppendBytes(data, (UInt8 *)&msg, sizeof(msg)); + CFDataAppendBytes(data, packet->data, packet->length); + CFMessagePortSendRequest(msg_port, 0, data, 0.0, 0.0, NULL, NULL); + CFRelease(data); + } packet = MIDIPacketNext(packet); } + CFRelease(msg_port); } diff --git a/dlls/winecoreaudio.drv/coremidi.h b/dlls/winecoreaudio.drv/coremidi.h index 3433a1d4342..47566345b54 100644 --- a/dlls/winecoreaudio.drv/coremidi.h +++ b/dlls/winecoreaudio.drv/coremidi.h @@ -73,6 +73,12 @@ extern void MIDIIn_ReadProc(const MIDIPacketList *pktlist, void *refCon, void *c extern void MIDIOut_Send(MIDIPortRef port, MIDIEndpointRef dest, UInt8 *buffer, unsigned length); /* midi.c */ -void MIDIIn_SendMessage(UInt16 devID, const void *buffer, UInt16 length); +extern CFStringRef MIDIInThreadPortName; + +typedef struct { + UInt16 devID; + UInt16 length; + Byte data[]; +} MIDIMessage; #endif diff --git a/dlls/winecoreaudio.drv/midi.c b/dlls/winecoreaudio.drv/midi.c index 32826cb658c..2c89f32b430 100644 --- a/dlls/winecoreaudio.drv/midi.c +++ b/dlls/winecoreaudio.drv/midi.c @@ -1,14 +1,11 @@ /* - * Sample MIDI Wine Driver for Mac OS X (based on OSS midi driver) + * MIDI driver for macOS (PE-side) * - * Copyright 1994 Martin Ayotte - * Copyright 1998 Luiz Otavio L. Zorzella (init procedures) - * Copyright 1998/1999 Eric POUECH : - * 98/7 changes for making this MIDI driver work on OSS - * current support is limited to MIDI ports of OSS systems - * 98/9 rewriting MCI code for MIDI - * 98/11 split in midi.c and mcimidi.c + * Copyright 1994 Martin Ayotte + * Copyright 1998 Luiz Otavio L. Zorzella + * Copyright 1998, 1999 Eric POUECH * Copyright 2005, 2006 Emmanuel Maillard + * Copyright 2021 Huw Davies * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -78,14 +75,8 @@ typedef struct tagMIDISource { DWORD startTime; } MIDISource; -typedef struct { - UInt16 devID; - UInt16 length; - Byte data[]; -} MIDIMessage; - static CRITICAL_SECTION midiInLock; /* Critical section for MIDI In */ -static CFStringRef MIDIInThreadPortName = NULL; +CFStringRef MIDIInThreadPortName = NULL; static DWORD WINAPI MIDIIn_MessageThread(LPVOID p); @@ -798,33 +789,6 @@ static DWORD MIDIIn_Reset(WORD wDevID) /* * MIDI In Mach message handling */ - -/* - * Call from CoreMIDI IO threaded callback, - * we can't call Wine debug channels, critical section or anything using NtCurrentTeb here. - */ -void MIDIIn_SendMessage(UInt16 devID, const void *buffer, UInt16 length) -{ - MIDIMessage msg; - CFMutableDataRef data; - - CFMessagePortRef messagePort; - messagePort = CFMessagePortCreateRemote(kCFAllocatorDefault, MIDIInThreadPortName); - - msg.devID = devID; - msg.length = length; - - data = CFDataCreateMutable(kCFAllocatorDefault, sizeof(msg) + length); - if (data) - { - CFDataAppendBytes(data, (UInt8 *) &msg, sizeof(msg)); - CFDataAppendBytes(data, buffer, length); - CFMessagePortSendRequest(messagePort, 0, data, 0.0, 0.0, NULL, NULL); - CFRelease(data); - } - CFRelease(messagePort); -} - static CFDataRef MIDIIn_MessageHandler(CFMessagePortRef local, SInt32 msgid, CFDataRef data, void *info) { MIDIMessage *msg = NULL;
1
0
0
0
Huw Davies : winecoreaudio: Temporarily move MIDIOut_Send() to audiounit.c.
by Alexandre Julliard
26 Nov '21
26 Nov '21
Module: wine Branch: master Commit: 1f0591dd4558c606d844fc30c21f5c2b1e11c34b URL:
https://source.winehq.org/git/wine.git/?a=commit;h=1f0591dd4558c606d844fc30…
Author: Huw Davies <huw(a)codeweavers.com> Date: Thu Nov 25 11:03:36 2021 +0000 winecoreaudio: Temporarily move MIDIOut_Send() to audiounit.c. This is to enable coremidi.c to become the unixlib, while still enabling code on the user-side to be able to call MIDIOut_Send() for the time being. Eventually, its equivalent will move to the unixlib and audiounit.c will disappear. Signed-off-by: Huw Davies <huw(a)codeweavers.com> Signed-off-by: Andrew Eikum <aeikum(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/winecoreaudio.drv/audiounit.c | 13 +++++++++++++ dlls/winecoreaudio.drv/coremidi.c | 12 ------------ 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/dlls/winecoreaudio.drv/audiounit.c b/dlls/winecoreaudio.drv/audiounit.c index 030ff4d090a..c91fec216bd 100644 --- a/dlls/winecoreaudio.drv/audiounit.c +++ b/dlls/winecoreaudio.drv/audiounit.c @@ -22,6 +22,7 @@ #define ULONG CoreFoundation_ULONG #define HRESULT CoreFoundation_HRESULT +#include <mach/mach_time.h> #include <AudioUnit/AudioUnit.h> #include <AudioToolbox/AudioToolbox.h> #undef ULONG @@ -195,3 +196,15 @@ int SynthUnit_Close(AUGraph graph) return 1; } + +void MIDIOut_Send(MIDIPortRef port, MIDIEndpointRef dest, UInt8 *buffer, unsigned length) +{ + Byte packetBuff[512]; + MIDIPacketList *packetList = (MIDIPacketList *)packetBuff; + + MIDIPacket *packet = MIDIPacketListInit(packetList); + + packet = MIDIPacketListAdd(packetList, sizeof(packetBuff), packet, mach_absolute_time(), length, buffer); + if (packet) + MIDISend(port, dest, packetList); +} diff --git a/dlls/winecoreaudio.drv/coremidi.c b/dlls/winecoreaudio.drv/coremidi.c index 94761b05c4f..6d54d89cfac 100644 --- a/dlls/winecoreaudio.drv/coremidi.c +++ b/dlls/winecoreaudio.drv/coremidi.c @@ -67,15 +67,3 @@ void MIDIIn_ReadProc(const MIDIPacketList *pktlist, void *refCon, void *connRefC packet = MIDIPacketNext(packet); } } - -void MIDIOut_Send(MIDIPortRef port, MIDIEndpointRef dest, UInt8 *buffer, unsigned length) -{ - Byte packetBuff[512]; - MIDIPacketList *packetList = (MIDIPacketList *)packetBuff; - - MIDIPacket *packet = MIDIPacketListInit(packetList); - - packet = MIDIPacketListAdd(packetList, sizeof(packetBuff), packet, mach_absolute_time(), length, buffer); - if (packet) - MIDISend(port, dest, packetList); -}
1
0
0
0
Alexandre Julliard : mountmgr: Move the DiskArbitration support to the Unix library.
by Alexandre Julliard
26 Nov '21
26 Nov '21
Module: wine Branch: master Commit: 236a1bc8f0c8a01e9312748eca149ec5e773397d URL:
https://source.winehq.org/git/wine.git/?a=commit;h=236a1bc8f0c8a01e9312748e…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Fri Nov 26 16:50:41 2021 +0100 mountmgr: Move the DiskArbitration support to the Unix library. Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/mountmgr.sys/dbus.c | 5 --- dlls/mountmgr.sys/diskarb.c | 72 ++++++++++++++++++++------------------------ dlls/mountmgr.sys/mountmgr.c | 6 ---- dlls/mountmgr.sys/mountmgr.h | 6 ---- dlls/mountmgr.sys/unixlib.c | 1 + dlls/mountmgr.sys/unixlib.h | 1 + 6 files changed, 34 insertions(+), 57 deletions(-) diff --git a/dlls/mountmgr.sys/dbus.c b/dlls/mountmgr.sys/dbus.c index 43f79d39034..28b229f03d0 100644 --- a/dlls/mountmgr.sys/dbus.c +++ b/dlls/mountmgr.sys/dbus.c @@ -827,9 +827,4 @@ void run_dbus_loop(void) TRACE( "Skipping, DBUS support not compiled in\n" ); } -NTSTATUS dhcp_request( void *args ) -{ - return STATUS_NOT_SUPPORTED; -} - #endif /* SONAME_LIBDBUS_1 */ diff --git a/dlls/mountmgr.sys/diskarb.c b/dlls/mountmgr.sys/diskarb.c index 7c55659862d..e034a4c1c5b 100644 --- a/dlls/mountmgr.sys/diskarb.c +++ b/dlls/mountmgr.sys/diskarb.c @@ -18,8 +18,11 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#if 0 +#pragma makedep unix +#endif + #include "config.h" -#include "wine/port.h" #include <assert.h> #include <errno.h> @@ -43,6 +46,8 @@ #include "winsock2.h" #include "ws2ipdef.h" #include "dhcpcsdk.h" +#include "unixlib.h" + #include "wine/debug.h" WINE_DEFAULT_DEBUG_CHANNEL(mountmgr); @@ -163,9 +168,9 @@ static void appeared_callback( DADiskRef disk, void *context ) } if (removable) - add_dos_device( -1, device, device, mount_point, type, guid_ptr, &scsi_info ); + queue_device_op( ADD_DOS_DEVICE, device, device, mount_point, type, guid_ptr, NULL, &scsi_info ); else - if (guid_ptr) add_volume( device, device, mount_point, DEVICE_HARDDISK_VOL, guid_ptr, NULL, &scsi_info ); + if (guid_ptr) queue_device_op( ADD_VOLUME, device, device, mount_point, DEVICE_HARDDISK_VOL, guid_ptr, NULL, &scsi_info ); done: CFRelease( dict ); @@ -191,20 +196,17 @@ static void disappeared_callback( DADiskRef disk, void *context ) TRACE( "got unmount notification for '%s'\n", device ); - if ((ref = CFDictionaryGetValue( dict, CFSTR("DAMediaRemovable") )) && CFBooleanGetValue( ref )) - remove_dos_device( -1, device ); - else - remove_volume( device ); + queue_device_op( REMOVE_DEVICE, device, NULL, NULL, 0, NULL, NULL, NULL ); done: CFRelease( dict ); } -static DWORD WINAPI runloop_thread( void *arg ) +void run_diskarbitration_loop(void) { DASessionRef session = DASessionCreate( NULL ); - if (!session) return 1; + if (!session) return; DASessionScheduleWithRunLoop( session, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode ); DARegisterDiskAppearedCallback( session, kDADiskDescriptionMatchVolumeMountable, @@ -216,20 +218,11 @@ static DWORD WINAPI runloop_thread( void *arg ) CFRunLoopRun(); DASessionUnscheduleFromRunLoop( session, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode ); CFRelease( session ); - return 0; -} - -void initialize_diskarbitration(void) -{ - HANDLE handle; - - if (!(handle = CreateThread( NULL, 0, runloop_thread, NULL, 0, NULL ))) return; - CloseHandle( handle ); } #else /* HAVE_DISKARBITRATION_DISKARBITRATION_H */ -void initialize_diskarbitration(void) +void run_diskarbitration_loop(void) { TRACE( "Skipping, Disk Arbitration support not compiled in\n" ); } @@ -291,17 +284,17 @@ done: return ret; } -ULONG get_dhcp_request_param( const char *unix_name, struct mountmgr_dhcp_request_param *param, char *buf, ULONG offset, - ULONG size ) +NTSTATUS dhcp_request( void *args ) { - CFStringRef service_id = find_service_id( unix_name ); + const struct dhcp_request_params *params = args; + CFStringRef service_id = find_service_id( params->unix_name ); CFDictionaryRef dict; CFDataRef value; DWORD ret = 0; CFIndex len; - param->offset = 0; - param->size = 0; + params->req->offset = 0; + params->req->size = 0; if (!service_id) return 0; if (!(dict = SCDynamicStoreCopyDHCPInfo( NULL, service_id ))) @@ -310,25 +303,25 @@ ULONG get_dhcp_request_param( const char *unix_name, struct mountmgr_dhcp_reques return 0; } CFRelease( service_id ); - if (!(value = DHCPInfoGetOptionData( dict, map_option(param->id) ))) + if (!(value = DHCPInfoGetOptionData( dict, map_option(params->req->id) ))) { CFRelease( dict ); return 0; } len = CFDataGetLength( value ); - switch (param->id) + switch (params->req->id) { case OPTION_SUBNET_MASK: case OPTION_ROUTER_ADDRESS: case OPTION_BROADCAST_ADDRESS: { - DWORD *ptr = (DWORD *)(buf + offset); - if (len == sizeof(*ptr) && size >= sizeof(*ptr)) + DWORD *ptr = (DWORD *)(params->buffer + params->offset); + if (len == sizeof(*ptr) && params->size >= sizeof(*ptr)) { CFDataGetBytes( value, CFRangeMake(0, len), (UInt8 *)ptr ); - param->offset = offset; - param->size = sizeof(*ptr); + params->req->offset = params->offset; + params->req->size = sizeof(*ptr); TRACE( "returning %08x\n", *ptr ); } ret = sizeof(*ptr); @@ -338,33 +331,32 @@ ULONG get_dhcp_request_param( const char *unix_name, struct mountmgr_dhcp_reques case OPTION_DOMAIN_NAME: case OPTION_MSFT_IE_PROXY: { - char *ptr = buf + offset; - if (size >= len) + char *ptr = params->buffer + params->offset; + if (params->size >= len) { CFDataGetBytes( value, CFRangeMake(0, len), (UInt8 *)ptr ); - param->offset = offset; - param->size = len; + params->req->offset = params->offset; + params->req->size = len; TRACE( "returning %s\n", debugstr_an(ptr, len) ); } ret = len; break; } default: - FIXME( "option %u not supported\n", param->id ); + FIXME( "option %u not supported\n", params->req->id ); break; } CFRelease( dict ); - return ret; + *params->ret_size = ret; + return STATUS_SUCCESS; } #elif !defined(SONAME_LIBDBUS_1) -ULONG get_dhcp_request_param( const char *unix_name, struct mountmgr_dhcp_request_param *param, char *buf, ULONG offset, - ULONG size ) +NTSTATUS dhcp_request( void *args ) { - FIXME( "support not compiled in\n" ); - return 0; + return STATUS_NOT_SUPPORTED; } #endif diff --git a/dlls/mountmgr.sys/mountmgr.c b/dlls/mountmgr.sys/mountmgr.c index 8aeaee8dc04..2e3ff80c36a 100644 --- a/dlls/mountmgr.sys/mountmgr.c +++ b/dlls/mountmgr.sys/mountmgr.c @@ -408,15 +408,11 @@ static void WINAPI query_dhcp_request_params( TP_CALLBACK_INSTANCE *instance, vo offset = FIELD_OFFSET(struct mountmgr_dhcp_request_params, params[query->count]); for (i = 0; i < query->count; i++) { -#ifdef __APPLE__ - offset += get_dhcp_request_param( query->unix_name, &query->params[i], (char *)query, offset, outsize - offset ); -#else ULONG ret_size; struct dhcp_request_params params = { query->unix_name, &query->params[i], (char *)query, offset, outsize - offset, &ret_size }; MOUNTMGR_CALL( dhcp_request, ¶ms ); offset += ret_size; -#endif if (offset > outsize) { if (offset >= sizeof(query->size)) query->size = offset; @@ -685,8 +681,6 @@ NTSTATUS WINAPI DriverEntry( DRIVER_OBJECT *driver, UNICODE_STRING *path ) params.op_apc = device_op; CloseHandle( CreateThread( NULL, 0, run_loop_thread, ¶ms, 0, NULL )); - initialize_diskarbitration(); - #ifdef _WIN64 /* create a symlink so that the Wine port overrides key can be edited with 32-bit reg or regedit */ RegCreateKeyExW( HKEY_LOCAL_MACHINE, wow64_ports_keyW, 0, NULL, REG_OPTION_CREATE_LINK, diff --git a/dlls/mountmgr.sys/mountmgr.h b/dlls/mountmgr.sys/mountmgr.h index c3557d7e548..0297f6f11fe 100644 --- a/dlls/mountmgr.sys/mountmgr.h +++ b/dlls/mountmgr.sys/mountmgr.h @@ -36,8 +36,6 @@ #define WINE_MOUNTMGR_EXTENSIONS #include "ddk/mountmgr.h" -extern void initialize_diskarbitration(void) DECLSPEC_HIDDEN; - extern WCHAR *strdupW( const WCHAR * ) DECLSPEC_HIDDEN; /* device functions */ @@ -114,8 +112,4 @@ extern struct mount_point *add_volume_mount_point( DEVICE_OBJECT *device, UNICOD extern void delete_mount_point( struct mount_point *mount ) DECLSPEC_HIDDEN; extern void set_mount_point_id( struct mount_point *mount, const void *id, unsigned int id_len ) DECLSPEC_HIDDEN; -#ifdef __APPLE__ -extern ULONG get_dhcp_request_param( const char *unix_name, struct mountmgr_dhcp_request_param *param, - char *buf, ULONG offset, ULONG size ) DECLSPEC_HIDDEN; -#endif #endif /* __WINE_MOUNTMGR_H */ diff --git a/dlls/mountmgr.sys/unixlib.c b/dlls/mountmgr.sys/unixlib.c index caecb0140a8..54ba8c81b78 100644 --- a/dlls/mountmgr.sys/unixlib.c +++ b/dlls/mountmgr.sys/unixlib.c @@ -128,6 +128,7 @@ static NTSTATUS run_loop( void *args ) const struct run_loop_params *params = args; run_loop_params = *params; + run_diskarbitration_loop(); run_dbus_loop(); return STATUS_SUCCESS; } diff --git a/dlls/mountmgr.sys/unixlib.h b/dlls/mountmgr.sys/unixlib.h index afaed5fa559..74d076fa4fd 100644 --- a/dlls/mountmgr.sys/unixlib.h +++ b/dlls/mountmgr.sys/unixlib.h @@ -152,6 +152,7 @@ extern void queue_device_op( enum device_op op, const char *udi, const char *dev const char *mount_point, enum device_type type, const GUID *guid, const char *disk_serial, const struct scsi_info *info ) DECLSPEC_HIDDEN; extern void run_dbus_loop(void) DECLSPEC_HIDDEN; +extern void run_diskarbitration_loop(void) DECLSPEC_HIDDEN; extern NTSTATUS dhcp_request( void *args ) DECLSPEC_HIDDEN; extern NTSTATUS query_symbol_file( void *buff, ULONG insize, ULONG outsize, ULONG *info ) DECLSPEC_HIDDEN;
1
0
0
0
Alexandre Julliard : mountmgr: Move the DBus support to the Unix library.
by Alexandre Julliard
26 Nov '21
26 Nov '21
Module: wine Branch: master Commit: 95615a4afbac69b171d54533a4494e43f7811b55 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=95615a4afbac69b171d54533…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Fri Nov 26 15:38:17 2021 +0100 mountmgr: Move the DBus support to the Unix library. Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/mountmgr.sys/dbus.c | 132 +++++++++++++++++++++---------------------- dlls/mountmgr.sys/mountmgr.c | 50 +++++++++++++++- dlls/mountmgr.sys/mountmgr.h | 3 +- dlls/mountmgr.sys/unixlib.c | 67 ++++++++++++++++++++++ dlls/mountmgr.sys/unixlib.h | 55 ++++++++++++++++++ 5 files changed, 237 insertions(+), 70 deletions(-) Diff:
https://source.winehq.org/git/wine.git/?a=commitdiff;h=95615a4afbac69b171d5…
1
0
0
0
← Newer
1
...
7
8
9
10
11
12
13
...
96
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
Results per page:
10
25
50
100
200