~ubuntu-branches/ubuntu/feisty/muse/feisty

« back to all changes in this revision

Viewing changes to synti/stklib/WvIn.h

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Kobras
  • Date: 2002-04-23 17:28:23 UTC
  • Revision ID: james.westby@ubuntu.com-20020423172823-w8yplzr81a759xa3
Tags: upstream-0.5.2
ImportĀ upstreamĀ versionĀ 0.5.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/********************************************/
 
2
/*
 
3
  Audio Data Input Base Class
 
4
  by Gary P. Scavone, 1999-2000
 
5
 
 
6
  This class can handle multi-channel
 
7
  input.  Multi-channel input is
 
8
  interleaved in the vector "data".
 
9
  Actual data input occurs in the
 
10
  subclasses of WvIn.
 
11
 
 
12
  Currently, STK is only supporting a few data
 
13
  types (16-bit integer .snd, .wav, .raw, and
 
14
  .aif files and 64-bit double MAT-files).  In
 
15
  order to support more formats AND to make the
 
16
  writing of subclasses easier, a format ENUM
 
17
  could be defined and a generalized getData()
 
18
  function written within this WvIn class.  Then,
 
19
  most subclasses of WvIn would only have to
 
20
  setup the appropriate parameters and all
 
21
  other processing would happen here.
 
22
*/
 
23
/********************************************/
 
24
 
 
25
#if !defined(__WvIn_h)
 
26
#define __WvIn_h
 
27
 
 
28
/* "Oneshot" files larger than MAX_FILE_LOAD_SIZE will be
 
29
   copied into memory in RT_BUFFER_SIZE chunks, rather than
 
30
   completely loaded into a buffer at instantiation.
 
31
*/
 
32
#define MAX_FILE_LOAD_SIZE 5000000
 
33
 
 
34
// Buffer size, in sample frames, when incrementally loading from disk
 
35
#define LOAD_BUFFER_SIZE 1024
 
36
 
 
37
#include "Object.h"
 
38
#include "StkError.h"
 
39
 
 
40
class WvIn : public Object
 
41
{
 
42
protected:  
 
43
  long fileSize;
 
44
  long bufferSize;
 
45
  long readPointer;
 
46
  long dataOffset;
 
47
  int channels;
 
48
  int looping;
 
49
  int finished;
 
50
  int chunking;
 
51
  int interpolate;
 
52
  MY_FLOAT *data;
 
53
  MY_FLOAT time;
 
54
  MY_FLOAT rate;
 
55
  MY_FLOAT phaseOffset;
 
56
  MY_FLOAT *lastOutput;
 
57
  FILE *fd;
 
58
  virtual void getData(long index);
 
59
public:
 
60
  WvIn();
 
61
  virtual ~WvIn();
 
62
  void reset();
 
63
  void normalize();
 
64
  void normalize(MY_FLOAT newPeak);
 
65
  virtual void setRate(MY_FLOAT aRate);
 
66
  void setFreq(MY_FLOAT aFreq);
 
67
  virtual void addTime(MY_FLOAT aTime);
 
68
  void addPhase(MY_FLOAT anAngle);
 
69
  void addPhaseOffset(MY_FLOAT anAngle);
 
70
  void setInterpolate(int anInterpStatus);
 
71
  virtual void setLooping(int aLoopStatus);
 
72
  long getSize();
 
73
  int isFinished();
 
74
  virtual int informTick();
 
75
  MY_FLOAT tick();
 
76
  MY_MULTI mtick();
 
77
  MY_FLOAT lastOut();
 
78
  MY_MULTI mlastOut();
 
79
};
 
80
 
 
81
#endif // defined(__WvIn_h)