|
View:
New views
3 Messages
—
Rating Filter:
Alert me
|
|
|
Openal Driver Issue on windows xpPlease help,
I cannot seem to get openal 3d effect to work. When I enumerate the devices using "ALC_ENUMERATION_EXT" and ALC_DEVICE_SPECIFIER etc only 2 devices are listed .. Generic Hardware and Generic Software. I have a gigabit motherboard with the Realtek audio driver. The sounds play but with no position or distance effect. Even with listen position 0,0,0 and orientation 0,1,0,0,0,1 and source postion 100,0,0 or 0,0,100 and AL_REFERENCE_DISTANCE 1.0 and AL_MAX_DISTANCE 2.0 and AL_ROLLOFF_FACTOR 1.0 there is no attenuation of sound. Thinking that it might be some kind of driver issue I bought a Sound Blaster X-FiXtreme Audio Card I removed the realtek drivers and disabled the on board audio then install the sound blaster card and drivers. still same result. I downloaded the Aug 2008 directx SDK and installed it with same result I played with the 3d sound example app in the directx SDK and it seams to work fine. Please help .. here is the code RCODE SelectSndDevice( VxIrrBase * poMgr ) { char deviceName[256] = {0}; char *defaultDevice=NULL; char *deviceList=NULL; if( alcIsExtensionPresent(NULL, (ALCchar*)"AL_EXT_MP3") == AL_TRUE ) { log_msg( 0, "SelectSndDevice: openal MP3 extention available\n" ); } else { log_msg( 0, "SelectSndDevice: openal MP3 extention is NOT available\n" ); } char * devList[50]; int iDeviceCnt = 0; int iDefaultDeviceIdx = 0; if( alcIsExtensionPresent(NULL, (ALCchar*)"ALC_ENUMERATION_EXT") == AL_TRUE ) { // try out enumeration extension ALCchar * deviceList = (char *)alcGetString(NULL, ALC_DEVICE_SPECIFIER); //devList.numDevices = 0; if( strlen(deviceList) ) { //devList.numDevices=1; defaultDevice = (char *)alcGetString(NULL, ALC_DEFAULT_DEVICE_SPECIFIER); //devList.numDefaultDevice = 0; for( U16 numDevices = 0; numDevices < 16; numDevices++ ) { devList[numDevices] = deviceList; log_msg( 0, "SelectSndDevice: device found %s ", deviceList ); if (defaultDevice && strcmp(devList[numDevices], defaultDevice) == 0) { iDefaultDeviceIdx = numDevices; } deviceList += strlen(deviceList); if (deviceList[0] == 0) { if (deviceList[1] == 0) { break; } else { iDeviceCnt++; deviceList++; } } } } } return 0; } //--------------------------------------------------------------------------- //! initialize sound manager RCODE VxSoundMgr::StartupSoundMgr( VxIrrBase * poMgr ) { //RegisterWithSquirrelScripting(); m_poGameMgr = poMgr; //=== setup audiere ===// //m_poAudiereDevice = audiere::OpenDevice(); //if( ! m_poAudiereDevice ) //{ // log_msg( 0, "Could not open Audiere sound device" ); // vx_assert( false ); //} //=== setup openal ===// SelectSndDevice( m_poGameMgr ); m_poSndDevice = alcOpenDevice((ALchar*)"DirectSound3D"); if( m_poSndDevice == NULL ) { log_msg( 0, "VxSoundMgr::StartupSoundMgr: Could not create DirectSound3D Device\n" ); vx_assert( FALSE ); } CheckForSndErrors(); int result[2]; //alcGetIntegerv( m_poSndDevice, ALC_MAJOR_VERSION, 4, &result[0]); //alcGetIntegerv( m_poSndDevice, ALC_MINOR_VERSION, 4, &result[1]); //log_msg( 0, "VxSoundMgr::StartupSoundMgr: OpenAl Version Major %d Minor %d\n", result[0], result[1] ); //Create context(s) m_poSndContext = alcCreateContext( m_poSndDevice, NULL ); if( m_poSndContext == NULL ) { log_msg( 0, "VxSoundMgr::StartupSoundMgr: Could not create DirectSound3D Context\n" ); vx_assert( FALSE ); } CheckForSndErrors(); //Set active context alcMakeContextCurrent( m_poSndContext ); CheckForSndErrors(); //alListenerfv( AL_ORIENTATION, (ALfloat*)&m_oSndListenOri); CheckForSndErrors(); irr::core::vector3df v3fSrcPos( 0.0f, 0.0f, 100.0f ); irr::core::vector3df v3fListenPos( 0.0f, 0.0f, 0.0f ); ALfloat ori[6]; ori[0] = 0.0f; ori[1] = 1.0f; ori[2] = 0.0f; ori[3] = 0.0f; ori[4] = 0.0f; ori[5] = 1.0f; PlayTestSound( v3fSrcPos, v3fListenPos, ori, "media/soundsnap/animal/Lion_growl_low_soft_01_SFXBible_ss00230.wav" ); // Clear Error Code alGetError(); return 0; } //--------------------------------------------------------------------------- //! play test sound void VxSoundMgr::PlayTestSound( irr::core::vector3df v3fSrcPos, irr::core::vector3df v3fListenPos, float * pf32Ori, char * pFileName ) { alListenerfv(AL_POSITION, (ALfloat*)&v3fListenPos); alListenerfv(AL_ORIENTATION, (ALfloat*)pf32Ori); VxSndSource oSndSrc; oSndSrc.m_poMgr = m_poGameMgr; oSndSrc.m_bAlLoop = true; ALboolean loop; loop = oSndSrc.m_bAlLoop; alutLoadWAVFile( (ALbyte *)pFileName, &oSndSrc.m_eAlFormatBuffer, (void **) &oSndSrc.m_pAlBuffer, (unsigned int *)&oSndSrc.m_iAlBufferLen, &oSndSrc.m_iAlFreqBuffer, &loop ); alGenSources(1, &oSndSrc.m_uiAlSource); alGenBuffers(1, &oSndSrc.m_uiAlSampleSet); alBufferData( oSndSrc.m_uiAlSampleSet, oSndSrc.m_eAlFormatBuffer, oSndSrc.m_pAlBuffer, oSndSrc.m_iAlBufferLen, oSndSrc.m_iAlFreqBuffer ); alSourcei(oSndSrc.m_uiAlSource, AL_BUFFER, oSndSrc.m_uiAlSampleSet); alutUnloadWAV( oSndSrc.m_eAlFormatBuffer, oSndSrc.m_pAlBuffer, oSndSrc.m_iAlBufferLen, oSndSrc.m_iAlFreqBuffer); //oSndSrc.SetPosition( v3fSrcPos ); alSource3f(oSndSrc.m_uiAlSource, AL_POSITION, v3fSrcPos.X, v3fSrcPos.Y, v3fSrcPos.Z ); // set the pitch alSourcef( oSndSrc.m_uiAlSource,AL_PITCH,1.0f); // set the gain alSourcef( oSndSrc.m_uiAlSource,AL_GAIN,1.0f); // AL_REFERENCE_DISTANCE f, fv, i, iv the distance under which the volume // for the source would normally drop by half (before being influenced // by rolloff factor or AL_MAX_DISTANCE) alSourcei( oSndSrc.m_uiAlSource, AL_SOURCE_RELATIVE, AL_FALSE ); alSourcef( oSndSrc.m_uiAlSource, AL_REFERENCE_DISTANCE, 1.0f ); alSourcef( oSndSrc.m_uiAlSource, AL_MAX_DISTANCE, 2.0f ); alSourcef( oSndSrc.m_uiAlSource, AL_ROLLOFF_FACTOR, 1.0f ); //oSndSrc.Enable3DEffect( TRUE ); // set looping alSourcei( oSndSrc.m_uiAlSource, AL_LOOPING, AL_TRUE ); // play sound alSourcePlay( oSndSrc.m_uiAlSource ); } |
|
|
Re: Openal Driver Issue on windows xpOn Monday 10 November 2008 04:28:17 am slytron wrote:
> The sounds play but with no position or distance effect. > Even with listen position 0,0,0 and orientation 0,1,0,0,0,1 and source > postion 100,0,0 or 0,0,100 and AL_REFERENCE_DISTANCE 1.0 and > AL_MAX_DISTANCE 2.0 and AL_ROLLOFF_FACTOR 1.0 > there is no attenuation of sound. Is the sound mono or stereo? Stereo sounds won't position or get attenuated. Also, with the max distance set to 2, any source-listener distance beyond 2 units won't attenuate farther. A couple unrelated comments on the code, though.. > if( alcIsExtensionPresent(NULL, (ALCchar*)"AL_EXT_MP3") == AL_TRUE ) I wouldn't rely on this extension. AFAIK, the Windows version doesn't support it, and the new Linux version doesn't either. You're better off using an external lib to decode it and load/stream it with OpenAL (it may also be beneficial to use Vorbis instead of MP3, as its free-er and compresses better). > m_poSndDevice = alcOpenDevice((ALchar*)"DirectSound3D"); And try not to hardcode device names like this. It may not always be available. _______________________________________________ Openal-devel mailing list Openal-devel@... http://opensource.creative.com/mailman/listinfo/openal-devel |
|
|
|
| Free embeddable forum powered by Nabble | Forum Help |