mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-02 09:01:50 -05:00
media-session: start the midi bridge from the session
This commit is contained in:
parent
0a6ad1adec
commit
fb95e7660a
6 changed files with 41 additions and 10 deletions
|
|
@ -83,9 +83,13 @@ extern "C" {
|
|||
* capturing PCM */
|
||||
#define SPA_NAME_API_ALSA_PCM_SINK "api.alsa.pcm.sink" /**< an alsa Node interface for
|
||||
* playback PCM */
|
||||
#define SPA_NAME_API_ALSA_MIDI_DEVICE "api.alsa.midi.device" /**< an alsa Midi device */
|
||||
#define SPA_NAME_API_ALSA_MIDI_SOURCE "api.alsa.midi.source" /**< an alsa Node interface for
|
||||
* capturing midi */
|
||||
#define SPA_NAME_API_ALSA_SEQ_DEVICE "api.alsa.seq.device" /**< an alsa Midi device */
|
||||
#define SPA_NAME_API_ALSA_SEQ_SOURCE "api.alsa.seq.source" /**< an alsa Node interface for
|
||||
* capture of midi */
|
||||
#define SPA_NAME_API_ALSA_SEQ_SINK "api.alsa.seq.sink" /**< an alsa Node interface for
|
||||
* playback of midi */
|
||||
#define SPA_NAME_API_ALSA_SEQ_BRIDGE "api.alsa.seq.bridge" /**< an alsa Node interface for
|
||||
* bridging midi ports */
|
||||
|
||||
/** keys for bluez5 factory names */
|
||||
#define SPA_NAME_API_BLUEZ5_ENUM_DBUS "api.bluez5.enum.dbus" /**< a dbus Device interface */
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@
|
|||
#include <spa/param/audio/format.h>
|
||||
#include <spa/pod/filter.h>
|
||||
|
||||
#define NAME "alsa-source"
|
||||
#define NAME "alsa-bridge"
|
||||
|
||||
#include "alsa-seq.h"
|
||||
|
||||
|
|
@ -946,15 +946,15 @@ impl_enum_interface_info(const struct spa_handle_factory *factory,
|
|||
|
||||
static const struct spa_dict_item info_items[] = {
|
||||
{ SPA_KEY_FACTORY_AUTHOR, "Wim Taymans <wim.taymans@gmail.com>" },
|
||||
{ SPA_KEY_FACTORY_DESCRIPTION, "Record midi with the alsa API" },
|
||||
{ SPA_KEY_FACTORY_DESCRIPTION, "Bridge midi ports with the alsa sequencer API" },
|
||||
{ SPA_KEY_FACTORY_USAGE, "["SPA_KEY_API_ALSA_PATH"=<device>]" },
|
||||
};
|
||||
|
||||
static const struct spa_dict info = SPA_DICT_INIT_ARRAY(info_items);
|
||||
|
||||
const struct spa_handle_factory spa_alsa_midi_source_factory = {
|
||||
const struct spa_handle_factory spa_alsa_seq_bridge_factory = {
|
||||
SPA_VERSION_HANDLE_FACTORY,
|
||||
SPA_NAME_API_ALSA_MIDI_SOURCE,
|
||||
SPA_NAME_API_ALSA_SEQ_BRIDGE,
|
||||
&info,
|
||||
impl_get_size,
|
||||
impl_init,
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ extern const struct spa_handle_factory spa_alsa_source_factory;
|
|||
extern const struct spa_handle_factory spa_alsa_sink_factory;
|
||||
extern const struct spa_handle_factory spa_alsa_udev_factory;
|
||||
extern const struct spa_handle_factory spa_alsa_device_factory;
|
||||
extern const struct spa_handle_factory spa_alsa_midi_source_factory;
|
||||
extern const struct spa_handle_factory spa_alsa_seq_bridge_factory;
|
||||
|
||||
SPA_EXPORT
|
||||
int spa_handle_factory_enum(const struct spa_handle_factory **factory, uint32_t *index)
|
||||
|
|
@ -52,7 +52,7 @@ int spa_handle_factory_enum(const struct spa_handle_factory **factory, uint32_t
|
|||
*factory = &spa_alsa_device_factory;
|
||||
break;
|
||||
case 4:
|
||||
*factory = &spa_alsa_midi_source_factory;
|
||||
*factory = &spa_alsa_seq_bridge_factory;
|
||||
break;
|
||||
default:
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ add-spa-lib api.jack.* jack/libspa-jack
|
|||
|
||||
#load-module libpipewire-module-spa-device api.jack.device
|
||||
#load-module libpipewire-module-spa-device api.alsa.enum.udev
|
||||
load-module libpipewire-module-spa-node api.alsa.midi.source node.name=MIDI-Bridge
|
||||
#load-module libpipewire-module-spa-node api.alsa.seq.bridge node.name=MIDI-Bridge
|
||||
load-module libpipewire-module-rtkit
|
||||
load-module libpipewire-module-protocol-native
|
||||
load-module libpipewire-module-spa-node-factory
|
||||
|
|
|
|||
|
|
@ -522,6 +522,30 @@ static const struct spa_device_events alsa_udev_events =
|
|||
.object_info = alsa_udev_object_info,
|
||||
};
|
||||
|
||||
static int alsa_start_midi_bridge(struct impl *impl)
|
||||
{
|
||||
struct pw_properties *props;
|
||||
int res = 0;
|
||||
|
||||
props = pw_properties_new(
|
||||
SPA_KEY_FACTORY_NAME, SPA_NAME_API_ALSA_SEQ_BRIDGE,
|
||||
SPA_KEY_NODE_NAME, "Midi-Bridge",
|
||||
NULL);
|
||||
|
||||
impl->midi_bridge = pw_core_proxy_create_object(impl->core_proxy,
|
||||
"spa-node-factory",
|
||||
PW_TYPE_INTERFACE_Node,
|
||||
PW_VERSION_NODE_PROXY,
|
||||
&props->dict,
|
||||
0);
|
||||
|
||||
if (impl->midi_bridge == NULL) {
|
||||
res = -errno;
|
||||
}
|
||||
return res;
|
||||
|
||||
}
|
||||
|
||||
static int alsa_start_monitor(struct impl *impl, struct monitor *monitor)
|
||||
{
|
||||
struct spa_handle *handle;
|
||||
|
|
|
|||
|
|
@ -93,6 +93,8 @@ struct impl {
|
|||
struct spa_dbus *dbus;
|
||||
struct spa_dbus_connection *dbus_connection;
|
||||
DBusConnection *conn;
|
||||
|
||||
struct pw_proxy *midi_bridge;
|
||||
};
|
||||
|
||||
struct object {
|
||||
|
|
@ -1227,6 +1229,7 @@ static void start_services(struct impl *impl)
|
|||
|
||||
bluez5_start_monitor(impl, &impl->bluez5_monitor);
|
||||
alsa_start_monitor(impl, &impl->alsa_monitor);
|
||||
alsa_start_midi_bridge(impl);
|
||||
v4l2_start_monitor(impl, &impl->v4l2_monitor);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue