From c3102ab8a53ec60539a3c2dfe4ee4661eb1537b4 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Wed, 12 Apr 2023 13:12:29 +0200 Subject: [PATCH] Add preference to set PPQN of exported MIDI files This also changes the default from 19200 to 1920 --- libs/ardour/ardour/rc_configuration_vars.h | 1 + libs/ardour/export_smf_writer.cc | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/libs/ardour/ardour/rc_configuration_vars.h b/libs/ardour/ardour/rc_configuration_vars.h index f56c521240..af35967387 100644 --- a/libs/ardour/ardour/rc_configuration_vars.h +++ b/libs/ardour/ardour/rc_configuration_vars.h @@ -281,3 +281,4 @@ CONFIG_VARIABLE (bool, show_video_server_dialog, "show-video-server-dialog", fal /* export */ CONFIG_VARIABLE (float, export_preroll, "export-preroll", 2.0) // seconds CONFIG_VARIABLE (float, export_silence_threshold, "export-silence-threshold", -90) // dB +CONFIG_VARIABLE (float, ppqn_factor_for_export, "ppqn-factor-for-export", 1) // Temporal::ticks_per_beat diff --git a/libs/ardour/export_smf_writer.cc b/libs/ardour/export_smf_writer.cc index 96925b2008..16aeff975b 100644 --- a/libs/ardour/export_smf_writer.cc +++ b/libs/ardour/export_smf_writer.cc @@ -18,9 +18,11 @@ #include +#include "temporal/tempo.h" + #include "ardour/export_smf_writer.h" #include "ardour/midi_buffer.h" -#include "temporal/tempo.h" +#include "ardour/rc_configuration.h" using namespace ARDOUR; using namespace Evoral; @@ -43,7 +45,7 @@ int ExportSMFWriter::init (std::string const& path, samplepos_t timespan_start) { ::g_unlink (path.c_str ()); - if (SMF::create (path)) { + if (SMF::create (path, 1, Temporal::ticks_per_beat * Config->get_ppqn_factor_for_export ())) { return -1; } _path = path;