diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2009-08-27 03:09:30 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2009-08-27 03:09:30 +0000 |
commit | 3845af6ce92ef15637ffb09410f442e7b4a104c3 (patch) | |
tree | 218a29f23c83c3ac57c857d3b1f599f1e6d97a14 /libs/ardour/ardour | |
parent | c6be9b688802198e04a07dc902c49d1d6b66340e (diff) |
lots of MIDI editing stuff. to be explained on the website when its done
git-svn-id: svn://localhost/ardour2/branches/3.0@5596 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/ardour')
-rw-r--r-- | libs/ardour/ardour/midi_model.h | 3 | ||||
-rw-r--r-- | libs/ardour/ardour/midi_operator.h | 42 | ||||
-rw-r--r-- | libs/ardour/ardour/midi_source.h | 4 | ||||
-rw-r--r-- | libs/ardour/ardour/midi_track.h | 3 | ||||
-rw-r--r-- | libs/ardour/ardour/quantize.h | 28 | ||||
-rw-r--r-- | libs/ardour/ardour/route.h | 3 | ||||
-rw-r--r-- | libs/ardour/ardour/smf_source.h | 2 | ||||
-rw-r--r-- | libs/ardour/ardour/tempo.h | 2 | ||||
-rw-r--r-- | libs/ardour/ardour/types.h | 6 |
9 files changed, 80 insertions, 13 deletions
diff --git a/libs/ardour/ardour/midi_model.h b/libs/ardour/ardour/midi_model.h index 3feda1a22c..967372fa9a 100644 --- a/libs/ardour/ardour/midi_model.h +++ b/libs/ardour/ardour/midi_model.h @@ -47,7 +47,7 @@ class MidiSource; * Because of this MIDI controllers and automatable controllers/widgets/etc * are easily interchangeable. */ -class MidiModel : public AutomatableSequence<double> { +class MidiModel : public AutomatableSequence<Evoral::MusicalTime> { public: typedef double TimeType; @@ -91,6 +91,7 @@ public: MidiModel::DeltaCommand* new_delta_command(const std::string name="midi edit"); void apply_command(Session& session, Command* cmd); + void apply_command_as_subcommand(Session& session, Command* cmd); bool write_to(boost::shared_ptr<MidiSource> source); diff --git a/libs/ardour/ardour/midi_operator.h b/libs/ardour/ardour/midi_operator.h new file mode 100644 index 0000000000..e3ed6aabfd --- /dev/null +++ b/libs/ardour/ardour/midi_operator.h @@ -0,0 +1,42 @@ +/* + Copyright (C) 2009 Paul Davis + + 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., 675 Mass Ave, Cambridge, MA 02139, USA. + +*/ + +#ifndef __libardour_midi_operator_h__ +#define __libardour_midi_operator_h__ + +#include <vector> +#include <string> + +#include "evoral/types.hpp" +#include "evoral/Sequence.hpp" + +namespace ARDOUR { + +class MidiOperator { + public: + MidiOperator() {} + virtual ~MidiOperator() {} + + virtual int operator() (std::vector<Evoral::Sequence<Evoral::MusicalTime>::Notes>&) = 0; + virtual std::string name() const = 0; +}; + +} /* namespace */ + +#endif /* __libardour_midi_operator_h__ */ diff --git a/libs/ardour/ardour/midi_source.h b/libs/ardour/ardour/midi_source.h index cf49e59458..a479b4a8a8 100644 --- a/libs/ardour/ardour/midi_source.h +++ b/libs/ardour/ardour/midi_source.h @@ -65,7 +65,7 @@ class MidiSource : virtual public Source sframes_t source_start, nframes_t cnt); - virtual void append_event_unlocked_beats(const Evoral::Event<double>& ev) = 0; + virtual void append_event_unlocked_beats(const Evoral::Event<Evoral::MusicalTime>& ev) = 0; virtual void append_event_unlocked_frames(const Evoral::Event<nframes_t>& ev, sframes_t source_start) = 0; @@ -128,7 +128,7 @@ class MidiSource : virtual public Source boost::shared_ptr<MidiModel> _model; bool _writing; - mutable Evoral::Sequence<double>::const_iterator _model_iter; + mutable Evoral::Sequence<Evoral::MusicalTime>::const_iterator _model_iter; mutable double _length_beats; mutable sframes_t _last_read_end; diff --git a/libs/ardour/ardour/midi_track.h b/libs/ardour/ardour/midi_track.h index e7ffd40d67..5c5ef5c26c 100644 --- a/libs/ardour/ardour/midi_track.h +++ b/libs/ardour/ardour/midi_track.h @@ -84,7 +84,8 @@ protected: int _set_state (const XMLNode&, bool call_base); private: - void write_controller_messages(MidiBuffer& buf, sframes_t start_frame, sframes_t end_frame, nframes_t nframes); + void write_out_of_band_data (BufferSet& bufs, sframes_t start_frame, sframes_t end_frame, + nframes_t nframes); int set_diskstream (boost::shared_ptr<MidiDiskstream> ds); void use_new_diskstream (); diff --git a/libs/ardour/ardour/quantize.h b/libs/ardour/ardour/quantize.h index f7307c194c..57e5467294 100644 --- a/libs/ardour/ardour/quantize.h +++ b/libs/ardour/ardour/quantize.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2007 Paul Davis + Copyright (C) 2007-2009 Paul Davis Author: Dave Robillard This program is free software; you can redistribute it and/or modify @@ -21,19 +21,33 @@ #ifndef __ardour_quantize_h__ #define __ardour_quantize_h__ -#include "ardour/filter.h" +#include "ardour/types.h" +#include "ardour/midi_operator.h" namespace ARDOUR { -class Quantize : public Filter { +class Session; + +class Quantize : public MidiOperator { public: - Quantize (ARDOUR::Session&, double q); - ~Quantize (); + Quantize (ARDOUR::Session&, QuantizeType type, + bool snap_start, bool snap_end, + double start_grid, double end_grid, + float strength, float swing, float threshold); + ~Quantize (); - int run (boost::shared_ptr<ARDOUR::Region>); + int operator() (std::vector<Evoral::Sequence<Evoral::MusicalTime>::Notes>&); + std::string name() const { return std::string ("quantize"); } private: - double _q; + ARDOUR::Session& session; + bool _snap_start; + bool _snap_end; + double _start_grid; + double _end_grid; + float _strength; + float _swing; + float _threshold; }; } /* namespace */ diff --git a/libs/ardour/ardour/route.h b/libs/ardour/ardour/route.h index 9195a50060..34bf9e8d9f 100644 --- a/libs/ardour/ardour/route.h +++ b/libs/ardour/ardour/route.h @@ -326,6 +326,9 @@ class Route : public SessionObject, public AutomatableControls void passthru (sframes_t start_frame, sframes_t end_frame, nframes_t nframes, int declick); + virtual void write_out_of_band_data (BufferSet& /* bufs */, sframes_t /* start_frame */, sframes_t /* end_frame */, + nframes_t /* nframes */) {} + virtual void process_output_buffers (BufferSet& bufs, sframes_t start_frame, sframes_t end_frame, nframes_t nframes, bool with_processors, int declick); diff --git a/libs/ardour/ardour/smf_source.h b/libs/ardour/ardour/smf_source.h index dc9cbeee55..73bef5480a 100644 --- a/libs/ardour/ardour/smf_source.h +++ b/libs/ardour/ardour/smf_source.h @@ -51,7 +51,7 @@ public: bool set_name (const std::string& newname) { return (set_source_name(newname, false) == 0); } - void append_event_unlocked_beats (const Evoral::Event<double>& ev); + void append_event_unlocked_beats (const Evoral::Event<Evoral::MusicalTime>& ev); void append_event_unlocked_frames (const Evoral::Event<nframes_t>& ev, sframes_t source_start); void mark_streaming_midi_write_started (NoteMode mode, sframes_t start_time); diff --git a/libs/ardour/ardour/tempo.h b/libs/ardour/ardour/tempo.h index fcda463fe1..843437dab7 100644 --- a/libs/ardour/ardour/tempo.h +++ b/libs/ardour/ardour/tempo.h @@ -204,7 +204,7 @@ class TempoMap : public PBD::StatefulDestructible nframes_t round_to_bar (nframes_t frame, int dir); nframes_t round_to_beat (nframes_t frame, int dir); - nframes_t round_to_beat_subdivision (nframes_t fr, int sub_num); + nframes_t round_to_beat_subdivision (nframes_t fr, int sub_num, int dir); nframes_t round_to_tick (nframes_t frame, int dir); void set_length (nframes_t frames); diff --git a/libs/ardour/ardour/types.h b/libs/ardour/ardour/types.h index 809eb5b2b2..1a30cfd769 100644 --- a/libs/ardour/ardour/types.h +++ b/libs/ardour/ardour/types.h @@ -446,6 +446,12 @@ namespace ARDOUR { Rectified }; + enum QuantizeType { + Plain, + Legato, + Groove + }; + } // namespace ARDOUR std::istream& operator>>(std::istream& o, ARDOUR::SampleFormat& sf); |