Browse Source

Save version and sample rate with project.

tags/non-daw-v1.1.0
Jonathan Moore Liles 17 years ago
parent
commit
767aa44b7c
3 changed files with 55 additions and 4 deletions
  1. +49
    -0
      Timeline/Project.C
  2. +2
    -1
      Timeline/Project.H
  3. +4
    -3
      Timeline/TLE.fl

+ 49
- 0
Timeline/Project.C 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;


+ 2
- 1
Timeline/Project.H 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 );


+ 4
- 3
Timeline/TLE.fl 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
}
}


Loading…
Cancel
Save