summaryrefslogtreecommitdiff
path: root/libs/evoral
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2009-07-23 03:01:31 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2009-07-23 03:01:31 +0000
commit38510cb19e217c62a8e1e1664bed13f44c42ef08 (patch)
tree6e4b5f25d7b2703d4c762b8f8e8c9f0370ed711a /libs/evoral
parent3804e3bc497f68d4b68f51794815db3ffe5e7a91 (diff)
install ardour.menus and bindings file (elthariel) ; initial, basic MIDI gain (fader) working
git-svn-id: svn://localhost/ardour2/branches/3.0@5416 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/evoral')
-rw-r--r--libs/evoral/evoral/MIDIEvent.hpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/libs/evoral/evoral/MIDIEvent.hpp b/libs/evoral/evoral/MIDIEvent.hpp
index 12c57a96a0..f7df4980fe 100644
--- a/libs/evoral/evoral/MIDIEvent.hpp
+++ b/libs/evoral/evoral/MIDIEvent.hpp
@@ -19,6 +19,7 @@
#ifndef EVORAL_MIDI_EVENT_HPP
#define EVORAL_MIDI_EVENT_HPP
+#include <cmath>
#include <boost/shared_ptr.hpp>
#include "evoral/Event.hpp"
#include "evoral/midi_events.h"
@@ -68,6 +69,12 @@ struct MIDIEvent : public Event<Time> {
inline bool is_channel_pressure() const { return (type() == MIDI_CMD_CHANNEL_PRESSURE); }
inline uint8_t note() const { return (this->_buf[1]); }
inline uint8_t velocity() const { return (this->_buf[2]); }
+ inline void set_velocity(uint8_t value) { this->_buf[2] = value; }
+ inline void scale_velocity(float factor) {
+ if (factor < 0) factor = 0;
+ this->_buf[2] = (uint8_t) lrintf (this->_buf[2]*factor);
+ if (this->_buf[2] > 127) this->_buf[2] = 127;
+ }
inline uint8_t cc_number() const { return (this->_buf[1]); }
inline void set_cc_number(uint8_t number) { this->_buf[1] = number; }
inline uint8_t cc_value() const { return (this->_buf[2]); }