AudioOutputThread

Wraps AudioPcmOutThreadImplementation with RAII semantics for better error handling and disposal than the old way.

DO NOT USE THE new OPERATOR ON THIS! Just construct it inline:

auto audio = AudioOutputThread(true);
audio.beep();

Constructors

this
this(bool enable, int SampleRate, int channels, string device)
this(bool enable, string device, int SampleRate, int channels)

Pass true to enable the audio thread. Otherwise, it will just live as a dummy mock object that you should not actually try to use.

Destructor

~this
~this()

When the internal refcount reaches zero, it stops the audio and rejoins the thread, throwing any pending exception (yes the dtor can throw! extremely unlikely though).

Postblit

this(this)
this(this)

Keeps an internal refcount.

Members

Functions

join
void join(bool a)

You should call exit instead of join. It will signal the thread to exit and then call join for you.

opCast
bool opCast()

This allows you to check if(audio) to see if it is enabled.

rawJoin
Throwable rawJoin(bool rethrow)

Don't call this unless you're sure you know what you're doing.

suspended
bool suspended()

Returns true if the output is suspended. Use suspend and unsuspend to change this.

toArsdJsvar
auto toArsdJsvar()

provides automatic arsd.jsvar script wrapping capability. Make sure the script also finishes before this goes out of scope or it may end up talking to a dead object....

Templates

opDispatch
template opDispatch(string name)

Other methods are forwarded to the implementation of type AudioPcmOutThreadImplementation. See that for more information on what you can do.

Meta

History

Added May 9, 2020 to replace the old AudioPcmOutThread class that proved pretty difficult to use correctly.

Suggestion Box / Bug Report