September 29, 2019
On Sunday, 29 September 2019 at 20:51:40 UTC, Murilo wrote:
> Are you sure it is like this:

join waits for it to finish before returning. You need to stop before joining otherwise join may never return.
September 29, 2019
On Sunday, 29 September 2019 at 20:57:09 UTC, Adam D. Ruppe wrote:
> On Sunday, 29 September 2019 at 20:51:40 UTC, Murilo wrote:
>> Are you sure it is like this:
>
> join waits for it to finish before returning. You need to stop before joining otherwise join may never return.

Alright, thanks. So let me see if I get this straight, .stop() will stop the thread and then .join() will return. But what exactly does .join() return?
September 29, 2019
On Sunday, 29 September 2019 at 21:06:02 UTC, Murilo wrote:
> .stop() will stop the thread

More specifically, stop tells the audio output to stop. It finishes what it is doing and then exits. At this point, the thread terminates.

join() waits for the thread to finish terminating (which it won't do if you don't tell it to stop *first*) and then cleans it up. join will return any exception/error it happened to throw while ending.
September 29, 2019
On Sunday, 29 September 2019 at 22:52:02 UTC, Adam D. Ruppe wrote:
> On Sunday, 29 September 2019 at 21:06:02 UTC, Murilo wrote:
>> .stop() will stop the thread
>
> More specifically, stop tells the audio output to stop. It finishes what it is doing and then exits. At this point, the thread terminates.
>
> join() waits for the thread to finish terminating (which it won't do if you don't tell it to stop *first*) and then cleans it up. join will return any exception/error it happened to throw while ending.

ahh, okay, thanks. Now, one last question, if stop() actually makes the output, not the thread, stop, then start() makes the output, not the thread, begin?
September 29, 2019
On Sunday, 29 September 2019 at 23:48:35 UTC, Murilo wrote:
> Now, one last question, if stop() actually makes the output, not the thread, stop, then start() makes the output, not the thread, begin?

It does both. start is from the base class Thread, it starts it which immediately opens the audio device and can feed stuff when it is necessary.
October 19, 2019
> but at the beginning of main() set it up with
>
>
> 	auto audio = new AudioPcmOutThread();
> 	audio.start();
> 	scope(exit) {
> 		audio.stop();
> 		audio.join();
> 	}

Thanks Adam. That worked on Windows, but now that I have switched to Linux Mint it is throwing this:
arsd.simpleaudio.AlsaException@arsd/simpleaudio.d(1170): params init: Operation not permitted
----------------
??:? arsd.simpleaudio.snd_pcm_t* arsd.simpleaudio.openAlsaPcm(arsd.simpleaudio.snd_pcm_stream_t) [0x55eab05a0f4a]
??:? ref arsd.simpleaudio.AudioOutput arsd.simpleaudio.AudioOutput.__ctor(int) [0x55eab059f7ec]
??:? void arsd.simpleaudio.AudioPcmOutThread.run() [0x55eab059f23d]
??:? void core.thread.Thread.run() [0x55eab05c10d1]
??:? thread_entryPoint [0x55eab05d809b]
??:? [0x7fb40e4ff6da]

What should I do?
October 19, 2019
On Saturday, 19 October 2019 at 01:48:57 UTC, Murilo wrote:
> init: Operation not permitted

Your system probably uses PulseAudio which I don't like, so I don't support it in my code.

It *might* work to run `pasuspender -- ./your_program_here` but I don't know.

I can check more tomorrow.
October 19, 2019
On Saturday, 19 October 2019 at 02:10:54 UTC, Adam D. Ruppe wrote:
> On Saturday, 19 October 2019 at 01:48:57 UTC, Murilo wrote:
>> init: Operation not permitted
>
> Your system probably uses PulseAudio which I don't like, so I don't support it in my code.
>
> It *might* work to run `pasuspender -- ./your_program_here` but I don't know.
>
> I can check more tomorrow.

That unfortunately didn't work. I would be very grateful if you could find out a way around it and tell me.
October 19, 2019
try it now with the new version of simpleaudio.d from git
October 19, 2019
On Saturday, 19 October 2019 at 13:08:49 UTC, Adam D. Ruppe wrote:
> try it now with the new version of simpleaudio.d from git

Ahhhhhh, now it works! Thank you so much man. I really appreciate the work you do with your library, I have been using it for everything, I'm now training a neural network using your library.