mirror of
https://github.com/moonlight-stream/moonlight-embedded.git
synced 2026-02-16 10:30:47 +00:00
Can change audio device
This commit is contained in:
@@ -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));
|
||||
|
||||
@@ -19,4 +19,6 @@
|
||||
|
||||
#include "limelight-common/Limelight.h"
|
||||
|
||||
extern const char* audio_device;
|
||||
|
||||
extern AUDIO_RENDERER_CALLBACKS audio_callbacks;
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user