Click here to Skip to main content
15,927,745 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: Sorry, the tags were on Pin
Anonymous19-Apr-05 13:55
Anonymous19-Apr-05 13:55 
GeneralRe: Sorry, the tags were on Pin
ebred19-Apr-05 14:00
ebred19-Apr-05 14:00 
GeneralRe: Sorry, the tags were on Pin
Anonymous19-Apr-05 14:43
Anonymous19-Apr-05 14:43 
GeneralRe: Sorry, the tags were on Pin
ebred19-Apr-05 15:09
ebred19-Apr-05 15:09 
GeneralRe: Sorry, the tags were on Pin
ebred19-Apr-05 14:32
ebred19-Apr-05 14:32 
GeneralRe: Sorry, the tags were on Pin
Anonymous19-Apr-05 15:44
Anonymous19-Apr-05 15:44 
GeneralRe: VB.NEt/win32 waveinopen Pin
Anonymous19-Apr-05 17:00
Anonymous19-Apr-05 17:00 
GeneralRe: VB.NEt/win32 waveinopen Pin
ebred20-Apr-05 12:17
ebred20-Apr-05 12:17 
Phew.
I got it to work. I submitted a question on a ms run community. I was calcualting average bytes with variables that had not yet been calculated in the waveformat structure i posted earlier.
I have converted to WAVEFORMATEX as well.

Here the code that will return a handle to the device:

<br />
'opens input for recording<br />
    <DllImport("winmm.dll", EntryPoint:="waveInOpen", _<br />
    CallingConvention:=CallingConvention.StdCall)> _<br />
    Public Shared Function waveInOpen(<Out()> ByRef lphWaveIn As IntPtr, ByVal uDeviceID As Integer, _<br />
    ByRef lpFormat As WAVEFORMATEX, ByVal dwCallback As Integer, ByVal dwInstance As Integer, _<br />
    ByVal dwFlags As Integer) As Integer<br />
<br />
    End Function<br />
<br />
    'used to describe format of wave data<br />
<br />
    <StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Ansi)> _<br />
    Structure WAVEFORMATEX<br />
        Public wFormat As Short<br />
        Public nChannels As Short<br />
        Public nSamplesPerSec As Integer<br />
        Public nAvgBytesPerSec As Integer<br />
        Public nBlockAlign As Short<br />
        Public wBitsPerSample As Short<br />
        Public cbSize As Short<br />
<br />
    End Structure<br />
<br />
    Private Const WAVE_FORMAT_QUERY As Long = &H1<br />
    Private Const WAVE_MAPPER As Integer = -1&<br />
    Private Const WAVE_FORMAT_DIRECT As Integer = &H8<br />
    Private Const CALLBACK_NULL As Integer = &H0<br />
    Private Const WAVE_FORMAT_PCM As Integer = 1<br />
    Private structWaveInputVars As WAVEFORMATEX<br />
<br />
<br />
#End Region<br />


Heres the calling code:
<br />
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load<br />
        Dim l As Long<br />
        With structWaveInputVars<br />
            .wFormat = WAVE_FORMAT_PCM<br />
            .nChannels = 2<br />
            .nSamplesPerSec = 11025<br />
            .nAvgBytesPerSec = 176400 'no longer calculated<br />
            .nBlockAlign = 4<br />
            .wBitsPerSample = 8<br />
            .cbSize = 0<br />
        End With<br />
<br />
        hDevice = Marshal.AllocHGlobal(4)<br />
        <br />
<br />
<br />
        l = waveInOpen(hDevice, 0, structWaveInputVars, 0, 0, CALLBACK_NULL)<br />
<br />
    End Sub<br />

Thanks a lot for your help anon
GeneralRe: VB.NEt/win32 waveinopen Pin
Anonymous20-Apr-05 16:13
Anonymous20-Apr-05 16:13 
GeneralBinding Pin
Jaydeanster19-Apr-05 10:48
Jaydeanster19-Apr-05 10:48 
GeneralWinXP strange character conversion Pin
John Shaw19-Apr-05 9:55
John Shaw19-Apr-05 9:55 
GeneralRe: WinXP strange character conversion Pin
Anonymous19-Apr-05 10:55
Anonymous19-Apr-05 10:55 
GeneralUpdate: WinXP strange character conversion Pin
John Shaw19-Apr-05 11:31
John Shaw19-Apr-05 11:31 
GeneralAgain about MSN messenger Pin
usmanmir19-Apr-05 9:07
usmanmir19-Apr-05 9:07 
GeneralRe: Again about MSN messenger Pin
thrakazog19-Apr-05 10:33
thrakazog19-Apr-05 10:33 
GeneralRe: Again about MSN messenger Pin
Dave Kreskowiak19-Apr-05 15:10
mveDave Kreskowiak19-Apr-05 15:10 
Generaldelete a whole table Pin
HRusaw19-Apr-05 8:20
HRusaw19-Apr-05 8:20 
GeneralRe: delete a whole table Pin
Chris Meech19-Apr-05 8:53
Chris Meech19-Apr-05 8:53 
GeneralRe: delete a whole table Pin
HRusaw19-Apr-05 9:29
HRusaw19-Apr-05 9:29 
GeneralRe: delete a whole table Pin
Scott Serl19-Apr-05 10:05
Scott Serl19-Apr-05 10:05 
GeneralRe: delete a whole table Pin
HRusaw20-Apr-05 3:04
HRusaw20-Apr-05 3:04 
GeneralRe: delete a whole table Pin
rhenerlau19-Apr-05 16:09
rhenerlau19-Apr-05 16:09 
GeneralRe: delete a whole table Pin
sumit2119-Apr-05 20:39
sumit2119-Apr-05 20:39 
GeneralRe: delete a whole table Pin
HRusaw20-Apr-05 3:05
HRusaw20-Apr-05 3:05 
GeneralRe: delete a whole table Pin
HRusaw20-Apr-05 3:00
HRusaw20-Apr-05 3:00 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.