mirror of
https://github.com/vanilla-wiiu/vanilla.git
synced 2025-01-22 16:21:48 -05:00
got audio working on vanilla-pi
This commit is contained in:
parent
997c4d7543
commit
f6e0945095
1 changed files with 13 additions and 7 deletions
20
rpi/main.c
20
rpi/main.c
|
@ -103,15 +103,19 @@ int decode(const void *data, size_t size)
|
||||||
|
|
||||||
int run_backend(void *data)
|
int run_backend(void *data)
|
||||||
{
|
{
|
||||||
/*SDL_AudioSpec desired = {0};
|
SDL_AudioSpec desired = {0};
|
||||||
desired.freq = 48000;
|
desired.freq = 48000;
|
||||||
desired.format = AUDIO_S16LSB;
|
desired.format = AUDIO_S16LSB;
|
||||||
desired.channels = 2;
|
desired.channels = 2;
|
||||||
|
|
||||||
SDL_AudioDeviceID audio = SDL_OpenAudioDevice(NULL, 0, &desired, NULL, 0);
|
SDL_AudioDeviceID audio = SDL_OpenAudioDevice(NULL, 0, &desired, NULL, 0);
|
||||||
if (!audio) {
|
if (audio) {
|
||||||
|
SDL_PauseAudioDevice(audio, 0);
|
||||||
|
} else {
|
||||||
printf("Failed to open audio device\n");
|
printf("Failed to open audio device\n");
|
||||||
}*/
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
vanilla_event_t event;
|
vanilla_event_t event;
|
||||||
|
|
||||||
|
@ -119,15 +123,17 @@ int run_backend(void *data)
|
||||||
if (event.type == VANILLA_EVENT_VIDEO) {
|
if (event.type == VANILLA_EVENT_VIDEO) {
|
||||||
decode(event.data, event.size);
|
decode(event.data, event.size);
|
||||||
} else if (event.type == VANILLA_EVENT_AUDIO) {
|
} else if (event.type == VANILLA_EVENT_AUDIO) {
|
||||||
/*if (audio) {
|
if (audio) {
|
||||||
SDL_QueueAudio(audio, event.data, event.size);
|
if (SDL_QueueAudio(audio, event.data, event.size) < 0) {
|
||||||
}*/
|
printf("Failed to queue audio\n", event.size);
|
||||||
|
}
|
||||||
|
}
|
||||||
} else if (event.type == VANILLA_EVENT_VIBRATE) {
|
} else if (event.type == VANILLA_EVENT_VIBRATE) {
|
||||||
vibrate = event.data[0];
|
vibrate = event.data[0];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//SDL_CloseAudioDevice(audio);
|
SDL_CloseAudioDevice(audio);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue