mistermitchell
03-26-2006, 03:11 PM
Hello...I've made a program with Visual Basic 2005 which plays .wav files using DirectX 8 DirectSound...but I can't find a way to add effects such as Echo or Distortion to a buffer...methods for doing this in VB6 don't seem to work at all so directx4vb.com didn't help....could someone please help me with this problem?
Leade
03-30-2006, 04:39 AM
When setting the flags during creation you must set the FX flag in order to apply effects
if no effects are need then the following flags are ok
.lFlags = DSBCAPS_LOCDEFER Or DSBCAPS_CTRLFREQUENCY Or DSBCAPS_CTRLPAN Or DSBCAPS_CTRLVOLUME Or DSBCAPS_CTRLPOSITIONNOTIFY Or DSBCAPS_STATIC
however the moment you add fx then you lose most of the thing you can do and have to use on the following flags
.lFlags = DSBCAPS_LOCDEFER Or DSBCAPS_CTRLPAN Or DSBCAPS_CTRLVOLUME Or DSBCAPS_CTRLPOSITIONNOTIFY Or DSBCAPS_STATIC Or DSBCAPS_CTRLFX
as you can see DSBCAPS_CTRLFREQUENCY is missing, this is because you can't use DSBCAPS_CTRLFREQUENCY and DSBCAPS_CTRLFX at the same time.
Hope that helps.
mistermitchell
03-30-2006, 08:12 PM
I tried that but I still keep getting the same errors...maybe you could look at this code and point out some errors to me...
If e.KeyData = Keys.Z Then
DSBuffer = DS.CreateSoundBufferFromFile(appPath & "\piano\noteZ.wav", BufferDesc)
DSBuffer.Play(DxVBLibA.CONST_DSBPLAYFLAGS.DSBPLAY_DEFAULT)
DSBuffer.SetFX(1, FXList, lReturn)
objFX_Distortion = DSBuffer.GetObjectinPath(DxVBLibA.AUDIOCONSTANTS.DSFX_STANDARD_DISTORT ION, _
1, DxVBLibA.AUDIOCONSTANTS.IID_DirectSoundFXDistortion)
objFX_Distortion.SetAllParameters(FX_Distortion)
This bit of code gives me an error when the Z key is pressed which reads...
System.Runtime.InteropServices.COMException (0x8002802B): Element not found. (Exception from HRESULT: 0x8002802B (TYPE_E_ELEMENTNOTFOUND))
at DxVBLibA.DirectSoundSecondaryBuffer8.SetFX(Int32 lEffectsCount, Array& Buffers, Array& lResultIDs)
This error comes from the DSBuffer.SetFX(1, FXList, lReturn) line of the code.
Rockoon
04-01-2006, 12:43 AM
Are you sure that your hardware supports effects natively? I am quite certain that almost all audio programs that impliment effects do so in software, not hardware (excluding EAX support used in some games)
That often means processing the audio stream before it gets to the soundcards internal buffers (things like echo and reverb can be done without processing the stream by using multiple channels)
mistermitchell
04-01-2006, 05:39 PM
Ummm...I don't know where this hardware and software talk is coming from...I'm using direct x...which I always thought was software.
Iceplug
04-01-2006, 06:22 PM
All software uses hardware. DirectSound software uses the speakers and the sound card software.
Rockoon
04-02-2006, 05:30 AM
Not all hardware has the same features, and the DirectX API does not attempt to impliment all features that might be lacking in the hardware via software.
This is why a video or sound card for example might advertise itself as "compatible" OR "compliant" with DirectX 8.1 meaning that it supports a specific minimum specification OR the entire specification.
The DirectX API does not attempt to emulate ANYTHING that is part of the minimum specification.
Further, the DirectX API (as well as OpenGL and OpenAL) often has "extensions" specific to particular hardware that goes above and beyond the entire specification. Pixel shaders were once an "extension" of DirectX and OpenGL.. ie, not part of the specification at all!
I believe that in your specific case, the hardware you are using does not support the features you are trying to utilize and further that those features are probably not part of the minimum specification.
mistermitchell
04-02-2006, 11:23 AM
Well....that is certainly something to consider...but...if I can get direct sound to change the frequency of buffered sounds...then I'd say it should be able to do something like add distortion....Pretty well everything in Visual Basic 2005 is different from VB6....I've been running into these sorts of problems alot where it's just a matter of knowing the new way of doing things.
Rockoon
04-03-2006, 01:56 AM
Well....that is certainly something to consider...but...if I can get direct sound to change the frequency of buffered sounds...then I'd say it should be able to do something like add distortion....Pretty well everything in Visual Basic 2005 is different from VB6....I've been running into these sorts of problems alot where it's just a matter of knowing the new way of doing things.
Changing the frequency is extremely simple to impliment... (simply send samples faster or slower to the DAC than is considered normal.. usualy 44.1khz is considered normal)
...feedback isn't.
mistermitchell
04-08-2006, 06:28 PM
:mad: Well...I decided to revert back to VB6 for this project and I can now add sound effects like I wanted to...thanks for your attempts to help...there are way too many changes in Visual Basic 2005 for a beginner such as myself to learn with...I'll have to wait until more people know about it before I can learn how to use it.
Leade
04-09-2006, 12:04 PM
:mad: Well...I decided to revert back to VB6 for this project and I can now add sound effects like I wanted to...thanks for your attempts to help...there are way too many changes in Visual Basic 2005 for a beginner such as myself to learn with...I'll have to wait until more people know about it before I can learn how to use it.
I figure out the problem anyway
you cannot set the effects while the sample is playing, to have to get all the sound effect classes before you play the sound the afterward you can adjust them in real time as you wish.
Also when creating you cannot use the DSBCAPS_STATIC with DSBCAPS_FX i forgot to take that out sorry.:whoops:
mistermitchell
04-14-2006, 07:08 PM
Have you done this with Visual Basic 2005? I could not get effects to work at all with that bull****...It is good in the way it creates buffers automatically but it's pretty well impossible for me to find a way to apply effects....as a result the vb2005 and vb6 versions of my program are pretty well 2 different programs that do different things...What I'd really like to know is how to have both progams open at the same time handling keystrokes....With the vb2005 program controlling the num pad and the vb6 controlling everything else.
death_entry
04-20-2006, 10:50 AM
I was under the impression that only one program could have focus at any one time.