Directsound with Visual Basic 2005???
Directsound with Visual Basic 2005???
Directsound with Visual Basic 2005???
Directsound with Visual Basic 2005???
Directsound with Visual Basic 2005???
Directsound with Visual Basic 2005??? Directsound with Visual Basic 2005??? Directsound with Visual Basic 2005??? Directsound with Visual Basic 2005??? Directsound with Visual Basic 2005??? Directsound with Visual Basic 2005??? Directsound with Visual Basic 2005??? Directsound with Visual Basic 2005???
Directsound with Visual Basic 2005??? Directsound with Visual Basic 2005???
Directsound with Visual Basic 2005???
Go Back  Xtreme Visual Basic Talk > > > > Directsound with Visual Basic 2005???


Reply
 
Thread Tools Display Modes
  #1  
Old 07-08-2006, 06:11 AM
TimeWillTell TimeWillTell is offline
Newcomer
 
Join Date: Jul 2006
Posts: 1
Default


Evening all,

I'm new to VB2005, having done some VBA with Excel over the last decade. I've searched the forum and this is the thread coming closest to discussing a problem I have here.

I'm writing an app attempting to read the sound capture buffer of my Realtek AC97 sound card (ie, it's on the motherboard). I need to have the buffer notify my app when it reaches certain points so I can read it before the cursor wraps around and overwrites the recorded sound data. The code I'm using is adapted from a working VB6 app (at least I'm told it's the working version), and I'm using VB2005 on an XP machine with DirectX 8. I'm running into problems with this subroutine:

==Code starts
Sub SetEvents()
'Sets events for capture buffer notification at 0 and 1/2.
Dim strErrMsg As String = ""

Try
hEvent(0) = dx.CreateEvent(Me) 'Event handle for first half of buffer.
hEvent(1) = dx.CreateEvent(Me) 'Event handle for second half of buffer.

'Buffer event 0 sets write at 50% of buffer.
EVNT(0).hEventNotify = hEvent(0)
EVNT(0).lOffset = (dscbd.lBufferBytes \ 2) - 1 'Set event to first half of capture buffer.

'Buffer event 1 write at 100% of buffer.
EVNT(1).hEventNotify = hEvent(1)
EVNT(1).lOffset = dscbd.lBufferBytes - 1 'Set event to second half of capture buffer.

dscb.SetNotificationPositions(2, EVNT)
Catch ex As Exception
strErrMsg = "SetEvents:" & _
vbCrLf
strErrMsg = strErrMsg & ex.Message
MessageBox.Show(strErrMsg, "Sound", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try

End Sub
==Code ends

The call to the SetNotificationPositions method fails at runtime, producing this error:
"Element not found. HResult 0x8002802B TYPE_E_ELEMENTNOTFOUND".

I've been able to use DirectSound calls under DirectX 8 to enumerate the sound devices and query the sound card, so that bit seems to work. Any ideas as to what's causing this problem and how to fix it?

TIA.
Reply With Quote
  #2  
Old 07-08-2006, 06:20 AM
Iceplug's Avatar
IceplugDirectsound with Visual Basic 2005??? Iceplug is offline
MetaCenturion

Retired Moderator
* Guru *
 
Join Date: Aug 2001
Location: Iowa, USA
Posts: 16,583
Default

There are problems if you try to use some aspects of using DirectX 8 with VB.NET (this may be one) - I'd recommend using DirectX 9 DirectSound.
__________________

Iceplug, USN
Quadrill 1 Quadrill 2 (full) Quadrill 3 JumpCross .NET Website is ALIVE! - DL Platform Tour for VB.NET! Posting Guidelines Hint: Specify your location in your user cp profile if you want compassion!
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
Directsound with Visual Basic 2005???
Directsound with Visual Basic 2005???
Directsound with Visual Basic 2005??? Directsound with Visual Basic 2005???
Directsound with Visual Basic 2005???
Directsound with Visual Basic 2005???
Directsound with Visual Basic 2005??? Directsound with Visual Basic 2005??? Directsound with Visual Basic 2005??? Directsound with Visual Basic 2005??? Directsound with Visual Basic 2005??? Directsound with Visual Basic 2005??? Directsound with Visual Basic 2005???
Directsound with Visual Basic 2005???
Directsound with Visual Basic 2005???
 
Directsound with Visual Basic 2005???
Directsound with Visual Basic 2005???
 
-->