~ubuntu-branches/ubuntu/lucid/ardour/lucid-proposed

« back to all changes in this revision

Viewing changes to libs/ardour/session_state.cc

  • Committer: Bazaar Package Importer
  • Author(s): Free Ekanayaka
  • Date: 2008-02-07 20:51:55 UTC
  • mfrom: (1.1.13 upstream)
  • Revision ID: james.westby@ubuntu.com-20080207205155-xzi5lq5s2o1okvx8
Tags: 1:2.3.1-1
* New upstream release
* debian/control:
   - build-depend on libfftw3-dev (Closes: #463803)
   - added Homepage, Vcs-Svn, Vcs-Browser
* debian/patches
   - dropped 50-soundtouch.patch (fixed upstream)
   - updated 80_ardourino.patch
   - dropped unused patches from source package

Show diffs side-by-side

added added

removed removed

Lines of Context:
127
127
        _name = _current_snapshot_name = snapshot_name;
128
128
 
129
129
        _current_frame_rate = _engine.frame_rate ();
 
130
        _nominal_frame_rate = _current_frame_rate;
 
131
        _base_frame_rate = _current_frame_rate;
 
132
 
130
133
        _tempo_map = new TempoMap (_current_frame_rate);
131
134
        _tempo_map->StateChanged.connect (mem_fun (*this, &Session::tempo_map_changed));
132
135
 
222
225
                waiting_for_sync_offset = false;
223
226
        }
224
227
 
225
 
        _current_frame_rate = 48000;
226
 
        _base_frame_rate = 48000;
227
 
 
228
228
        last_smpte_when = 0;
229
229
        _smpte_offset = 0;
230
230
        _smpte_offset_negative = true;
469
469
}
470
470
 
471
471
int
472
 
Session::create (bool& new_session, const string& mix_template, nframes_t initial_length)
 
472
Session::ensure_subdirs ()
473
473
{
474
474
        string dir;
475
475
 
476
 
        if (g_mkdir_with_parents (_path.c_str(), 0755) < 0) {
477
 
                error << string_compose(_("Session: cannot create session dir \"%1\" (%2)"), _path, strerror (errno)) << endmsg;
478
 
                return -1;
479
 
        }
480
 
 
481
476
        dir = peak_dir ();
482
477
 
483
478
        if (g_mkdir_with_parents (dir.c_str(), 0755) < 0) {
484
 
                error << string_compose(_("Session: cannot create session peakfile dir \"%1\" (%2)"), dir, strerror (errno)) << endmsg;
 
479
                error << string_compose(_("Session: cannot create session peakfile folder \"%1\" (%2)"), dir, strerror (errno)) << endmsg;
485
480
                return -1;
486
481
        }
487
482
 
492
487
                dir = sound_dir ();
493
488
                
494
489
                if (g_mkdir_with_parents (dir.c_str(), 0755) < 0) {
495
 
                        error << string_compose(_("Session: cannot create session sounds dir \"%1\" (%2)"), dir, strerror (errno)) << endmsg;
 
490
                        error << string_compose(_("Session: cannot create session sounds folder \"%1\" (%2)"), dir, strerror (errno)) << endmsg;
496
491
                        return -1;
497
492
                }
498
493
        }
500
495
        dir = dead_sound_dir ();
501
496
 
502
497
        if (g_mkdir_with_parents (dir.c_str(), 0755) < 0) {
503
 
                error << string_compose(_("Session: cannot create session dead sounds dir \"%1\" (%2)"), dir, strerror (errno)) << endmsg;
 
498
                error << string_compose(_("Session: cannot create session dead sounds folder \"%1\" (%2)"), dir, strerror (errno)) << endmsg;
504
499
                return -1;
505
500
        }
506
501
 
507
502
        dir = export_dir ();
508
503
 
509
504
        if (g_mkdir_with_parents (dir.c_str(), 0755) < 0) {
510
 
                error << string_compose(_("Session: cannot create session export dir \"%1\" (%2)"), dir, strerror (errno)) << endmsg;
511
 
                return -1;
512
 
        }
513
 
 
 
505
                error << string_compose(_("Session: cannot create session export folder \"%1\" (%2)"), dir, strerror (errno)) << endmsg;
 
506
                return -1;
 
507
        }
 
508
 
 
509
        dir = analysis_dir ();
 
510
 
 
511
        if (g_mkdir_with_parents (dir.c_str(), 0755) < 0) {
 
512
                error << string_compose(_("Session: cannot create session analysis folder \"%1\" (%2)"), dir, strerror (errno)) << endmsg;
 
513
                return -1;
 
514
        }
 
515
 
 
516
        return 0;
 
517
}
 
518
 
 
519
int
 
520
Session::create (bool& new_session, const string& mix_template, nframes_t initial_length)
 
521
{
 
522
 
 
523
        if (g_mkdir_with_parents (_path.c_str(), 0755) < 0) {
 
524
                error << string_compose(_("Session: cannot create session folder \"%1\" (%2)"), _path, strerror (errno)) << endmsg;
 
525
                return -1;
 
526
        }
 
527
 
 
528
        if (ensure_subdirs ()) {
 
529
                return -1;
 
530
        }
514
531
 
515
532
        /* check new_session so we don't overwrite an existing one */
516
533
 
559
576
 
560
577
        _state_of_the_state = Clean;
561
578
 
562
 
 
563
579
        save_state ("");
564
580
 
565
581
        return 0;
915
931
 
916
932
        // store libardour version, just in case
917
933
        char buf[16];
918
 
        snprintf(buf, sizeof(buf)-1, "%d.%d.%d", 
919
 
                 libardour2_major_version, libardour2_minor_version, libardour2_micro_version);
 
934
        snprintf(buf, sizeof(buf), "%d.%d.%d", libardour2_major_version, libardour2_minor_version, libardour2_micro_version);
920
935
        node->add_property("version", string(buf));
921
936
                
922
937
        /* store configuration settings */
923
938
 
924
939
        if (full_state) {
925
940
        
926
 
                /* store the name */
927
941
                node->add_property ("name", _name);
 
942
                snprintf (buf, sizeof (buf), "%" PRId32, _nominal_frame_rate);
 
943
                node->add_property ("sample-rate", buf);
928
944
 
929
945
                if (session_dirs.size() > 1) {
930
946
 
1142
1158
        int ret = -1;
1143
1159
 
1144
1160
        _state_of_the_state = StateOfTheState (_state_of_the_state|CannotSave);
1145
 
 
1146
1161
        
1147
1162
        if (node.name() != X_("Session")){
1148
1163
                fatal << _("programming error: Session: incorrect XML node sent to set_state()") << endmsg;
1153
1168
                _name = prop->value ();
1154
1169
        }
1155
1170
 
 
1171
        if ((prop = node.property (X_("sample-rate"))) != 0) {
 
1172
 
 
1173
                _nominal_frame_rate = atoi (prop->value());
 
1174
 
 
1175
                if (_nominal_frame_rate != _current_frame_rate) {
 
1176
                        if (AskAboutSampleRateMismatch (_nominal_frame_rate, _current_frame_rate)) {
 
1177
                                return -1;
 
1178
                        }
 
1179
                }
 
1180
        }
 
1181
 
1156
1182
        setup_raid_path(_path);
1157
1183
 
1158
1184
        if ((prop = node.property (X_("id-counter"))) != 0) {
2045
2071
}
2046
2072
 
2047
2073
string
 
2074
Session::analysis_dir () const
 
2075
{
 
2076
        string res = _path;
 
2077
        res += "analysis/";
 
2078
        return res;
 
2079
}
 
2080
 
 
2081
string
2048
2082
Session::template_dir ()
2049
2083
{
2050
2084
        string path = get_user_ardour_path();
2105
2139
string
2106
2140
Session::control_protocol_path ()
2107
2141
{
 
2142
        char *p = getenv ("ARDOUR_CONTROL_SURFACE_PATH");
 
2143
        if (p && *p) {
 
2144
                return p;
 
2145
        }
2108
2146
        return suffixed_search_path (X_("surfaces"), false);
2109
2147
}
2110
2148
 
2808
2846
                newpath += dead_sound_dir_name;
2809
2847
 
2810
2848
                if (g_mkdir_with_parents (newpath.c_str(), 0755) < 0) {
2811
 
                        error << string_compose(_("Session: cannot create session peakfile dir \"%1\" (%2)"), newpath, strerror (errno)) << endmsg;
 
2849
                        error << string_compose(_("Session: cannot create session peakfile folder \"%1\" (%2)"), newpath, strerror (errno)) << endmsg;
2812
2850
                        return -1;
2813
2851
                }
2814
2852