aboutsummaryrefslogtreecommitdiffhomepage
path: root/backends/winmidi.c
diff options
context:
space:
mode:
authorcbdev <cb@cbcdn.com>2019-11-03 16:59:13 +0100
committercbdev <cb@cbcdn.com>2019-11-03 16:59:13 +0100
commit24e5594c754ec74918848d33d513db69d54aba47 (patch)
treed93808cce63be70cb8e331a15d5d425ece2abb57 /backends/winmidi.c
parent65bd41387c8dbf67812de1881198a47c9bb4b55e (diff)
downloadmidimonster-24e5594c754ec74918848d33d513db69d54aba47.tar.gz
midimonster-24e5594c754ec74918848d33d513db69d54aba47.tar.bz2
midimonster-24e5594c754ec74918848d33d513db69d54aba47.zip
Fix winmidi wire format
Diffstat (limited to 'backends/winmidi.c')
-rw-r--r--backends/winmidi.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/backends/winmidi.c b/backends/winmidi.c
index 83d0c7e..de7d867 100644
--- a/backends/winmidi.c
+++ b/backends/winmidi.c
@@ -21,7 +21,6 @@ static struct {
.socket_pair = {-1, -1}
};
-//TODO detect option
//TODO receive feedback socket until EAGAIN
int init(){
@@ -123,8 +122,9 @@ static channel* winmidi_channel(instance* inst, char* spec){
next_token = spec + 7;
}
}
- else{
- fprintf(stderr, "Unknown winmidi channel specification %s\n", spec);
+
+ if(!next_token){
+ fprintf(stderr, "Invalid winmidi channel specification %s\n", spec);
return NULL;
}
@@ -226,8 +226,8 @@ static int winmidi_set(instance* inst, size_t num, channel** c, channel_value* v
break;
case pitchbend:
output.components.status = 0xE0 | ident.fields.channel;
- output.components.data1 = ((int)(v[u].normalised * 32639.0)) & 0xFF;
- output.components.data2 = (((int)(v[u].normalised * 32639.0)) & 0xFF00) >> 8;
+ output.components.data1 = ((int)(v[u].normalised * 16384.0)) & 0x7F;
+ output.components.data2 = (((int)(v[u].normalised * 16384.0)) >> 7) & 0x7F;
break;
default:
fprintf(stderr, "Unknown winmidi channel type %d\n", ident.fields.type);
@@ -357,7 +357,7 @@ static void CALLBACK winmidi_input_callback(HMIDIIN device, unsigned message, DW
case 0xE0:
ident.fields.type = pitchbend;
ident.fields.control = 0;
- val.normalised = (double)((input.components.data2 << 8) | input.components.data1) / 32639.0;
+ val.normalised = (double)((input.components.data2 << 7) | input.components.data1) / 16384.0;
break;
default:
fprintf(stderr, "winmidi unhandled status byte %02X\n", input.components.status);