Browse Source

Continue working on engine functionality.

tags/non-daw-v1.1.0
Jonathan Moore Liles 17 years ago
parent
commit
0dff4be584
10 changed files with 113 additions and 9 deletions
  1. +1
    -1
      Timeline/Audio_File.H
  2. +1
    -0
      Timeline/Makefile
  3. +54
    -0
      Timeline/Mutex.H
  4. +1
    -1
      Timeline/Peaks.H
  5. +1
    -1
      Timeline/Port.H
  6. +20
    -1
      Timeline/Timeline.C
  7. +13
    -3
      Timeline/Timeline.H
  8. +4
    -0
      Timeline/Track.H
  9. +13
    -0
      Timeline/Track_Header.C
  10. +5
    -2
      Timeline/Track_Header.H

+ 1
- 1
Timeline/Audio_File.H View File

@@ -22,7 +22,7 @@
/* Base class for all audio file library interfaces */
#include <stdlib.h>

typedef unsigned long nframes_t;
#include "types.h"
typedef float sample_t;

#include "Peaks.H"


+ 1
- 0
Timeline/Makefile View File

@@ -13,6 +13,7 @@ SRCS= \
Audio_File_SF.C \
Port.C \
Disk_Stream.C \
Engine.C \
Loggable.C \

OBJS=$(SRCS:.C=.o)


+ 54
- 0
Timeline/Mutex.H View File

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

};

+ 1
- 1
Timeline/Peaks.H View File

@@ -21,7 +21,7 @@

#include <stdlib.h>

typedef unsigned long nframes_t;
#include "types.h"

struct Peak {
float min;


+ 1
- 1
Timeline/Port.H View File

@@ -23,7 +23,7 @@

typedef float sample_t;
//typedef jack_nframes_t nframes_t;
typedef unsigned long nframes_t;
#include "types.h"

class Port
{


+ 20
- 1
Timeline/Timeline.C View File

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

+ 13
- 3
Timeline/Timeline.H View File

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

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

+ 4
- 0
Timeline/Track.H View File

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

};

+ 13
- 0
Timeline/Track_Header.C View File

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

+ 5
- 2
Timeline/Track_Header.H View File

@@ -34,6 +34,8 @@
#include <vector>
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 <Port> 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

Loading…
Cancel
Save