Sound ~ References - uchicago-cs/chiventure GitHub Wiki
Introduction
This page serves as a collection of information for future sound teams to reference.
Locating SDL2 (and other external) Library Files
The SDL2 library and header files can be located by running:
Dynamic Libraries:
$cd /usr/lib/x86_64-linux-gnu
Header Files:
$cd /usr/include/SDL2
After copying and moving the required files, you can navigate back to your desktop by running:
$cd ../../../home/CNETID
Troubleshooting
ALSA lib error
Advanced Linux Sound Architecture (ALSA) is a library that provides audio functionality to Linux operating systems. We believe the following errors are a result of working remotely through the CS Linux Servers.
When compiling an audio program, a function from the SDL library, Mix_OpenAudio() is receiving an error that informs the user that an audio device cannot be found. If an audio device is not found, this is the following output when trying to run an executable audio program:
ALSA lib confmisc.c:767:(parse_card) cannot find card '0'
ALSA lib conf.c:4732:(_snd_config_evaluate) function snd_func_card_driver returned error: No such file or directory
ALSA lib confmisc.c:392:(snd_func_concat) error evaluating strings
ALSA lib conf.c:4732:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory
ALSA lib confmisc.c:1246:(snd_func_refer) error evaluating name
ALSA lib conf.c:4732:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5220:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2642:(snd_pcm_open_noupdate) Unknown PCM default
Unable to open audio: ALSA: Couldn't open audio device: No such file or directory
We identified that the CS Linux Remote Servers did not have audio devices installed in them, therefore the required SDL functions couldn't locate a source to play sound. We confirmed this by trying to play a YouTube video that has sound on NoMachine, a remote desktop that is SSHed to the CS Linux server. When we did not hear sound, we ran the command: arecord -l
on the Linux Terminal. This is a command that lists all sound cards and audio devices.
This is the following output from the CS Linux Server Terminal:
arecord: device_list:274: no soundcards found...
This is the following output from a Linux environment on a local virtual box:
Note: These outputs will vary depending on the sound cards and audio devices installed on your computer.
$ arecord -l
**** List of CAPTURE Hardware Devices ****
card 0: I82801AAICH [Intel 82801AA-ICH], device 0: Intel ICH [Intel 82801AA-ICH]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 0: I82801AAICH [Intel 82801AA-ICH], device 1: Intel ICH - MIC ADC [Intel 82801AA-ICH - MIC ADC]
Subdevices: 1/1
Subdevice #0: subdevice #0
A local virtual box installed with Linux has access to our local computer's sound cards and audio devices. However, working remotely on the CS Linux Server, the CS Linux server cannot access our computer's sound cards and audio device, leading to the ALSA errors when compiling. As of May 14th, the tech staff was currently looking into the audio issues we encountered through noMachine.
#Residual Backlog Issues:
Implement play/load sound function: Play sound within src/sound/sound.c appears to be working, but the sound_init() function does not incorporate the given variables correctly. This doesn’t seem to be an issue when playing a sound, so perhaps sound_init() is unnecessary. Additionally, to play the sound we are able to use SDL_OpenAudioDevice(), SDL_QueueAudio(), SDL_delay() functionally while also ending and closing the sound file with SDL_CloseAudioDevice(), SDL_FreeWAV(), and SDL_Quit().
SDL Research:
Notes from https://wiki.libsdl.org/Introduction
CMake builds the library. The library supports the following: Windows, Mac OS, Linus, iOS, android. SDL can access the following: Video (3D graphics, creates and manages multiple windows), input events (Mouse, keyboard, joystick, force feedback), audio (runs independently in a separate thread), file I/O abstraction (built-in support for files and memory), threads, timers, CPU feature detection, endian independence, power managements