On Tue, Jul 26, 2005 at 11:52:55PM +0200, Johannes Koch wrote:
The pitch value was wrongly converted and has to be centered around zero.
Changelog Fixed pitch bending in the alsa midi driver.
? patch.diff Index: dlls/winmm/winealsa/midi.c =================================================================== RCS file: /home/wine/wine/dlls/winmm/winealsa/midi.c,v retrieving revision 1.16 diff -u -p -r1.16 midi.c --- dlls/winmm/winealsa/midi.c 27 Apr 2005 09:39:56 -0000 1.16 +++ dlls/winmm/winealsa/midi.c 26 Jul 2005 21:31:05 -0000 @@ -833,7 +833,7 @@ static DWORD modData(WORD wDevID, DWORD snd_seq_ev_set_controller(&event, evt&0x0F, d1, d2); break; case MIDI_CMD_BENDER:
snd_seq_ev_set_pitchbend(&event, evt&0x0F, ((WORD)d1 << 7) | (WORD)d2);
snd_seq_ev_set_pitchbend(&event, evt&0x0F, ((WORD)d2 << 7 | (WORD)d1) - 0x2000);
This is not correct, you need extra ( ) around the << 7, like this perhaps:
snd_seq_ev_set_pitchbend(&event, evt&0x0F, (((WORD)d2 << 7) | (WORD)d1) - 0x2000);
Ciao, Marcus
No, you don't. The bitwise shifting operator has a higher precedence than the bitwise or does. You may test it with this programm:
#include <stdio.h>
int main(int agrc, char** argv) { int iTest = 0x42 << 7 | 0x02; int iTest1 = (0x42 << 7) | 0x02; int iTest2 = 0x42 << (7 | 0x02);
printf("iTest: %d; iTest1: %d, iTest2: %d\n", iTest, iTest1, iTest2);
return 0; }
I get the following output(compiled with gcc 3.3.5): iTest: 8450; iTest1: 8450, iTest2: 8448
Greetings, Johannes
Johannes Koch wrote:
No, you don't. The bitwise shifting operator has a higher precedence than the bitwise or does.
In case you didn't know...
$ man 7 operator
is your friend. :-)
Felix