On Thu, Apr 08, 2010 at 06:51:51AM -0500, Chris Bennett wrote:
> 
> 
> Chris Bennett wrote:
> >>well, on my machine, mplayer does get it's last aucat volume back.
> >>that is, if I start mplayer then set it's aucat volume to 90, then
> >>quit mplayer and start it again later, it's aucat volume is 90.
> >>this works through playlists too.  mplayer's internal volume,
> >>however, gets reset both when stopping/starting and when changing
> >>songs in a playlist.  mplayer's internal volume is what is displayed
> >>by mplayer.
> >>
> >>if you are manipulating aucat volume because you have no hardware
> >>controls, you might find the nmixer program from the mp3blaster
> >>package useful.
> >>
> >Just tried nmixer, but it has same problem as aucatvol.
> >Only works after starting mplayer.

yes.  starting mplayer *once* during the lifetime of the aucat server
process should be enough though.  the volume should not get reset
simply because you closed mplayer and started it again, or because
mplayer closed and reopened it's connection to aucat between songs.
it *does* get reset if you stop and restart the aucat server though.
the volume of the streams is a state of the server, terminate
the server and the state is lost.

so, is this what you have done, and it does not work?  or are you
restarting aucat, or?

I just want to be extra clear on what is supposed to be happening and
what is actually happening.

> >So that isn't a better solution in my case, since I have a
> >"clearer" set of scripts for aucatvol.
> >
> >Worth a try, though
> >
> FWIW, I may as well share the scripts I use
> These don't work perfectly, sometimes aucat keeps its volume.
> I don't know why, using u or d from volumechanger restores order.
> 
> For changing volume, but keeping a record of current setting:
> 
> in .profile:
> pgrep -x aucat || (aucat -l -v 127 && echo '127' > /home/chris/current_vol)

> CURR_VOL=`cat /home/chris/current_vol`

>        -u) RAISE=`expr $CURR_VOL + 8`

that assumes that nothing else is changing the volume, which isn't
necessarily true.

>            `/home/chris101/aucatvol $RAISE`

using aucatvol without the -c option changes the volume for *all*
clients, and why the backticks?

>            echo "$RAISE"  > /home/chris/current_vol

again, that assumes nothing else is changing the volume.

> --------------
> for mplayer
> 
> perl version
> 
> #!/usr/bin/perl
> #
> #       mplayer shuffle playlist and adjust volume
> #
> 
> use warnings;
> use strict;
> 
> use Errno qw (EAGAIN);
> 
> unless ($ARGV[0]) {
>        print "Please enter a playlist\n";
>        open(my $fh, "-|", "find", "/home/chris", "-name", "*\.pls" )
> || die("Unable to open find pipe: $!");
>        while (<$fh>) {
>                print;
>        }
>        close($fh);
>        exit 1;
> }
> my $pid;
> 
> FORK: {
>        if ($pid = fork) {
>                exec "mplayer -shuffle -playlist $ARGV[0]";
>        }
>        elsif (defined $pid) {
>                system "sleep .3";
>                exec "/home/chris/volumechanger -s 31";
>        }
> }
> 
> exit 0;

that sets the volume once, after mplayer has started (assuming .3
seconds is enough time for mplayer to have started), not between
each song of the playlist.

> or shell (I prefer perl, but did this as an exercise)
> 
> #!/bin/bash
> 
> for ((i=0;i<4;i++)); do
>  sleep .1
> /home/chris/volumechanger -s 31
> done &
> 
> mplayer "$@"

and that sets the volume for each client 4 time at .1 second intervals,
not between songs.

if you want to set the initial volume of all aucat clients, you
can do that when you start aucat ...

-- 
jake...@sdf.lonestar.org
SDF Public Access UNIX System - http://sdf.lonestar.org

Reply via email to