How to mute a track from lua?

I have a route object obtained from Session:get_routes():iter()

How can I mute/unmute it?

I’ve tried this:

route:mute_control():set_value(0, PBD.GroupControlDisposition.NoGroup)

and this:

Session:set_controls(route:mute_control(), 0, PBD.GroupControlDisposition.NoGroup)

but I haven’t gotten it working. Can somebody explain what I’m doing wrong?

try

 local ctrls = ARDOUR.ControlListPtr ()
 ctrls:push_back (route:mute_control())
 Session:set_controls (ctrls, 1, PBD.GroupControlDisposition.NoGroup)

see also ardour/share/scripts/mute_all_tracks.lua at master · Ardour/ardour · GitHub

Alternatively use the singular set_control (not controls)

Session:set_control(route:mute_control(), 1, PBD.GroupControlDisposition.NoGroup)

see also ardour/share/scripts/s_track_props.lua at master · Ardour/ardour · GitHub

1 Like

So, referenced to the mute script, this should do the global unmute :

-- of more than one control is to be changed..
if ctrls:size() > 0 then
	-- do it (queue change in realtime-context) set to "0" ; here 'unmuted'
	Session:set_controls (ctrls, 0, PBD.GroupControlDisposition.NoGroup)
end
1 Like

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.