Skip to content

Conversation

@michaelgregorius
Copy link
Contributor

This pull request introduces input selection for the Jack driver and should be merged after #7786 because input selection only makes sense if recording is implemented/merged.

The dialog looks as follows with the PR:

JackDriverWithInputSelectionAndWarning

A warning is shown in case the users have inputs or outputs in their configuration which are not available at the time when the dialog was created. Users can then either cancel out of the dialog or select the inputs/outputs so that everything is configured fine again.

Note: it shares many commits with #7919 which will disappear if #7919 is merged before this one.

Add two combo boxes and a Jack client to the Jack setup dialog. The combo
boxes display the available Jack inputs. Please note that in Jack
terminology these are called "outputs".

The own Jack client is necessary because the setup dialog does not have
any access to the actual driver. So a new client is created when the
dialog is opened and deleted when it is closed, i.e. when the dialog is
deleted itself.

The available inputs are collected via
`AudioJack::setupWidget::getAudioInputNames` and are then put into the
combo boxes via `AudioJack::setupWidget::populateComboBox`.

`AudioJack::setupWidget::saveSettings` saves the selections that have
been made in the combo boxes into the configuration.

Add the method `handleRegistrationEvent` to `AudioJack` and register it
in `AudioJack::initJackClient` via `jack_set_port_registration_callback`.
Currently it will only output information about the port via `printf` but
not do anything else. It can likely be removed again because the
`AudioJack::setupWidget` uses it's own client and must register its own
callbacks in case it wants to react to changed inputs and outputs while
the setup dialog is open.

* Do the same for the inputs
* Read the information stored in the configuration when the driver is
  initialized. Gracefully handle when selections are not available, e.g.
  because the device is not plugged in.
* Decide if the setup dialog should react to changed ports while it is
  open. This might complicate selections that are currently made, i.e. it
  has to be ensured that the user experience is good.
* Remove printf statements
Extend the Jack setup dialog with combo boxes that present the available
outputs.

Save the selected outputs in the configuration.

Add `AudioJack::setupWidget::getAudioPortNames` which takes the type of
port and then collects all port names which match. Make the new
`getAudioOutputNames` and `getAudioInputNames` delegate to that method
with the appropriate type. This also hides the different terminologies a
bit.
Attempt to reconnect the inputs and outputs from the configuration during
startup of the Jack driver. Nothing will be done for inputs and outputs
that are not available at startup. Example: the users might have saved
some inputs when a device was available. The device is then disconnected
and LMMS restarted. The stored inputs cannot be used anymore. To give the
users the least surprise nothing is done.

`AudioJack::attemptToConnect` does the actual reconnection and also
prints some information for now.

`attemptToReconnectOutput` and `attemptToReconnectInput` delegate to
`attemptToConnect` with the right parameters.
When populating the combo boxes select the current input/output as saved
in the configuration.
Show a warning message in the Jack setup dialog if some inputs or outputs
that are set in the configuration are missing in the system. This might
for example be caused by disconnected devices.

Let `populateComboBox` return a boolean which indicates if the selected
port can be found in the list of displayed ports or not.
Remove `AudioJack::handleRegistrationEvent` as it was only used for
debugging so far.
Replace repeated hard-coded strings with references to static constant
variables in the anonymous namespace. This should prevent subtle mistakes
when working with the configuration values of the Jack driver.
Input selection does not make sense for master now because recording is
not implemented/merged yet. However, being able to select the inputs from
a combo box instead of having to use an external connection manager
already brings benefit to users. Hence we remove input selection for now.

There will be a separate branch/commit which will revert this commit,
i.e. which will add input selection again once it makes sense for master.
Introduce input selection for the Jack driver similar to how it is done
for the outputs, i.e. saving to configuration, reconnection at driver
start, etc.
@michaelgregorius
Copy link
Contributor Author

Closing this pull request as the extra commits have now been incorporated into #7919. The rationale is that the SDL driver dialog also already sports input selection although the feature itself is not implemented yet. If wanted the input selection can be temporarily removed with #ifdef statements.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant