void AudioSystem::setDopplerFactor(float dopplerFactor) { SHINY_CHECK_AUDIO_SYSTEM_VALID_CURRENT("setting doppler factor"); ASSERT(dopplerFactor >= 0.0f, "Invalid doppler factor value: %f, should be non-negative", dopplerFactor); alDopplerFactor(dopplerFactor); SHINY_CHECK_AL_ERROR("setting doppler factor"); }
static int lua_alDopplerFactor(lua_State* lua_state) { ALfloat the_value; the_value = lua_tonumber(lua_state, 1); alDopplerFactor(the_value); return 0; }
HG_ERROR SoundManager::initialize() { HG_ERROR err = HG_OK; BREAK_START; mDevice = alcOpenDevice(NULL); if (mDevice == NULL) { err = HG_ERROR_AL_DEVICE_NOT_SUPPORT; break; } mContext = alcCreateContext(mDevice, NULL); if (mContext == NULL) { err = HG_ERROR_AL_CONTEXT_FAILED; break; } alcMakeContextCurrent(mContext); alListenerf(AL_GAIN, 1.0f); // Doppler alDopplerFactor(1.0f); alDopplerVelocity(343.0f); BREAK_END; return err; }
DWORD COpenALSoundUtility::OnSetSoundScale(DWORD size, void *param) { VERIFY_MESSAGE_SIZE(size, sizeof(float)); float soundScale = *(float*)param; m_fSoundScale = soundScale; alSpeedOfSound(SPEED_OF_SOUND * m_fSoundScale); ALenum err = alGetError(); if (err != AL_NO_ERROR) { m_ToolBox->SetErrorValue(ERR_NULL_POINTER); m_ToolBox->Log( LOGWARNING, _T("Sound manager: OpenAL problem setting up OpenAL speed of sound: %s\n"), GetALErrorString(err)); return false; } alDopplerFactor(m_fGlobalDopplerFactor * m_fSoundScale); err = alGetError(); if (err != AL_NO_ERROR) { m_ToolBox->SetErrorValue(ERR_NULL_POINTER); m_ToolBox->Log( LOGWARNING, _T("Sound manager: OpenAL problem setting up OpenAL doppler factor: %s\n"), GetALErrorString(err)); return false; } return MSG_HANDLED_STOP; }
void ListenerNode::activate() { alListenerf( AL_GAIN, _gain ); alDopplerFactor( _dopplerFactor ); alSpeedOfSound( _speedOfSound ); updatePositionAndOrientation(); }
void spp_AudioManager::SetDopplerInformation(float dopplerFactor, float speedOfSound) { alDopplerFactor(dopplerFactor); Log("SetDopplerInformation in spp_AudioManager."); alSpeedOfSound(speedOfSound); Log("SetDopplerInformation in spp_AudioManager."); }
ALuint Systems::SoundSystem::CreateSource() { ALuint source; alGenSources((ALuint)1, &source); alDopplerFactor(1); // Numbers greater than 1 will increase Doppler effect, numbers lower than 1 will decrease the Doppler effect alDopplerVelocity(350.f); // Defines the velocity of the sound return source; }
void View::initAL() { qDebug( "* OpenAL:" ); // const ALCchar * extensionsALC = alcGetString( NULL, ALC_EXTENSIONS ); // qDebug() << "OpenAL: Supported context extensions:" << extensionsALC; #ifdef ALC_ALL_DEVICES_SPECIFIER if( alcIsExtensionPresent( NULL, "ALC_ENUMERATE_ALL_EXT" ) == AL_TRUE ) { const ALCchar * devicesAL = alcGetString( NULL, ALC_ALL_DEVICES_SPECIFIER ); if( devicesAL ) { qDebug( "\t* %s:", qPrintable(tr("Available devices")) ); for( const ALchar * d = devicesAL; *d; d += strlen(d)+1 ) { qDebug( "\t\t* %s", d ); } } } #else if( alcIsExtensionPresent( NULL, "ALC_ENUMERATE_EXT") == AL_TRUE ) { const ALCchar * devicesAL = alcGetString( NULL, ALC_DEVICE_SPECIFIER ); if( devicesAL ) { qDebug( "\t* %s:", qPrintable(tr("Available devices")) ); for( const ALchar * d = devicesAL; *d; d += strlen(d)+1 ) { qDebug( "\t\t* %s", d ); } } } #endif const ALCchar * defaultDeviceNameAL = NULL; #ifdef ALC_DEFAULT_ALL_DEVICES_SPECIFIER defaultDeviceNameAL = alcGetString( NULL, ALC_DEFAULT_ALL_DEVICES_SPECIFIER ); #else defaultDeviceNameAL = alcGetString( NULL, ALC_DEFAULT_DEVICE_SPECIFIER ); #endif qDebug( "\t* %s:\t%s", qPrintable(tr("Opening default device")), defaultDeviceNameAL ); mALDevice = alcOpenDevice( defaultDeviceNameAL ); if( !mALDevice ) qFatal( "\t\t! %s!", qPrintable(tr("Could not open audio device")) ); mALContext = alcCreateContext( mALDevice, NULL ); alcMakeContextCurrent( mALContext ); const ALCchar * vendorAL = alGetString( AL_VENDOR ); qDebug( "\t* %s:\t%s", qPrintable(tr("Vendor")), vendorAL ); const ALCchar * rendererAL = alGetString( AL_RENDERER ); qDebug( "\t* %s:\t%s", qPrintable(tr("Renderer")), rendererAL ); const ALCchar * versionAL = alGetString( AL_VERSION ); qDebug( "\t* %s:\t%s", qPrintable(tr("Version")) , versionAL ); // const ALCchar * extensionsAL = alcGetString( NULL, AL_EXTENSIONS ); // qDebug( "\t* %s:\t%s", qPrintable(tr("Supported extensions")), extensionsAL ); alDopplerFactor( 0.2f ); }
Handle<Value> ALDopplerFactorCallback(const Arguments& args) { //if less that nbr of formal parameters then do nothing if (args.Length() < 1) return v8::Undefined(); //get arguments double arg0 = args[0]->NumberValue(); //make call alDopplerFactor((ALfloat)arg0); return v8::Undefined(); }
void ConfigurarEntorno ( ALsizei identificador, ALenum modelo, ALfloat doppler_factor, ALfloat doppler_vel, ALint room, ALint room_high_frequency, ALfloat rolloff_factor, ALfloat decay_time, ALfloat decay_high_frequency_ratio, ALint reflections, ALfloat reflections_delay, ALint reverb, ALfloat reverb_delay, ALfloat diffusion, ALfloat density, ALfloat high_frequency_reference ){ /* Configuramos la atenuacion y el efecto doppler */ alEnable ( AL_DISTANCE_MODEL ); alDistanceModel ( modelo ); alDopplerFactor ( doppler_factor ); alDopplerVelocity ( doppler_vel ); /* Recordad que en metros la velocidad del sonido es 343 */ #ifdef _LINUX /* Generamos el entorno y comprobamos errores */ alGenEnvironmentIASIG ( identificador, &entornos[identificador] ); if ( !alIsEnvironmentIASIG ( entornos[identificador] )){ fprintf ( logs, "No se puede configurar parte del entorno\n"); } /* Configuramos las propiedades del entorno */ alEnvironmentiIASIG ( entornos[identificador], AL_ENV_ROOM_IASIG, room ); alEnvironmentiIASIG ( entornos[identificador], AL_ENV_ROOM_HIGH_FREQUENCY_IASIG, room_high_frequency); alEnvironmentfIASIG ( entornos[identificador], AL_ENV_ROOM_ROLLOFF_FACTOR_IASIG, rolloff_factor ); alEnvironmentfIASIG ( entornos[identificador], AL_ENV_DECAY_TIME_IASIG, decay_time ); alEnvironmentfIASIG ( entornos[identificador], AL_ENV_DECAY_HIGH_FREQUENCY_RATIO_IASIG, decay_high_frequency_ratio ); alEnvironmentiIASIG ( entornos[identificador], AL_ENV_REFLECTIONS_IASIG, reflections ); alEnvironmentfIASIG ( entornos[identificador], AL_ENV_REFLECTIONS_DELAY_IASIG, reflections_delay ); alEnvironmentiIASIG ( entornos[identificador], AL_ENV_REVERB_IASIG, reverb ); alEnvironmentfIASIG ( entornos[identificador], AL_ENV_REVERB_DELAY_IASIG, reverb_delay ); alEnvironmentfIASIG ( entornos[identificador], AL_ENV_DIFFUSION_IASIG, diffusion ); alEnvironmentfIASIG ( entornos[identificador], AL_ENV_DENSITY_IASIG, density ); alEnvironmentfIASIG ( entornos[identificador], AL_ENV_HIGH_FREQUENCY_REFERENCE_IASIG, high_frequency_reference ); #endif #ifdef _WIN32 /* Para windows se pueden crear y configurar entornos utilizando las extensiones EAX que admiten algunas tarjetas Soundblaster. Pero como no sé si es gratuito la utilizacion de dichas extensiones, de momento para windows no se generaran entornos */ #endif }
static int _context_setdopplerfactor (PyObject* self, PyObject *value, void *closure) { double factor; ASSERT_CONTEXT_IS_CURRENT (self, -1); if (!DoubleFromObj (value, &factor)) return -1; CLEAR_ALERROR_STATE (); alDopplerFactor ((ALfloat)factor); if (SetALErrorException (alGetError (), 0)) return -1; return 0; }
void DS_SFX_Listener(int prop, float value) { switch(prop) { case SFXLP_UNITS_PER_METER: unitsPerMeter = value; break; case SFXLP_DOPPLER: alDopplerFactor(value); break; default: break; } }
OALAudioEngine::OALAudioEngine() { ALCdevice* device = alcOpenDevice(nullptr); ALCcontext* context = alcCreateContext(device, 0); alcMakeContextCurrent(context); this->SetListenerPos(float3(0, 0, 0)); this->SetListenerVel(float3(0, 0, 0)); this->SetListenerOri(float3(0, 0, 1), float3(0, 1, 0)); alDistanceModel(AL_INVERSE_DISTANCE); alDopplerFactor(1); alDopplerVelocity(343); // m/s }
// --------------------------------------------------------------------------------------- // ds3d_update_buffer() // // parameters: channel => identifies the 3D sound to update // min => the distance at which sound doesn't get any louder // max => the distance at which sound doesn't attenuate any further // pos => world position of sound // vel => velocity of the objects producing the sound // // returns: 0 => success // -1 => failure // // int ds3d_update_buffer(int channel, float min, float max, vec3d *pos, vec3d *vel) { if (Cmdline_no_3d_sound) { nprintf(("Sound", "Aborting ds3d_update_buffer due to Cmdline_no_3d_sound...")); return -1; } if (channel < 0) { return 0; } ALuint source_id = Channels[channel].source_id; ALfloat rolloff = 1.0f; if (pos) { OpenAL_ErrorPrint( alSource3f(source_id, AL_POSITION, pos->xyz.x, pos->xyz.y, -pos->xyz.z) ); } if (vel) { OpenAL_ErrorPrint( alSource3f(source_id, AL_VELOCITY, vel->xyz.x, vel->xyz.y, vel->xyz.z) ); //OpenAL_ErrorPrint( alDopplerFactor(1.0f) ); } else { OpenAL_ErrorPrint( alSource3f(source_id, AL_VELOCITY, 0.0f, 0.0f, 0.0f) ); OpenAL_ErrorPrint( alDopplerFactor(0.0f) ); } if (max <= min) { rolloff = 0.0f; } else { #define MIN_GAIN 0.05f rolloff = (min / (min + (max - min))) / MIN_GAIN; if (rolloff < 0.0f) { rolloff = 0.0f; } } OpenAL_ErrorPrint( alSourcef(source_id, AL_ROLLOFF_FACTOR, rolloff) ); OpenAL_ErrorPrint( alSourcef(source_id, AL_REFERENCE_DISTANCE, min) ); OpenAL_ErrorPrint( alSourcef(source_id, AL_MAX_DISTANCE, max) ); return 0; }
void init() { s_al_device = alcOpenDevice(NULL); CE_ASSERT(s_al_device, "Cannot open OpenAL audio device"); s_al_context = alcCreateContext(s_al_device, NULL); CE_ASSERT(s_al_context, "Cannot create OpenAL context"); AL_CHECK(alcMakeContextCurrent(s_al_context)); CE_LOGD("OpenAL Vendor : %s", alGetString(AL_VENDOR)); CE_LOGD("OpenAL Version : %s", alGetString(AL_VERSION)); CE_LOGD("OpenAL Renderer : %s", alGetString(AL_RENDERER)); AL_CHECK(alDistanceModel(AL_INVERSE_DISTANCE_CLAMPED)); AL_CHECK(alDopplerFactor(1.0f)); AL_CHECK(alDopplerVelocity(343.0f)); }
static int Initialize(void *hnd) { ALCdevice *dev; ALCcontext *ctxt; ALCint attrs[3]; // TODO: Check for failures (generally, not just in this file). dev = alcOpenDevice(NULL); attrs[0] = ALC_FREQUENCY; attrs[1] = RLX.Audio.SR_to_Khz[RLX.Audio.SamplingRate]; attrs[2] = 0; ctxt = alcCreateContext(dev, (ALCint *)&attrs); alcMakeContextCurrent(ctxt); alDistanceModel(AL_INVERSE_DISTANCE); alDopplerFactor(0.f); // No doppler alDopplerVelocity(0.f); // No velocity RLX.Audio.Config|=RLXAUDIO_Use3D; return 0; }
void ListenerNode::setParamF( int param, int compIdx, float value ) { switch( param ) { case ListenerNodeParams::MasterGain: _gain = value; if( _gain < 0.0f ) _gain = 0.0f; //only set the master gain if we are active if( SoundManager::instance()->getActiveListener() == this ) alListenerf( AL_GAIN, _gain ); return; case ListenerNodeParams::DopplerFactor: _dopplerFactor = value; if( _dopplerFactor < 0.0f ) _dopplerFactor = 0.0f; //only set the the doppler factor if we are active if( SoundManager::instance()->getActiveListener() == this ) alDopplerFactor( _dopplerFactor ); return; case ListenerNodeParams::SpeedOfSound: _speedOfSound = value; if( _speedOfSound < 0.0f ) _speedOfSound = 0.0f; //only set the the speed of sound if we are active if( SoundManager::instance()->getActiveListener() == this ) alSpeedOfSound( _speedOfSound ); return; default: SceneNode::setParamF( param, compIdx, value ); } }
void Init(int frequency, int resolution, int sources) { (void)resolution; --sources; // one spare source for music ALCint attribs[] = { ALC_FREQUENCY, frequency, /*ALC_MONO_SOURCES, sources, ALC_STEREO_SOURCES, 1,*/ 0 }; alureInitDevice(NULL, attribs); soundSources = new ALuint[sources]; alGenSources(sources, soundSources); alGenSources(1, &musicSource); //alGenBuffers(2, musicBufs); soundSourceCount = sources; alDistanceModel(AL_INVERSE_DISTANCE_CLAMPED); alSpeedOfSound(1400.0); alDopplerFactor(0.7); alureUpdateInterval(0.03333f); }
bool Audio::init(){ logs().audio.write("[Audio] init"); if(!alutInit(NULL, 0)){ hardware.audio=false; return false; } ALenum error=alGetError(); if(error != AL_NO_ERROR){ logs().audio.write("[AudioObject] init error '"+String(alGetString(error))+"' "); console().write(String("audio init error '"+String(alGetString(error))+"' ")); return false; } alDistanceModel(AL_LINEAR_DISTANCE_CLAMPED); //NONE for none, AL_INVERSE_DISTANCE for other + //AL_INVERSE_DISTANCE_CLAMPED alDopplerFactor ( dopplerFactor ); error=alGetError(); active=true; //handle:play(); //handle:volume //default=1 (out of 1) //handle:range //default=0 (no range=play everywhere) //handle:directional //defaut=false //handle:loop //default=true //handle:id //handle id, internal error=alGetError(); if(error != AL_NO_ERROR){ return false; } return true; }
void Init(int frequency, int resolution, int sources) { (void)resolution; --sources; // one spare source for music ALCint attribs[] = { ALC_FREQUENCY, frequency, /*ALC_MONO_SOURCES, sources, ALC_STEREO_SOURCES, 1,*/ 0 }; if (AL_FALSE == alureInitDevice(NULL, attribs)) { LOG("Sound", LOG_ERROR, "ALURE init failure"); exit(1); } soundSources = new ALuint[sources]; alGenSources(sources, soundSources); alGenSources(1, &musicSource); alGenBuffers(2, musicBufs); soundSourceCount = sources; alDistanceModel(AL_INVERSE_DISTANCE_CLAMPED); alSpeedOfSound(1400.0); alDopplerFactor(0.7); alureUpdateInterval(0.03333f); #ifndef NDEBUG if (alGetError()) LOG("Sound", LOG_ERROR, "OpenAL init failure"); const ALchar* err = alureGetErrorString(); if (strcmp(err, "No error")) { LOG("Sound", LOG_ERROR, "ALURE init failure: %s", err); exit(1); } #endif }
void Extension::SetDopplerFactor(float DopplerFactor) { alDopplerFactor(DopplerFactor); }
value lime_al_doppler_factor (value factor) { alDopplerFactor (val_float (factor)); return alloc_null (); }
void al_dopplerfactor( int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[] ) { if (NULL == alDopplerFactor) mogl_glunsupported("alDopplerFactor"); alDopplerFactor((ALfloat)mxGetScalar(prhs[0])); }
__FORCE_ALIGN_STACK__ void CSound::StartThread(int maxSounds) { { boost::recursive_mutex::scoped_lock lck(soundMutex); // alc... will create its own thread it will copy the name from the current thread. // Later we finally rename `our` audio thread. Threading::SetThreadName("openal"); // NULL -> default device const ALchar* deviceName = NULL; std::string configDeviceName = ""; // we do not want to set a default for snd_device, // so we do it like this ... if (configHandler->IsSet("snd_device")) { configDeviceName = configHandler->GetString("snd_device"); deviceName = configDeviceName.c_str(); } ALCdevice* device = alcOpenDevice(deviceName); if ((device == NULL) && (deviceName != NULL)) { LOG_L(L_WARNING, "Could not open the sound device \"%s\", trying the default device ...", deviceName); configDeviceName = ""; deviceName = NULL; device = alcOpenDevice(deviceName); } if (device == NULL) { LOG_L(L_ERROR, "Could not open a sound device, disabling sounds"); CheckError("CSound::InitAL"); return; } else { ALCcontext *context = alcCreateContext(device, NULL); if (context != NULL) { alcMakeContextCurrent(context); CheckError("CSound::CreateContext"); } else { alcCloseDevice(device); LOG_L(L_ERROR, "Could not create OpenAL audio context"); return; } } maxSounds = GetMaxMonoSources(device, maxSounds); LOG("OpenAL info:"); if(alcIsExtensionPresent(NULL, "ALC_ENUMERATION_EXT")) { LOG(" Available Devices:"); const char* deviceSpecifier = alcGetString(NULL, ALC_ALL_DEVICES_SPECIFIER); while (*deviceSpecifier != '\0') { LOG(" %s", deviceSpecifier); while (*deviceSpecifier++ != '\0') ; } LOG(" Device: %s", (const char*)alcGetString(device, ALC_DEVICE_SPECIFIER)); } LOG(" Vendor: %s", (const char*)alGetString(AL_VENDOR)); LOG(" Version: %s", (const char*)alGetString(AL_VERSION)); LOG(" Renderer: %s", (const char*)alGetString(AL_RENDERER)); LOG(" AL Extensions: %s", (const char*)alGetString(AL_EXTENSIONS)); LOG(" ALC Extensions: %s", (const char*)alcGetString(device, ALC_EXTENSIONS)); // Init EFX efx = new CEFX(device); // Generate sound sources for (int i = 0; i < maxSounds; i++) { CSoundSource* thenewone = new CSoundSource(); if (thenewone->IsValid()) { sources.push_back(thenewone); } else { maxSounds = std::max(i-1, 0); LOG_L(L_WARNING, "Your hardware/driver can not handle more than %i soundsources", maxSounds); delete thenewone; break; } } LOG(" Max Sounds: %i", maxSounds); // Set distance model (sound attenuation) alDistanceModel(AL_INVERSE_DISTANCE_CLAMPED); alDopplerFactor(0.2f); alListenerf(AL_GAIN, masterVolume); } Threading::SetThreadName("audio"); Watchdog::RegisterThread(WDT_AUDIO); while (!soundThreadQuit) { boost::this_thread::sleep(boost::posix_time::millisec(50)); //! 20Hz Watchdog::ClearTimer(WDT_AUDIO); Update(); } Watchdog::DeregisterThread(WDT_AUDIO); sources.clear(); // delete all sources delete efx; // must happen after sources and before context efx = NULL; ALCcontext* curcontext = alcGetCurrentContext(); ALCdevice* curdevice = alcGetContextsDevice(curcontext); alcMakeContextCurrent(NULL); alcDestroyContext(curcontext); alcCloseDevice(curdevice); }
ALvoid CDECL wine_alDopplerFactor(ALfloat value) { alDopplerFactor(value); }
void AUD_OpenALDevice::setDopplerFactor(float factor) { alDopplerFactor(factor); }
void WSoundComponent::SetDopplerFactor(float fFactor) { alDopplerFactor(fFactor); }
UBOOL UOpenALAudioSubsystem::Init() { guard(UOpenALAudioSubsystem::Init); INT Rate = GetActualOutputRate(); // OpenAL / ALURE initialization ALCint ContextAttrs[] = { ALC_FREQUENCY, Rate, 0 }; if( alureInitDevice( NULL, ContextAttrs ) == AL_FALSE ) appErrorf( TEXT("Couldn't initialize OpenAL: %s"), alureGetErrorString() ); alDistanceModel( AL_LINEAR_DISTANCE_CLAMPED ); CheckALErrorFlag( TEXT("alDistanceModel") ); alDopplerFactor( DopplerFactor ); CheckALErrorFlag( TEXT("alDopplerFactor") ); // Metre per second to units per second, where units per meter is 52.5. // Taken from: http://wiki.beyondunreal.com/Legacy:General_Scale_And_Dimensions alSpeedOfSound( 343.3f * 52.5f ); CheckALErrorFlag( TEXT("alSpeedOfSound") ); ALuint* NewSources = new ALuint[NumSources + 1]; Sources = new FAudioSource[NumSources]; alGenSources( NumSources + 1, NewSources ); CheckALErrorFlag( TEXT("alGenSources") ); MusicSource = NewSources[0]; for( INT i=0; i<NumSources; i++ ) Sources[i].Id = NewSources[i+1]; delete[] NewSources; // Fix the music source to 0 values alSource3f( MusicSource, AL_POSITION, 0.f, 0.f, 0.f ); alSource3f( MusicSource, AL_VELOCITY, 0.f, 0.f, 0.f ); alSource3f( MusicSource, AL_DIRECTION, 0.f, 0.f, 0.f ); alSourcef( MusicSource, AL_ROLLOFF_FACTOR, 0.f ); alSourcei( MusicSource, AL_SOURCE_RELATIVE, AL_TRUE ); SetVolumes(); CheckALErrorFlag( TEXT("SetVolumes") ); // MikMod initialization //kipz - remove this because it breaks on new mikmod //MikMod_RegisterDriver( &MusicDriver ); MikMod_RegisterAllDrivers(); // Register only formats that are known to be supported by UT. // Taken from: http://wiki.beyondunreal.com/Music MikMod_RegisterLoader( &load_mod ); MikMod_RegisterLoader( &load_s3m ); MikMod_RegisterLoader( &load_stm ); MikMod_RegisterLoader( &load_it ); MikMod_RegisterLoader( &load_xm ); MikMod_RegisterLoader( &load_far ); MikMod_RegisterLoader( &load_669 ); md_mixfreq = Rate; if ( HighQualityMusic ) md_mode |= DMODE_HQMIXER; if( MikMod_Init( "" ) ) appErrorf( TEXT("Couldn't initialize MikMod: %s"), MikMod_strerror( MikMod_errno ) ); // Initialized! USound::Audio = this; UMusic::Audio = this; Initialized = 1; return 1; unguard; }
bool EOSAudioDevice::initialize() { ALCcontext *pContext = 0; ALCdevice *pDevice = 0; // load config _device = "auto"; _bufferSize = BUFFER_SIZE; _sourcesLimit = SOURCES_LIMIT; _distanceFactor = 1; _dopplerFactor = 1; _speedOfSound = 343.3f; _rolloffFactor = 0.001f; _maxDistance = 4000; _referenceDistance = 3000; _masterVolume = 1; // clean error status alGetError(); // initialize OpenAL pDevice = alcOpenDevice(NULL); // select the "default device" if(pDevice) { pContext = alcCreateContext(pDevice, NULL); alcMakeContextCurrent(pContext); } const ALchar *strVendor = alGetString(AL_VENDOR), *strVersion = alGetString(AL_VERSION), *strRenderer = alGetString(AL_RENDERER), *strAlExtensions = alGetString(AL_EXTENSIONS); LOGINFO("OpenAL v%s by %s", strVersion, strVendor); LOGINFO(" Renderer: %s", strRenderer); LOGINFO(" Extensions: %s", strAlExtensions); const ALCchar *strDefSpecifier = alcGetString(pDevice, ALC_DEFAULT_DEVICE_SPECIFIER), *strCaptDefSpecifier = alcGetString(pDevice, ALC_CAPTURE_DEFAULT_DEVICE_SPECIFIER), *strAlcExtensions = alcGetString(pDevice, ALC_EXTENSIONS); LOGINFO(" Default device: %s", strDefSpecifier); LOGINFO(" Default capture device: %s", strCaptDefSpecifier); LOGINFO(" Device extensions: %s", strAlcExtensions); // query extensions _extLinearDistanceClamped = alIsExtensionPresent("AL_LINEAR_DISTANCE_CLAMPED"); LOGINFO(" Extension [AL_LINEAR_DISTANCE_CLAMPED]: is %s", (_extLinearDistanceClamped)?"available.":"not available."); // allocate sources allocateSources(); LOGINFO(" OpenAL: %i audio sources available", sourcesHandle.size()); checkErrors("initialize[sources allocation]"); // distance factor if(_extLinearDistanceClamped) alDistanceModel(AL_LINEAR_DISTANCE_CLAMPED); else alDistanceModel(AL_INVERSE_DISTANCE_CLAMPED); setDistanceFactor(_distanceFactor); checkErrors("initialize[distance factor]"); // doppler factor alDopplerFactor(_dopplerFactor); // don't exaggerate doppler shift alSpeedOfSound(_speedOfSound); // using meters/second // init listner listenerSetPosition(0, 0, 0); listenerSetOrientation(0, 0, 1, 0, 1, 0); listenerSetGain(_masterVolume); checkErrors("initialize[listener]"); // init libdumb dumb_register_stdfiles(); // check for errors in this function return checkErrors("initialize"); }
void EOSAudioDevice::setDopplerFactor(float factor) { _dopplerFactor = factor; alDopplerFactor(_dopplerFactor); checkErrors("setDopplerFactor()"); }