
I get the same buzz, but when I use memset to zero out the stream buffer before calling SDL_MixAudio, I get the correct sound from the. What is in stream before calling SDL_MixAudio? The issue may be that you're using SDL_MixAudio. SDL_RenderCopy(renderer, texture, NULL, &button) SDL_SetRenderDrawColor(renderer, 0, 0, 0, 255) SDL_Texture* texture = SDL_CreateTextureFromSurface(renderer, surface)

SDL_Surface* surface = TTF_RenderText_Solid(font, "Go!", white) SDL_Renderer* renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED) SDL_Window* window = SDL_CreateWindow("Test", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, 400, 200, 0) SDL_MixAudio(stream, &sound.data, amount, SDL_MIX_MAXVOLUME) Void mixing(void *unused, Uint8 *stream, int len) #include īool buttonPress(int x, int y, SDL_Rect r) I think it's something to do with the audio callback function but I am very new to this so I'm not sure exactly how it works. There are no errors and the program doesn't crash it's just that instead of playing the drum sound it makes a weird buzzing noise that doesn't stop until you exit the program.

The program opens a window with a button that says go and when you hit the button it should play a WAV of a drum sample.
CRAZY BUZZING LINEIN HOW TO
I'm writing this simple program to learn how to work with audio with SDL.
