aboutsummaryrefslogtreecommitdiff
path: root/src/midiio/include/Voice.h
blob: 3cddf9f3fc2b1be1e9748b566f16869b77c4553e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
//
// Programmer:    Craig Stuart Sapp <craig@ccrma.stanford.edu>
// Creation Date: Sun Oct 11 18:21:46 PDT 1998
// Last Modified: Sun Oct 11 18:33:04 PDT 1998
// Filename:      ...sig/maint/code/control/Voice/Voice.h
// Web Address:   http://www-ccrma.stanford.edu/~craig/improv/include/Voice.h
// Syntax:        C++
//
// Description:   The Voice class is a MIDI output class which keeps
//                track of the last note played in to it.  If the last
//                note was not turned off when a new note is played,
//                then the old note will be turned off before the 
//                new note is played.
//

#ifndef _VOICE_H_INCLUDED
#define _VOICE_H_INCLUDED

#include "MidiOutput.h"

class Voice : public MidiOutput {
   public:
                   Voice          (int aChannel);
                   Voice          (const Voice& aVoice);
                   Voice          (void);
                  ~Voice          ();

      void         cont           (int controler, int data);
      int          getChan        (void) const;
      int          getChannel     (void) const;
      int          getKey         (void) const;
      int          getKeynum      (void) const;
      int          getOffTime     (void) const;
      int          getOnTime      (void) const;
      int          getVel         (void) const;
      int          getVelocity    (void) const;
      void         off            (void);
      void         pc             (int aTimbre);
      void         play           (int aChannel, int aKeyno, int aVelocity);
      void         play           (int aKeyno, int aVelocity);
      void         play           (void);
      void         setChan        (int aChannel);
      void         setChannel     (int aChannel);
      void         setKey         (int aKeyno);
      void         setKeynum      (int aKeyno);
      void         setVel         (int aVelocity);
      void         setVelocity    (int aVelocity);
      int          status         (void) const;
      void         sustain        (int aStatus);

   protected:
      int          chan;         // the current channel number
      int          key;          // the current key number
      int          vel;          // the current velocity value

      int          onTime;       // last note on message sent
      int          offTime;      // last note off message sent

      int          oldChan;      // last channel played on
      int          oldKey;       // last key to be played
      int          oldVel;       // last velocity of last key

      static SigTimer timer;     // for recording on/off times
};


#endif /* _VOICE_H_INCLUDED */


// md5sum:	8a5495ecc10d42be6b1832492e107723  - Voice.h =css= 20030102