new skeleton files and mods for the start of PatternSources

This commit is contained in:
Paul Davis 2016-10-27 14:43:09 -03:00
parent 5465f16bc3
commit 97c9a2e95f
6 changed files with 277 additions and 0 deletions

View file

@ -0,0 +1,94 @@
/*
Copyright (C) 2006 Paul Davis
Author: David Robillard
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 __ardour_midi_pattern_source_h__
#define __ardour_midi_pattern_source_h__
#include "ardour/midi_source.h"
#include "ardour/pattern_source.h"
namespace ARDOUR {
/** Source for MIDI patterns */
class LIBARDOUR_API MidiPatternSource : public MidiSource, public PatternSource
{
public:
typedef Evoral::Beats TimeType;
MidiPatternSource (Session& session, std::string const & name);
MidiPatternSource (Session& session, const XMLNode&);
virtual ~MidiPatternSource ();
/* PatternSources are modified using the PatternSource API, not the
MidiSource one, so these are no-ops.
*/
void append_event_beats(const Lock& lock,
const Evoral::Event<Evoral::Beats>& ev) {}
void append_event_frames(const Lock& lock,
const Evoral::Event<framepos_t>& ev,
framepos_t source_start) {}
void mark_streaming_midi_write_started (const Lock& lock, NoteMode mode) {}
void mark_streaming_write_started (const Lock& lock) {}
void mark_streaming_write_completed (const Lock& lock) {}
void mark_write_starting_now (framecnt_t position,
framecnt_t capture_length,
framecnt_t loop_length) {}
void mark_midi_streaming_write_completed (
const Lock& lock,
Evoral::Sequence<Evoral::Beats>::StuckNoteOption stuck_option,
Evoral::Beats when = Evoral::Beats()) {}
bool empty () const;
framecnt_t length (framepos_t pos) const;
void update_length (framecnt_t);
void session_saved() {}
XMLNode& get_state ();
int set_state (const XMLNode&, int version);
bool length_mutable() const { return true; }
void set_length_beats(TimeType l) { _length_beats = l; }
TimeType length_beats() const { return _length_beats; }
virtual void load_model(const Glib::Threads::Mutex::Lock& lock, bool force_reload=false) = 0;
virtual void destroy_model(const Glib::Threads::Mutex::Lock& lock) = 0;
protected:
void flush_midi(const Lock& lock) {}
framecnt_t read_unlocked (const Lock& lock,
Evoral::EventSink<framepos_t>& dst,
framepos_t position,
framepos_t start,
framecnt_t cnt,
Evoral::Range<framepos_t>* loop_range,
MidiStateTracker* tracker,
MidiChannelFilter* filter) const;
framecnt_t write_unlocked (const Lock& lock,
MidiRingBuffer<framepos_t>& source,
framepos_t position,
framecnt_t cnt);
};
}
#endif /* __ardour_midi_source_h__ */

View file

@ -0,0 +1,44 @@
/*
Copyright (C) 2016 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 __ardour_pattern_source_h__
#define __ardour_pattern_source_h__
#include <string>
#include "ardour/source.h"
#include "ardour/data_type.h"
namespace ARDOUR {
class Session;
class LIBARDOUR_API PatternSource : virtual public Source
{
public:
PatternSource (Session&, DataType type, const std::string& name);
PatternSource (Session&, const XMLNode&);
virtual ~PatternSource ();
};
}
#endif /* __ardour_pattern_source_h__ */

View file

@ -50,6 +50,7 @@ class LIBARDOUR_API Source : public SessionObject
Destructive = 0x80,
Empty = 0x100, /* used for MIDI only */
RF64_RIFF = 0x200,
Pattern = 0x400
};
typedef Glib::Threads::Mutex::Lock Lock;
@ -81,6 +82,7 @@ class LIBARDOUR_API Source : public SessionObject
int set_state (const XMLNode&, int version);
bool destructive() const { return (_flags & Destructive); }
bool is_pattern() const { return (_flags & Pattern); }
bool writable () const;
virtual bool set_destructive (bool /*yn*/) { return false; }
virtual bool length_mutable() const { return false; }

View file

@ -0,0 +1,96 @@
/*
Copyright (C) 2016 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.
*/
#include "ardour/midi_pattern_source.h"
#include "pbd/i18n.h"
using namespace std;
using namespace ARDOUR;
using namespace PBD;
MidiPatternSource::MidiPatternSource (Session& s, std::string const & name)
: Source (s, DataType::MIDI, name, Source::Pattern)
, MidiSource (s, name)
, PatternSource (s, DataType::MIDI, name)
{
}
MidiPatternSource::MidiPatternSource (Session& s, const XMLNode& node)
: Source (s, node)
, MidiSource (s, node)
, PatternSource (s, node)
{
// set_state (node Stateful::loading_state_version);
}
MidiPatternSource::~MidiPatternSource ()
{
}
framecnt_t
MidiPatternSource::length (framepos_t) const
{
return max_framepos - 1;
}
bool
MidiPatternSource::empty () const
{
return false;
}
void
MidiPatternSource::update_length (framecnt_t)
{
return;
}
XMLNode&
MidiPatternSource::get_state ()
{
XMLNode* node = new XMLNode ("midi-pattern-source");
return *node;
}
int
MidiPatternSource::set_state (XMLNode const& node, int)
{
return 0;
}
framecnt_t
MidiPatternSource::write_unlocked (Lock const& lock,
MidiRingBuffer<framepos_t>& source,
framepos_t position,
framecnt_t cnt)
{
return 0;
}
framecnt_t
MidiPatternSource::read_unlocked (const Lock& lock,
Evoral::EventSink<framepos_t>& dst,
framepos_t position,
framepos_t start,
framecnt_t cnt,
Evoral::Range<framepos_t>* loop_range,
MidiStateTracker* tracker,
MidiChannelFilter* filter) const
{
return 0;
}

View file

@ -0,0 +1,39 @@
/*
Copyright (C) 2016 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.
*/
#include "ardour/pattern_source.h"
#include "pbd/i18n.h"
using namespace std;
using namespace ARDOUR;
using namespace PBD;
PatternSource::PatternSource (Session& s, DataType type, const std::string& name)
: Source (s, type, name, Source::Pattern)
{
}
PatternSource::PatternSource (Session& s, const XMLNode& node)
: Source (s, node)
{
}
PatternSource::~PatternSource ()
{
}

View file

@ -128,6 +128,7 @@ libardour_sources = [
'midi_diskstream.cc',
'midi_model.cc',
'midi_patch_manager.cc',
'midi_pattern_source.cc',
'midi_playlist.cc',
'midi_playlist_source.cc',
'midi_port.cc',
@ -160,6 +161,7 @@ libardour_sources = [
'panner_manager.cc',
'panner_shell.cc',
'parameter_descriptor.cc',
'pattern_source.cc',
'pcm_utils.cc',
'phase_control.cc',
'playlist.cc',