1
Audio / Example programs crashing when writing(accesing) SoundBuffer to file.
« on: March 30, 2020, 09:08:36 pm »
Hi. I have used sfml for small games before. Recently I decided to download & use it again on my new Windows installation. While running the example programs provided something strange happens. When running the sound-capture example, it records fine and playing back works. But when saving the file nothing, and then "voip.exe has stopped working" pops up. I modified the code to this:
GCC 7.3.0 MinGW (SEH) - 64-bit
And the recompilation of the capture was done with this command:
g++ SoundCapture.cpp -o scpt.exe -D SFML_STATIC -ID:\programming\SFML-2.5.1\include -LD:\programming\SFML-2.5.1\lib -static -lsfml-graphics-s -lfreetype -lsfml-window-s -lopengl32 -lgdi32 -lsfml-audio-s -lopenal32 -lflac -lvorbisenc -lvorbisfile -lvorbis -logg -lsfml-network-s -lws2_32 -lsfml-system-s -lwinmm -Wall
if (choice == 's')
{
// Choose the filename
std::string filename;
std::cout << "Choose the file to create: ";
std::getline(std::cin, filename);
sf::OutputSoundFile file;
if (!file.openFromFile(filename, sampleRate, 2)) return -1;
file.write(buffer.getSamples(),buffer.getSampleCount());
}
The interesting thing is, that the program doesn't stop returning -1, it still crashes the same way. Also interesting is, that using the VoIP example, everything works fine, the IRL replay works, but after stopping and pressing enter, the audio doesn't play. The program just skips that and ends without crashing, leading me to believe something is wrong with the actual buffer itself. The examples were from the x64 bit source for this compiler:{
// Choose the filename
std::string filename;
std::cout << "Choose the file to create: ";
std::getline(std::cin, filename);
sf::OutputSoundFile file;
if (!file.openFromFile(filename, sampleRate, 2)) return -1;
file.write(buffer.getSamples(),buffer.getSampleCount());
}
GCC 7.3.0 MinGW (SEH) - 64-bit
And the recompilation of the capture was done with this command:
g++ SoundCapture.cpp -o scpt.exe -D SFML_STATIC -ID:\programming\SFML-2.5.1\include -LD:\programming\SFML-2.5.1\lib -static -lsfml-graphics-s -lfreetype -lsfml-window-s -lopengl32 -lgdi32 -lsfml-audio-s -lopenal32 -lflac -lvorbisenc -lvorbisfile -lvorbis -logg -lsfml-network-s -lws2_32 -lsfml-system-s -lwinmm -Wall