Skip to content

Commit

Permalink
Merge pull request #1 from haesslich/master
Browse files Browse the repository at this point in the history
fixing float to int conversion
  • Loading branch information
MircoL authored Nov 24, 2021
2 parents a7e908b + 830b11c commit 4d3ddbe
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
9 changes: 5 additions & 4 deletions README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,11 @@ The files are:
- SteinbergCC121.transport.js (transport functions)

When using Linux, the script should automaticly find and subscribe the controller. It can be necessary for other operating systems to manually choose the controller script and select the right MIDI-IN and MIDI-OUT devices in the Bitwig settings.
There is an explanation what each knob and button does (assignment.pdf).

Information:

Script was tested in Linux Mint 18 64-bit with Bitwig 2 and uses API version 5. There is an explanation what each knob and button does (assignment.pdf).
Changelog:
Version 1.1:
- fixed float to int conversion for volumeValue, causing script to cease working in bitwig 3.3

Known issues:

Expand All @@ -24,4 +25,4 @@ However, the button function itself works fine - it is only the LEDs.
About:

Author: Philipp Winniewski
Date: 22/06/2018
Date: 18/12/2020
6 changes: 3 additions & 3 deletions SteinbergCC121.channel.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ function initChannel() {
});

trackBank.getChannel(0).volume().value().addValueObserver(function(volumeValue) {
var LSB = (volumeValue * 16383) % 128;
var MSB = (volumeValue * 16383) / 128;
var LSB = Math.trunc((volumeValue * 16383) % 128);
var MSB = Math.trunc((volumeValue * 16383) / 128);
sendMidi(224, LSB, MSB);
});

Expand Down Expand Up @@ -114,4 +114,4 @@ function onMidiChannel(status, data1, data2) {
} else if (status == 224) {
trackBank.getChannel(0).volume().value().set(data2 * 128 + data1, 16383);
}
}
}
4 changes: 2 additions & 2 deletions SteinbergCC121.control.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ var midiListeners;
var isJogActive = false;

// Company, product, script version, UUID, author
host.defineController("Steinberg", "CC121", "1.0", "A1068940-6B61-11E8-B566-0800200C9A66", "Philipp Winniewski");
host.defineController("Steinberg", "CC121", "1.1", "A1068940-6B61-11E8-B566-0800200C9A66", "Philipp Winniewski");
host.defineMidiPorts(1, 1);
// For Windows
host.addDeviceNameBasedDiscoveryPair(["Steinberg CC121-1"], ["Steinberg CC121-1"]);
Expand Down Expand Up @@ -124,4 +124,4 @@ function midiCcValueToInteger(ccValue) {
} else {
return 0;
}
}
}

0 comments on commit 4d3ddbe

Please sign in to comment.