26 #include <sigc++/bind.h>
27 #include <gtkmm/settings.h>
35 #ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
45 #include <gtkmm/main.h>
57 #ifdef PLATFORM_WINDOWS
63 #include "gtk2ardour-version.h"
82 MessageDialog win (
string_compose (
_(
"%1 could not connect to the audio backend."), PROGRAM_NAME),
87 win.add_button (Stock::QUIT, RESPONSE_CLOSE);
88 win.set_default_response (RESPONSE_CLOSE);
91 win.set_position (Gtk::WIN_POS_CENTER);
105 if (AudioEngine::instance()->processed_frames() == 0) {
107 MessageDialog msg (
string_compose (
_(
"The audio backend (%1) has failed, or terminated"), AudioEngine::instance()->current_backend_name()),
false);
108 msg.set_position (Gtk::WIN_POS_CENTER);
110 "%2 exited unexpectedly, and without notifying %1.\n\
112 This could be due to misconfiguration or to an error inside %2.\n\
114 Click OK to exit %1."), PROGRAM_NAME, AudioEngine::instance()->current_backend_name()));
123 MessageDialog msg (
string_compose (
_(
"The audio backend (%1) has failed, or terminated"), AudioEngine::instance()->current_backend_name()),
false);
124 msg.set_secondary_text (
string_compose (
_(
"%2 exited unexpectedly, and without notifying %1."),
125 PROGRAM_NAME, AudioEngine::instance()->current_backend_name()));
131 #ifndef PLATFORM_WINDOWS
137 static bool done_the_backend_thing =
false;
139 if (!done_the_backend_thing) {
140 AudioEngine::instance()->died ();
142 done_the_backend_thing =
true;
147 #if (!defined COMPILER_MSVC && defined PLATFORM_WINDOWS)
149 static FILE* pStdOut = 0;
150 static FILE* pStdErr = 0;
151 static BOOL bConsole;
152 static HANDLE hStdOut;
155 IsAConsolePort (HANDLE handle)
158 return (GetConsoleMode(handle, &mode) != 0);
164 bConsole = AttachConsole(ATTACH_PARENT_PROCESS);
165 hStdOut = GetStdHandle(STD_OUTPUT_HANDLE);
171 if ((bConsole) && (IsAConsolePort(hStdOut))) {
172 pStdOut = freopen(
"CONOUT$",
"w", stdout );
173 pStdErr = freopen(
"CONOUT$",
"w", stderr );
189 INPUT_RECORD input_record;
191 input_record.EventType = KEY_EVENT;
192 input_record.Event.KeyEvent.bKeyDown = TRUE;
193 input_record.Event.KeyEvent.dwControlKeyState = 0;
194 input_record.Event.KeyEvent.uChar.UnicodeChar = VK_RETURN;
195 input_record.Event.KeyEvent.wRepeatCount = 1;
196 input_record.Event.KeyEvent.wVirtualKeyCode = VK_RETURN;
197 input_record.Event.KeyEvent.wVirtualScanCode = MapVirtualKey( VK_RETURN, 0 );
200 WriteConsoleInput( GetStdHandle( STD_INPUT_HANDLE ), &input_record, 1, &written );
208 #elif (defined(COMPILER_MSVC) && defined(NDEBUG) && !defined(RDC_BUILD))
217 Gtk::Main app(argc, argv);
219 Gtk::MessageDialog dlgReportParseError (
string_compose (
_(
"\n %1 could not understand your command line "), PROGRAM_NAME),
220 false, MESSAGE_ERROR, BUTTONS_CLOSE,
true);
221 dlgReportParseError.set_title (
string_compose (
_(
"An error was encountered while launching %1"), PROGRAM_NAME));
222 dlgReportParseError.run ();
231 #if (defined(COMPILER_MSVC) && defined(NDEBUG) && !defined(RDC_BUILD))
237 #elif (defined WINDOWS_VST_SUPPORT && !defined PLATFORM_WINDOWS)
251 int main (
int argc,
char *argv[])
260 if (!Glib::thread_supported()) {
270 #if (defined WINDOWS_VST_SUPPORT && !defined PLATFORM_WINDOWS)
278 cerr <<
"bind txt domain [" << PACKAGE <<
"] to " <<
localedir << endl;
288 pthread_setcanceltype (PTHREAD_CANCEL_ASYNCHRONOUS, 0);
297 #ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
298 if (g_getenv (
"BOOST_DEBUG")) {
310 <<
_(
" (built using ")
313 <<
_(
" and GCC version ") << __VERSION__
323 cerr <<
_(
"Copyright (C) 1999-2015 Paul Davis") << endl
324 <<
_(
"Some portions Copyright (C) Steve Harris, Ari Johnson, Brett Viren, Joel Baker, Robin Gareus") << endl
326 <<
string_compose (
_(
"%1 comes with ABSOLUTELY NO WARRANTY"), PROGRAM_NAME) << endl
327 <<
_(
"not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.") << endl
328 <<
_(
"This is free software, and you are welcome to redistribute it ") << endl
329 <<
_(
"under certain conditions; see the source for copying conditions.")
342 #ifndef PLATFORM_WINDOWS
344 cerr <<
_(
"Cannot xinstall SIGPIPE error handler") << endl;
367 #if (defined WINDOWS_VST_SUPPORT && !defined PLATFORM_WINDOWS)
static void command_line_parse_error(int *argc, char **argv[])
LIBPBD_API Transmitter fatal
int32_t parse_opts(int argc, char *argv[])
static Application * instance()
LIBARDOUR_API const char * revision
#define bind_textdomain_codeset(Domainname, Codeset)
LIBPBD_API Transmitter error
LIBPBD_API Transmitter warning
void windows_vst_gui_init(int *argc, char **argv[])
static void console_madness_end()
std::ostream & endmsg(std::ostream &ostr)
static void console_madness_begin()
LIBPBD_API void pthread_cancel_all()
LIBARDOUR_API void check_for_old_configuration_files()
void boost_debug_shared_ptr_show_live_debugging(bool yn)
LIBPBD_API Transmitter info
#define bindtextdomain(Domainname, Dirname)
int main(int argc, char *argv[])
static void sigpipe_handler(int)
static string localedir(LOCALEDIR)
LIBARDOUR_API void cleanup()
void run(Receiver &old_receiver)
void fixup_bundle_environment(int, char *[], std::string &localedir)
int ardour_main(int argc, char *argv[])
static gboolean tell_about_backend_death(void *)
void listen_to(Transmitter &)
LIBARDOUR_API bool init(bool with_vst, bool try_optimization, const char *localedir)
TextReceiver text_receiver("ardour")
std::string string_compose(const std::string &fmt, const T1 &o1)