Visterm icon indicating copy to clipboard operation
Visterm copied to clipboard

Finding incorrect audio device

Open Th0ught09 opened this issue 2 years ago • 0 comments

Digging through the code I see that the function SDL_OpenAudiDevice is passed NULL as the listening device which defaults to my microphone unfortunately. I have tried running files to test the ID out of my headphones using a test file such as

#include <stdlib.h>
#include <stdio.h>
#include <stdint.h>
#include <limits.h>
#include <SDL2/SDL.h>
#include <complex.h>
#include <stdio.h>

int main() {
    SDL_AudioDeviceID recording_device_id;
    const int device_index = 0; // Index of the audio device to query
    const int is_capture = 0; // 0 to query playback device, 1 to query recording device
    int num_output_devices;
    const char* device_name = SDL_GetAudioDeviceName(device_index, is_capture) ?: "No audio device found";

    if (device_name) {
        printf("Device name: %s\n", device_name);
    } else {
        printf("No audio device found\n");
    }
    num_output_devices = SDL_GetNumAudioDevices(SDL_TRUE);
	if(!num_output_devices){
		printf("Device name: %d\n", num_output_devices);
		SDL_Quit();
		return 1;
	}

    return 0;
}

But I am very inexperienced with c so not sure how to tackle the dependency issues I keep running into It's an excellent idea and I would love to use it so a fix like this would be very appreciated!

Th0ught09 avatar Apr 01 '23 10:04 Th0ught09