Why is my SDL Program doing this?

Hey all!

I have just jumped into some C++ programming for the first time, after having some amount of knowledge using other languages. I am currently making a game using SDL2, and I am having some issues...

http://pastebin.com/7cgCdjGk <---- Link to my code so far (nothing complex)

Every time I run this, the audio coming from Discord on Linux freaks out. My friends sound extremely choppy, and so does my microphone to them. I am not doing anything with audio in the code, so I have no idea why it would even try and capture an audio device, if that is what it's doing.

If anyone has any idea why my SDL program would do this, please, toss it at me. I have been soaking in SDL Documentation, forum posts, and LazyFoo tutorials for hours and have not figured it out.

I tried switching my SDL_PollEvent(&e) loop to an if block using SDL_WaitEvent(&e)
I tried setting SDL_AUDIODRIVER (it is an environment variable) to everything it could possibly be set to.
and more...

I am running Arch Linux, with MATE environment.

compiling with g++ main.cpp -Wall -lSDL2 -lSDL2_image -o Ghougerry


Well I feel like an idiot.
I have been running the wrong executable this whole time.

I have an alias in my terminal profile: run='./../bin/Ghougerry'
and I am not using that bin directory in my makefile anymore.

Well thanks anyway for the people that spent some time looking at this :p

Glad we could be there.

1 Like