From cf0da62ff0e4ef7dfcf0730f1af057edd34dc15a Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Sat, 11 Feb 2006 02:34:03 +0000 Subject: [PATCH] miscellaneous fixes post-jesse's 24 bit file format changes git-svn-id: svn://localhost/trunk/ardour2@317 d708f5d6-7413-0410-9779-e7cbd77b26cf --- gtk2_ardour/SConscript | 1 + gtk2_ardour/ardbg | 4 +- gtk2_ardour/ardour_ui2.cc | 130 ++++++++++++++++++++++++++ gtk2_ardour/arval | 2 +- gtk2_ardour/canvas-simplerect.c | 6 +- gtk2_ardour/canvas-simplerect.h | 6 +- gtk2_ardour/plugin_ui.cc | 1 - gtk2_ardour/regionview.cc | 125 +++++++++++++++++-------- gtk2_ardour/regionview.h | 24 ++++- gtk2_ardour/streamview.cc | 39 +++----- gtk2_ardour/time_axis_view_item.cc | 61 +++++++++--- gtk2_ardour/time_axis_view_item.h | 7 +- libs/ardour/ardour/audioengine.h | 18 ++-- libs/ardour/ardour/configuration.h | 67 ++++++------- libs/ardour/ardour/port.h | 12 +-- libs/ardour/ardour/session.h | 12 ++- libs/ardour/ardour/utils.h | 14 ++- libs/ardour/configuration.cc | 21 +++++ libs/ardour/destructive_filesource.cc | 2 - libs/ardour/diskstream.cc | 1 - libs/ardour/port.cc | 1 + libs/ardour/session.cc | 8 +- libs/ardour/session_butler.cc | 8 +- libs/ardour/session_state.cc | 34 ++++++- libs/midi++2/mmc.cc | 2 +- 25 files changed, 442 insertions(+), 164 deletions(-) diff --git a/gtk2_ardour/SConscript b/gtk2_ardour/SConscript index ee1d713cce..95136ae008 100644 --- a/gtk2_ardour/SConscript +++ b/gtk2_ardour/SConscript @@ -163,6 +163,7 @@ selection.cc sfdb_ui.cc send_ui.cc streamview.cc +taperegionview.cc tempo_dialog.cc time_axis_view.cc time_axis_view_item.cc diff --git a/gtk2_ardour/ardbg b/gtk2_ardour/ardbg index a4d686a545..0aa19ac5e7 100755 --- a/gtk2_ardour/ardbg +++ b/gtk2_ardour/ardbg @@ -8,11 +8,11 @@ export ARDOUR_BINDINGS=./ardour.bindings if [ -x ./ardour.bin ] ; then # scons executable - export LD_LIBRARY_PATH=../libs/ardour + export LD_LIBRARY_PATH=../libs/ardour:$LD_LIBRARY_PATH exec gdb ./ardour.bin else # autofoo/make executable - export LD_LIBRARY_PATH=../libs/ardour/.libs + export LD_LIBRARY_PATH=../libs/ardour/.libs:$LD_LIBRARY_PATH exec gdb ./ardour fi diff --git a/gtk2_ardour/ardour_ui2.cc b/gtk2_ardour/ardour_ui2.cc index 8d026a43a4..6b256c2609 100644 --- a/gtk2_ardour/ardour_ui2.cc +++ b/gtk2_ardour/ardour_ui2.cc @@ -117,6 +117,134 @@ ARDOUR_UI::setup_adjustables () adjuster_table.attach (*mmc_id_button, 2, 3, 1, 2, FILL, FILL, 5, 5); } +#define NEW_LOOP_XPM +#ifdef NEW_LOOP_XPM + +/* XPM */ +static const gchar * loop_xpm[] = { +"17 25 94 2", +" c None", +". c #4C4C4C", +"+ c #555555", +"@ c #454545", +"# c #242424", +"$ c #5E5E5E", +"% c #000000", +"& c #6B6B6B", +"* c #484848", +"= c #4E4E4E", +"- c #6A6A6A", +"; c #717171", +"> c #686868", +", c #838383", +"' c #888888", +") c #676767", +"! c #4A4A4A", +"~ c #474747", +"{ c #939393", +"] c #949494", +"^ c #9E9E9E", +"/ c #4B4B4B", +"( c #A1A1A1", +"_ c #A0A0A0", +": c #A5A5A5", +"< c #B2B2B2", +"[ c #646464", +"} c #ADADAD", +"| c #AAAAAA", +"1 c #B1B1B1", +"2 c #494949", +"3 c #9A9A9A", +"4 c #A2A2A2", +"5 c #A7A7A7", +"6 c #A8A8A8", +"7 c #C1C1C1", +"8 c #696969", +"9 c #656565", +"0 c #B6B6B6", +"a c #404040", +"b c #989898", +"c c #9D9D9D", +"d c #999999", +"e c #A3A3A3", +"f c #C4C4C4", +"g c #707070", +"h c #C2C2C2", +"i c #9C9C9C", +"j c #969696", +"k c #A4A4A4", +"l c #777777", +"m c #979797", +"n c #2F2F2F", +"o c #A9A9A9", +"p c #7D7D7D", +"q c #6D6D6D", +"r c #959595", +"s c #AFAFAF", +"t c #848484", +"u c #7F7F7F", +"v c #3B3B3B", +"w c #9B9B9B", +"x c #2B2B2B", +"y c #BFBFBF", +"z c #B3B3B3", +"A c #8A8A8A", +"B c #858585", +"C c #2E2E2E", +"D c #C3C3C3", +"E c #B8B8B8", +"F c #464646", +"G c #8E8E8E", +"H c #898989", +"I c #8D8D8D", +"J c #797979", +"K c #BCBCBC", +"L c #909090", +"M c #8C8C8C", +"N c #2A2A2A", +"O c #747474", +"P c #818181", +"Q c #808080", +"R c #C6C6C6", +"S c #C0C0C0", +"T c #787878", +"U c #868686", +"V c #878787", +"W c #8B8B8B", +"X c #666666", +"Y c #BDBDBD", +"Z c #929292", +"` c #6C6C6C", +" . c #505050", +".. c #C8C8C8", +" . + ", +" @ # $ ", +" @ % @ & ", +" * % % = - ", +" * % ; % = > ", +" * % , ' % = ) ", +"* ! ! ~ % { ] ^ % / . ! * ~ * + ", +"~ % % % % ( _ : < % % % % % % % ) ", +"* % $ [ % } | 1 % 2 3 ^ 4 5 6 % 7 ", +"* % 8 9 % 0 0 % a b c d c _ e % f ", +"* % g 8 % h % a b i b j c 4 k % 7 ", +"* % l g % % . m i j j 3 n o o % 7 ", +"~ % p l % q d i j r b # % 0 s % 7 ", +"~ % t u v b w j r d x % % y z % 7 ", +"~ % A B A b j ] d C % [ % D E % 7 ", +"F % G H I { ] b C % q J % f K % 7 ", +"~ % L M G { b N % O P Q % R S % 7 ", +"+ % % % % % % % T U V W % % % % D ", +" X 7 D 7 7 Y = % I Z b % 7 7 K 7 ", +" ` = % ( : % 7 ", +" 8 = % z % 7 ", +" X / % % 7 ", +" X .% .. ", +" - 9 .. ", +" q I "}; + +#else + static const gchar * loop_xpm[] = { "19 19 3 1", " c None", @@ -142,6 +270,8 @@ static const gchar * loop_xpm[] = { " ..+. ", " ... "}; +#endif + void ARDOUR_UI::transport_stopped () { diff --git a/gtk2_ardour/arval b/gtk2_ardour/arval index dd23b2801e..f560d4e336 100755 --- a/gtk2_ardour/arval +++ b/gtk2_ardour/arval @@ -5,5 +5,5 @@ export ARDOUR_UI=./ardour.menus export ARDOUR_UI_RC=./ardour2_ui.rc export ARDOUR_BINDINGS=./ardour.bindings -export LD_LIBRARY_PATH=../libs/ardour +export LD_LIBRARY_PATH=../libs/ardour:$LD_LIBRARY_PATH exec valgrind --num-callers=12 --tool=memcheck ./ardour.bin --novst $* diff --git a/gtk2_ardour/canvas-simplerect.c b/gtk2_ardour/canvas-simplerect.c index 8edfba7ca9..62d3a96bcf 100644 --- a/gtk2_ardour/canvas-simplerect.c +++ b/gtk2_ardour/canvas-simplerect.c @@ -573,9 +573,9 @@ gnome_canvas_simplerect_render (GnomeCanvasItem *item, randb = random() % 255; PAINT_BOX(buf, randr, randg, randb, simplerect->fill_a, begin, sy, end, ey); #else - FAST_PAINT_BOX (buf, simplerect->fill_r, simplerect->fill_g, simplerect->fill_b, simplerect->fill_a, - intersection.x0, intersection.y0, - intersection.x1, intersection.y1); + PAINT_BOX (buf, simplerect->fill_r, simplerect->fill_g, simplerect->fill_b, simplerect->fill_a, + intersection.x0, intersection.y0, + intersection.x1, intersection.y1); #endif } diff --git a/gtk2_ardour/canvas-simplerect.h b/gtk2_ardour/canvas-simplerect.h index 2e3ec1b7cc..5bb695bbf3 100644 --- a/gtk2_ardour/canvas-simplerect.h +++ b/gtk2_ardour/canvas-simplerect.h @@ -48,9 +48,9 @@ struct _GnomeCanvasSimpleRect gboolean fill; gboolean draw; gboolean full_draw_on_update; - uint32_t fill_color; - uint32_t outline_color; - uint32_t outline_pixels; + uint32_t fill_color; + uint32_t outline_color; + uint32_t outline_pixels; /* cached values set during update/used during render */ diff --git a/gtk2_ardour/plugin_ui.cc b/gtk2_ardour/plugin_ui.cc index c9e8c2ee14..fd4c91ff80 100644 --- a/gtk2_ardour/plugin_ui.cc +++ b/gtk2_ardour/plugin_ui.cc @@ -186,7 +186,6 @@ PluginUI::build (AudioEngine &engine) Frame* frame; Frame* bt_frame; VBox* box; - char info[32]; int output_row, output_col; int button_row, button_col; int output_rows, output_cols; diff --git a/gtk2_ardour/regionview.cc b/gtk2_ardour/regionview.cc index 5da65dead7..e2694f2b50 100644 --- a/gtk2_ardour/regionview.cc +++ b/gtk2_ardour/regionview.cc @@ -56,19 +56,25 @@ static const int32_t sync_mark_width = 9; sigc::signal AudioRegionView::AudioRegionViewGoingAway; -AudioRegionView::AudioRegionView (ArdourCanvas::Group *parent, AudioTimeAxisView &tv, - AudioRegion& r, - double spu, - double amplitude_above_axis, - Gdk::Color& basic_color, - bool wfw) - +AudioRegionView::AudioRegionView (ArdourCanvas::Group *parent, AudioTimeAxisView &tv, AudioRegion& r, double spu, + Gdk::Color& basic_color) : TimeAxisViewItem (r.name(), *parent, tv, spu, basic_color, r.position(), r.length(), TimeAxisViewItem::Visibility (TimeAxisViewItem::ShowNameText| TimeAxisViewItem::ShowNameHighlight| TimeAxisViewItem::ShowFrame)), - region (r) +{ +} + +AudioRegionView::AudioRegionView (ArdourCanvas::Group *parent, AudioTimeAxisView &tv, AudioRegion& r, double spu, + Gdk::Color& basic_color, TimeAxisViewItem::Visibility visibility) + : TimeAxisViewItem (r.name(), *parent, tv, spu, basic_color, r.position(), r.length(), visibility), + region (r) +{ +} + +void +AudioRegionView::init (double amplitude_above_axis, Gdk::Color& basic_color, bool wfw) { ArdourCanvas::Points shape; XMLNode *node; @@ -150,7 +156,7 @@ AudioRegionView::AudioRegionView (ArdourCanvas::Group *parent, AudioTimeAxisView foo += ':'; foo += "gain"; - gain_line = new AudioRegionGainLine (foo, tv.session(), *this, *group, region.envelope()); + gain_line = new AudioRegionGainLine (foo, trackview.session(), *this, *group, region.envelope()); if (!(_flags & EnvelopeVisible)) { gain_line->hide (); @@ -197,7 +203,7 @@ AudioRegionView::~AudioRegionView () gnome_canvas_waveview_cache_destroy (*cache); } - /* all waveviews will be destroyed when the group is destroyed */ + /* all waveviews etc will be destroyed when the group is destroyed */ for (vector::iterator g = ghosts.begin(); g != ghosts.end(); ++g) { delete *g; @@ -207,7 +213,9 @@ AudioRegionView::~AudioRegionView () delete editor; } - delete gain_line; + if (gain_line) { + delete gain_line; + } } gint @@ -402,16 +410,18 @@ AudioRegionView::reset_width_dependent_items (double pixel_width) zero_line->property_x2() = pixel_width - 1.0; } - if (pixel_width <= 6.0) { - fade_in_handle->hide(); - fade_out_handle->hide(); - } else { - if (_height < 5.0) { + if (fade_in_handle) { + if (pixel_width <= 6.0) { fade_in_handle->hide(); fade_out_handle->hide(); } else { - fade_in_handle->show(); - fade_out_handle->show(); + if (_height < 5.0) { + fade_in_handle->hide(); + fade_out_handle->hide(); + } else { + fade_in_handle->show(); + fade_out_handle->show(); + } } } @@ -517,19 +527,23 @@ AudioRegionView::set_height (gdouble height) waves[n]->property_y() = yoff + 2; } - if ((height/wcnt) < NAME_HIGHLIGHT_SIZE) { - gain_line->hide (); - } else { - if (_flags & EnvelopeVisible) { - gain_line->show (); + if (gain_line) { + if ((height/wcnt) < NAME_HIGHLIGHT_SIZE) { + gain_line->hide (); + } else { + if (_flags & EnvelopeVisible) { + gain_line->show (); + } } + gain_line->set_height ((uint32_t) rint (height - NAME_HIGHLIGHT_SIZE)); } manage_zero_line (); - gain_line->set_height ((uint32_t) rint (height - NAME_HIGHLIGHT_SIZE)); reset_fade_shapes (); - - name_text->raise_to_top(); + + if (name_text) { + name_text->raise_to_top(); + } } void @@ -565,6 +579,10 @@ AudioRegionView::reset_fade_in_shape () void AudioRegionView::reset_fade_in_shape_width (jack_nframes_t width) { + if (fade_in_handle == 0) { + return; + } + /* smallest size for a fade is 64 frames */ width = std::max ((jack_nframes_t) 64, width); @@ -645,6 +663,10 @@ AudioRegionView::reset_fade_out_shape () void AudioRegionView::reset_fade_out_shape_width (jack_nframes_t width) { + if (fade_out_handle == 0) { + return; + } + /* smallest size for a fade is 64 frames */ width = std::max ((jack_nframes_t) 64, width); @@ -732,7 +754,9 @@ AudioRegionView::set_samples_per_unit (gdouble spu) (*i)->set_duration (region.length() / samples_per_unit); } - gain_line->reset (); + if (gain_line) { + gain_line->reset (); + } reset_fade_shapes (); region_sync_changed (); } @@ -776,8 +800,13 @@ AudioRegionView::set_colors () { TimeAxisViewItem::set_colors (); - gain_line->set_line_color (region.envelope_active() ? color_map[cGainLine] : color_map[cGainLineInactive]); - sync_mark->property_fill_color_rgba() = fill_color; + if (gain_line) { + gain_line->set_line_color (region.envelope_active() ? color_map[cGainLine] : color_map[cGainLineInactive]); + } + + if (sync_mark) { + sync_mark->property_fill_color_rgba() = fill_color; + } for (uint32_t n=0; n < waves.size(); ++n) { if (region.muted()) { @@ -846,6 +875,10 @@ AudioRegionView::region_renamed () void AudioRegionView::region_sync_changed () { + if (sync_mark == 0) { + return; + } + int sync_dir; jack_nframes_t sync_offset; @@ -911,13 +944,15 @@ AudioRegionView::set_waveform_visible (bool yn) void AudioRegionView::temporarily_hide_envelope () { - gain_line->hide (); + if (gain_line) { + gain_line->hide (); + } } void AudioRegionView::unhide_envelope () { - if (_flags & EnvelopeVisible) { + if (gain_line && (_flags & EnvelopeVisible)) { gain_line->show (); } } @@ -925,7 +960,7 @@ AudioRegionView::unhide_envelope () void AudioRegionView::set_envelope_visible (bool yn) { - if ((_flags & EnvelopeVisible) != yn) { + if (gain_line && ((_flags & EnvelopeVisible) != yn)) { if (yn) { gain_line->show (); _flags |= EnvelopeVisible; @@ -1068,6 +1103,10 @@ AudioRegionView::peaks_ready_handler (uint32_t which) void AudioRegionView::add_gain_point_event (ArdourCanvas::Item *item, GdkEvent *ev) { + if (gain_line == 0) { + return; + } + double x, y; /* don't create points that can't be seen */ @@ -1274,7 +1313,7 @@ AudioRegionView::get_fill_color () void AudioRegionView::entered () { - if (_flags & EnvelopeVisible) { + if (gain_line && _flags & EnvelopeVisible) { gain_line->show_all_control_points (); } @@ -1282,27 +1321,35 @@ AudioRegionView::entered () UINT_TO_RGBA(fade_color,&r,&g,&b,&a); a=255; - fade_in_handle->property_fill_color_rgba() = RGBA_TO_UINT(r,g,b,a); - fade_out_handle->property_fill_color_rgba() = RGBA_TO_UINT(r,g,b,a); + if (fade_in_handle) { + fade_in_handle->property_fill_color_rgba() = RGBA_TO_UINT(r,g,b,a); + fade_out_handle->property_fill_color_rgba() = RGBA_TO_UINT(r,g,b,a); + } } void AudioRegionView::exited () { - gain_line->hide_all_but_selected_control_points (); + if (gain_line) { + gain_line->hide_all_but_selected_control_points (); + } uint32_t r,g,b,a; UINT_TO_RGBA(fade_color,&r,&g,&b,&a); a=0; - fade_in_handle->property_fill_color_rgba() = RGBA_TO_UINT(r,g,b,a); - fade_out_handle->property_fill_color_rgba() = RGBA_TO_UINT(r,g,b,a); + if (fade_in_handle) { + fade_in_handle->property_fill_color_rgba() = RGBA_TO_UINT(r,g,b,a); + fade_out_handle->property_fill_color_rgba() = RGBA_TO_UINT(r,g,b,a); + } } void AudioRegionView::envelope_active_changed () { - gain_line->set_line_color (region.envelope_active() ? color_map[cGainLine] : color_map[cGainLineInactive]); + if (gain_line) { + gain_line->set_line_color (region.envelope_active() ? color_map[cGainLine] : color_map[cGainLineInactive]); + } } void diff --git a/gtk2_ardour/regionview.h b/gtk2_ardour/regionview.h index 0ce154747f..03f8243231 100644 --- a/gtk2_ardour/regionview.h +++ b/gtk2_ardour/regionview.h @@ -52,11 +52,12 @@ class AudioRegionView : public TimeAxisViewItem AudioTimeAxisView&, ARDOUR::AudioRegion&, double initial_samples_per_unit, - double amplitude_above_axis, - Gdk::Color& base_color, - bool wait_for_waves); + Gdk::Color& basic_color); + ~AudioRegionView (); + virtual void init (double amplitude_above_axis, Gdk::Color& base_color, bool wait_for_waves); + ARDOUR::AudioRegion& region; // ok, let 'em have it bool is_valid() const { return valid; } void set_valid (bool yn) { valid = yn; } @@ -115,7 +116,20 @@ class AudioRegionView : public TimeAxisViewItem virtual void entered (); virtual void exited (); - private: + protected: + + /* this constructor allows derived types + to specify their visibility requirements + to the TimeAxisViewItem parent class + */ + + AudioRegionView (ArdourCanvas::Group *, + AudioTimeAxisView&, + ARDOUR::AudioRegion&, + double initial_samples_per_unit, + Gdk::Color& basic_color, + TimeAxisViewItem::Visibility); + enum Flags { EnvelopeVisible = 0x1, WaveformVisible = 0x4, @@ -178,7 +192,7 @@ class AudioRegionView : public TimeAxisViewItem void set_colors (); void compute_colors (Gdk::Color&); - void set_frame_color (); + virtual void set_frame_color (); void reset_width_dependent_items (double pixel_width); void set_waveview_data_src(); diff --git a/gtk2_ardour/streamview.cc b/gtk2_ardour/streamview.cc index dda5f0ef51..91a34de755 100644 --- a/gtk2_ardour/streamview.cc +++ b/gtk2_ardour/streamview.cc @@ -13,6 +13,7 @@ #include "streamview.h" #include "regionview.h" +#include "taperegionview.h" #include "audio_time_axis.h" #include "canvas-waveview.h" #include "canvas-simplerect.h" @@ -46,31 +47,15 @@ StreamView::StreamView (AudioTimeAxisView& tv) /* set_position() will position the group */ - //GTK2FIX -- how to get the group? is the canvas display really a group? - //canvas_group = gnome_canvas_item_new (GNOME_CANVAS_GROUP(_trackview.canvas_display), - // gnome_canvas_group_get_type (), - // NULL); canvas_group = new ArdourCanvas::Group(*_trackview.canvas_display); - //canvas_rect = gnome_canvas_item_new (GNOME_CANVAS_GROUP(canvas_group), - // gnome_canvas_simplerect_get_type(), - // "x1", 0.0, - // "y1", 0.0, - // "x2", 1000000.0, - // "y2", (double) tv.height, - // "outline_color_rgba", color_map[cAudioTrackOutline], - // /* outline ends and bottom */ - // "outline_what", (guint32) (0x1|0x2|0x8), - // "fill_color_rgba", stream_base_color, - // ] NULL); canvas_rect = new ArdourCanvas::SimpleRect (*canvas_group); canvas_rect->property_x1() = 0.0; canvas_rect->property_y1() = 0.0; canvas_rect->property_x2() = 1000000.0; canvas_rect->property_y2() = (double) tv.height; canvas_rect->property_outline_color_rgba() = color_map[cAudioTrackOutline]; - /* outline ends and bottom */ - canvas_rect->property_outline_what() = (guint32) (0x1|0x2|0x8); + canvas_rect->property_outline_what() = (guint32) (0x1|0x2|0x8); // outline ends and bottom canvas_rect->property_fill_color_rgba() = stream_base_color; canvas_rect->signal_event().connect (bind (mem_fun (_trackview.editor, &PublicEditor::canvas_stream_view_event), canvas_rect, &_trackview)); @@ -222,15 +207,19 @@ StreamView::add_region_view_internal (Region *r, bool wait_for_waves) return; } } + + switch (_trackview.audio_track()->mode()) { + case Normal: + region_view = new AudioRegionView (canvas_group, _trackview, *region, + _samples_per_unit, region_color); + break; + case Destructive: + region_view = new TapeAudioRegionView (canvas_group, _trackview, *region, + _samples_per_unit, region_color); + break; + } - region_view = new AudioRegionView (canvas_group, - _trackview, - *region, - _samples_per_unit, - _amplitude_above_axis, - region_color, - wait_for_waves); - + region_view->init (_amplitude_above_axis, region_color, wait_for_waves); region_views.push_front (region_view); /* follow global waveform setting */ diff --git a/gtk2_ardour/time_axis_view_item.cc b/gtk2_ardour/time_axis_view_item.cc index bab9e9e1b5..a9663b8630 100644 --- a/gtk2_ardour/time_axis_view_item.cc +++ b/gtk2_ardour/time_axis_view_item.cc @@ -64,7 +64,7 @@ const double TimeAxisViewItem::GRAB_HANDLE_LENGTH = 6 ; */ TimeAxisViewItem::TimeAxisViewItem(const string & it_name, ArdourCanvas::Group& parent, TimeAxisView& tv, double spu, Gdk::Color& base_color, jack_nframes_t start, jack_nframes_t duration, - Visibility visibility) + Visibility vis) : trackview (tv) { if (!have_name_font) { @@ -83,6 +83,7 @@ TimeAxisViewItem::TimeAxisViewItem(const string & it_name, ArdourCanvas::Group& max_item_duration = ARDOUR::max_frames; min_item_duration = 0 ; show_vestigial = true; + visibility = vis; if (duration == 0) { warning << "Time Axis Item Duration == 0" << endl ; @@ -108,14 +109,33 @@ TimeAxisViewItem::TimeAxisViewItem(const string & it_name, ArdourCanvas::Group& frame->property_outline_color_rgba() = color_map[cTimeAxisFrameOutline]; frame->property_fill_color_rgba() = color_map[cTimeAxisFrameFill]; + /* by default draw all 4 edges */ + + uint32_t outline_what = 0x1|0x2|0x4|0x8; + + if (visibility & HideFrameLR) { + outline_what &= ~(0x1 | 0x2); + } + + if (visibility & HideFrameTB) { + outline_what &= ~(0x4 | 0x8); + } + + frame->property_outline_what() = outline_what; + } else { frame = 0; } if (visibility & ShowNameHighlight) { name_highlight = new ArdourCanvas::SimpleRect (*group); - name_highlight->property_x1() = (double) 1.0; - name_highlight->property_x2() = (double) (trackview.editor.frame_to_pixel(item_duration)) - 1; + if (visibility & FullWidthNameHighlight) { + name_highlight->property_x1() = (double) 0.0; + name_highlight->property_x2() = (double) (trackview.editor.frame_to_pixel(item_duration)); + } else { + name_highlight->property_x1() = (double) 1.0; + name_highlight->property_x2() = (double) (trackview.editor.frame_to_pixel(item_duration)) - 1; + } name_highlight->property_y1() = (double) (trackview.height - TimeAxisViewItem::NAME_HIGHLIGHT_SIZE); name_highlight->property_y2() = (double) (trackview.height - 1); name_highlight->property_outline_color_rgba() = color_map[cNameHighlightFill]; @@ -508,10 +528,14 @@ TimeAxisViewItem::set_height(double height) if (name_highlight) { if (height < NAME_HIGHLIGHT_THRESH) { name_highlight->hide(); - name_text->hide(); + if (name_text) { + name_text->hide(); + } } else { name_highlight->show(); - name_text->show(); + if (name_text) { + name_text->show(); + } } if (height > NAME_HIGHLIGHT_SIZE) { @@ -567,7 +591,7 @@ TimeAxisViewItem::get_canvas_frame() ArdourCanvas::Item* TimeAxisViewItem::get_canvas_group() { - return(group) ; + return (group) ; } /** @@ -576,7 +600,7 @@ TimeAxisViewItem::get_canvas_group() ArdourCanvas::Item* TimeAxisViewItem::get_name_highlight() { - return(name_highlight) ; + return (name_highlight) ; } /** @@ -585,7 +609,7 @@ TimeAxisViewItem::get_name_highlight() ArdourCanvas::Text* TimeAxisViewItem::get_name_text() { - return(name_text) ; + return (name_text) ; } /** @@ -780,7 +804,9 @@ TimeAxisViewItem::reset_width_dependent_items (double pixel_width) if (name_highlight) { name_highlight->hide(); - name_text->hide(); + if (name_text) { + name_text->hide(); + } } if (frame) { @@ -801,14 +827,23 @@ TimeAxisViewItem::reset_width_dependent_items (double pixel_width) if (height < NAME_HIGHLIGHT_THRESH) { name_highlight->hide(); - name_text->hide(); + if (name_text) { + name_text->hide(); + } } else { name_highlight->show(); - name_text->show(); - reset_name_width (pixel_width); + if (name_text) { + name_text->show(); + reset_name_width (pixel_width); + } + } + + if (visibility & FullWidthNameHighlight) { + name_highlight->property_x2() = pixel_width; + } else { + name_highlight->property_x2() = pixel_width - 1.0; } - name_highlight->property_x2() = pixel_width - 1.0; } if (frame) { diff --git a/gtk2_ardour/time_axis_view_item.h b/gtk2_ardour/time_axis_view_item.h index d33738cc8b..b1e9939449 100644 --- a/gtk2_ardour/time_axis_view_item.h +++ b/gtk2_ardour/time_axis_view_item.h @@ -326,7 +326,10 @@ class TimeAxisViewItem : public sigc::trackable, public Selectable ShowFrame = 0x1, ShowNameHighlight = 0x2, ShowNameText = 0x4, - ShowHandles = 0x8 + ShowHandles = 0x8, + HideFrameLR = 0x10, + HideFrameTB = 0x20, + FullWidthNameHighlight = 0x40 }; /** @@ -454,6 +457,8 @@ class TimeAxisViewItem : public sigc::trackable, public Selectable ArdourCanvas::SimpleRect* frame_handle_start; ArdourCanvas::SimpleRect* frame_handle_end; + Visibility visibility; + }; /* class TimeAxisViewItem */ #endif /* __gtk_ardour_time_axis_view_item_h__ */ diff --git a/libs/ardour/ardour/audioengine.h b/libs/ardour/ardour/audioengine.h index d349f5bae5..9fe3ce5424 100644 --- a/libs/ardour/ardour/audioengine.h +++ b/libs/ardour/ardour/audioengine.h @@ -102,24 +102,24 @@ class AudioEngine : public sigc::trackable virtual const char *what() const throw() { return "could not connect to engine backend"; } }; - Port *register_audio_input_port (const string& portname); - Port *register_audio_output_port (const string& portname); + Port *register_audio_input_port (const std::string& portname); + Port *register_audio_output_port (const std::string& portname); int unregister_port (Port *); - int connect (const string& source, const string& destination); - int disconnect (const string& source, const string& destination); + int connect (const std::string& source, const std::string& destination); + int disconnect (const std::string& source, const std::string& destination); int disconnect (Port *); - const char ** get_ports (const string& port_name_pattern, const string& type_name_pattern, uint32_t flags); + const char ** get_ports (const std::string& port_name_pattern, const std::string& type_name_pattern, uint32_t flags); uint32_t n_physical_outputs () const; uint32_t n_physical_inputs () const; - string get_nth_physical_output (uint32_t n) { + std::string get_nth_physical_output (uint32_t n) { return get_nth_physical (n, JackPortIsInput); } - string get_nth_physical_input (uint32_t n) { + std::string get_nth_physical_input (uint32_t n) { return get_nth_physical (n, JackPortIsOutput); } @@ -130,7 +130,7 @@ class AudioEngine : public sigc::trackable the return value */ - Port *get_port_by_name (const string& name, bool keep = true); + Port *get_port_by_name (const std::string& name, bool keep = true); enum TransportState { TransportStopped = JackTransportStopped, @@ -215,7 +215,7 @@ class AudioEngine : public sigc::trackable PortConnections port_connections; void remove_connections_for (Port*); - string get_nth_physical (uint32_t which, int flags); + std::string get_nth_physical (uint32_t which, int flags); static int _xrun_callback (void *arg); static int _graph_order_callback (void *arg); diff --git a/libs/ardour/ardour/configuration.h b/libs/ardour/ardour/configuration.h index c0a1301318..8ae0c0f73a 100644 --- a/libs/ardour/ardour/configuration.h +++ b/libs/ardour/ardour/configuration.h @@ -29,8 +29,6 @@ #include #include -using std::string; - class XMLNode; namespace ARDOUR { @@ -42,21 +40,21 @@ class Configuration : public Stateful virtual ~Configuration(); struct MidiPortDescriptor { - string tag; - string device; - string type; - string mode; + std::string tag; + std::string device; + std::string type; + std::string mode; MidiPortDescriptor (const XMLNode&); XMLNode& get_state(); }; - std::map midi_ports; + std::map midi_ports; int load_state (); int save_state (); - XMLNode& option_node (const string &, const string &); + XMLNode& option_node (const std::string &, const std::string &); int set_state (const XMLNode&); XMLNode& get_state (void); @@ -76,8 +74,8 @@ class Configuration : public Stateful bool get_trace_midi_output (); void set_trace_midi_output (bool); - string get_raid_path(); - void set_raid_path(string); + std::string get_raid_path(); + void set_raid_path(std::string); uint32_t get_minimum_disk_io(); void set_minimum_disk_io(uint32_t); @@ -88,11 +86,11 @@ class Configuration : public Stateful bool does_hiding_groups_deactivates_groups(); void set_hiding_groups_deactivates_groups(bool); - string get_auditioner_output_left(); - void set_auditioner_output_left(string); + std::string get_auditioner_output_left(); + void set_auditioner_output_left(std::string); - string get_auditioner_output_right(); - void set_auditioner_output_right(string); + std::string get_auditioner_output_right(); + void set_auditioner_output_right(std::string); bool get_mute_affects_pre_fader(); void set_mute_affects_pre_fader (bool); @@ -112,14 +110,14 @@ class Configuration : public Stateful uint32_t get_disk_choice_space_threshold(); void set_disk_choice_space_threshold (uint32_t); - string get_mmc_port_name(); - void set_mmc_port_name(string); + std::string get_mmc_port_name(); + void set_mmc_port_name(std::string); - string get_mtc_port_name(); - void set_mtc_port_name(string); - - string get_midi_port_name(); - void set_midi_port_name(string); + std::string get_mtc_port_name(); + void set_mtc_port_name(std::string); + + std::string get_midi_port_name(); + void set_midi_port_name(std::string); uint32_t get_midi_feedback_interval_ms(); void set_midi_feedback_interval_ms (uint32_t); @@ -163,25 +161,28 @@ class Configuration : public Stateful bool get_timecode_source_is_synced (); void set_timecode_source_is_synced (bool); - string get_user_ardour_path (); - string get_system_ardour_path (); + std::string get_user_ardour_path (); + std::string get_system_ardour_path (); gain_t get_quieten_at_speed (); void set_quieten_at_speed (gain_t); + + std::string get_tape_dir (); + void set_tape_dir (std::string); private: void set_defaults (); - string get_system_path(); - string get_user_path(); + std::string get_system_path(); + std::string get_user_path(); /* this is subject to wordexp, so we need to keep the original (user-entered) form around. e.g. ~/blah-> /home/foo/blah */ - string raid_path; + std::string raid_path; bool raid_path_is_user; - string orig_raid_path; + std::string orig_raid_path; uint32_t minimum_disk_io_bytes; bool minimum_disk_io_bytes_is_user; @@ -189,9 +190,9 @@ class Configuration : public Stateful bool track_buffer_seconds_is_user; bool hiding_groups_deactivates_groups; bool hiding_groups_deactivates_groups_is_user; - string auditioner_output_left; + std::string auditioner_output_left; bool auditioner_output_left_is_user; - string auditioner_output_right; + std::string auditioner_output_right; bool auditioner_output_right_is_user; bool mute_affects_pre_fader; bool mute_affects_pre_fader_is_user; @@ -205,11 +206,11 @@ class Configuration : public Stateful bool solo_latch_is_user; uint32_t disk_choice_space_threshold; bool disk_choice_space_threshold_is_user; - string mtc_port_name; + std::string mtc_port_name; bool mtc_port_name_is_user; - string mmc_port_name; + std::string mmc_port_name; bool mmc_port_name_is_user; - string midi_port_name; + std::string midi_port_name; bool midi_port_name_is_user; bool use_hardware_monitoring; bool use_hardware_monitoring_is_user; @@ -248,6 +249,8 @@ class Configuration : public Stateful bool midi_feedback_interval_ms_is_user; bool latched_record_enable; bool latched_record_enable_is_user; + std::string tape_dir; + bool tape_dir_is_user; XMLNode *key_node; bool user_configuration; diff --git a/libs/ardour/ardour/port.h b/libs/ardour/ardour/port.h index e5edcf72ac..ff9c25e1c4 100644 --- a/libs/ardour/ardour/port.h +++ b/libs/ardour/ardour/port.h @@ -53,15 +53,15 @@ class Port : public sigc::trackable { silent = false; } - string name() { + std::string name() { return _name; } - string short_name() { + std::string short_name() { return jack_port_short_name (port); } - int set_name (string str); + int set_name (std::string str); JackPortFlags flags() const { return _flags; @@ -79,7 +79,7 @@ class Port : public sigc::trackable { return jack_port_connected (port); } - bool connected_to (const string& portname) const { + bool connected_to (const std::string& portname) const { return jack_port_connected_to (port, portname.c_str()); } @@ -191,8 +191,8 @@ class Port : public sigc::trackable { */ JackPortFlags _flags; - string _type; - string _name; + std::string _type; + std::string _name; bool last_monitor : 1; bool silent : 1; diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h index d4ca8c1ddc..7f0bc57e7b 100644 --- a/libs/ardour/ardour/session.h +++ b/libs/ardour/ardour/session.h @@ -243,10 +243,11 @@ class Session : public sigc::trackable, public Stateful bool dirty() const { return _state_of_the_state & Dirty; } sigc::signal DirtyChanged; - string sound_dir () const; - string peak_dir () const; - string dead_sound_dir () const; - string automation_dir () const; + std::string sound_dir () const; + std::string tape_dir () const; + std::string peak_dir () const; + std::string dead_sound_dir () const; + std::string automation_dir () const; static string template_path (); static string template_dir (); @@ -1618,10 +1619,11 @@ class Session : public sigc::trackable, public Stateful PBD::Lock space_lock; static const char* sound_dir_name; + static const char* tape_dir_name; static const char* dead_sound_dir_name; static const char* peak_dir_name; - string discover_best_sound_dir (); + string discover_best_sound_dir (bool destructive = false); int ensure_sound_dir (string, string&); void refresh_disk_space (); diff --git a/libs/ardour/ardour/utils.h b/libs/ardour/ardour/utils.h index 36ee6f105f..2fc6fa6e50 100644 --- a/libs/ardour/ardour/utils.h +++ b/libs/ardour/ardour/utils.h @@ -29,13 +29,11 @@ class XMLNode; -using std::ostream; - void elapsed_time_to_str (char *buf, uint32_t seconds); -string legalize_for_path (std::string str); -ostream& operator<< (ostream& o, const ARDOUR::BBT_Time& bbt); +std::string legalize_for_path (std::string str); +std::ostream& operator<< (std::ostream& o, const ARDOUR::BBT_Time& bbt); XMLNode* find_named_node (const XMLNode& node, std::string name); -string placement_as_string (ARDOUR::Placement); +std::string placement_as_string (ARDOUR::Placement); static inline float f_max(float x, float a) { x -= a; @@ -48,12 +46,12 @@ static inline float f_max(float x, float a) { int cmp_nocase (const std::string& s, const std::string& s2); -int tokenize_fullpath (string fullpath, string& path, string& name); +int tokenize_fullpath (std::string fullpath, std::string& path, std::string& name); -int touch_file(string path); +int touch_file(std::string path); uint32_t long get_uid(); -string region_name_from_path (string path); +std::string region_name_from_path (std::string path); #endif /* __ardour_utils_h__ */ diff --git a/libs/ardour/configuration.cc b/libs/ardour/configuration.cc index 61d288ab51..3b4ad4b45f 100644 --- a/libs/ardour/configuration.cc +++ b/libs/ardour/configuration.cc @@ -294,6 +294,11 @@ Configuration::state (bool user_only) if (!user_only || latched_record_enable_is_user) { node->add_child_nocopy(option_node("latched-record-enable", latched_record_enable?"yes":"no")); } + if (!user_only || tape_dir_is_user) { + if (!tape_dir.empty()) { + node->add_child_nocopy(option_node("tape-dir", tape_dir)); + } + } /* use-vst is always per-user */ node->add_child_nocopy (option_node ("use-vst", use_vst?"yes":"no")); @@ -436,6 +441,8 @@ Configuration::set_state (const XMLNode& root) set_midi_feedback_interval_ms (atoi (option_value.c_str())); } else if (option_name == "latched-record-enable") { set_latched_record_enable (option_value == "yes"); + } else if (option_name == "tape-dir") { + set_tape_dir (option_value); } } @@ -492,6 +499,7 @@ Configuration::set_defaults () timecode_source_is_synced = true; use_vst = true; /* if we build with VST_SUPPORT, otherwise no effect */ quieten_at_speed = true; + tape_dir = ""; midi_feedback_interval_ms = 100; @@ -532,6 +540,7 @@ Configuration::set_defaults () quieten_at_speed_is_user = false; midi_feedback_interval_ms_is_user = false; latched_record_enable_is_user = false; + tape_dir_is_user = false; } Configuration::MidiPortDescriptor::MidiPortDescriptor (const XMLNode& node) @@ -1151,3 +1160,15 @@ Configuration::get_latched_record_enable () { return latched_record_enable; } + +string +Configuration::get_tape_dir () +{ + return tape_dir; +} + +void +Configuration::set_tape_dir (string path) +{ + tape_dir = path; +} diff --git a/libs/ardour/destructive_filesource.cc b/libs/ardour/destructive_filesource.cc index 8715c5f283..6e3ca0ef78 100644 --- a/libs/ardour/destructive_filesource.cc +++ b/libs/ardour/destructive_filesource.cc @@ -117,8 +117,6 @@ DestructiveFileSource::setup_standard_crossfades (jack_nframes_t rate) int DestructiveFileSource::seek (jack_nframes_t frame) { -// file_pos = data_offset + (sizeof (Sample) * frame); - cerr << _name << " Seek to " << frame << " = " << data_offset + (_sample_size * frame) << endl; return 0; } diff --git a/libs/ardour/diskstream.cc b/libs/ardour/diskstream.cc index 30f365ae32..a3daaf2ff0 100644 --- a/libs/ardour/diskstream.cc +++ b/libs/ardour/diskstream.cc @@ -1701,7 +1701,6 @@ DiskStream::finish_capture (bool rec_monitors_input) was_recording = false; if (_flags & Recordable) { - cerr << "STOP CAPTURE\n"; for (ChannelList::iterator chan = channels.begin(); chan != channels.end(); ++chan) { (*chan).write_source->mark_capture_end (); } diff --git a/libs/ardour/port.cc b/libs/ardour/port.cc index 9d6a90aa54..c5c03d0a05 100644 --- a/libs/ardour/port.cc +++ b/libs/ardour/port.cc @@ -21,6 +21,7 @@ #include "ardour/port.h" using namespace ARDOUR; +using namespace std; Port::Port (jack_port_t *p) : port (p) diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc index e0c6c1bf7e..0b5cd8f3c1 100644 --- a/libs/ardour/session.cc +++ b/libs/ardour/session.cc @@ -76,6 +76,7 @@ const char* Session::_template_suffix = X_(".template"); const char* Session::_statefile_suffix = X_(".ardour"); const char* Session::_pending_suffix = X_(".pending"); const char* Session::sound_dir_name = X_("sounds"); +const char* Session::tape_dir_name = X_("tapes"); const char* Session::peak_dir_name = X_("peaks"); const char* Session::dead_sound_dir_name = X_("dead_sounds"); @@ -2658,7 +2659,12 @@ Session::create_file_source (DiskStream& ds, int32_t chan, bool destructive) for (i = session_dirs.begin(); i != session_dirs.end(); ++i) { spath = (*i).path; - spath += sound_dir_name; + + if (destructive) { + spath += tape_dir_name; + } else { + spath += sound_dir_name; + } spath += '/'; spath += legalized; diff --git a/libs/ardour/session_butler.cc b/libs/ardour/session_butler.cc index 00a2465d9b..bec34469ff 100644 --- a/libs/ardour/session_butler.cc +++ b/libs/ardour/session_butler.cc @@ -193,7 +193,7 @@ Session::butler_thread_work () << endmsg; break; } - + if (pfd[0].revents & ~POLLIN) { error << _("Error on butler thread request pipe") << endmsg; break; @@ -242,9 +242,9 @@ Session::butler_thread_work () } } -// for (DiskStreamList::iterator i = diskstreams.begin(); i != diskstreams.end(); ++i) { -// cerr << "BEFORE " << (*i)->name() << ": pb = " << (*i)->playback_buffer_load() << " cp = " << (*i)->capture_buffer_load() << endl; -// } + for (i = diskstreams.begin(); i != diskstreams.end(); ++i) { + // cerr << "BEFORE " << (*i)->name() << ": pb = " << (*i)->playback_buffer_load() << " cp = " << (*i)->capture_buffer_load() << endl; + } if (transport_work_requested()) { butler_transport_work (); diff --git a/libs/ardour/session_state.cc b/libs/ardour/session_state.cc index 45a51e813b..bd80ad50a5 100644 --- a/libs/ardour/session_state.cc +++ b/libs/ardour/session_state.cc @@ -486,6 +486,15 @@ Session::create (bool& new_session, string* mix_template, jack_nframes_t initial } } + dir = tape_dir (); + + if (mkdir (dir.c_str(), 0755) < 0) { + if (errno != EEXIST) { + error << string_compose(_("Session: cannot create session tape dir \"%1\" (%2)"), dir, strerror (errno)) << endmsg; + return -1; + } + } + dir = dead_sound_dir (); if (mkdir (dir.c_str(), 0755) < 0) { @@ -1956,11 +1965,17 @@ Session::ensure_sound_dir (string path, string& result) } string -Session::discover_best_sound_dir () +Session::discover_best_sound_dir (bool destructive) { vector::iterator i; string result; + /* destructive files all go into the same place */ + + if (destructive) { + return tape_dir(); + } + /* handle common case without system calls */ if (session_dirs.size() == 1) { @@ -1968,7 +1983,7 @@ Session::discover_best_sound_dir () } /* OK, here's the algorithm we're following here: - + We want to select which directory to use for the next file source to be created. Ideally, we'd like to use a round-robin process so as to @@ -2174,6 +2189,21 @@ Session::sound_dir () const return res; } +string +Session::tape_dir () const +{ + string res = Config->get_tape_dir(); + + if (!res.empty()) { + return res; + } + + res = _path; + res += tape_dir_name; + res += '/'; + return res; +} + string Session::peak_dir () const { diff --git a/libs/midi++2/mmc.cc b/libs/midi++2/mmc.cc index 0d369db433..3e1aefd4eb 100644 --- a/libs/midi++2/mmc.cc +++ b/libs/midi++2/mmc.cc @@ -475,7 +475,7 @@ MachineControl::write_track_record_ready (byte *msg, size_t len) { size_t n; - size_t base_track; + ssize_t base_track; /* Bits 0-4 of the first byte are for special tracks: