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
24typedef enum 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 NUM_EXPORT_FORMATS,
48
52const char *
54
58const char *
60
62export_format_from_pretty_str (const char * pretty_str);
63
67typedef enum ExportTimeRange
68{
69 TIME_RANGE_LOOP,
70 TIME_RANGE_SONG,
71 TIME_RANGE_CUSTOM,
73
74static const char * export_time_range_str[] = {
75 "Loop",
76 "Song",
77 "Custom",
78};
79
80static inline const char *
81export_time_range_to_str (ExportTimeRange export_time_range)
82{
83 return export_time_range_str[export_time_range];
84}
85
106
107static const char * export_mode_str[] = {
108 "Full",
109 "Tracks",
110 "Regions",
111};
112
113static inline const char *
114export_mode_to_str (ExportMode export_mode)
115{
116 return export_mode_str[export_mode];
117}
118
119typedef enum BounceStep
120{
121 BOUNCE_STEP_BEFORE_INSERTS,
122 BOUNCE_STEP_PRE_FADER,
123 BOUNCE_STEP_POST_FADER,
124} BounceStep;
125
126static const char * bounce_step_str[] = {
127 N_ ("Before inserts"),
128 N_ ("Pre-fader"),
129 N_ ("Post fader"),
130};
131
132static inline const char *
133bounce_step_to_str (BounceStep bounce_step)
134{
135 return bounce_step_str[bounce_step];
136}
137
142typedef struct ExportSettings
143{
144 ExportFormat format;
145 char * artist;
146 char * title;
147 char * genre;
148
151 ExportTimeRange time_range;
152
155
161
164
172 BounceStep bounce_step;
173
176 Position custom_end;
177
180
184 bool dither;
185
189 char * file_uri;
190
194
195 ProgressInfo * progress_info;
197
205
217void
219 ExportSettings * self,
220 ExportFormat format,
221 const char * filepath,
222 const char * bounce_name);
223
224void
225export_settings_print (const ExportSettings * self);
226
227void
228export_settings_free (ExportSettings * self);
229
238NONNULL GPtrArray *
240 const ExportSettings * const settings,
241 EngineState * engine_state);
242
254NONNULL_ARGS (1)
256 const ExportSettings * const settings,
257 GPtrArray * connections,
258 EngineState * engine_state);
259
268void *
270
279void
281 GTask * task,
282 gpointer source_obj,
283 gpointer task_data,
284 GCancellable * cancellable);
285
294void
296 ExportSettings * settings,
297 const Position * pos);
298
305int
307
312#endif
Audio utils.
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:68
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:94
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.
COLD NONNULL_ARGS(1) void automation_track_init_loaded(AutomationTrack *self
Inits a loaded AutomationTracklist.
@ EXPORT_MODE_REGIONS
Export selected regions within the range only.
Definition exporter.h:104
@ EXPORT_MODE_FULL
Export everything within the range normally.
Definition exporter.h:96
@ EXPORT_MODE_TRACKS
Export selected tracks within the range only.
Definition exporter.h:100
@ EXPORT_FORMAT_MIDI0
MIDI type 0.
Definition exporter.h:41
@ EXPORT_FORMAT_RAW
Raw audio data.
Definition exporter.h:35
@ EXPORT_FORMAT_MIDI1
MIDI type 1.
Definition exporter.h:44
BitDepth
Bit depth.
Definition audio.h:29
Position struct and API.
Export settings to be passed to the exporter to use.
Definition exporter.h:143
bool lanes_as_tracks
Export track lanes as separate MIDI tracks.
Definition exporter.h:179
bool bounce_with_parents
Bounce with parent tracks (direct outs).
Definition exporter.h:163
BitDepth depth
Bit depth (16/24/64).
Definition exporter.h:150
BounceStep bounce_step
Bounce step (pre inserts, pre fader, post fader).
Definition exporter.h:172
char * file_uri
Absolute path for export file.
Definition exporter.h:189
Position custom_start
Positions in case of custom time range.
Definition exporter.h:175
int num_files
Number of files being simultaneously exported, for progress calculation.
Definition exporter.h:193
ExportMode mode
Export mode.
Definition exporter.h:154
bool disable_after_bounce
Disable exported track (or mute region) after bounce.
Definition exporter.h:160
bool dither
Dither or not.
Definition exporter.h:184
A Position is made up of bars.beats.sixteenths.ticks.
Definition position.h:137