SFML community forums

Help => Audio => Topic started by: blakemac on May 25, 2015, 03:39:42 pm

Title: SoundBufferRecorder recorder.start() returns EXC_BAD_ACCESS(code=1, address=0x0)
Post by: blakemac on May 25, 2015, 03:39:42 pm
I'm trying to record audio (using Xcode) and when I reach the command recorder.start() I'm getting EXC_BAD_ACCESS(code=1, address=0x0). I've made a small example that still gives me the error:
#include <iostream>
#include <SFML/Audio.hpp>
#include <SFML/Graphics.hpp>

using namespace std;
using namespace sf;

int main(int argc, char const** argv)
{
    //  Create the main window
    RenderWindow window(sf::VideoMode(800, 600), "My new window");
   
    if (!SoundBufferRecorder::isAvailable()) {
        return EXIT_FAILURE;
    }
   
    sf::SoundBufferRecorder recorder;
   
    recorder.start();
   
    recorder.stop();
   
    return EXIT_SUCCESS;
}

Any help would be very greatly appreciated!  :D
Title: Re: SoundBufferRecorder recorder.play() returns EXC_BAD_ACCESS(code=1, address=0x0)
Post by: eXpl0it3r on May 25, 2015, 03:59:10 pm
Do you mean recorder.start()?
Title: Re: SoundBufferRecorder recorder.start() returns EXC_BAD_ACCESS(code=1, address=0x0)
Post by: blakemac on May 25, 2015, 04:16:32 pm
Whoops, yeah that meant to say recorder.start() like in the code sample, fixed it now, but the problem is still the same
Title: Re: SoundBufferRecorder recorder.start() returns EXC_BAD_ACCESS(code=1, address=0x0)
Post by: Hapax on May 25, 2015, 04:44:50 pm
Your code, and the example code in the documentation for SoundBufferRecorder both fail for me too. Both fail (for me) at recorder.start() with "Failed to open the audio capture device..." and, in the example code, the buffer.saveToFile fails with "Format not recognised".
Title: Re: SoundBufferRecorder recorder.start() returns EXC_BAD_ACCESS(code=1, address=0x0)
Post by: Hiura on May 25, 2015, 10:26:23 pm
Do you also get a stack trace similar to this?

0   libsystem_c.dylib                   0x00007fff91c7c152 strlen + 18
1   org.sfml-dev.OpenAL                 0x0000000101da3a8c al_string_copy_cstr + 28
2   org.sfml-dev.OpenAL                 0x0000000101db21b3 ca_open_capture + 2115
3   org.sfml-dev.OpenAL                 0x0000000101d9451b alcCaptureOpenDevice + 587
4   libsfml-audio.2.3.dylib             0x0000000101d3ac98 sf::SoundRecorder::start(unsigned int) + 296
5   sound-capture                       0x0000000101d2c894 main + 228
6   libdyld.dylib                       0x00007fff917c95c9 start + 1

Note that this is an issue with the OpenAL version shipped with SFML since https://github.com/SFML/SFML/commit/ce16554763177d7285248e81e9b0e0201f0c43e3. You can revert that commit, remove /Library/Frameworks/OpenAl.frameworks, recompile SFML and use it.

However you might have other issues, namely https://github.com/SFML/SFML/issues/541.
Title: Re: SoundBufferRecorder recorder.start() returns EXC_BAD_ACCESS(code=1, address=0x0)
Post by: blakemac on May 26, 2015, 11:21:30 pm
That did the trick, you rock! And it got me to learn a lot about Cmake and Git haha, thanks