I am working on a C ++ application that uses SDL / SDL_Mixer to play wav files. I am developing a Mac application without any problems. However, I really need an application to run on Linux, so I am installing VirtualBox on my Windows 7 machine with Ubuntu 12.04 LTS. Compilation works fine until I try to initialize the system. SDL_Mixer then issues the error message "No audio device available."
Here is the code where the error occurs:
using namespace std; void simple_sound_init() { if (SDL_Init(SDL_INIT_AUDIO) == -1) { fprintf(stderr, "init SDL error: %s\n", SDL_GetError()); SDL_Quit(); exit(1); } if (Mix_OpenAudio(SOUNDSAMPLERATE, MIX_DEFAULT_FORMAT, 1, 1024) != 0) { fprintf(stderr, "initialize audio error: %s\n", Mix_GetError()); Mix_CloseAudio(); SDL_Quit(); exit(1); } Mix_ChannelFinished(simple_sound_channel_finised); }
The exact error I get is:
initialize audio error: No available audio device
P / S: I searched extensively for online solutions, and I tried to verify the installation of libraries, etc. However, since it is possible that I missed something, any suggestions on the base library are welcome, and I will confirm that I configured them.
source share