Re: How to copy source/data of LDIRECTSOUNDBUFFER to LDIRECTSOUNDBUFFER8 variable.



Thanks , i can capture and add effect then playback at the same time. I use
LDIRECTSOUNDBUFFER8 instead of LDIRECTSOUNDBUFFER. The app run well.

But i have other question: i see that the demo have a delay time between i
say into microphone and playback to device. delay time about 120 - 140
miliseconds. Can you show me the reason?
And can you help me fix this, i would like to "say and hear" are realtime
or decrease time delay?

Thanks for your help.

"Chris P. [MVP]" <msdn@xxxxxxxxxxxx> wrote in message
news:1edy5m56pptxe$.1q8b49i8sluhq$.dlg@xxxxxxxxxxxxx
On Sat, 9 Sep 2006 16:23:58 +0700, Paul wrote:

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?

Well error codes returned are always useful. What error does it give you?

IDirectSoundBuffer8 replaces IDirectSoundBuffer and is all you need to
use,
but you do have to query interface on the IDirectSoundBuffer returned from
CreateBuffer() to get it.

if( FAILED( hr = m_pDS->CreateSoundBuffer( &dsbd, &pDSBuffer, NULL ) ) )
return DXTRACE_ERR_MSGBOX( TEXT("CreateSoundBuffer"), hr );
if( FAILED( hr = pDSBuffer->QueryInterface( IID_IDirectSoundBuffer8,
(VOID**)&m_pDSBOutput ) ) )
return DXTRACE_ERR_MSGBOX( TEXT("QueryInterface"), hr );

--
http://www.chrisnet.net/code.htm
http://www.avdevforum.com/AV


.