Hi Folks,
I was hoping to get a little help here. I have recently foun the following code (here: http://www.opennetcf.org/forums/topic.asp?TOPIC_ID=160) -
public class VoiceRecorder
-
{
-
#region API prototypes
-
[DllImport("voicectl.dll", EntryPoint = "VoiceRecorder_Create")]
-
private unsafe static extern IntPtr VoiceRecorder_Create(CM_VOICE_RECORDER* voicerec);
-
-
[DllImport("coredll.dll", EntryPoint = "GetForegroundWindow")]
-
private unsafe static extern IntPtr GetForegroundWindow();
-
#endregion
-
-
[StructLayout(LayoutKind.Sequential)]
-
public unsafe struct CM_VOICE_RECORDER
-
{
-
public int cb;
-
public wndStyle dwStyle;
-
public int xPos;
-
public int yPos;
-
public IntPtr hwndParent;
-
public int id;
-
public char* lpszRecordFileName;
-
}
-
-
public enum wndStyle : uint
-
{
-
VRS_NO_OKCANCEL = 0x0001, // No OK/CANCLE displayed
-
VRS_NO_NOTIFY = 0x0002, // No parent Notifcation
-
VRS_MODAL = 0x0004, // Control is Modal
-
VRS_NO_OK = 0x0008, // No OK displayed
-
VRS_NO_RECORD = 0x0010, // No RECORD button displayed
-
VRS_PLAY_MODE = 0x0020, // Immediately play supplied file when launched
-
VRS_NO_MOVE = 0x0040, // Grip is removed and cannot be moved around by the user
-
VRS_RECORD_MODE = 0x0080, // Immediately record when launched
-
VRS_STOP_DISMISS = 0x0100 // Dismiss control when stopped
-
}
-
-
private unsafe CM_VOICE_RECORDER _VoiceRec;
-
private IntPtr _hRecorder;
-
private string wavFile = @"\My Documents\~VRec_0.wav";
-
-
private IntPtr _Hwnd = (IntPtr)0;
-
-
public IntPtr Hwnd
-
{
-
get { return _Hwnd; }
-
set
-
{
-
_VoiceRec.hwndParent = value;
-
_Hwnd = value;
-
}
-
}
-
-
public unsafe VoiceRecorder()
-
{
-
_hRecorder = new IntPtr();
-
char[] temp = new char[32];
-
-
this.Hwnd = GetForegroundWindow();
-
-
// Populate temp with the file path of the WAV file
-
Buffer.BlockCopy(wavFile.ToCharArray(), 0, temp, 0, 2 * wavFile.Length);
-
-
fixed (char* lpszFileName = temp)
-
{
-
_VoiceRec = new CM_VOICE_RECORDER();
-
-
_VoiceRec.hwndParent = _Hwnd;
-
_VoiceRec.dwStyle = wndStyle.VRS_NO_MOVE | wndStyle.VRS_MODAL;
-
_VoiceRec.cb = (int)Marshal.SizeOf(_VoiceRec);
-
_VoiceRec.xPos = -1;
-
_VoiceRec.yPos = -1;
-
_VoiceRec.lpszRecordFileName = lpszFileName;
-
}
-
}
-
-
// Show the voice recorder
-
public unsafe void Show()
-
{
-
fixed (CM_VOICE_RECORDER* _VoiceRecPtr = &_VoiceRec)
-
{
-
_hRecorder = VoiceRecorder_Create(_VoiceRecPtr);
-
}
-
}
-
}
-
}
-
which is for creating a voice/audio recorder on a WM5 PDA. I have included the code into my project in a VoiceRecorder.cs class, and have invoked it from the main code (i.e. VoiceRecorder vr = new VoiceRecorder(); vr.show() ) and the voice recorder app appears on screen, and beeps when I hit record, but there doesnt seem to be any file being created, nor is there any functions for playback. I was wondering if anyone could help me out here, as I really want to include this in my application. If anyone has any other ideas on a good way to include a voice recording feature from c# code I would greatly appreciate it!
Cheers folks,
Mark
3 4106
Who wrote voicectl.dll? And do you have access to the source code for it?
Who wrote voicectl.dll? And do you have access to the source code for it?
It's a standard component within Windows Mobile 5 (NB I think i hit the wrong button earlier and reported this post and not replying! Sorry!)
Banfa 9,065
Expert Mod 8TB
Given these 2 lines -
private string wavFile = @"\My Documents\~VRec_0.wav";
-
-
char[] temp = new char[32];
-
I can't help feeling that you have a file path/name error. I know nothing of cs but if the @ in the first statement equates to a balnk string then the path to the file is obviously invalid.
On the other hand assuming that the @ in the first statement equates to the current users directory (making the path valid) then the length of the wavFile is going to be rather longer than the 32 characters assigned to temp;
Either way you seem to have an error around you file path/name.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Dfenestr8 |
last post by:
Hi.
I'm no coder. I'm just a working guy who likes to tinker with computers in
my spare time.
That's my hobby. My passion is: playing instruments. Combining the two,
I've made a couple of...
|
by: fuliopen |
last post by:
I know there are three types of audio files: wav, mp3 and wma. Keeping
other factors, such as KHz, bit. mono or stereo, constant, the largest
type is wav, and wma is the smallest. Is this...
|
by: arkam |
last post by:
Here is the code :
public class AudioMixerHelper
{
public const int MMSYSERR_NOERROR = 0;
public const int MAXPNAMELEN = 32;
public const int MIXER_LONG_NAME_CHARS = 64;
public const int...
|
by: Mad Scientist Jr |
last post by:
I'm trying to record a voice memo on a Pocket PC (2000) from VB.NET
(smart device application from vs.net 2003).
Tom Shelton did an initial conversion to VB.NET which I am trying to
run, but am...
|
by: Emma Gumbdough |
last post by:
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...
|
by: Jonathon |
last post by:
I am creating an app that needs to capture dictation. I am currently
starting to work with the OpenNETCF library.
First, are there any other (better) alternatives to this package. We
can spend...
|
by: zenologia |
last post by:
Hello, I need to write an audio recorder application, and before
starting writing code I'd like to know what components are available
on the market.
I'm looking for one or more .net audio...
|
by: wwzaygvm |
last post by:
audio mid recorder 3.95 and crack
http://cracks.12w.net
F
R
E
E
|
by: Frinavale |
last post by:
I'm very impressed with Ubuntu.
Everything works very well with my laptop in this flavour of Linux...even the media controls that I was sure wouldn't work do.
I'm having problems with Skype...
|
by: DolphinDB |
last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation.
Take...
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
| |