RCU-ification of AudioEngine port list, and DiskStreams. not well tested, but basical...
[ardour.git] / gtk2_ardour / ardour_ui.cc
index c9116ac4e9eb243ebd4c46f848aff483a2b55e0d..bca27c7231ab978bf0ebc083f8941032e2b8dc8f 100644 (file)
@@ -46,6 +46,7 @@
 #include <midi++/mmc.h>
 
 #include <ardour/ardour.h>
+#include <ardour/session_route.h>
 #include <ardour/port.h>
 #include <ardour/audioengine.h>
 #include <ardour/playlist.h>
@@ -53,7 +54,6 @@
 #include <ardour/audio_diskstream.h>
 #include <ardour/audiofilesource.h>
 #include <ardour/recent_sessions.h>
-#include <ardour/session_diskstream.h>
 #include <ardour/port.h>
 #include <ardour/audio_track.h>
 
@@ -116,16 +116,15 @@ ARDOUR_UI::ARDOUR_UI (int *argcp, char **argvp[], string rcfile)
 
          shuttle_units_button (_("% ")),
 
-         punch_in_button (_("punch\nin")),
-         punch_out_button (_("punch\nout")),
-         auto_return_button (_("auto\nreturn")),
-         auto_play_button (_("auto\nplay")),
-         auto_input_button (_("auto\ninput")),
-         click_button (_("click")),
-         auditioning_alert_button (_("AUDITIONING")),
+         punch_in_button (_("Punch In")),
+         punch_out_button (_("Punch Out")),
+         auto_return_button (_("Auto Return")),
+         auto_play_button (_("Autuo Play")),
+         auto_input_button (_("Auto Input")),
+         click_button (_("Click")),
+         auditioning_alert_button (_("AUDITION")),
          solo_alert_button (_("SOLO")),
          shown_flag (false)
-
 {
        using namespace Gtk::Menu_Helpers;
 
@@ -186,8 +185,8 @@ ARDOUR_UI::ARDOUR_UI (int *argcp, char **argvp[], string rcfile)
        gettimeofday (&last_shuttle_request, 0);
 
        ARDOUR::AudioDiskstream::DeleteSources.connect (mem_fun(*this, &ARDOUR_UI::delete_sources_in_the_right_thread));
-       ARDOUR::AudioDiskstream::DiskOverrun.connect (mem_fun(*this, &ARDOUR_UI::disk_overrun_handler));
-       ARDOUR::AudioDiskstream::DiskUnderrun.connect (mem_fun(*this, &ARDOUR_UI::disk_underrun_handler));
+       ARDOUR::Diskstream::DiskOverrun.connect (mem_fun(*this, &ARDOUR_UI::disk_overrun_handler));
+       ARDOUR::Diskstream::DiskUnderrun.connect (mem_fun(*this, &ARDOUR_UI::disk_underrun_handler));
 
        /* handle pending state with a dialog */
 
@@ -507,11 +506,11 @@ ARDOUR_UI::update_sample_rate (jack_nframes_t ignored)
                jack_nframes_t rate = engine->frame_rate();
                
                if (fmod (rate, 1000.0) != 0.0) {
-                       snprintf (buf, sizeof (buf), _("SR: %.1f kHz / %4.1f msecs"), 
+                       snprintf (buf, sizeof (buf), _("%.1f kHz / %4.1f msecs"), 
                                  (float) rate/1000.0f,
                                  (engine->frames_per_cycle() / (float) rate) * 1000.0f);
                } else {
-                       snprintf (buf, sizeof (buf), _("SR: %u kHz / %4.1f msecs"), 
+                       snprintf (buf, sizeof (buf), _("%u kHz / %4.1f msecs"), 
                                  rate/1000,
                                  (engine->frames_per_cycle() / (float) rate) * 1000.0f);
                }
@@ -524,7 +523,7 @@ void
 ARDOUR_UI::update_cpu_load ()
 {
        char buf[32];
-       snprintf (buf, sizeof (buf), _("DSP Load: %.1f%%"), engine->get_cpu_load());
+       snprintf (buf, sizeof (buf), _("DSP: %.1f%%"), engine->get_cpu_load());
        cpu_load_label.set_text (buf);
 }
 
@@ -543,9 +542,10 @@ ARDOUR_UI::update_buffer_load ()
 }
 
 void
-ARDOUR_UI::count_recenabled_diskstreams (AudioDiskstream& ds)
+ARDOUR_UI::count_recenabled_diskstreams (Route& route)
 {
-       if (ds.record_enabled()) {
+       Track* track = dynamic_cast<Track*>(&route);
+       if (track && track->diskstream()->record_enabled()) {
                rec_enabled_diskstreams++;
        }
 }
@@ -561,7 +561,7 @@ ARDOUR_UI::update_disk_space()
        char buf[64];
 
        if (frames == max_frames) {
-               strcpy (buf, _("space: 24hrs+"));
+               strcpy (buf, _("Disk: 24hrs+"));
        } else {
                int hrs;
                int mins;
@@ -571,7 +571,7 @@ ARDOUR_UI::update_disk_space()
                if (session->actively_recording()){
                        
                        rec_enabled_diskstreams = 0;
-                       session->foreach_audio_diskstream (this, &ARDOUR_UI::count_recenabled_diskstreams);
+                       session->foreach_route (this, &ARDOUR_UI::count_recenabled_diskstreams);
                        
                        if (rec_enabled_diskstreams) {
                                frames /= rec_enabled_diskstreams;
@@ -591,7 +591,7 @@ ARDOUR_UI::update_disk_space()
                frames -= mins * fr * 60;
                secs = frames / fr;
                
-               snprintf (buf, sizeof(buf), _("space: %02dh:%02dm:%02ds"), hrs, mins, secs);
+               snprintf (buf, sizeof(buf), _("Disk: %02dh:%02dm:%02ds"), hrs, mins, secs);
        }
 
        disk_space_label.set_text (buf);
@@ -917,11 +917,6 @@ restart JACK with more ports."));
        }
 }
 
-void
-ARDOUR_UI::diskstream_added (AudioDiskstream* ds)
-{
-}
-
 void
 ARDOUR_UI::do_transport_locate (jack_nframes_t new_position)
 {
@@ -1169,12 +1164,15 @@ ARDOUR_UI::toggle_record_enable (uint32_t dstream)
        
        if ((r = session->route_by_remote_id (dstream)) != 0) {
 
-               AudioTrack* at;
+               Track* t;
 
-               if ((at = dynamic_cast<AudioTrack*>(r.get())) != 0) {
-                       at->disk_stream().set_record_enabled (!at->disk_stream().record_enabled(), this);
+               if ((t = dynamic_cast<Track*>(r.get())) != 0) {
+                       t->diskstream()->set_record_enabled (!t->diskstream()->record_enabled());
                }
        }
+       if (session == 0) {
+               return;
+       }
 }
 
 void
@@ -2150,11 +2148,11 @@ ARDOUR_UI::halt_on_xrun_message ()
 }
 
 void 
-ARDOUR_UI::delete_sources_in_the_right_thread (list<ARDOUR::AudioFileSource*>* deletion_list)
+ARDOUR_UI::delete_sources_in_the_right_thread (list<ARDOUR::Source*>* deletion_list)
 {
        ENSURE_GUI_THREAD (bind (mem_fun(*this, &ARDOUR_UI::delete_sources_in_the_right_thread), deletion_list));
 
-       for (list<AudioFileSource*>::iterator i = deletion_list->begin(); i != deletion_list->end(); ++i) {
+       for (list<Source*>::iterator i = deletion_list->begin(); i != deletion_list->end(); ++i) {
                delete *i;
        }