*/
-#define __STDC_LIMIT_MACROS
#include <stdint.h>
#include <algorithm>
PBD::Signal0<void> Session::SendFeedback;
PBD::Signal0<void> Session::TimecodeOffsetChanged;
-PBD::Signal0<void> Session::StartTimeChanged;
-PBD::Signal0<void> Session::EndTimeChanged;
+PBD::Signal1<void, framepos_t> Session::StartTimeChanged;
+PBD::Signal1<void, framepos_t> Session::EndTimeChanged;
PBD::Signal0<void> Session::AutoBindingOn;
PBD::Signal0<void> Session::AutoBindingOff;
PBD::Signal2<void,std::string, std::string> Session::Exported;
PBD::Signal1<int,boost::shared_ptr<Playlist> > Session::AskAboutPlaylistDeletion;
+PBD::Signal0<void> Session::Quit;
static void clean_up_session_event (SessionEvent* ev) { delete ev; }
const SessionEvent::RTeventCallback Session::rt_cleanup (clean_up_session_event);
DirtyChanged (); /* EMIT SIGNAL */
}
+ StartTimeChanged.connect_same_thread (*this, boost::bind (&Session::start_time_changed, this, _1));
+ EndTimeChanged.connect_same_thread (*this, boost::bind (&Session::end_time_changed, this, _1));
+
_is_new = false;
}
g_atomic_int_set (&_record_status, Enabled);
- /* this function is currently called from somewhere other than an RT thread.
- this save_state() call therefore doesn't impact anything.
+ /* This function is currently called from somewhere other than an RT thread.
+ This save_state() call therefore doesn't impact anything. Doing it here
+ means that we save pending state of which sources the next record will use,
+ which gives us some chance of recovering from a crash during the record.
*/
-
+
save_state ("", true);
-
+
if (_transport_speed) {
if (!config.get_punch_in()) {
enable_record ();
set_dirty();
}
-nframes64_t
+framepos_t
Session::audible_frame () const
{
- nframes64_t ret;
- nframes64_t tf;
+ framepos_t ret;
+ framepos_t tf;
nframes_t offset;
/* the first of these two possible settings for "offset"
return;
}
- pair<nframes_t, nframes_t> const ext = get_extent ();
+ pair<framepos_t, framepos_t> const ext = get_extent ();
if (_session_range_location == 0) {
/* we don't have a session range yet; use this one (provided it is valid) */
- if (ext.first != max_frames) {
+ if (ext.first != max_framepos) {
add_session_range_location (ext.first, ext.second);
}
} else {
}
/** @return Extent of the session's contents; if the session is empty, the first value of
- * the pair will equal max_frames.
+ * the pair will equal max_framepos.
*/
-pair<nframes_t, nframes_t>
+pair<framepos_t, framepos_t>
Session::get_extent () const
{
- pair<nframes_t, nframes_t> ext (max_frames, 0);
+ pair<framepos_t, framepos_t> ext (max_framepos, 0);
boost::shared_ptr<RouteList> rl = routes.reader ();
for (RouteList::iterator i = rl->begin(); i != rl->end(); ++i) {
continue;
}
- pair<nframes_t, nframes_t> e = tr->playlist()->get_extent ();
+ pair<framepos_t, framepos_t> e = tr->playlist()->get_extent ();
if (e.first < ext.first) {
ext.first = e.first;
}
Session::peak_path (string base) const
{
sys::path peakfile_path(_session_dir->peak_path());
- peakfile_path /= basename_nosuffix (base) + peakfile_suffix;
+ peakfile_path /= base + peakfile_suffix;
return peakfile_path.to_string();
}
}
}
-nframes_t
+framecnt_t
Session::available_capture_duration ()
{
float sample_bytes_on_disk = 4.0; // keep gcc happy
double scale = 4096.0 / sample_bytes_on_disk;
- if (_total_free_4k_blocks * scale > (double) max_frames) {
- return max_frames;
+ if (_total_free_4k_blocks * scale > (double) max_framecnt) {
+ return max_framecnt;
}
-
- return (nframes_t) floor (_total_free_4k_blocks * scale);
+
+ return (framecnt_t) floor (_total_free_4k_blocks * scale);
}
void
}
boost::shared_ptr<RouteList>
-Session::get_routes_with_regions_at (nframes64_t const p) const
+Session::get_routes_with_regions_at (framepos_t const p) const
{
shared_ptr<RouteList> r = routes.reader ();
shared_ptr<RouteList> rl (new RouteList);
}
}
-nframes_t
+framepos_t
Session::current_start_frame () const
{
return _session_range_location ? _session_range_location->start() : 0;
}
-nframes_t
+framepos_t
Session::current_end_frame () const
{
return _session_range_location ? _session_range_location->end() : 0;
}
}
+
+void
+Session::start_time_changed (framepos_t old)
+{
+ /* Update the auto loop range to match the session range
+ (unless the auto loop range has been changed by the user)
+ */
+
+ Location* s = _locations->session_range_location ();
+ Location* l = _locations->auto_loop_location ();
+
+ if (l->start() == old) {
+ l->set_start (s->start(), true);
+ }
+}
+
+void
+Session::end_time_changed (framepos_t old)
+{
+ /* Update the auto loop range to match the session range
+ (unless the auto loop range has been changed by the user)
+ */
+
+ Location* s = _locations->session_range_location ();
+ Location* l = _locations->auto_loop_location ();
+
+ if (l->end() == old) {
+ l->set_end (s->end(), true);
+ }
+}