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
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);
}
}
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