Help playing sounds using arsd.simpleaudio

Adam D. Ruppe destructionator at gmail.com
Sat Sep 28 14:03:53 UTC 2019


On Saturday, 28 September 2019 at 03:21:38 UTC, Murilo wrote:
> Can anyone just please show me how to play a background 
> sound(like those in games) using arsd.simpleaudio? I'd like 
> something simple with a code snippet please.

it is really minimal be warned

but at the beginning of main() set it up with


	auto audio = new AudioPcmOutThread();
	audio.start();
	scope(exit) {
		audio.stop();
		audio.join();
	}


and then when you want it to make sounds, call its functions like

     audio.beep();

or

     audio.playOgg("my-file.ogg");

you can convert things like wav and mp3 into the ogg format with 
various tools of the internet.



that's about all it does.


More information about the Digitalmars-d-learn mailing list