Zrythm
a highly automated and intuitive digital audio workstation
Loading...
Searching...
No Matches
exporter.h
1// SPDX-FileCopyrightText: © 2018-2022 Alexandros Theodotou <alex@zrythm.org>
2// SPDX-License-Identifier: LicenseRef-ZrythmLicense
3
4#ifndef __AUDIO_EXPORT_H__
5#define __AUDIO_EXPORT_H__
6
7#include "dsp/position.h"
8#include "utils/audio.h"
9
10#include <glib/gi18n.h>
11
12typedef struct EngineState EngineState;
13typedef struct ProgressInfo ProgressInfo;
14
24enum class ExportFormat
25{
26 EXPORT_FORMAT_AIFF,
27 EXPORT_FORMAT_AU,
28 EXPORT_FORMAT_CAF,
29 EXPORT_FORMAT_FLAC,
30 EXPORT_FORMAT_MP3,
31 EXPORT_FORMAT_OGG_VORBIS,
32 EXPORT_FORMAT_OGG_OPUS,
33
36
37 EXPORT_FORMAT_WAV,
38 EXPORT_FORMAT_W64,
39
42
45};
46
50const char *
52
56const char *
58
60export_format_from_pretty_str (const char * pretty_str);
61
66{
67 TIME_RANGE_LOOP,
68 TIME_RANGE_SONG,
69 TIME_RANGE_CUSTOM,
70};
71
72static const char * export_time_range_str[] = {
73 "Loop",
74 "Song",
75 "Custom",
76};
77
78static inline const char *
79export_time_range_to_str (ExportTimeRange export_time_range)
80{
81 return export_time_range_str[static_cast<int> (export_time_range)];
82}
83
91enum class ExportMode
92{
95
99
103};
104
105static const char * export_mode_str[] = {
106 "Full",
107 "Tracks",
108 "Regions",
109};
110
111static inline const char *
112export_mode_to_str (ExportMode export_mode)
113{
114 return export_mode_str[static_cast<int> (export_mode)];
115}
116
117enum class BounceStep
118{
119 BOUNCE_STEP_BEFORE_INSERTS,
120 BOUNCE_STEP_PRE_FADER,
121 BOUNCE_STEP_POST_FADER,
122};
123
124static const char * bounce_step_str[] = {
125 N_ ("Before inserts"),
126 N_ ("Pre-fader"),
127 N_ ("Post fader"),
128};
129
130static inline const char *
131bounce_step_to_str (BounceStep bounce_step)
132{
133 return bounce_step_str[static_cast<int> (bounce_step)];
134}
135
139typedef struct ExportSettings
140{
141 ExportFormat format;
142 char * artist;
143 char * title;
144 char * genre;
145
148 ExportTimeRange time_range;
149
152
158
161
169 BounceStep bounce_step;
170
173 Position custom_end;
174
177
181 bool dither;
182
186 char * file_uri;
187
191
192 ProgressInfo * progress_info;
194
202
214void
216 ExportSettings * self,
217 ExportFormat format,
218 const char * filepath,
219 const char * bounce_name);
220
221void
222export_settings_print (const ExportSettings * self);
223
224void
225export_settings_free (ExportSettings * self);
226
235NONNULL GPtrArray *
237 const ExportSettings * const settings,
238 EngineState * engine_state);
239
251NONNULL_ARGS (1)
253 const ExportSettings * const settings,
254 GPtrArray * connections,
255 EngineState * engine_state);
256
265void *
267
276void
278 GTask * task,
279 gpointer source_obj,
280 gpointer task_data,
281 GCancellable * cancellable);
282
291void
293 ExportSettings * settings,
294 const Position * pos);
295
302int
304
309#endif
Audio utils.
NONNULL_ARGS(1) int undo_manager_undo(UndoManager *self
Undo last action.
ExportSettings * export_settings_new(void)
Returns an instance of default ExportSettings.
int exporter_export(ExportSettings *info)
Exports an audio file based on the given settings.
ExportTimeRange
Time range to export.
Definition exporter.h:66
void exporter_create_audio_track_after_bounce(ExportSettings *settings, const Position *pos)
To be called to create and perform an undoable action for creating an audio track with the bounced ma...
ExportMode
Export mode.
Definition exporter.h:92
void export_settings_set_bounce_defaults(ExportSettings *self, ExportFormat format, const char *filepath, const char *bounce_name)
Sets the defaults for bouncing.
ExportFormat
Export format.
Definition exporter.h:25
void * exporter_generic_export_thread(void *data)
Generic export thread to be used for simple exporting.
NONNULL GPtrArray * exporter_prepare_tracks_for_export(const ExportSettings *const settings, EngineState *engine_state)
This must be called on the main thread after the intended tracks have been marked for bounce and befo...
void exporter_post_export(const ExportSettings *const settings, GPtrArray *connections, EngineState *engine_state)
This must be called on the main thread after the export is completed.
const char * export_format_to_ext(ExportFormat format)
Returns the audio format as a file extension.
const char * export_format_to_pretty_str(ExportFormat format)
Returns the format as a human friendly label.
void exporter_generic_export_task_thread(GTask *task, gpointer source_obj, gpointer task_data, GCancellable *cancellable)
Generic export task thread function to be used for simple exporting.
@ EXPORT_MODE_TRACKS
Export selected tracks within the range only.
@ EXPORT_MODE_FULL
Export everything within the range normally.
@ EXPORT_MODE_REGIONS
Export selected regions within the range only.
@ EXPORT_FORMAT_MIDI1
MIDI type 1.
@ EXPORT_FORMAT_RAW
Raw audio data.
@ EXPORT_FORMAT_MIDI0
MIDI type 0.
BitDepth
Bit depth.
Definition audio.h:28
Position struct and API.
Export settings to be passed to the exporter to use.
Definition exporter.h:140
bool lanes_as_tracks
Export track lanes as separate MIDI tracks.
Definition exporter.h:176
bool bounce_with_parents
Bounce with parent tracks (direct outs).
Definition exporter.h:160
BitDepth depth
Bit depth (16/24/64).
Definition exporter.h:147
BounceStep bounce_step
Bounce step (pre inserts, pre fader, post fader).
Definition exporter.h:169
char * file_uri
Absolute path for export file.
Definition exporter.h:186
Position custom_start
Positions in case of custom time range.
Definition exporter.h:172
int num_files
Number of files being simultaneously exported, for progress calculation.
Definition exporter.h:190
ExportMode mode
Export mode.
Definition exporter.h:151
bool disable_after_bounce
Disable exported track (or mute region) after bounce.
Definition exporter.h:157
bool dither
Dither or not.
Definition exporter.h:181
A Position is made up of bars.beats.sixteenths.ticks.
Definition position.h:124