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.

131 lines
3.6KB

  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 <stdio.h>
  20. #include <unistd.h>
  21. #include <sys/stat.h>
  22. #include <stdlib.h>
  23. #include <string.h>
  24. #include "Region.H"
  25. #include "Sequence.H"
  26. #include "Audio_Sequence.H"
  27. #include "Timeline.H"
  28. #include "Tempo_Sequence.H"
  29. #include "Time_Sequence.H"
  30. #include "Ruler_Sequence.H"
  31. #include "Control_Sequence.H"
  32. #include "Transport.H"
  33. #include "Loggable.H"
  34. #include "Track.H"
  35. #include "Engine.H"
  36. #include "TLE.H"
  37. #include "../FL/Boxtypes.H"
  38. #include <stdlib.h>
  39. #include <sys/stat.h>
  40. #include "Session.H"
  41. Engine *engine;
  42. Timeline *timeline;
  43. Transport *transport;
  44. #define VERSION "0.5.0"
  45. /* TODO: put these in a header */
  46. #define USER_CONFIG_DIR ".non-daw/"
  47. const char APP_NAME[] = "Non-DAW";
  48. const char APP_TITLE[] = "The Non-DAW (Digital Audio Workstation)";
  49. const char COPYRIGHT[] = "Copyright (C) 2008 Jonathan Moore Liles";
  50. #define PACKAGE "non"
  51. #include "debug.h"
  52. char *user_config_dir;
  53. #include <errno.h>
  54. static int
  55. ensure_dirs ( void )
  56. {
  57. asprintf( &user_config_dir, "%s/%s", getenv( "HOME" ), USER_CONFIG_DIR );
  58. int r = mkdir( user_config_dir, 0777 );
  59. return r == 0 || errno == EEXIST;
  60. }
  61. int
  62. main ( int argc, char **argv )
  63. {
  64. /* welcome to C++ */
  65. LOG_REGISTER_CREATE( Region );
  66. LOG_REGISTER_CREATE( Time_Point );
  67. LOG_REGISTER_CREATE( Tempo_Point );
  68. LOG_REGISTER_CREATE( Ruler_Point );
  69. LOG_REGISTER_CREATE( Control_Point );
  70. LOG_REGISTER_CREATE( Track );
  71. LOG_REGISTER_CREATE( Audio_Sequence );
  72. LOG_REGISTER_CREATE( Control_Sequence );
  73. init_boxtypes();
  74. if ( ! ensure_dirs() )
  75. FATAL( "Cannot create required directories" );
  76. printf( "%s %s -- %s\n", APP_TITLE, VERSION, COPYRIGHT );
  77. if ( argc > 1 )
  78. if ( ! Session::open( argv[ 1 ] ) )
  79. FATAL( "Could not open session specified on command line" );
  80. /* FIXME: open session in /tmp if none is given? */
  81. TLE tle;
  82. MESSAGE( "Initializing JACK" );
  83. /* we don't really need a pointer for this */
  84. engine = new Engine;
  85. engine->init();
  86. /* always start stopped (please imagine for me a realistic
  87. * scenario requiring otherwise */
  88. transport->stop();
  89. MESSAGE( "Starting GUI" );
  90. // tle.main_window->show( argc, argv );
  91. tle.main_window->show();
  92. Fl::run();
  93. }