Fix wrong usage of audio_info_t and audio_prinfo_t

This commit is contained in:
John Lorentzson 2025-04-17 18:32:02 +02:00
parent 62898c85f8
commit abdfcf2e00

View file

@ -28,15 +28,15 @@ static void* soundcheckthread(void*) {
uint16_t out[0x400 * 2]; uint16_t out[0x400 * 2];
while(1) { while(1) {
bool ready = false; bool ready = false;
audio_prinfo_t audioInfo; audio_info_t audioInfo;
ioctl(sndfp, AUDIO_GETINFO, &audioInfo); ioctl(sndfp, AUDIO_GETINFO, &audioInfo);
int oldeof = audioInfo.eof; int oldeof = audioInfo.play.eof;
usleep(for_as_long_as_it_seems_we_should); usleep(for_as_long_as_it_seems_we_should);
while(ready == false) { while(ready == false) {
ioctl(sndfp, AUDIO_GETINFO, &audioInfo); ioctl(sndfp, AUDIO_GETINFO, &audioInfo);
if(audioInfo.eof > oldeof) { if(audioInfo.play.eof > oldeof) {
ready = true; ready = true;
} }
} }
@ -72,13 +72,17 @@ unsigned long SoftwareMixerBackend_Init(void (*callback)(long *stream, size_t fr
return 0; return 0;
} }
audio_prinfo_t audioInfo; audio_info_t audioInfo;
ioctl(sndfp, AUDIO_GETINFO, &audioInfo); ioctl(sndfp, AUDIO_GETINFO, &audioInfo);
audioInfo.sample_rate = 48000; audio_prinfo_t info = audioInfo.play;
audioInfo.channels = 2;
audioInfo.precision = 16; info.sample_rate = 8000;
audioInfo.encoding = AUDIO_ENCODING_LINEAR; info.channels = 2;
audioInfo.port = AUDIO_SPEAKER; info.precision = 8;
info.encoding = AUDIO_ENCODING_LINEAR;
info.port = AUDIO_SPEAKER;
audioInfo.play = info;
ioctl(sndfp, AUDIO_SETINFO, &audioInfo); ioctl(sndfp, AUDIO_SETINFO, &audioInfo);
if(signal(parkSignal, threadPark) == SIG_ERR) { if(signal(parkSignal, threadPark) == SIG_ERR) {
@ -94,7 +98,7 @@ unsigned long SoftwareMixerBackend_Init(void (*callback)(long *stream, size_t fr
pthread_create(&thread, &thread_attr, soundcheckthread, (void*)NULL); pthread_create(&thread, &thread_attr, soundcheckthread, (void*)NULL);
return 48000; // return the sampling rate return 8000; // return the sampling rate
} }
void SoftwareMixerBackend_Deinit(void) { void SoftwareMixerBackend_Deinit(void) {