I am working on a C++ application which uses SDL/SDL_Mixer to play wav files. I've been developing the application on a Mac without much problem. However, I do need this application to work on Linux, so I put VirtualBox on my Windows 7 machine with Ubuntu 12.04 LTS. Compilation works fine, until I actually try to initialize the system. Then, SDL_Mixer gives an error "No available audio device."
Here is the code where the error is thrown:
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 have searched extensively online for solutions and I've tried checking over the libraries install, etc. However, since it is possible that I've missed something, any basic library suggestions are welcome, and I will confirm that I have them set up.