How to copy source/data of LDIRECTSOUNDBUFFER to LDIRECTSOUNDBUFFER8 variable.
Hi all
Directsound have two samples: One is soundFX and other is DuplexFilter
sample
In soundFX, the app used LDIRECTSOUNDBUFFER8 with purpose are using setFX
function.
But in DuplexFilter, app used LDIRECTSOUNDBUFFER for capture and playback
at the same time.
Now , I would like to combine two sample. I would like to capture and add
effect and playback sound ( my voice through microphone) at the same time?
Can i do this?
I have tried to do as follow:
first i will have m_pDSBCapture, a capture sound buffer, (from my voice)
with type is LDIRECTSOUNDBUFFER and m_pDSBOutput, a output sound buffer, is
same type. I also have a m_pDSB8 with type is LDIRECTSOUNDBUFFER8 .
Now, i want to copy data from m_pDSBCapture or m_pDSBOutput to m_pDSB8 so
that i can call setFX and Play function for m_pDSB8 . How can i do this???
I call m_pDSBOutput->QueryInterface( IID_IDirectSoundBuffer8, (LPVOID*)
&m_pDSB8 ) ) ) then is failed.
Can anyone show me solution? Do you have sample source do this?
Thanks
You really shouldn't use both. You should standardize on IDirectSoundBuffer8. You can use IDirectSoundBuffer::DuplicateSoundBuffer(). It's also available for IDirectSoundBuffer8.
It's fairly simple to change the DuplexFilter sample to use IDirectSoundBuffer8. Just take the buffer creation code from the soundFX sample and replace the creation code in the DuplexFilter sample with it.
It's fairly simple to change the DuplexFilter sample to use IDirectSoundBuffer8. Just take the buffer creation code from the soundFX sample and replace the creation code in the DuplexFilter sample with it.
Thank you,
i will call IDirectSoundBuffer::DuplicateSoundBuffer()to copy data source from LDirectsoundBuffer variable to LDirectsoundBuffer8 variable, right?
If right, can i set effect sound for LDirectsoundBuffer8 var by call SetFX function? Because these are process realtime, capture and add effect and playback at the same time, so i wonder can i do that with directsound?
Can you help me more?
i will call IDirectSoundBuffer::DuplicateSoundBuffer()to copy data source from LDirectsoundBuffer variable to LDirectsoundBuffer8 variable, right?
If right, can i set effect sound for LDirectsoundBuffer8 var by call SetFX function? Because these are process realtime, capture and add effect and playback at the same time, so i wonder can i do that with directsound?
Can you help me more?
No problem. If I were you, I would standardize on IDirectSoundBuffer8 for everything and avoid this mess altogether.
Quote:
i will call IDirectSoundBuffer::DuplicateSoundBuffer()to copy data source from LDirectsoundBuffer variable to LDirectsoundBuffer8 variable, right?
Careful with that. Duplicating the sound buffer only duplicates the read/write pointers, volume control, etc. It DOES NOT duplicate the data, it shares it.
Quote:
If right, can i set effect sound for LDirectsoundBuffer8 var by call SetFX function?
I don't believe you can. The duplicate function is only supported for buffers that do not have sound fx controls. You may be able to add sound effect control after duplicating, but it doesn't seem like that is possible.
Quote:
Because these are process realtime, capture and add effect and playback at the same time, so i wonder can i do that with directsound?
I would suggest having 2 buffers. Capture into one buffer, then lock it and copy the data into another buffer. This "other" buffer will support your sound effects and play the sound as you like.
Hope that helps.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement