OLCSOUNDMAKER销毁后明显的方法致电。H

发布于 2025-01-27 15:00:11 字数 1673 浏览 2 评论 0原文

我无法提出一个更好的标题,所以请随时提出建议。

我试图跟随OneloneCoder的关于声音合成的教程,我只是在第一个视频中进行了一半,而我的代码已经引发了异常。 我要做的就是从他的github 和复制入口点:

#include <iostream>

#include "olcNoiseMaker.h"

double make_noise(double time)
{
    return 0.5 * sin(440.0 * 2 * PI * time);
}

int main()
{
    std::wcout << "Synthesizer, part 1" << std::endl;

    std::vector<std::wstring> devices = olcNoiseMaker<short>::Enumerate();

    for (auto d : devices)
    {
        std::wcout << "Found output device: " << d << std::endl;
    }

    olcNoiseMaker<short> sound(devices[0], 44100, 1, 8, 512);
    sound.SetUserFunction(make_noise);

    while (1) { ; }

    return EXIT_SUCCESS;
}

在视频中,他运行得很好。对我来说,它开始产生声音,然后在的60-80迭代之后(1)循环后,它停止并提高了这一点:(

Unhandled exception thrown: write access violation.
std::_Atomic_address_as<long,std::_Atomic_padded<unsigned int> >(...) was 0xB314F7CC.

&lt; atomic&gt; < /code>标题文件,第1474行。),

通过使用VS逐步踏上代码,除了在每次运行中的不同时间发生,这可能意味着它与多线程有关,但是我不确定,因为我对这个话题不太熟悉。

我发现是类似的,但是即使它说[解决了],也没有向我显示答案。

有人可以帮助摆脱这种例外吗?

I couldn't come up with a better title, so feel free to give suggestions.

I tried to follow OneLoneCoder's tutorial on sound synthesizing, I'm only halfway through the first video and my code already throws an exception.
All I did was downloading his olcSoundMaker.h from his github, and copying the entry point:

#include <iostream>

#include "olcNoiseMaker.h"

double make_noise(double time)
{
    return 0.5 * sin(440.0 * 2 * PI * time);
}

int main()
{
    std::wcout << "Synthesizer, part 1" << std::endl;

    std::vector<std::wstring> devices = olcNoiseMaker<short>::Enumerate();

    for (auto d : devices)
    {
        std::wcout << "Found output device: " << d << std::endl;
    }

    olcNoiseMaker<short> sound(devices[0], 44100, 1, 8, 512);
    sound.SetUserFunction(make_noise);

    while (1) { ; }

    return EXIT_SUCCESS;
}

In the video he runs this just fine; for me, it starts producing a sound, then after 60-80 iterations of the while (1) loop, it stops and raises this:

Unhandled exception thrown: write access violation.
std::_Atomic_address_as<long,std::_Atomic_padded<unsigned int> >(...) was 0xB314F7CC.

(from the <atomic> header file, line 1474.)

By stepping through the code with VS I didn't find out much, except that it happens at different times during every run, which may mean it has something to do with multithreading, but I'm not sure since I'm not very familiar with the topic.

I found this question which is similar, but even though it says [SOLVED] it doesn't show me the answers.

Anyone that can help to get rid of that exception?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

泪冰清 2025-02-03 15:00:11

就在前几天,当我开始写一个可波动的合成器时,我遇到了类似的问题。就我而言,摆脱这种情况的方法是将项目配置更改为X84。

Just the other day I encountered a similar problem when I started writing a wavetable synthesizer. In my case, the way out of this situation was to change the project configuration to x84.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文