kokernutz / traktor-kontrol-screens

Replacement screens for the Native Instruments Traktor Kontrol D2, S5, and S8
105 stars 40 forks source link

Workaround for MixerFX selection on Kontrol S8 #14

Closed MrPatben8 closed 6 years ago

MrPatben8 commented 6 years ago

I was trying to figure out why it wasn't possible to map the filter to select MixerFX, turns out that because the S8 has an internal mixer it is not possible to remap the button in any way (this includes the CUE button). My workaround was to instead use the two FX assign button at the top of each channel, so by pressing SHIFT + fx buttons you can cycle through the different effects. However this removes the ability to assign FX units 3 & 4, so in order to maintain this functionality I thought a reasonable compromise is to only allow MixerFX selection if the filter button is active otherwise just control FX units 3 & 4 as it would normally. The following code is the modified part inside of qml/CSI/S8/Channel.qml

 AppProperty { id: mixerFXOn; path: app_prefix + "fx.on" }

  AppProperty { id: mixerFX; path: app_prefix + "fx.select" }

  WiresGroup
 {
   enabled: !channel.shift
   Wire { from: surface_prefix + "fx.assign.1"; to: TogglePropertyAdapter { path: app_prefix + "fx.assign.1"; } }
   Wire { from: surface_prefix + "fx.assign.2"; to: TogglePropertyAdapter { path: app_prefix + "fx.assign.2"; } }
 }

 WiresGroup
 {
   enabled: channel.shift && (!mixerFXOn.value && fxMode.value == FxMode.FourFxUnits)
   Wire { from: surface_prefix + "fx.assign.1"; to: TogglePropertyAdapter { path: app_prefix + "fx.assign.3"; } }
   Wire { from: surface_prefix + "fx.assign.2"; to: TogglePropertyAdapter { path: app_prefix + "fx.assign.4"; } }
 }

 WiresGroup
 {
   enabled: channel.shift && (mixerFXOn.value || fxMode.value == FxMode.TwoFxUnits)
   Wire { from: surface_prefix + "fx.assign.1"; to: ButtonScriptAdapter { onRelease: { mixerFX.value = (mixerFX.value + 4) % 5; } } }
   Wire { from: surface_prefix + "fx.assign.2"; to: ButtonScriptAdapter { onRelease: { mixerFX.value = (mixerFX.value + 1) % 5; } } }
 }

I'd love to know what you think, is this a good compromise or does it just make the whole thing too complicated? Personally I feel like it works for me, as long as I'm not furiously tying to assign FX units 3 & 4.

EDIT: Modified so that it ignores filter conditionality for MixerFX selection if FxMode.TwoFxUnits is true. Fixed small issue with FX unit assign.

bascurtiz commented 6 years ago

@MrPatben8

Works great, Thanks!

Though, SHIFT+Filter button to en/disable doesn't work. So I can't activate or de-activate the Filter nomore.

I've used the last version of @kokernutz , with the whole S8 part back to normal (incl. working SHIFT-Filter button to en/disable) + I've edited the Channel.qml, where I've overwritten the part under / fx assign with your above shown code.

UPDATE: If I don't overwrite the / fx assign section, but instead add to it, your new code simply doesn't work.

UPDATE 2: Somehow, it works now, incl. SHIFT+Filter button to en/disable + Your SHIFT FX assign 2 buttons to switch from Filter-setting =)

For reference, code of Channel.xml looks like this in total, so people can easily copy/paste and overwrite:

import CSI 1.0

Module
{
  // input
  id: channel
  property int number:     1
  property string surface: ""
  property bool shift:     false

  // helpers
  property string surface_prefix:  channel.surface + "." + channel.number + "." 
  property string app_prefix:      "app.traktor.mixer.channels." + channel.number + "."

  // channel strip
  Wire { from: surface_prefix + "volume";     to: DirectPropertyAdapter { path: app_prefix + "volume"            } }
  Wire { from: surface_prefix + "gain";       to: DirectPropertyAdapter { path: app_prefix + "gain"              } }
  Wire { from: surface_prefix + "eq.high";    to: DirectPropertyAdapter { path: app_prefix + "eq.high"           } }
  Wire { from: surface_prefix + "eq.mid";     to: DirectPropertyAdapter { path: app_prefix + "eq.mid"            } }
  Wire { from: surface_prefix + "eq.low";     to: DirectPropertyAdapter { path: app_prefix + "eq.low"            } }
  Wire { from: surface_prefix + "filter";     to: DirectPropertyAdapter { path: app_prefix + "fx.adjust"         } }
  Wire { from: surface_prefix + "filter_on";  to: DirectPropertyAdapter { path: app_prefix + "fx.on"             } }
  Wire { from: surface_prefix + "cue";        to: DirectPropertyAdapter { path: app_prefix + "cue"               } }

  // level meter
  LEDLevelMeter { name: "meter"; dBThresholds: [-30,-20,-10,-6,-4,-2,0,2,4,6,8] }
  Wire { from: surface_prefix + "levelmeter"; to: "meter" }
  Wire { from: "meter.level"; to: DirectPropertyAdapter { path: app_prefix + "level.prefader.linear.sum"; input: false } }

  // xfader assign
  Wire { from: surface_prefix + "xfader_assign.left";  to: DirectPropertyAdapter { path: app_prefix + "xfader_assign.left"   } }
  Wire { from: surface_prefix + "xfader_assign.right"; to: DirectPropertyAdapter { path: app_prefix + "xfader_assign.right"  } }

  // fx Assign

 AppProperty { id: mixerFXOn; path: app_prefix + "fx.on" }

 AppProperty { id: mixerFX; path: app_prefix + "fx.select" }

 WiresGroup
 {
   enabled: !channel.shift || (fxMode.value == FxMode.TwoFxUnits)
   Wire { from: surface_prefix + "fx.assign.1"; to: TogglePropertyAdapter { path: app_prefix + "fx.assign.1"; } }
   Wire { from: surface_prefix + "fx.assign.2"; to: TogglePropertyAdapter { path: app_prefix + "fx.assign.2"; } }
 }

 WiresGroup
 {
   enabled: channel.shift && (!mixerFXOn.value && fxMode.value == FxMode.FourFxUnits)
   Wire { from: surface_prefix + "fx.assign.1"; to: TogglePropertyAdapter { path: app_prefix + "fx.assign.3"; } }
   Wire { from: surface_prefix + "fx.assign.2"; to: TogglePropertyAdapter { path: app_prefix + "fx.assign.4"; } }
 }

 WiresGroup
 {
   enabled: channel.shift && (mixerFXOn.value || fxMode.value == FxMode.TwoFxUnits)
   Wire { from: surface_prefix + "fx.assign.1"; to: ButtonScriptAdapter { onRelease: { mixerFX.value = (mixerFX.value + 4) % 5; } } }
   Wire { from: surface_prefix + "fx.assign.2"; to: ButtonScriptAdapter { onRelease: { mixerFX.value = (mixerFX.value + 1) % 5; } } }
 }

}
MrPatben8 commented 6 years ago

Hey @bascurtiz , I just made a new change to the QML. It may explain why you were having issues (Thanks to @jkudish for pointing it out). Basically I just removed the || (fxMode.value == FxMode.TwoFxUnits) from the first WiresGroup. The issue was that if you were using only 2 FX units then pressing SHIFT + FX arrows would change the MixerFX and assign the FX units at the same time. This has now been fixed. Thanks for your feedback!

This is the new full code:

import CSI 1.0

Module
{
  // input
  id: channel
  property int number:     1
  property string surface: ""
  property bool shift:     false

  // helpers
  property string surface_prefix:  channel.surface + "." + channel.number + "." 
  property string app_prefix:      "app.traktor.mixer.channels." + channel.number + "."

  // channel strip
  Wire { from: surface_prefix + "volume";     to: DirectPropertyAdapter { path: app_prefix + "volume"            } }
  Wire { from: surface_prefix + "gain";       to: DirectPropertyAdapter { path: app_prefix + "gain"              } }
  Wire { from: surface_prefix + "eq.high";    to: DirectPropertyAdapter { path: app_prefix + "eq.high"           } }
  Wire { from: surface_prefix + "eq.mid";     to: DirectPropertyAdapter { path: app_prefix + "eq.mid"            } }
  Wire { from: surface_prefix + "eq.low";     to: DirectPropertyAdapter { path: app_prefix + "eq.low"            } }
  Wire { from: surface_prefix + "filter";     to: DirectPropertyAdapter { path: app_prefix + "fx.adjust"         } }
  Wire { from: surface_prefix + "filter_on";  to: DirectPropertyAdapter { path: app_prefix + "fx.on"             } }
  Wire { from: surface_prefix + "cue";        to: DirectPropertyAdapter { path: app_prefix + "cue"               } }

  // level meter
  LEDLevelMeter { name: "meter"; dBThresholds: [-30,-20,-10,-6,-4,-2,0,2,4,6,8] }
  Wire { from: surface_prefix + "levelmeter"; to: "meter" }
  Wire { from: "meter.level"; to: DirectPropertyAdapter { path: app_prefix + "level.prefader.linear.sum"; input: false } }

  // xfader assign
  Wire { from: surface_prefix + "xfader_assign.left";  to: DirectPropertyAdapter { path: app_prefix + "xfader_assign.left"   } }
  Wire { from: surface_prefix + "xfader_assign.right"; to: DirectPropertyAdapter { path: app_prefix + "xfader_assign.right"  } }

  // fx Assign

 AppProperty { id: mixerFXOn; path: app_prefix + "fx.on" }

 AppProperty { id: mixerFX; path: app_prefix + "fx.select" }

 WiresGroup
 {
   enabled: !channel.shift
   Wire { from: surface_prefix + "fx.assign.1"; to: TogglePropertyAdapter { path: app_prefix + "fx.assign.1"; } }
   Wire { from: surface_prefix + "fx.assign.2"; to: TogglePropertyAdapter { path: app_prefix + "fx.assign.2"; } }
 }

 WiresGroup
 {
   enabled: channel.shift && (!mixerFXOn.value && fxMode.value == FxMode.FourFxUnits)
   Wire { from: surface_prefix + "fx.assign.1"; to: TogglePropertyAdapter { path: app_prefix + "fx.assign.3"; } }
   Wire { from: surface_prefix + "fx.assign.2"; to: TogglePropertyAdapter { path: app_prefix + "fx.assign.4"; } }
 }

 WiresGroup
 {
   enabled: channel.shift && (mixerFXOn.value || fxMode.value == FxMode.TwoFxUnits)
   Wire { from: surface_prefix + "fx.assign.1"; to: ButtonScriptAdapter { onRelease: { mixerFX.value = (mixerFX.value + 4) % 5; } } }
   Wire { from: surface_prefix + "fx.assign.2"; to: ButtonScriptAdapter { onRelease: { mixerFX.value = (mixerFX.value + 1) % 5; } } }
 }

}

I have created a pull request with these changes here Hopefully @kokernutz will approve the changes and apply them to the master branch. I'd love to contribute more to this project :)

skymakai commented 6 years ago

I'll have to try this on the Kontrol S5 and see how it's affected.

kokernutz commented 6 years ago

Thanks for thinking about and working on this! I will review next week when I have some time.

MrPatben8 commented 6 years ago

Alright great! Let me know if there's anything else I can help with.