Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixes in common-controller-scripts.js #1072

Merged
merged 6 commits into from
Dec 13, 2016
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions res/controllers/Reloop Terminal Mix 2-4.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,11 @@ TerminalMix.samplerVolume = function (channel, control, value) {
}
}

TerminalMix.pitchSlider = function (channel, control, value, status, group) {
// invert pitch slider (down=faster) so it matches the labels on controller
engine.setValue(group,"rate",-script.midiPitch(control, value, status));
}

ronso0 marked this conversation as resolved.
Show resolved Hide resolved
TerminalMix.pitchRange = function (channel, control, value, status, group) {
midi.sendShortMsg(status,control,value); // Make button light or extinguish
if (value<=0) return;
Expand Down
20 changes: 8 additions & 12 deletions res/controllers/Reloop Terminal Mix 2-4.midi.xml
Original file line number Diff line number Diff line change
Expand Up @@ -732,11 +732,10 @@
</control>
<control>
<group>[Channel1]</group>
<key>rate</key>
<key>TerminalMix.pitchSlider</key>
<status>0xE0</status>
<options>
<invert/>
<soft-takeover/>
<script-binding/>
</options>
</control>
<control>
Expand Down Expand Up @@ -1384,11 +1383,10 @@
</control>
<control>
<group>[Channel2]</group>
<key>rate</key>
<key>TerminalMix.pitchSlider</key>
<status>0xE1</status>
<options>
<invert/>
<soft-takeover/>
<script-binding/>
</options>
</control>
<control>
Expand Down Expand Up @@ -2089,11 +2087,10 @@
</control>
<control>
<group>[Channel3]</group>
<key>rate</key>
<key>TerminalMix.pitchSlider</key>
<status>0xE2</status>
<options>
<invert/>
<soft-takeover/>
<script-binding/>
</options>
</control>
<control>
Expand Down Expand Up @@ -2706,11 +2703,10 @@
</control>
<control>
<group>[Channel4]</group>
<key>rate</key>
<key>TerminalMix.pitchSlider</key>
<status>0xE3</status>
<options>
<invert/>
<soft-takeover/>
<script-binding/>
</options>
</control>
<control>
Expand Down
10 changes: 6 additions & 4 deletions res/controllers/common-controller-scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -265,9 +265,9 @@ script.loopMove = function (group,direction,numberOfBeats) {
if (!numberOfBeats || numberOfBeats==0) numberOfBeats = 0.5;

if (direction < 0) {
engine.setValue(group, "loop_move", -number_of_beats);
engine.setValue(group, "loop_move", -numberOfBeats);
} else {
engine.setValue(group, "loop_move", number_of_beats);
engine.setValue(group, "loop_move", numberOfBeats);
}
}

Expand Down Expand Up @@ -315,8 +315,10 @@ script.spinback = function(channel, control, value, status, group) {
Output: none
-------- ------------------------------------------------------ */
script.brake = function(channel, control, value, status, group) {
// disable on note-off or zero value note/cc
engine.brake(parseInt(group.substring(8,9)), ((status & 0xF0) != 0x80 && value > 0));
// calculate current playback speed
ronso0 marked this conversation as resolved.
Show resolved Hide resolved
var currentRate = engine.getValue(group,"bpm") / engine.getValue(group,"file_bpm");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would engine.getValue(group, "rate"); work?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the wiki I see that 'rate' ranges from -1...0..1 (which I read as "0 = normal speed") while in brake() 'rate' '1' means normal speed, -10 would be 10x backwards
So I guess no. And I was to lazy to even think about the conversion.. ;)
But the identical naming is irritating, though. Maybe in brake() 'rate' should be 'speed'?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, I was asking in case it would be easier to just get the rate value without having to manipulate it at all. I'm okay with the naming as is.

// disable on note-off or zero value note/cc, use default decay rate '1', consider playback speed
engine.brake(parseInt(group.substring(8,9)), ((status & 0xF0) != 0x80 && value > 0), 1, currentRate);
}

// bpm - Used for tapping the desired BPM for a deck
Expand Down