# Bus Solo/Mute... again...



## Nimbus Audio (May 5, 2014)

Hi, I've been trying to write a solo/mute script for the Bus section of Kontakt & quite honestly am getting nowhere fast. 

Could somebody please help me out & shed any light on how to do this....?

*I have read the other 2 main posts on this forum relating to Solo scripts but they don't resolve the issue for me as they refer to a multi script, and the allow/disallow groups method. 

I'm assuming the 'Bus Solo' button in the bus section isn't accessible 'yet' through KSP (?), so I'm guessing the only way to do this is by controlling the Bypass state of something like a Gainer effect in the last effect slot of the bus section. 

* Studio Drummer handles solo/mutes in a way similar to this apparently, but I don't have that script to study over, so......

I could code simply to have a solo button activate 'muted' Gainer effects on all buses except the one I want to hear/solo. This isn't really ideal, what I need is a method to latch solo/mute where I can simultaneously solo/unsolo/mute more the one bus at any time (Just like on a normal mixer).

I'm guessing that the mute button would also need to be controlling the Gainer effect's bypass state?

I wish I could post up a script giving an example of how far I've got in my failed attempts, but I have nothing...

This really has been confusing me and melting my brain for weeks now....ha ha.

Any help with this would be much appreciated

Thx

ASiAM.


----------



## Big Bob (May 5, 2014)

Hey Asiam,

Rather than me outlining the process, my buddy Tod is the guy you want to communicate with about this. I happen to know that he's in the middle of a fairly ambitious scripting project that neatly implements the Solo/Mute function for the K5 bus structure.

So, I'll point him to your thread and he can tell you first hand the pros and cons of doing this in various way. To be continued ...

Rejoice,

Bob


----------



## Nimbus Audio (May 5, 2014)

Many thx, that would be a massive help.

ASiAM.


----------



## Tod (May 5, 2014)

Nimbus Audio @ Mon May 05 said:


> I'm assuming the 'Bus Solo' button in the bus section isn't accessible 'yet' through KSP (?), so I'm guessing the only way to do this is by controlling the Bypass state of something like a Gainer effect in the last effect slot of the bus section.



Hi Asiam,

Basically that's what I'm doing, bypassing the Gainer that's set up as a FX on each bus.



> I could code simply to have a solo button activate 'muted' Gainer effects on all buses except the one I want to hear/solo. This isn't really ideal, what I need is a method to latch solo/mute where I can simultaneously solo/unsolo/mute more the one bus at any time (Just like on a normal mixer).



Actually I haven't found this to be a problem, I can mute or solo any output at will. I will say I've got it set up so that I can have solo and mute on at the same time but solo takes precedence over the mute button/switch so I don't find that to be a problem, as soon as I unsolo it it's muted again. 



> I'm guessing that the mute button would also need to be controlling the Gainer effect's bypass state?



I think the best way to put this is that there really is no solo, we actually only have mutes. 

The way I've got this set up (and I have to tell you my good friend Bob helped me a great deal with this) is that when ever a solo or mute is activated, the mute status for all the buses are scanned using a NI FUNCTION. That way you don't have to keep track of a bunch of complicated variables, I think it's fast enough and it's precise. 

This is all for the mixer portion of the library. I've also got separate nkis for the individual kit pieces and I'm using bus-16 for that. Instead of using the allow disallow I'm simply sending them to bus-16 which has it's volume turned off as well as a Gainer on it. 

I hope this helps, I've got a ways to go to completely finish the library so it will be a while before I can check this out in it's final stages.


----------



## Nimbus Audio (May 5, 2014)

Hi, thx for the reply.

It seems I'm on the right track, & what you said makes sense.

I'll give it a try & see what happens.

Could you explain a bit more about the FUNCTION part of your post. I'm unfamiliar with using functions as yet.

Is this to stop any odd behaviour between the mute/solo relationship occurring when both buttons are pressed?

Many thx


----------



## Tod (May 5, 2014)

Nimbus Audio @ Mon May 05 said:


> Hi, thx for the reply.
> 
> Could you explain a bit more about the FUNCTION part of your post. I'm unfamiliar with using functions as yet.
> 
> Is this to stop any odd behaviour between the mute/solo relationship occurring when both buttons are pressed?



When I say NI FUNCTION I'm referring to built in functions that you can call on for various things, kind of a subroutine. You have to use a *call* statement, in the case of my mute-solo function I called it mute_solo so I use "call mute_solo" to invoke it. I think these FUNCTIONS came about with K4.

No, there really is no odd behavior between the mute/solo relationship. Like I said solo takes precedence over mute so that even if it looks muted while it's soloed, it's still unmuted as long as the solo button/switch is on.

In my case, when a solo or a mute button is pushed, a variable is sent to the mute_solo function the tells it whether it's a mute or a solo as well as which one it is. 

Like I said it's been a while since I visited it but I'll see if I can come up with something more for you tomorrow if you still have questions. I'll have to take a closer look at the scripting. :D


----------



## Lindon (May 6, 2014)

Actually you dont (I think) need to keep a state variable, the gainer state will tell you if its muted or not, and so will the mute and solo buttons on your interface.

I assume (of course) that you are attempting to provide some sort of mixer interface like this:

http://drumdrops.com/uploads/images/Mixer%20with%20Audio.jpg (http://drumdrops.com/uploads/images/Mix ... 0Audio.jpg)

Which implements the latching solo/mute functionality on each bus with a gainer as Tod describes, tho to be frank I'm thinking of changing it to directly manage the volume levels on the actual instrument groups themselves to give me one more effect spot in each bus...

Lindon


----------



## Big Bob (May 6, 2014)

> Actually you dont (I think) need to keep a state variable



No, you don't have to keep a separate state variable, but, there are a lot of advantages to doing so. If you use indexing techniques, keeping the state variables in an array results in much simpler code for tests like 'are there any solo buttons down at the moment' because you can use the KSP array *search* function to great advantage.

Rejoice,

Bob

BTW Lindon, that's a pretty nice looking panel, did you do all the graphics yourself?


----------



## Tod (May 6, 2014)

Okay, mine isn't near a fancy as Lindon's and it's still just in the mockup stage. I've got a lot more to add to it like Mute/UnMute all, and porbably Solo/UnSolo all. Also maybe output assignments.

This is a short little video of how it looks at this point.

http://youtu.be/oChozymlSBY

This is how the compiled code for the function and solo / mute on ui_controls looks.


```
function mute_solo

  if ($Cur_But>8) 
  {Get current state of solo button and change the font for the changed button state}
    %SoloBtns[$Cur_But-8] := get_control_par(%SoloID[$Cur_But-8],$CONTROL_PAR_VALUE) 
    set_control_par(%SoloID[$Cur_But-8],$CONTROL_PAR_FONT_TYPE,%SoloFont[get_control_par(%SoloID[$Cur_But-8],$CONTROL_PAR_VALUE)])
  else 
  {Get current state of mute button and change the font for the changed button state}
    %MuteBtns[$Cur_But] := get_control_par(%MuteID[$Cur_But],$CONTROL_PAR_VALUE)
    set_control_par(%MuteID[$Cur_But],$CONTROL_PAR_FONT_TYPE,%MuteFont[get_control_par(%MuteID[$Cur_But],$CONTROL_PAR_VALUE)])
    set_control_par(%OutID[0],$CONTROL_PAR_PICTURE_STATE,%MuteBtns[0])
  end if

    
    {Scans the solo buttons and sets them all to their current state}
  $Cur_But := 1
  while ($Cur_But<=8)
    if (search(%SoloBtns,1)<0)
      set_engine_par($ENGINE_PAR_EFFECT_BYPASS,1-%MuteBtns[$Cur_But],-1,0,$NI_BUS_OFFSET+$Cur_But-1)
    else
      set_engine_par($ENGINE_PAR_EFFECT_BYPASS,%SoloBtns[$Cur_But],-1,0,$NI_BUS_OFFSET+$Cur_But-1)
    end if
    set_control_par(%OutID[$Cur_But],$CONTROL_PAR_PICTURE_STATE,$Cur_But*%MuteBtns[0])
    set_engine_par($ENGINE_PAR_OUTPUT_CHANNEL,$Cur_But*%MuteBtns[0]-1,-1,-1,$NI_BUS_OFFSET+$Cur_But-1)
    inc($Cur_But)
  end while
end function

on ui_control($Mute1)
  $Cur_But := 1
  call mute_solo
end on

on ui_control($Solo1)
  $Cur_But := 9
  call mute_solo
end on
```


----------



## Nimbus Audio (May 6, 2014)

A traditional mixer layout is exactly what i'm doing.
I'll post up a pic once I get these buttons on the gui.

I'll be bk on with this tomorrow to see if I can get it working.

Thx for the help everyone that replied.

ASiAM.


----------



## Lindon (May 7, 2014)

Well I cant claim the look of "mine" is me at all, I did the instrument design and original layouts, but all the individual images(buttons, sliders etc.) were re-done by a graphic designer. The mixer is where you see the smallest of my influence on the "the look" these days, the sequencer, midi player and kit pages more so, still if you are interested the code base is license-able...


----------

