are large.
*/
- if (beat_spacing < 25.0) {
+ if (beat_spacing < 15.0) {
break;
}
}
if (_trackview.session().transport_rolling()) {
- cerr << "\tSHOW: rolling\n";
-
if (!rec_active &&
_trackview.session().record_status() == Session::Recording &&
_trackview.get_diskstream()->record_enabled()) {
MidiRegion::SourceList sources;
- // FIXME
MidiDiskstream* mds = dynamic_cast<MidiDiskstream*>(_trackview.get_diskstream());
assert(mds);
sources.push_back((Source*)mds->write_source());
- // FIXME
rec_data_ready_connections.push_back (mds->write_source()->ViewDataRangeReady.connect (bind (mem_fun (*this, &MidiStreamView::rec_data_range_ready), mds->write_source())));
// handle multi
rec_updating = true;
rec_active = true;
- // Show, damn you!
- rec_rect->show();
- rec_rect->raise_to_top();
-
} else if (rec_active &&
(_trackview.session().record_status() != Session::Recording ||
!_trackview.get_diskstream()->record_enabled())) {
- cerr << "NO SHOW 1\n";
-
screen_update_connection.disconnect();
rec_active = false;
rec_updating = false;
continue;
}
- // FIXME
+ // FIXME?
MidiRegion * region = dynamic_cast<MidiRegion*>(*iter);
assert(region);
virtual XMLNode& get_state(void) = 0;
virtual int set_state(const XMLNode& node) = 0;
- // FIXME: makes sense for all diskstream types?
virtual void monitor_input (bool) {}
jack_nframes_t capture_offset() const { return _capture_offset; }
int do_refill_with_alloc();
- int read (RawMidi* buf, jack_nframes_t& start, jack_nframes_t cnt, bool reversed);
+ int read (MidiBuffer& dst, jack_nframes_t& start, jack_nframes_t cnt, bool reversed);
void finish_capture (bool rec_monitors_input);
void transport_stopped (struct tm&, time_t, bool abort);
class Region;
class MidiRegion;
class Source;
+class MidiBuffer;
class MidiPlaylist : public ARDOUR::Playlist
{
MidiPlaylist (const MidiPlaylist&, jack_nframes_t start, jack_nframes_t cnt,
string name, bool hidden = false);
- jack_nframes_t read (RawMidi *dst, RawMidi *mixdown,
+ jack_nframes_t read (MidiBuffer& buf,
jack_nframes_t start, jack_nframes_t cnt, uint32_t chan_n=0);
int set_state (const XMLNode&);
class Session;
class MidiFilter;
class MidiSource;
+class MidiBuffer;
class MidiRegion : public Region
{
MidiSource& midi_source (uint32_t n=0) const;
- jack_nframes_t read_at (RawMidi* out, RawMidi* mix,
+ jack_nframes_t read_at (MidiBuffer& out,
jack_nframes_t position,
jack_nframes_t cnt,
uint32_t chan_n = 0,
jack_nframes_t read_frames = 0,
jack_nframes_t skip_frames = 0) const;
- jack_nframes_t master_read_at (RawMidi* buf, RawMidi* mix,
+ jack_nframes_t master_read_at (MidiBuffer& buf,
jack_nframes_t position,
jack_nframes_t cnt,
uint32_t chan_n=0) const;
StateManager::State* state_factory (std::string why) const;
Change restore_state (StateManager::State&);
- jack_nframes_t _read_at (const SourceList&, RawMidi *buf,
+ jack_nframes_t _read_at (const SourceList&, MidiBuffer& buf,
jack_nframes_t position,
jack_nframes_t cnt,
uint32_t chan_n = 0,
namespace ARDOUR {
-/** Source for raw MIDI data */
+class MidiBuffer;
+
+/** Source for MIDI data */
class MidiSource : public Source
{
public:
MidiSource (const XMLNode&);
virtual ~MidiSource ();
- virtual jack_nframes_t read (RawMidi *dst, jack_nframes_t start, jack_nframes_t cnt) const;
- virtual jack_nframes_t write (RawMidi *src, jack_nframes_t cnt);
+ virtual jack_nframes_t read (MidiBuffer& dst, jack_nframes_t start, jack_nframes_t cnt) const;
+ virtual jack_nframes_t write (MidiBuffer& src, jack_nframes_t cnt);
virtual void mark_for_remove() = 0;
virtual void mark_streaming_write_completed () {}
int set_state (const XMLNode&);
protected:
- virtual jack_nframes_t read_unlocked (RawMidi* dst, jack_nframes_t start, jack_nframes_t cn) const = 0;
- virtual jack_nframes_t write_unlocked (RawMidi* dst, jack_nframes_t cnt) = 0;
+ virtual jack_nframes_t read_unlocked (MidiBuffer& dst, jack_nframes_t start, jack_nframes_t cnt) const = 0;
+ virtual jack_nframes_t write_unlocked (MidiBuffer& dst, jack_nframes_t cnt) = 0;
mutable Glib::Mutex _lock;
string _captured_for;
namespace ARDOUR {
+class MidiBuffer;
+
/** Standard Midi File (Type 0) Source */
class SMFSource : public MidiSource {
public:
int init (string idstr, bool must_exist);
- jack_nframes_t read_unlocked (RawMidi* dst, jack_nframes_t start, jack_nframes_t cn) const;
- jack_nframes_t write_unlocked (RawMidi* dst, jack_nframes_t cnt);
+ jack_nframes_t read_unlocked (MidiBuffer& dst, jack_nframes_t start, jack_nframes_t cn) const;
+ jack_nframes_t write_unlocked (MidiBuffer& dst, jack_nframes_t cnt);
bool find (std::string path, bool must_exist, bool& is_new);
bool removable() const;
// FIXME: reading from a MIDI port is different, can't just memcpy
//memcpy (_current_capture_buffer, _io->input(0)->get_buffer (rec_nframes) + offset + rec_offset, sizeof (RawMidi) * rec_nframes);
assert(_source_port);
- for (size_t i=0; i < _source_port->size(); ++i) {
- cerr << "DISKSTREAM GOT EVENT " << i << "!!\n";
+
+ /*for (size_t i=0; i < _source_port->size(); ++i) {
+ cerr << "DISKSTREAM GOT EVENT(1) " << i << "!!\n";
}
- //if (_source_port->size() == 0)
- // cerr << "No events :/ (1)\n";
+ if (_source_port->size() == 0)
+ cerr << "No events :/ (1)\n";
+ */
} else {
// FIXME (see above)
//RawMidi* buf = _io->input (0)->get_buffer (nframes) + offset;
assert(_source_port);
+
+ /*
for (size_t i=0; i < _source_port->size(); ++i) {
- cerr << "DISKSTREAM GOT EVENT " << i << "!!\n";
+ cerr << "DISKSTREAM GOT EVENT(2) " << i << "!!\n";
}
- //if (_source_port->size() == 0)
- // cerr << "No events :/ (2)\n";
+ if (_source_port->size() == 0)
+ cerr << "No events :/ (2)\n";
+ */
+
RawMidi* buf = NULL; // FIXME FIXME FIXME (make it compile)
assert(false);
jack_nframes_t first = _capture_vector.len[0];
if (rec_nframes) {
// FIXME: filthy hack to fool the GUI into thinking we're doing something
- if (_write_source)
- _write_source->ViewDataRangeReady (transport_frame, rec_nframes); /* EMIT SIGNAL */
+ //if (_write_source)
+ // _write_source->ViewDataRangeReady (transport_frame, rec_nframes); /* EMIT SIGNAL */
/* data will be written to disk */
}
int
-MidiDiskstream::read (RawMidi* buf, jack_nframes_t& start, jack_nframes_t cnt, bool reversed)
+MidiDiskstream::read (MidiBuffer& dst, jack_nframes_t& start, jack_nframes_t cnt, bool reversed)
{
return 0;
}
/** FIXME: semantics of return value? */
jack_nframes_t
-MidiPlaylist::read (RawMidi *buf, RawMidi *mixdown_buffer, jack_nframes_t start,
+MidiPlaylist::read (MidiBuffer& buf, jack_nframes_t start,
jack_nframes_t cnt, unsigned chan_n)
{
/* this function is never called from a realtime thread, so
sort(regs.begin(), regs.end(), layer_cmp);
for (vector<MidiRegion*>::iterator i = regs.begin(); i != regs.end(); ++i) {
- (*i)->read_at (buf, mixdown_buffer, start, cnt, chan_n, read_frames, skip_frames);
+ (*i)->read_at (buf, start, cnt, chan_n, read_frames, skip_frames);
ret += (*i)->read_data_count();
}
if (announce) {
CheckNewRegion (this); /* EMIT SIGNAL */
}
+
+ assert(_name.find("/") == string::npos);
}
/* Basic MidiRegion constructor (one channel) */
if (announce) {
CheckNewRegion (this); /* EMIT SIGNAL */
}
+
+ assert(_name.find("/") == string::npos);
}
/* Basic MidiRegion constructor (many channels) */
if (announce) {
CheckNewRegion (this); /* EMIT SIGNAL */
}
+
+ assert(_name.find("/") == string::npos);
}
if (announce) {
CheckNewRegion (this); /* EMIT SIGNAL */
}
+
+ assert(_name.find("/") == string::npos);
}
MidiRegion::MidiRegion (const MidiRegion &other)
save_state ("initial state");
/* NOTE: no CheckNewRegion signal emitted here. This is the copy constructor */
+ assert(_name.find("/") == string::npos);
}
MidiRegion::MidiRegion (MidiSource& src, const XMLNode& node)
save_state ("initial state");
+ assert(_name.find("/") == string::npos);
assert(_type == DataType::MIDI);
CheckNewRegion (this); /* EMIT SIGNAL */
save_state ("initial state");
+ assert(_name.find("/") == string::npos);
assert(_type == DataType::MIDI);
CheckNewRegion (this); /* EMIT SIGNAL */
}
jack_nframes_t
-MidiRegion::read_at (RawMidi *out, RawMidi* mix_buf, jack_nframes_t position,
+MidiRegion::read_at (MidiBuffer& out, jack_nframes_t position,
jack_nframes_t cnt,
uint32_t chan_n, jack_nframes_t read_frames, jack_nframes_t skip_frames) const
{
}
jack_nframes_t
-MidiRegion::master_read_at (RawMidi *out, RawMidi* mix_buf, jack_nframes_t position,
+MidiRegion::master_read_at (MidiBuffer& out, jack_nframes_t position,
jack_nframes_t cnt, uint32_t chan_n) const
{
return _read_at (_master_sources, out, position, cnt, chan_n, 0, 0);
}
jack_nframes_t
-MidiRegion::_read_at (const SourceList& srcs, RawMidi *buf,
+MidiRegion::_read_at (const SourceList& srcs, MidiBuffer& buf,
jack_nframes_t position, jack_nframes_t cnt,
uint32_t chan_n, jack_nframes_t read_frames, jack_nframes_t skip_frames) const
{
}
jack_nframes_t
-MidiSource::read (RawMidi* dst, jack_nframes_t start, jack_nframes_t cnt) const
+MidiSource::read (MidiBuffer& dst, jack_nframes_t start, jack_nframes_t cnt) const
{
Glib::Mutex::Lock lm (_lock);
return read_unlocked (dst, start, cnt);
}
jack_nframes_t
-MidiSource::write (RawMidi* dst, jack_nframes_t cnt)
+MidiSource::write (MidiBuffer& dst, jack_nframes_t cnt)
{
Glib::Mutex::Lock lm (_lock);
return write_unlocked (dst, cnt);
return 0;
}
-/* AudioRegion management */
+/* Region management */
string
Session::new_region_name (string old)
char buf[16];
string subbase;
+ assert(base.find("/") == string::npos);
+
if (base == "") {
Glib::Mutex::Lock lm (region_lock);
*/
SMFSource::SMFSource (std::string path, Flag flags)
- : MidiSource (path), _flags (flags)
+ : MidiSource (region_name_from_path(path)), _flags (flags)
{
/* constructor used for new internal-to-session files. file cannot exist */
throw failed_constructor ();
}
+ assert(_name.find("/") == string::npos);
+
SourceCreated (this); /* EMIT SIGNAL */
}
throw failed_constructor ();
}
+ assert(_name.find("/") == string::npos);
+
SourceCreated (this); /* EMIT SIGNAL */
}
int
SMFSource::init (string pathstr, bool must_exist)
{
- bool is_new = false;
+ //bool is_new = false;
- _length = 1024; // FIXME FIXME FIXME: force save
-
/*
if (!find (pathstr, must_exist, is_new)) {
cerr << "cannot find " << pathstr << " with me = " << must_exist << endl;
}
*/
- // Yeah, we sound it. Swear.
+ // Yeah, we found it. Swear.
+ assert(_name.find("/") == string::npos);
return 0;
}
}
jack_nframes_t
-SMFSource::read_unlocked (RawMidi* dst, jack_nframes_t start, jack_nframes_t cnt) const
+SMFSource::read_unlocked (MidiBuffer& dst, jack_nframes_t start, jack_nframes_t cnt) const
{
- return 0;
+ dst.clear();
+ return cnt;
}
jack_nframes_t
-SMFSource::write_unlocked (RawMidi* dst, jack_nframes_t cnt)
+SMFSource::write_unlocked (MidiBuffer& src, jack_nframes_t cnt)
{
- return 0;
+ ViewDataRangeReady (_length, cnt); /* EMIT SIGNAL */
+ _length += cnt;
+ return cnt;
}
XMLNode&
}
+ assert(_name.find("/") == string::npos);
+
return 0;
}
Source::Source (string name, DataType type)
: _type(type)
{
+ assert(_name.find("/") == string::npos);
+
_name = name;
_use_cnt = 0;
_timestamp = 0;
if (set_state (node) || _type == DataType::NIL) {
throw failed_constructor();
}
+ assert(_name.find("/") == string::npos);
}
Source::~Source ()
if ((prop = node.property ("timestamp")) != 0) {
sscanf (prop->value().c_str(), "%ld", &_timestamp);
}
+ assert(_name.find("/") == string::npos);
return 0;
}
{
string::size_type pos;
+ /* remove any leading path */
+
+ if ((pos = path.find_last_of ('/')) != string::npos) {
+ path = path.substr(pos+1);
+ }
+
/* remove filename suffixes etc. */
if ((pos = path.find_last_of ('.')) != string::npos) {