Browse Source

redesign export dialog

audio_region_bpm_change_fix
Alexandros Theodotou 5 months ago
parent
commit
14cd7ecc51
Signed by: alex
GPG Key ID: 022EAE42313D70F3
  1. 53
      inc/audio/exporter.h
  2. 64
      inc/gui/widgets/dialogs/export_dialog.h
  3. 26
      inc/settings/settings.h
  4. 22
      inc/utils/audio.h
  5. 2
      meson.build
  6. 2
      meson_options.txt
  7. 651
      resources/ui/export_dialog.ui
  8. 65
      scripts/gen-schema.scm.in
  9. 100
      src/audio/exporter.c
  10. 1018
      src/gui/widgets/dialogs/export_dialog.c
  11. 20
      src/gui/widgets/dialogs/save_chord_preset_dialog.c
  12. 2
      src/gui/widgets/panel_file_browser.c
  13. 31
      src/settings/settings.c
  14. 29
      src/utils/audio.c
  15. 2
      subprojects/libadwaita.wrap
  16. 20
      tests/helpers/exporter.h
  17. 20
      tests/settings/settings.c

53
inc/audio/exporter.h

@ -1,21 +1,5 @@ @@ -1,21 +1,5 @@
/*
* Copyright (C) 2018-2021 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 Affero 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Zrythm. If not, see <https://www.gnu.org/licenses/>.
*/
// SPDX-FileCopyrightText: © 2018-2021 Alexandros Theodotou <alex@zrythm.org>
// SPDX-License-Identifier: LicenseRef-ZrythmLicense
#ifndef __AUDIO_EXPORT_H__
#define __AUDIO_EXPORT_H__
@ -40,18 +24,34 @@ typedef enum ExportFormat @@ -40,18 +24,34 @@ typedef enum ExportFormat
EXPORT_FORMAT_WAV,
EXPORT_FORMAT_MP3,
/** Raw audio data. */
EXPORT_FORMAT_RAW,
/** MIDI type 0. */
EXPORT_FORMAT_MIDI0,
/** MIDI type 1. */
EXPORT_FORMAT_MIDI1,
/** Raw audio data. */
EXPORT_FORMAT_RAW,
NUM_EXPORT_FORMATS,
} ExportFormat;
/**
* Returns the format as a human friendly label.
*/
const char *
export_format_to_pretty_str (ExportFormat format);
/**
* Returns the audio format as a file extension.
*/
const char *
export_format_to_ext (ExportFormat format);
ExportFormat
export_format_from_pretty_str (
const char * pretty_str);
/**
* Time range to export.
*/
@ -257,17 +257,6 @@ exporter_create_audio_track_after_bounce ( @@ -257,17 +257,6 @@ exporter_create_audio_track_after_bounce (
ExportSettings * settings,
const Position * pos);
/**
* Returns the audio format as string.
*
* @param extension Whether to return the extension
* for this format, or a human friendly label.
*/
const char *
exporter_stringize_export_format (
ExportFormat format,
bool extension);
/**
* Exports an audio file based on the given
* settings.

64
inc/gui/widgets/dialogs/export_dialog.h

@ -1,21 +1,5 @@ @@ -1,21 +1,5 @@
/*
* Copyright (C) 2018-2022 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 Affero 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Zrythm. If not, see <https://www.gnu.org/licenses/>.
*/
// SPDX-FileCopyrightText: © 2018-2022 Alexandros Theodotou <alex@zrythm.org>
// SPDX-License-Identifier: LicenseRef-ZrythmLicense
/**
* \file
@ -26,6 +10,7 @@ @@ -26,6 +10,7 @@
#ifndef __GUI_WIDGETS_EXPORT_DIALOG_H__
#define __GUI_WIDGETS_EXPORT_DIALOG_H__
#include <adwaita.h>
#include <gtk/gtk.h>
#define EXPORT_DIALOG_WIDGET_TYPE \
@ -54,9 +39,37 @@ typedef enum ExportFilenamePattern @@ -54,9 +39,37 @@ typedef enum ExportFilenamePattern
*/
typedef struct _ExportDialogWidget
{
GtkDialog parent_instance;
GtkButton * cancel_button;
GtkButton * export_button;
GtkDialog parent_instance;
AdwViewSwitcherTitle * title;
AdwViewStack * stack;
/* audio */
AdwEntryRow * audio_title;
AdwEntryRow * audio_artist;
AdwEntryRow * audio_genre;
AdwComboRow * audio_format;
AdwComboRow * audio_bit_depth;
GtkSwitch * audio_dither_switch;
AdwComboRow * audio_filename_pattern;
AdwComboRow * audio_mixdown_or_stems;
GtkDropDown * audio_time_range_drop_down;
GtkTreeView * audio_tracks_treeview;
GtkLabel * audio_output_label;
/* MIDI */
AdwEntryRow * midi_title;
AdwEntryRow * midi_artist;
AdwEntryRow * midi_genre;
AdwComboRow * midi_format;
GtkSwitch * midi_export_lanes_as_tracks_switch;
AdwComboRow * midi_filename_pattern;
AdwComboRow * midi_mixdown_or_stems;
GtkDropDown * midi_time_range_drop_down;
GtkTreeView * midi_tracks_treeview;
GtkLabel * midi_output_label;
#if 0
GtkEntry * export_artist;
GtkEntry * export_title;
GtkEntry * export_genre;
@ -68,17 +81,10 @@ typedef struct _ExportDialogWidget @@ -68,17 +81,10 @@ typedef struct _ExportDialogWidget
GtkComboBox * bit_depth;
GtkCheckButton * lanes_as_tracks;
GtkToggleButton * dither;
GtkLabel * output_label;
GtkTreeView * tracks_treeview;
GtkTreeModel * tracks_model;
/** Underlying model of @ref
* ExportDialogWidget.tracks_model. */
GtkTreeStore * tracks_store;
GtkToggleButton * mixdown_toggle;
GtkToggleButton * stems_toggle;
#endif
} ExportDialogWidget;
/**

26
inc/settings/settings.h

@ -1,21 +1,5 @@ @@ -1,21 +1,5 @@
/*
* Copyright (C) 2018-2022 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 Affero 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Zrythm. If not, see <https://www.gnu.org/licenses/>.
*/
// SPDX-FileCopyrightText: © 2018-2022 Alexandros Theodotou <alex@zrythm.org>
// SPDX-License-Identifier: LicenseRef-ZrythmLicense
/**
* \file
@ -45,7 +29,8 @@ typedef struct UserShortcuts UserShortcuts; @@ -45,7 +29,8 @@ typedef struct UserShortcuts UserShortcuts;
/* ---- Standard settings ---- */
#define S_MONITOR SETTINGS->monitor
#define S_UI SETTINGS->ui
#define S_EXPORT SETTINGS->export
#define S_EXPORT_AUDIO SETTINGS->export_audio
#define S_EXPORT_MIDI SETTINGS->export_midi
#define S_GENERAL SETTINGS->general
#define S_UI_INSPECTOR SETTINGS->ui_inspector
#define S_UI_MIXER SETTINGS->ui_mixer
@ -139,7 +124,8 @@ typedef struct Settings @@ -139,7 +124,8 @@ typedef struct Settings
/** Transport settings. */
GSettings * transport;
GSettings * export;
GSettings * export_audio;
GSettings * export_midi;
GSettings * ui_mixer;
GSettings * ui_inspector;

22
inc/utils/audio.h

@ -56,6 +56,28 @@ audio_bit_depth_enum_to_int (BitDepth depth) @@ -56,6 +56,28 @@ audio_bit_depth_enum_to_int (BitDepth depth)
}
}
static inline BitDepth
audio_bit_depth_int_to_enum (int depth)
{
switch (depth)
{
case 16:
return BIT_DEPTH_16;
case 24:
return BIT_DEPTH_24;
case 32:
return BIT_DEPTH_32;
default:
g_return_val_if_reached (BIT_DEPTH_16);
}
}
BitDepth
audio_bit_depth_from_pretty_str (const char * str);
const char *
audio_bit_depth_to_pretty_str (BitDepth depth);
/**
* Number of plugin slots per channel.
*/

2
meson.build

@ -946,7 +946,7 @@ gtk_dep = dependency ( @@ -946,7 +946,7 @@ gtk_dep = dependency (
static: all_static)
libadwaita_dep = dependency (
'libadwaita-1', version: '>=1.0.0',
'libadwaita-1', version: '>=1.2',
fallback: ['libadwaita', 'libadwaita_dep'],
default_options: [
'vapi=false', 'tests=false',

2
meson_options.txt

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
# SPDX-FileCopyrightText: © 2019-2021 Alexandros Theodotou <alex@zrythm.org>
# SPDX-FileCopyrightText: © 2019-2022 Alexandros Theodotou <alex@zrythm.org>
# SPDX-License-Identifier: LicenseRef-ZrythmLicense
option (

651
resources/ui/export_dialog.ui

@ -1,436 +1,277 @@ @@ -1,436 +1,277 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<requires lib="Adw" version="4.0"/>
<requires lib="gtk" version="4.0"/>
<template class="ExportDialogWidget" parent="GtkDialog">
<property name="title" translatable="yes">Export As...</property>
<property name="modal">1</property>
<property name="decorated">0</property>
<property name="use_header_bar">0</property>
<property name="modal">true</property>
<property name="icon-name">zrythm</property>
<child internal-child="content_area">
<object class="GtkBox">
<property name="orientation">vertical</property>
<property name="spacing">2</property>
<child>
<object class="GtkLabel">
<property name="label" translatable="yes">Details</property>
<style>
<class name="section_heading"/>
</style>
<object class="AdwHeaderBar">
<property name="centering-policy">strict</property>
<child type="title">
<object class="AdwViewSwitcherTitle" id="title">
<property name="stack">stack</property>
</object>
</child>
</object>
</child>
<child>
<object class="GtkGrid">
<child>
<object class="GtkLabel" id="output_label">
<property name="margin-start">4</property>
<property name="margin-end">4</property>
<property name="margin-bottom">8</property>
<property name="vexpand">1</property>
<property name="yalign">0</property>
<layout>
<property name="column">1</property>
<property name="row">9</property>
<property name="column-span">3</property>
</layout>
</object>
</child>
<child>
<object class="GtkLabel">
<property name="label" translatable="yes">Output Files</property>
<style>
<class name="section_heading"/>
</style>
<layout>
<property name="column">1</property>
<property name="row">8</property>
<property name="column-span">3</property>
</layout>
</object>
</child>
<child>
<object class="GtkLabel">
<property name="label" translatable="yes">Time Range</property>
<style>
<class name="section_heading"/>
</style>
<layout>
<property name="column">1</property>
<property name="row">4</property>
<property name="column-span">3</property>
</layout>
</object>
</child>
<child>
<object class="GtkLabel">
<property name="label" translatable="yes">Tracks</property>
<style>
<class name="section_heading"/>
</style>
<layout>
<property name="column">0</property>
<property name="row">4</property>
</layout>
</object>
</child>
<child>
<object class="GtkTreeView" id="tracks_treeview">
<property name="focusable">1</property>
<property name="vexpand">1</property>
<child internal-child="selection">
<object class="GtkTreeSelection"/>
</child>
<layout>
<property name="column">0</property>
<property name="row">6</property>
<property name="row-span">4</property>
</layout>
</object>
</child>
<child>
<object class="GtkBox">
<child>
<object class="GtkToggleButton" id="mixdown_toggle">
<property name="label" translatable="yes">Mixdown</property>
<property name="focusable">1</property>
<property name="receives-default">1</property>
</object>
</child>
<child>
<object class="GtkToggleButton" id="stems_toggle">
<property name="label" translatable="yes">Stems</property>
<property name="focusable">1</property>
<property name="receives-default">1</property>
</object>
</child>
<style>
<class name="linked"/>
</style>
<layout>
<property name="column">0</property>
<property name="row">5</property>
</layout>
</object>
</child>
<object class="AdwViewStack" id="stack">
<child>
<object class="GtkBox">
<child>
<object class="GtkToggleButton" id="time_range_song">
<property name="label" translatable="yes">Song</property>
<property name="focusable">1</property>
<property name="receives-default">1</property>
</object>
</child>
<child>
<object class="GtkToggleButton" id="time_range_loop">
<property name="label" translatable="yes">Loop</property>
<property name="focusable">1</property>
<property name="receives-default">1</property>
</object>
</child>
<child>
<object class="GtkToggleButton" id="time_range_custom">
<property name="label" translatable="yes">Custom</property>
<property name="focusable">1</property>
<property name="receives-default">1</property>
</object>
</child>
<style>
<class name="linked"/>
</style>
<layout>
<property name="column">1</property>
<property name="row">5</property>
<property name="column-span">3</property>
</layout>
</object>
</child>
<child>
<object class="GtkGrid">
<property name="row-homogeneous">1</property>
<child>
<object class="GtkLabel" id="label5">
<property name="margin-start">4</property>
<property name="margin-end">4</property>
<property name="label" translatable="yes">Filename Pattern</property>
<layout>
<property name="column">0</property>
<property name="row">4</property>
</layout>
</object>
</child>
<child>
<object class="GtkComboBox" id="filename_pattern">
<layout>
<property name="column">1</property>
<property name="row">4</property>
</layout>
</object>
</child>
<child>
<object class="GtkEntry" id="export_title">
<property name="focusable">1</property>
<property name="hexpand">1</property>
<layout>
<property name="column">3</property>
<property name="row">1</property>
</layout>
</object>
</child>
<child>
<object class="GtkLabel" id="label6">
<property name="label" translatable="yes">Title</property>
<layout>
<property name="column">2</property>
<property name="row">1</property>
</layout>
</object>
</child>
<child>
<object class="GtkLabel" id="label2">
<property name="label" translatable="yes">Artist</property>
<layout>
<property name="column">0</property>
<property name="row">1</property>
</layout>
</object>
</child>
<child>
<object class="GtkEntry" id="export_artist">
<property name="focusable">1</property>
<property name="hexpand">1</property>
<layout>
<property name="column">1</property>
<property name="row">1</property>
</layout>
</object>
</child>
<child>
<object class="GtkLabel" id="label1">
<property name="label" translatable="yes">Genre</property>
<layout>
<property name="column">0</property>
<property name="row">2</property>
</layout>
</object>
</child>
<child>
<object class="GtkEntry" id="export_genre">
<property name="focusable">1</property>
<layout>
<property name="column">1</property>
<property name="row">2</property>
</layout>
</object>
</child>
<child>
<object class="GtkComboBox" id="format">
<property name="hexpand">1</property>
<layout>
<property name="column">3</property>
<property name="row">2</property>
</layout>
</object>
</child>
<child>
<object class="GtkLabel" id="label3">
<property name="label" translatable="yes">Format</property>
<layout>
<property name="column">2</property>
<property name="row">2</property>
</layout>
</object>
</child>
<child>
<object class="GtkLabel" id="label4">
<property name="margin-start">2</property>
<property name="margin-end">2</property>
<property name="label" translatable="yes">Bit depth</property>
<layout>
<property name="column">0</property>
<property name="row">3</property>
</layout>
</object>
</child>
<child>
<object class="GtkComboBox" id="bit_depth">
<layout>
<property name="column">1</property>
<property name="row">3</property>
</layout>
</object>
</child>
<child>
<object class="GtkToggleButton" id="dither">
<property name="label" translatable="yes">Dither</property>
<property name="focusable">1</property>
<layout>
<property name="column">2</property>
<property name="row">4</property>
<property name="column-span">2</property>
</layout>
</object>
</child>
<child>
<object class="GtkCheckButton" id="lanes_as_tracks">
<property name="label" translatable="yes">Lanes as separate tracks</property>
<property name="focusable">1</property>
<property name="tooltip-text" translatable="yes">Export track lanes as separate MIDI tracks</property>
<layout>
<property name="column">2</property>
<property name="row">3</property>
<property name="column-span">2</property>
</layout>
<object class="AdwViewStackPage">
<property name="name">audio</property>
<property name="title">Audio</property>
<property name="icon-name">signal-audio</property>
<property name="child">
<object class="GtkBox">
<property name="homogeneous">true</property>
<child>
<object class="AdwPreferencesPage">
<property name="title">Export Audio</property>
<child>
<object class="AdwPreferencesGroup">
<property name="title" translatable="yes">Metadata</property>
<child>
<object class="AdwEntryRow" id="audio_title">
<property name="title" translatable="yes">Title</property>
</object>
</child>
<child>
<object class="AdwEntryRow" id="audio_artist">
<property name="title" translatable="yes">Artist</property>
</object>
</child>
<child>
<object class="AdwEntryRow" id="audio_genre">
<property name="title" translatable="yes">Genre</property>
</object>
</child>
</object>
</child>
<child>
<object class="AdwPreferencesGroup">
<property name="title" translatable="yes">Options</property>
<child>
<object class="AdwComboRow" id="audio_format">
<property name="title" translatable="yes">Format</property>
</object>
</child>
<child>
<object class="AdwComboRow" id="audio_bit_depth">
<property name="title" translatable="yes">Bit Depth</property>
</object>
</child>
<child>
<object class="AdwActionRow" id="audio_dither">
<property name="title" translatable="yes">Dither</property>
<property name="subtitle" translatable="yes">Add low level noise to reduce errors on lower bit depths.</property>
<property name="activatable_widget">audio_dither_switch</property>
<child>
<object class="GtkSwitch" id="audio_dither_switch">
<property name="valign">center</property>
<property name="state">False</property>
</object>
</child>
</object>
</child>
<child>
<object class="AdwComboRow" id="audio_filename_pattern">
<property name="title" translatable="yes">Filename Pattern</property>
</object>
</child>
<child>
<object class="AdwComboRow" id="audio_mixdown_or_stems">
<property name="title" translatable="yes">Mixdown or Stems</property>
<property name="subtitle" translatable="yes">Whether to export the selected tracks as a single mixdown file or each track in its own file.</property>
</object>
</child>
</object>
</child>
</object>
</child>
<child>
<object class="AdwPreferencesPage">
<property name="title">Export Audio</property>
<child>
<object class="AdwPreferencesGroup">
<property name="title" translatable="yes">Selection</property>
<child>
<object class="AdwActionRow">
<property name="title" translatable="yes">Time range</property>
<property name="subtitle" translatable="yes">Only events inside this time range will be exported.</property>
<property name="activatable_widget">audio_time_range_drop_down</property>
<child>
<object class="GtkDropDown" id="audio_time_range_drop_down">
<property name="valign">center</property>
</object>
</child>
</object>
</child>
<child>
<object class="AdwExpanderRow">
<property name="title" translatable="yes">Track Selection</property>
<property name="expanded">true</property>
<child>
<object class="GtkListBoxRow">
<property name="activatable">0</property>
<child>
<object class="GtkTreeView" id="audio_tracks_treeview">
</object>
</child>
</object>
</child>
</object>
</child>
</object>
</child>
<child>
<object class="AdwPreferencesGroup">
<property name="title" translatable="yes">Output</property>
<child>
<object class="GtkLabel" id="audio_output_label">
</object>
</child>
</object>
</child>
</object>
</child>
</object>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<layout>
<property name="column">0</property>
<property name="row">0</property>
<property name="column-span">4</property>
</layout>
</object>
</child>
<child>
<object class="GtkBox">
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<layout>
<property name="column">1</property>
<property name="row">7</property>
<property name="column-span">3</property>
</layout>
</property>
</object>
</child>
<child>
<object class="GtkBox">
<child>
<object class="GtkBox" id="from_meter">
<property name="hexpand">1</property>
<property name="orientation">vertical</property>
<object class="AdwViewStackPage">
<property name="name">midi</property>
<property name="title">MIDI</property>
<property name="icon-name">signal-midi</property>
<property name="child">
<object class="GtkBox">
<property name="homogeneous">true</property>
<child>
<placeholder/>
<object class="AdwPreferencesPage">
<property name="title">Export MIDI</property>
<child>
<object class="AdwPreferencesGroup">
<property name="title" translatable="yes">Metadata</property>
<child>
<object class="AdwEntryRow" id="midi_title">
<property name="title" translatable="yes">Title</property>
</object>
</child>
<child>
<object class="AdwEntryRow" id="midi_artist">
<property name="title" translatable="yes">Artist</property>
</object>
</child>
<child>
<object class="AdwEntryRow" id="midi_genre">
<property name="title" translatable="yes">Genre</property>
</object>
</child>
</object>
</child>
<child>
<object class="AdwPreferencesGroup">
<property name="title" translatable="yes">Options</property>
<child>
<object class="AdwComboRow" id="midi_format">
<property name="title" translatable="yes">Format</property>
<property name="model">
<object class="GtkStringList">
<items>
<item>Type 0</item>
<item>Type 1</item>
</items>
</object>
</property>
</object>
</child>
<child>
<object class="AdwActionRow" id="midi_export_lanes_as_tracks">
<property name="title" translatable="yes">Export Lanes as Tracks</property>
<property name="activatable_widget">midi_export_lanes_as_tracks_switch</property>
<child>
<object class="GtkSwitch" id="midi_export_lanes_as_tracks_switch">
<property name="valign">center</property>
<property name="state">False</property>
</object>
</child>
</object>
</child>
<child>
<object class="AdwComboRow" id="midi_filename_pattern">
<property name="title" translatable="yes">Filename Pattern</property>
</object>
</child>
<child>
<object class="AdwComboRow" id="midi_mixdown_or_stems">
<property name="title" translatable="yes">Mixdown or Stems</property>
<property name="subtitle" translatable="yes">Whether to export the selected tracks as a single mixdown file or each track in its own file.</property>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
</child>
<child>
<object class="GtkLabel">
<property name="margin-start">4</property>
<property name="margin-end">4</property>
<property name="label" translatable="yes">~</property>
</object>
</child>
<child>
<object class="GtkBox" id="to_meter">
<property name="hexpand">1</property>
<property name="orientation">vertical</property>
<child>
<placeholder/>
<object class="AdwPreferencesPage">
<property name="title">Export MIDI</property>
<child>
<object class="AdwPreferencesGroup">
<property name="title" translatable="yes">Selection</property>
<child>
<object class="AdwActionRow">
<property name="title" translatable="yes">Time range</property>
<property name="subtitle" translatable="yes">Only events inside this time range will be exported.</property>
<property name="activatable_widget">midi_time_range_drop_down</property>
<child>
<object class="GtkDropDown" id="midi_time_range_drop_down">
<property name="valign">center</property>
</object>
</child>
</object>
</child>
<child>
<object class="AdwExpanderRow">
<property name="title" translatable="yes">Track Selection</property>
<property name="expanded">true</property>
<child>
<object class="GtkListBoxRow">
<property name="activatable">0</property>
<child>
<object class="GtkTreeView" id="midi_tracks_treeview">
</object>
</child>
</object>
</child>
</object>
</child>
</object>
</child>
<child>
<object class="AdwPreferencesGroup">
<property name="title" translatable="yes">Output</property>
<child>
<object class="GtkLabel" id="midi_output_label">
</object>
</child>
</object>
</child>
</object>
</child>
</object>
</child>
<layout>
<property name="column">1</property>
<property name="row">6</property>
<property name="column-span">3</property>
</layout>
</property>
</object>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
</object>
</child>
</object>
</child>
<child internal-child="action_area">
<object class="GtkBox">
<property name="valign">center</property>
<child>
<object class="GtkButton" id="cancel_button">
<property name="label" translatable="yes">Cancel</property>
<property name="focusable">1</property>
<property name="receives-default">1</property>
<signal name="clicked" handler="on_cancel_clicked" object="ExportDialogWidget" swapped="no"/>
</object>
</child>
<child>
<object class="GtkButton" id="export_button">
<property name="label" translatable="yes">Export</property>
<property name="focusable">1</property>
<property name="receives-default">1</property>
</object>
</child>
</object>
</child>
</template>
<object class="GtkSizeGroup" id="top_ctrl_sz_group">
<widgets>
<widget name="export_title"/>
<widget name="export_artist"/>
<widget name="export_genre"/>
<widget name="format"/>
<widget name="bit_depth"/>
<widget name="filename_pattern"/>
</widgets>
</object>
<object class="GtkSizeGroup" id="top_label_sz_group">
<widgets>
<widget name="label1"/>
<widget name="label2"/>
<widget name="label3"/>
<widget name="label4"/>
<widget name="label5"/>
<widget name="label6"/>
</widgets>
</object>
</interface>

65
scripts/gen-schema.scm.in

@ -252,13 +252,6 @@ Args: @@ -252,13 +252,6 @@ Args:
(print-enum
"export-time-range"
'("loop" "song" "custom"))
(print-enum
"export-format"
'("flac" "ogg-vorbis" "ogg-opus" "wav"
"mp3" "midi-0" "midi-1" "raw"))
(print-enum
"export-bit-depth"
'("16" "24" "32"))
(print-enum
"export-filename-pattern"
'("append-format"
@ -906,7 +899,7 @@ Args: @@ -906,7 +899,7 @@ Args:
(schema-print
(make-schema
"export"
"export.audio"
(list
(make-schema-key
"genre" "s" "Electronic"
@ -925,8 +918,8 @@ Args: @@ -925,8 +918,8 @@ Args:
"song"
"Time range"
"Time range to export.")
(make-schema-key-with-enum
"format" "export-format" "flac"
(make-schema-key
"format" "s" "FLAC"
"Format"
"Format to export to.")
(make-schema-key-with-enum
@ -935,10 +928,6 @@ Args: @@ -935,10 +928,6 @@ Args:
"append-format"
"Filename pattern"
"Filename pattern for exported files.")
(make-schema-key
"lanes-as-tracks" "b" "false"
"Lanes as tracks"
"Export track lanes as separate MIDI tracks.")
(make-schema-key
"dither" "b" "false"
"Dither"
@ -947,12 +936,52 @@ Args: @@ -947,12 +936,52 @@ Args:
"export-stems" "b" "false"
"Export stems"
"Whether to export stems instead of the mixdown.")
(make-schema-key-with-enum
"bit-depth"
"export-bit-depth" "24"
(make-schema-key
"bit-depth" "i" "24"
"Bit depth"
"Bit depth to use when exporting")
))) ;; export
))) ;; export.audio
(schema-print
(make-schema
"export.midi"
(list
(make-schema-key
"genre" "s" "Electronic"
"Genre"
"Genre to use when exporting.")
(make-schema-key
"artist" "s" "Zrythm"
"Artist"
"Artist to use when exporting.")
(make-schema-key
"title" "s" "My Project"
"Title"
"Title to use when exporting.")
(make-schema-key-with-enum
"time-range" "export-time-range"
"song"
"Time range"
"Time range to export.")
(make-schema-key-with-range
"format" "i" "0" "1"
"1" "Format"
"MIDI file format (Type 0 or 1).")
(make-schema-key-with-enum
"filename-pattern"
"export-filename-pattern"
"append-format"
"Filename pattern"
"Filename pattern for exported files.")
(make-schema-key
"lanes-as-tracks" "b" "false"
"Lanes as tracks"
"Export track lanes as separate MIDI tracks.")
(make-schema-key
"export-stems" "b" "false"
"Export stems"
"Whether to export stems instead of the mixdown.")
))) ;; export.midi
(schema-print
(make-schema

100
src/audio/exporter.c

@ -28,6 +28,7 @@ @@ -28,6 +28,7 @@
#include "utils/io.h"
#include "utils/math.h"
#include "utils/objects.h"
#include "utils/string.h"
#include "utils/ui.h"
#include "zrythm_app.h"
@ -38,68 +39,48 @@ @@ -38,68 +39,48 @@
#define AMPLITUDE (1.0 * 0x7F000000)
static const char * pretty_formats[] = {
"FLAC", "OGG (Vorbis)", "OGG (OPUS)",
"WAV", "MP3", "RAW",
"MIDI Type 0", "MIDI Type 1",
};
static const char * format_exts[] = {
"FLAC", "ogg", "ogg", "wav",
"mp3", "raw", "mid", "mid",
};
/**
* Returns the audio format as string.
*
* @param extension Whether to return the extension
* for this format, or a human friendly label.
* Returns the format as a human friendly label.
*/
const char *
export_format_to_pretty_str (ExportFormat format)
{
return pretty_formats[format];
}
/**
* Returns the audio format as a file extension.
*/
const char *
exporter_stringize_export_format (
ExportFormat format,
bool extension)
export_format_to_ext (ExportFormat format)
{
switch (format)
return format_exts[format];
}
ExportFormat
export_format_from_pretty_str (
const char * pretty_str)
{
for (ExportFormat i = 0; i < NUM_EXPORT_FORMATS;
i++)
{
case EXPORT_FORMAT_FLAC:
return "FLAC";
case EXPORT_FORMAT_OGG_VORBIS:
if (extension)
{
return "ogg";
}
else
{
return "ogg (Vorbis)";
}
case EXPORT_FORMAT_OGG_OPUS:
if (extension)
{
return "ogg";
}
else
{
return "ogg (OPUS)";
}
case EXPORT_FORMAT_WAV:
return "wav";
case EXPORT_FORMAT_MP3:
return "mp3";
case EXPORT_FORMAT_MIDI0:
if (extension)
{
return "mid";
}
else
{
return "MIDI type 0";
}
case EXPORT_FORMAT_MIDI1:
if (extension)
{
return "mid";
}
else
{
return "MIDI type 1";
}
case EXPORT_FORMAT_RAW:
return "raw";
case NUM_EXPORT_FORMATS:
break;
if (string_is_equal (
pretty_str, pretty_formats[i]))
return i;
}
g_return_val_if_reached (NULL);
g_return_val_if_reached (EXPORT_FORMAT_FLAC);
}
static int
@ -129,8 +110,7 @@ export_audio (ExportSettings * info) @@ -129,8 +110,7 @@ export_audio (ExportSettings * info)
default:
{
const char * format =
exporter_stringize_export_format (
info->format, false);
export_format_to_pretty_str (info->format);
info->progress_info.has_error = true;
sprintf (
@ -709,8 +689,7 @@ export_settings_set_bounce_defaults ( @@ -709,8 +689,7 @@ export_settings_set_bounce_defaults (
char * tmp_dir = g_dir_make_tmp (
"zrythm_bounce_XXXXXX", NULL);
const char * ext =
exporter_stringize_export_format (
self->format, true);
export_format_to_ext (self->format);
char filename[800];
sprintf (filename, "%s.%s", bounce_name, ext);
self->file_uri =
@ -876,8 +855,7 @@ export_settings_print (const ExportSettings * self) @@ -876,8 +855,7 @@ export_settings_print (const ExportSettings * self)
"dither: %d\n"
"file: %s\n"
"num files: %d\n",
exporter_stringize_export_format (
self->format, true),
export_format_to_pretty_str (self->format),
self->artist, self->title, self->genre,
audio_bit_depth_enum_to_int (self->depth),
"TODO", export_mode_to_str (self->mode),

1018
src/gui/widgets/dialogs/export_dialog.c

File diff suppressed because it is too large Load Diff

20
src/gui/widgets/dialogs/save_chord_preset_dialog.c

@ -1,21 +1,5 @@ @@ -1,21 +1,5 @@
/*
* Copyright (C) 2022 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 Affero 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Zrythm. If not, see <https://www.gnu.org/licenses/>.
*/
// SPDX-FileCopyrightText: © 2022 Alexandros Theodotou <alex@zrythm.org>
// SPDX-License-Identifier: LicenseRef-ZrythmLicense
#include "gui/backend/event.h"
#include "gui/backend/event_manager.h"

2
src/gui/widgets/panel_file_browser.c

@ -343,7 +343,7 @@ on_bookmark_row_activated ( @@ -343,7 +343,7 @@ on_bookmark_row_activated (
static void
on_file_search_changed (
GtkSearchEntry * search_entry,
GtkSearchEntry * search_entry,
PanelFileBrowserWidget * self)
{
gtk_filter_changed (

31
src/settings/settings.c

@ -1,21 +1,5 @@ @@ -1,21 +1,5 @@
/*
* Copyright (C) 2018-2022 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 Affero 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Zrythm. If not, see <https://www.gnu.org/licenses/>.
*/
// SPDX-FileCopyrightText: © 2018-2022 Alexandros Theodotou <alex@zrythm.org>
// SPDX-License-Identifier: LicenseRef-ZrythmLicense
/**
* \file
@ -60,8 +44,10 @@ settings_new (void) @@ -60,8 +44,10 @@ settings_new (void)
self->general = g_settings_new (
GSETTINGS_ZRYTHM_PREFIX ".general");
self->export = g_settings_new (
GSETTINGS_ZRYTHM_PREFIX ".export");
self->export_audio = g_settings_new (
GSETTINGS_ZRYTHM_PREFIX ".export.audio");
self->export_midi = g_settings_new (
GSETTINGS_ZRYTHM_PREFIX ".export.midi");
self->monitor = g_settings_new (
GSETTINGS_ZRYTHM_PREFIX ".monitor");
self->ui =
@ -103,7 +89,7 @@ settings_new (void) @@ -103,7 +89,7 @@ settings_new (void)
#undef PREFERENCES_PREFIX
g_return_val_if_fail (
self->general && self->export && self->ui
self->general && self->export_audio && self->ui
&& self->ui_inspector,
NULL);
@ -573,7 +559,8 @@ settings_free (Settings * self) @@ -573,7 +559,8 @@ settings_free (Settings * self)
FREE_SETTING (monitor);
FREE_SETTING (ui);
FREE_SETTING (transport);
FREE_SETTING (export);
FREE_SETTING (export_audio);
FREE_SETTING (export_midi);
FREE_SETTING (ui_mixer);
FREE_SETTING (ui_inspector);
FREE_SETTING (ui_panels);

29
src/utils/audio.c

@ -7,8 +7,11 @@ @@ -7,8 +7,11 @@
#include "project.h"
#include "utils/audio.h"
#include "utils/math.h"
#include "utils/string.h"
#include "utils/vamp.h"
#include <glib/gi18n.h>
#include <audec/audec.h>
#include <samplerate.h>
#include <sndfile.h>
@ -20,6 +23,32 @@ @@ -20,6 +23,32 @@
static int num_cores = 0;
static const char * bit_depth_pretty_strings[] = {
__ ("16 bit"),
__ ("24 bit"),
__ ("32 bit"),
};
BitDepth
audio_bit_depth_from_pretty_str (const char * str)
{
for (BitDepth i = BIT_DEPTH_16;
i <= BIT_DEPTH_32; i++)
{
if (string_is_equal (
str, _ (bit_depth_pretty_strings[i])))
return i;
}
g_return_val_if_reached (BIT_DEPTH_16);
}
const char *
audio_bit_depth_to_pretty_str (BitDepth depth)
{
return _ (bit_depth_pretty_strings[depth]);
}
void
audio_audec_log_func (
AudecLogLevel level,

2
subprojects/libadwaita.wrap

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
[wrap-git]
directory=libadwaita
url=https://gitlab.gnome.org/GNOME/libadwaita
revision=libadwaita-1-1
revision=main
depth=1

20
tests/helpers/exporter.h

@ -1,21 +1,5 @@ @@ -1,21 +1,5 @@
/*
* Copyright (C) 2022 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 Affero 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Zrythm. If not, see <https://www.gnu.org/licenses/>.
*/
// SPDX-FileCopyrightText: © 2022 Alexandros Theodotou <alex@zrythm.org>
// SPDX-License-Identifier: LicenseRef-ZrythmLicense
/**
* \file

20
tests/settings/settings.c

@ -1,21 +1,5 @@ @@ -1,21 +1,5 @@
/*
* Copyright (C) 2021 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 Affero 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Zrythm. If not, see <https://www.gnu.org/licenses/>.
*/
// SPDX-FileCopyrightText: © 2021 Alexandros Theodotou <alex@zrythm.org>
// SPDX-License-Identifier: LicenseRef-ZrythmLicense
#include "zrythm-test-config.h"

Loading…
Cancel
Save