diff --git a/Timeline/Audio_File.H b/Timeline/Audio_File.H index 93671f3..f8a6a12 100644 --- a/Timeline/Audio_File.H +++ b/Timeline/Audio_File.H @@ -22,7 +22,7 @@ /* Base class for all audio file library interfaces */ #include -typedef unsigned long nframes_t; +#include "types.h" typedef float sample_t; #include "Peaks.H" diff --git a/Timeline/Makefile b/Timeline/Makefile index 25173cc..d8edcd9 100644 --- a/Timeline/Makefile +++ b/Timeline/Makefile @@ -13,6 +13,7 @@ SRCS= \ Audio_File_SF.C \ Port.C \ Disk_Stream.C \ + Engine.C \ Loggable.C \ OBJS=$(SRCS:.C=.o) diff --git a/Timeline/Mutex.H b/Timeline/Mutex.H new file mode 100644 index 0000000..92c90a6 --- /dev/null +++ b/Timeline/Mutex.H @@ -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 + +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 ); + } + +}; diff --git a/Timeline/Peaks.H b/Timeline/Peaks.H index 46e03ba..880029e 100644 --- a/Timeline/Peaks.H +++ b/Timeline/Peaks.H @@ -21,7 +21,7 @@ #include -typedef unsigned long nframes_t; +#include "types.h" struct Peak { float min; diff --git a/Timeline/Port.H b/Timeline/Port.H index 4649085..6fc631f 100644 --- a/Timeline/Port.H +++ b/Timeline/Port.H @@ -23,7 +23,7 @@ typedef float sample_t; //typedef jack_nframes_t nframes_t; -typedef unsigned long nframes_t; +#include "types.h" class Port { diff --git a/Timeline/Timeline.C b/Timeline/Timeline.C index 534002e..34d5a12 100644 --- a/Timeline/Timeline.C +++ b/Timeline/Timeline.C @@ -17,7 +17,6 @@ /* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /*******************************************************************************/ - #include "Timeline.H" #include "Tempo_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; +} diff --git a/Timeline/Timeline.H b/Timeline/Timeline.H index c51dc61..406fffb 100644 --- a/Timeline/Timeline.H +++ b/Timeline/Timeline.H @@ -27,9 +27,12 @@ #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 */ -typedef unsigned long nframes_t; +#include "types.h" #include #include @@ -74,8 +77,11 @@ struct Rectangle }; +class Engine; -class Timeline : public Fl_Overlay_Window +#include "Mutex.H" + +class Timeline : public Fl_Overlay_Window, public Mutex { 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: - nframes_t xoffset; int _yposition; @@ -139,4 +144,9 @@ public: void select( const Rectangle &r ); +private: + + friend class Engine; // FIXME: only Engine::process() needs to be friended.x + + nframes_t process ( nframes_t nframes ); }; diff --git a/Timeline/Track.H b/Timeline/Track.H index d8f3a41..53d4455 100644 --- a/Timeline/Track.H +++ b/Timeline/Track.H @@ -38,6 +38,8 @@ class Region; class Track_Widget; +#include "types.h" + /* This is the base class for all track types. */ class Track : public Fl_Widget, public Loggable @@ -124,4 +126,6 @@ public: virtual int handle ( int m ); virtual void draw ( void ); + virtual nframes_t process ( nframes_t nframes ) { return 0; } + }; diff --git a/Timeline/Track_Header.C b/Timeline/Track_Header.C index efaa820..c73b2c7 100644 --- a/Timeline/Track_Header.C +++ b/Timeline/Track_Header.C @@ -96,6 +96,8 @@ Track_Header::Track_Header ( int X, int Y, int W, int H, const char *L ) : _show_all_takes = false; _size = 1; +// diskstream = new Disk_Stream( this ); + Fl_Group::size( w(), height() ); Track_Header *o = this; @@ -276,3 +278,14 @@ Track_Header::add_control( Track *t ) resize(); } + + +/**********/ +/* Engine */ +/**********/ + +nframes_t +Track_Header::process ( nframes_t nframes ) +{ + return track()->process( nframes ); +} diff --git a/Timeline/Track_Header.H b/Timeline/Track_Header.H index b2c2379..4a8a30c 100644 --- a/Timeline/Track_Header.H +++ b/Timeline/Track_Header.H @@ -34,6 +34,8 @@ #include using std::vector; +class Disk_Stream; + class Track_Header : public Fl_Group, public Loggable { @@ -71,9 +73,8 @@ public: Fl_Pack *control; Fl_Pack *takes; - vector output; /* output ports... */ - + Disk_Stream *diskstream; const char *class_name ( void ) { return "Track_Header"; } @@ -262,5 +263,7 @@ public: } } + + nframes_t process ( nframes_t nframes ); }; #endif