Hi Robert,
I just built an application using this code and the filter is working
correctly for me (the sound becomes filtered and much quieter).
In the initialization code ...
DeviceName=alcGetString(0,ALC_DEFAULT_DEVICE_SPECIFIER);
//ALC_DEFAULT_ALL_DEVICES_SPECIFIER this was here in henrys code
printf("\n\nDevice is %s\n",DeviceName);
That code will display the name of the *default* device on the system -
which should be the one you opened - but I think the purpose of the log is
to display the device that is being used. In which case you need to use
the following ...
DeviceName=alcGetString(Device,ALC_DEVICE_SPECIFIER);
printf("\n\nDevice Used is %s\n",DeviceName);
i.e. pass in the device handle and use the ALC_DEVICE_SPECIFIER enum.
What device name is returned? What versions of the openal32.dll and
wrap_oal.dll files do you have?
Thanks,
Dan
Creative Labs (UK) Ltd.
Notice
The information in this message is confidential and may be legally
privileged. It is intended solely for the addressee. Access to this
message by anyone else is unauthorized. If you are not the intended
recipient, any disclosure, copying or distribution of the message, or
any action taken by you in reliance on it, is prohibited and may be
unlawful. If you have received this message in error, please delete it
and contact the sender immediately. Thank you.
Creative Labs UK Ltd company number 2658256 registered in England and Wales
at Belmont Road, Belmont Place, Maidenhead, Berkshire, SL6 6TB
Robert Smyth
<
macgabhr@...>
Sent by: To
openal-bounces@op
openal@...
ensource.creative cc
.com
Subject
[Openal] Adding filters
05/26/2009 10:43
AM
Hi,
I am trying to add filters to a raw source using openal. THe code I am
using can be seen below. I have read the sdk ext manual and seem to be
doing everything correctly. The program compiles and I get a correct sound
device to be found and no erros when creating my filter but instead of
playing the filtered source it just repeats what has already been played,
i.e the filter doesnt seem to work. I am using microsoft visual studio 9.0
on a dell precision through windows.
// Basic.cpp : Defines the entry point for the console application.
//
// Basic
// Just makes a basic sound for a few seconds then applies a low pass
filter
// Then some effects
#include
<alut.h>
#include
<efx.h>
#include
<conio.h>
#include
<stdlib.h>
#include
<stdio.h>
#include
<al.h>
#include
<alc.h>
#include
<EFX-Util.h>
#include
<efx-creative.h>
#define
NULL 0
LPALGENFILTERS alGenFilters;
LPALFILTERI alFilteri;
LPALFILTERF alFilterf;
LPALGENEFFECTS alGenEffects;
LPALEFFECTI alEffecti;
LPALEFFECTF alEffectf;
LPALGENAUXILIARYEFFECTSLOTS alGenAuxiliaryEffectSlots;
LPALAUXILIARYEFFECTSLOTI alAuxiliaryEffectSloti;
LPALISFILTER alIsFilter;
int
main(int argc, char **argv)
{
ALuint helloBuffer, source;
ALuint filter,filtera;
ALuint EffectSlot,ReverbEffect;
ALCcontext *Context;
ALCdevice *Device;
ALCint iSends;
const
ALCchar *DeviceName;
// Setting up openal
alutInit (&argc, argv);
Context=alcGetCurrentContext();
Device=alcGetContextsDevice(Context);
DeviceName=alcGetString(0,ALC_DEFAULT_DEVICE_SPECIFIER);
//ALC_DEFAULT_ALL_DEVICES_SPECIFIER this was here in henrys code
printf(
"\n\nDevice is %s\n",DeviceName);
// And effects definitions
alGenFilters = (LPALGENFILTERS)alGetProcAddress(
"alGenFilters");
alFilteri=(LPALFILTERI)alGetProcAddress(
"alFilteri");
alFilterf=(LPALFILTERF)alGetProcAddress(
"alFilterf");
alGenEffects=(LPALGENEFFECTS)alGetProcAddress(
"alGenEffects");
alEffecti=(LPALEFFECTI)alGetProcAddress(
"alEffecti");
alEffectf=(LPALEFFECTF)alGetProcAddress(
"alEffectf");
alGenAuxiliaryEffectSlots=(LPALGENAUXILIARYEFFECTSLOTS)alGetProcAddress(
"alGenAuxiliaryEffectSlots");
alAuxiliaryEffectSloti=(LPALAUXILIARYEFFECTSLOTI)alGetProcAddress(
"alAuxiliaryEffectSloti");
alIsFilter= (LPALISFILTER)alGetProcAddress(
"alIsFilter");
// Setup Buffer from input file or helloworld
if(argc==2)
helloBuffer= alutCreateBufferFromFile(argv[1]);
else
helloBuffer = alutCreateBufferHelloWorld ();
// Generate Source and attach buffer
alGenSources(1,&source);
alSourcei(source,AL_BUFFER,helloBuffer);
// Set up some soruce parameters
alSourcei(source, AL_LOOPING, AL_TRUE);
printf(
"\nRaw Source\n");
alSourcePlay (source);
alutSleep(3);
alSourceStop(source);
// Now with a filter
alGetError();
alGenFilters(1,&filter);
if
(alGetError() == AL_NO_ERROR)
printf(
"Generated Filter %i\n",filter);
alFilteri(filter,AL_FILTER_TYPE,AL_FILTER_LOWPASS);
if
(alGetError() != AL_NO_ERROR)
printf(
"Low Pass Filter not supported\n");
else
{
alFilterf(filter,AL_LOWPASS_GAIN,0.5);
alFilterf(filter,AL_LOWPASS_GAINHF,0.01);
}
alSourcei(source,AL_DIRECT_FILTER,filter);
if
(alGetError() == AL_NO_ERROR)
{
printf(
"\nFiltered Source\n");
}
alSourcePlay (source);
alutSleep(3);
alSourceStop(source);
--
Robert Smyth_______________________________________________
Openal mailing list
Openal@...
http://opensource.creative.com/mailman/listinfo/openalForwardSourceID:NT0006C81A
_______________________________________________
Openal mailing list
Openal@...
http://opensource.creative.com/mailman/listinfo/openal