What's new

How can I purge groups on controller callback?

jotapedeside

New Member
Hi
I have a slider that controls the mic volume, and whenever this slider is 0, the mic gets purged. That's workin fine.
I want the user to be able to that mic's volume with the mod controller, but I can't use the purge function on the controller/function callback, which means I can't purge it if the user is controlling the volume via the controller.

Is there a workaround?
 
You don't need purge in the controller callback, it'll just work from the slider callback if you control the slider with a CC.

Purging with sliders that you want to automate is not a great idea though, since the user might interrupt his audio loading or purging, when all he wants to do is fade.
 
Purging with sliders that you want to automate is not a great idea though, since the user might interrupt his audio loading or purging, when all he wants to do is fade.
The purge only happens when the volume is actually 0, so the risk of that happening is basically null.


You don't need purge in the controller callback, it'll just work from the slider callback if you control the slider with a CC.
Maybe I'm doing it wrong then. When my controller reachs 0, the samples aren't purged. I'm not calling the slider callback on the controller, tho. (I'm not sure if that's your idea but I haven't found a way to do it anyway.) That's how I'm doing it.

Code:
on ui_control($mic1)
  $i := $OFFSET_MIC_MIN
  while ($i <= $OFFSET_MIC_MAX-1)
    if ($mic1= 0)
      purge_group($i, 0)
    else
      purge_group($i, 1)
    end if  
    call update_mic1()
    inc($i)
  end while
end on

function update_mic1
  set_engine_par($ENGINE_PAR_VOLUME,  $mic1, -1, 0, $NI_BUS_OFFSET + 0)
end function

on controller
    if ($CC_NUM = 1)
          $mic1 := %CC[$CC_NUM]*1000000/127
          call update_mic1()
    end if
end on
 
If you do it, and save it in the NKI, the user isn't bothered with it.

I think there's no other way, you cannot call purge from the 'on controller' callback...
 
Hi
I have a slider that controls the mic volume, and whenever this slider is 0, the mic gets purged. That's workin fine.
I want the user to be able to that mic's volume with the mod controller, but I can't use the purge function on the controller/function callback, which means I can't purge it if the user is controlling the volume via the controller.

Is there a workaround?
 
You don't need purge in the controller callback, it'll just work from the slider callback if you control the slider with a CC.

Purging with sliders that you want to automate is not a great idea though, since the user might interrupt his audio loading or purging, when all he wants to do is fade.
Sorry to hijack this thread and it‘s a bit off topic. But why are so many people against an automized purge function. It would save me hours, if I could select all tracks in my DAW and send a global purge command instead of selecting dozens of instances and do it one by one. there‘s no need to do this, while while your song is running.
 
Sorry to hijack this thread and it‘s a bit off topic. But why are so many people against an automized purge function. It would save me hours, if I could select all tracks in my DAW and send a global purge command instead of selecting dozens of instances and do it one by one. there‘s no need to do this, while while your song is running.

I totally feel you, man. Seems like they're trying to protect us from "mistakes" and preventing us to learn from them. "Why do you want to do this outside of the box idea? No, you don't need that, trust me."
 
There is a workaround I've played with where you make an endless loop in the persistence changed callback that checks on variables. I'm not sure I'd recommend it because I don't know what the pitfalls of doing this might be, but you could try it.
 
Top Bottom