Save version and sample rate with project.

This commit is contained in:
Jonathan Moore Liles 2008-05-06 19:41:07 -05:00
parent 281607550b
commit 767aa44b7c
3 changed files with 55 additions and 4 deletions

View File

@ -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;

View File

@ -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 );

View File

@ -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
}
}