Vector3 OpenALDevice::getListenerVelocity() const { ALfloat v[3]; alGetListenerfv(AL_VELOCITY, v); return Vector3(v[0], v[1], v[2]); }
void OALAudioEngine::GetListenerOri(float3& face, float3& up) const { float v[6]; alGetListenerfv(AL_ORIENTATION, v); face = ALVecToVec(float3(v)); up = ALVecToVec(float3(&v[3])); }
NzVector3f NzAudio::GetListenerVelocity() { NzVector3f velocity; alGetListenerfv(AL_VELOCITY, velocity); return velocity; }
Vector3 OpenALDevice::getListenerLocation() const { ALfloat p[3]; alGetListenerfv(AL_POSITION, p); return Vector3(p[0], p[1], p[2]); }
NzVector3f NzAudio::GetListenerPosition() { NzVector3f position; alGetListenerfv(AL_POSITION, position); return position; }
NzVector3f NzAudio::GetListenerDirection() { ALfloat orientation[6]; alGetListenerfv(AL_ORIENTATION, orientation); return NzVector3f(orientation[0], orientation[1], orientation[2]); }
//////////////////////////////////////////////////////////// /// Get the current orientation of the listener (the point /// he's looking at) //////////////////////////////////////////////////////////// ofxVec3f Listener::GetTarget() { float Orientation[6]; ALCheck(alGetListenerfv(AL_ORIENTATION, Orientation)); return ofxVec3f(Orientation[0], Orientation[1], Orientation[2]); }
void al_getlistenerfv( int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[] ) { if (NULL == alGetListenerfv) mogl_glunsupported("alGetListenerfv"); alGetListenerfv((ALenum)mxGetScalar(prhs[0]), (ALfloat*)mxGetData(prhs[1])); }
Vector3f Listener::getDirection() { float orientation[6]; alCheck(alGetListenerfv(AL_ORIENTATION, orientation)); return Vector3f(orientation[0], orientation[1], orientation[2]); }
static seal_err_t getfv(int key, float* vector) { alGetListenerfv(key, vector); return _seal_get_openal_err(); }
glm::vec3 AudioSystem::getListenerVelocity() const { SHINY_CHECK_AUDIO_SYSTEM_VALID_CURRENT("getting listener velocity"); glm::vec3 velocity(0.0f); alGetListenerfv(AL_VELOCITY, glm::value_ptr(velocity)); SHINY_CHECK_AL_ERROR("getting listener velocity"); return velocity; }
glm::vec3 AudioSystem::getListenerPosition() const { SHINY_CHECK_AUDIO_SYSTEM_VALID_CURRENT("getting listener position"); glm::vec3 position(0.0f); alGetListenerfv(AL_POSITION, glm::value_ptr(position)); SHINY_CHECK_AL_ERROR("getting listener position"); return position; }
NzQuaternionf NzAudio::GetListenerRotation() { float orientation[6]; alGetListenerfv(AL_ORIENTATION, orientation); NzVector3f forward(orientation[0], orientation[1], orientation[2]); return NzQuaternionf::RotationBetween(NzVector3f::Forward(), forward); }
void emu_alGetListener3f(ALenum pname,ALfloat *v0,ALfloat *v1,ALfloat *v2) { ALfloat ptArray[10]; ptArray[0] = *v0; ptArray[1] = *v1; ptArray[2] = *v2; alGetListenerfv(pname, ptArray); *v0 = ptArray[0]; *v1 = ptArray[1]; *v2 = ptArray[2]; }
//Get listener Speed (3d sound) void SoundManager::GetListenerSpeed( float& velx, float& vely, float& velz ) { ALfloat vel[3]; alGetListenerfv(AL_VELOCITY, vel); //Check errors ALenum error(alGetError()); if(error != AL_NO_ERROR) { SingletonLogMgr::Instance()->AddNewLine("SoundManager::GetListenerSpeed","Failure while getting listener values (" + GetALErrorString(error,false) + ")",LOGEXCEPTION); } velx = vel[0]; vely = vel[1]; velz = vel[2]; }
glm::quat AudioSystem::getListenerOrientation() const { SHINY_CHECK_AUDIO_SYSTEM_VALID_CURRENT("getting listener orientation"); std::array<float, 6> values = {{ kForward.x, kForward.y, kForward.z, kUp.x, kUp.y, kUp.z }}; alGetListenerfv(AL_ORIENTATION, values.data()); SHINY_CHECK_AL_ERROR("getting listener orientation"); glm::vec3 direction(values[0], values[1], values[2]); glm::vec3 up(values[3], values[4], values[5]); return glm::toQuat(glm::lookAtRH(glm::vec3(0.0f), direction, up)); }
//Get listener position (3d sound) void SoundManager::GetListenerPosition( float& posx, float& posy, float& posz) { ALfloat pos[3]; alGetListenerfv(AL_POSITION, pos); //Check errors ALenum error(alGetError()); if(error != AL_NO_ERROR) { SingletonLogMgr::Instance()->AddNewLine("SoundManager::GetListenerPosition","Failure while getting listener values (" + GetALErrorString(error,false) + ")",LOGEXCEPTION); } posx = pos[0]; posy = pos[1]; posz = pos[2]; }
int main( void ) { ALCdevice *device; ALCcontext *context = NULL; ALfloat pregain = FLOAT_VAL; ALfloat postgain = 0.0; ALuint sid; device = alcOpenDevice( NULL ); if( device == NULL ) { return EXIT_FAILURE; } context = alcCreateContext( device, NULL ); if( context == NULL ) { alcCloseDevice( device ); return EXIT_FAILURE; } alcMakeContextCurrent( context ); alListenerf( AL_GAIN, pregain ); alGetListenerfv( AL_GAIN, &postgain ); if( postgain != pregain ) { fprintf( stderr, "Listener GAIN f***ed up: %f vs %f\n", pregain, postgain ); } alGenSources( 1, &sid ); alSourcef( sid, AL_GAIN, pregain ); alGetSourcefv( sid, AL_GAIN, &postgain ); if( postgain != pregain ) { fprintf( stderr, "Source GAIN f***ed up: %f vs %f\n", pregain, postgain ); } fprintf( stderr, "All tests okay\n" ); fflush( stderr ); alcMakeContextCurrent( NULL ); alcCloseDevice( device ); return EXIT_SUCCESS; }
value lime_al_get_listenerfv (int param, int count) { ALfloat* values = new ALfloat[count]; alGetListenerfv (param, values); value result = alloc_array (count); for (int i = 0; i < count; i++) { val_array_set_i (result, i, alloc_float (values[i])); } delete [] values; return result; }
value lime_al_get_listenerfv (value param, value count) { int length = val_int (count); ALfloat* values = new ALfloat[length]; alGetListenerfv (val_int (param), values); value result = alloc_array (length); for (int i = 0; i < length; ++i) { val_array_set_i (result, i, alloc_float (values[i])); } return result; }
//Get listener orientation (3d sound void SoundManager::GetListenerOrientation( float& lookatx, float& lookaty, float& lookatz, float& upx, float& upy, float& upz ) { ALfloat ori[6]; alGetListenerfv(AL_ORIENTATION, ori); //Check errors ALenum error(alGetError()); if(error != AL_NO_ERROR) { SingletonLogMgr::Instance()->AddNewLine("SoundManager::GetListenerOrientation","Failure while setting listener values (" + GetALErrorString(error,false) + ")",LOGEXCEPTION); } lookatx = ori[0]; lookaty = ori[1]; lookatz = ori[2]; upx = ori[3]; upy = ori[4]; upz = ori[5]; }
std::pair<Vector3f, Vector3f> Sound_Renderer_AL::get_listener_forward_and_up() const { ALfloat lfau[6] = {1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}; alGetListenerfv()(AL_ORIENTATION, lfau); return std::make_pair(Vector3f(lfau[0], lfau[1], lfau[2]), Vector3f(lfau[3], lfau[4], lfau[5])); }
void Audio::getVelocity(float * v) const { alGetListenerfv(AL_VELOCITY, v); }
void Audio::getOrientation(float * v) const { alGetListenerfv(AL_ORIENTATION, v); }
void Audio::getPosition(float * v) const { alGetListenerfv(AL_POSITION, v); }
ALvoid CDECL wine_alGetListenerfv(ALenum param, ALfloat* values) { alGetListenerfv(param, values); }
const Math::CVector3D COALDevice::GetOrientationUp() const { float32 pfData[6]; alGetListenerfv(AL_ORIENTATION, pfData); return Math::CVector3D(pfData[3], pfData[4], pfData[5]); }
const Math::CVector3D COALDevice::GetOrientationForward() const { float32 pfData[6]; alGetListenerfv(AL_ORIENTATION, pfData); return Math::CVector3D(pfData[0], pfData[1], pfData[2]); }
const Math::CVector3D COALDevice::GetVelocity() const { Math::CVector3D vResult; alGetListenerfv(AL_VELOCITY, vResult.GetPointer()); return vResult; }
const Math::CVector3D COALDevice::GetPosition() const { Math::CVector3D vResult; alGetListenerfv(AL_POSITION, vResult.GetPointer()); return vResult; }