[Alsaplayer-devel]libalsaplayer

Andy Lo A Foe andy@alsaplayer.org
Sat, 16 Feb 2002 04:14:31 +0100


Hi,

I just committed code for libalsaplayer to CVS. This means that writing
remote controlling clients has suddenly become a piece of cake.
On a system with libalsaplayer.so installed the following piece of code 
will seek to an arbitrary position (in seconds) in the current song for
example:

-------- seek.c -------------

#include <alsaplayer/control.h>

int main (int argc, char *argv[])
{
        int pos;
        if (argc == 2) {
                pos = atoi(argv[1]);

                if (ap_set_int (0, AP_SET_INT_POS_SECOND, pos) != -1) {
                        printf("Seeked to second %d\n", pos);
                }
        }
  return 0;
}

------------- end -----------

compile: gcc -o seek seek.c -lalsaplayer

I have implemented most of the commands currently defined in the
control.h file. The session code is still setup to support a single
session (and user) at any time, this will change soon.

I have also added a new command line option -e (or --enqueue). When
starting alsaplayer with -e it will try to append the files to the
playlist of the already running alsaplayer process, instead of starting
a whole new copy. This is btw the most requested feature by my wife, it
makes creating playlists on-the-fly very simple, just setup your file
browser to execute alsaplayer -e $file whenever you click an mp3 :-)

Regards,
Andy