DirectxEvent8 in DirectSound (HELP!) 
Author Message
 DirectxEvent8 in DirectSound (HELP!)

can anyone please tell me whats wrong in this piece of code??I am getting
run time error(Automation Error)
This is not the whole code, but the suspected error generationg code.I am a
novice.....pls help me.

Implements DirectXEvent8
Dim psary(0) As DSBPOSITIONNOTIFY

psary(0).hEventNotify = dx.CreateEvent(Me)
psary(0).lOffset = DSBPN_OFFSETSTOP
dscb.SetNotificationPositions 1, psary() '-------> this is where i m getting
run time error

Private Sub DirectXEvent8_DXCallback(ByVal eventid As Long)

Select Case psary(0).hEventNotify
Case lngevent
MsgBox hello
End Select

End Sub



Mon, 04 Oct 2004 21:32:19 GMT  
 DirectxEvent8 in DirectSound (HELP!)
When you create your sound buffer, are you setting the
DSBCAPS_CTRLPOSITIONNOTIFY flag?  This is required to use notifications on a
buffer.

--
Eric DeBrosse
http://www.blown.com/dx/
Microsoft Visual Basic DirectX MVP

The opinions expressed in this message are my own personal views and
do not reflect the official views of Microsoft Corporation. The MVP program
does not constitute employment or contractual obligation with Microsoft.


Quote:

> can anyone please tell me whats wrong in this piece of code??I am getting
> run time error(Automation Error)
> This is not the whole code, but the suspected error generationg code.I am
a
> novice.....pls help me.

> Implements DirectXEvent8
> Dim psary(0) As DSBPOSITIONNOTIFY

> psary(0).hEventNotify = dx.CreateEvent(Me)
> psary(0).lOffset = DSBPN_OFFSETSTOP
> dscb.SetNotificationPositions 1, psary() '-------> this is where i m
getting
> run time error

> Private Sub DirectXEvent8_DXCallback(ByVal eventid As Long)

> Select Case psary(0).hEventNotify
> Case lngevent
> MsgBox hello
> End Select

> End Sub



Tue, 05 Oct 2004 01:20:28 GMT  
 DirectxEvent8 in DirectSound (HELP!)
yes i have done that.... here is the complete code....

Dim dsc As DirectSoundCapture8
Dim dscbd As DSCBUFFERDESC
Dim dscb As DirectSoundCaptureBuffer8
Dim ds As DirectSound8
Dim dx As New DirectX8
Dim dsenum As DirectSoundEnum8
Dim appbuff() As Byte
Dim x As Integer
Dim y As Long
Dim devguid As String
Dim z As Long
Dim strbuff As String
Implements DirectXEvent8
'Dim dxe As DirectXEvent8
Dim psary(0) As DSBPOSITIONNOTIFY
'Dim curs As DSCURSORS

Private Sub cmbSelDev_click()
y = cmbSelDev.ListIndex
devguid = dsenum.GetGuid(y + 1)
End Sub

Private Sub cmdSrtCap_Click()
ReDim appbuff(7350)
dscb.Start (DSCBSTART_LOOPING)
psary(0).hEventNotify = dx.CreateEvent(Me)
psary(0).lOffset = DSBPN_OFFSETSTOP
dscb.SetNotificationPositions 1, psary()

'Debug.Print dscb.GetStatus
'dscb.GetCurrentPosition curs
'If curs.lWrite = 7350 - 1 Then
'dscb.ReadBuffer 0, 7350 - 1, appbuff(0), DSCBLOCK_DEFAULT
'End If
'If curs.lWrite = 14700 - 1 Then
'dscb.ReadBuffer 7350, 14700 - 1, appbuff(0), DSCBLOCK_DEFAULT
'End If
'If curs.lWrite = 22050 - 1 Then
'dscb.ReadBuffer 14700, 22050 - 1, appbuff(0), DSCBLOCK_DEFAULT
'End If

dscb.ReadBuffer 0, dscbd.lBufferBytes - 1, appbuff(0), DSCBLOCK_DEFAULT
sckServer.SendData appbuff() 'strbuff
End Sub

Private Sub DirectXEvent8_DXCallback(ByVal eventid As Long)

Select Case psary(0).hEventNotify
Case lngevent
MsgBox hello
End Select

End Sub

Private Sub Form_Load()

With sckServer
        .RemoteHost = "Default"
        .RemotePort = 1024    ' Port to connect to.
        .Bind 1023
End With

Set dsenum = dx.GetDSEnum
For x = 1 To dsenum.GetCount
cmbSelDev.AddItem dsenum.GetDescription(x)
Next x

Set dsc = dx.DirectSoundCaptureCreate(devguid) 'create dsscapture object

With dscbd.fxFormat 'define wave format
  .nFormatTag = WAVE_FORMAT_PCM
  .nChannels = 1
  .lSamplesPerSec = 11025
  .nBitsPerSample = 16
  .nBlockAlign = .nBitsPerSample / 8 * .nChannels
  .lAvgBytesPerSec = .lSamplesPerSec * .nBlockAlign
  .nSize = 0  ' Ignored for WAVE_FORMAT_PCM.
End With

dscbd.lFlags = DSBCAPS_GLOBALFOCUS Or DSBCAPS_GETCURRENTPOSITION2 Or
DSBCAPS_CTRLPOSITIONNOTIFY
'Set the flags for the buffer. Flags needed are DSBCAPS_GLOBALFOCUS,
'DSBCAPS_GETCURRENTPOSITION2 for accurate notification position tracking,
'and DSBCAPS_CTRLPOSITIONNOTIFY to let Direct Sound know we are keeping
'track of the position during playback.
'dscbd.lFlags = DSCBCAPS_DEFAULT
dscbd.lBufferBytes = dscbd.fxFormat.lAvgBytesPerSec
Set dscb = dsc.CreateCaptureBuffer(dscbd)  ' create dsc buffer

End Sub

Quote:
----- Original Message -----
From: Eric DeBrosse [MS MVP]

Newsgroups: microsoft.public.vb.directx
Sent: Thursday, April 18, 2002 10:50 PM
Subject: Re: DirectxEvent8 in DirectSound (HELP!)

When you create your sound buffer, are you setting the
DSBCAPS_CTRLPOSITIONNOTIFY flag?  This is required to use notifications on a
buffer.

--
Eric DeBrosse
http://www.blown.com/dx/
Microsoft Visual Basic DirectX MVP

The opinions expressed in this message are my own personal views and
do not reflect the official views of Microsoft Corporation. The MVP program
does not constitute employment or contractual obligation with Microsoft.



> can anyone please tell me whats wrong in this piece of code??I am getting
> run time error(Automation Error)
> This is not the whole code, but the suspected error generationg code.I am
a
> novice.....pls help me.

> Implements DirectXEvent8
> Dim psary(0) As DSBPOSITIONNOTIFY

> psary(0).hEventNotify = dx.CreateEvent(Me)
> psary(0).lOffset = DSBPN_OFFSETSTOP
> dscb.SetNotificationPositions 1, psary() '-------> this is where i m
getting
> run time error

> Private Sub DirectXEvent8_DXCallback(ByVal eventid As Long)

> Select Case psary(0).hEventNotify
> Case lngevent
> MsgBox hello
> End Select

> End Sub



Tue, 05 Oct 2004 02:10:10 GMT  
 DirectxEvent8 in DirectSound (HELP!)
And the error number is ? It often helps to diagnose the problem...

Patrice



Quote:

> can anyone please tell me whats wrong in this piece of code??I am getting
> run time error(Automation Error)
> This is not the whole code, but the suspected error generationg code.I am
a
> novice.....pls help me.

> Implements DirectXEvent8
> Dim psary(0) As DSBPOSITIONNOTIFY

> psary(0).hEventNotify = dx.CreateEvent(Me)
> psary(0).lOffset = DSBPN_OFFSETSTOP
> dscb.SetNotificationPositions 1, psary() '-------> this is where i m
getting
> run time error

> Private Sub DirectXEvent8_DXCallback(ByVal eventid As Long)

> Select Case psary(0).hEventNotify
> Case lngevent
> MsgBox hello
> End Select

> End Sub



Tue, 05 Oct 2004 02:06:08 GMT  
 DirectxEvent8 in DirectSound (HELP!)
Runtime Error '-2005401550(88780032)'
Automation Error

Parag.

And the error number is ? It often helps to diagnose the problem...

Patrice



Quote:

> can anyone please tell me whats wrong in this piece of code??I am getting
> run time error(Automation Error)
> This is not the whole code, but the suspected error generationg code.I am
a
> novice.....pls help me.

> Implements DirectXEvent8
> Dim psary(0) As DSBPOSITIONNOTIFY

> psary(0).hEventNotify = dx.CreateEvent(Me)
> psary(0).lOffset = DSBPN_OFFSETSTOP
> dscb.SetNotificationPositions 1, psary() '-------> this is where i m
getting
> run time error

> Private Sub DirectXEvent8_DXCallback(ByVal eventid As Long)

> Select Case psary(0).hEventNotify
> Case lngevent
> MsgBox hello
> End Select

> End Sub



Tue, 05 Oct 2004 14:10:39 GMT  
 DirectxEvent8 in DirectSound (HELP!)
D3DX8.GetErrorString allows to find out that this is a DSERR_INVALIDCALL.
DXERR_INVALIDCALL indicates an improper API usage that is the call is not
correct and can't succeed (i.e. wrong parameter) as opposed to a call that
fails for some reason but that is correct (i.e. out of memory or capability
not supported by the hardware).

I noticed that you start the capture and then you set the notification
position. This is IMO invalid. Try to reverse the order of these calls....

Patrice



Quote:
> Runtime Error '-2005401550(88780032)'
> Automation Error

> Parag.


> And the error number is ? It often helps to diagnose the problem...

> Patrice



> > can anyone please tell me whats wrong in this piece of code??I am
getting
> > run time error(Automation Error)
> > This is not the whole code, but the suspected error generationg code.I
am
> a
> > novice.....pls help me.

> > Implements DirectXEvent8
> > Dim psary(0) As DSBPOSITIONNOTIFY

> > psary(0).hEventNotify = dx.CreateEvent(Me)
> > psary(0).lOffset = DSBPN_OFFSETSTOP
> > dscb.SetNotificationPositions 1, psary() '-------> this is where i m
> getting
> > run time error

> > Private Sub DirectXEvent8_DXCallback(ByVal eventid As Long)

> > Select Case psary(0).hEventNotify
> > Case lngevent
> > MsgBox hello
> > End Select

> > End Sub



Tue, 05 Oct 2004 15:37:58 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. DirectXEvent8 forms & ActiveX Controls

2. HELP: DirectSound Example

3. Help with DirectSound in VB4

4. VB6 DirectSound (DirectX8) Help!!

5. i need to program directSound, and directShow from .NET

6. Playing .mp3 trough DirectSound ???

7. mp3 into directsound buffer ??

8. DirectSound Clicking Problem

9. DirectShow / DirectSound in VB?

10. how to do directsound

11. using DirectSound in VB5

12. DirectSound in VB5

 

 
Powered by phpBB® Forum Software