2008-02-14 06:47:12 +01:00
|
|
|
|
|
|
|
/*******************************************************************************/
|
|
|
|
/* Copyright (C) 2008 Jonathan Moore Liles */
|
|
|
|
/* */
|
|
|
|
/* 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; see the file COPYING. If not,write to the Free Software */
|
|
|
|
/* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
|
|
|
/*******************************************************************************/
|
|
|
|
|
|
|
|
#include <FL/Fl.H>
|
2008-05-03 06:44:48 +02:00
|
|
|
|
2008-02-14 06:47:12 +01:00
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
#include <sys/stat.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
2008-05-22 09:05:49 +02:00
|
|
|
#include <stdlib.h>
|
2008-02-14 06:47:12 +01:00
|
|
|
|
2008-05-22 09:05:49 +02:00
|
|
|
/* for registrations */
|
2008-05-05 02:04:20 +02:00
|
|
|
#include "Audio_Region.H"
|
2008-04-19 06:16:21 +02:00
|
|
|
#include "Sequence.H"
|
|
|
|
#include "Audio_Sequence.H"
|
2008-02-16 08:21:15 +01:00
|
|
|
#include "Timeline.H"
|
2008-04-19 06:16:21 +02:00
|
|
|
#include "Tempo_Sequence.H"
|
|
|
|
#include "Time_Sequence.H"
|
2008-05-05 00:32:08 +02:00
|
|
|
#include "Annotation_Sequence.H"
|
2008-04-19 06:16:21 +02:00
|
|
|
#include "Control_Sequence.H"
|
|
|
|
#include "Track.H"
|
2008-02-17 22:25:02 +01:00
|
|
|
|
2008-04-23 04:22:46 +02:00
|
|
|
#include "TLE.H"
|
2008-04-22 23:23:23 +02:00
|
|
|
|
2008-04-27 12:18:03 +02:00
|
|
|
#include "../FL/Boxtypes.H"
|
2008-04-22 23:23:23 +02:00
|
|
|
|
2008-05-07 01:33:24 +02:00
|
|
|
#include "Project.H"
|
2008-05-15 03:10:49 +02:00
|
|
|
#include "LASH.H"
|
2008-05-22 09:05:49 +02:00
|
|
|
#include "Transport.H"
|
|
|
|
#include "Engine/Engine.H"
|
2008-05-15 03:10:49 +02:00
|
|
|
|
2008-06-02 03:13:18 +02:00
|
|
|
#include "util/Thread.H"
|
|
|
|
|
2008-04-09 02:05:15 +02:00
|
|
|
Engine *engine;
|
2008-02-21 17:20:36 +01:00
|
|
|
Timeline *timeline;
|
2008-04-22 04:47:29 +02:00
|
|
|
Transport *transport;
|
2008-05-15 03:10:49 +02:00
|
|
|
LASH *lash;
|
2008-05-15 06:23:16 +02:00
|
|
|
TLE *tle;
|
2008-02-21 10:35:03 +01:00
|
|
|
|
2008-05-03 06:44:48 +02:00
|
|
|
/* TODO: put these in a header */
|
|
|
|
#define USER_CONFIG_DIR ".non-daw/"
|
|
|
|
|
|
|
|
const char APP_NAME[] = "Non-DAW";
|
2008-05-15 06:23:16 +02:00
|
|
|
const char APP_TITLE[] = "The Non-DAW";
|
2008-05-03 06:44:48 +02:00
|
|
|
const char COPYRIGHT[] = "Copyright (C) 2008 Jonathan Moore Liles";
|
|
|
|
|
|
|
|
#define PACKAGE "non"
|
|
|
|
|
|
|
|
|
2008-05-22 09:05:49 +02:00
|
|
|
#include "util/debug.h"
|
2008-02-20 07:11:33 +01:00
|
|
|
|
2008-04-25 05:15:17 +02:00
|
|
|
char *user_config_dir;
|
2008-05-03 06:44:48 +02:00
|
|
|
|
|
|
|
#include <errno.h>
|
2008-04-22 23:23:23 +02:00
|
|
|
|
2008-04-25 05:15:17 +02:00
|
|
|
static int
|
|
|
|
ensure_dirs ( void )
|
|
|
|
{
|
2008-05-03 06:44:48 +02:00
|
|
|
asprintf( &user_config_dir, "%s/%s", getenv( "HOME" ), USER_CONFIG_DIR );
|
2008-04-22 23:23:23 +02:00
|
|
|
|
2008-05-03 06:44:48 +02:00
|
|
|
int r = mkdir( user_config_dir, 0777 );
|
|
|
|
|
|
|
|
return r == 0 || errno == EEXIST;
|
|
|
|
}
|
|
|
|
|
2008-05-16 02:26:51 +02:00
|
|
|
#include <FL/Fl_Shared_Image.H>
|
|
|
|
|
2008-06-05 04:11:17 +02:00
|
|
|
#include <signal.h>
|
|
|
|
|
2008-05-17 20:42:50 +02:00
|
|
|
|
2008-02-14 06:47:12 +01:00
|
|
|
int
|
|
|
|
main ( int argc, char **argv )
|
|
|
|
{
|
2008-06-02 03:13:18 +02:00
|
|
|
Thread::init();
|
|
|
|
|
|
|
|
Thread thread( "UI" );
|
|
|
|
thread.set();
|
2008-05-16 02:26:51 +02:00
|
|
|
|
|
|
|
fl_register_images();
|
|
|
|
|
2008-03-01 15:23:59 +01:00
|
|
|
/* welcome to C++ */
|
2008-05-06 06:33:41 +02:00
|
|
|
LOG_REGISTER_CREATE( Annotation_Point );
|
|
|
|
LOG_REGISTER_CREATE( Annotation_Region );
|
2008-05-05 01:06:36 +02:00
|
|
|
LOG_REGISTER_CREATE( Annotation_Sequence );
|
2008-05-06 06:33:41 +02:00
|
|
|
LOG_REGISTER_CREATE( Audio_Region );
|
|
|
|
LOG_REGISTER_CREATE( Audio_Sequence );
|
|
|
|
LOG_REGISTER_CREATE( Control_Point );
|
|
|
|
LOG_REGISTER_CREATE( Control_Sequence );
|
|
|
|
LOG_REGISTER_CREATE( Tempo_Point );
|
|
|
|
LOG_REGISTER_CREATE( Time_Point );
|
|
|
|
LOG_REGISTER_CREATE( Track );
|
2008-02-22 21:20:44 +01:00
|
|
|
|
2008-04-27 12:18:03 +02:00
|
|
|
init_boxtypes();
|
|
|
|
|
2008-06-05 04:11:17 +02:00
|
|
|
signal( SIGPIPE, SIG_IGN );
|
|
|
|
|
2008-04-25 05:15:17 +02:00
|
|
|
if ( ! ensure_dirs() )
|
2008-05-03 06:44:48 +02:00
|
|
|
FATAL( "Cannot create required directories" );
|
|
|
|
|
|
|
|
printf( "%s %s -- %s\n", APP_TITLE, VERSION, COPYRIGHT );
|
|
|
|
|
2008-05-15 06:23:16 +02:00
|
|
|
tle = new TLE;
|
2008-04-22 04:47:29 +02:00
|
|
|
|
2008-05-03 06:44:48 +02:00
|
|
|
MESSAGE( "Initializing JACK" );
|
|
|
|
|
2008-04-09 02:05:15 +02:00
|
|
|
/* we don't really need a pointer for this */
|
|
|
|
engine = new Engine;
|
2008-06-05 04:11:17 +02:00
|
|
|
if ( ! engine->init() )
|
|
|
|
FATAL( "Could not connect to JACK!" );
|
2008-04-09 02:05:15 +02:00
|
|
|
|
2008-04-25 23:35:51 +02:00
|
|
|
/* always start stopped (please imagine for me a realistic
|
|
|
|
* scenario requiring otherwise */
|
|
|
|
transport->stop();
|
|
|
|
|
2008-05-15 03:10:49 +02:00
|
|
|
MESSAGE( "Initializing LASH" );
|
|
|
|
lash = new LASH;
|
|
|
|
|
|
|
|
lash->init( APP_NAME, APP_TITLE, &argc, &argv );
|
|
|
|
|
2008-06-06 04:30:34 +02:00
|
|
|
MESSAGE( "Starting GUI" );
|
|
|
|
|
|
|
|
tle->run();
|
|
|
|
|
2008-05-04 09:32:54 +02:00
|
|
|
if ( argc > 1 )
|
2008-06-22 01:46:11 +02:00
|
|
|
tle->open( argv[ 1 ] );
|
2008-05-04 09:32:54 +02:00
|
|
|
|
2008-06-06 04:30:34 +02:00
|
|
|
Fl::run();
|
2008-05-11 19:19:01 +02:00
|
|
|
|
|
|
|
MESSAGE( "Your fun is over" );
|
2008-02-14 06:47:12 +01:00
|
|
|
}
|