status.new_regions.clear ();
- if ((in = sf_open (status.pathname.c_str(), SFM_READ, &info)) == 0) {
- error << string_compose(_("Import: cannot open input sound file \"%1\""), status.pathname) << endmsg;
+ if ((in = sf_open (status.paths.front().c_str(), SFM_READ, &info)) == 0) {
+ error << string_compose(_("Import: cannot open input sound file \"%1\""), status.paths.front()) << endmsg;
return -1;
} else {
if ((uint32_t) info.samplerate != frame_rate()) {
sf_close(in);
status.doing_what = _("resampling audio");
// resample to session frame_rate
- if (sample_rate_convert(status, status.pathname, tmp_convert_file)) {
+ if (sample_rate_convert(status, status.paths.front(), tmp_convert_file)) {
if ((in = sf_open (tmp_convert_file.c_str(), SFM_READ, &info)) == 0) {
error << string_compose(_("Import: cannot open converted sound file \"%1\""), tmp_convert_file) << endmsg;
return -1;
}
} else if (!status.cancel){
// error
- error << string_compose(_("Import: error while resampling sound file \"%1\""), status.pathname) << endmsg;
+ error << string_compose(_("Import: error while resampling sound file \"%1\""), status.paths.front()) << endmsg;
return -1;
} else {
// canceled
}
sounds_dir = discover_best_sound_dir ();
- basepath = PBD::basename_nosuffix (status.pathname);
+ basepath = PBD::basename_nosuffix (status.paths.front());
for (n = 0; n < info.channels; ++n) {
sources.push_back(newfiles[n]);
}
- boost::shared_ptr<AudioRegion> r (boost::dynamic_pointer_cast<AudioRegion> (RegionFactory::create (sources, 0, newfiles[0]->length(), region_name_from_path (Glib::path_get_basename (basepath)),
+ boost::shared_ptr<AudioRegion> r (boost::dynamic_pointer_cast<AudioRegion> (RegionFactory::create (sources, 0, newfiles[0]->length(), region_name_from_path (basepath, true),
0, AudioRegion::Flag (AudioRegion::DefaultFlags | AudioRegion::WholeFile))));
status.new_regions.push_back (r);
status.new_regions.push_back (boost::dynamic_pointer_cast<AudioRegion>
(RegionFactory::create (boost::static_pointer_cast<Source> (newfiles[n]), 0, newfiles[n]->length(),
- region_name_from_path (Glib::path_get_basename (newfiles[n]->name())),
+ region_name_from_path (newfiles[n]->name(), true),
0, AudioRegion::Flag (AudioRegion::DefaultFlags | AudioRegion::WholeFile | AudioRegion::Import))));
}
}