| @@ -71,7 +71,7 @@ CFLAGS+=-DVERSION=\"$(VERSION)\" \ | |||
| -DDOCUMENT_PATH=\"$(DOCUMENT_PATH)\" \ | |||
| -DPIXMAP_PATH=\"$(PIXMAP_PATH)\" | |||
| CXXFLAGS += $(SNDFILE_CFLAGS) $(LASH_CFLAGS) $(FLTK_CFLAGS) $(JACK_CFLAGS) | |||
| CXXFLAGS += $(SNDFILE_CFLAGS) $(FLTK_CFLAGS) $(JACK_CFLAGS) | |||
| CXXFLAGS := $(CFLAGS) $(CXXFLAGS) | |||
| INCLUDES := -I. -Iutil -IFL -Inonlib | |||
| @@ -1,120 +0,0 @@ | |||
| /*******************************************************************************/ | |||
| /* 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_Engine protocol */ | |||
| /* NOTES: Since LASH doesn't provide us with the information we | |||
| * need--when we need it--we just punt and only use LASH to save and | |||
| * load the path to the *real* project data. */ | |||
| #include "LASH_Engine.H" | |||
| #include "Project.H" | |||
| #include "TLE.H" // all this just for quit() | |||
| #include <FL/Fl.H> | |||
| #include <FL/filename.H> | |||
| extern TLE *tle; | |||
| #include "const.h" | |||
| #include "util/debug.h" | |||
| const float lash_poll_interval = 0.2f; | |||
| void | |||
| LASH_Engine::timer_cb ( void *v ) | |||
| { | |||
| ((LASH_Engine*)v)->poll(); | |||
| Fl::repeat_timeout( lash_poll_interval, &LASH_Engine::timer_cb, v ); | |||
| } | |||
| LASH_Engine::LASH_Engine ( ) | |||
| { | |||
| Fl::add_timeout( lash_poll_interval, &LASH_Engine::timer_cb, this ); | |||
| } | |||
| LASH_Engine::~LASH_Engine ( ) | |||
| { | |||
| Fl::remove_timeout( &LASH_Engine::timer_cb ); | |||
| } | |||
| bool | |||
| LASH_Engine::handle_save_file ( const char *path ) | |||
| { | |||
| MESSAGE( "LASH wants us to save \"%s\"", path ); | |||
| char *name; | |||
| asprintf( &name, "%s/project-path", path ); | |||
| FILE *fp; | |||
| if ( ! ( fp = fopen( name, "w" ) ) ) | |||
| { | |||
| free( name ); | |||
| return false; | |||
| } | |||
| else | |||
| free( name ); | |||
| char project_path[ 512 ]; | |||
| fl_filename_absolute( project_path, sizeof( project_path ), "." ); | |||
| fwrite( project_path, strlen( project_path ), 1, fp ); | |||
| fclose( fp ); | |||
| return Project::save(); | |||
| } | |||
| bool | |||
| LASH_Engine::handle_restore_file ( const char *path ) | |||
| { | |||
| MESSAGE( "LASH wants us to load \"%s\"", path ); | |||
| char *name; | |||
| asprintf( &name, "%s/project-path", path ); | |||
| FILE *fp; | |||
| if ( ! ( fp = fopen( name, "r" ) ) ) | |||
| { | |||
| free( name ); | |||
| return false; | |||
| } | |||
| else | |||
| free( name ); | |||
| char project_path[ 512 ]; | |||
| fgets( project_path, sizeof( project_path ), fp ); | |||
| fclose( fp ); | |||
| return Project::open( project_path ) == 0; | |||
| } | |||
| void | |||
| LASH_Engine::handle_quit ( void ) | |||
| { | |||
| MESSAGE( "LASH wants us to quit" ); | |||
| tle->quit(); | |||
| } | |||
| @@ -1,38 +0,0 @@ | |||
| /*******************************************************************************/ | |||
| /* 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_Engine : public LASH::Client | |||
| { | |||
| static void timer_cb ( void *v ); | |||
| public: | |||
| LASH_Engine ( ); | |||
| ~LASH_Engine ( ); | |||
| bool handle_save_file ( const char *path ); | |||
| bool handle_restore_file ( const char *path ); | |||
| void handle_quit ( void ); | |||
| }; | |||
| @@ -24,8 +24,6 @@ comment {// | |||
| decl {const float STATUS_UPDATE_FREQ = 0.5f;} {} | |||
| decl {\#include "LASH_Engine.H"} {} | |||
| decl {\#include "Fl_Menu_Settings.H"} {} | |||
| decl {\#include "Timeline.H"} {} | |||
| @@ -67,9 +65,6 @@ decl {extern char project_display_name[256];} {global | |||
| decl {extern char *user_config_dir;} {global | |||
| } | |||
| decl {extern LASH_Engine *lash;} {global | |||
| } | |||
| class TLE {open | |||
| } { | |||
| decl {Fl_Color system_colors[3];} {} | |||
| @@ -694,8 +689,8 @@ ab.run();} | |||
| code0 {\#include "FL/Fl_Blinker.H"} | |||
| class Fl_Blinker | |||
| } | |||
| Fl_Button lash_blinker { | |||
| label LASH | |||
| Fl_Button sm_blinker { | |||
| label SM | |||
| xywh {695 30 50 15} box ROUNDED_BOX down_box ROUNDED_BOX color 75 selection_color 86 labelfont 2 labelcolor 39 deactivate | |||
| code0 {\#include "FL/Fl_Blinker.H"} | |||
| class Fl_Blinker | |||
| @@ -812,8 +807,10 @@ if ( engine->zombified() && ! zombie ) | |||
| solo_blinker->value( Track::soloing() ); | |||
| rec_blinker->value( transport->rolling && transport->rec_enabled() ); | |||
| lash_blinker->value( lash->enabled() ); | |||
| selected_blinker->value( timeline->nselected() );} {} | |||
| sm_blinker->value( timeline->session_manager_name() != NULL ); | |||
| sm_blinker->tooltip( timeline->session_manager_name() ); | |||
| selected_blinker->value( timeline->nselected() );} {selected | |||
| } | |||
| } | |||
| Function {update_cb( void *v )} {open private return_type {static void} | |||
| } { | |||
| @@ -145,6 +145,8 @@ public: | |||
| void update_tempomap ( void ); | |||
| const char *session_manager_name ( void ) { return NULL; } | |||
| nframes_t fpp ( void ) const { return 1 << _fpp; } | |||
| void range ( nframes_t start, nframes_t length ); | |||
| nframes_t length ( void ) const; | |||
| @@ -43,7 +43,6 @@ | |||
| #include "../FL/Boxtypes.H" | |||
| #include "Project.H" | |||
| #include "LASH_Engine.H" | |||
| #include "Transport.H" | |||
| #include "Engine/Engine.H" | |||
| @@ -52,7 +51,6 @@ | |||
| Engine *engine; | |||
| Timeline *timeline; | |||
| Transport *transport; | |||
| LASH_Engine *lash; | |||
| TLE *tle; | |||
| /* TODO: put these in a header */ | |||
| @@ -147,17 +145,6 @@ main ( int argc, char **argv ) | |||
| * scenario requiring otherwise */ | |||
| transport->stop(); | |||
| MESSAGE( "Initializing LASH" ); | |||
| lash = new LASH_Engine; | |||
| if ( argc > 1 && ! strcmp( argv[1], "--no-lash" ) ) | |||
| { | |||
| MESSAGE( "--no-lash specified on command-line: LASH disabled." ); | |||
| shift( argv, &argc, 1 ); | |||
| } | |||
| else | |||
| lash->init( jack_name, APP_TITLE, &argc, &argv ); | |||
| MESSAGE( "Starting GUI" ); | |||
| tle->run(); | |||
| @@ -12,7 +12,7 @@ Timeline_SRCS:=$(Timeline_SRCS:.fl=.C) | |||
| Timeline_SRCS:=$(sort $(Timeline_SRCS)) | |||
| Timeline_OBJS:=$(Timeline_SRCS:.C=.o) | |||
| Timeline_LIBS := $(FLTK_LIBS) $(JACK_LIBS) $(SNDFILE_LIBS) $(LASH_LIBS) | |||
| Timeline_LIBS := $(FLTK_LIBS) $(JACK_LIBS) $(SNDFILE_LIBS) | |||
| Timeline/timeline: $(Timeline_OBJS) FL | |||
| @ echo -n Linking timeline... | |||
| @@ -10,11 +10,10 @@ begin | |||
| begin_options | |||
| ask "Installation prefix" prefix /usr/local | |||
| ask "Use the LASH Audio Session Handler" USE_LASH yes | |||
| ask "Build for debugging" USE_DEBUG no | |||
| using DEBUG && | |||
| { | |||
| { | |||
| ask "Use unoptimized drawing routines" USE_UNOPTIMIZED_DRAWING no | |||
| ask "Use widget for timeline" USE_WIDGET_FOR_TIMELINE no | |||
| using WIDGET_FOR_TIMELINE || ask "Use singlebuffered timeline" USE_SINGLEBUFFERED_TIMELINE no | |||
| @@ -29,6 +28,4 @@ require_command makedepend makedepend | |||
| require_package JACK 0.103.0 jack | |||
| require_package sndfile 1.0.17 sndfile | |||
| using LASH && require_package LASH 0.5.4 lash-1.0 | |||
| end | |||
| @@ -1,134 +0,0 @@ | |||
| /*******************************************************************************/ | |||
| /* 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. */ | |||
| /*******************************************************************************/ | |||
| /* Handler based wrapper for LASH */ | |||
| #include "Client.H" | |||
| /* #include "const.h" */ | |||
| /* #include "util/debug.h" */ | |||
| namespace LASH | |||
| { | |||
| Client::Client ( ) | |||
| { | |||
| _void = 0; | |||
| } | |||
| Client::~Client ( ) | |||
| { | |||
| /* TODO: anything? */ | |||
| } | |||
| #ifdef HAVE_LASH | |||
| #include <lash/lash.h> | |||
| #define _client (static_cast<lash_client_t*>(_void)) | |||
| bool | |||
| Client::init ( const char *jack_name, const char *long_name, int *argc, char ***argv ) | |||
| { | |||
| if ( ! ( _void = lash_init( lash_extract_args( argc, argv ), jack_name, | |||
| LASH_Config_File, LASH_PROTOCOL( 2, 0 ) ) ) ) | |||
| return false; | |||
| /* register name */ | |||
| lash_jack_client_name( _client, jack_name ); | |||
| lash_event_t *e = lash_event_new_with_type( LASH_Client_Name ); | |||
| lash_event_set_string( e, long_name ); | |||
| lash_send_event( _client, e ); | |||
| return true; | |||
| } | |||
| bool | |||
| Client::enabled ( void ) | |||
| { | |||
| return lash_enabled( _client ); | |||
| } | |||
| /** process any queued events */ | |||
| void | |||
| Client::poll ( void ) | |||
| { | |||
| if ( ! _client ) | |||
| return; | |||
| lash_event_t *e; | |||
| while ( ( e = lash_get_event( _client ) ) ) | |||
| { | |||
| const char *name = lash_event_get_string( e ); | |||
| switch ( lash_event_get_type( e ) ) | |||
| { | |||
| case LASH_Save_File: | |||
| handle_save_file( name ); | |||
| lash_send_event( _client, lash_event_new_with_type( LASH_Save_File ) ); | |||
| break; | |||
| case LASH_Restore_File: | |||
| 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 ) ); | |||
| break; | |||
| case LASH_Quit: | |||
| handle_quit(); | |||
| break; | |||
| default: | |||
| // WARNING( "unhandled LASH event" ); | |||
| break; | |||
| } | |||
| lash_event_destroy( e ); | |||
| } | |||
| } | |||
| #else | |||
| bool | |||
| Client::init ( const char *jack_name, const char *long_name, int *argc, char ***argv ) | |||
| { | |||
| return true; | |||
| } | |||
| bool | |||
| Client::enabled ( void ) | |||
| { | |||
| return false; | |||
| } | |||
| void | |||
| Client::poll ( void ) | |||
| { | |||
| } | |||
| #endif | |||
| } | |||
| @@ -1,52 +0,0 @@ | |||
| /*******************************************************************************/ | |||
| /* 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. */ | |||
| /*******************************************************************************/ | |||
| /* generic master class for interfacing with LASH... */ | |||
| #pragma once | |||
| namespace LASH | |||
| { | |||
| class Client | |||
| { | |||
| /* to avoid including the lash header here... */ | |||
| void *_void; | |||
| protected: | |||
| virtual bool handle_save_file ( const char *path ) = 0; | |||
| virtual bool handle_restore_file ( const char *path ) = 0; | |||
| virtual void handle_quit ( void ) = 0; | |||
| public: | |||
| Client ( ); | |||
| virtual ~Client ( ); | |||
| bool init ( const char *jack_name, const char *full_name, int *argc, char ***argv ); | |||
| bool enabled ( void ); | |||
| void poll ( void ); | |||
| void project_save ( void ); | |||
| void project_quit ( void ); | |||
| /* TODO: project_add, project_remove, project_dir, project_name, percentage */ | |||
| }; | |||
| } | |||