小编Foo*_*Bar的帖子

尝试从数组中读取时出错

我也试着让我的C#控制台应用程序发出哔哔声.是的我知道我可以使用Console.Beep但我也想降低音量等.

但我得到的错误是这样的:

预期的方法名称

在这条线上:

binaryWriter.Write(hdr(i));
Run Code Online (Sandbox Code Playgroud)

这是我的代码:

    private bool Beep(int volume, int frequency, int duration)
{
    try
    {
        double amplitude = volume * 1.27;
        double a = ((amplitude * (System.Math.Pow(2, 15))) / 1000) - 1;
        double deltaFt = 2 * System.Math.PI * frequency / 8000;

        double samples = 441 * (duration / 100);
        int bytes = Convert.ToInt32(samples) * 4;
        int[] hdr = {
    0x46464952,
    36 + bytes,
    0x45564157,
    0x20746d66,
    16,
    0x20001,
    8000,
    176400,
    0x100004,
    0x61746164,
    bytes
};
        using (System.IO.MemoryStream memoryStream = …
Run Code Online (Sandbox Code Playgroud)

c#

0
推荐指数
1
解决办法
65
查看次数

标签 统计

c# ×1