#include "about_dialog.h"
#include "read_only_session_dialog.h"
+#include "sample_rate_mismatch_dialog.h"
#include "actions.h"
#include "add_tracks_dialog.h"
#include "ambiguous_file_dialog.h"
int
ARDOUR_UI::sr_mismatch_dialog (framecnt_t desired, framecnt_t actual)
{
- HBox* hbox = new HBox();
- Image* image = new Image (Stock::DIALOG_WARNING, ICON_SIZE_DIALOG);
- ArdourDialog dialog (_("Sample Rate Mismatch"), true);
- Label message (string_compose (_("\
-This session was created with a sample rate of %1 Hz, but\n\
-%2 is currently running at %3 Hz. If you load this session,\n\
-device will be switched to the session sample rate value. \n\
-If an attemp to switch the device is unsuccessful\n\
-audio may be played at the wrong sample rate.\n"), desired, PROGRAM_NAME, actual));
-
- image->set_alignment(ALIGN_CENTER, ALIGN_TOP);
- hbox->pack_start (*image, PACK_EXPAND_WIDGET, 12);
- hbox->pack_end (message, PACK_EXPAND_PADDING, 12);
- dialog.get_vbox()->pack_start(*hbox, PACK_EXPAND_PADDING, 6);
- dialog.add_button (_("Cancel"), RESPONSE_REJECT);
- dialog.add_button (_("Accept"), RESPONSE_ACCEPT);
- dialog.set_default_response (RESPONSE_ACCEPT);
- dialog.set_position (WIN_POS_CENTER);
- message.show();
- image->show();
- hbox->show();
-
- switch (dialog.run()) {
+
+ SampleRateMismatchDialog srm_dialog(desired, PROGRAM_NAME, actual);
+
+ switch ( srm_dialog.run () ) {
case RESPONSE_ACCEPT:
return 0;
default:
954DCFC21A023AAB00B7160E /* license_dialog.xml in Resources */ = {isa = PBXBuildFile; fileRef = 954DCFC01A023AAB00B7160E /* license_dialog.xml */; };
954DCFDC1A07A07600B7160E /* read_only_session_dialog.cc in Sources */ = {isa = PBXBuildFile; fileRef = 954DCFDB1A07A07600B7160E /* read_only_session_dialog.cc */; };
954DCFDE1A07A14E00B7160E /* read_only_session_dialog.xml in Resources */ = {isa = PBXBuildFile; fileRef = 954DCFDD1A07A14E00B7160E /* read_only_session_dialog.xml */; };
+ 954DCFE11A07C70400B7160E /* sample_rate_mismatch_dialog.cc in Sources */ = {isa = PBXBuildFile; fileRef = 954DCFE01A07C70400B7160E /* sample_rate_mismatch_dialog.cc */; };
+ 954DCFE51A07D1C800B7160E /* sample_rate_mismatch_dialog.xml in Resources */ = {isa = PBXBuildFile; fileRef = 954DCFE41A07D1C800B7160E /* sample_rate_mismatch_dialog.xml */; };
95A134DE1A0239080008E3D6 /* license_dialog.cc in Sources */ = {isa = PBXBuildFile; fileRef = 95A134DD1A0239080008E3D6 /* license_dialog.cc */; };
CE1A907A199A37AE00ECA62B /* add_tracks_dialog.cc in Sources */ = {isa = PBXBuildFile; fileRef = CE1A9079199A37AE00ECA62B /* add_tracks_dialog.cc */; };
CE1C6DCE19879F04006BDB03 /* compact_meter_bridge.cc in Sources */ = {isa = PBXBuildFile; fileRef = CE1C6DCC19879F04006BDB03 /* compact_meter_bridge.cc */; };
954DCFD71A07A06300B7160E /* read_only_session_dialog.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = read_only_session_dialog.h; path = ../read_only_session_dialog.h; sourceTree = "<group>"; };
954DCFDB1A07A07600B7160E /* read_only_session_dialog.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = read_only_session_dialog.cc; path = ../read_only_session_dialog.cc; sourceTree = "<group>"; };
954DCFDD1A07A14E00B7160E /* read_only_session_dialog.xml */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = read_only_session_dialog.xml; sourceTree = "<group>"; };
+ 954DCFDF1A07C6F200B7160E /* sample_rate_mismatch_dialog.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = sample_rate_mismatch_dialog.h; path = ../sample_rate_mismatch_dialog.h; sourceTree = "<group>"; };
+ 954DCFE01A07C70400B7160E /* sample_rate_mismatch_dialog.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = sample_rate_mismatch_dialog.cc; path = ../sample_rate_mismatch_dialog.cc; sourceTree = "<group>"; };
+ 954DCFE41A07D1C800B7160E /* sample_rate_mismatch_dialog.xml */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = sample_rate_mismatch_dialog.xml; sourceTree = "<group>"; };
95A134DD1A0239080008E3D6 /* license_dialog.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = license_dialog.cc; path = ../license_dialog.cc; sourceTree = "<group>"; };
95A134DF1A02391F0008E3D6 /* license_dialog.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = license_dialog.h; path = ../license_dialog.h; sourceTree = "<group>"; };
CE1A9079199A37AE00ECA62B /* add_tracks_dialog.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = add_tracks_dialog.cc; path = ../add_tracks_dialog.cc; sourceTree = "<group>"; };
43279040194EFF38003C9FEA /* source */ = {
isa = PBXGroup;
children = (
+ 954DCFE01A07C70400B7160E /* sample_rate_mismatch_dialog.cc */,
954DCFDB1A07A07600B7160E /* read_only_session_dialog.cc */,
954DCFBC1A0239DA00B7160E /* about_dialog.cc */,
95A134DD1A0239080008E3D6 /* license_dialog.cc */,
43279429194F0062003C9FEA /* ui */ = {
isa = PBXGroup;
children = (
+ 954DCFE41A07D1C800B7160E /* sample_rate_mismatch_dialog.xml */,
954DCFDD1A07A14E00B7160E /* read_only_session_dialog.xml */,
954DCFBF1A023AAB00B7160E /* about_dialog.xml */,
954DCFC01A023AAB00B7160E /* license_dialog.xml */,
43279480194F00CB003C9FEA /* headers */ = {
isa = PBXGroup;
children = (
+ 954DCFDF1A07C6F200B7160E /* sample_rate_mismatch_dialog.h */,
954DCFD71A07A06300B7160E /* read_only_session_dialog.h */,
954DCFBE1A0239EC00B7160E /* about_dialog.h */,
95A134DF1A02391F0008E3D6 /* license_dialog.h */,
43279334194F003A003C9FEA /* application-x-ardour_22px.png in Resources */,
43279335194F003A003C9FEA /* application-x-ardour_32px.png in Resources */,
43279336194F003A003C9FEA /* application-x-ardour_48px.png in Resources */,
+ 954DCFE51A07D1C800B7160E /* sample_rate_mismatch_dialog.xml in Resources */,
43279337194F003A003C9FEA /* ardour-app-icon_osx.png in Resources */,
43279338194F003A003C9FEA /* ardour-app-icon_osx_mask.png in Resources */,
43279339194F003A003C9FEA /* ardour_icon_16px.png in Resources */,
CE294C7B19CAD54500D12768 /* waves_dropdown.cc in Sources */,
CE294C7C19CAD54500D12768 /* waves_grid.cc in Sources */,
CE294C7D19CAD54500D12768 /* waves_zoom_control.cc in Sources */,
+ 954DCFE11A07C70400B7160E /* sample_rate_mismatch_dialog.cc in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
--- /dev/null
+/*
+ Copyright (C) 2014 Waves Audio Ltd.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#include "sample_rate_mismatch_dialog.h"
+#include "utils.h"
+#include <string.h>
+#include "i18n.h"
+
+using namespace Gtk;
+using namespace Gdk;
+using namespace std;
+using namespace ARDOUR;
+using namespace PBD;
+
+SampleRateMismatchDialog::SampleRateMismatchDialog (ARDOUR::framecnt_t desired, std::string program_name, ARDOUR::framecnt_t actual)
+ : WavesDialog (_("sample_rate_mismatch_dialog.xml"), true, false)
+ , _cancel_button ( get_waves_button ("cancel_button") )
+ , _accept_button ( get_waves_button ("accept_button") )
+ , _info_label_1 ( get_label("info_label_1") )
+ , _info_label_2 ( get_label("info_label_2") )
+ , _info_label_3 ( get_label("info_label_3") )
+ , _info_label_4 ( get_label("info_label_4") )
+ , _info_label_5 ( get_label("info_label_5") )
+{
+ set_modal (true);
+ set_resizable (false);
+
+ _cancel_button.signal_clicked.connect (sigc::mem_fun (*this, &SampleRateMismatchDialog::cancel_button_pressed));
+ _accept_button.signal_clicked.connect (sigc::mem_fun (*this, &SampleRateMismatchDialog::accept_button_pressed));
+
+ _info_label_1.set_text (string_compose ( _("This session was created with a sample rate of %1 Hz, but "), desired) );
+ _info_label_2.set_text (string_compose ( _("%1 is currently running at %2 Hz. If you load this session, "), program_name, actual) );
+ _info_label_3.set_text ( _("device will be switched to the session sample rate value.") );
+ _info_label_4.set_text ( _("If an attemp to switch the device is unsuccessful") );
+ _info_label_5.set_text ( _("audio may be played at the wrong sample rate.") );
+
+ show_all ();
+}
+
+void
+SampleRateMismatchDialog::on_esc_pressed ()
+{
+ hide ();
+ response (Gtk::RESPONSE_CANCEL);
+}
+
+void
+SampleRateMismatchDialog::on_enter_pressed ()
+{
+ hide ();
+ response (Gtk::RESPONSE_ACCEPT);
+}
+
+void
+SampleRateMismatchDialog::cancel_button_pressed (WavesButton*)
+{
+ hide ();
+ response (Gtk::RESPONSE_CANCEL);
+}
+
+void
+SampleRateMismatchDialog::accept_button_pressed (WavesButton*)
+{
+ hide ();
+ response (Gtk::RESPONSE_ACCEPT);
+}
+
+SampleRateMismatchDialog::~SampleRateMismatchDialog ()
+{
+}
--- /dev/null
+/*
+ Copyright (C) 2014 Waves Audio Ltd.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#ifndef __sample_rate_mismatch_dialog_h__
+#define __sample_rate_mismatch_dialog_h__
+
+#include "waves_dialog.h"
+#include "ardour_button.h"
+#include <string.h>
+#include "utils.h"
+
+class SampleRateMismatchDialog : public WavesDialog
+{
+public:
+ SampleRateMismatchDialog(ARDOUR::framecnt_t desired, std::string program_name, ARDOUR::framecnt_t actual);
+ ~SampleRateMismatchDialog();
+
+protected:
+ void on_esc_pressed ();
+ void on_enter_pressed ();
+
+private:
+ void cancel_button_pressed (WavesButton*);
+ void accept_button_pressed (WavesButton*);
+
+ WavesButton& _cancel_button;
+ WavesButton& _accept_button;
+ Gtk::Label& _info_label_1;
+ Gtk::Label& _info_label_2;
+ Gtk::Label& _info_label_3;
+ Gtk::Label& _info_label_4;
+ Gtk::Label& _info_label_5;
+};
+
+#endif /* __sample_rate_mismatch_dialog_h__ */
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<Dialog title="Sample rate mismatch" resizeable="False">
+
+ <style name="generic_control"
+ winfont ="Arial Bold 12"
+ macfont ="Helvetica Bold 12"
+ fgnormal="#BFBFBF"
+ bgnormal="#6C6C6C"
+ fgactive="#BFBFBF"
+ bgactive="#454545"
+ fghover="#CCCCCC"
+ bghover="#898989"/>
+
+ <Layout width="420"
+ height="125"
+ bgnormal="#EDECE8">
+ <VBox width="420"
+ x="0"
+ y="20">
+ <Label id="info_label_1"
+ style="generic_control"
+ fgnormal="#6D6E72"
+ horzalignment="center"/>
+ <Label id="info_label_2"
+ style="generic_control"
+ fgnormal="#6D6E72"
+ horzalignment="center"/>
+ <Label id="info_label_3"
+ style="generic_control"
+ fgnormal="#6D6E72"
+ horzalignment="center"/>
+ <Label id="info_label_4"
+ style="generic_control"
+ fgnormal="#6D6E72"
+ horzalignment="center"/>
+ <Label id="info_label_5"
+ style="generic_control"
+ fgnormal="#6D6E72"
+ horzalignment="center"/>
+ </VBox>
+
+ <Button id="cancel_button"
+ style="generic_control"
+ text="Cancel"
+ fgnormal="#6D6E72"
+ bgnormal="#CACAC5"
+ fgactive="#EDECE8"
+ bgactive="#6D6E72"
+ borderwidth="0 0 0 0"
+ bordercolor="#6D6E72"
+ width="80"
+ height="22"
+ x="240"
+ y="95"/>
+
+ <Button id="accept_button"
+ style="generic_control"
+ text="Accept"
+ fgnormal="#6D6E72"
+ bgnormal="#CACAC5"
+ fgactive="#EDECE8"
+ bgactive="#6D6E72"
+ borderwidth="0 0 0 0"
+ bordercolor="#6D6E72"
+ width="80"
+ height="22"
+ x="330"
+ y="95"/>
+ </Layout>
+
+</Dialog>
\ No newline at end of file
'fft_graph.cc',
'fft_result.cc',
'floating_text_entry.cc',
+ 'sample_rate_mismatch_dialog.cc',
'sfdb_freesound_mootcher.cc',
'gain_meter.cc',
'generic_pluginui.cc',