deprecate execfuse/autosshfs in favor of autosshfs-mount script
[hband-tools.git] / libasound-plugins / libasound-getprogname.c
blob07ec1533ab101bbb2e41d1ccd35c08de37f14115
2 /*
3 DESCRIPTION
5 This libasound (ALSA) configuration plugin provides "getprogname" @func function.
6 It enables you to have eg. a softvolume control channel for each program.
7 When a new control is created, the client program have to stop+play or restart,
8 otherwise the control's volume level can not be changed. Tough, it works great at
9 the second time.
10 The created control stays there after the program exists.
12 EXAMPLE
14 ~/.asoundrc:
16 pcm.softvol0 {
17 type softvol
18 slave.pcm "hw:0"
19 control {
20 name {
21 @func getprogname
22 default "SoftVolume0"
24 card hw
25 device 0
29 func.getprogname {
30 lib "/usr/src/alsa-lib-1.0.25/libasound-getprogname.so"
31 func "snd_func_getprogname"
34 BUILD
36 Compile against alsa-lib-1.0.25
38 if libtool acts weirdly, it may forgot that $ECHO is $echo ... or the other way around...
41 # not good
42 #gcc -Iinclude/ -lbsd libasound-getprogname.c -o libasound-getprogname.so -shared -fPIC -Wl,--version-script=libasound-getprogname.ver
44 # less wrong? it worked anyway...
45 mkdir .libs
46 ./libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -Wall -g -I./include/ \
47 -D_GNU_SOURCE -g -O2 -MD -MP -c -o libasound-getprogname.lo libasound-getprogname.c
48 gcc -shared -lbsd -lasound .libs/libasound-getprogname.o -o libasound-getprogname.so
51 #include <bsd/stdlib.h>
53 #include "include/local.h"
55 int snd_func_getprogname(snd_config_t **dst, snd_config_t *root ATTRIBUTE_UNUSED,
56 snd_config_t *src, snd_config_t *private_data ATTRIBUTE_UNUSED)
58 const char *id;
59 int err = snd_config_get_id(src, &id);
60 if (err < 0) return err;
62 char *progname = getprogname();
63 return snd_config_imake_string(dst, id, progname);
66 SND_DLSYM_BUILD_VERSION(snd_func_getprogname, SND_CONFIG_DLSYM_VERSION_EVALUATE);