NO-OP/Optimize Bounce: Lookup data-type only once

This is to prepare for midi-to-audio bounce: allow to change the
data-type to be used as output.
This commit is contained in:
Robin Gareus 2019-04-07 19:34:37 +02:00
parent 7450d69189
commit a1c19911db
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
1 changed files with 6 additions and 4 deletions

View File

@ -6113,6 +6113,8 @@ Session::write_one_track (Track& track, samplepos_t start, samplepos_t end,
string legal_playlist_name;
string possible_path;
DataType data_type = track.data_type();
if (end <= start) {
error << string_compose (_("Cannot write a range where end <= start (e.g. %1 <= %2)"),
end, start) << endmsg;
@ -6122,7 +6124,7 @@ Session::write_one_track (Track& track, samplepos_t start, samplepos_t end,
diskstream_channels = track.bounce_get_output_streams (diskstream_channels, endpoint,
include_endpoint, for_export, for_freeze);
if (diskstream_channels.n(track.data_type()) < 1) {
if (diskstream_channels.n(data_type) < 1) {
error << _("Cannot write a range with no data.") << endmsg;
return result;
}
@ -6149,10 +6151,10 @@ Session::write_one_track (Track& track, samplepos_t start, samplepos_t end,
legal_playlist_name = legalize_for_path (playlist->name());
for (uint32_t chan_n = 0; chan_n < diskstream_channels.n(track.data_type()); ++chan_n) {
for (uint32_t chan_n = 0; chan_n < diskstream_channels.n(data_type); ++chan_n) {
string base_name = string_compose ("%1-%2-bounce", playlist->name(), chan_n);
string path = ((track.data_type() == DataType::AUDIO)
string path = ((data_type == DataType::AUDIO)
? new_audio_source_path (legal_playlist_name, diskstream_channels.n_audio(), chan_n, false, true)
: new_midi_source_path (legal_playlist_name));
@ -6161,7 +6163,7 @@ Session::write_one_track (Track& track, samplepos_t start, samplepos_t end,
}
try {
source = SourceFactory::createWritable (track.data_type(), *this, path, false, sample_rate());
source = SourceFactory::createWritable (data_type, *this, path, false, sample_rate());
}
catch (failed_constructor& err) {