Assists music production by grouping standalone programs into sessions. Community version of "Non Session Manager".
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

151 lines
4.1KB

  1. /*******************************************************************************/
  2. /* Copyright (C) 2008 Jonathan Moore Liles */
  3. /* */
  4. /* This program is free software; you can redistribute it and/or modify it */
  5. /* under the terms of the GNU General Public License as published by the */
  6. /* Free Software Foundation; either version 2 of the License, or (at your */
  7. /* option) any later version. */
  8. /* */
  9. /* This program is distributed in the hope that it will be useful, but WITHOUT */
  10. /* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */
  11. /* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for */
  12. /* more details. */
  13. /* */
  14. /* You should have received a copy of the GNU General Public License along */
  15. /* with This program; see the file COPYING. If not,write to the Free Software */
  16. /* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
  17. /*******************************************************************************/
  18. #include <FL/Fl.H>
  19. #include <FL/Fl_Single_Window.H>
  20. #include <FL/Fl_Single_Window.H>
  21. #include <FL/Fl_Scroll.H>
  22. #include <FL/Fl_Pack.H>
  23. #include "Mixer_Strip.H"
  24. #include <stdlib.h>
  25. #include <unistd.h>
  26. #include "DPM.H"
  27. #include "Mixer.H"
  28. #include "Engine/Engine.H"
  29. #include "util/Thread.H"
  30. #include "util/debug.h"
  31. #include "Project.H"
  32. Engine *engine;
  33. Mixer *mixer;
  34. Fl_Single_Window *main_window;
  35. #include <FL/Boxtypes.H>
  36. #include "Loggable.H"
  37. #include <FL/Fl_Tooltip.H>
  38. #include <FL/fl_ask.H>
  39. /* for registration */
  40. #include "Module.H"
  41. #include "Gain_Module.H"
  42. #include "Plugin_Module.H"
  43. #include "JACK_Module.H"
  44. #include "Meter_Module.H"
  45. #include "Meter_Indicator_Module.H"
  46. #include "Controller_Module.H"
  47. #include "Chain.H"
  48. #include <signal.h>
  49. static void cb_main ( Fl_Widget *w, void *v )
  50. {
  51. }
  52. int
  53. main ( int argc, char **argv )
  54. {
  55. Thread::init();
  56. Thread thread( "UI" );
  57. thread.set();
  58. Fl_Tooltip::color( FL_BLACK );
  59. Fl_Tooltip::textcolor( FL_YELLOW );
  60. Fl_Tooltip::size( 14 );
  61. Fl_Tooltip::hoverdelay( 0.1f );
  62. // Fl::visible_focus( 0 );
  63. LOG_REGISTER_CREATE( Mixer_Strip );
  64. LOG_REGISTER_CREATE( Chain );
  65. LOG_REGISTER_CREATE( Plugin_Module );
  66. LOG_REGISTER_CREATE( Gain_Module );
  67. LOG_REGISTER_CREATE( Meter_Module );
  68. LOG_REGISTER_CREATE( JACK_Module );
  69. LOG_REGISTER_CREATE( Meter_Indicator_Module );
  70. LOG_REGISTER_CREATE( Controller_Module );
  71. init_boxtypes();
  72. signal( SIGPIPE, SIG_IGN );
  73. Fl::get_system_colors();
  74. Fl::scheme( "plastic" );
  75. // Fl::scheme( "gtk+" );
  76. /* Fl::foreground( 0xFF, 0xFF, 0xFF ); */
  77. /* Fl::background( 0x10, 0x10, 0x10 ); */
  78. MESSAGE( "Initializing JACK" );
  79. engine = new Engine();
  80. engine->init( "Non-Mixer" );
  81. {
  82. Fl_Single_Window *o = main_window = new Fl_Single_Window( 1024, 768, "Mixer" );
  83. {
  84. Fl_Widget *o = mixer = new Mixer( 0, 0, main_window->w(), main_window->h(), NULL );
  85. Fl_Group::current()->resizable(o);
  86. }
  87. o->end();
  88. o->callback( cb_main, main_window );
  89. o->show( argc, argv );
  90. }
  91. {
  92. engine->lock();
  93. if ( argc > 1 )
  94. {
  95. /* char name[1024]; */
  96. /* snprintf( name, sizeof( name ), "%s/history", argv[1] ); */
  97. /* Loggable::open( name ); */
  98. MESSAGE( "Loading \"%s\"", argv[1] );
  99. if ( int err = Project::open( argv[1] ) )
  100. {
  101. fl_alert( "Error opening project specified on commandline: %s", Project::errstr( err ) );
  102. }
  103. }
  104. else
  105. {
  106. WARNING( "Running without a project--nothing will be saved." );
  107. }
  108. engine->unlock();
  109. }
  110. Fl::run();
  111. delete engine;
  112. MESSAGE( "Your fun is over" );
  113. }