@@ -0,0 +1,56 @@ | |||
/*******************************************************************************/ | |||
/* 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. */ | |||
/*******************************************************************************/ | |||
/* actual implementation of our side of the LASH protocol */ | |||
#include "LASH.H" | |||
#include "debug.h" | |||
LASH::LASH ( ) | |||
{ | |||
} | |||
LASH::~LASH ( ) | |||
{ | |||
} | |||
bool | |||
LASH::handle_save_file ( const char *path ) | |||
{ | |||
MESSAGE( "LASH wants us to save \"%s\"", path ); | |||
return true; | |||
} | |||
bool | |||
LASH::handle_restore_file ( const char *path ) | |||
{ | |||
MESSAGE( "LASH wants us to load \"%s\"", path ); | |||
return true; | |||
} | |||
void | |||
LASH::handle_quit ( void ) | |||
{ | |||
MESSAGE( "LASH wants us to quit" ); | |||
} |
@@ -0,0 +1,36 @@ | |||
/*******************************************************************************/ | |||
/* 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. */ | |||
/*******************************************************************************/ | |||
#pragma once | |||
#include "LASH_Client.H" | |||
class LASH : public LASH_Client | |||
{ | |||
public: | |||
LASH ( ); | |||
~LASH ( ); | |||
bool handle_save_file ( const char *path ); | |||
bool handle_restore_file ( const char *path ); | |||
void handle_quit ( void ); | |||
}; |
@@ -38,8 +38,6 @@ LASH_Client::~LASH_Client ( ) | |||
bool | |||
LASH_Client::init ( const char *jack_name, const char *long_name, int *argc, char ***argv ) | |||
{ | |||
MESSAGE( "Initializing LASH" ); | |||
if ( ! ( _void = lash_init( lash_extract_args( argc, argv ), jack_name, | |||
LASH_Config_File, LASH_PROTOCOL( 2, 0 ) ) ) ) | |||
return false; | |||
@@ -68,8 +66,6 @@ LASH_Client::poll ( void ) | |||
{ | |||
case LASH_Save_File: | |||
{ | |||
MESSAGE( "LASH wants us to save \"%s\"", name ); | |||
handle_save_file( name ); | |||
lash_send_event( _client, lash_event_new_with_type( LASH_Save_File ) ); | |||
@@ -79,9 +75,7 @@ LASH_Client::poll ( void ) | |||
} | |||
case LASH_Restore_File: | |||
{ | |||
MESSAGE( "LASH wants us to load \"%s\"", name ); | |||
if ( ! handle_load_file( name ) ) | |||
if ( ! handle_restore_file( name ) ) | |||
/* FIXME: should we tell lash that we couldn't load the song? */; | |||
lash_send_event( _client, lash_event_new_with_type( LASH_Restore_File ) ); | |||
@@ -89,7 +83,6 @@ LASH_Client::poll ( void ) | |||
break; | |||
} | |||
case LASH_Quit: | |||
MESSAGE( "LASH wants us to quit" ); | |||
handle_quit(); | |||
break; | |||
default: | |||
@@ -29,9 +29,9 @@ class LASH_Client | |||
protected: | |||
virtual bool handle_load_file ( const char *path ) = 0; | |||
virtual bool handle_save_file ( const char *path ) = 0; | |||
virtual bool handle_quit ( void ) = 0; | |||
virtual bool handle_restore_file ( const char *path ) = 0; | |||
virtual void handle_quit ( void ) = 0; | |||
public: | |||
@@ -51,9 +51,12 @@ | |||
#include "Project.H" | |||
#include "LASH.H" | |||
Engine *engine; | |||
Timeline *timeline; | |||
Transport *transport; | |||
LASH *lash; | |||
/* TODO: put these in a header */ | |||
#define USER_CONFIG_DIR ".non-daw/" | |||
@@ -81,6 +84,15 @@ ensure_dirs ( void ) | |||
return r == 0 || errno == EEXIST; | |||
} | |||
const float lash_poll_interval = 0.2f; | |||
static void | |||
lash_cb ( void *arg ) | |||
{ | |||
lash->poll(); | |||
Fl::repeat_timeout( lash_poll_interval, lash_cb, 0 ); | |||
} | |||
int | |||
main ( int argc, char **argv ) | |||
@@ -116,6 +128,13 @@ main ( int argc, char **argv ) | |||
* scenario requiring otherwise */ | |||
transport->stop(); | |||
MESSAGE( "Initializing LASH" ); | |||
lash = new LASH; | |||
lash->init( APP_NAME, APP_TITLE, &argc, &argv ); | |||
Fl::add_timeout( lash_poll_interval, lash_cb, 0 ); | |||
if ( argc > 1 ) | |||
if ( ! Project::open( argv[ 1 ] ) ) | |||
FATAL( "Could not open project specified on command line" ); | |||
@@ -3,6 +3,7 @@ | |||
Timeline_VERSION := 0.5.0 | |||
Timeline_SRCS= \ | |||
Timeline/LASH.C \ | |||
Timeline/LASH_Client.C \ | |||
Timeline/Annotation_Region.C \ | |||
Timeline/Audio_File.C \ | |||