Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I make a beep function using SDL?

Tags:

c

audio

sdl

I want to make my SDL program sound a simple beep at a certain frequency. How do I go about doing that?

I've found a tutorial that writes to SDL's sound buffer or so, but it doesn't seem to work. (I'm using OSX "Snow Leopard")

like image 881
Aleph Dvorak Avatar asked Nov 14 '22 18:11

Aleph Dvorak


1 Answers

The tutorial's code forgets to initialize Beeper::v and generateSamples does not work with random values of v. Try to add the line v=0; to Beeper::Beeper()

like image 149
Nordic Mainframe Avatar answered Dec 21 '22 09:12

Nordic Mainframe