Commit e8eda127 authored by Alex Tee's avatar Alex Tee

base implementation of modulator tab (WIP)

parent a2cd207a
Pipeline #926 passed with stages
in 7 minutes and 20 seconds
/*
* Copyright (C) 2019 Alexandros Theodotou <alex at zrythm dot org>
*
* This file is part of Zrythm
*
* Zrythm is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Zrythm is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Zrythm. If not, see <https://www.gnu.org/licenses/>.
*/
/**
* \file
*
* Modulator for each Track/Channel.
*/
#ifndef __AUDIO_MODULATOR_H__
#define __AUDIO_MODULATOR_H__
#include "utils/yaml.h"
typedef struct _ModulatorWidget ModulatorWidget;
typedef struct Track Track;
typedef struct Plugin Plugin;
typedef struct PluginDescriptor PluginDescriptor;
/**
* A Modulator for modulating/automating parameters
* of other Plugins.
*
* Each Channel/Track contains a list of Modulators
* that are not in the Channel strip, shown in a
* separate tab in the bottom panel.
*/
typedef struct Modulator
{
/**
* Index in the list of Modulators for the Track.
*/
int index;
/**
* The plugin that does the processing for this
* Modulator.
*
* This plugin must have at least 1 CV out port that
* will be shown on the right side of the
* ModulatorWidget, and any number of Control in
* ports shown as knobs on the left side of the
* ModulatorWidget for changing its parameters.
*/
Plugin * plugin;
/** Uniquely identifiable name. */
char * name;
/** Pointer back to the Track. */
Track * track;
/**
* The widget associated with this Modulator.
*/
ModulatorWidget * widget;
} Modulator;
static const cyaml_schema_field_t
modulator_fields_schema[] =
{
CYAML_FIELD_INT (
"index", CYAML_FLAG_DEFAULT,
Modulator, index),
CYAML_FIELD_END
};
static const cyaml_schema_value_t
modulator_schema = {
CYAML_VALUE_MAPPING (CYAML_FLAG_POINTER,
Modulator, modulator_fields_schema),
};
/**
* Creates a new Modulator.
*
* @param descr The descriptor of a plugin to
* instantiate.
* @param track The owner Track.
*/
Modulator *
modulator_new (
PluginDescriptor * descr,
Track * track);
#endif // __AUDIO_MODULATOR_H__
......@@ -35,8 +35,10 @@
#include <gtk/gtk.h>
#define MAX_REGIONS 300
#define MAX_MODULATORS 14
typedef struct AutomationTracklist AutomationTracklist;
typedef struct AutomationTracklist
AutomationTracklist;
typedef struct Region Region;
typedef struct Position Position;
typedef struct _TrackWidget TrackWidget;
......@@ -47,6 +49,7 @@ typedef struct Automatable Automatable;
typedef struct AutomationPoint AutomationPoint;
typedef struct ZChord ZChord;
typedef struct MusicalScale MusicalScale;
typedef struct Modulator Modulator;
typedef enum TrackType
{
......@@ -185,6 +188,10 @@ typedef struct Track
AutomationTracklist automation_tracklist;
/** Modulators for this Track. */
Modulator * modulators[MAX_MODULATORS];
int num_modulators;
} Track;
static const cyaml_strval_t
......@@ -417,6 +424,14 @@ char *
track_stringize_type (
TrackType type);
/**
* Adds and connects a Modulator to the Track.
*/
void
track_add_modulator (
Track * track,
Modulator * modulator);
/**
* Wrapper for each track type.
*/
......
......@@ -132,6 +132,7 @@ typedef enum EventType
ET_CHANNEL_OUTPUT_CHANGED,
ET_CHANNEL_SLOTS_CHANGED,
ET_DRUM_MODE_CHANGED,
ET_MODULATOR_ADDED,
} EventType;
/**
......
/*
* Copyright (C) 2018 Alexandros Theodotou <alex at zrythm dot org>
* Copyright (C) 2018-2019 Alexandros Theodotou <alex at zrythm dot org>
*
* This file is part of Zrythm
*
......@@ -41,13 +41,14 @@ G_DECLARE_FINAL_TYPE (BotDockEdgeWidget,
typedef struct _MixerWidget MixerWidget;
typedef struct _ClipEditorWidget ClipEditorWidget;
typedef struct _RackWidget RackWidget;
typedef struct _ModulatorViewWidget
ModulatorViewWidget;
typedef struct _BotDockEdgeWidget
{
GtkBox parent_instance;
GtkNotebook * bot_notebook;
RackWidget * rack;
ModulatorViewWidget * modulator_view;
ClipEditorWidget * clip_editor;
MixerWidget * mixer;
} BotDockEdgeWidget;
......
......@@ -17,6 +17,10 @@
* along with Zrythm. If not, see <https://www.gnu.org/licenses/>.
*/
/**
* \file
*/
#ifndef __GUI_WIDGETS_CLIP_EDITOR_H__
#define __GUI_WIDGETS_CLIP_EDITOR_H__
......@@ -37,6 +41,12 @@ typedef struct _AudioClipEditorWidget
AudioClipEditorWidget;
typedef struct ClipEditor ClipEditor;
/**
* The ClipEditorWidget shows in the Clip Editor /
* Piano Roll tab of the bottom panel, and is a stack
* of PianoRollWidget for the piano roll and
* AudioClipEditorWidget for audio regions.
*/
typedef struct _ClipEditorWidget
{
GtkStack parent_instance;
......
......@@ -42,7 +42,8 @@ typedef struct Channel Channel;
typedef enum DragDestBoxType
{
DRAG_DEST_BOX_TYPE_MIXER,
DRAG_DEST_BOX_TYPE_TRACKLIST
DRAG_DEST_BOX_TYPE_TRACKLIST,
DRAG_DEST_BOX_TYPE_MODULATORS,
} DragDestBoxType;
typedef struct _DragDestBoxWidget
......@@ -58,8 +59,9 @@ typedef struct _DragDestBoxWidget
* Creates a drag destination box widget.
*/
DragDestBoxWidget *
drag_dest_box_widget_new (GtkOrientation orientation,
int spacing,
DragDestBoxType type);
drag_dest_box_widget_new (
GtkOrientation orientation,
int spacing,
DragDestBoxType type);
#endif
......@@ -40,11 +40,15 @@ G_DECLARE_DERIVABLE_TYPE (
typedef struct
{
GtkButton * button;
GtkBox * btn_box;
GtkLabel * btn_label;
GtkImage * btn_img;
GtkRevealer * revealer;
GtkBox * content;
/** Horizontal or vertical. */
GtkOrientation orientation;
} ExpanderBoxWidgetPrivate;
typedef struct _ExpanderBoxWidgetClass
......@@ -105,4 +109,35 @@ expander_box_widget_add_content (
content);
}
static inline void
expander_box_widget_set_orientation (
ExpanderBoxWidget * self,
GtkOrientation orientation)
{
ExpanderBoxWidgetPrivate * prv =
expander_box_widget_get_private (self);
/* set the main orientation */
prv->orientation = orientation;
gtk_orientable_set_orientation (
GTK_ORIENTABLE (self),
orientation);
/* set the orientation of the box inside the
* expander button */
gtk_orientable_set_orientation (
GTK_ORIENTABLE (prv->btn_box),
orientation == GTK_ORIENTATION_HORIZONTAL ?
GTK_ORIENTATION_VERTICAL :
GTK_ORIENTATION_HORIZONTAL);
/* set the label angle */
if (orientation == GTK_ORIENTATION_HORIZONTAL)
gtk_label_set_angle (
prv->btn_label, 90.0);
else
gtk_label_set_angle (
prv->btn_label, 0.0);
}
#endif
/*
* Copyright (C) 2019 Alexandros Theodotou <alex at zrythm dot org>
*
* This file is part of Zrythm
*
* Zrythm is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Zrythm is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Zrythm. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef __GUI_WIDGETS_KNOB_WITH_NAME_H__
#define __GUI_WIDGETS_KNOB_WITH_NAME_H__
#include <gtk/gtk.h>
#define KNOB_WITH_NAME_WIDGET_TYPE \
(knob_with_name_widget_get_type ())
G_DECLARE_FINAL_TYPE (
KnobWithNameWidget,
knob_with_name_widget,
Z, KNOB_WITH_NAME_WIDGET,
GtkBox)
typedef struct _KnobWidget KnobWidget;
/**
* A vertical box with a knob at the top and a name
* at the bottom.
*/
typedef struct _KnobWithNameWidget
{
GtkBox parent_instance;
/** The label to show below the knob. */
GtkLabel * label;
/** The knob. */
KnobWidget * knob;
} KnobWithNameWidget;
KnobWithNameWidget *
knob_with_name_widget_new (
const char * name,
KnobWidget * knob);
#endif
/*
* Copyright (C) 2019 Alexandros Theodotou <alex at zrythm dot org>
*
* This file is part of Zrythm
*
* Zrythm is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Zrythm is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Zrythm. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef __GUI_WIDGETS_MODULATOR_H__
#define __GUI_WIDGETS_MODULATOR_H__
#include "audio/track.h"
#include "gui/widgets/two_col_expander_box.h"
#include <gtk/gtk.h>
#define MODULATOR_WIDGET_TYPE \
(modulator_widget_get_type ())
G_DECLARE_FINAL_TYPE (
ModulatorWidget,
modulator_widget,
Z, MODULATOR_WIDGET,
TwoColExpanderBoxWidget)
typedef struct _KnobWithNameWidget KnobWithNameWidget;
typedef struct Modulator Modulator;
typedef struct _ModulatorWidget
{
TwoColExpanderBoxWidget parent_instance;
/** The controls box on the left. */
GtkBox * controls_box;
KnobWithNameWidget * knobs[MAX_MODULATORS];
int num_knobs;
/** The graph on the right. */
GtkDrawingArea * graph;
/** Width is 60 so 59 previous points per
* CV out (max 6). */
double prev_points[6][60];
/** Pointer back to the Modulator. */
Modulator * modulator;
} ModulatorWidget;
ModulatorWidget *
modulator_widget_new (
Modulator * modulator);
#endif
/*
* Copyright (C) 2019 Alexandros Theodotou <alex at zrythm dot org>
*
* This file is part of Zrythm
*
* Zrythm is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Zrythm is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Zrythm. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef __GUI_WIDGETS_MODULATOR_VIEW_H__
#define __GUI_WIDGETS_MODULATOR_VIEW_H__
#include <gtk/gtk.h>
#define MODULATOR_VIEW_WIDGET_TYPE \
(modulator_view_widget_get_type ())
G_DECLARE_FINAL_TYPE (
ModulatorViewWidget,
modulator_view_widget,
Z, MODULATOR_VIEW_WIDGET,
GtkBox)
#define MW_MODULATOR_VIEW \
MW_BOT_DOCK_EDGE->modulator_view
/**
* Brings up the ModulatorViewWidget in the notebook.
*/
#define SHOW_MODULATOR_VIEW \
gtk_notebook_set_current_page ( \
MW_MODULATOR_VIEW->bot_notebook, 2)
typedef struct _ModulatorWidget ModulatorWidget;
typedef struct _ColorAreaWidget ColorAreaWidget;
typedef struct Track Track;
/**
* The ModulatorViewWidget contains the
* ModulatorWidgets for the selected Track.
*/
typedef struct _ModulatorViewWidget
{
GtkBox parent_instance;
GtkBox * modulators_box;
ColorAreaWidget * color;
GtkLabel * track_name;
Track * track;
ModulatorWidget * modulators[14];
} ModulatorViewWidget;
void
modulator_view_widget_refresh (
ModulatorViewWidget * self,
Track * track);
#endif
......@@ -130,28 +130,50 @@ typedef struct Lv2Plugin
LV2_Options_Option options[6];
LV2_Atom_Forge forge; ///< Atom forge
Sratom* sratom; ///< Atom serialiser
Sratom* ui_sratom; ///< Atom serialiser for UI thread
ZixRing* ui_events; ///< Port events from UI
ZixRing* plugin_events; ///< Port events from plugin
void* ui_event_buf; ///< Buffer for reading UI port events
LV2_Worker worker; ///< Worker thread implementation
LV2_Worker state_worker; ///< Synchronous worker for state restore
ZixSem work_lock; ///< Lock for plugin work() method
ZixSem* done; ///< Exit semaphore
char* temp_dir; ///< Temporary plugin state directory
char* save_dir; ///< Plugin save directory
const LilvPlugin* lilv_plugin; ///< Plugin class (RDF data)
LilvState * state; ///< temporary storage
LilvState* preset; ///< Current preset
LilvUIs* uis; ///< All plugin UIs (RDF data)
const LilvUI* ui; ///< Plugin UI (RDF data)
const LilvNode* ui_type; ///< Plugin UI type (unwrapped)
LilvInstance* instance; ///< Plugin instance (shared library)
SuilHost* ui_host; ///< Plugin UI host support
SuilInstance* ui_instance; ///< Plugin UI instance (shared library)
void* window; ///< Window (if applicable) (GtkWindow)
/** Atom forge. */
LV2_Atom_Forge forge;
/** Atom serializer */
Sratom* sratom;
/** Atom serializer for UI thread. */
Sratom* ui_sratom;
/** Port events from UI. */
ZixRing* ui_events;
/** Port events from plugin. */
ZixRing* plugin_events;
/** Buffer for readding UI port events. */
void* ui_event_buf;
/** Worker thread implementation. */
LV2_Worker worker;
/** Synchronous worker for state restore. */
LV2_Worker state_worker;
/** Lock for plugin work() method. */
ZixSem work_lock;
/** Exit semaphore. */
ZixSem* done;
/** Temporary plugin state directory. */
char* temp_dir;
/** Plugin save directory. */
char* save_dir;
/** Plugin class (RDF data). */
const LilvPlugin* lilv_plugin;
/** Temporary storage. */
LilvState * state;
/** Current preset. */
LilvState* preset;
/** All plugin UIs (RDF data). */
LilvUIs* uis;
/** Plugin UI (RDF data). */
const LilvUI* ui;
/** Plugin UI type (unwrapped). */
const LilvNode* ui_type;
/** Plugin instance (shared library). */
LilvInstance* instance;
/** Plugin UI host support. */
SuilHost* ui_host;
/** Plugin UI instance (shared library). */
SuilInstance* ui_instance;
/** Window (if applicable) (GtkWindow). */
void* window;
/** ID of the delete-event signal so that we can
* deactivate before freeing the plugin. */
gulong delete_event_id;
......
......@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-05-23 10:30+0100\n"
"POT-Creation-Date: 2019-05-24 19:01+0100\n"
"PO-Revision-Date: 2019-05-09 12:18+0000\n"
"Last-Translator: Weblate Admin <weblate.admin@zrythm.org>\n"
"Language-Team: Arabic <https://translate.zrythm.org/projects/zrythm/zrythm/"
......@@ -64,7 +64,7 @@ msgstr ""
msgid "Artist"
msgstr ""
#: src/audio/track.c:732
#: src/audio/track.c:749
msgid "Audio"
msgstr ""
......@@ -112,7 +112,7 @@ msgstr ""
msgid "Bot"
msgstr ""
#: src/audio/track.c:735
#: src/audio/track.c:752
msgid "Bus"
msgstr ""
......@@ -158,7 +158,7 @@ msgstr ""
msgid "Choose a method to donate"
msgstr ""
#: src/audio/track.c:741
#: src/audio/track.c:758
msgid "Chord"
msgstr ""
......@@ -315,6 +315,10 @@ msgstr ""
msgid "Editing"
msgstr ""
#: resources/ui/bot_dock_edge.ui:56
msgid "Editor"
msgstr ""
#: resources/ui/shortcuts.ui:180
msgid "Editor Shortcuts"
msgstr ""
......@@ -439,7 +443,7 @@ msgstr ""
msgid "Grid"
msgstr ""
#: src/audio/track.c:744
#: src/audio/track.c:761
msgid "Group"
msgstr ""
......@@ -475,7 +479,7 @@ msgstr ""
msgid "Inserts"
msgstr ""
#: src/audio/track.c:729
#: src/audio/track.c:746
msgid "Instrument"
msgstr ""
......@@ -576,7 +580,7 @@ msgstr ""
msgid "Main Window"
msgstr ""
#: src/project.c:142 src/audio/track.c:738
#: src/project.c:142 src/audio/track.c:755
msgid "Master"
msgstr ""
......@@ -588,6 +592,10 @@ msgstr ""
msgid "Mixer panel"
msgstr ""
#: resources/ui/bot_dock_edge.ui:121
msgid "Modulators"
msgstr ""
#: src/actions/move_plugins_action.c:151
#, c-format
msgid "Move %d Plugins"
......@@ -713,10 +721,6 @@ msgstr ""
msgid "Pencil tool"
msgstr ""
#: resources/ui/bot_dock_edge.ui:56
msgid "Piano Roll"
msgstr ""
#: resources/ui/bot_dock_edge.ui:41
msgid "Piano roll panel"
msgstr ""
......@@ -818,10 +822,6 @@ msgstr ""
msgid "RW"
msgstr ""
#: resources/ui/bot_dock_edge.ui:121
msgid "Rack"
msgstr ""
#: resources/ui/shortcuts.ui:209
msgid "Ramp tool"
msgstr ""
......@@ -1106,7 +1106,8 @@ msgstr ""
msgid "Track Ports"
msgstr ""
#: resources/ui/piano_roll.ui:53 resources/ui/audio_clip_editor.ui:34
#: resources/ui/piano_roll.ui:53 resources/ui/modulator_view.ui:53
#: resources/ui/audio_clip_editor.ui:34
msgid "Track name"
msgstr ""
......
......@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: zrythm 0.2.003\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-05-23 10:30+0100\n"
"POT-Creation-Date: 2019-05-24 19:01+0100\n"
"PO-Revision-Date: 2019-03-23 13:18+0000\n"
"Last-Translator: alex <alex at zrythm dot org>\n"
"Language-Team: German\n"
......@@ -61,7 +61,7 @@ msgstr ""
msgid "Artist"
msgstr ""
#: src/audio/track.c:732
#: src/audio/track.c:749
msgid "Audio"
msgstr ""
......@@ -109,7 +109,7 @@ msgstr ""
msgid "Bot"
msgstr ""
#: src/audio/track.c:735
#: src/audio/track.c:752
msgid "Bus"
msgstr ""
......@@ -155,7 +155,7 @@ msgstr ""
msgid "Choose a method to donate"
msgstr ""
#: src/audio/track.c:741
#: src/audio/track.c:758
msgid "Chord"
msgstr ""
......@@ -312,6 +312,10 @@ msgstr ""
msgid "Editing"
msgstr ""
#: resources/ui/bot_dock_edge.ui:56
msgid "Editor"
msgstr ""
#: resources/ui/shortcuts.ui:180
msgid "Editor Shortcuts"
msgstr ""
......@@ -436,7 +440,7 @@ msgstr ""
msgid "Grid"
msgstr ""
#: src/audio/track.c:744
#: src/audio/track.c:761
msgid "Group"
msgstr ""
......@@ -472,7 +476,7 @@ msgstr ""
msgid "Inserts"
msgstr ""
#: src/audio/track.c:729
#: src/audio/track.c:746
msgid "Instrument"
msgstr ""
......@@ -573,7 +577,7 @@ msgstr ""
msgid "Main Window"
msgstr ""
#: src/project.c:142 src/audio/track.c:738
#: src/project.c:142 src/audio/track.c:755
msgid "Master"
msgstr ""
......@@ -585,6 +589,10 @@ msgstr ""
msgid "Mixer panel"
msgstr ""
#: resources/ui/bot_dock_edge.ui:121
msgid "Modulators"
msgstr ""
#: src/actions/move_plugins_action.c:151
#, c-format
msgid "Move %d Plugins"
......@@ -710,10 +718,6 @@ msgstr ""
msgid "Pencil tool"
msgstr ""
#: resources/ui/bot_dock_edge.ui:56
msgid "Piano Roll"
msgstr ""
#: resources/ui/bot_dock_edge.ui:41
msgid "Piano roll panel"
msgstr ""
......@@ -815,10 +819,6 @@ msgstr ""
msgid "RW"
msgstr ""
#: resources/ui/bot_dock_edge.ui:121
msgid "Rack"
msgstr ""
#: resources/ui/shortcuts.ui:209
msgid "Ramp tool"
msgstr ""
......@@ -1103,7 +1103,8 @@ msgstr ""
msgid "Track Ports"