~ubuntu-branches/ubuntu/quantal/muse/quantal

« back to all changes in this revision

Viewing changes to synti/libsynti/mpevent.h

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Kobras
  • Date: 2005-08-23 17:19:39 UTC
  • mto: (4.1.1 breezy) (1.1.9) (10.1.6 sid)
  • mto: This revision was merged to the branch mainline in revision 5.
  • Revision ID: james.westby@ubuntu.com-20050823171939-hd8fgzokb4dbj007
Tags: upstream-0.7.1+0.7.2pre2
ImportĀ upstreamĀ versionĀ 0.7.1+0.7.2pre2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
//=========================================================
 
2
//  MusE
 
3
//  Linux Music Editor
 
4
//  $Id: mpevent.h,v 1.1 2004/02/12 18:30:31 wschweer Exp $
 
5
//
 
6
//  (C) Copyright 1999-2002 Werner Schweer (ws@seh.de)
 
7
//=========================================================
 
8
 
 
9
#ifndef __MPEVENT_H__
 
10
#define __MPEVENT_H__
 
11
 
 
12
#include "evdata.h"
 
13
 
 
14
//---------------------------------------------------------
 
15
//   MEvent
 
16
//    baseclass for MidiPlayEvent and MidiRecordEvent
 
17
//---------------------------------------------------------
 
18
 
 
19
//---------------------------------------------------------
 
20
//   MEvent
 
21
//---------------------------------------------------------
 
22
 
 
23
class MEvent {
 
24
      unsigned _time;
 
25
      EvData edata;
 
26
      unsigned char _port, _channel, _type;
 
27
      int _a, _b;
 
28
 
 
29
   public:
 
30
      MEvent() {}
 
31
      MEvent(unsigned tm, int p, int c, int t, int a, int b)
 
32
        : _time(tm), _port(p), _channel(c & 0xf), _type(t), _a(a), _b(b) {}
 
33
      MEvent(unsigned t, int p, int type, const unsigned char* data, int len);
 
34
      MEvent(unsigned t, int p, int tpe, EvData d) : _time(t), edata(d), _port(p), _type(tpe) {}
 
35
 
 
36
      ~MEvent()         {}
 
37
 
 
38
      int port()    const      { return _port;    }
 
39
      int channel() const      { return _channel; }
 
40
      int type()    const      { return _type;    }
 
41
      int dataA()   const      { return _a;       }
 
42
      int dataB()   const      { return _b;       }
 
43
      unsigned time() const    { return _time;    }
 
44
 
 
45
      void setPort(int val)    { _port = val;     }
 
46
      void setChannel(int val) { _channel = val;  }
 
47
      void setType(int val)    { _type = val;     }
 
48
      void setA(int val)       { _a = val;        }
 
49
      void setB(int val)       { _b = val;        }
 
50
      void setTime(unsigned val) { _time = val;     }
 
51
 
 
52
      const EvData& eventData() const { return edata; }
 
53
      unsigned char* data() const     { return edata.data; }
 
54
      int len() const                 { return edata.dataLen; }
 
55
      void setData(const EvData& e)   { edata = e; }
 
56
      void setData(const unsigned char* p, int len) { edata.setData(p, len); }
 
57
      bool isNote() const      { return _type == 0x90; }
 
58
      bool isNoteOff() const   { return (_type == 0x80)||(_type == 0x90 && _b == 0); }
 
59
      };
 
60
 
 
61
//---------------------------------------------------------
 
62
//   MidiRecordEvent
 
63
//    allocated and deleted in midiseq thread context
 
64
//---------------------------------------------------------
 
65
 
 
66
class MidiPlayEvent;
 
67
 
 
68
class MidiRecordEvent : public MEvent {
 
69
   public:
 
70
      MidiRecordEvent() {}
 
71
      MidiRecordEvent(const MEvent& e) : MEvent(e) {}
 
72
      MidiRecordEvent(unsigned tm, int p, int c, int t, int a, int b)
 
73
        : MEvent(tm, p, c, t, a, b) {}
 
74
      MidiRecordEvent(unsigned t, int p, int tpe, const unsigned char* data, int len)
 
75
        : MEvent(t, p, tpe, data, len) {}
 
76
      MidiRecordEvent(unsigned t, int p, int type, EvData data)
 
77
        : MEvent(t, p, type, data) {}
 
78
      ~MidiRecordEvent() {}
 
79
      };
 
80
 
 
81
//---------------------------------------------------------
 
82
//   MidiPlayEvent
 
83
//    allocated and deleted in audio thread context
 
84
//---------------------------------------------------------
 
85
 
 
86
class MidiPlayEvent : public MEvent {
 
87
   public:
 
88
      MidiPlayEvent() {}
 
89
      MidiPlayEvent(const MEvent& e) : MEvent(e) {}
 
90
      MidiPlayEvent(unsigned tm, int p, int c, int t, int a, int b)
 
91
        : MEvent(tm, p, c, t, a, b) {}
 
92
      MidiPlayEvent(unsigned t, int p, int type, const unsigned char* data, int len)
 
93
        : MEvent(t, p, type, data, len) {}
 
94
      MidiPlayEvent(unsigned t, int p, int type, EvData data)
 
95
        : MEvent(t, p, type, data) {}
 
96
      ~MidiPlayEvent() {}
 
97
      };
 
98
 
 
99
#endif
 
100