@@ -22,7 +22,7 @@ | |||||
/* Base class for all audio file library interfaces */ | /* Base class for all audio file library interfaces */ | ||||
#include <stdlib.h> | #include <stdlib.h> | ||||
typedef unsigned long nframes_t; | |||||
#include "types.h" | |||||
typedef float sample_t; | typedef float sample_t; | ||||
#include "Peaks.H" | #include "Peaks.H" | ||||
@@ -13,6 +13,7 @@ SRCS= \ | |||||
Audio_File_SF.C \ | Audio_File_SF.C \ | ||||
Port.C \ | Port.C \ | ||||
Disk_Stream.C \ | Disk_Stream.C \ | ||||
Engine.C \ | |||||
Loggable.C \ | Loggable.C \ | ||||
OBJS=$(SRCS:.C=.o) | OBJS=$(SRCS:.C=.o) | ||||
@@ -0,0 +1,54 @@ | |||||
/*******************************************************************************/ | |||||
/* 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 <pthread.h> | |||||
class Mutex | |||||
{ | |||||
pthread_mutex_t _lock; | |||||
public: | |||||
Mutex ( ) | |||||
{ | |||||
// _lock = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP; | |||||
} | |||||
void | |||||
lock ( void ) | |||||
{ | |||||
pthread_mutex_lock( &_lock ); | |||||
} | |||||
void | |||||
unlock ( void ) | |||||
{ | |||||
pthread_mutex_unlock( &_lock ); | |||||
} | |||||
int | |||||
trylock ( void ) | |||||
{ | |||||
return pthread_mutex_trylock( &_lock ); | |||||
} | |||||
}; |
@@ -21,7 +21,7 @@ | |||||
#include <stdlib.h> | #include <stdlib.h> | ||||
typedef unsigned long nframes_t; | |||||
#include "types.h" | |||||
struct Peak { | struct Peak { | ||||
float min; | float min; | ||||
@@ -23,7 +23,7 @@ | |||||
typedef float sample_t; | typedef float sample_t; | ||||
//typedef jack_nframes_t nframes_t; | //typedef jack_nframes_t nframes_t; | ||||
typedef unsigned long nframes_t; | |||||
#include "types.h" | |||||
class Port | class Port | ||||
{ | { | ||||
@@ -17,7 +17,6 @@ | |||||
/* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ | /* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ | ||||
/*******************************************************************************/ | /*******************************************************************************/ | ||||
#include "Timeline.H" | #include "Timeline.H" | ||||
#include "Tempo_Track.H" | #include "Tempo_Track.H" | ||||
#include "Time_Track.H" | #include "Time_Track.H" | ||||
@@ -597,3 +596,23 @@ Timeline::handle ( int m ) | |||||
} | } | ||||
} | } | ||||
/**********/ | |||||
/* Engine */ | |||||
/**********/ | |||||
/** call process() on each track header */ | |||||
nframes_t | |||||
Timeline::process ( nframes_t nframes ) | |||||
{ | |||||
for ( int i = tracks->children(); i-- ; ) | |||||
{ | |||||
Track_Header *t = (Track_Header*)tracks->child( i ); | |||||
t->process( nframes ); | |||||
} | |||||
/* FIXME: BOGUS */ | |||||
return nframes; | |||||
} |
@@ -27,9 +27,12 @@ | |||||
#include "Scalebar.H" | #include "Scalebar.H" | ||||
/* FIXME: this class needs a lot of cleaning up. Too many public | |||||
* members etc. */ | |||||
/* #include "Audio_File.H" // just for nframes_t */ | /* #include "Audio_File.H" // just for nframes_t */ | ||||
typedef unsigned long nframes_t; | |||||
#include "types.h" | |||||
#include <math.h> | #include <math.h> | ||||
#include <assert.h> | #include <assert.h> | ||||
@@ -74,8 +77,11 @@ struct Rectangle | |||||
}; | }; | ||||
class Engine; | |||||
#include "Mutex.H" | |||||
class Timeline : public Fl_Overlay_Window | |||||
class Timeline : public Fl_Overlay_Window, public Mutex | |||||
{ | { | ||||
static void draw_clip ( void * v, int X, int Y, int W, int H ); | static void draw_clip ( void * v, int X, int Y, int W, int H ); | ||||
@@ -112,7 +118,6 @@ class Timeline : public Fl_Overlay_Window | |||||
public: | public: | ||||
nframes_t xoffset; | nframes_t xoffset; | ||||
int _yposition; | int _yposition; | ||||
@@ -139,4 +144,9 @@ public: | |||||
void select( const Rectangle &r ); | void select( const Rectangle &r ); | ||||
private: | |||||
friend class Engine; // FIXME: only Engine::process() needs to be friended.x | |||||
nframes_t process ( nframes_t nframes ); | |||||
}; | }; |
@@ -38,6 +38,8 @@ class Region; | |||||
class Track_Widget; | class Track_Widget; | ||||
#include "types.h" | |||||
/* This is the base class for all track types. */ | /* This is the base class for all track types. */ | ||||
class Track : public Fl_Widget, public Loggable | class Track : public Fl_Widget, public Loggable | ||||
@@ -124,4 +126,6 @@ public: | |||||
virtual int handle ( int m ); | virtual int handle ( int m ); | ||||
virtual void draw ( void ); | virtual void draw ( void ); | ||||
virtual nframes_t process ( nframes_t nframes ) { return 0; } | |||||
}; | }; |
@@ -96,6 +96,8 @@ Track_Header::Track_Header ( int X, int Y, int W, int H, const char *L ) : | |||||
_show_all_takes = false; | _show_all_takes = false; | ||||
_size = 1; | _size = 1; | ||||
// diskstream = new Disk_Stream( this ); | |||||
Fl_Group::size( w(), height() ); | Fl_Group::size( w(), height() ); | ||||
Track_Header *o = this; | Track_Header *o = this; | ||||
@@ -276,3 +278,14 @@ Track_Header::add_control( Track *t ) | |||||
resize(); | resize(); | ||||
} | } | ||||
/**********/ | |||||
/* Engine */ | |||||
/**********/ | |||||
nframes_t | |||||
Track_Header::process ( nframes_t nframes ) | |||||
{ | |||||
return track()->process( nframes ); | |||||
} |
@@ -34,6 +34,8 @@ | |||||
#include <vector> | #include <vector> | ||||
using std::vector; | using std::vector; | ||||
class Disk_Stream; | |||||
class Track_Header : public Fl_Group, public Loggable | class Track_Header : public Fl_Group, public Loggable | ||||
{ | { | ||||
@@ -71,9 +73,8 @@ public: | |||||
Fl_Pack *control; | Fl_Pack *control; | ||||
Fl_Pack *takes; | Fl_Pack *takes; | ||||
vector <Port> output; /* output ports... */ | vector <Port> output; /* output ports... */ | ||||
Disk_Stream *diskstream; | |||||
const char *class_name ( void ) { return "Track_Header"; } | const char *class_name ( void ) { return "Track_Header"; } | ||||
@@ -262,5 +263,7 @@ public: | |||||
} | } | ||||
} | } | ||||
nframes_t process ( nframes_t nframes ); | |||||
}; | }; | ||||
#endif | #endif |