mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-20 13:46:30 +01:00
AU GUIs basically working, though unfinished; push up dialog for massive split operations (still in progress); fix problem where peakfile is slightly older than audio data even though it is ready to use (debugging output still present); move sync-menu code to libs/gtkmm2ext for linkage reasons; prevent flush_pending() calls from "top menu" items on OS X from locking the GUI; try to make adding lots of regions (e.g. from split-at-points) scale a bit better; SAE version has no timecode mode for audio clocks
git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@3038 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
7999372fac
commit
a1955a82e8
33 changed files with 401 additions and 247 deletions
|
|
@ -92,7 +92,6 @@ au_pluginui.mm
|
|||
""")
|
||||
|
||||
gtkosx_files=Split("""
|
||||
sync-menu.c
|
||||
cocoacarbon.mm
|
||||
""")
|
||||
|
||||
|
|
|
|||
|
|
@ -66,7 +66,6 @@
|
|||
<menuitem action='playhead-to-edit'/>
|
||||
<menuitem action='focus-on-clock'/>
|
||||
<separator/>
|
||||
<menuitem action='ToggleTimeMaster'/>
|
||||
<menuitem action='TogglePunchIn'/>
|
||||
<menuitem action='TogglePunchOut'/>
|
||||
<menuitem action='ToggleAutoInput'/>
|
||||
|
|
|
|||
|
|
@ -338,7 +338,11 @@ ARDOUR_UI::post_engine ()
|
|||
|
||||
/* set default clock modes */
|
||||
|
||||
if (Profile->get_sae()) {
|
||||
primary_clock.set_mode (AudioClock::MinSec);
|
||||
} else {
|
||||
primary_clock.set_mode (AudioClock::SMPTE);
|
||||
}
|
||||
secondary_clock.set_mode (AudioClock::BBT);
|
||||
|
||||
/* start the time-of-day-clock */
|
||||
|
|
|
|||
|
|
@ -37,7 +37,10 @@
|
|||
#include "engine_dialog.h"
|
||||
#include "editor.h"
|
||||
#include "actions.h"
|
||||
#include "sync-menu.h"
|
||||
|
||||
#ifdef GTKOSX
|
||||
#include <gtkmm2ext/sync-menu.h>
|
||||
#endif
|
||||
|
||||
#include <ardour/session.h>
|
||||
#include <ardour/profile.h>
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@ class AUPluginUI : public PlugUIBase, public Gtk::VBox
|
|||
virtual void activate ();
|
||||
virtual void deactivate ();
|
||||
|
||||
void lower_box_realized ();
|
||||
void on_realize ();
|
||||
void on_show ();
|
||||
void on_hide ();
|
||||
|
|
@ -49,6 +50,10 @@ class AUPluginUI : public PlugUIBase, public Gtk::VBox
|
|||
int prefheight;
|
||||
int prefwidth;
|
||||
|
||||
Gtk::HBox top_box;
|
||||
Gtk::EventBox low_box;
|
||||
Gtk::VBox vpacker;
|
||||
|
||||
/* Cocoa */
|
||||
|
||||
NSWindow* cocoa_window;
|
||||
|
|
@ -62,14 +67,11 @@ class AUPluginUI : public PlugUIBase, public Gtk::VBox
|
|||
AudioUnitCarbonView editView;
|
||||
WindowRef carbon_window;
|
||||
EventHandlerRef carbon_event_handler;
|
||||
bool carbon_parented;
|
||||
bool cocoa_parented;
|
||||
bool _activating_from_app;
|
||||
|
||||
void test_view_support (bool&, bool&);
|
||||
bool test_cocoa_view_support ();
|
||||
bool test_carbon_view_support ();
|
||||
int create_carbon_view (bool generic);
|
||||
int create_carbon_view ();
|
||||
int create_cocoa_view ();
|
||||
|
||||
int parent_carbon_window ();
|
||||
|
|
|
|||
|
|
@ -2,6 +2,9 @@
|
|||
#include <ardour/audio_unit.h>
|
||||
#include <ardour/insert.h>
|
||||
|
||||
#undef check // stupid gtk, stupid apple
|
||||
|
||||
#include <gtkmm/button.h>
|
||||
#include <gdk/gdkquartz.h>
|
||||
|
||||
#include "au_pluginui.h"
|
||||
|
|
@ -32,43 +35,54 @@ AUPluginUI::AUPluginUI (boost::shared_ptr<PluginInsert> insert)
|
|||
throw failed_constructor ();
|
||||
}
|
||||
|
||||
bool has_carbon;
|
||||
bool has_cocoa;
|
||||
/* stuff some stuff into the top of the window */
|
||||
|
||||
Gtk::Button* button = manage (new Gtk::Button ("press me"));
|
||||
Gtk::Label* label = manage (new Gtk::Label ("hello, world!"));
|
||||
|
||||
top_box.set_spacing (6);
|
||||
top_box.set_border_width (6);
|
||||
top_box.pack_start (*button, false, false);
|
||||
top_box.pack_start (*label, false, true);
|
||||
|
||||
set_spacing (6);
|
||||
pack_start (top_box, false, false);
|
||||
pack_start (low_box, false, false);
|
||||
|
||||
button->show ();
|
||||
label->show ();
|
||||
top_box.show ();
|
||||
low_box.show ();
|
||||
|
||||
_activating_from_app = false;
|
||||
carbon_parented = false;
|
||||
cocoa_parented = false;
|
||||
cocoa_parent = 0;
|
||||
cocoa_window = 0;
|
||||
au_view = 0;
|
||||
|
||||
test_view_support (has_carbon, has_cocoa);
|
||||
/* prefer cocoa, fall back to cocoa, but use carbon if its there */
|
||||
|
||||
if (has_cocoa) {
|
||||
if (test_cocoa_view_support()) {
|
||||
create_cocoa_view ();
|
||||
} else if (has_carbon) {
|
||||
create_carbon_view (has_carbon);
|
||||
} else if (test_carbon_view_support()) {
|
||||
create_carbon_view ();
|
||||
} else {
|
||||
/* fallback to cocoa */
|
||||
create_cocoa_view ();
|
||||
}
|
||||
}
|
||||
|
||||
low_box.signal_realize().connect (mem_fun (this, &AUPluginUI::lower_box_realized));
|
||||
}
|
||||
|
||||
AUPluginUI::~AUPluginUI ()
|
||||
{
|
||||
if (carbon_parented) {
|
||||
if (cocoa_parent) {
|
||||
NSWindow* win = get_nswindow();
|
||||
RemoveEventHandler(carbon_event_handler);
|
||||
[win removeChildWindow:cocoa_parent];
|
||||
}
|
||||
} else if (carbon_window) {
|
||||
/* never parented */
|
||||
DisposeWindow (carbon_window);
|
||||
}
|
||||
|
||||
void
|
||||
AUPluginUI::test_view_support (bool& has_carbon, bool& has_cocoa)
|
||||
{
|
||||
has_carbon = test_carbon_view_support();
|
||||
has_cocoa = test_cocoa_view_support();
|
||||
}
|
||||
|
||||
bool
|
||||
|
|
@ -216,24 +230,16 @@ AUPluginUI::create_cocoa_view ()
|
|||
}
|
||||
|
||||
if (!wasAbleToLoadCustomView) {
|
||||
// [B] Otherwise show generic Cocoa view
|
||||
// load generic Cocoa view
|
||||
au_view = [[AUGenericView alloc] initWithAudioUnit:*au->get_au()];
|
||||
[(AUGenericView *)au_view setShowsExpertParameters:YES];
|
||||
}
|
||||
|
||||
/* make a child cocoa window */
|
||||
|
||||
cocoa_window = [[NSWindow alloc]
|
||||
initWithContentRect:crect
|
||||
styleMask:NSBorderlessWindowMask
|
||||
backing:NSBackingStoreBuffered
|
||||
defer:NO];
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
AUPluginUI::create_carbon_view (bool generic)
|
||||
AUPluginUI::create_carbon_view ()
|
||||
{
|
||||
OSStatus err;
|
||||
ControlRef root_control;
|
||||
|
|
@ -252,7 +258,7 @@ AUPluginUI::create_carbon_view (bool generic)
|
|||
kWindowNoShadowAttribute|
|
||||
kWindowNoTitleBarAttribute);
|
||||
|
||||
if ((err = CreateNewWindow(kFloatingWindowClass, attr, &r, &carbon_window)) != noErr) {
|
||||
if ((err = CreateNewWindow(kDocumentWindowClass, attr, &r, &carbon_window)) != noErr) {
|
||||
error << string_compose (_("AUPluginUI: cannot create carbon window (err: %1)"), err) << endmsg;
|
||||
return -1;
|
||||
}
|
||||
|
|
@ -277,14 +283,13 @@ AUPluginUI::create_carbon_view (bool generic)
|
|||
GetControlBounds(viewPane, &bounds);
|
||||
size.x = bounds.right-bounds.left;
|
||||
size.y = bounds.bottom-bounds.top;
|
||||
SizeWindow(carbon_window, (short) (size.x + 0.5), (short) (size.y + 0.5), true);
|
||||
|
||||
prefwidth = (int) (size.x + 0.5);
|
||||
prefheight = (int) (size.y + 0.5);
|
||||
|
||||
#if 0
|
||||
mViewPaneResizer->WantEventTypes (GetControlEventTarget(mAUViewPane), GetEventTypeCount(resizeEvent), resizeEvent);
|
||||
#endif
|
||||
SizeWindow (carbon_window, prefwidth, prefheight, true);
|
||||
low_box.set_size_request (prefwidth, prefheight);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -311,22 +316,24 @@ AUPluginUI::get_nswindow ()
|
|||
void
|
||||
AUPluginUI::activate ()
|
||||
{
|
||||
NSWindow* win = get_nswindow ();
|
||||
[win setLevel:NSFloatingWindowLevel];
|
||||
cerr << "AUPluginUI:: activate!\n";
|
||||
|
||||
if (carbon_parented) {
|
||||
[cocoa_parent makeKeyAndOrderFront:nil];
|
||||
cerr << "APP activated, activate carbon window\n";
|
||||
if (carbon_window && cocoa_parent) {
|
||||
cerr << "APP activated, activate carbon window " << insert->name() << endl;
|
||||
_activating_from_app = true;
|
||||
ActivateWindow (carbon_window, TRUE);
|
||||
_activating_from_app = false;
|
||||
[cocoa_parent makeKeyAndOrderFront:nil];
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
AUPluginUI::deactivate ()
|
||||
{
|
||||
/* nothing to do here */
|
||||
cerr << "APP DEactivated, for " << insert->name() << endl;
|
||||
_activating_from_app = true;
|
||||
ActivateWindow (carbon_window, FALSE);
|
||||
_activating_from_app = false;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -339,15 +346,18 @@ _carbon_event (EventHandlerCallRef nextHandlerRef, EventRef event, void *userDat
|
|||
OSStatus
|
||||
AUPluginUI::carbon_event (EventHandlerCallRef nextHandlerRef, EventRef event)
|
||||
{
|
||||
cerr << "CARBON EVENT\n";
|
||||
|
||||
UInt32 eventKind = GetEventKind(event);
|
||||
ClickActivationResult howToHandleClick;
|
||||
Gtk::Container* toplevel = get_toplevel();
|
||||
NSWindow* win = get_nswindow ();
|
||||
|
||||
cerr << "window " << win << " carbon event type " << eventKind << endl;
|
||||
|
||||
switch (eventKind) {
|
||||
case kEventWindowHandleActivate:
|
||||
cerr << "carbon window activated\n";
|
||||
cerr << "carbon window for " << insert->name() << " activated\n";
|
||||
if (_activating_from_app) {
|
||||
cerr << "app activation, ignore window activation\n";
|
||||
return noErr;
|
||||
|
|
@ -357,12 +367,14 @@ AUPluginUI::carbon_event (EventHandlerCallRef nextHandlerRef, EventRef event)
|
|||
break;
|
||||
|
||||
case kEventWindowHandleDeactivate:
|
||||
cerr << "carbon window deactivated\n";
|
||||
return eventNotHandledErr;
|
||||
cerr << "carbon window for " << insert->name() << " deactivated\n";
|
||||
// never deactivate the carbon window
|
||||
return noErr;
|
||||
break;
|
||||
|
||||
case kEventWindowGetClickActivation:
|
||||
cerr << "carbon window CLICK activated\n";
|
||||
[win makeKeyAndOrderFront:nil];
|
||||
howToHandleClick = kActivateAndHandleClick;
|
||||
SetEventParameter(event, kEventParamClickActivation, typeClickActivationResult,
|
||||
sizeof(ClickActivationResult), &howToHandleClick);
|
||||
|
|
@ -377,6 +389,8 @@ AUPluginUI::parent_carbon_window ()
|
|||
{
|
||||
NSWindow* win = get_nswindow ();
|
||||
int x, y;
|
||||
int tbx, tby;
|
||||
|
||||
|
||||
if (!win) {
|
||||
return -1;
|
||||
|
|
@ -400,7 +414,9 @@ AUPluginUI::parent_carbon_window ()
|
|||
|
||||
int titlebar_height = wm_frame.size.height - content_frame.size.height;
|
||||
|
||||
MoveWindow (carbon_window, x, y + titlebar_height, false);
|
||||
int packing_extra = 6; // this is the total vertical packing in our top level window
|
||||
|
||||
MoveWindow (carbon_window, x, y + titlebar_height + top_box.get_height() + packing_extra, false);
|
||||
ShowWindow (carbon_window);
|
||||
|
||||
// create the cocoa window for the carbon one and make it visible
|
||||
|
|
@ -408,8 +424,7 @@ AUPluginUI::parent_carbon_window ()
|
|||
|
||||
EventTypeSpec windowEventTypes[] = {
|
||||
{kEventClassWindow, kEventWindowGetClickActivation },
|
||||
{kEventClassWindow, kEventWindowHandleDeactivate },
|
||||
{kEventClassWindow, kEventWindowHandleActivate }
|
||||
{kEventClassWindow, kEventWindowHandleDeactivate }
|
||||
};
|
||||
|
||||
EventHandlerUPP ehUPP = NewEventHandlerUPP(_carbon_event);
|
||||
|
|
@ -421,10 +436,6 @@ AUPluginUI::parent_carbon_window ()
|
|||
}
|
||||
|
||||
[win addChildWindow:cocoa_parent ordered:NSWindowAbove];
|
||||
[win setLevel:NSFloatingWindowLevel];
|
||||
[win setHidesOnDeactivate:YES];
|
||||
|
||||
carbon_parented = true;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -433,6 +444,8 @@ int
|
|||
AUPluginUI::parent_cocoa_window ()
|
||||
{
|
||||
NSWindow* win = get_nswindow ();
|
||||
NSView* packView = 0;
|
||||
NSRect packFrame;
|
||||
|
||||
if (!win) {
|
||||
return -1;
|
||||
|
|
@ -446,9 +459,11 @@ AUPluginUI::parent_cocoa_window ()
|
|||
}
|
||||
|
||||
// Get the size of the new AU View's frame
|
||||
NSRect au_view_frame = [au_view frame];
|
||||
packFrame = [au_view frame];
|
||||
packFrame.origin.x = 0;
|
||||
packFrame.origin.y = 0;
|
||||
|
||||
if (au_view_frame.size.width > 500 || au_view_frame.size.height > 500) {
|
||||
if (packFrame.size.width > 500 || packFrame.size.height > 500) {
|
||||
|
||||
/* its too big - use a scrollview */
|
||||
|
||||
|
|
@ -458,7 +473,7 @@ AUPluginUI::parent_cocoa_window ()
|
|||
[scroll_view setHasHorizontalScroller:YES];
|
||||
[scroll_view setHasVerticalScroller:YES];
|
||||
|
||||
NSSize frameSize = [NSScrollView frameSizeForContentSize:au_view_frame.size
|
||||
packFrame.size = [NSScrollView frameSizeForContentSize:packFrame.size
|
||||
hasHorizontalScroller:[scroll_view hasHorizontalScroller]
|
||||
hasVerticalScroller:[scroll_view hasVerticalScroller]
|
||||
borderType:[scroll_view borderType]];
|
||||
|
|
@ -467,77 +482,25 @@ AUPluginUI::parent_cocoa_window ()
|
|||
// frame but size equal to the size of the new view
|
||||
NSRect newFrame;
|
||||
newFrame.origin = [scroll_view frame].origin;
|
||||
newFrame.size = frameSize;
|
||||
newFrame.size = packFrame.size;
|
||||
|
||||
// Set the new frame and document views on the scroll view
|
||||
NSRect currentFrame = [scroll_view frame];
|
||||
[scroll_view setFrame:newFrame];
|
||||
[scroll_view setDocumentView:au_view];
|
||||
|
||||
cerr << "scroll view size is " << newFrame.size.width << " x " << newFrame.size.height << endl;
|
||||
|
||||
NSSize oldContentSize = [[cocoa_window contentView] frame].size;
|
||||
NSSize newContentSize = oldContentSize;
|
||||
|
||||
cerr << "original size is " << newContentSize.width << " x " << newContentSize.height << endl;
|
||||
|
||||
newContentSize.width += (newFrame.size.width - currentFrame.size.width);
|
||||
newContentSize.height += (newFrame.size.height - currentFrame.size.height);
|
||||
|
||||
#ifdef PACK_COCOA_INTO_GTK_WINDOW
|
||||
NSView* view = [win contentView];
|
||||
|
||||
[win setContentSize:newContentSize];
|
||||
[view addSubview:scroll_view];
|
||||
#else
|
||||
[cocoa_window setContentSize:newContentSize];
|
||||
[cocoa_window setContentView:scroll_view];
|
||||
#endif
|
||||
packView = scroll_view;
|
||||
|
||||
} else {
|
||||
|
||||
#ifdef PACK_COCOA_INTO_GTK_WINDOW
|
||||
NSView* view = [win contentView];
|
||||
|
||||
[win setContentSize:au_view_frame.size];
|
||||
[view addSubview:au_view];
|
||||
#else
|
||||
[cocoa_window setContentSize:au_view_frame.size];
|
||||
[cocoa_window setContentView:au_view];
|
||||
#endif
|
||||
|
||||
packView = au_view;
|
||||
}
|
||||
|
||||
/* compute how tall the title bar is, because we have to offset the position of the child window
|
||||
by that much.
|
||||
*/
|
||||
NSView* view = gdk_quartz_window_get_nsview (low_box.get_window()->gobj());
|
||||
|
||||
NSRect content_frame = [NSWindow contentRectForFrameRect:[win frame] styleMask:[win styleMask]];
|
||||
NSRect wm_frame = [NSWindow frameRectForContentRect:content_frame styleMask:[win styleMask]];
|
||||
int titlebar_height = wm_frame.size.height - content_frame.size.height;
|
||||
[view setFrame:packFrame];
|
||||
[view addSubview:packView];
|
||||
|
||||
// move cocoa window into position relative to the toplevel window
|
||||
|
||||
NSRect view_frame = [[cocoa_window contentView] frame];
|
||||
view_frame.origin.x = content_frame.origin.x;
|
||||
view_frame.origin.y = content_frame.origin.y;
|
||||
|
||||
[cocoa_window setFrame:view_frame display:NO];
|
||||
|
||||
/* make top level window big enough to hold cocoa window and titlebar */
|
||||
|
||||
content_frame.size.width = view_frame.size.width;
|
||||
content_frame.size.height = view_frame.size.height + titlebar_height;
|
||||
|
||||
[win setFrame:content_frame display:NO];
|
||||
|
||||
/* now make cocoa window a child of this top level */
|
||||
|
||||
[win addChildWindow:cocoa_window ordered:NSWindowAbove];
|
||||
[win setLevel:NSFloatingWindowLevel];
|
||||
[win setHidesOnDeactivate:YES];
|
||||
|
||||
cocoa_parented = true;
|
||||
low_box.set_size_request (packFrame.size.width, packFrame.size.height);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -547,16 +510,21 @@ AUPluginUI::on_realize ()
|
|||
{
|
||||
VBox::on_realize ();
|
||||
|
||||
/* our windows should not have that resize indicator */
|
||||
|
||||
NSWindow* win = get_nswindow ();
|
||||
if (win) {
|
||||
[win setShowsResizeIndicator:NO];
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
AUPluginUI::lower_box_realized ()
|
||||
{
|
||||
if (au_view) {
|
||||
|
||||
if (parent_cocoa_window ()) {
|
||||
}
|
||||
|
||||
parent_cocoa_window ();
|
||||
} else if (carbon_window) {
|
||||
|
||||
if (parent_carbon_window ()) {
|
||||
// ShowWindow (carbon_window);
|
||||
}
|
||||
parent_carbon_window ();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -572,12 +540,15 @@ AUPluginUI::on_map_event (GdkEventAny* ev)
|
|||
{
|
||||
cerr << "AU plugin map event\n";
|
||||
|
||||
if (au_view) {
|
||||
show_all ();
|
||||
} else if (carbon_window) {
|
||||
[cocoa_parent setIsVisible:YES];
|
||||
ShowWindow (carbon_window);
|
||||
if (carbon_window) {
|
||||
|
||||
// move top level GTK window to the correct level
|
||||
// to keep the stack together and not be sliceable
|
||||
|
||||
NSWindow* win = get_nswindow ();
|
||||
// [win setLevel:NSFloatingWindowLevel];
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -588,6 +559,8 @@ AUPluginUI::on_show ()
|
|||
|
||||
VBox::on_show ();
|
||||
|
||||
gtk_widget_realize (GTK_WIDGET(low_box.gobj()));
|
||||
|
||||
if (au_view) {
|
||||
show_all ();
|
||||
} else if (carbon_window) {
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@
|
|||
#include <ardour/ardour.h>
|
||||
#include <ardour/session.h>
|
||||
#include <ardour/tempo.h>
|
||||
#include <ardour/profile.h>
|
||||
#include <sigc++/bind.h>
|
||||
|
||||
#include "ardour_ui.h"
|
||||
|
|
@ -1883,7 +1884,9 @@ AudioClock::build_ops_menu ()
|
|||
MenuList& ops_items = ops_menu->items();
|
||||
ops_menu->set_name ("ArdourContextMenu");
|
||||
|
||||
if (!Profile->get_sae()) {
|
||||
ops_items.push_back (MenuElem (_("Timecode"), bind (mem_fun(*this, &AudioClock::set_mode), SMPTE)));
|
||||
}
|
||||
ops_items.push_back (MenuElem (_("Bars:Beats"), bind (mem_fun(*this, &AudioClock::set_mode), BBT)));
|
||||
ops_items.push_back (MenuElem (_("Minutes:Seconds"), bind (mem_fun(*this, &AudioClock::set_mode), MinSec)));
|
||||
ops_items.push_back (MenuElem (_("Samples"), bind (mem_fun(*this, &AudioClock::set_mode), Frames)));
|
||||
|
|
|
|||
|
|
@ -772,6 +772,8 @@ AudioRegionView::create_waves ()
|
|||
|
||||
uint32_t nchans = atv.get_diskstream()->n_channels();
|
||||
|
||||
cerr << "creating waves for " << _region->name() << " with wfd = " << wait_for_data << " and channels = " << nchans << endl;
|
||||
|
||||
/* in tmp_waves, set up null pointers for each channel so the vector is allocated */
|
||||
for (uint32_t n = 0; n < nchans; ++n) {
|
||||
tmp_waves.push_back (0);
|
||||
|
|
@ -787,14 +789,16 @@ AudioRegionView::create_waves ()
|
|||
|
||||
if (wait_for_data) {
|
||||
if (audio_region()->source(n)->peaks_ready (bind (mem_fun(*this, &AudioRegionView::peaks_ready_handler), n), data_ready_connection)) {
|
||||
cerr << "\tData is ready\n";
|
||||
create_one_wave (n, true);
|
||||
} else {
|
||||
cerr << "\tdata is not ready\n";
|
||||
// we'll get a PeaksReady signal from the source in the future
|
||||
// and will call create_one_wave(n) then.
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
cerr << "\tdon't delay, display today!\n";
|
||||
create_one_wave (n, true);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@
|
|||
#include "ardour_ui.h"
|
||||
#include "actions.h"
|
||||
#include "opts.h"
|
||||
#include "sync-menu.h"
|
||||
#include <gtkmm2ext/sync-menu.h>
|
||||
|
||||
#include <Appkit/Appkit.h>
|
||||
|
||||
|
|
|
|||
|
|
@ -1142,7 +1142,7 @@ Editor::connect_to_session (Session *t)
|
|||
session_connections.push_back (session->TransportStateChange.connect (mem_fun(*this, &Editor::map_transport_state)));
|
||||
session_connections.push_back (session->PositionChanged.connect (mem_fun(*this, &Editor::map_position_change)));
|
||||
session_connections.push_back (session->RouteAdded.connect (mem_fun(*this, &Editor::handle_new_route)));
|
||||
session_connections.push_back (session->AudioRegionAdded.connect (mem_fun(*this, &Editor::handle_new_audio_region)));
|
||||
session_connections.push_back (session->AudioRegionsAdded.connect (mem_fun(*this, &Editor::handle_new_audio_regions)));
|
||||
session_connections.push_back (session->AudioRegionRemoved.connect (mem_fun(*this, &Editor::handle_audio_region_removed)));
|
||||
session_connections.push_back (session->DurationChanged.connect (mem_fun(*this, &Editor::handle_new_duration)));
|
||||
session_connections.push_back (session->edit_group_added.connect (mem_fun(*this, &Editor::add_edit_group)));
|
||||
|
|
|
|||
|
|
@ -930,8 +930,10 @@ class Editor : public PublicEditor
|
|||
int ensure_cursor (nframes_t* pos);
|
||||
|
||||
void handle_new_audio_region (boost::weak_ptr<ARDOUR::AudioRegion>);
|
||||
void handle_new_audio_regions (vector<boost::weak_ptr<ARDOUR::AudioRegion> >& );
|
||||
void handle_audio_region_removed (boost::weak_ptr<ARDOUR::AudioRegion>);
|
||||
void add_audio_region_to_region_display (boost::shared_ptr<ARDOUR::AudioRegion>);
|
||||
void add_audio_regions_to_region_display (std::vector<boost::weak_ptr<ARDOUR::AudioRegion> > & );
|
||||
void region_hidden (boost::shared_ptr<ARDOUR::Region>);
|
||||
void redisplay_regions ();
|
||||
void insert_into_tmp_audio_regionlist(boost::shared_ptr<ARDOUR::AudioRegion>);
|
||||
|
|
@ -961,7 +963,7 @@ class Editor : public PublicEditor
|
|||
void split_region_at (nframes_t);
|
||||
void split_regions_at (nframes_t, RegionSelection&);
|
||||
void split_region_at_transients ();
|
||||
void split_region_at_points (boost::shared_ptr<ARDOUR::Region>, ARDOUR::AnalysisFeatureList&);
|
||||
void split_region_at_points (boost::shared_ptr<ARDOUR::Region>, ARDOUR::AnalysisFeatureList&, bool can_ferret);
|
||||
void crop_region_to_selection ();
|
||||
void crop_region_to (nframes_t start, nframes_t end);
|
||||
void set_sync_point (nframes64_t, const RegionSelection&);
|
||||
|
|
|
|||
|
|
@ -1028,11 +1028,10 @@ Editor::button_release_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemT
|
|||
case MouseObject:
|
||||
switch (item_type) {
|
||||
case AutomationTrackItem:
|
||||
dynamic_cast<AutomationTimeAxisView*>(clicked_trackview)->add_automation_event
|
||||
(item,
|
||||
event,
|
||||
where,
|
||||
event->button.y);
|
||||
AutomationTimeAxisView* atv = dynamic_cast<AutomationTimeAxisView*>(clicked_trackview);
|
||||
if (atv) {
|
||||
atv->add_automation_event (item, event, where, event->button.y);
|
||||
}
|
||||
return true;
|
||||
break;
|
||||
|
||||
|
|
|
|||
|
|
@ -5198,7 +5198,7 @@ Editor::split_region_at_transients ()
|
|||
boost::shared_ptr<AudioRegion> ar = boost::dynamic_pointer_cast<AudioRegion> ((*i)->region());
|
||||
|
||||
if (ar && (ar->get_transients (positions) == 0)) {
|
||||
split_region_at_points ((*i)->region(), positions);
|
||||
split_region_at_points ((*i)->region(), positions, true);
|
||||
positions.clear ();
|
||||
}
|
||||
|
||||
|
|
@ -5210,9 +5210,10 @@ Editor::split_region_at_transients ()
|
|||
}
|
||||
|
||||
void
|
||||
Editor::split_region_at_points (boost::shared_ptr<Region> r, AnalysisFeatureList& positions)
|
||||
Editor::split_region_at_points (boost::shared_ptr<Region> r, AnalysisFeatureList& positions, bool can_ferret)
|
||||
{
|
||||
boost::shared_ptr<AudioRegion> ar = boost::dynamic_pointer_cast<AudioRegion> (r);
|
||||
bool use_rhythmic_rodent = false;
|
||||
|
||||
if (!ar) {
|
||||
return;
|
||||
|
|
@ -5228,6 +5229,40 @@ Editor::split_region_at_points (boost::shared_ptr<Region> r, AnalysisFeatureList
|
|||
return;
|
||||
}
|
||||
|
||||
|
||||
if (positions.size() > 20) {
|
||||
Glib::ustring msgstr = string_compose (_("You are about to split\n%1\ninto %2 pieces.\nThis could take a long time."), ar->name(), positions.size() + 1);
|
||||
MessageDialog msg (msgstr,
|
||||
false,
|
||||
Gtk::MESSAGE_INFO,
|
||||
Gtk::BUTTONS_OK_CANCEL);
|
||||
|
||||
if (can_ferret) {
|
||||
msg.add_button (_("Call for the Ferret!"), RESPONSE_APPLY);
|
||||
}
|
||||
|
||||
msg.set_title (_("Excessive split?"));
|
||||
msg.set_secondary_text (_("Press OK to continue with this split operation\nor ask the Ferret dialog to tune the analysis"));
|
||||
msg.present ();
|
||||
|
||||
int response = msg.run();
|
||||
msg.hide ();
|
||||
switch (response) {
|
||||
case RESPONSE_OK:
|
||||
break;
|
||||
case RESPONSE_APPLY:
|
||||
use_rhythmic_rodent = true;
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (use_rhythmic_rodent) {
|
||||
show_rhythm_ferret ();
|
||||
return;
|
||||
}
|
||||
|
||||
AnalysisFeatureList::const_iterator x;
|
||||
|
||||
nframes64_t pos = ar->position();
|
||||
|
|
@ -5249,6 +5284,9 @@ Editor::split_region_at_points (boost::shared_ptr<Region> r, AnalysisFeatureList
|
|||
|
||||
pl->freeze ();
|
||||
pl->remove_region (ar);
|
||||
vector<boost::shared_ptr<Region> > new_regions;
|
||||
|
||||
cerr << "about to split using " << positions.size() << " positions" << endl;
|
||||
|
||||
while (x != positions.end()) {
|
||||
|
||||
|
|
@ -5276,7 +5314,13 @@ Editor::split_region_at_points (boost::shared_ptr<Region> r, AnalysisFeatureList
|
|||
continue;
|
||||
}
|
||||
|
||||
pl->add_region (RegionFactory::create (ar->get_sources(), file_start, len, new_name), pos);
|
||||
/* do NOT announce new regions 1 by one, just wait till they are all done */
|
||||
|
||||
boost::shared_ptr<Region> r = RegionFactory::create (ar->get_sources(), file_start, len, new_name, 0, Region::DefaultFlags, false);
|
||||
pl->add_region (r, pos);
|
||||
new_regions.push_back (r);
|
||||
|
||||
cerr << "done at " << pos << endl;
|
||||
|
||||
pos += len;
|
||||
++x;
|
||||
|
|
@ -5287,6 +5331,7 @@ Editor::split_region_at_points (boost::shared_ptr<Region> r, AnalysisFeatureList
|
|||
}
|
||||
|
||||
pl->thaw ();
|
||||
session->add_regions (new_regions);
|
||||
|
||||
XMLNode& after (pl->get_state());
|
||||
|
||||
|
|
|
|||
|
|
@ -58,20 +58,10 @@ Editor::handle_audio_region_removed (boost::weak_ptr<AudioRegion> wregion)
|
|||
}
|
||||
|
||||
void
|
||||
Editor::handle_new_audio_region (boost::weak_ptr<AudioRegion> wregion)
|
||||
Editor::handle_new_audio_regions (vector<boost::weak_ptr<AudioRegion> >& v)
|
||||
{
|
||||
ENSURE_GUI_THREAD (bind (mem_fun (*this, &Editor::handle_new_audio_region), wregion));
|
||||
|
||||
/* don't copy region - the one we are being notified
|
||||
about belongs to the session, and so it will
|
||||
never be edited.
|
||||
*/
|
||||
|
||||
boost::shared_ptr<AudioRegion> region (wregion.lock());
|
||||
|
||||
if (region) {
|
||||
add_audio_region_to_region_display (region);
|
||||
}
|
||||
ENSURE_GUI_THREAD (bind (mem_fun (*this, &Editor::handle_new_audio_regions), v));
|
||||
add_audio_regions_to_region_display (v);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
@ -82,6 +72,21 @@ Editor::region_hidden (boost::shared_ptr<Region> r)
|
|||
redisplay_regions ();
|
||||
}
|
||||
|
||||
void
|
||||
Editor::add_audio_regions_to_region_display (vector<boost::weak_ptr<AudioRegion> >& regions)
|
||||
{
|
||||
cerr << "Adding " << regions.size() << " to region list\n";
|
||||
|
||||
region_list_display.set_model (Glib::RefPtr<Gtk::TreeStore>(0));
|
||||
for (vector<boost::weak_ptr<AudioRegion> >::iterator x = regions.begin(); x != regions.end(); ++x) {
|
||||
boost::shared_ptr<AudioRegion> region ((*x).lock());
|
||||
if (region) {
|
||||
add_audio_region_to_region_display (region);
|
||||
}
|
||||
}
|
||||
region_list_display.set_model (region_list_model);
|
||||
}
|
||||
|
||||
void
|
||||
Editor::add_audio_region_to_region_display (boost::shared_ptr<AudioRegion> region)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -87,6 +87,7 @@ MixerStrip::MixerStrip (Mixer_UI& mx, Session& sess, boost::shared_ptr<Route> rt
|
|||
: AxisView(sess),
|
||||
RouteUI (rt, sess, _("Mute"), _("Solo"), _("Record")),
|
||||
_mixer(mx),
|
||||
_mixer_owned (in_mixer),
|
||||
pre_redirect_box (PreFader, sess, rt, mx.plugin_selector(), mx.selection(), in_mixer),
|
||||
post_redirect_box (PostFader, sess, rt, mx.plugin_selector(), mx.selection(), in_mixer),
|
||||
gpm (_route, sess),
|
||||
|
|
@ -661,12 +662,11 @@ MixerStrip::add_connection_to_output_menu (ARDOUR::Connection* c)
|
|||
void
|
||||
MixerStrip::update_diskstream_display ()
|
||||
{
|
||||
if (is_audio_track()) {
|
||||
|
||||
map_frozen ();
|
||||
|
||||
update_input_display ();
|
||||
|
||||
if (is_audio_track()) {
|
||||
|
||||
if (input_selector) {
|
||||
input_selector->hide_all ();
|
||||
}
|
||||
|
|
@ -675,9 +675,6 @@ MixerStrip::update_diskstream_display ()
|
|||
|
||||
} else {
|
||||
|
||||
map_frozen ();
|
||||
|
||||
update_input_display ();
|
||||
show_passthru_color ();
|
||||
}
|
||||
}
|
||||
|
|
@ -1144,9 +1141,11 @@ MixerStrip::map_frozen ()
|
|||
pre_redirect_box.set_sensitive (true);
|
||||
post_redirect_box.set_sensitive (true);
|
||||
speed_spinner.set_sensitive (true);
|
||||
// XXX need some way, maybe, to retoggle redirect editors
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
_route->foreach_redirect (this, &MixerStrip::hide_redirect_editor);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -107,6 +107,7 @@ class MixerStrip : public RouteUI, public Gtk::EventBox
|
|||
|
||||
bool _embedded;
|
||||
bool _packed;
|
||||
bool _mixer_owned;
|
||||
Width _width;
|
||||
void* _width_owner;
|
||||
|
||||
|
|
|
|||
|
|
@ -62,7 +62,6 @@ using namespace Gtk;
|
|||
using namespace sigc;
|
||||
|
||||
PluginUIWindow::PluginUIWindow (boost::shared_ptr<PluginInsert> insert, bool scrollable)
|
||||
: ArdourDialog ("plugin ui")
|
||||
{
|
||||
bool have_gui = false;
|
||||
non_gtk_gui = false;
|
||||
|
|
@ -99,7 +98,7 @@ PluginUIWindow::PluginUIWindow (boost::shared_ptr<PluginInsert> insert, bool scr
|
|||
GenericPluginUI* pu = new GenericPluginUI (insert, scrollable);
|
||||
|
||||
_pluginui = pu;
|
||||
get_vbox()->add (*pu);
|
||||
add (*pu);
|
||||
|
||||
set_wmclass (X_("ardour_plugin_editor"), "Ardour");
|
||||
|
||||
|
|
@ -107,7 +106,7 @@ PluginUIWindow::PluginUIWindow (boost::shared_ptr<PluginInsert> insert, bool scr
|
|||
signal_unmap_event().connect (mem_fun (*pu, &GenericPluginUI::stop_updating));
|
||||
}
|
||||
|
||||
set_position (Gtk::WIN_POS_MOUSE);
|
||||
// set_position (Gtk::WIN_POS_MOUSE);
|
||||
set_name ("PluginEditor");
|
||||
add_events (Gdk::KEY_PRESS_MASK|Gdk::KEY_RELEASE_MASK|Gdk::BUTTON_PRESS_MASK|Gdk::BUTTON_RELEASE_MASK);
|
||||
|
||||
|
|
@ -138,23 +137,14 @@ PluginUIWindow::on_show ()
|
|||
{
|
||||
cerr << "PluginWindow shown\n";
|
||||
|
||||
ArdourDialog::on_show ();
|
||||
Glib::ListHandle<Widget*> kids (get_vbox()->get_children());
|
||||
|
||||
cerr << "send show to " << kids.size() << " children of this plugin UI\n";
|
||||
|
||||
for (Glib::ListHandle<Widget*>::iterator x = kids.begin(); x != kids.end(); ++x) {
|
||||
cerr << "\tSend show to " << (*x) << endl;
|
||||
(*x)->show ();
|
||||
}
|
||||
cerr << "!! send done\n";
|
||||
Window::on_show ();
|
||||
}
|
||||
|
||||
void
|
||||
PluginUIWindow::on_hide ()
|
||||
{
|
||||
cerr << "PluginWindow hidden\n";
|
||||
ArdourDialog::on_hide ();
|
||||
Window::on_hide ();
|
||||
}
|
||||
|
||||
bool
|
||||
|
|
@ -174,7 +164,7 @@ PluginUIWindow::create_vst_editor(boost::shared_ptr<PluginInsert> insert)
|
|||
VSTPluginUI* vpu = new VSTPluginUI (insert, vp);
|
||||
|
||||
_pluginui = vpu;
|
||||
get_vbox()->add (*vpu);
|
||||
add (*vpu);
|
||||
vpu->package (*this);
|
||||
}
|
||||
|
||||
|
|
@ -191,8 +181,7 @@ PluginUIWindow::create_audiounit_editor (boost::shared_ptr<PluginInsert> insert)
|
|||
#else
|
||||
VBox* box;
|
||||
_pluginui = create_au_gui (insert, &box);
|
||||
cerr << "#*#*#*#*#*#*#*#*## PACK " << box << " INTO PLUGIN UI\n";
|
||||
get_vbox()->add (*box);
|
||||
add (*box);
|
||||
non_gtk_gui = true;
|
||||
|
||||
extern sigc::signal<void,bool> ApplicationActivationChanged;
|
||||
|
|
@ -206,12 +195,16 @@ void
|
|||
PluginUIWindow::app_activated (bool yn)
|
||||
{
|
||||
#if defined (HAVE_AUDIOUNITS) && defined(GTKOSX)
|
||||
if (yn) {
|
||||
if (_pluginui) {
|
||||
_pluginui->activate ();
|
||||
}
|
||||
}
|
||||
cerr << "APP activated ? " << yn << endl;
|
||||
if (_pluginui) {
|
||||
if (yn) {
|
||||
_pluginui->activate ();
|
||||
present ();
|
||||
} else {
|
||||
hide ();
|
||||
_pluginui->deactivate ();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -196,7 +196,7 @@ class GenericPluginUI : public PlugUIBase, public Gtk::VBox
|
|||
void print_parameter (char *buf, uint32_t len, uint32_t param);
|
||||
};
|
||||
|
||||
class PluginUIWindow : public ArdourDialog
|
||||
class PluginUIWindow : public Gtk::Window
|
||||
{
|
||||
public:
|
||||
PluginUIWindow (boost::shared_ptr<ARDOUR::PluginInsert> insert, bool scrollable=false);
|
||||
|
|
@ -213,6 +213,7 @@ class PluginUIWindow : public ArdourDialog
|
|||
|
||||
private:
|
||||
PlugUIBase* _pluginui;
|
||||
Gtk::VBox vbox;
|
||||
bool non_gtk_gui;
|
||||
void app_activated (bool);
|
||||
void plugin_going_away ();
|
||||
|
|
|
|||
|
|
@ -157,7 +157,7 @@ class PublicEditor : public Gtk::Window, public PBD::StatefulThingWithGoingAway
|
|||
virtual void restore_editing_space() = 0;
|
||||
virtual nframes64_t get_preferred_edit_position (bool ignore_playhead = false) = 0;
|
||||
virtual void toggle_meter_updating() = 0;
|
||||
virtual void split_region_at_points (boost::shared_ptr<ARDOUR::Region>, ARDOUR::AnalysisFeatureList&) = 0;
|
||||
virtual void split_region_at_points (boost::shared_ptr<ARDOUR::Region>, ARDOUR::AnalysisFeatureList&, bool can_ferret) = 0;
|
||||
|
||||
sigc::signal<void> ZoomFocusChanged;
|
||||
sigc::signal<void> ZoomChanged;
|
||||
|
|
|
|||
|
|
@ -1089,11 +1089,7 @@ RedirectBox::edit_redirect (boost::shared_ptr<Redirect> redirect)
|
|||
|
||||
plugin_ui = new PluginUIWindow (plugin_insert);
|
||||
|
||||
if (_owner_is_mixer) {
|
||||
ARDOUR_UI::instance()->the_mixer()->ensure_float (*plugin_ui);
|
||||
} else {
|
||||
ARDOUR_UI::instance()->the_editor().ensure_float (*plugin_ui);
|
||||
}
|
||||
// plugin_ui->set_keep_above (true);
|
||||
|
||||
WindowTitle title(Glib::get_application_name());
|
||||
title += generate_redirect_title (plugin_insert);
|
||||
|
|
|
|||
|
|
@ -271,7 +271,7 @@ RhythmFerret::do_split_action ()
|
|||
|
||||
(*i)->get_time_axis_view().hide_temporary_lines ();
|
||||
|
||||
editor.split_region_at_points ((*i)->region(), current_results);
|
||||
editor.split_region_at_points ((*i)->region(), current_results, false);
|
||||
|
||||
/* i is invalid at this point */
|
||||
|
||||
|
|
|
|||
|
|
@ -108,6 +108,8 @@ Analyser::analyse_audio_file_source (boost::shared_ptr<AudioFileSource> src)
|
|||
|
||||
TransientDetector td (src->sample_rate());
|
||||
|
||||
cerr << "analyzing " << src->name () << endl;
|
||||
|
||||
if (td.run (src->get_transients_path(), src.get(), 0, results) == 0) {
|
||||
src->set_been_analysed (true);
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -554,7 +554,10 @@ class Session : public PBD::StatefulDestructible
|
|||
|
||||
/* region info */
|
||||
|
||||
void add_regions (std::vector<boost::shared_ptr<Region> >&);
|
||||
|
||||
sigc::signal<void,boost::weak_ptr<AudioRegion> > AudioRegionAdded;
|
||||
sigc::signal<void,std::vector<boost::weak_ptr<AudioRegion> >& > AudioRegionsAdded;
|
||||
sigc::signal<void,boost::weak_ptr<AudioRegion> > AudioRegionRemoved;
|
||||
|
||||
int region_name (string& result, string base = string(""), bool newlevel = false) const;
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@
|
|||
#include <ardour/audiofilter.h>
|
||||
#include <ardour/region_factory.h>
|
||||
#include <ardour/source_factory.h>
|
||||
#include <ardour/analyser.h>
|
||||
|
||||
#include "i18n.h"
|
||||
|
||||
|
|
@ -104,6 +105,10 @@ AudioFilter::finish (boost::shared_ptr<AudioRegion> region, SourceList& nsrcs, s
|
|||
afs->update_header (region->position(), *now, xnow);
|
||||
afs->mark_immutable ();
|
||||
}
|
||||
|
||||
/* now that there is data there, requeue the file for analysis */
|
||||
|
||||
Analyser::queue_source_for_analysis (*si, false);
|
||||
}
|
||||
|
||||
/* create a new region */
|
||||
|
|
|
|||
|
|
@ -1576,6 +1576,8 @@ AudioRegion::get_transients (AnalysisFeatureList& results, bool force_new)
|
|||
return 0;
|
||||
}
|
||||
|
||||
cerr << "startup analysis of " << _name << endl;
|
||||
|
||||
TransientDetector t (pl->session().frame_rate());
|
||||
bool existing_results = !results.empty();
|
||||
|
||||
|
|
@ -1588,10 +1590,14 @@ AudioRegion::get_transients (AnalysisFeatureList& results, bool force_new)
|
|||
|
||||
t.reset ();
|
||||
|
||||
cerr << "working on channel " << i << endl;
|
||||
|
||||
if (t.run ("", this, i, these_results)) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
cerr << "done\n";
|
||||
|
||||
/* translate all transients to give absolute position */
|
||||
|
||||
for (AnalysisFeatureList::iterator i = these_results.begin(); i != these_results.end(); ++i) {
|
||||
|
|
@ -1617,6 +1623,11 @@ AudioRegion::get_transients (AnalysisFeatureList& results, bool force_new)
|
|||
/* make sure ours are clean too */
|
||||
|
||||
TransientDetector::cleanup_transients (_transients, pl->session().frame_rate(), 3.0);
|
||||
|
||||
} else {
|
||||
|
||||
TransientDetector::cleanup_transients (_transients, pl->session().frame_rate(), 3.0);
|
||||
results = _transients;
|
||||
}
|
||||
|
||||
valid_transients = true;
|
||||
|
|
|
|||
|
|
@ -70,6 +70,7 @@ AudioSource::AudioSource (Session& s, ustring name)
|
|||
AudioSource::AudioSource (Session& s, const XMLNode& node)
|
||||
: Source (s, node)
|
||||
{
|
||||
|
||||
_peaks_built = false;
|
||||
_peak_byte_max = 0;
|
||||
peakfile = -1;
|
||||
|
|
@ -141,6 +142,8 @@ AudioSource::peaks_ready (sigc::slot<void> the_slot, sigc::connection& conn) con
|
|||
connect the slot while still holding the lock.
|
||||
*/
|
||||
|
||||
cerr << _name << " @ " << this << " peaks built = " << _peaks_built << endl;
|
||||
|
||||
if (!(ret = _peaks_built)) {
|
||||
conn = PeaksReady.connect (the_slot);
|
||||
}
|
||||
|
|
@ -213,7 +216,7 @@ AudioSource::initialize_peakfile (bool newfile, ustring audio_path)
|
|||
|
||||
/* we found it in the peaks dir, so check it out */
|
||||
|
||||
if (statbuf.st_size == 0) {
|
||||
if (statbuf.st_size == 0 || (statbuf.st_size < ((length() / _FPP) * sizeof (PeakData)))) {
|
||||
// empty
|
||||
_peaks_built = false;
|
||||
} else {
|
||||
|
|
@ -221,7 +224,16 @@ AudioSource::initialize_peakfile (bool newfile, ustring audio_path)
|
|||
struct stat stat_file;
|
||||
int err = stat (audio_path.c_str(), &stat_file);
|
||||
|
||||
if (!err && stat_file.st_mtime > statbuf.st_mtime){
|
||||
if (err) {
|
||||
_peaks_built = false;
|
||||
_peak_byte_max = 0;
|
||||
} else {
|
||||
|
||||
/* allow 6 seconds slop on checking peak vs. file times because of various
|
||||
disk action "races"
|
||||
*/
|
||||
|
||||
if (stat_file.st_mtime > statbuf.st_mtime && (stat_file.st_mtime - statbuf.st_mtime > 6)) {
|
||||
_peaks_built = false;
|
||||
_peak_byte_max = 0;
|
||||
} else {
|
||||
|
|
@ -230,6 +242,7 @@ AudioSource::initialize_peakfile (bool newfile, ustring audio_path)
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!newfile && !_peaks_built && _build_missing_peakfiles && _build_peakfiles) {
|
||||
build_peaks_from_scratch ();
|
||||
|
|
|
|||
|
|
@ -46,6 +46,7 @@
|
|||
#include <ardour/region_factory.h>
|
||||
#include <ardour/source_factory.h>
|
||||
#include <ardour/resampled_source.h>
|
||||
#include <ardour/analyser.h>
|
||||
|
||||
#include "i18n.h"
|
||||
|
||||
|
|
@ -285,11 +286,14 @@ Session::import_audiofiles (import_status& status)
|
|||
|
||||
/* flush the final length(s) to the header(s) */
|
||||
|
||||
for (AudioSources::iterator x = all_new_sources.begin();
|
||||
x != all_new_sources.end(); ++x)
|
||||
for (AudioSources::iterator x = all_new_sources.begin(); x != all_new_sources.end(); ++x)
|
||||
{
|
||||
(*x)->update_header(0, *now, xnow);
|
||||
(*x)->done_with_peakfile_writes ();
|
||||
|
||||
/* now that there is data there, requeue the file for analysis */
|
||||
|
||||
Analyser::queue_source_for_analysis (boost::static_pointer_cast<Source>(*x), false);
|
||||
}
|
||||
|
||||
/* save state so that we don't lose these new Sources */
|
||||
|
|
|
|||
|
|
@ -2567,6 +2567,14 @@ Session::region_name (string& result, string base, bool newlevel) const
|
|||
|
||||
void
|
||||
Session::add_region (boost::shared_ptr<Region> region)
|
||||
{
|
||||
vector<boost::shared_ptr<Region> > v;
|
||||
v.push_back (region);
|
||||
add_regions (v);
|
||||
}
|
||||
|
||||
void
|
||||
Session::add_regions (vector<boost::shared_ptr<Region> >& new_regions)
|
||||
{
|
||||
boost::shared_ptr<AudioRegion> ar;
|
||||
boost::shared_ptr<AudioRegion> oar;
|
||||
|
|
@ -2575,8 +2583,14 @@ Session::add_region (boost::shared_ptr<Region> region)
|
|||
{
|
||||
Glib::Mutex::Lock lm (region_lock);
|
||||
|
||||
for (vector<boost::shared_ptr<Region> >::iterator ii = new_regions.begin(); ii != new_regions.end(); ++ii) {
|
||||
|
||||
boost::shared_ptr<Region> region = *ii;
|
||||
|
||||
if (region == 0) {
|
||||
|
||||
error << _("Session::add_region() ignored a null region. Warning: you might have lost a region.") << endmsg;
|
||||
|
||||
} else if ((ar = boost::dynamic_pointer_cast<AudioRegion> (region)) != 0) {
|
||||
|
||||
AudioRegionList::iterator x;
|
||||
|
|
@ -2616,6 +2630,7 @@ Session::add_region (boost::shared_ptr<Region> region)
|
|||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* mark dirty because something has changed even if we didn't
|
||||
add the region to the region list.
|
||||
|
|
@ -2624,9 +2639,34 @@ Session::add_region (boost::shared_ptr<Region> region)
|
|||
set_dirty();
|
||||
|
||||
if (added) {
|
||||
region->GoingAway.connect (sigc::bind (mem_fun (*this, &Session::remove_region), boost::weak_ptr<Region>(region)));
|
||||
|
||||
vector<boost::weak_ptr<AudioRegion> > v;
|
||||
boost::shared_ptr<AudioRegion> first_ar;
|
||||
|
||||
for (vector<boost::shared_ptr<Region> >::iterator ii = new_regions.begin(); ii != new_regions.end(); ++ii) {
|
||||
|
||||
boost::shared_ptr<Region> region = *ii;
|
||||
boost::shared_ptr<AudioRegion> ar;
|
||||
|
||||
if (region == 0) {
|
||||
|
||||
error << _("Session::add_region() ignored a null region. Warning: you might have lost a region.") << endmsg;
|
||||
|
||||
} else if ((ar = boost::dynamic_pointer_cast<AudioRegion> (region)) != 0) {
|
||||
v.push_back (ar);
|
||||
|
||||
if (!first_ar) {
|
||||
first_ar = ar;
|
||||
}
|
||||
}
|
||||
|
||||
region->StateChanged.connect (sigc::bind (mem_fun (*this, &Session::region_changed), boost::weak_ptr<Region>(region)));
|
||||
AudioRegionAdded (ar); /* EMIT SIGNAL */
|
||||
region->GoingAway.connect (sigc::bind (mem_fun (*this, &Session::remove_region), boost::weak_ptr<Region>(region)));
|
||||
}
|
||||
|
||||
if (!v.empty()) {
|
||||
AudioRegionsAdded (v); /* EMIT SIGNAL */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -31,6 +31,8 @@ gtkmm2ext.Append(CXXFLAGS="-DLIBSIGC_DISABLE_DEPRECATED")
|
|||
gtkmm2ext.Append(PACKAGE=domain)
|
||||
gtkmm2ext.Append(POTFILE=domain + '.pot')
|
||||
|
||||
extra_sources = []
|
||||
|
||||
gtkmm2ext_files = Split("""
|
||||
auto_spin.cc
|
||||
barcontroller.cc
|
||||
|
|
@ -59,12 +61,21 @@ version.cc
|
|||
window_title.cc
|
||||
""")
|
||||
|
||||
gtkosx_files=Split("""
|
||||
sync-menu.c
|
||||
""")
|
||||
|
||||
if gtkmm2ext['GTKOSX']:
|
||||
extra_sources += gtkosx_files
|
||||
gtkmm2ext.Append (CCFLAGS="-DTOP_MENUBAR -DGTKOSX")
|
||||
gtkmm2ext.Append (LINKFLAGS="-framework Carbon")
|
||||
|
||||
gtkmm2ext.VersionBuild(['version.cc','gtkmm2ext/version.h'], [])
|
||||
|
||||
gtkmm2ext.Append(CCFLAGS="-D_REENTRANT")
|
||||
gtkmm2ext.Append(CCFLAGS="-DLOCALEDIR=\\\""+final_prefix+"/share/locale\\\"")
|
||||
|
||||
libgtkmm2ext = gtkmm2ext.SharedLibrary('gtkmm2ext', gtkmm2ext_files)
|
||||
libgtkmm2ext = gtkmm2ext.SharedLibrary('gtkmm2ext', gtkmm2ext_files + extra_sources)
|
||||
|
||||
Default(libgtkmm2ext)
|
||||
|
||||
|
|
@ -76,5 +87,6 @@ env.Alias('install', env.Install(os.path.join(install_prefix, env['LIBDIR'], 'ar
|
|||
env.Alias('tarball', env.Distribute (env['DISTTREE'],
|
||||
[ 'SConscript', 'i18n.h', 'gettext.h'] +
|
||||
gtkmm2ext_files +
|
||||
gtkosx_files +
|
||||
glob.glob('po/*.po') +
|
||||
glob.glob('gtkmm2ext/*.h')))
|
||||
|
|
|
|||
|
|
@ -572,9 +572,31 @@ UI::popup_error (const char *text)
|
|||
msg.run ();
|
||||
}
|
||||
|
||||
#ifdef GTKOSX
|
||||
extern "C" {
|
||||
int gdk_quartz_in_carbon_menu_event_handler ();
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
UI::flush_pending ()
|
||||
{
|
||||
#ifdef GTKOSX
|
||||
/* as of february 11th 2008, gtk/osx has a problem in that mac menu events
|
||||
are handled using Carbon with an "internal" event handling system that
|
||||
doesn't pass things back to the glib/gtk main loop. this makes
|
||||
gtk_main_iteration() block if we call it while in a menu event handler
|
||||
because glib gets confused and thinks there are two threads running
|
||||
g_main_poll_func().
|
||||
|
||||
this hack (relies on code in gtk2_ardour/sync-menu.c) works
|
||||
around that.
|
||||
*/
|
||||
|
||||
if (gdk_quartz_in_carbon_menu_event_handler()) {
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
if (!caller_is_ui_thread()) {
|
||||
error << "non-UI threads cannot call UI::flush_pending()"
|
||||
<< endmsg;
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@
|
|||
|
||||
#include <Carbon/Carbon.h>
|
||||
|
||||
#include "sync-menu.h"
|
||||
#include <gtkmm2ext/sync-menu.h>
|
||||
|
||||
|
||||
/* TODO
|
||||
|
|
@ -533,6 +533,14 @@ carbon_menu_item_connect (GtkWidget *menu_item,
|
|||
* carbon event handler
|
||||
*/
|
||||
|
||||
static int _in_carbon_menu_event_handler = 0;
|
||||
|
||||
int
|
||||
gdk_quartz_in_carbon_menu_event_handler ()
|
||||
{
|
||||
return _in_carbon_menu_event_handler;
|
||||
}
|
||||
|
||||
static OSStatus
|
||||
menu_event_handler_func (EventHandlerCallRef event_handler_call_ref,
|
||||
EventRef event_ref,
|
||||
|
|
@ -541,6 +549,9 @@ menu_event_handler_func (EventHandlerCallRef event_handler_call_ref,
|
|||
UInt32 event_class = GetEventClass (event_ref);
|
||||
UInt32 event_kind = GetEventKind (event_ref);
|
||||
MenuRef menu_ref;
|
||||
OSStatus ret;
|
||||
|
||||
_in_carbon_menu_event_handler = 1;
|
||||
|
||||
switch (event_class)
|
||||
{
|
||||
|
|
@ -572,6 +583,7 @@ menu_event_handler_func (EventHandlerCallRef event_handler_call_ref,
|
|||
if (err == noErr && GTK_IS_WIDGET (widget))
|
||||
{
|
||||
gtk_menu_item_activate (GTK_MENU_ITEM (widget));
|
||||
_in_carbon_menu_event_handler = 0;
|
||||
return noErr;
|
||||
}
|
||||
}
|
||||
|
|
@ -617,7 +629,9 @@ menu_event_handler_func (EventHandlerCallRef event_handler_call_ref,
|
|||
break;
|
||||
}
|
||||
|
||||
return CallNextEventHandler (event_handler_call_ref, event_ref);
|
||||
ret = CallNextEventHandler (event_handler_call_ref, event_ref);
|
||||
_in_carbon_menu_event_handler = 0;
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
#ifndef __ardour_svn_revision_h__
|
||||
#define __ardour_svn_revision_h__
|
||||
static const char* ardour_svn_revision = "3025";
|
||||
static const char* ardour_svn_revision = "3029";
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue