mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-07 07:14:56 +01:00
SMF: add a set_length() method which will place TrkEnd meta-events
This commit is contained in:
parent
769920d337
commit
aa2fb8c1d4
2 changed files with 18 additions and 0 deletions
|
|
@ -34,6 +34,7 @@
|
||||||
#include "libsmf/smf.h"
|
#include "libsmf/smf.h"
|
||||||
|
|
||||||
#include "temporal/tempo.h"
|
#include "temporal/tempo.h"
|
||||||
|
#include "temporal/beats.h"
|
||||||
|
|
||||||
#include "evoral/Event.h"
|
#include "evoral/Event.h"
|
||||||
#include "evoral/SMF.h"
|
#include "evoral/SMF.h"
|
||||||
|
|
@ -528,6 +529,21 @@ SMF::end_write(string const & path)
|
||||||
fclose(f);
|
fclose(f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
SMF::set_length (Temporal::Beats const & b)
|
||||||
|
{
|
||||||
|
if (!_smf) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (uint16_t n = 0; n < _smf->number_of_tracks; ++n) {
|
||||||
|
smf_track_t* trk = smf_get_track_by_number (_smf, n+1);
|
||||||
|
if (trk) {
|
||||||
|
smf_track_add_eot_pulses (trk, (int) floor (b.get_ticks() * ((double) ppqn() / Temporal::ticks_per_beat)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
double
|
double
|
||||||
SMF::round_to_file_precision (double val) const
|
SMF::round_to_file_precision (double val) const
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -39,6 +39,7 @@ typedef smf_tempo_struct smf_tempo_t;
|
||||||
|
|
||||||
namespace Temporal {
|
namespace Temporal {
|
||||||
class TempoMap;
|
class TempoMap;
|
||||||
|
class Beats;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace Evoral {
|
namespace Evoral {
|
||||||
|
|
@ -89,6 +90,7 @@ public:
|
||||||
void end_write(std::string const &);
|
void end_write(std::string const &);
|
||||||
|
|
||||||
void flush() {};
|
void flush() {};
|
||||||
|
void set_length (Temporal::Beats const &);
|
||||||
|
|
||||||
double round_to_file_precision (double val) const;
|
double round_to_file_precision (double val) const;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue