Help playing sounds using arsd.simpleaudio

Murilo murilomiranda92 at hotmail.com
Sun Sep 29 04:37:43 UTC 2019


On Saturday, 28 September 2019 at 14:03:53 UTC, Adam D. Ruppe 
wrote:
> 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.

Thanks. Now, I would like to know if I could just use it like 
this instead:

import arsd.simpleaudio;

void main()
{
     AudioPcmOutThread audio = new AudioPcmOutThread;
     audio.start;
     audio.playOgg("shock.ogg");
     audio.join;
     audio.stop;
}



More information about the Digitalmars-d-learn mailing list