Commit 9aa9cde8 authored by Emmanuel Maillard's avatar Emmanuel Maillard Committed by Alexandre Julliard

winecoreaudio: Implement MIDIOut_GetVolume and MIDIOut_SetVolume.

parent 97d5a029
......@@ -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 */
......
......@@ -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);
......
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