13
0

Fix previous patch a bit better.

git-svn-id: svn://localhost/ardour2/branches/3.0@8959 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Carl Hetherington 2011-02-25 17:40:19 +00:00
parent e5c6071235
commit eb8de01f42
5 changed files with 29 additions and 6 deletions

View File

@ -284,7 +284,6 @@ class AudioDiskstream : public Diskstream
int add_channel_to (boost::shared_ptr<ChannelList>, uint32_t how_many);
int remove_channel_from (boost::shared_ptr<ChannelList>, uint32_t how_many);
framecnt_t playback_distance;
};
} // namespace ARDOUR

View File

@ -288,6 +288,7 @@ class Diskstream : public SessionObject, public PublicDiskstream
framepos_t file_frame;
framepos_t playback_sample;
framecnt_t playback_distance;
uint32_t _read_data_count;
uint32_t _write_data_count;

View File

@ -76,7 +76,6 @@ AudioDiskstream::AudioDiskstream (Session &sess, const string &name, Diskstream:
: Diskstream(sess, name, flag)
, deprecated_io_node(NULL)
, channels (new ChannelList)
, playback_distance (0)
{
/* prevent any write sources from being created */
@ -89,7 +88,6 @@ AudioDiskstream::AudioDiskstream (Session& sess, const XMLNode& node)
: Diskstream(sess, node)
, deprecated_io_node(NULL)
, channels (new ChannelList)
, playback_distance (0)
{
in_set_state = true;
init ();

View File

@ -106,6 +106,7 @@ Diskstream::Diskstream (Session &sess, const string &name, Flag flag)
, _target_speed (_speed)
, file_frame (0)
, playback_sample (0)
, playback_distance (0)
, _read_data_count (0)
, _write_data_count (0)
, in_set_state (false)
@ -149,6 +150,7 @@ Diskstream::Diskstream (Session& sess, const XMLNode& /*node*/)
, _target_speed (_speed)
, file_frame (0)
, playback_sample (0)
, playback_distance (0)
, _read_data_count (0)
, _write_data_count (0)
, in_set_state (false)

View File

@ -496,6 +496,8 @@ MidiDiskstream::process (framepos_t transport_frame, pframes_t nframes, bool can
bool nominally_recording;
bool re = record_enabled ();
playback_distance = 0;
check_record_status (transport_frame, can_record);
nominally_recording = (can_record && re);
@ -557,10 +559,31 @@ MidiDiskstream::process (framepos_t transport_frame, pframes_t nframes, bool can
}
if (rec_nframes) {
/* data will be written to disk */
if (rec_nframes == nframes && rec_offset == 0) {
playback_distance = nframes;
}
adjust_capture_position = rec_nframes;
} else if (nominally_recording) {
/* XXXX do this for MIDI !!!
can't do actual capture yet - waiting for latency effects to finish before we start
*/
playback_distance = nframes;
} else {
/* XXX: should be doing varispeed stuff here, similar to the code in AudioDiskstream::process */
playback_distance = nframes;
}
ret = 0;
if (commit (nframes)) {
@ -576,9 +599,9 @@ MidiDiskstream::commit (framecnt_t nframes)
bool need_butler = false;
if (_actual_speed < 0.0) {
playback_sample -= nframes;
playback_sample -= playback_distance;
} else {
playback_sample += nframes;
playback_sample += playback_distance;
}
if (adjust_capture_position != 0) {