Can change audio device

This commit is contained in:
Iwan Timmer committed 2015-05-10 23:56:42 +02:00
1 parent 3f10389863
commit 073d5f1b3e
3 files changed
+10 -3

No files matched your search

+2 -2
View File
@@ -29,7 +29,7 @@
#define CHANNEL_COUNT 2 #define CHANNEL_COUNT 2
#define FRAME_SIZE 240 #define FRAME_SIZE 240
static const char* device = "default"; const char* audio_device = "sysdefault";
static snd_pcm_t *handle; static snd_pcm_t *handle;
static OpusDecoder* decoder; static OpusDecoder* decoder;
@@ -47,7 +47,7 @@ static void audio_renderer_init() {
unsigned int sampleRate = SAMPLE_RATE; unsigned int sampleRate = SAMPLE_RATE;
/* Open PCM device for playback. */ /* 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 */ /* Set hardware parameters */
CHECK_RETURN(snd_pcm_hw_params_malloc(&hw_params)); CHECK_RETURN(snd_pcm_hw_params_malloc(&hw_params));
+2
View File
@@ -19,4 +19,6 @@
#include "limelight-common/Limelight.h" #include "limelight-common/Limelight.h"
extern const char* audio_device;
extern AUDIO_RENDERER_CALLBACKS audio_callbacks; extern AUDIO_RENDERER_CALLBACKS audio_callbacks;
+6 -1
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-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-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-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); exit(0);
} }
@@ -109,6 +110,7 @@ int main(int argc, char* argv[]) {
{"input", required_argument, 0, 'j'}, {"input", required_argument, 0, 'j'},
{"mapping", required_argument, 0, 'k'}, {"mapping", required_argument, 0, 'k'},
{"nosops", no_argument, 0, 'l'}, {"nosops", no_argument, 0, 'l'},
{"audio", required_argument, 0, 'm'},
{0, 0, 0, 0}, {0, 0, 0, 0},
}; };
@@ -119,7 +121,7 @@ int main(int argc, char* argv[]) {
int option_index = 0; int option_index = 0;
bool sops = true; bool sops = true;
int c; 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) { switch (c) {
case 'a': case 'a':
config.width = 720; config.width = 720;
@@ -159,6 +161,9 @@ int main(int argc, char* argv[]) {
case 'l': case 'l':
sops = false; sops = false;
break; break;
case 'm':
audio_device = optarg;
break;
case 1: case 1:
if (action == NULL) if (action == NULL)
action = optarg; action = optarg;