25 #define isinf_local(val) !((bool)_finite((double)val))
26 #define isnan_local(val) (bool)_isnan((double)val)
28 #define isinf_local std::isinf
29 #define isnan_local std::isnan
38 #include "ardour/debug.h"
52 #include "ardour/utils.h"
69 , _immediate_events(1024)
70 , _step_edit_ring_buffer(64)
72 , _step_editing (false)
73 , _input_active (true)
154 if ((prop = node.
property (
X_(
"note-mode"))) != 0) {
167 if ((prop = node.
property (
"input-active")) != 0) {
174 if ((prop = node.
property (
"playback-channel-mode")) != 0) {
177 if ((prop = node.
property (
"capture-channel-mode")) != 0) {
180 if ((prop = node.
property (
"channel-mode")) != 0) {
183 capture_channel_mode = playback_channel_mode;
186 unsigned int playback_channel_mask = 0xffff;
187 unsigned int capture_channel_mask = 0xffff;
189 if ((prop = node.
property (
"playback-channel-mask")) != 0) {
190 sscanf (prop->
value().c_str(),
"0x%x", &playback_channel_mask);
192 if ((prop = node.
property (
"capture-channel-mask")) != 0) {
193 sscanf (prop->
value().c_str(),
"0x%x", &capture_channel_mask);
195 if ((prop = node.
property (
"channel-mask")) != 0) {
196 sscanf (prop->
value().c_str(),
"0x%x", &playback_channel_mask);
197 capture_channel_mask = playback_channel_mask;
225 freeze_node =
new XMLNode (
X_(
"freeze-info"));
231 (*i)->id.print (buf,
sizeof(buf));
279 if ((prop = fnode->
property (
X_(
"playlist"))) != 0) {
290 if ((prop = fnode->
property (
X_(
"state"))) != 0) {
297 for (citer = clist.begin(); citer != clist.end(); ++citer) {
298 if ((*citer)->name() !=
X_(
"processor")) {
302 if ((prop = (*citer)->property (
X_(
"id"))) == 0) {
340 Glib::Threads::RWLock::ReaderLock lm (
_processor_lock, Glib::Threads::TRY_LOCK);
377 dret = diskstream->
process (bufs, transport_frame, 0, playback_distance,
false);
378 need_butler = diskstream->
commit (playback_distance);
390 _meter->run (bufs, start_frame, end_frame, nframes,
true);
397 need_butler = diskstream->
commit (playback_distance);
437 need_butler = diskstream->
commit (playback_distance);
445 int ret =
Track::no_roll (nframes, start_frame, end_frame, state_changing);
457 Glib::Threads::RWLock::ReaderLock lm (
_processor_lock, Glib::Threads::TRY_LOCK);
464 (*i)->realtime_locate ();
473 Glib::Threads::RWLock::ReaderLock lm (
_processor_lock, Glib::Threads::TRY_LOCK);
480 (*i)->realtime_handle_transport_stopped ();
512 if ((tcontrol = boost::dynamic_pointer_cast<MidiTrack::MidiControl>(c->second)) &&
527 Buffer& b (p->get_buffer (nframes));
579 bool include_endpoint,
617 bool include_endpoint)
619 vector<boost::shared_ptr<Source> > srcs;
620 return _session.
write_one_track (*
this, start, end,
false, srcs, itt, endpoint, include_endpoint,
false,
false);
626 std::cerr <<
"MIDI freeze currently unsupported" << std::endl;
654 for (uint8_t channel = 0; channel <= 0xF; channel++) {
670 cerr <<
"WARNING: Ignoring illegal immediate MIDI event" << endl;
680 switch (param.
type()) {
703 cerr <<
"MIDIControl value is infinity" << endl;
705 cerr <<
"MIDIControl value is NaN" << endl;
706 }
else if (val < desc.
lower) {
707 cerr <<
"MIDIControl value is < " << desc.
lower << endl;
708 }
else if (val > desc.
upper) {
709 cerr <<
"MIDIControl value is > " << desc.
upper << endl;
718 assert(val <= desc.
upper);
719 if ( !
_list || ! automation_playback()) {
721 uint8_t ev[3] = { parameter.
channel(), uint8_t (val), 0 };
722 switch(parameter.
type()) {
725 ev[1] = parameter.
id();
743 ev[1] = 0x7F & int(val);
744 ev[2] = 0x7F & (int(val) >> 7);
750 _route->write_immediate_event(size, ev);
894 for (uint8_t channel = 0; channel <= 0xF; channel++) {
896 if ((1<<channel) & mask) {
int roll(pframes_t nframes, framepos_t start_frame, framepos_t end_frame, int declick, bool &need_butler)
void set_record_enabled(bool yn, void *src)
ARDOUR::Session & _session
boost::shared_ptr< Diskstream > create_diskstream()
float lower
Minimum value (in Hz, for frequencies)
MidiBuffer & get_midi(size_t i)
void set_monitoring(MonitorChoice)
boost::shared_ptr< Region > write_one_track(Track &, framepos_t start, framepos_t end, bool overwrite, std::vector< boost::shared_ptr< Source > > &, InterThreadInfo &wot, boost::shared_ptr< Processor > endpoint, bool include_endpoint, bool for_export, bool for_freeze)
void write_out_of_band_data(BufferSet &bufs, framepos_t start_frame, framepos_t end_frame, framecnt_t nframes)
FreezeRecord _freeze_record
const std::string & value() const
framecnt_t read(Evoral::EventSink< framepos_t > &buf, framepos_t start, framecnt_t cnt, uint32_t chan_n=0, MidiChannelFilter *filter=NULL)
PBD::Signal0< void > DiskstreamChanged
virtual int set_state(const XMLNode &, int version)
#define MIDI_CMD_CHANNEL_PRESSURE
void flush_buffers(framecnt_t nframes)
static bool midi_event_is_valid(const uint8_t *buffer, size_t len)
PBD::Signal0< void > FreezeChange
int process(BufferSet &, framepos_t transport_frame, pframes_t nframes, framecnt_t &, bool need_diskstream)
shared_ptr< T > dynamic_pointer_cast(shared_ptr< U > const &r)
int set_state(const XMLNode &, int version)
boost::shared_ptr< MidiDiskstream > midi_diskstream() const
int no_roll(pframes_t nframes, framepos_t start_frame, framepos_t end_frame, bool state_changing)
bool commit(framecnt_t nframes)
#define MIDI_CMD_PGM_CHANGE
static const MutePoint AllPoints
uint16_t get_channel_mask() const
LIBARDOUR_API uint64_t MidiIO
virtual void set_monitoring(MonitorChoice)
boost::shared_ptr< Control > control(const Parameter &id, bool create_if_missing=false)
boost::shared_ptr< MidiBuffer > get_gui_feed_buffer() const
XMLNode * add_child_copy(const XMLNode &)
void non_realtime_locate(framepos_t)
const XMLNodeList & children(const std::string &str=std::string()) const
virtual void set_parameter_automation_state(Evoral::Parameter param, AutoState)
ProcessorList _processors
uint32_t write(Time time, Evoral::EventType type, uint32_t size, const uint8_t *buf)
boost::shared_ptr< Region > bounce(InterThreadInfo &)
uint16_t get_playback_channel_mask() const
RecordState record_status() const
LIBARDOUR_API PBD::PropertyDescriptor< framepos_t > start
virtual int no_roll(pframes_t nframes, framepos_t start_frame, framepos_t end_frame, bool state_changing)
virtual void set_parameter_automation_state(Evoral::Parameter param, AutoState)
void set_record_enabled(bool yn, void *src)
MidiChannelFilter _capture_filter
void set_capture_channel_mode(ChannelMode mode, uint16_t mask)
void set_diskstream(boost::shared_ptr< Diskstream >)
void realtime_handle_transport_stopped()
PBD::ScopedConnection _diskstream_data_recorded_connection
void set_playback_channel_mask(uint16_t mask)
boost::shared_ptr< Evoral::Control > control(const Evoral::Parameter &id, bool create=false)
static framecnt_t port_offset()
boost::shared_ptr< Playlist > playlist
boost::shared_ptr< PeakMeter > _meter
boost::shared_ptr< Region > top_unmuted_region_at(framepos_t frame)
#define MIDI_CTL_RESET_CONTROLLERS
std::list< XMLNode * > XMLNodeList
PBD::Signal1< void, boost::weak_ptr< MidiSource > > DataRecorded
Glib::Threads::Mutex _control_lock
PBD::Signal0< void > StateReady
void flush_playback(framepos_t, framepos_t)
PBD::Signal1< void, bool > StepEditStatusChange
MidiRingBuffer< framepos_t > _step_edit_ring_buffer
Evoral::ParameterDescriptor descriptor(const Evoral::Parameter ¶m) const
uint16_t get_capture_channel_mask() const
Evoral::Parameter midi_parameter(const uint8_t *buf, const uint32_t len)
void set_capture_channel_mask(uint16_t mask)
void set_note_mode(NoteMode m)
XMLProperty * property(const char *)
PBD::Signal0< void > InputActiveChanged
void set_note_mode(NoteMode m)
boost::shared_ptr< IO > _output
#define string_2_enum(str, e)
float upper
Maximum value (in Hz, for frequencies)
void set_input_active(bool yn)
void set_input_active(bool)
enum ARDOUR::IOChange::Type type
MidiRingBuffer< framepos_t > _immediate_events
std::vector< FreezeRecordProcessorInfo * > processor_info
void set_playback_channel_mode(ChannelMode mode, uint16_t mask)
virtual std::string describe_parameter(Evoral::Parameter param)
size_t read(MidiBuffer &dst, framepos_t start, framepos_t end, framecnt_t offset=0, bool stop_on_overflow_in_destination=false)
bool string_is_affirmative(const std::string &str)
void set_state_part_two()
int internal_playback_seek(framecnt_t)
boost::shared_ptr< Delivery > main_outs() const
StateOfTheState state_of_the_state() const
framepos_t transport_frame() const
std::string describe_parameter(Evoral::Parameter param)
boost::shared_ptr< Region > bounce_range(framepos_t start, framepos_t end, InterThreadInfo &iti, boost::shared_ptr< Processor > endpoint, bool include_endpoint)
frameoffset_t calculate_playback_distance(pframes_t nframes)
ChanCount n_outputs() const
boost::shared_ptr< Playlist > playlist()
void freeze_me(InterThreadInfo &)
bool record_enabled() const
void update_controls(const BufferSet &bufs)
#define DEBUG_TRACE(bits, str)
MonitorChoice _monitoring
virtual boost::shared_ptr< Diskstream > diskstream_factory(XMLNode const &)
static EventTypeMap & instance()
LIBARDOUR_API XMLNode * find_named_node(const XMLNode &node, std::string name)
void filter(BufferSet &bufs)
void set_value(double val)
void set_step_editing(bool yn)
void map_input_active(bool)
const Parameter & parameter() const
framepos_t position() const
bool write_immediate_event(size_t size, const uint8_t *buf)
XMLProperty * add_property(const char *name, const std::string &value)
void diskstream_data_recorded(boost::weak_ptr< MidiSource >)
BufferSet & get_route_buffers(ChanCount count=ChanCount::ZERO, bool silence=true)
boost::shared_ptr< IO > _input
bool transport_stopped() const
MonitorState monitoring_state() const
boost::shared_ptr< SMFSource > write_source(uint32_t n=0)
void add_child_nocopy(XMLNode &)
int can_internal_playback_seek(framecnt_t)
MonitorState monitoring_state() const
bool set_channel_mask(uint16_t mask)
pframes_t get_block_size() const
framepos_t current_end_frame() const
XMLNode & state(bool full)
PBD::Signal1< void, boost::weak_ptr< MidiSource > > DataRecorded
framepos_t current_start_frame() const
boost::shared_ptr< ControlList > list()
const ChanCount & count() const
ChannelMode get_capture_channel_mode() const
framecnt_t check_initial_delay(framecnt_t nframes, framepos_t &)
bool input_active() const
Pass through all channel information unmodified.
void non_realtime_locate(framepos_t)
boost::shared_ptr< SessionPlaylists > playlists
virtual void process_output_buffers(BufferSet &bufs, framepos_t start_frame, framepos_t end_frame, pframes_t nframes, int declick, bool gain_automation_ok)
boost::shared_ptr< MuteMaster > _mute_master
int export_stuff(BufferSet &bufs, framepos_t start_frame, framecnt_t end_frame, boost::shared_ptr< Processor > endpoint, bool include_endpoint, bool for_export, bool for_freeze)
InstrumentInfo & instrument_info()
XMLNode & state(bool full)
Glib::Threads::RWLock _processor_lock
const uint8_t * buffer() const
ChannelMode get_playback_channel_mode() const
MidiChannelFilter _playback_filter
boost::shared_ptr< Diskstream > _diskstream
void track_input_active(IOChange, void *)
AutomationType midi_parameter_type(uint8_t status)
virtual void set_diskstream(boost::shared_ptr< Diskstream >)
#define MIDI_CTL_ALL_NOTES_OFF
XMLNodeList::const_iterator XMLNodeConstIterator
void fill_buffers_with_input(BufferSet &bufs, boost::shared_ptr< IO > io, pframes_t nframes)
boost::shared_ptr< Playlist > playlist()
ChanCount n_process_buffers()
void push_midi_input_to_step_edit_ringbuffer(framecnt_t nframes)
bool input_active() const
boost::shared_ptr< MidiPlaylist > midi_playlist()
bool set_channel_mode(ChannelMode mode, uint16_t mask)
std::string string_compose(const std::string &fmt, const T1 &o1)