Zrythm
a highly automated and intuitive digital audio workstation
Loading...
Searching...
No Matches
midi_mapping.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: © 2019-2022 Alexandros Theodotou <alex@zrythm.org>
2// SPDX-License-Identifier: LicenseRef-ZrythmLicense
3
10#ifndef __AUDIO_MIDI_MAPPING_H__
11#define __AUDIO_MIDI_MAPPING_H__
12
13#include "dsp/ext_port.h"
14#include "dsp/port.h"
15#include "utils/midi.h"
16
17typedef struct _WrappedObjectWithChangeSignal WrappedObjectWithChangeSignal;
18
25#define MIDI_MAPPINGS (PROJECT->midi_mappings)
26
54
58typedef struct MidiMappings
59{
60 MidiMapping ** mappings;
61 size_t mappings_size;
62 int num_mappings;
64
69void
71
77
78#define midi_mappings_bind_device(self, buf, dev_port, dest_port, fire_events) \
79 midi_mappings_bind_at ( \
80 self, buf, dev_port, dest_port, (self)->num_mappings, fire_events)
81
82#define midi_mappings_bind_track(self, buf, dest_port, fire_events) \
83 midi_mappings_bind_at ( \
84 self, buf, NULL, dest_port, (self)->num_mappings, fire_events)
85
95void
97 MidiMappings * self,
98 midi_byte_t * buf,
99 ExtPort * device_port,
100 Port * dest_port,
101 int idx,
102 bool fire_events);
103
110void
111midi_mappings_unbind (MidiMappings * self, int idx, bool fire_events);
112
114midi_mapping_new (void);
115
116void
117midi_mapping_set_enabled (MidiMapping * self, bool enabled);
118
119int
120midi_mapping_get_index (MidiMappings * self, MidiMapping * mapping);
121
122NONNULL MidiMapping *
123midi_mapping_clone (const MidiMapping * src);
124
125void
126midi_mapping_free (MidiMapping * self);
127
136void
138 MidiMappings * self,
139 MidiEvents * events,
140 bool queued);
141
145void
147
155int
157 MidiMappings * self,
158 Port * dest_port,
159 GPtrArray * arr);
160
162midi_mappings_clone (const MidiMappings * src);
163
164void
165midi_mappings_free (MidiMappings * self);
166
171#endif
Ports that transfer audio/midi/other signals to one another.
External ports.
void midi_mappings_apply_from_cc_events(MidiMappings *self, MidiEvents *events, bool queued)
Applies the events to the appropriate mapping.
void midi_mappings_bind_at(MidiMappings *self, midi_byte_t *buf, ExtPort *device_port, Port *dest_port, int idx, bool fire_events)
Binds the CC represented by the given raw buffer (must be size 3) to the given Port.
void midi_mappings_init_loaded(MidiMappings *self)
Initializes the MidiMappings after a Project is loaded.
int midi_mappings_get_for_port(MidiMappings *self, Port *dest_port, GPtrArray *arr)
Get MIDI mappings for the given port.
void midi_mappings_apply(MidiMappings *self, midi_byte_t *buf)
Applies the given buffer to the matching ports.
MidiMappings * midi_mappings_new(void)
Returns a newly allocated MidiMappings.
void midi_mappings_unbind(MidiMappings *self, int idx, bool fire_events)
Unbinds the given binding.
uint8_t midi_byte_t
MIDI byte.
Definition types.h:32
MIDI utils.
External port.
Definition ext_port.h:77
Container for passing midi events through ports.
Definition midi_event.h:68
A mapping from a MIDI value to a destination.
midi_byte_t key[3]
Raw MIDI signal.
ExtPort * device_port
The device that this connection will be mapped for.
WrappedObjectWithChangeSignal * gobj
Used in Gtk.
Port * dest
Destination pointer, for convenience.
int enabled
Whether this binding is enabled.
PortIdentifier dest_id
Destination.
All MIDI mappings in Zrythm.
Struct used to identify Ports in the project.
Must ONLY be created via port_new()
Definition port.h:140
A GObject-ified normal C object with a signal that interested parties can listen to for changes.