如何在C#中生成警报 [英] how to generate an alarm in C#
本文介绍了如何在C#中生成警报的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在频率在800hz/970hz之间变化并且周期每秒重复两次的C#中生成警报
how to generate an alarm in C# where frequence varied between 800hz/970hz and where the cycle is repeated 2 times every second
推荐答案
我知道更简单的方法:
I know much simpler way:
for (int index=0; index<repetitions; ++index)
{
System.Console.Beep(800, 250);
System.Console.Beep(970, 250);
//frequency (first parameter) and timing (second parameter) may vary :-)
}
注释:
您没有解释频率调制的概况;这是最简单的变体之一.
您可能需要在单独的线程中运行它-可以工作.
您无需使您的应用程序成为控制台应用程序.此代码将在任何应用程序中运行.
Notes:
You did not explain the profile of frequency modulation; this is one of the simplest variants.
You may want to run it in a separate thread — it will work.
You don''t need to make you application a console application. This code will run in any application.
在这里 ^ ]
已在此问题中进行了讨论
在C#中使用采样频率 [
Has been discussed in this Question
Use of sampling frequency in C#[^]
might be helpful :)
这篇关于如何在C#中生成警报的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文