@@ -126,7 +126,7 @@ nsd.default_path( *default_path ); | |||||
nsd.run(); | nsd.run(); | ||||
if ( nsd.default_path() ) | if ( nsd.default_path() ) | ||||
*default_path = strdup( nsd.default_path() ); | |||||
*default_path = nsd.default_path(); | |||||
return nsd.path;} {} | return nsd.path;} {} | ||||
} | } |
@@ -1 +1 @@ | |||||
Subproject commit 415422bd1b35cdbac5c751dcf8f4fb9cbe696927 | |||||
Subproject commit d0063527aa360a3f1fd34e76fc0dd9125efb9202 |
@@ -176,6 +176,9 @@ Chain::~Chain ( ) | |||||
engine()->lock(); | engine()->lock(); | ||||
for ( unsigned int i = scratch_port.size(); i--; ) | |||||
delete[] (sample_t*)scratch_port[i].buffer(); | |||||
/* if we leave this up to FLTK, it will happen after we've | /* if we leave this up to FLTK, it will happen after we've | ||||
already destroyed the engine */ | already destroyed the engine */ | ||||
modules_pack->clear(); | modules_pack->clear(); | ||||
@@ -190,11 +190,11 @@ void Mixer::command_new ( void ) | |||||
{ | { | ||||
DMESSAGE( "New project" ); | DMESSAGE( "New project" ); | ||||
char *default_path; | |||||
char *default_path = read_line( user_config_dir, "default_path" ); | |||||
read_line( user_config_dir, "default_path", &default_path ); | |||||
char *path = new_project_chooser( &default_path ); | |||||
char *result_path = default_path; | |||||
char *path = new_project_chooser( &result_path ); | |||||
if ( path ) | if ( path ) | ||||
{ | { | ||||
@@ -207,10 +207,13 @@ void Mixer::command_new ( void ) | |||||
update_menu(); | update_menu(); | ||||
if ( default_path ) | |||||
if ( result_path != default_path ) | |||||
free(default_path); | |||||
if ( result_path ) | |||||
{ | { | ||||
write_line( user_config_dir, "default_path", default_path ); | |||||
free( default_path ); | |||||
write_line( user_config_dir, "default_path", result_path ); | |||||
free( result_path ); | |||||
} | } | ||||
} | } | ||||
@@ -48,6 +48,8 @@ namespace OSC | |||||
free( _path ); | free( _path ); | ||||
if ( _typespec ) | if ( _typespec ) | ||||
free( _typespec ); | free( _typespec ); | ||||
if ( _documentation ) | |||||
free( _documentation ); | |||||
} | } | ||||
/**********/ | /**********/ | ||||
@@ -228,13 +230,25 @@ namespace OSC | |||||
Endpoint::~Endpoint ( ) | Endpoint::~Endpoint ( ) | ||||
{ | { | ||||
// lo_server_thread_free( _st ); | // lo_server_thread_free( _st ); | ||||
for ( std::list<Method*>::iterator i = _methods.begin(); | |||||
i != _methods.end(); | |||||
i++ ) | |||||
delete(*i); | |||||
_methods.clear(); | |||||
if ( _server ) | if ( _server ) | ||||
{ | { | ||||
lo_server_free( _server ); | lo_server_free( _server ); | ||||
_server = 0; | _server = 0; | ||||
} | } | ||||
lo_address_free( _addr ); | |||||
_addr = 0; | |||||
} | } | ||||
OSC::Signal * | OSC::Signal * | ||||
Endpoint::find_target_by_peer_address ( std::list<Signal*> *l, lo_address addr ) | Endpoint::find_target_by_peer_address ( std::list<Signal*> *l, lo_address addr ) | ||||
{ | { | ||||
@@ -947,14 +961,13 @@ namespace OSC | |||||
Signal * | Signal * | ||||
Endpoint::add_signal ( const char *path, Signal::Direction dir, float min, float max, float default_value, signal_handler handler, void *user_data ) | Endpoint::add_signal ( const char *path, Signal::Direction dir, float min, float max, float default_value, signal_handler handler, void *user_data ) | ||||
{ | { | ||||
Signal *o = new Signal( path, dir ); | |||||
char *s; | char *s; | ||||
asprintf( &s, "%s%s", name(), path ); | asprintf( &s, "%s%s", name(), path ); | ||||
if ( s ) | |||||
o->_path = s; | |||||
Signal *o = new Signal( s, dir ); | |||||
free(s); | |||||
o->_handler = handler; | o->_handler = handler; | ||||
o->_user_data = user_data; | o->_user_data = user_data; | ||||
o->_endpoint = this; | o->_endpoint = this; | ||||
@@ -159,25 +159,27 @@ write_line ( const char *dir, const char *name, const char *value ) | |||||
} | } | ||||
/** write a single string to a file */ | /** write a single string to a file */ | ||||
void | |||||
read_line ( const char *dir, const char *name, char **value ) | |||||
char * | |||||
read_line ( const char *dir, const char *name ) | |||||
{ | { | ||||
char path[512]; | char path[512]; | ||||
*value = 0; | |||||
snprintf( path, sizeof( path ), "%s/%s", dir, name ); | snprintf( path, sizeof( path ), "%s/%s", dir, name ); | ||||
FILE *fp = fopen( path, "r" ); | FILE *fp = fopen( path, "r" ); | ||||
if ( ! fp ) | if ( ! fp ) | ||||
return; | |||||
return 0; | |||||
char *value = (char*)malloc( 512 ); | |||||
*value = (char*)malloc( 512 ); | |||||
value[0] = 0; | |||||
fgets( *value, 512, fp ); | |||||
fgets( value, 512, fp ); | |||||
fclose( fp ); | fclose( fp ); | ||||
return value; | |||||
} | } | ||||
#include <sys/statvfs.h> | #include <sys/statvfs.h> | ||||
@@ -30,7 +30,7 @@ int backwards_fgetc ( FILE *fp ); | |||||
char * backwards_fgets ( char *s, int size, FILE *fp ); | char * backwards_fgets ( char *s, int size, FILE *fp ); | ||||
void touch ( int fd ); | void touch ( int fd ); | ||||
void write_line ( const char *dir, const char *name, const char *value ); | void write_line ( const char *dir, const char *name, const char *value ); | ||||
void read_line ( const char *dir, const char *name, char **value ); | |||||
char * read_line ( const char *dir, const char *name ); | |||||
size_t free_space ( const char *file ); | size_t free_space ( const char *file ); | ||||
size_t total_space ( const char *file ); | size_t total_space ( const char *file ); | ||||
int percent_used ( const char *file ); | int percent_used ( const char *file ); |
@@ -144,7 +144,7 @@ class NSM_Client : public Fl_Group | |||||
client_name->copy_label( l ); | client_name->copy_label( l ); | ||||
// _client_label = l; | |||||
free(l); | |||||
redraw(); | redraw(); | ||||
} | } | ||||
@@ -178,7 +178,7 @@ public: | |||||
{ | { | ||||
if ( _client_id ) | if ( _client_id ) | ||||
free( _client_id ); | free( _client_id ); | ||||
_client_id = strdup( v ); | _client_id = strdup( v ); | ||||
} | } | ||||
@@ -240,11 +240,7 @@ public: | |||||
void | void | ||||
pending_command ( const char *command ) | pending_command ( const char *command ) | ||||
{ | { | ||||
char *cmd = strdup( command ); | |||||
free( (void*)_progress->label() ); | |||||
_progress->label( cmd ); | |||||
_progress->copy_label( command ); | |||||
stopped( 0 ); | stopped( 0 ); | ||||
@@ -375,7 +371,7 @@ public: | |||||
{ Fl_Progress *o = _progress = new Fl_Progress( xx, Y + H * 0.25, 75, H * 0.50, NULL ); | { Fl_Progress *o = _progress = new Fl_Progress( xx, Y + H * 0.25, 75, H * 0.50, NULL ); | ||||
o->box( FL_FLAT_BOX ); | o->box( FL_FLAT_BOX ); | ||||
o->color( FL_BLACK ); | o->color( FL_BLACK ); | ||||
o->label( strdup( "launch" ) ); | |||||
o->copy_label( "launch" ); | |||||
o->labelsize( 12 ); | o->labelsize( 12 ); | ||||
o->minimum( 0.0f ); | o->minimum( 0.0f ); | ||||
o->maximum( 1.0f ); | o->maximum( 1.0f ); | ||||
@@ -462,6 +458,12 @@ public: | |||||
~NSM_Client ( ) | ~NSM_Client ( ) | ||||
{ | { | ||||
if ( _client_id ) | |||||
{ | |||||
free( _client_id ); | |||||
_client_id = NULL; | |||||
} | |||||
if ( _client_name ) | if ( _client_name ) | ||||
{ | { | ||||
free( _client_name ); | free( _client_name ); | ||||
@@ -925,7 +927,7 @@ public: | |||||
o->type( FL_VERTICAL ); | o->type( FL_VERTICAL ); | ||||
o->spacing( 2 ); | o->spacing( 2 ); | ||||
{ Fl_Box *o = new Fl_Box( 0,0,100, 24, "Sessions" ); | |||||
{ new Fl_Box( 0,0,100, 24, "Sessions" ); | |||||
} | } | ||||
{ | { | ||||
@@ -1049,8 +1051,6 @@ public: | |||||
osc->owner = this; | osc->owner = this; | ||||
osc->url(); | |||||
osc->add_method( "/error", "sis", osc_handler, osc, "msg" ); | osc->add_method( "/error", "sis", osc_handler, osc, "msg" ); | ||||
osc->add_method( "/reply", "ss", osc_handler, osc, "msg" ); | osc->add_method( "/reply", "ss", osc_handler, osc, "msg" ); | ||||
osc->add_method( "/reply", "s", osc_handler, osc, "" ); | osc->add_method( "/reply", "s", osc_handler, osc, "" ); | ||||
@@ -1398,14 +1398,13 @@ main (int argc, char **argv ) | |||||
{ | { | ||||
/* pass non-option arguments on to daemon */ | /* pass non-option arguments on to daemon */ | ||||
char **args = (char **)malloc( 4 + argc - optind ); | |||||
char *args[4 + argc - optind]; | |||||
int i = 0; | int i = 0; | ||||
args[i++] = (char*)"nsmd"; | |||||
args[i++] = (char*)"--gui-url"; | |||||
args[i++] = strdup("nsmd"); | |||||
args[i++] = strdup("--gui-url"); | |||||
args[i++] = url; | args[i++] = url; | ||||
for ( ; optind < argc; i++, optind++ ) | for ( ; optind < argc; i++, optind++ ) | ||||
{ | { | ||||
DMESSAGE( "Passing argument: %s", argv[optind] ); | DMESSAGE( "Passing argument: %s", argv[optind] ); | ||||
@@ -1419,6 +1418,8 @@ main (int argc, char **argv ) | |||||
FATAL( "Error starting process: %s", strerror( errno ) ); | FATAL( "Error starting process: %s", strerror( errno ) ); | ||||
} | } | ||||
} | } | ||||
free(url); | |||||
} | } | ||||
Fl::add_timeout( 1.0, ping, NULL ); | Fl::add_timeout( 1.0, ping, NULL ); | ||||
@@ -38,12 +38,15 @@ OSC_Thread::OSC_Thread ( ) | |||||
OSC_Thread::~OSC_Thread ( ) | OSC_Thread::~OSC_Thread ( ) | ||||
{ | { | ||||
lock(); | |||||
if ( _shutdown == false ) | if ( _shutdown == false ) | ||||
{ | { | ||||
_shutdown = true; | _shutdown = true; | ||||
_thread.join(); | _thread.join(); | ||||
} | } | ||||
} | |||||
unlock(); | |||||
} | |||||
void | void | ||||
OSC_Thread::start ( ) | OSC_Thread::start ( ) | ||||
@@ -209,7 +209,7 @@ Project::close ( void ) | |||||
*Project::_name = '\0'; | *Project::_name = '\0'; | ||||
*Project::_created_on = '\0'; | *Project::_created_on = '\0'; | ||||
release_lock( &_lockfd, ".lock" ); | release_lock( &_lockfd, ".lock" ); | ||||
delete engine; | delete engine; | ||||
@@ -326,6 +326,9 @@ Project::open ( const char *name ) | |||||
else | else | ||||
*_created_on = 0; | *_created_on = 0; | ||||
free( created_by ); | |||||
free( creation_date ); | |||||
set_name( name ); | set_name( name ); | ||||
*_path = '\0'; | *_path = '\0'; | ||||
@@ -330,12 +330,13 @@ pi.run();} | |||||
label {&New} | label {&New} | ||||
callback {save_timeline_settings(); | callback {save_timeline_settings(); | ||||
char *result_path; | |||||
char *default_path; | |||||
char *default_path = read_line( user_config_dir, "default_path" ); | |||||
result_path = default_path; | |||||
read_line( user_config_dir, "default_path", &default_path ); | |||||
char *path = new_project_chooser( &default_path ); | |||||
char *path = new_project_chooser( &result_path ); | |||||
if ( path ) | if ( path ) | ||||
{ | { | ||||
@@ -344,10 +345,13 @@ char *default_path; | |||||
free( path ); | free( path ); | ||||
} | } | ||||
if ( default_path ) | |||||
if ( reuslt_path != default_path ) | |||||
free(default_path); | |||||
if ( result_path ) | |||||
{ | { | ||||
write_line( user_config_dir, "default_path", default_path ); | |||||
free( default_path ); | |||||
write_line( user_config_dir, "default_path", result_path ); | |||||
free( result_path ); | |||||
} | } | ||||
@@ -395,6 +395,8 @@ Timeline::menu_cb ( Fl_Menu_ *m ) | |||||
Track *t = new Track( name ); | Track *t = new Track( name ); | ||||
free( name ); | |||||
Audio_Sequence *o = new Audio_Sequence( t ); | Audio_Sequence *o = new Audio_Sequence( t ); | ||||
add_track( t ); | add_track( t ); | ||||
@@ -582,6 +584,8 @@ Timeline::~Timeline ( ) | |||||
{ | { | ||||
delete osc_thread; | delete osc_thread; | ||||
osc_thread = 0; | osc_thread = 0; | ||||
delete osc; | |||||
osc = 0; | |||||
} | } | ||||
Timeline::Timeline ( int X, int Y, int W, int H, const char* L ) : BASE( X, Y, W, H, L ) | Timeline::Timeline ( int X, int Y, int W, int H, const char* L ) : BASE( X, Y, W, H, L ) | ||||
@@ -2095,7 +2099,9 @@ Timeline::init_osc ( const char *osc_port ) | |||||
osc->owner = this; | osc->owner = this; | ||||
printf( "OSC=%s\n", osc->url() ); | |||||
char *url = osc->url(); | |||||
printf( "OSC=%s\n", url ); | |||||
free(url); | |||||
osc->add_method( "/non/hello", "ssss", &Timeline::osc_non_hello, osc, "" ); | osc->add_method( "/non/hello", "ssss", &Timeline::osc_non_hello, osc, "" ); | ||||