I'm using code similar to this:
byte[] arrData = ... // get the wave data
IntPtr intPtrData = Marshal.AllocHGlobal( arrData.Length );
Marshal.Copy( arrData, 0, intPtrData, arrData.Length );
sipxCallStartPlayBuffer( callHandle, intPtrData, arrData.Length, false, true,
true );
Marshal.FreeHGlobal( intPtrData );
and this works, at least for short recordings.
Regards,
Daníel
> From: [EMAIL PROTECTED]> To: [email protected]> CC: [EMAIL
> PROTECTED]> Subject: Re: [sipxtapi-dev] SipxCallPlayBufferStart and jerky
> output ...I'm puzzled !> Date: Thu, 14 Jun 2007 16:49:45 +0200> > I think I
> have tested with Marshal.AllocHGlobal, and got the same garbled> output.> >
> Currently it's done like this:> > m_spMemoryStream = new SpMemoryStream();> >
> m_spMemoryStream.Format.Type =>
> SpeechLib.SpeechAudioFormatType.SAFT8kHz16BitMono;> >
> m_spVoice.AudioOutputStream = m_spMemoryStream;> >
> m_spVoice.Speak(speechString, SpeechVoiceSpeakFlags.SVSFDefault |>
> SpeechVoiceSpeakFlags.SVSFPurgeBeforeSpeak );> > > byte [] byteArray =
> (byte[]) m_spMemoryStream.GetData();> > GCHandle gcHandle =
> GCHandle.Alloc(byteArray, GCHandleType.Pinned);> > IntPtr bufferIntPtr =
> gcHandle.AddrOfPinnedObject();> > SipxCallPlayBufferStart(m_handleIntPtr,
> bufferIntPtr, byteArray.Length, 0,> false, false, true);> > > > -----
> Original Message ----- > From: "Daniel Sigurgeirsson" <[EMAIL PROTECTED]>>
> To: "stipus" <[EMAIL PROTECTED]>; <[email protected]>> Sent:
> Thursday, June 14, 2007 4:16 PM> Subject: RE: [sipxtapi-dev]
> SipxCallPlayBufferStart and jerky output> ...I'mpuzzled !> > > How is the
> buffer allocated in the first place? I've used the> sipxCallPlayBufferStart
> (from .NET) with no problems, allocating buffer> using Marshal.AllocHGlobal(
> ).> > Regards,> Daníel> >
_________________________________________________________________
Play free games, earn tickets, get cool prizes! Join Live Search Club.
http://club.live.com/home.aspx?icid=CLUB_wlmailtextlink
_______________________________________________
sipxtapi-dev mailing list
[email protected]
List Archive: http://list.sipfoundry.org/archive/sipxtapi-dev/