csabahruska / proteaaudio

Simple audio library for Windows, Linux, OSX. Supports Mp3, Ogg, Wav playback and multichannel mixing.
28 stars 8 forks source link

RtApiPulse::callbackEvent: audio write error, Invalid argument. #13

Closed nomeata closed 1 year ago

nomeata commented 1 year ago

I am experimenting with proteaaudio-0.9.4, but when I do with this code:


import Sound.ProteaAudio

playSound :: B.ByteString -> IO ()
playSound content = do
    ok <- initAudio 1 22050 0
    print ok
    sample <- sampleFromMemoryWav (B.toStrict content) 1
    sound <- soundPlay sample  1 1 0 1
    -- finishAudio
    return ()

I get log spam saying

RtApiPulse::callbackEvent: audio write error, Invalid argument.

Am I approaching this the wrong way?

nomeata commented 1 year ago

Nevermind, the 0 in initAudio is of course bogus. I was thrown off by

The default value 512 guarantees a good latency below 40 ms at 22050 Hz sample frequency.

on a field that’s not Maybe Int, but probably jumped to conclusions about the default being used when I pass 0.