Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Control XMMS Volume
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Multimedia
View previous topic :: View next topic  
Author Message
Dark Ninja
Tux's lil' helper
Tux's lil' helper


Joined: 31 Jan 2005
Posts: 127

PostPosted: Fri Feb 04, 2005 9:32 pm    Post subject: Control XMMS Volume Reply with quote

Is there any way to control XMMS w/out actually having to use the main XMMS window and move the slider up and down (either with the mouse or arrow keys). Right now, I can control XMMS via my keyboard using keybindings to XMMS' commands xmms -p, xmms -r, etc.

I was wondering if there was a way to control volume the same way. Thanks
Back to top
View user's profile Send private message
sammalpa
n00b
n00b


Joined: 30 Jan 2005
Posts: 38
Location: Helsinki, Finland

PostPosted: Fri Feb 04, 2005 9:36 pm    Post subject: Reply with quote

At least for me also scroll-wheel on top of the xmms main-window does the trick..
Back to top
View user's profile Send private message
Dark Ninja
Tux's lil' helper
Tux's lil' helper


Joined: 31 Jan 2005
Posts: 127

PostPosted: Fri Feb 04, 2005 9:39 pm    Post subject: Reply with quote

Ah...sorry, I didn't specify quite what I meant.

When I'm working on another virtual desktop, I can just hit Ctrl+V to fast forward to the next song without having to switch back to the desktop that XMMS is on (which is a slight hassle). I would like to be able to do the same thing with sound. I'm just not sure what I'd bind the keys to (if anything).

Thanks
Back to top
View user's profile Send private message
sammalpa
n00b
n00b


Joined: 30 Jan 2005
Posts: 38
Location: Helsinki, Finland

PostPosted: Fri Feb 04, 2005 9:52 pm    Post subject: Reply with quote

Ah, silly me..

I recall using something called 'lineakd' earlier on my debian box at work with some multimedia keyboard.. that enables some ways to control the volume, don't know / recall very well anymore how that worked..

or you can use 'aumix -v75' to set volume to 75% etc.. propably some l33t hax0r can build some cools script around this as well..

(edited to add the aumix idea that I just realized..)
Back to top
View user's profile Send private message
ppurka
Advocate
Advocate


Joined: 26 Dec 2004
Posts: 3256

PostPosted: Fri Feb 04, 2005 10:30 pm    Post subject: Reply with quote

If you are using alsa, u can bind the following commands to some keys:
Code:
amixer sset 'PCM' 5%+      ------- for increasing volume
amixer sset 'PCM' 5%-      ------- for decreasing volume

HTH
Back to top
View user's profile Send private message
Dark Ninja
Tux's lil' helper
Tux's lil' helper


Joined: 31 Jan 2005
Posts: 127

PostPosted: Fri Feb 04, 2005 10:32 pm    Post subject: Reply with quote

Woo hoo!

Exactly what I was looking for. Thank you!

[edit]
BTW - Slight command change. Remove the % sign for the command to work. Weird thing, though, the volume will go up and down by 3% with this command. Very confusing, but acceptable.
[/edit]
Back to top
View user's profile Send private message
pdr
l33t
l33t


Joined: 20 Mar 2004
Posts: 618

PostPosted: Sat Feb 05, 2005 6:58 pm    Post subject: Reply with quote

I've got multimedia keyboard and remote control set to send XF86AudioLowerVolume and XF86AudioRaiseVolume when I click the down/up volume buttons. In fluxbox keys file, I bind them to "amixer set Master 10+" or "amixer set Master 10-".

For the mute toggle buttons (mapped to XF86AudioMute), I had to write a script that stores the current volume and either does "amixer set Master 0" or "amixer set Master <stored volume>". This is because at some point using "amixer set Master mute" and "amixer set Master unmute" because unsupported in emu10k1...
Back to top
View user's profile Send private message
TerminalAddict
Tux's lil' helper
Tux's lil' helper


Joined: 13 Feb 2003
Posts: 119

PostPosted: Sat Feb 19, 2005 1:47 pm    Post subject: Reply with quote

pdr wrote:
I've got multimedia keyboard and remote control set to send XF86AudioLowerVolume and XF86AudioRaiseVolume when I click the down/up volume buttons. In fluxbox keys file, I bind them to "amixer set Master 10+" or "amixer set Master 10-".

For the mute toggle buttons (mapped to XF86AudioMute), I had to write a script that stores the current volume and either does "amixer set Master 0" or "amixer set Master <stored volume>". This is because at some point using "amixer set Master mute" and "amixer set Master unmute" because unsupported in emu10k1...


fancy sharing that script :)
Back to top
View user's profile Send private message
pdr
l33t
l33t


Joined: 20 Mar 2004
Posts: 618

PostPosted: Mon Feb 21, 2005 1:05 pm    Post subject: Reply with quote

Code:
#!/bin/sh

# Get the current volume setting
VOLUME=`amixer sget Master | grep 'Mono: Playback' | sed 's/^[^[]*\[\([^%]*\).*$/\1/'`

# If current muted then...
if [ "$VOLUME" = "0" ]; then
        # If we have the old volume stored, use it and delete
        if [ -f ~/.fluxbox/last_volume ]; then
                LASTVOLUME=`cat ~/.fluxbox/last_volume`
                rm ~/.fluxbox/last_volume
        # Otherwise, just set to 50% volume
        else
                LASTVOLUME="50"
        fi
        # Change volume
        amixer -q set Master $LASTVOLUME > /dev/null
# If not currently muted then save current volume and mute
else
        echo "$VOLUME" > ~/.fluxbox/last_volume
        amixer -q set Master 0 > /dev/null
fi


Note that the file ~/.fluxbox/last_volume - as in "if [ -f ~/.fluxbox/last_volume ]; then" - is where I am storing the last volume setting. It is hard-coded because this script was written for me :) . You may want to put it elsewhere, especially if you are not using fluxbox...

The only thing still remaining with this is that I want an OSD to pop up when I change the volume or toggle mute. With my last system I just used xosd, but (1) I did nothing "of interest" to kill an xosd that was currently on screen, so clicking quickly put up multiple messages that looked like they were overwriting each other, and (2) the reason for my new installation was to get rid of bloat (ie KDE :) ) that had crept in; don't want the gnome-libs that are required for xosd. So have to write something like xosd that is lighter weight and can be signalled to update itself instead of popping up new instances on top of each other.

[edit]

Well, it seems that xosd doesn't HAVE to be a resource pig; it is the xmms support that used gdk-pixbuf, and thus required gnome-libs. If you set -xmms for it in /etc/portage/package.use then there were no added requirements for me (your mileage may vary - I've already emerged gtk and some other support builds).

I found that fluxbox didn't want to allow me to run two commands in keys (via ExecCommand, and separating the commands with a semi-colon) so I ended up with separate scripts to raise/lower volume which (1) use amixer to set the volume, and (2) call another script called "show_volume". Also modified the above toggle_mute script to append a call to ~/.fluxbox/show_volume at the bottom of the script.

The show_volume script just gets the volume from amixer, calls killall to kill all current instances of osd_cat, and then calls osd_cat to display the current volume for 5 seconds. The only thing I'm not happy with is (1) I have a separate raise_volume and lower_volume scripts which could/will be combined into one called "change_volume" and I pass in values like "10+" as a parameter; and (2) the killall call is writing info about the killed instance to the terminal I ran startx in, so that when I leave X I've got a bunch of messages on the screen that I don't want to see.
Back to top
View user's profile Send private message
pianosaurus
l33t
l33t


Joined: 19 Apr 2004
Posts: 944
Location: Bash$

PostPosted: Sat Apr 23, 2005 9:02 pm    Post subject: Reply with quote

Umm, pdr? Couldn't you just use amixer set Master toggle? It will mute the channel without mucking with the volume, so running the same command again will reset to the volume it was on. Or does your script do something else too?
_________________
PKA Cuber
Please add [SOLVED] to the subject of your original post when you feel that your problem is resolved.
Adopt an unanswered post
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Multimedia All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum