Simple Volume Control

By Viper01 on Nov 06, 2009

Mostly a product of boredom, but I thought I'd make a Volume Control dialog for practice. To use, load into a new Remotes file and right-click in a channel, then select 'Volume Control'. Drag the bar to the right to increase the volume, and to the left to decrease it.

Couldn't figure out how to incorporate a Mute/Unmute function, so if anyone wants to lend me some assistance, I'll incorporate it. :)

Edit: Got a Mute/Unmute function working now, posted updated code.

;Simple Volume Control 
;by Zericho
;irc.rizon.net #Oni

menu channel {
  Volume Control:dialog -dm vol vol
}
dialog Vol {
  title "Volume Control"
  size -1 -1 245 23
  option dbu
  button "Mute/Unmute", 13, 202 4 40 15
  scroll "", 12, 4 -7 195 23, horizontal range 0 65535
}

on *:dialog:vol:init:0: {
  did -c $dname 12 $vol(master)
}

on *:dialog:vol:scroll:12: { 
  vol -v $did($did).sel 
}

on *:dialog:vol:sclick:13: {
  if ($vol(master).mute == $true) {
    /vol -vu2
    /did -u $dname 13
    /did -e $dname 12
  }
  elseif ($vol(master).mute == $false) {
    /vol -vu1
    /did -b $dname 12
  }
}

Comments

Sign in to comment.
Viper01   -  Oct 04, 2010

got around to adding a mute/unmute function, posted edited code.

 Respond  
Scakk   -  Nov 08, 2009
dialog Vol {
  title "Volume Control"
  size -1 -1 100 210
  option dbu
  scroll "", 12, 5 10 23 195, vertical range 0 65535
}

Vertical. Can not max the max at the top.

 Respond  
sunslayer   -  Nov 08, 2009

i tried but i don't think its possible to get max at top :/

 Respond  
eL^Topo   -  Nov 08, 2009

Thank you too sunslayer, but max volume isn't upwards :)

 Respond  
sunslayer   -  Nov 07, 2009

replace the dialog with this

dialog Vol {
  title "Volume Control"
  size -1 -1 54 205
  option dbu
  scroll "", 12, 21 4 9 195, range 0 65535
}
 Respond  
eL^Topo   -  Nov 07, 2009

Nice... Thanks
Is there any way to make it vertical with max vol upwards?

 Respond  
Scakk   -  Nov 06, 2009

According to the Help Files

The -uN switch sets the mute setting, where N = 1 is on, N = 2 is off.
 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.