|
-
February 12th, 2009, 05:01 PM
#1
Send tone to sound card...
The following function causes the small computer speaker to emit a tone for the requested duration:
Code:
Console.Beep(freq, duration_ms);
Is there a generic function to call to send the tone to the sound card, or would the call have to be hardware specific dependent on the particular sound card in the computer?
Thanks,
Jim
Last edited by Jim_Auricman; February 12th, 2009 at 05:05 PM.
Reason: Corrected code tag.
-
February 12th, 2009, 09:25 PM
#2
Re: Send tone to sound card...
It's a WinAPI, and you can P/Invoke it:
Code:
using System;
using System.Runtime.InteropServices;
public class _Main
{
#region Win32
[DllImport("Kernel32.dll")]
static extern bool Beep(
uint dwFreq, uint dwDuration
);
#endregion
public static void Main()
{
Beep(150, 150);
}
}
-
February 12th, 2009, 10:48 PM
#3
Re: Send tone to sound card...
Thanks, dglienna.
I tried your test program and sound does indeed come out of the headphones.
This enables me to do what I have planned to do.
Jim
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|