Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions src/webots/sound/WbSoundEngine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
#include <ode/ode.h>

#include <cassert>
#include <iostream>

static WbWorld *gWorld = NULL;
static bool gOpenAL = false;
Expand Down Expand Up @@ -92,10 +93,13 @@ static void init() {
gVolume = WbPreferences::instance()->value("Sound/volume", 80).toInt();
WbLog::toggle(stderr); // we want to disable stderr to avoid warnings in the console
try {
std::cout << "Calling alcGetString()" << std::endl;
const ALCchar *defaultDeviceName = alcGetString(NULL, ALC_DEFAULT_DEVICE_SPECIFIER);
if (defaultDeviceName == NULL)
if (defaultDeviceName == NULL || !strcmp(defaultDeviceName, "Null Audio Device"))
throw QObject::tr("Cannot find OpenAL default device");
std::cout << "Calling alcOpenDevice()" << std::endl;
gDefaultDevice = alcOpenDevice(defaultDeviceName);
std::cout << "Called alcOpenDevice()" << std::endl;
if (gDefaultDevice == NULL)
throw QObject::tr("Cannot initialize OpenAL default device '%1'").arg(defaultDeviceName);
gContext = alcCreateContext(gDefaultDevice, NULL);
Expand All @@ -106,8 +110,9 @@ static void init() {
gDevice = QString(defaultDeviceName);
} catch (const QString &e) {
WbLog::toggle(stderr);
if (WbSysInfo::environmentVariable("CI").isEmpty())
WbLog::warning(QObject::tr("Cannot initialize the sound engine: %1").arg(e));
WbLog::warning(QObject::tr("Cannot initialize the sound engine: %1").arg(e));
std::cout << QObject::tr("Cannot initialize the sound engine: %1").arg(e).toUtf8().constData() << std::endl;

return;
}
WbLog::toggle(stderr);
Expand Down