ardour
note_fixer.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2015 Paul Davis
3  Author: David Robillard
4 
5  This program is free software; you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation; either version 2 of the License, or
8  (at your option) any later version.
9 
10  This program is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License
16  along with this program; if not, write to the Free Software
17  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 */
19 
20 #ifndef __ardour_note_fixer_h__
21 #define __ardour_note_fixer_h__
22 
23 #include <list>
24 
25 #include <boost/utility.hpp>
26 
27 #include "ardour/midi_model.h"
28 #include "ardour/types.h"
29 #include "evoral/Beats.hpp"
30 #include "evoral/Note.hpp"
31 
32 namespace Evoral { template<typename Time> class EventSink; }
33 
34 namespace ARDOUR {
35 
36 class BeatsFramesConverter;
37 class MidiStateTracker;
38 class TempoMap;
39 
46 class NoteFixer : public boost::noncopyable
47 {
48 public:
50 
51  ~NoteFixer();
52 
54  void clear();
55 
66  void prepare(TempoMap& tempo_map,
67  const MidiModel::NoteDiffCommand* cmd,
69  framepos_t pos,
70  std::set< boost::weak_ptr<Note> >& active_notes);
71 
80  framepos_t pos,
81  MidiStateTracker& tracker);
82 
83 private:
85  typedef std::list<Event*> Events;
86 
88  Event* copy_event(framepos_t time, const Evoral::Event<Evoral::Beats>& ev);
89 
91  bool note_is_active(const BeatsFramesConverter& converter,
93  framepos_t pos);
94 
95  Events _events;
96 };
97 
98 } /* namespace ARDOUR */
99 
100 #endif /* __ardour_note_fixer_h__ */
101 
102 
Evoral::Event< framepos_t > Event
Definition: note_fixer.h:84
void prepare(TempoMap &tempo_map, const MidiModel::NoteDiffCommand *cmd, framepos_t origin, framepos_t pos, std::set< boost::weak_ptr< Note > > &active_notes)
Definition: note_fixer.cc:43
Event * copy_event(framepos_t time, const Evoral::Event< Evoral::Beats > &ev)
Definition: note_fixer.cc:129
#define origin
Evoral::Note< Evoral::Beats > Note
Definition: note_fixer.h:49
LIBARDOUR_API uint64_t TempoMap
Definition: debug.cc:60
bool note_is_active(const BeatsFramesConverter &converter, boost::shared_ptr< Note > note, framepos_t pos)
Definition: note_fixer.cc:135
void emit(Evoral::EventSink< framepos_t > &dst, framepos_t pos, MidiStateTracker &tracker)
Definition: note_fixer.cc:116
Definition: amp.h:29
int64_t framepos_t
Definition: types.h:66
std::list< Event * > Events
Definition: note_fixer.h:85