Example #1
0
void LLAudioEngine::setMuted(bool muted)
{
	if (muted != mMuted)
	{
		mMuted = muted;
		setMasterGain(mMasterGain);
	}
}
Example #2
0
nSoundSystem::nSoundSystem(QObject *parent) :
    QObject(parent), m_success(false)
{
    qDebug("nSoundSystem initializing.");

    m_context = 0;
    m_device = 0;

    m_device = alcOpenDevice(0); //default device
    if(!m_device)
        qWarning("Error creating OpenAL device.");

    int attributes[] = {ALC_FREQUENCY, NEIASOUND_FREQ, 0};
    m_context = alcCreateContext(m_device, attributes);
    if(!m_context)
        qWarning("Error creating OpenAL context.");

    alcMakeContextCurrent(m_context);
    if( alGetError()!=AL_NO_ERROR)
        qWarning("nSoundSystem::nSoundSystem(): Failed to set context as current.");

    if(!nEfxHelper::initialize(m_device))
        qWarning("nSoundSystem::nSoundSystem(): nEfxHelper initialization failed.");

    m_listener = new nSoundListener(this);
    m_success = true;

#ifdef ANDROID
#ifdef MOB
    alcDeviceEnableHrtfMOB( m_device, false );
#endif
#endif

    alcGetIntegerv(m_device, ALC_MAX_AUXILIARY_SENDS, 1, &m_numSends);
    
    nSoundSource::_resetRoleGains();
    QSettings settings;
    settings.beginGroup("Audio");
    setMasterGain(settings.value("MasterGain", 100).toFloat()/100.0f);
    settings.endGroup();


    int efxMaj, efxMin;
    alcGetIntegerv(m_device, ALC_EFX_MAJOR_VERSION, 1, &efxMaj);
    alcGetIntegerv(m_device, ALC_EFX_MINOR_VERSION, 1, &efxMin);

    qDebug("nSoundSystem::nSoundSystem(): initialized successfully");
    qDebug() << QStringLiteral("EFX OpenAL Extension version %1.%2").arg(efxMaj).arg(efxMin);

    nEfxHelper::initialize(m_device);

}