AL_API ALvoid AL_APIENTRY alGetIntegerv(ALenum pname, ALint *values) { ALCcontext *context; if(values) { switch(pname) { case AL_DOPPLER_FACTOR: case AL_DOPPLER_VELOCITY: case AL_DISTANCE_MODEL: case AL_SPEED_OF_SOUND: case AL_DEFERRED_UPDATES_SOFT: case AL_GAIN_LIMIT_SOFT: case AL_NUM_RESAMPLERS_SOFT: case AL_DEFAULT_RESAMPLER_SOFT: values[0] = alGetInteger(pname); return; } } context = GetContextRef(); if(!context) return; switch(pname) { default: SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); } done: ALCcontext_DecRef(context); }
AL_API ALvoid AL_APIENTRY alGetIntegerv(ALenum pname, ALint *values) { ALCcontext *Context; if(values) { switch(pname) { case AL_DOPPLER_FACTOR: case AL_DOPPLER_VELOCITY: case AL_DISTANCE_MODEL: case AL_SPEED_OF_SOUND: case AL_DEFERRED_UPDATES_SOFT: values[0] = alGetInteger(pname); return; } } Context = GetContextRef(); if(!Context) return; al_try { CHECK_VALUE(Context, values); switch(pname) { default: al_throwerr(Context, AL_INVALID_ENUM); } } al_endtry; ALCcontext_DecRef(Context); }
void al_getinteger( int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[] ) { if (NULL == alGetInteger) mogl_glunsupported("alGetInteger"); plhs[0]=mxCreateDoubleMatrix(1,1,mxREAL); *mxGetPr(plhs[0])=(double)alGetInteger((ALenum)mxGetScalar(prhs[0])); }
AudioSystem::DistanceModel AudioSystem::getDistanceModel() const { SHINY_CHECK_AUDIO_SYSTEM_VALID_CURRENT("getting distance model"); ALint distanceModel = alGetInteger(AL_DISTANCE_MODEL); SHINY_CHECK_AL_ERROR("getting distance model"); return getDistanceModelClass(distanceModel); }
static PyObject* _context_getdistancemodel (PyObject* self, void *closure) { ALint model; ASSERT_CONTEXT_IS_CURRENT (self, NULL); CLEAR_ALERROR_STATE (); model = alGetInteger (AL_DISTANCE_MODEL); if (SetALErrorException (alGetError (), 0)) return NULL; return PyInt_FromLong ((long)model); }
Handle<Value> ALGetIntegerCallback(const Arguments& args) { //if less that nbr of formal parameters then do nothing if (args.Length() < 1) return v8::Undefined(); //get arguments int arg0 = args[0]->IntegerValue(); //make call alGetInteger((ALenum)arg0); return v8::Undefined(); }
AL_API ALvoid AL_APIENTRY alGetIntegerv(ALenum pname, ALint *values) { ALCcontext *context; ALCdevice *device; MidiSynth *synth; ALsizei i; if(values) { switch(pname) { case AL_DOPPLER_FACTOR: case AL_DOPPLER_VELOCITY: case AL_DISTANCE_MODEL: case AL_SPEED_OF_SOUND: case AL_DEFERRED_UPDATES_SOFT: case AL_SOUNDFONTS_SIZE_SOFT: case AL_MIDI_STATE_SOFT: values[0] = alGetInteger(pname); return; } } context = GetContextRef(); if(!context) return; switch(pname) { case AL_SOUNDFONTS_SOFT: device = context->Device; synth = device->Synth; if(synth->NumSoundfonts > 0) { if(!(values)) SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); for(i = 0;i < synth->NumSoundfonts;i++) values[i] = synth->Soundfonts[i]->id; } break; default: SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); } done: ALCcontext_DecRef(context); }
AUD_DistanceModel AUD_OpenALDevice::getDistanceModel() const { switch(alGetInteger(AL_DISTANCE_MODEL)) { case AL_INVERSE_DISTANCE: return AUD_DISTANCE_MODEL_INVERSE; case AL_INVERSE_DISTANCE_CLAMPED: return AUD_DISTANCE_MODEL_INVERSE_CLAMPED; case AL_LINEAR_DISTANCE: return AUD_DISTANCE_MODEL_LINEAR; case AL_LINEAR_DISTANCE_CLAMPED: return AUD_DISTANCE_MODEL_LINEAR_CLAMPED; case AL_EXPONENT_DISTANCE: return AUD_DISTANCE_MODEL_EXPONENT; case AL_EXPONENT_DISTANCE_CLAMPED: return AUD_DISTANCE_MODEL_EXPONENT_CLAMPED; default: return AUD_DISTANCE_MODEL_INVALID; } }
AL_API ALvoid AL_APIENTRY alGetIntegerv(ALenum pname,ALint *data) { ALCcontext *Context; if(data) { switch(pname) { case AL_DOPPLER_FACTOR: case AL_DOPPLER_VELOCITY: case AL_DISTANCE_MODEL: case AL_SPEED_OF_SOUND: case AL_DEFERRED_UPDATES_SOFT: *data = alGetInteger(pname); return; } } Context = GetContextRef(); if(!Context) return; if(data) { switch(pname) { default: alSetError(Context, AL_INVALID_ENUM); break; } } else { // data is a NULL pointer alSetError(Context, AL_INVALID_VALUE); } ALCcontext_DecRef(Context); }
void CSoundSource::Play(IAudioChannel* channel, SoundItem* item, float3 pos, float3 velocity, float volume, bool relative) { assert(!curStream.Valid()); assert(channel); if (!item->PlayNow()) return; Stop(); curVolume = volume; curPlaying = item; curChannel = channel; alSourcei(id, AL_BUFFER, item->buffer->GetId()); alSourcef(id, AL_GAIN, volume * item->GetGain() * channel->volume); alSourcef(id, AL_PITCH, item->GetPitch() * globalPitch); velocity *= item->dopplerScale * ELMOS_TO_METERS; alSource3f(id, AL_VELOCITY, velocity.x, velocity.y, velocity.z); alSourcei(id, AL_LOOPING, (item->loopTime > 0) ? AL_TRUE : AL_FALSE); loopStop = spring_gettime() + spring_msecs(item->loopTime); if (relative || !item->in3D) { in3D = false; if (efxEnabled) { alSource3i(id, AL_AUXILIARY_SEND_FILTER, AL_EFFECTSLOT_NULL, 0, AL_FILTER_NULL); alSourcei(id, AL_DIRECT_FILTER, AL_FILTER_NULL); efxEnabled = false; } alSourcei(id, AL_SOURCE_RELATIVE, AL_TRUE); alSourcef(id, AL_ROLLOFF_FACTOR, 0.f); alSource3f(id, AL_POSITION, 0.0f, 0.0f, -1.0f * ELMOS_TO_METERS); #ifdef __APPLE__ alSourcef(id, AL_REFERENCE_DISTANCE, referenceDistance * ELMOS_TO_METERS); #endif } else { if (item->buffer->GetChannels() > 1) { LOG_L(L_WARNING, "Can not play non-mono \"%s\" in 3d.", item->buffer->GetFilename().c_str()); } in3D = true; if (efx->enabled) { efxEnabled = true; alSourcef(id, AL_AIR_ABSORPTION_FACTOR, efx->GetAirAbsorptionFactor()); alSource3i(id, AL_AUXILIARY_SEND_FILTER, efx->sfxSlot, 0, AL_FILTER_NULL); alSourcei(id, AL_DIRECT_FILTER, efx->sfxFilter); efxUpdates = efx->updates; } alSourcei(id, AL_SOURCE_RELATIVE, AL_FALSE); pos *= ELMOS_TO_METERS; alSource3f(id, AL_POSITION, pos.x, pos.y, pos.z); curHeightRolloffModifier = heightRolloffModifier; alSourcef(id, AL_ROLLOFF_FACTOR, ROLLOFF_FACTOR * item->rolloff * heightRolloffModifier); #ifdef __APPLE__ alSourcef(id, AL_MAX_DISTANCE, 1000000.0f); //! Max distance is too small by default on my Mac... ALfloat gain = channel->volume * item->GetGain() * volume; if (gain > 1.0f) { //! OpenAL on Mac cannot handle AL_GAIN > 1 well, so we will adjust settings to get the same output with AL_GAIN = 1. ALint model = alGetInteger(AL_DISTANCE_MODEL); ALfloat rolloff = ROLLOFF_FACTOR * item->rolloff * heightRolloffModifier; ALfloat ref = referenceDistance * ELMOS_TO_METERS; if ((model == AL_INVERSE_DISTANCE_CLAMPED) || (model == AL_INVERSE_DISTANCE)) { alSourcef(id, AL_REFERENCE_DISTANCE, ((gain - 1.0f) * ref / rolloff) + ref); alSourcef(id, AL_ROLLOFF_FACTOR, (gain + rolloff - 1.0f) / gain); alSourcef(id, AL_GAIN, 1.0f); } } else { alSourcef(id, AL_REFERENCE_DISTANCE, referenceDistance * ELMOS_TO_METERS); } #endif } alSourcePlay(id); if (item->buffer->GetId() == 0) LOG_L(L_WARNING, "CSoundSource::Play: Empty buffer for item %s (file %s)", item->name.c_str(), item->buffer->GetFilename().c_str()); CheckError("CSoundSource::Play"); }
ALint CDECL wine_alGetInteger(ALenum param) { return alGetInteger(param); }
JNIEXPORT jint JNICALL Java_org_lwjgl_openal_AL10_nalGetInteger(JNIEnv *__env, jclass clazz, jint paramName, jlong __functionAddress) { alGetIntegerPROC alGetInteger = (alGetIntegerPROC)(intptr_t)__functionAddress; UNUSED_PARAMS(__env, clazz) return (jint)alGetInteger(paramName); }
static int lua_alGet(lua_State* lua_state) { ALenum enum_parameter; int openal_primitive_type; enum_parameter = lua_tointeger(lua_state, 1); openal_primitive_type = lua_getTypeForEnum(enum_parameter); switch(openal_primitive_type) { case LUAOPENAL_BOOL_TYPE: { ALboolean ret_val; ret_val = alGetBoolean(enum_parameter); lua_pushboolean(lua_state, ret_val); return 1; break; } case LUAOPENAL_INT_TYPE: { ALint ret_val; ret_val = alGetInteger(enum_parameter); lua_pushinteger(lua_state, ret_val); return 1; break; } case LUAOPENAL_FLOAT_TYPE: { ALfloat ret_val; ret_val = alGetFloat(enum_parameter); lua_pushnumber(lua_state, ret_val); return 1; break; } case LUAOPENAL_INT_3_TYPE: { ALint ret_val[3]; alGetIntegerv(enum_parameter, ret_val); lua_pushinteger(lua_state, ret_val[0]); lua_pushinteger(lua_state, ret_val[1]); lua_pushinteger(lua_state, ret_val[2]); return 3; break; } case LUAOPENAL_FLOAT_3_TYPE: { ALfloat ret_val[3]; alGetFloatv(enum_parameter, ret_val); lua_pushnumber(lua_state, ret_val[0]); lua_pushnumber(lua_state, ret_val[1]); lua_pushnumber(lua_state, ret_val[2]); return 3; break; } case LUAOPENAL_FLOAT_6_TYPE: { ALfloat ret_val[6]; alGetFloatv(enum_parameter, ret_val); lua_pushnumber(lua_state, ret_val[0]); lua_pushnumber(lua_state, ret_val[1]); lua_pushnumber(lua_state, ret_val[2]); lua_pushnumber(lua_state, ret_val[3]); lua_pushnumber(lua_state, ret_val[4]); lua_pushnumber(lua_state, ret_val[5]); return 6; break; } case LUAOPENAL_STRING_TYPE: { const ALchar* ret_val; ret_val = alGetString(enum_parameter); lua_pushstring(lua_state, ret_val); return 1; break; } default: { /* TODO: Figure out how to handle OpenAL extensions. */ luaL_error(lua_state, "Unhandled parameter type for alGetSource*"); } } return 0; }
void SoundSource::updateDistanceAttenuation() { if(!mActive) return; Ogre::Real mDistance = getDistanceToListener(); Ogre::Real critDist; switch(alGetInteger(AL_DISTANCE_MODEL)) { case AL_NONE: mDistanceAttenuation = 1.0f; break; case AL_INVERSE_DISTANCE: if ((critDist = mReferenceDistance + (mRolloffFactor * (mDistance - mReferenceDistance))) <= 0.0) mDistanceAttenuation = 1.0; else mDistanceAttenuation = mReferenceDistance / critDist; break; case AL_INVERSE_DISTANCE_CLAMPED: if (mMaxDistance <= mReferenceDistance) mDistanceAttenuation = 1.0; else if ((critDist = mReferenceDistance + (mRolloffFactor * (std::min(std::max(mDistance, mReferenceDistance), mMaxDistance) - mReferenceDistance))) <= 0.0) mDistanceAttenuation = 1.0; else mDistanceAttenuation = mReferenceDistance / critDist; break; case AL_LINEAR_DISTANCE: if (mMaxDistance <= mReferenceDistance) mDistanceAttenuation = 1.0; else mDistanceAttenuation = float(1.0) - mRolloffFactor * (mDistance - mReferenceDistance) / (mMaxDistance - mReferenceDistance); break; case AL_LINEAR_DISTANCE_CLAMPED: if (mMaxDistance <= mReferenceDistance) mDistanceAttenuation = 1.0; else mDistanceAttenuation = float(1.0) - mRolloffFactor * (std::min(std::max(mDistance, mReferenceDistance), mMaxDistance) - mReferenceDistance) / (mMaxDistance - mReferenceDistance); break; case AL_EXPONENT_DISTANCE: if (mReferenceDistance == 0.0) mDistanceAttenuation = 1.0; else if ((critDist = mDistance / mReferenceDistance) == 0) mDistanceAttenuation = 1.0; else mDistanceAttenuation = Ogre::Math::Pow(critDist, -mRolloffFactor); break; case AL_EXPONENT_DISTANCE_CLAMPED: if ((mMaxDistance <= mReferenceDistance) || (mReferenceDistance == 0.0f)) mDistanceAttenuation = 1.0; else if ((critDist = std::min(std::max(mDistance, mReferenceDistance), mMaxDistance) / mReferenceDistance) == 0) mDistanceAttenuation = 1.0; else mDistanceAttenuation = Ogre::Math::Pow(critDist, -mRolloffFactor); break; } }
int lime_al_get_integer (int param) { return alGetInteger (param); }
value lime_al_get_integer (value param) { return alloc_int (alGetInteger (val_int (param))); }
//***************************************************************************** // alGetInteger //***************************************************************************** // ALAPI ALint ALAPIENTRY alGetInteger(ALenum param) { AL_RESULT_FXN(alGetInteger(param), ALint, 0); }