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
141typedef struct ExportSettings
142{
143 ExportFormat format;
144 char * artist;
145 char * title;
146 char * genre;
147
150 ExportTimeRange time_range;
151
154
160
163
171 BounceStep bounce_step;
172
175 Position custom_end;
176
179
183 bool dither;
184
188 char * file_uri;
189
193
194 ProgressInfo * progress_info;
196
204
216void
218 ExportSettings * self,
219 ExportFormat format,
220 const char * filepath,
221 const char * bounce_name);
222
223void
224export_settings_print (const ExportSettings * self);
225
226void
227export_settings_free (ExportSettings * self);
228
237NONNULL GPtrArray *
239 const ExportSettings * const settings,
240 EngineState * engine_state);
241
253NONNULL_ARGS (1)
255 const ExportSettings * const settings,
256 GPtrArray * connections,
257 EngineState * engine_state);
258
267void *
269
278void
280 GTask * task,
281 gpointer source_obj,
282 gpointer task_data,
283 GCancellable * cancellable);
284
293void
295 ExportSettings * settings,
296 const Position * pos);
297
304int
306
311#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: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.
@ 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:142
bool lanes_as_tracks
Export track lanes as separate MIDI tracks.
Definition exporter.h:178
bool bounce_with_parents
Bounce with parent tracks (direct outs).
Definition exporter.h:162
BitDepth depth
Bit depth (16/24/64).
Definition exporter.h:149
BounceStep bounce_step
Bounce step (pre inserts, pre fader, post fader).
Definition exporter.h:171
char * file_uri
Absolute path for export file.
Definition exporter.h:188
Position custom_start
Positions in case of custom time range.
Definition exporter.h:174
int num_files
Number of files being simultaneously exported, for progress calculation.
Definition exporter.h:192
ExportMode mode
Export mode.
Definition exporter.h:153
bool disable_after_bounce
Disable exported track (or mute region) after bounce.
Definition exporter.h:159
bool dither
Dither or not.
Definition exporter.h:183
A Position is made up of bars.beats.sixteenths.ticks.
Definition position.h:126