By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,262 Members | 1,128 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,262 IT Pros & Developers. It's quick & easy.

Voice Recorder For Pocket PC (VB.NET version)

P: n/a
Okay we have here a VB.NET version of the .net compact framework voice
recorder sample that uses open net CF
c# version at:
http://www.opennetcf.org/forums/topic.asp?TOPIC_ID=79

THIS CODE CREATES AN INSTANCE OF A VOICE RECORDER, but now how do you
get it to record, save, play back, etc?

'
------------------------------------------------------------------------
-----
' NOTES
'
------------------------------------------------------------------------
-----
' Q: Once we have a voice recorder object, how do you then pass messages
to it??
' A: Im working on that... Essentially the sendmessage api function will
need to
' be p/invoked. The voicerecordercreate function has returned the hwnd
so
' messages can be sent to this. The voice recorder messages are
documented in
' the sdk
' I haven't had much luck with the sendmessage function - everytime I
try to
' send a message to the voicerecorder, it just closes the
voicerecorder.....
'
' I got this code to run. This code seems to record to files in \\My
' Documents\~VRec_* where * is a number.
' Alan, did you install the Speech.NET or Speech API?
'
' The files ~VRec_* are temporary files that the voice recorder uses to
store
' the data while it is recording. Sometimes, depending on how the
recorder is
' terminated, they get converted to recording*.wav
'
' Take a look here:
' http://www.innovativedss.com/forums/...sp?TOPIC_ID=80
' for an example of playing .WAV sounds.

'
------------------------------------------------------------------------
-----
' CREDITS
'
------------------------------------------------------------------------
-----
' ported to vb.net by
' Tom Shelton (to*@YOUKNOWTHEDRILLmtogden.com)
' Off the top of my head... I'm not sure why the original code is using
' unsafe code. There doesn't seem to be anything used that would require
that
' - but, I don't know much about the Pocket PC environment. If the
unsafe is
' required for some reason on PPC, then you have to use C#.
' with additional help from
' "Ken Tucker" <vb***@bellsouth.net>

'
------------------------------------------------------------------------
-----
' THE CODE
'
------------------------------------------------------------------------
-----
Imports System
Imports System.Data
Imports System.Runtime.InteropServices
Public Class VoiceRecorder
<StructLayout(LayoutKind.Sequential)> _
Protected Structure CM_VOICE_RECORDER
Public cb As Integer
Public dwStyle As Integer
Public xPos As Integer
Public yPos As Integer
Public hwndParent As IntPtr
Public id As Integer
Public lpszRecordFileName As String
End Structure
<DllImport("voicectl.dll", CallingConvention:=CallingConvention.Winapi)>
_
Private Shared Function VoiceRecorder_Create _
(ByRef myVoiceRecorder As CM_VOICE_RECORDER) As IntPtr
End Function
Private voicerec As CM_VOICE_RECORDER
Private handle As IntPtr
Public Sub New()
With voicerec
.cb = Marshal.SizeOf(voicerec)
.lpszRecordFileName = "\My Documents\VoiceControl.wav"
.xPos = -1
.yPos = -1
End With
End Sub
Public Sub Show()
handle = VoiceRecorder_Create(voicerec)
End Sub
End Class

'************************************************* **********************
***************
'code for Button1 codebehind to record & save a voice memo to
"myfile.wav"
'currently we can only create an instance of VoiceRecorder
'how do you get it to record, save, play back, etc?
'************************************************* **********************
***************
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim VoiceRecorder1 As VoiceRecorder
VoiceRecorder1 = New VoiceRecorder
'VoiceRecorder1.???
End Sub


*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 20 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.