fix error in multiple calls to SourceFactory::createWritable()

removal of tape tracks removed an intermediate argument in the argument list; presence of default args for the
last two arguments and implicit conversion from int->bool prevented the compiler from complaining
about any existing calls.

This supplements/extends a54b000a70
This commit is contained in:
Paul Davis 2020-03-23 21:47:13 -06:00
parent 3bbad66a99
commit 0f63b82943
8 changed files with 16 additions and 36 deletions

View file

@ -269,10 +269,7 @@ Editor::write_region (string path, boost::shared_ptr<AudioRegion> region)
try { try {
fs = boost::dynamic_pointer_cast<AudioFileSource> ( fs = boost::dynamic_pointer_cast<AudioFileSource> (SourceFactory::createWritable (DataType::AUDIO, *_session, path, _session->sample_rate()));
SourceFactory::createWritable (DataType::AUDIO, *_session,
path, true,
false, _session->sample_rate()));
} }
catch (failed_constructor& err) { catch (failed_constructor& err) {
@ -408,10 +405,7 @@ Editor::write_audio_range (AudioPlaylist& playlist, const ChanCount& count, list
path = s; path = s;
try { try {
fs = boost::dynamic_pointer_cast<AudioFileSource> ( fs = boost::dynamic_pointer_cast<AudioFileSource> (SourceFactory::createWritable (DataType::AUDIO, *_session, path, _session->sample_rate()));
SourceFactory::createWritable (DataType::AUDIO, *_session,
path, true,
false, _session->sample_rate()));
} }
catch (failed_constructor& err) { catch (failed_constructor& err) {

View file

@ -86,7 +86,7 @@ Filter::make_new_sources (boost::shared_ptr<Region> region, SourceList& nsrcs, s
nsrcs.push_back (boost::dynamic_pointer_cast<Source> ( nsrcs.push_back (boost::dynamic_pointer_cast<Source> (
SourceFactory::createWritable (region->data_type(), session, SourceFactory::createWritable (region->data_type(), session,
path, false, sample_rate))); path, sample_rate)));
} }
catch (failed_constructor& err) { catch (failed_constructor& err) {

View file

@ -202,9 +202,7 @@ create_mono_sources_for_writing (const vector<string>& new_paths,
try { try {
const DataType type = SMFSource::safe_midi_file_extension (*i) ? DataType::MIDI : DataType::AUDIO; const DataType type = SMFSource::safe_midi_file_extension (*i) ? DataType::MIDI : DataType::AUDIO;
source = SourceFactory::createWritable (type, sess, source = SourceFactory::createWritable (type, sess, i->c_str(), samplerate);
i->c_str(),
samplerate);
} }
catch (const failed_constructor& err) { catch (const failed_constructor& err) {

View file

@ -1055,10 +1055,9 @@ LuaAPI::Rubberband::process (luabridge::LuaRef cb)
return rv; return rv;
} }
try { try {
_asrc.push_back (boost::dynamic_pointer_cast<AudioSource> (
SourceFactory::createWritable ( _asrc.push_back (boost::dynamic_pointer_cast<AudioSource> (SourceFactory::createWritable (DataType::AUDIO, session, path, sample_rate)));
DataType::AUDIO, session,
path, false, sample_rate)));
} catch (failed_constructor& err) { } catch (failed_constructor& err) {
cleanup (true); cleanup (true);
return rv; return rv;

View file

@ -145,9 +145,7 @@ MidiRegion::do_export (string path) const
/* caller must check for pre-existing file */ /* caller must check for pre-existing file */
assert (!path.empty()); assert (!path.empty());
assert (!Glib::file_test (path, Glib::FILE_TEST_EXISTS)); assert (!Glib::file_test (path, Glib::FILE_TEST_EXISTS));
newsrc = boost::dynamic_pointer_cast<MidiSource>( newsrc = boost::dynamic_pointer_cast<MidiSource>(SourceFactory::createWritable(DataType::MIDI, _session, path, _session.sample_rate()));
SourceFactory::createWritable(DataType::MIDI, _session,
path, false, _session.sample_rate()));
BeatsSamplesConverter bfc (_session.tempo_map(), _position); BeatsSamplesConverter bfc (_session.tempo_map(), _position);
Temporal::Beats const bbegin = bfc.from (_start); Temporal::Beats const bbegin = bfc.from (_start);
@ -177,8 +175,7 @@ MidiRegion::clone (string path) const
assert (!path.empty()); assert (!path.empty());
assert (!Glib::file_test (path, Glib::FILE_TEST_EXISTS)); assert (!Glib::file_test (path, Glib::FILE_TEST_EXISTS));
newsrc = boost::dynamic_pointer_cast<MidiSource>( newsrc = boost::dynamic_pointer_cast<MidiSource>(
SourceFactory::createWritable(DataType::MIDI, _session, SourceFactory::createWritable(DataType::MIDI, _session, path, _session.sample_rate()));
path, false, _session.sample_rate()));
return clone (newsrc); return clone (newsrc);
} }

View file

@ -4907,8 +4907,7 @@ Session::create_audio_source_for_session (size_t n_chans, string const & base, u
const string path = new_audio_source_path (base, n_chans, chan, true); const string path = new_audio_source_path (base, n_chans, chan, true);
if (!path.empty()) { if (!path.empty()) {
return boost::dynamic_pointer_cast<AudioFileSource> ( return boost::dynamic_pointer_cast<AudioFileSource> (SourceFactory::createWritable (DataType::AUDIO, *this, path, sample_rate(), true, true));
SourceFactory::createWritable (DataType::AUDIO, *this, path, sample_rate(), true, true));
} else { } else {
throw failed_constructor (); throw failed_constructor ();
} }
@ -4921,9 +4920,7 @@ Session::create_midi_source_for_session (string const & basic_name)
const string path = new_midi_source_path (basic_name); const string path = new_midi_source_path (basic_name);
if (!path.empty()) { if (!path.empty()) {
return boost::dynamic_pointer_cast<SMFSource> ( return boost::dynamic_pointer_cast<SMFSource> (SourceFactory::createWritable (DataType::MIDI, *this, path, sample_rate()));
SourceFactory::createWritable (
DataType::MIDI, *this, path, false, sample_rate()));
} else { } else {
throw failed_constructor (); throw failed_constructor ();
} }
@ -4966,9 +4963,7 @@ Session::create_midi_source_by_stealing_name (boost::shared_ptr<Track> track)
const string path = Glib::build_filename (source_search_path (DataType::MIDI).front(), name); const string path = Glib::build_filename (source_search_path (DataType::MIDI).front(), name);
return boost::dynamic_pointer_cast<SMFSource> ( return boost::dynamic_pointer_cast<SMFSource> (SourceFactory::createWritable (DataType::MIDI, *this, path, sample_rate()));
SourceFactory::createWritable (
DataType::MIDI, *this, path, false, sample_rate()));
} }
bool bool
@ -5726,7 +5721,7 @@ Session::write_one_track (Track& track, samplepos_t start, samplepos_t end,
} }
try { try {
source = SourceFactory::createWritable (data_type, *this, path, false, sample_rate()); source = SourceFactory::createWritable (data_type, *this, path, sample_rate());
} }
catch (failed_constructor& err) { catch (failed_constructor& err) {

View file

@ -42,7 +42,7 @@ AudioRegionTest::setUp ()
std::string const test_wav_path = Glib::build_filename (new_test_output_dir(), "test.wav"); std::string const test_wav_path = Glib::build_filename (new_test_output_dir(), "test.wav");
_playlist = PlaylistFactory::create (DataType::AUDIO, *_session, "test"); _playlist = PlaylistFactory::create (DataType::AUDIO, *_session, "test");
_audio_playlist = boost::dynamic_pointer_cast<AudioPlaylist> (_playlist); _audio_playlist = boost::dynamic_pointer_cast<AudioPlaylist> (_playlist);
_source = SourceFactory::createWritable (DataType::AUDIO, *_session, test_wav_path, false, get_test_sample_rate ()); _source = SourceFactory::createWritable (DataType::AUDIO, *_session, test_wav_path, get_test_sample_rate ());
/* Write a staircase to the source */ /* Write a staircase to the source */

View file

@ -119,9 +119,7 @@ ensure_per_region_source (Session* session, boost::shared_ptr<MidiRegion> region
<< " for region " << region->name() << endl; << " for region " << region->name() << endl;
} else { } else {
newsrc = boost::dynamic_pointer_cast<MidiSource>( newsrc = boost::dynamic_pointer_cast<MidiSource>(SourceFactory::createWritable(DataType::MIDI, *session, newsrc_path, session->sample_rate()));
SourceFactory::createWritable(DataType::MIDI, *session,
newsrc_path, false, session->sample_rate()));
if (!newsrc) { if (!newsrc) {
cout << UTILNAME << ":" << endl cout << UTILNAME << ":" << endl
@ -175,8 +173,7 @@ ensure_per_source_source (Session* session, boost::shared_ptr<MidiRegion> region
} else { } else {
newsrc = boost::dynamic_pointer_cast<MidiSource>( newsrc = boost::dynamic_pointer_cast<MidiSource>(
SourceFactory::createWritable(DataType::MIDI, *session, SourceFactory::createWritable(DataType::MIDI, *session, newsrc_path, session->sample_rate()));
newsrc_path, false, session->sample_rate()));
if (!newsrc) { if (!newsrc) {
cout << UTILNAME << ":" << endl cout << UTILNAME << ":" << endl
<<" An error occurred creating writeable source " << newsrc_path << " exiting." << endl; <<" An error occurred creating writeable source " << newsrc_path << " exiting." << endl;