Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Access violation error #74

Open
MichaelSvejcar opened this issue Dec 10, 2022 · 0 comments
Open

Access violation error #74

MichaelSvejcar opened this issue Dec 10, 2022 · 0 comments

Comments

@MichaelSvejcar
Copy link

MichaelSvejcar commented Dec 10, 2022

Hello, I've been testing this library with slightly modified code which was provided as example:

var engine = AudioEngine.CreateDefault();
var buffer = engine.CreateBuffer();
var source = engine.CreateSource();

// Play a 1s long sound at 440hz
AudioFormat format;
format.BitsPerSample = 16;
format.Channels = 1;
format.SampleRate = 44100;
float freq = 440.0f;
var size = format.SampleRate;
var samples = new short[size];

for (int i = 0; i < size; i++)
{
    samples[i] = (short)(32760 * Math.Sin((2 * Math.PI * freq) / size * i));
}

buffer.BufferData(samples, format);

for (int i = 0; i < 60; i++)
{
    source.QueueBuffer(buffer);
}

source.Play();

However, after running this code and getting approximately two seconds of playback, the app crashes with code 3221225477 (0xc0000005) 'Access violation'. One time it haven't crashed, but weird noise started to come from the speakers. Do you know what may be causing this issue? Is there maybe some maximum length that the buffer is supposed to have for it to run stably?
Thank you and have a nice day!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant