Profile
- Name
- Band Volume 1.0
- ID
- 48259
- Shared with
- Public
- Parent
- None
- Children
- None
- Created on
- February 17, 2014 at 20:39 PM UTC
- Updated on
- February 17, 2014 at 20:39 PM UTC
- Description
A volume control for bands. Select a band strength from 0 to 10. The initial value is the average strength of all bands. Click "Adjust" to change the strength of all enabled bands. Optionally, check "Include disabled bands?" to change the strength of all bands. Click "Exit" to dismiss the script.
Best for
Code
--[[
* Band Volume
* Original Author: LociOiling
* Version 1.0 February 17, 2014
* adjust band strength
- select strength between 0 and 10
> the initial strength is the average strength of all bands
- disabled bands not adjusted, optionally include disabled bands
- click "Adjust" to apply the change
- click "Exit" to leave the script
]]--
version = '1.0'
title = 'Band Volume v'..version
print ( title )
nBnd = band.GetCount ( )
print ( "number of bands = " .. nBnd )
bStrength = 0
nBndD = 0
for jj = 1, nBnd do
bStrength = bStrength + band.GetStrength ( jj )
if not band.IsEnabled ( jj ) then
nBndD = nBndD + 1
end
end
bStrength = bStrength / nBnd
print ( "average band strength = " .. bStrength )
if nBndD > 0 then
print ( "disabled bands = " .. nBndD )
end
function AskVolume ()
disabledB = false;
local ask = dialog.CreateDialog ( title )
repeat
ask.bStrength = dialog.AddSlider ( "Band strength:", bStrength, 0, 10, 1)
ask.disabledB = dialog.AddCheckbox ( "Include disabled bands?", disabledB )
ask.OK = dialog.AddButton ( "Adjust", 1 )
ask.Cancel = dialog.AddButton ( "Exit", 0 )
askresult = dialog.Show ( ask )
if askresult > 0 then
bStrength = ask.bStrength.value
disabledB = ask.disabledB.value
print ( "adjusting to strength " .. bStrength )
for jj = 1, band.GetCount () do
if band.IsEnabled ( jj ) or disabledB then
band.SetStrength ( jj, bStrength )
end
end
end
until askresult < 1
return
end
AskVolume ()