Skip to content

Commit

Permalink
Pulseaudio mode now selected with the configuration
Browse files Browse the repository at this point in the history
file parameter sound_device
  • Loading branch information
rubund committed Jul 17, 2012
1 parent b0dca3d commit 6d62e44
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 11 deletions.
5 changes: 3 additions & 2 deletions gnuais.conf-example
Expand Up @@ -9,7 +9,8 @@ MyEmail gnuais@example.com
# Directory, where logs will be written. Defaults to current directory.
#LogDir logs

# ALSA sound device name, either the name of the card (default for the
# ALSA sound device name or "pulse" for pulseaudio,
# If alsa is used: either the name of the card (default for the
# first / default card), or a device name, for example: hw:2,0 for the first
# input of the third card.
SoundDevice default
Expand Down Expand Up @@ -59,4 +60,4 @@ SoundLevelLog 1
#serial_port /dev/ttyS0

# Use test file as input instead of the audio device input
#SoundInFile testmessages/gnuais-stereo-2rx.raw
#SoundInFile ../testmessages/gnuais-stereo-2rx.raw
6 changes: 3 additions & 3 deletions src/ais.c
Expand Up @@ -109,7 +109,7 @@ int main(int argc, char *argv[])
channels = 1;
}
#ifdef HAVE_PULSEAUDIO
if(pulseaudio != NULL){
if((strcmp("pulse",sound_device) == 0) || (strcmp("pulseaudio",sound_device) == 0)){
if((pa_dev = pulseaudio_initialize()) == NULL){
hlog(LOG_CRIT, "Error opening pulseaudio device");
return -1;
Expand Down Expand Up @@ -180,7 +180,7 @@ int main(int argc, char *argv[])
done = 1;
}
#ifdef HAVE_PULSEAUDIO
else if (pulseaudio){
else if (pa_dev){
buffer_read = pulseaudio_read(pa_dev, buffer, buffer_l);
}
#endif
Expand Down Expand Up @@ -219,7 +219,7 @@ int main(int argc, char *argv[])
fclose(sound_in_fd);
}
#ifdef HAVE_PULSEAUDIO
else if (pulseaudio) {
else if (pa_dev) {
pulseaudio_cleanup(pa_dev);
}
#endif
Expand Down
3 changes: 0 additions & 3 deletions src/cfg.c
Expand Up @@ -62,8 +62,6 @@ char *sound_out_file;
int sound_channels = SOUND_CHANNELS_MONO;
int sound_levellog = 0;

char *pulseaudio;

char *mysql_host;
char *mysql_db;
char *mysql_user;
Expand Down Expand Up @@ -110,7 +108,6 @@ static struct cfgcmd cfg_cmds[] = {
{ "mysql_keepsmall", _CFUNC_ do_toggle, &mysql_keepsmall },
{ "mysql_oldlimit", _CFUNC_ do_int, &mysql_oldlimit },

{ "pulseaudio", _CFUNC_ do_string, &pulseaudio },
{ "sounddevice", _CFUNC_ do_string, &sound_device },
{ "soundinfile", _CFUNC_ do_string, &sound_in_file },
{ "soundoutfile", _CFUNC_ do_string, &sound_out_file },
Expand Down
2 changes: 0 additions & 2 deletions src/cfg.h
Expand Up @@ -53,8 +53,6 @@ extern int verbose;
extern char *mycall;
extern char *myemail;

extern char *pulseaudio;

extern char *sound_device;
extern char *sound_in_file;
extern char *sound_out_file;
Expand Down
3 changes: 2 additions & 1 deletion src/gnuais.conf
Expand Up @@ -9,7 +9,8 @@ MyEmail gnuais@example.com
# Directory, where logs will be written. Defaults to current directory.
#LogDir logs

# ALSA sound device name, either the name of the card (default for the
# ALSA sound device name or "pulse" for pulseaudio,
# If alsa is used: either the name of the card (default for the
# first / default card), or a device name, for example: hw:2,0 for the first
# input of the third card.
SoundDevice default
Expand Down

0 comments on commit 6d62e44

Please sign in to comment.