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.

129 lines
3.7KB

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