mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-12 17:46:34 +01:00
Take commit() out of process() in both types of
diskstream, and call commit() where appropriate. git-svn-id: svn://localhost/ardour2/branches/3.0@10361 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
d47e9247df
commit
5dba72c874
8 changed files with 38 additions and 34 deletions
|
|
@ -151,7 +151,7 @@ class AudioDiskstream : public Diskstream
|
||||||
protected:
|
protected:
|
||||||
friend class AudioTrack;
|
friend class AudioTrack;
|
||||||
|
|
||||||
int process (framepos_t transport_frame, pframes_t nframes, bool& need_butler);
|
int process (framepos_t transport_frame, pframes_t nframes, framecnt_t &);
|
||||||
bool commit (framecnt_t);
|
bool commit (framecnt_t);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
||||||
|
|
@ -182,7 +182,7 @@ class Diskstream : public SessionObject, public PublicDiskstream
|
||||||
protected:
|
protected:
|
||||||
friend class Track;
|
friend class Track;
|
||||||
|
|
||||||
virtual int process (framepos_t transport_frame, pframes_t nframes, bool& need_butler) = 0;
|
virtual int process (framepos_t transport_frame, pframes_t nframes, framecnt_t &) = 0;
|
||||||
virtual bool commit (framecnt_t) = 0;
|
virtual bool commit (framecnt_t) = 0;
|
||||||
|
|
||||||
//private:
|
//private:
|
||||||
|
|
|
||||||
|
|
@ -142,7 +142,7 @@ class MidiDiskstream : public Diskstream
|
||||||
protected:
|
protected:
|
||||||
friend class MidiTrack;
|
friend class MidiTrack;
|
||||||
|
|
||||||
int process (framepos_t transport_frame, pframes_t nframes, bool& need_butler);
|
int process (framepos_t transport_frame, pframes_t nframes, framecnt_t &);
|
||||||
bool commit (framecnt_t nframes);
|
bool commit (framecnt_t nframes);
|
||||||
static framecnt_t midi_readahead;
|
static framecnt_t midi_readahead;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -415,18 +415,17 @@ AudioDiskstream::prepare_record_status(framepos_t capture_start_frame)
|
||||||
* that someone can read playback_distance worth of data from.
|
* that someone can read playback_distance worth of data from.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
AudioDiskstream::process (framepos_t transport_frame, pframes_t nframes, bool& need_butler)
|
AudioDiskstream::process (framepos_t transport_frame, pframes_t nframes, framecnt_t& playback_distance)
|
||||||
{
|
{
|
||||||
uint32_t n;
|
uint32_t n;
|
||||||
boost::shared_ptr<ChannelList> c = channels.reader();
|
boost::shared_ptr<ChannelList> c = channels.reader();
|
||||||
ChannelList::iterator chan;
|
ChannelList::iterator chan;
|
||||||
int ret = -1;
|
|
||||||
framecnt_t rec_offset = 0;
|
framecnt_t rec_offset = 0;
|
||||||
framecnt_t rec_nframes = 0;
|
framecnt_t rec_nframes = 0;
|
||||||
bool collect_playback = false;
|
bool collect_playback = false;
|
||||||
bool can_record = _session.actively_recording ();
|
bool can_record = _session.actively_recording ();
|
||||||
|
|
||||||
framecnt_t playback_distance = 0;
|
playback_distance = 0;
|
||||||
|
|
||||||
if (!_io || !_io->active()) {
|
if (!_io || !_io->active()) {
|
||||||
return 0;
|
return 0;
|
||||||
|
|
@ -511,7 +510,7 @@ AudioDiskstream::process (framepos_t transport_frame, pframes_t nframes, bool& n
|
||||||
|
|
||||||
if (rec_nframes > total) {
|
if (rec_nframes > total) {
|
||||||
DiskOverrun ();
|
DiskOverrun ();
|
||||||
goto out;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::shared_ptr<AudioPort> const ap = _io->audio (n);
|
boost::shared_ptr<AudioPort> const ap = _io->audio (n);
|
||||||
|
|
@ -617,7 +616,7 @@ AudioDiskstream::process (framepos_t transport_frame, pframes_t nframes, bool& n
|
||||||
cerr << _name << " Need " << necessary_samples << " total = " << total << endl;
|
cerr << _name << " Need " << necessary_samples << " total = " << total << endl;
|
||||||
cerr << "underrun for " << _name << endl;
|
cerr << "underrun for " << _name << endl;
|
||||||
DiskUnderrun ();
|
DiskUnderrun ();
|
||||||
goto out;
|
return -1;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
|
@ -663,14 +662,7 @@ AudioDiskstream::process (framepos_t transport_frame, pframes_t nframes, bool& n
|
||||||
_speed = _target_speed;
|
_speed = _target_speed;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = 0;
|
return 0;
|
||||||
|
|
||||||
if (commit (playback_distance)) {
|
|
||||||
need_butler = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
out:
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Update various things including playback_sample, read pointer on each channel's playback_buf
|
/** Update various things including playback_sample, read pointer on each channel's playback_buf
|
||||||
|
|
|
||||||
|
|
@ -329,7 +329,6 @@ AudioTrack::roll (pframes_t nframes, framepos_t start_frame, framepos_t end_fram
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int dret;
|
|
||||||
Sample* b;
|
Sample* b;
|
||||||
Sample* tmpb;
|
Sample* tmpb;
|
||||||
framepos_t transport_frame;
|
framepos_t transport_frame;
|
||||||
|
|
@ -348,19 +347,26 @@ AudioTrack::roll (pframes_t nframes, framepos_t start_frame, framepos_t end_fram
|
||||||
|
|
||||||
transport_frame = _session.transport_frame();
|
transport_frame = _session.transport_frame();
|
||||||
|
|
||||||
|
int dret;
|
||||||
|
framecnt_t playback_distance;
|
||||||
|
|
||||||
if ((nframes = check_initial_delay (nframes, transport_frame)) == 0) {
|
if ((nframes = check_initial_delay (nframes, transport_frame)) == 0) {
|
||||||
|
|
||||||
/* need to do this so that the diskstream sets its
|
/* need to do this so that the diskstream sets its
|
||||||
playback distance to zero, thus causing diskstream::commit
|
playback distance to zero, thus causing diskstream::commit
|
||||||
to do nothing.
|
to do nothing.
|
||||||
*/
|
*/
|
||||||
return diskstream->process (transport_frame, 0, need_butler);
|
|
||||||
|
dret = diskstream->process (transport_frame, 0, playback_distance);
|
||||||
|
need_butler = diskstream->commit (playback_distance);
|
||||||
|
return dret;
|
||||||
}
|
}
|
||||||
|
|
||||||
_silent = false;
|
_silent = false;
|
||||||
_amp->apply_gain_automation(false);
|
_amp->apply_gain_automation(false);
|
||||||
|
|
||||||
if ((dret = diskstream->process (transport_frame, nframes, need_butler)) != 0) {
|
if ((dret = diskstream->process (transport_frame, nframes, playback_distance)) != 0) {
|
||||||
|
need_butler = diskstream->commit (playback_distance);
|
||||||
silence (nframes);
|
silence (nframes);
|
||||||
return dret;
|
return dret;
|
||||||
}
|
}
|
||||||
|
|
@ -479,6 +485,8 @@ AudioTrack::roll (pframes_t nframes, framepos_t start_frame, framepos_t end_fram
|
||||||
silence (nframes);
|
silence (nframes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
need_butler = diskstream->commit (playback_distance);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -475,15 +475,15 @@ trace_midi (ostream& o, MIDI::byte *msg, size_t len)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int
|
int
|
||||||
MidiDiskstream::process (framepos_t transport_frame, pframes_t nframes, bool& need_butler)
|
MidiDiskstream::process (framepos_t transport_frame, pframes_t nframes, framecnt_t& playback_distance)
|
||||||
{
|
{
|
||||||
int ret = -1;
|
|
||||||
framecnt_t rec_offset = 0;
|
framecnt_t rec_offset = 0;
|
||||||
framecnt_t rec_nframes = 0;
|
framecnt_t rec_nframes = 0;
|
||||||
bool nominally_recording;
|
bool nominally_recording;
|
||||||
bool re = record_enabled ();
|
bool re = record_enabled ();
|
||||||
bool can_record = _session.actively_recording ();
|
bool can_record = _session.actively_recording ();
|
||||||
framecnt_t playback_distance = 0;
|
|
||||||
|
playback_distance = 0;
|
||||||
|
|
||||||
check_record_status (transport_frame, can_record);
|
check_record_status (transport_frame, can_record);
|
||||||
|
|
||||||
|
|
@ -596,13 +596,7 @@ MidiDiskstream::process (framepos_t transport_frame, pframes_t nframes, bool& ne
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = 0;
|
return 0;
|
||||||
|
|
||||||
if (commit (playback_distance)) {
|
|
||||||
need_butler = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
|
|
|
||||||
|
|
@ -279,14 +279,13 @@ MidiTrack::set_state_part_two ()
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
MidiTrack::roll (pframes_t nframes, framepos_t start_frame, framepos_t end_frame, int declick, bool& needs_butler)
|
MidiTrack::roll (pframes_t nframes, framepos_t start_frame, framepos_t end_frame, int declick, bool& need_butler)
|
||||||
{
|
{
|
||||||
Glib::RWLock::ReaderLock lm (_processor_lock, Glib::TRY_LOCK);
|
Glib::RWLock::ReaderLock lm (_processor_lock, Glib::TRY_LOCK);
|
||||||
if (!lm.locked()) {
|
if (!lm.locked()) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int dret;
|
|
||||||
boost::shared_ptr<MidiDiskstream> diskstream = midi_diskstream();
|
boost::shared_ptr<MidiDiskstream> diskstream = midi_diskstream();
|
||||||
|
|
||||||
automation_snapshot (start_frame);
|
automation_snapshot (start_frame);
|
||||||
|
|
@ -302,17 +301,23 @@ MidiTrack::roll (pframes_t nframes, framepos_t start_frame, framepos_t end_frame
|
||||||
|
|
||||||
framepos_t transport_frame = _session.transport_frame();
|
framepos_t transport_frame = _session.transport_frame();
|
||||||
|
|
||||||
|
int dret;
|
||||||
|
framecnt_t playback_distance;
|
||||||
|
|
||||||
if ((nframes = check_initial_delay (nframes, transport_frame)) == 0) {
|
if ((nframes = check_initial_delay (nframes, transport_frame)) == 0) {
|
||||||
/* need to do this so that the diskstream sets its
|
/* need to do this so that the diskstream sets its
|
||||||
playback distance to zero, thus causing diskstream::commit
|
playback distance to zero, thus causing diskstream::commit
|
||||||
to do nothing.
|
to do nothing.
|
||||||
*/
|
*/
|
||||||
return diskstream->process (transport_frame, 0, needs_butler);
|
dret = diskstream->process (transport_frame, 0, playback_distance);
|
||||||
|
need_butler = diskstream->commit (playback_distance);
|
||||||
|
return dret;
|
||||||
}
|
}
|
||||||
|
|
||||||
_silent = false;
|
_silent = false;
|
||||||
|
|
||||||
if ((dret = diskstream->process (transport_frame, nframes, needs_butler)) != 0) {
|
if ((dret = diskstream->process (transport_frame, nframes, playback_distance)) != 0) {
|
||||||
|
need_butler = diskstream->commit (playback_distance);
|
||||||
silence (nframes);
|
silence (nframes);
|
||||||
return dret;
|
return dret;
|
||||||
}
|
}
|
||||||
|
|
@ -373,6 +378,8 @@ MidiTrack::roll (pframes_t nframes, framepos_t start_frame, framepos_t end_frame
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
need_butler = diskstream->commit (playback_distance);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -378,7 +378,10 @@ Track::silent_roll (pframes_t nframes, framepos_t /*start_frame*/, framepos_t /*
|
||||||
|
|
||||||
silence (nframes);
|
silence (nframes);
|
||||||
|
|
||||||
return _diskstream->process (_session.transport_frame(), nframes, need_butler);
|
framecnt_t playback_distance;
|
||||||
|
int const dret = _diskstream->process (_session.transport_frame(), nframes, playback_distance);
|
||||||
|
need_butler = _diskstream->commit (playback_distance);
|
||||||
|
return dret;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue