mirror of
https://github.com/Ryujinx/libsoundio.git
synced 2025-03-08 10:10:14 +00:00
add Jack option to leave ports unconnected
This commit is contained in:
parent
eef66c5d34
commit
662ef7983b
|
@ -608,6 +608,12 @@ struct SoundIoOutStream {
|
|||
/// to an error code. Possible error codes are:
|
||||
/// * #SoundIoErrorIncompatibleDevice
|
||||
enum SoundIoError layout_error;
|
||||
|
||||
/// Optional: Whether to leave the software outputs unconnected.
|
||||
/// If this is set to `true`, JACK will not immediately connect the output
|
||||
/// of this stream to the output ports of the sound card.
|
||||
/// Defaults to `false`.
|
||||
bool unconnected;
|
||||
};
|
||||
|
||||
/// The size of this struct is not part of the API or ABI.
|
||||
|
@ -690,6 +696,12 @@ struct SoundIoInStream {
|
|||
/// If setting the channel layout fails for some reason, this field is set
|
||||
/// to an error code. Possible error codes are: #SoundIoErrorIncompatibleDevice
|
||||
enum SoundIoError layout_error;
|
||||
|
||||
/// Optional: Whether to leave the software inputs unconnected.
|
||||
/// If this is set to `true`, JACK will not immediately connect the input
|
||||
/// of this stream to the input ports of the sound card.
|
||||
/// Defaults to `false`.
|
||||
bool unconnected;
|
||||
};
|
||||
|
||||
/// See also ::soundio_version_major, ::soundio_version_minor, ::soundio_version_patch
|
||||
|
|
|
@ -542,6 +542,7 @@ static enum SoundIoError outstream_start_jack(struct SoundIoPrivate *si, struct
|
|||
if ((err = jack_activate(osj->client)))
|
||||
return SoundIoErrorStreaming;
|
||||
|
||||
if (!outstream->unconnected) {
|
||||
for (int ch = 0; ch < outstream->layout.channel_count; ch += 1) {
|
||||
struct SoundIoOutStreamJackPort *osjp = &osj->ports[ch];
|
||||
const char *dest_port_name = osjp->dest_port_name;
|
||||
|
@ -552,6 +553,7 @@ static enum SoundIoError outstream_start_jack(struct SoundIoPrivate *si, struct
|
|||
if ((err = jack_connect(osj->client, source_port_name, dest_port_name)))
|
||||
return SoundIoErrorStreaming;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -762,6 +764,7 @@ static enum SoundIoError instream_start_jack(struct SoundIoPrivate *si, struct S
|
|||
if ((err = jack_activate(isj->client)))
|
||||
return SoundIoErrorStreaming;
|
||||
|
||||
if (!instream->unconnected) {
|
||||
for (int ch = 0; ch < instream->layout.channel_count; ch += 1) {
|
||||
struct SoundIoInStreamJackPort *isjp = &isj->ports[ch];
|
||||
const char *source_port_name = isjp->source_port_name;
|
||||
|
@ -772,6 +775,7 @@ static enum SoundIoError instream_start_jack(struct SoundIoPrivate *si, struct S
|
|||
if ((err = jack_connect(isj->client, source_port_name, dest_port_name)))
|
||||
return SoundIoErrorStreaming;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue