Old 06-15-2021, 02:25 AM   #1
Ann-82
Human being with feelings
 
Join Date: May 2020
Location: Berlin
Posts: 166
Default Mute and solo aux channels macros

Hi everyone,

i'm working on my mixing template which provides 5 aux channels (such like ALL DRUMS/ALL BASS/ALL MUSIC...) and a final master buss. I would like to create some macros or custom actions for solo and mute these channels with a toolbar bottons avoiding scrolling everytime up and down in my project (i don't use the MCP at all).

I was thinking something like this (Mute example):

SWS: Save current track selection
Script: Lokasenna_Select tracks by name - Select ALL DRUMS.lua
Track: Toggle mute for selected tracks
SWS: Restore saved track selection

The problem is the button has got no toggle state.

Do you any better idea or solution?

Thank you in advance.
Ann-82 is offline   Reply With Quote
Old 06-15-2021, 07:12 AM   #2
Edgemeal
Human being with feelings
 
Edgemeal's Avatar
 
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 3,921
Default

How about scripts, something like,..

Toggle mute track by name,
Code:
-- Example file names for this script,...
-- Toggle mute for track ALL DRUMS.lua
-- Toggle mute for track ALL BASS.lua
-- Toggle mute for track ALL MUSIC.lua

function ToolbarButton(enable)
  local _, _, section_id, command_id = reaper.get_action_context()
  reaper.SetToggleCommandState(section_id, command_id, enable)
  reaper.RefreshToolbar2(section_id, command_id)
end

local name = ({reaper.get_action_context()})[2]:match("([^/\\_]+).lua$")
local find_track = name:match(" track (.*)")
if find_track ~= nil then 
  for i = 0, reaper.CountTracks(0) - 1 do
    local track = reaper.GetTrack(0, i)
    local _, track_name = reaper.GetTrackName(track, '')
    if track_name:match(find_track) then
      local mute = math.abs(1-reaper.GetMediaTrackInfo_Value(track, "B_MUTE"))
      reaper.SetMediaTrackInfo_Value(track, "B_MUTE", mute) 
      ToolbarButton(mute) -- highlight button when track mute
    end
  end
end
Toggle solo track by name,
Code:
-- Example file names for this script,...
-- Toggle solo for track ALL DRUMS.lua
-- Toggle solo for track ALL BASS.lua
-- Toggle solo for track ALL MUSIC.lua

function ToolbarButton(enable)
  local _, _, section_id, command_id = reaper.get_action_context()
  reaper.SetToggleCommandState(section_id, command_id, enable)
  reaper.RefreshToolbar2(section_id, command_id)
end

local name = ({reaper.get_action_context()})[2]:match("([^/\\_]+).lua$")
local find_track = name:match(" track (.*)")
if find_track ~= nil then 
  for i = 0, reaper.CountTracks(0) - 1 do
    local track = reaper.GetTrack(0, i)
    local _, track_name = reaper.GetTrackName(track, '')
    if track_name:match(find_track) then
      local solo = math.abs(1-reaper.GetMediaTrackInfo_Value(track, "I_SOLO"))
      reaper.SetMediaTrackInfo_Value(track, "I_SOLO", solo) 
      ToolbarButton(solo) -- highlight button when track solo
    end
  end
end

Last edited by Edgemeal; 06-15-2021 at 07:23 AM.
Edgemeal is offline   Reply With Quote
Old 06-16-2021, 02:20 AM   #3
Ann-82
Human being with feelings
 
Join Date: May 2020
Location: Berlin
Posts: 166
Default

Quote:
Originally Posted by Edgemeal View Post
How about scripts, something like,..

Toggle mute track by name,
Code:
-- Example file names for this script,...
-- Toggle mute for track ALL DRUMS.lua
-- Toggle mute for track ALL BASS.lua
-- Toggle mute for track ALL MUSIC.lua

function ToolbarButton(enable)
  local _, _, section_id, command_id = reaper.get_action_context()
  reaper.SetToggleCommandState(section_id, command_id, enable)
  reaper.RefreshToolbar2(section_id, command_id)
end

local name = ({reaper.get_action_context()})[2]:match("([^/\\_]+).lua$")
local find_track = name:match(" track (.*)")
if find_track ~= nil then 
  for i = 0, reaper.CountTracks(0) - 1 do
    local track = reaper.GetTrack(0, i)
    local _, track_name = reaper.GetTrackName(track, '')
    if track_name:match(find_track) then
      local mute = math.abs(1-reaper.GetMediaTrackInfo_Value(track, "B_MUTE"))
      reaper.SetMediaTrackInfo_Value(track, "B_MUTE", mute) 
      ToolbarButton(mute) -- highlight button when track mute
    end
  end
end
Toggle solo track by name,
Code:
-- Example file names for this script,...
-- Toggle solo for track ALL DRUMS.lua
-- Toggle solo for track ALL BASS.lua
-- Toggle solo for track ALL MUSIC.lua

function ToolbarButton(enable)
  local _, _, section_id, command_id = reaper.get_action_context()
  reaper.SetToggleCommandState(section_id, command_id, enable)
  reaper.RefreshToolbar2(section_id, command_id)
end

local name = ({reaper.get_action_context()})[2]:match("([^/\\_]+).lua$")
local find_track = name:match(" track (.*)")
if find_track ~= nil then 
  for i = 0, reaper.CountTracks(0) - 1 do
    local track = reaper.GetTrack(0, i)
    local _, track_name = reaper.GetTrackName(track, '')
    if track_name:match(find_track) then
      local solo = math.abs(1-reaper.GetMediaTrackInfo_Value(track, "I_SOLO"))
      reaper.SetMediaTrackInfo_Value(track, "I_SOLO", solo) 
      ToolbarButton(solo) -- highlight button when track solo
    end
  end
end
Hi Edgemeal, thank you a lot for your script! I've created a new reascript from the action list and i paste your script inside. But i still can't figure out how to make it works. Did i miss something? Sorry i'm really bad in understanding scripts
Ann-82 is offline   Reply With Quote
Old 06-16-2021, 03:53 AM   #4
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,630
Default

When creating the new script, you name the scripts according to the following rules:

For mute:
Toggle mute for track Trackname.lua

Where you substitute the word Trackname with the name of the track that shall be muted.
So if you want to mute tracks with trackname "This is awesome music" in its name you name the script:

Toggle mute for track This is awesome music.lua

For solo:
The same, but you name it like

Toggle solo for track Trackname.lua

So for tracks with

"This is awesome music"

in their name, you name the script:

Toggle solo for track This is awesome music.lua

@Edgemeal
The scripts seem to be case sensitive. So maybe, you can improve on that. Especially as Windows doesn't allow

Filename.lua

and

filename.lua

being different files which would break things.
__________________
Use you/she/her.Ultraschall-Api Lua Api4Reaper - Donate, if you wish

On vacation for the time being...

Last edited by Meo-Ada Mespotine; 06-16-2021 at 03:58 AM.
Meo-Ada Mespotine is offline   Reply With Quote
Old 06-16-2021, 04:07 AM   #5
Ann-82
Human being with feelings
 
Join Date: May 2020
Location: Berlin
Posts: 166
Default

Quote:
Originally Posted by Meo-Ada Mespotine View Post
When creating the new script, you name the scripts according to the following rules:

For mute:
Toggle mute for track Trackname.lua

Where you substitute the word Trackname with the name of the track that shall be muted.
So if you want to mute tracks with trackname "This is awesome music" in its name you name the script:

Toggle mute for track This is awesome music.lua

For solo:
The same, but you name it like

Toggle solo for track Trackname.lua

So for tracks with

"This is awesome music"

in their name, you name the script:

Toggle solo for track This is awesome music.lua

@Edgemeal
The scripts seem to be case sensitive. So maybe, you can improve on that. Especially as Windows doesn't allow

Filename.lua

and

filename.lua

being different files which would break things.
Hallo Meo-Ada mespotine, thank you, now is working great!

The only problem is that the script doesn't mirror the actual state of the track. For example in a situation where i open a different project the toolbar doesn't show me if some channel was set to mute or solo. Is there any work around possible? Thank you!!
Ann-82 is offline   Reply With Quote
Old 06-16-2021, 10:10 AM   #6
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,630
Default

Quote:
Originally Posted by Ann-82 View Post
Hallo Meo-Ada mespotine, thank you, now is working great!

The only problem is that the script doesn't mirror the actual state of the track. For example in a situation where i open a different project the toolbar doesn't show me if some channel was set to mute or solo. Is there any work around possible? Thank you!!
This would need a background-script that runs permanently, that looks in the current project, if any track is solo/muted and set the toolbar-buttons in that case.
The scripts only work, when you run them in the project you had opened in that moment.
In between two runs, it will not do anything, including resetting the toolbar-buttons(must be one programmatically).

Could be doable, but it must be started everytime Reaper is started for it to work(as startup-action probably).
__________________
Use you/she/her.Ultraschall-Api Lua Api4Reaper - Donate, if you wish

On vacation for the time being...
Meo-Ada Mespotine is offline   Reply With Quote
Old 06-16-2021, 11:34 PM   #7
Ann-82
Human being with feelings
 
Join Date: May 2020
Location: Berlin
Posts: 166
Default

Quote:
Originally Posted by Meo-Ada Mespotine View Post
This would need a background-script that runs permanently, that looks in the current project, if any track is solo/muted and set the toolbar-buttons in that case.
The scripts only work, when you run them in the project you had opened in that moment.
In between two runs, it will not do anything, including resetting the toolbar-buttons(must be one programmatically).

Could be doable, but it must be started everytime Reaper is started for it to work(as startup-action probably).
Ok, i understand, this sounds much more complex. I guess i will keep it simple for now following the script of edgemeal, probably is more then enough thank you a lot.
Ann-82 is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 05:47 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.