Module: wine Branch: master Commit: 9aa9cde8416a251d8ed6fcba05d533d792b91541 URL: http://source.winehq.org/git/wine.git/?a=commit;h=9aa9cde8416a251d8ed6fcba05...
Author: Emmanuel Maillard mahanuu@free.fr Date: Wed Apr 25 01:16:44 2007 +0200
winecoreaudio: Implement MIDIOut_GetVolume and MIDIOut_SetVolume.
---
dlls/winecoreaudio.drv/coremidi.h | 3 ++ dlls/winecoreaudio.drv/midi.c | 52 +++++++++++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+), 0 deletions(-)
diff --git a/dlls/winecoreaudio.drv/coremidi.h b/dlls/winecoreaudio.drv/coremidi.h index 2a02003..69fd4ce 100644 --- a/dlls/winecoreaudio.drv/coremidi.h +++ b/dlls/winecoreaudio.drv/coremidi.h @@ -55,6 +55,9 @@ typedef void *AUGraph; extern OSStatus MusicDeviceMIDIEvent(AudioUnit au, UInt32 inStatus, UInt32 inData1, UInt32 inData2, UInt32 inOffsetSampleFrame); extern OSStatus MusicDeviceSysEx(AudioUnit au, const UInt8 *inData, UInt32 inLength);
+/* audiounit.c */ +extern int AudioUnit_SetVolume(AudioUnit au, float left, float right); +extern int AudioUnit_GetVolume(AudioUnit au, float *left, float *right); #endif
/* coremidi.c */ diff --git a/dlls/winecoreaudio.drv/midi.c b/dlls/winecoreaudio.drv/midi.c index 6bca11e..7cbddcf 100644 --- a/dlls/winecoreaudio.drv/midi.c +++ b/dlls/winecoreaudio.drv/midi.c @@ -449,6 +449,56 @@ static DWORD MIDIOut_GetNumDevs(void) return MIDIOut_NumDevs; }
+static DWORD MIDIOut_GetVolume(WORD wDevID, DWORD *lpdwVolume) +{ + TRACE("%d\n", wDevID); + + if (wDevID >= MIDIOut_NumDevs) { + WARN("bad device ID : %d\n", wDevID); + return MMSYSERR_BADDEVICEID; + } + if (lpdwVolume == NULL) { + WARN("Invalid Parameter\n"); + return MMSYSERR_INVALPARAM; + } + + if (destinations[wDevID].caps.wTechnology == MOD_SYNTH) + { + float left; + float right; + AudioUnit_GetVolume(destinations[wDevID].synth, &left, &right); + + *lpdwVolume = ((WORD) left * 0xFFFFl) + (((WORD) right * 0xFFFFl) << 16); + + return MMSYSERR_NOERROR; + } + + return MMSYSERR_NOTSUPPORTED; +} + +static DWORD MIDIOut_SetVolume(WORD wDevID, DWORD dwVolume) +{ + TRACE("%d\n", wDevID); + + if (wDevID >= MIDIOut_NumDevs) { + WARN("bad device ID : %d\n", wDevID); + return MMSYSERR_BADDEVICEID; + } + if (destinations[wDevID].caps.wTechnology == MOD_SYNTH) + { + float left; + float right; + + left = LOWORD(dwVolume) / 65535.0f; + right = HIWORD(dwVolume) / 65535.0f; + AudioUnit_SetVolume(destinations[wDevID].synth, left, right); + + return MMSYSERR_NOERROR; + } + + return MMSYSERR_NOTSUPPORTED; +} + /************************************************************************** * modMessage */ @@ -479,7 +529,9 @@ DWORD WINAPI CoreAudio_modMessage(UINT wDevID, UINT wMsg, DWORD dwUser, DWORD dw case MODM_GETNUMDEVS: return MIDIOut_GetNumDevs(); case MODM_GETVOLUME: + return MIDIOut_GetVolume(wDevID, (DWORD*)dwParam1); case MODM_SETVOLUME: + return MIDIOut_SetVolume(wDevID, dwParam1); case MODM_RESET: default: TRACE("Unsupported message (08%x)\n", wMsg);