10#ifndef __AUDIO_FADER_H__
11#define __AUDIO_FADER_H__
31#define FADER_SCHEMA_VERSION 2
33#define MONITOR_FADER (CONTROL_ROOM->monitor_fader)
35#define FADER_MAGIC 32548791
36#define IS_FADER(f) (f->magic == FADER_MAGIC)
37#define IS_FADER_AND_NONNULL(f) (f && f->magic == FADER_MAGIC)
40#define FADER_DEFAULT_FADE_FRAMES_SHORT 1024
41#define FADER_DEFAULT_FADE_FRAMES \
42 (ZRYTHM_TESTING ? FADER_DEFAULT_FADE_FRAMES_SHORT : 8192)
44#define FADER_FADE_FRAMES_FOR_TYPE(f) \
45 ((f)->type == FaderType::FADER_TYPE_MONITOR \
46 ? FADER_DEFAULT_FADE_FRAMES \
47 : FADER_DEFAULT_FADE_FRAMES_SHORT)
49#define fader_is_in_active_project(self) \
50 ((self->track != NULL && track_is_in_active_project (self->track)) || (self->sample_processor != NULL && sample_processor_is_in_active_project (self->sample_processor)) || (self->control_room != NULL && control_room_is_in_active_project (self->control_room)))
69 FADER_TYPE_MIDI_CHANNEL,
244fader_create_swap_phase_port (
Fader * self,
bool passthrough);
317#define fader_get_listened(self) (control_port_is_toggled (self->listen))
365fader_get_fader_val (
void * self);
368fader_get_default_fader_val (
void * self);
371fader_db_string_getter (
void * obj,
char * buf);
374fader_get_channel (
Fader * self);
377fader_get_track (
Fader * self);
380fader_update_volume_and_fader_val (
Fader * self);
420fader_update_track_pos (
426fader_clone (
const Fader * src);
Ports that transfer audio/midi/other signals to one another.
NONNULL_ARGS(1) int undo_manager_undo(UndoManager *self
Undo last action.
HOT NONNULL void fader_clear_buffers(Fader *self)
Clears all buffers.
COLD Fader * fader_new(FaderType type, bool passthrough, Track *track, ControlRoom *control_room, SampleProcessor *sample_processor)
Creates a new fader.
void fader_set_listened(Fader *self, bool listen, bool fire_events)
Sets fader listen and optionally adds the action to the undo stack.
void fader_free(Fader *self)
Frees the fader members.
NONNULL bool fader_get_muted(const Fader *const self)
Returns if the fader is muted.
HOT NONNULL bool fader_get_soloed(const Fader *const self)
Returns if the track is soloed.
bool fader_get_swap_phase(Fader *self)
Gets whether mono compatibility is enabled.
bool fader_get_mono_compat_enabled(Fader *self)
Gets whether mono compatibility is enabled.
void fader_set_soloed(Fader *self, bool solo, bool fire_events)
Sets track soloed and optionally adds the action to the undo stack.
void fader_set_muted(Fader *self, bool mute, bool fire_events)
Sets track muted and optionally adds the action to the undo stack.
void fader_copy_values(Fader *src, Fader *dest)
Copy the fader values from source to dest.
NONNULL float fader_get_amp(void *self)
Gets the fader amplitude (not db) FIXME is void * necessary? do it in the caller.
NONNULL HOT void fader_process(Fader *self, const EngineProcessTimeInfo *const time_nfo)
Process the Fader.
void fader_set_mono_compat_enabled(Fader *self, bool enabled, bool fire_events)
Sets whether mono compatibility is enabled.
NONNULL void fader_append_ports(const Fader *self, GPtrArray *ports)
Appends the ports owned by fader to the given array.
void fader_add_amp(void *self, float amp)
Adds (or subtracts if negative) to the amplitude of the fader (clamped at 0.0 to 2....
void fader_set_swap_phase(Fader *self, bool enabled, bool fire_events)
Sets whether mono compatibility is enabled.
void fader_disconnect_all(Fader *self)
Disconnects all ports connected to the fader.
void fader_set_amp_with_action(Fader *self, float amp_from, float amp_to, bool skip_if_equal)
Sets the amp value with an undoable action.
bool fader_get_implied_soloed(Fader *self)
Returns whether the fader is not soloed on its own but its direct out (or its direct out's direct out...
void fader_set_fader_val(Fader *self, float fader_val)
Sets the fader levels from a normalized value 0.0-1.0 (such as in widgets).
void fader_set_amp(void *self, float amp)
Sets the amplitude of the fader.
@ FADER_TYPE_GENERIC
For generic uses.
@ FADER_TYPE_AUDIO_CHANNEL
Audio fader for Channel's.
@ FADER_TYPE_SAMPLE_PROCESSOR
Audio fader for the sample processor.
@ FADER_TYPE_MONITOR
Audio fader for the monitor.
@ MIDI_FADER_MODE_CC_VOLUME
Send CC volume event on change TODO.
@ MIDI_FADER_MODE_VEL_MULTIPLIER
Multiply velocity of all MIDI note ons.
A Channel is part of a Track (excluding Tracks that don't have Channels) and contains information rel...
The control room allows to specify how Listen will work on each Channel and to set overall volume aft...
Common struct to pass around during processing to avoid repeating the data in function arguments.
A Fader is a processor that is used for volume controls and pan.
Port * balance
A control Port that controls the balance (0.0 ~ 1.0) 0.5 is center.
StereoPorts * stereo_out
L & R audio output ports, if audio.
Port * listen
Listened or not.
Port * swap_phase
Swap phase toggle.
ControlRoom * control_room
Pointer to owner control room, if any.
bool was_effectively_muted
Cache.
float fader_val
0.0 ~ 1.0 for widgets.
Port * midi_in
MIDI in port, if MIDI.
int fading_out
Whether currently fading out.
Port * mute
Control port for muting the (channel) fader.
Track * track
Pointer to owner track, if any.
bool passthrough
Whether this is a passthrough fader (like a prefader).
float volume
Volume in dBFS.
int fade_out_samples
Number of samples left to fade out.
StereoPorts * stereo_in
L & R audio input ports, if audio.
float phase
Used by the phase knob (0.0 ~ 360.0).
Port * amp
A control port that controls the volume in amplitude (0.0 ~ 1.5)
float l_port_db
Current dBFS after processing each output port.
int fade_in_samples
Number of samples left to fade in.
Port * solo
Soloed or not.
Port * mono_compat_enabled
Whether mono compatibility switch is enabled.
Port * midi_out
MIDI out port, if MIDI.
float last_cc_volume
Value of amp during last processing.
SampleProcessor * sample_processor
Pointer to owner sample processor, if any.
MidiFaderMode midi_mode
MIDI fader mode.
Struct used to identify Ports in the project.
Must ONLY be created via port_new()
A processor to be used in the routing graph for playing samples independent of the timeline.
L & R port, for convenience.
Track to be inserted into the Project's Tracklist.