42 Commits

Author SHA1 Message Date
Chris Robinson
d766c59d4d Simplify connecting JACK ports 2021-07-25 00:10:15 -07:00
Chris Robinson
76a9fdae75 Use a unique_ptr to auto-free the jack ports list 2021-06-12 14:19:55 -07:00
Chris Robinson
7e32478327 Set the JACK output ports as terminal
Since there are no input ports associated with the output.
2021-06-12 12:54:31 -07:00
Chris Robinson
241107faeb Give a name to a lambda 2021-06-11 13:43:01 -07:00
Chris Robinson
f5bcd12be1 Improve name duplication handling with JACK
If a custom device pattern matches an existing one, its name will be replaced.
A separate loop is used to check and handle duplicate display names.
2021-06-10 16:15:00 -07:00
Chris Robinson
debb932573 Add an option to mix directly in the JACK callback 2021-06-08 10:52:37 -07:00
Chris Robinson
061148072f Update include headers
Don't add alc/ to the include paths.
2021-04-27 16:04:54 -07:00
Chris Robinson
581174ef98 Use the DeviceBase for the backend 2021-04-24 09:03:14 -07:00
Chris Robinson
d2f587ee23 Move helpers.cpp to core 2021-04-22 03:15:26 -07:00
Chris Robinson
730c964029 Allow calling BackendBase::open multiple times on playback devices
It will not be called while the device is running. If the first call succeeds,
a subsequent call that happens to fail must leave the existing device state as
it was so it can be resumed.

This is a rough first pass. It will fail when trying to re-open the same device
which can only be opened once (for instance, with direct hardware access, on
hardware that doesn't do its own mixing). Some backends won't guarantee the new
device is usable until the reset() or start() call.
2021-03-08 22:29:40 -08:00
Chris Robinson
698799da0e Add enumeration to the JACK backend
Port names seem to be structured as <device_name:channel_name> or
<app_name:channel_name>. I'm not sure if this is always the case, but it seems
some other apps expect something like this.

Also fix the port selection to exclude MIDI ports and allow non-physical ports.
2021-02-13 00:45:38 -08:00
Chris Robinson
b5f1601c7f Remove an unnecessary semicolon 2021-01-22 06:05:50 -08:00
Chris Robinson
eedc42890f Move alexcpt to core 2020-12-24 22:49:55 -08:00
Chris Robinson
6ae0115bf7 Avoid AL/ALC types in the backends 2020-12-17 23:21:45 -08:00
Chris Robinson
5edd5a11fc Don't use ALC error enums for the backend error code 2020-12-17 21:07:53 -08:00
Chris Robinson
d578bc6cb1 Move logging to core 2020-12-17 02:47:03 -08:00
Chris Robinson
21162cf5fc Allow JACK to enumerate custom devices
Each device being associated with a port name pattern it'll try connecting to.
2020-09-10 21:09:06 -07:00
Chris Robinson
e8b3e82f96 Change a couple functions into member functions 2020-08-07 06:22:39 -07:00
Chris Robinson
f138369808 Add an option to auto-connect JACK ports 2020-08-05 00:27:12 -07:00
Chris Robinson
516de157d8 Use std::array instead of some C-style arrays 2020-08-05 00:10:10 -07:00
Chris Robinson
6ce9bf6c94 Move a couple related functions to the backend base 2020-06-12 12:53:47 -07:00
Chris Robinson
4094135ed7 Don't return a bool from the backend start method 2020-04-28 19:25:58 -07:00
Chris Robinson
02d7fbfa0c Use standard attribute declarations 2020-04-13 23:27:56 -07:00
Chris Robinson
d67cba99bd Clean up some more unnecessary uses of AL types 2020-04-08 10:15:43 -07:00
Chris Robinson
662d77159b Get rid of a redundant enum 2020-03-30 16:00:02 -07:00
Chris Robinson
f2ddf971df Return the enumerated device names from the backend
Rather than using an out parameter.
2020-03-30 15:37:41 -07:00
Chris Robinson
9b237790b2 Remove the mutex from the backend base 2020-03-29 23:57:37 -07:00
Chris Robinson
f1f9a14172 Avoid AL[C]boolean for internal use 2020-03-28 18:15:05 -07:00
Chris Robinson
eb49290dab Remove unnecessary locks now that the mixer doesn't require one 2020-02-26 04:58:02 -08:00
Chris Robinson
af08f68448 Fix JACK process callback handling
The callback apparently can't be set after activation, but we can't allocate
the ring buffer until after activation when the callback is already getting
called. An ugly flag it is, then, I guess.
2020-01-12 07:48:11 -08:00
Chris Robinson
6f1c853397 Don't allocate the ring buffer for JACK before activation
It seems the JACK server can send buffer size change events during device reset
and wait on it, which causes a failure since the change event can't be
processed during a reset. It's otherwise impossible to safely disable the
change event callback during a reset since the lock is already held and the
callback can be waiting to acquire it. The only guarantee we seem to have is
the event callback won't be invoked after jack_activate succeeds.

So instead, the buffer size can be queried after jack_activate and the ring
buffer allocated then, instead of using an event callback. This does mean the
buffer size can change with a start() call, but it's better than a failure to
start.
2020-01-11 15:10:54 -08:00
Chris Robinson
e6e2f509f8 Make CreateRingBuffer a static RingBuffer method 2020-01-10 07:56:43 -08:00
Chris Robinson
2e6a55a87c Handle padding between device sample frames
The padding must be constant and sample type aligned (e.g. some fixed multiple
of two bytes between the start of two consecutive frames for 16-bit output).
The intent is to always have the ability for stereo output with WASAPI even if
the device has some other unsupported configuration, as long as front-left and
front-right exist.
2019-12-21 20:43:46 -08:00
Chris Robinson
b687e952ef Make C callbacks noexcept
No telling what would happen if exceptions managed to get back into presumably
C-based callers.
2019-10-09 03:29:25 -07:00
Chris Robinson
963580c2d5 Never return null from CreateRingBuffer
Allocation failure would already throw a bad_alloc anyway, now a size overflow
throws an exception too.
2019-10-08 21:55:03 -07:00
Chris Robinson
7726a06d26 Clean up some exception messages and avoid duplicate log messages 2019-10-08 05:44:38 -07:00
Chris Robinson
52a003e9bb Avoid raw lock/unlock calls 2019-10-07 23:22:06 -07:00
Chris Robinson
02d80cd74d Use exceptions for backend open failures 2019-10-07 21:37:56 -07:00
Chris Robinson
c5a3c52822 Return and pass more appropriate types for backends 2019-09-15 09:50:28 -07:00
Chris Robinson
a250b6a986 Return unsigned values from the FromDevFmt functions 2019-09-13 14:29:25 -07:00
Chris Robinson
70058a8a84 Move the dynload decls and defs to common 2019-08-10 21:54:30 -07:00
Chris Robinson
cb3e96e756 Rename Alc to alc 2019-07-28 18:56:04 -07:00