diff --git a/Timeline/Project.C b/Timeline/Project.C index 87e4c55..331745f 100644 --- a/Timeline/Project.C +++ b/Timeline/Project.C @@ -31,6 +31,10 @@ project state belongs to Timeline and other classes. */ #include "Loggable.H" #include "Project.H" +#include "Timeline.H" // for sample_rate(); + +#define APP_TITLE "Non-DAW" + #include "debug.h" char Project::_name[256]; bool Project::_is_open = false; @@ -62,9 +66,52 @@ Project::close ( void ) { Loggable::close(); + write_info(); + _is_open = false; } +bool +Project::write_info ( void ) +{ + + if ( ! open() ) + return true; + + FILE *fp; + + if ( ! ( fp = fopen( "info", "w" ) ) ) + { + WARNING( "could not open project info file for writing." ); + return false; + } + + fprintf( fp, "version\n\t%s\nsample rate\n\t%lu\n", APP_TITLE " " VERSION, timeline->sample_rate() ); + + fclose( fp ); + + return true; +} + +bool +Project::read_info ( void ) +{ + FILE *fp; + + if ( ! ( fp = fopen( "info", "r" ) ) ) + { + WARNING( "could not open project info file for reading." ); + return false; + } + + /* TODO: something */ + + fclose( fp ); + + return true; +} + + bool Project::open ( const char *name ) { @@ -87,6 +134,8 @@ Project::open ( const char *name ) set_name( name ); + read_info(); + _is_open = true; return true; diff --git a/Timeline/Project.H b/Timeline/Project.H index 8f5f5f0..13997e5 100644 --- a/Timeline/Project.H +++ b/Timeline/Project.H @@ -28,7 +28,8 @@ class Project public: - + static bool write_info ( void ); + static bool read_info ( void ); static const char *name ( void ) { return Project::_name; } static void set_name ( const char *name ); static bool close ( void ); diff --git a/Timeline/TLE.fl b/Timeline/TLE.fl index c9ebfef..3a15998 100644 --- a/Timeline/TLE.fl +++ b/Timeline/TLE.fl @@ -131,8 +131,7 @@ menubar->picked( menubar->find_item( "&Timeline/Capture Format/Wav 24" ) ); char *path; asprintf( &path, "%s/options", user_config_dir ); ((Fl_Menu_Settings*)menubar)->load( menubar->find_item( "&Options" ), path ); -free( path );} {selected - } +free( path );} {} } Function {make_window()} {open } { @@ -215,9 +214,11 @@ Loggable::compact();} save_timeline_settings(); +Project::close(); + printf( "dropped %d buffers\\n", engine->dropped() ); -exit( 0 );} +exit( 0 );} selected xywh {40 40 40 25} shortcut 0x40071 } }