Can change audio device

This commit is contained in:
Iwan Timmer
2015-05-10 23:55:18 +02:00
parent 3f10389863
commit 073d5f1b3e
3 changed files with 10 additions and 3 deletions

View File

@@ -29,7 +29,7 @@
#define CHANNEL_COUNT 2
#define FRAME_SIZE 240
static const char* device = "default";
const char* audio_device = "sysdefault";
static snd_pcm_t *handle;
static OpusDecoder* decoder;
@@ -47,7 +47,7 @@ static void audio_renderer_init() {
unsigned int sampleRate = SAMPLE_RATE;
/* Open PCM device for playback. */
CHECK_RETURN(snd_pcm_open(&handle, device, SND_PCM_STREAM_PLAYBACK, SND_PCM_NONBLOCK))
CHECK_RETURN(snd_pcm_open(&handle, audio_device, SND_PCM_STREAM_PLAYBACK, SND_PCM_NONBLOCK))
/* Set hardware parameters */
CHECK_RETURN(snd_pcm_hw_params_malloc(&hw_params));

View File

@@ -19,4 +19,6 @@
#include "limelight-common/Limelight.h"
extern const char* audio_device;
extern AUDIO_RENDERER_CALLBACKS audio_callbacks;

View File

@@ -85,6 +85,7 @@ static void help() {
printf("\t-nosops\t\t\tDon't allow GFE to modify game settings\n");
printf("\t-input <device>\t\tUse <device> as input. Can be used multiple times\n");
printf("\t-mapping <file>\t\tUse <file> as gamepad mapping configuration file (use before -input)\n");
printf("\t-audio <device>\t\tUse <device> as ALSA audio output device (default sysdefault)\n");
exit(0);
}
@@ -109,6 +110,7 @@ int main(int argc, char* argv[]) {
{"input", required_argument, 0, 'j'},
{"mapping", required_argument, 0, 'k'},
{"nosops", no_argument, 0, 'l'},
{"audio", required_argument, 0, 'm'},
{0, 0, 0, 0},
};
@@ -119,7 +121,7 @@ int main(int argc, char* argv[]) {
int option_index = 0;
bool sops = true;
int c;
while ((c = getopt_long_only(argc, argv, "-abc:d:efg:h:i:j:k:l", long_options, &option_index)) != -1) {
while ((c = getopt_long_only(argc, argv, "-abc:d:efg:h:i:j:k:lm:", long_options, &option_index)) != -1) {
switch (c) {
case 'a':
config.width = 720;
@@ -159,6 +161,9 @@ int main(int argc, char* argv[]) {
case 'l':
sops = false;
break;
case 'm':
audio_device = optarg;
break;
case 1:
if (action == NULL)
action = optarg;