From 11595d2eff82bd5af9f299249c35bbaa4e25d1b1 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Wed, 25 May 2005 22:21:35 +0000 Subject: [PATCH] style fixes --- .../InputHandler/InputHandler_Win32_MIDI.cpp | 52 +++++++++++-------- 1 file changed, 29 insertions(+), 23 deletions(-) diff --git a/stepmania/src/arch/InputHandler/InputHandler_Win32_MIDI.cpp b/stepmania/src/arch/InputHandler/InputHandler_Win32_MIDI.cpp index b5ab250951..65eb3623f1 100644 --- a/stepmania/src/arch/InputHandler/InputHandler_Win32_MIDI.cpp +++ b/stepmania/src/arch/InputHandler/InputHandler_Win32_MIDI.cpp @@ -16,17 +16,18 @@ InputHandler_Win32_MIDI::InputHandler_Win32_MIDI() { int device_id = 0; - MMRESULT result; g_device = NULL; - if (device_id >= midiInGetNumDevs()) { + if( device_id >= midiInGetNumDevs() ) + { m_bFoundDevice = false; return; - } else - m_bFoundDevice = true; + } + m_bFoundDevice = true; - result = midiInOpen(&g_device, device_id, (DWORD)&(midiCallback), (DWORD)this, CALLBACK_FUNCTION); - if (result != MMSYSERR_NOERROR) { + MMRESULT result = midiInOpen(&g_device, device_id, (DWORD)&(midiCallback), (DWORD)this, CALLBACK_FUNCTION); + if( result != MMSYSERR_NOERROR ) + { char strError[256]; midiOutGetErrorText( result, strError, 256 ); LOG->Warn( "Error with MIDI Opening: %s", strError ); @@ -34,7 +35,8 @@ InputHandler_Win32_MIDI::InputHandler_Win32_MIDI() } result = midiInStart(g_device); - if (result != MMSYSERR_NOERROR) { + if( result != MMSYSERR_NOERROR ) + { char strError[256]; midiOutGetErrorText( result, strError, 256 ); LOG->Warn( "Error with MIDI Starting: %s", strError ); @@ -46,16 +48,18 @@ InputHandler_Win32_MIDI::~InputHandler_Win32_MIDI() { MMRESULT result; - result = midiInReset(g_device); - if (result != MMSYSERR_NOERROR) { + result = midiInReset( g_device ); + if( result != MMSYSERR_NOERROR ) + { char strError[256]; midiOutGetErrorText( result, strError, 256 ); LOG->Warn( "Error with MIDI Reset: %s", strError ); return; } - result = midiInClose(g_device); - if (result != MMSYSERR_NOERROR) { + result = midiInClose( g_device ); + if( result != MMSYSERR_NOERROR ) + { char strError[256]; midiOutGetErrorText( result, strError, 256 ); LOG->Warn( "Error with MIDI Close: %s", strError ); @@ -64,30 +68,32 @@ InputHandler_Win32_MIDI::~InputHandler_Win32_MIDI() } -void InputHandler_Win32_MIDI::GetDevicesAndDescriptions(vector& vDevicesOut, vector& vDescriptionsOut) +void InputHandler_Win32_MIDI::GetDevicesAndDescriptions( vector& vDevicesOut, vector& vDescriptionsOut ) { - if ( m_bFoundDevice ) + if( m_bFoundDevice ) { vDevicesOut.push_back( InputDevice(DEVICE_MIDI) ); vDescriptionsOut.push_back( "Win32_MIDI" ); } } -static void CALLBACK midiCallback(HMIDIIN g_device, UINT status, DWORD instancePtr, DWORD data, DWORD timestamp) +static void CALLBACK midiCallback( HMIDIIN device, UINT status, DWORD instancePtr, DWORD data, DWORD timestamp ) { - if (status == MIM_DATA) { - int type = data & 0x00ff; - int channel = (data & 0xff00) >> 8; - int value = ( data & 0x00ff0000) >> 16; + if( status == MIM_DATA ) + { + int iType = data & 0xff; + int iChannel = (data & 0xff00) >> 8; + int iValue = (data & 0xff0000) >> 16; - //Channel 0 in midi is a special channel that generally will get triggerd when too many channels are pressed - if ( channel == 0 ) return; + // Channel 0 in midi is a special channel that generally will get triggerd when too many channels are pressed + if( iChannel == 0 ) + return; - if ( type == 144 ) + if( iType == 144 ) { - DeviceInput di = DeviceInput(DEVICE_MIDI,channel); + DeviceInput di = DeviceInput( DEVICE_MIDI, iChannel ); di.ts.Touch(); - if ( value > 0 ) + if( iValue > 0 ) ((InputHandler_Win32_MIDI *)instancePtr)->SetDev( di, true ); else ((InputHandler_Win32_MIDI *)instancePtr)->SetDev( di, false );