diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2006-03-22 17:03:00 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2006-03-22 17:03:00 +0000 |
commit | 3aa346b253d515c3d0715ec5e0fa8b6ad477c4e5 (patch) | |
tree | a41d4380ad270324a2d05cbbab0d1e57dce2bdfe /gtk2_ardour/utils.cc | |
parent | 004a49b0c7051a4d0f8972b0aff0ef8fa9cab03d (diff) |
significant changes in code to handle import/embedding - much cleaner and less code, plus the import progress bar now works; unify response handling for Gtkmm2ext::Choice
git-svn-id: svn://localhost/trunk/ardour2@415 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour/utils.cc')
-rw-r--r-- | gtk2_ardour/utils.cc | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/gtk2_ardour/utils.cc b/gtk2_ardour/utils.cc index c0f1a9eaa8..c96f9a3da1 100644 --- a/gtk2_ardour/utils.cc +++ b/gtk2_ardour/utils.cc @@ -592,3 +592,21 @@ get_xpm (std::string name) return (xpm_map[name]); } +string +length2string (const int32_t frames, const float sample_rate) +{ + int secs = (int) (frames / sample_rate); + int hrs = secs / 3600; + secs -= (hrs * 3600); + int mins = secs / 60; + secs -= (mins * 60); + + int total_secs = (hrs * 3600) + (mins * 60) + secs; + int frames_remaining = frames - (total_secs * sample_rate); + float fractional_secs = (float) frames_remaining / sample_rate; + + char duration_str[32]; + sprintf (duration_str, "%02d:%02d:%05.2f", hrs, mins, (float) secs + fractional_secs); + + return duration_str; +} |