13
0

give MIDI tracks a (n automatable) velocity control

This commit is contained in:
Paul Davis 2022-12-18 15:40:53 -07:00
parent 25f5b275f4
commit 1d117aa372
8 changed files with 95 additions and 0 deletions

View File

@ -34,6 +34,7 @@ class MidiPlaylist;
class RouteGroup;
class SMFSource;
class Session;
class VelocityControl;
class LIBARDOUR_API MidiTrack : public Track
{
@ -75,6 +76,8 @@ public:
void midi_panic(void);
bool write_immediate_event (Evoral::EventType event_type, size_t size, const uint8_t* buf);
boost::shared_ptr<VelocityControl> velocity_control() const;
/** A control that will send "immediate" events to a MIDI track when twiddled */
struct MidiControl : public AutomationControl {
MidiControl(MidiTrack* route, const Evoral::Parameter& param,
@ -166,6 +169,8 @@ private:
MidiChannelFilter _playback_filter;
MidiChannelFilter _capture_filter;
boost::shared_ptr<VelocityControl> _velocity_control;
void set_state_part_two ();
void set_state_part_three ();

View File

@ -175,6 +175,7 @@ enum AutomationType {
BusSendEnable,
InsertReturnLevel,
MainOutVolume,
MidiVelocityAutomation,
/* used only by Controllable Descriptor to access send parameters */

View File

@ -0,0 +1,44 @@
/*
* Copyright (C) 2022 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.
*/
#ifndef __ardour_velocity_control_h__
#define __ardour_velocity_control_h__
#include <string>
#include <boost/shared_ptr.hpp>
#include "pbd/controllable.h"
#include "evoral/Parameter.h"
#include "ardour/slavable_automation_control.h"
#include "ardour/libardour_visibility.h"
namespace ARDOUR {
class Session;
class LIBARDOUR_API VelocityControl : public SlavableAutomationControl {
public:
VelocityControl (Session& session);
};
} /* namespace */
#endif /* __ardour_velocity_control_h__ */

View File

@ -166,6 +166,7 @@ AutomationList::create_curve_if_necessary()
case FadeInAutomation:
case FadeOutAutomation:
case EnvelopeAutomation:
case MidiVelocityAutomation:
create_curve();
break;
default:

View File

@ -208,6 +208,7 @@ setup_enum_writer ()
REGISTER_ENUM (BusSendEnable);
REGISTER_ENUM (InsertReturnLevel);
REGISTER_ENUM (MainOutVolume);
REGISTER_ENUM (MidiVelocityAutomation);
REGISTER (_AutomationType);
REGISTER_ENUM (Off);

View File

@ -64,6 +64,7 @@
#include "ardour/session_playlists.h"
#include "ardour/types_convert.h"
#include "ardour/utils.h"
#include "ardour/velocity_control.h"
#include "pbd/i18n.h"
@ -108,6 +109,9 @@ MidiTrack::init ()
return -1;
}
_velocity_control.reset (new VelocityControl (_session));
add_control (_velocity_control);
_input->changed.connect_same_thread (*this, boost::bind (&MidiTrack::track_input_active, this, _1, _2));
_disk_writer->set_note_mode (_note_mode);

View File

@ -0,0 +1,38 @@
/*
* Copyright (C) 2022 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 <cmath>
#include "pbd/convert.h"
#include "pbd/strsplit.h"
#include "ardour/velocity_control.h"
#include "ardour/session.h"
#include "pbd/i18n.h"
using namespace ARDOUR;
using namespace std;
VelocityControl::VelocityControl (Session& session)
: SlavableAutomationControl (session, Evoral::Parameter (MidiVelocityAutomation), ParameterDescriptor (Evoral::Parameter (MidiVelocityAutomation)),
boost::shared_ptr<AutomationList> (new AutomationList (Evoral::Parameter (MidiVelocityAutomation), Temporal::BeatTime)),
_("Velocity"))
{
}

View File

@ -278,6 +278,7 @@ libardour_sources = [
'utils.cc',
'vca.cc',
'vca_manager.cc',
'velocity_control.cc',
'video_tools_paths.cc',
'vumeterdsp.cc',
'worker.cc',