libardour: remove beats<->samples converter objects; provide a virtual get_origin() method instead to use with timepos_t/timecnt_t
This commit is contained in:
@@ -1685,10 +1685,6 @@
|
||||
RelativePath="..\ardour\automation_watch.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\ardour\beats_samples_converter.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\ardour\boost_debug.h"
|
||||
>
|
||||
|
||||
@@ -1,57 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2017 Paul Davis <paul@linuxaudiosystems.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#include "temporal/beats.h"
|
||||
#include "temporal/superclock.h"
|
||||
#include "temporal/time_converter.h"
|
||||
#include "temporal/types.h"
|
||||
|
||||
#include "ardour/libardour_visibility.h"
|
||||
#include "ardour/types.h"
|
||||
|
||||
#ifndef __ardour_beats_samples_converter_h__
|
||||
#define __ardour_beats_samples_converter_h__
|
||||
|
||||
namespace Temporal {
|
||||
class TempoMap;
|
||||
}
|
||||
|
||||
namespace ARDOUR {
|
||||
|
||||
/** Converter between quarter-note beats and samplepos_t. Takes distances in
|
||||
* quarter-note beats or samplepos_t from some origin (supplied to the
|
||||
* constructor in samplepos_t), and converts them to the opposite unit,
|
||||
* taking tempo changes into account.
|
||||
*/
|
||||
class LIBARDOUR_API BeatsSamplesConverter : public Temporal::TimeConverter<Temporal::Beats,samplepos_t,samplecnt_t> {
|
||||
public:
|
||||
BeatsSamplesConverter (const Temporal::TempoMap& tempo_map, Temporal::samplepos_t origin)
|
||||
: Temporal::TimeConverter<Temporal::Beats, samplepos_t, samplecnt_t> (origin)
|
||||
, _tempo_map (tempo_map)
|
||||
{}
|
||||
|
||||
samplecnt_t to (Temporal::Beats beats) const;
|
||||
Temporal::Beats from (samplecnt_t distance) const;
|
||||
|
||||
private:
|
||||
const Temporal::TempoMap& _tempo_map;
|
||||
};
|
||||
|
||||
} /* namespace ARDOUR */
|
||||
|
||||
#endif /* __ardour_beats_samples_converter_h__ */
|
||||
@@ -39,7 +39,6 @@
|
||||
#include "ardour/buffer.h"
|
||||
#include "ardour/midi_cursor.h"
|
||||
#include "ardour/source.h"
|
||||
#include "ardour/beats_samples_converter.h"
|
||||
|
||||
namespace ARDOUR {
|
||||
|
||||
|
||||
@@ -31,7 +31,6 @@
|
||||
#include "temporal/types_convert.h"
|
||||
|
||||
#include "ardour/automation_list.h"
|
||||
#include "ardour/beats_samples_converter.h"
|
||||
#include "ardour/event_type_map.h"
|
||||
#include "ardour/parameter_descriptor.h"
|
||||
#include "ardour/parameter_types.h"
|
||||
|
||||
@@ -1,52 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2017 Paul Davis <paul@linuxaudiosystems.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#include "pbd/stacktrace.h"
|
||||
|
||||
#include "temporal/tempo.h"
|
||||
|
||||
#include "ardour/beats_samples_converter.h"
|
||||
|
||||
namespace ARDOUR {
|
||||
|
||||
/** Takes a positive duration in quarter-note beats and considers it as a distance from the origin
|
||||
* supplied to the constructor. Returns the equivalent number of samples,
|
||||
* taking tempo changes into account.
|
||||
*/
|
||||
samplecnt_t
|
||||
BeatsSamplesConverter::to (Temporal::Beats beats) const
|
||||
{
|
||||
if (beats < Temporal::Beats()) {
|
||||
std::cerr << "negative beats passed to BFC: " << beats << std::endl;
|
||||
PBD::stacktrace (std::cerr, 30);
|
||||
return 0;
|
||||
}
|
||||
return _tempo_map.sample_quarters_delta_as_samples (_origin, beats) - _origin;
|
||||
}
|
||||
|
||||
/** Takes a positive duration in superclocks and considers it as a distance from the origin
|
||||
* supplied to the constructor. Returns the equivalent number of quarter-note beats,
|
||||
* taking tempo changes into account.
|
||||
*
|
||||
* Distance must be positive because we assume we are walking forward from our origin.
|
||||
*/
|
||||
Temporal::Beats
|
||||
BeatsSamplesConverter::from (samplecnt_t distance) const
|
||||
{
|
||||
return _tempo_map.sample_delta_as_quarters (_origin, distance);
|
||||
}
|
||||
@@ -44,7 +44,6 @@
|
||||
#include "ardour/audiorom.h"
|
||||
#include "ardour/buffer_set.h"
|
||||
#include "ardour/bundle.h"
|
||||
#include "ardour/beats_samples_converter.h"
|
||||
#include "ardour/chan_mapping.h"
|
||||
#include "ardour/convolver.h"
|
||||
#include "ardour/dB.h"
|
||||
|
||||
@@ -28,7 +28,6 @@
|
||||
#include "evoral/EventList.h"
|
||||
#include "evoral/Control.h"
|
||||
|
||||
#include "ardour/beats_samples_converter.h"
|
||||
#include "ardour/debug.h"
|
||||
#include "ardour/midi_model.h"
|
||||
#include "ardour/midi_playlist.h"
|
||||
|
||||
@@ -41,7 +41,6 @@
|
||||
|
||||
#include "ardour/amp.h"
|
||||
#include "ardour/beatbox.h"
|
||||
#include "ardour/beats_samples_converter.h"
|
||||
#include "ardour/buffer_set.h"
|
||||
#include "ardour/debug.h"
|
||||
#include "ardour/delivery.h"
|
||||
|
||||
Reference in New Issue
Block a user