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

« back to all changes in this revision

Viewing changes to midiport.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: midiport.h,v 1.1.1.1 2003/10/29 10:04:59 wschweer Exp $
5
 
//
6
 
//  (C) Copyright 1999/2000 Werner Schweer (ws@seh.de)
7
 
//=========================================================
8
 
 
9
 
#ifndef __MIDIPORT_H__
10
 
#define __MIDIPORT_H__
11
 
 
12
 
class MidiDevice;
13
 
class MidiInstrument;
14
 
 
15
 
const int MIDI_PORTS  = 16;   // max Number of Midi Ports
16
 
 
17
 
#ifndef MIDI_CHANNELS
18
 
#define MIDI_CHANNELS 16       // Channels per Port
19
 
#endif
20
 
 
21
 
class MidiPlayEvent;
22
 
 
23
 
//---------------------------------------------------------
24
 
//   ChannelState
25
 
//---------------------------------------------------------
26
 
 
27
 
struct ChannelState {
28
 
      int pitch;              // -8192 -- + 8191
29
 
      int program;
30
 
      signed char controller[128];
31
 
      };
32
 
 
33
 
//---------------------------------------------------------
34
 
//   MidiPort
35
 
//---------------------------------------------------------
36
 
 
37
 
class MidiPort {
38
 
      ChannelState _iState[MIDI_CHANNELS];    // Initial State
39
 
      ChannelState _cState[MIDI_CHANNELS];    // Current State
40
 
      MidiDevice* _device;
41
 
      int _masterVol;
42
 
      QString _state;
43
 
      MidiInstrument* _instrument;
44
 
      int _rwFlags;      // bits: 1 play, 2 capture, 3 duplex
45
 
 
46
 
   public:
47
 
      MidiPort();
48
 
 
49
 
      bool guiVisible() const;
50
 
      void showGui(bool f);
51
 
      bool hasGui() const;
52
 
 
53
 
      int portno() const;
54
 
      int rwFlags() const              { return _rwFlags; }
55
 
      void setrwFlags(int val);
56
 
 
57
 
      ChannelState* iState(int ch) { return &_iState[ch]; }
58
 
      ChannelState* cState(int ch) { return &_cState[ch]; }
59
 
      MidiDevice* device() const   { return _device; }
60
 
      const QString& state() const { return _state; }
61
 
      void setState(const QString& s) { _state = s; }
62
 
      void resetCstate(int channel, bool active);
63
 
      void resetIstate(int channel, bool active);
64
 
      void setMidiDevice(MidiDevice* dev);
65
 
      const QString& portname() const;
66
 
      MidiInstrument* instrument() const { return _instrument; }
67
 
      void setInstrument(MidiInstrument* i) { _instrument = i; }
68
 
 
69
 
      void gmOn();
70
 
      void gsOn();
71
 
      void xgOn();
72
 
 
73
 
      void programChange(int chn, int hbank, int lbank, int prg);
74
 
      void programChange(int chn, int prg);
75
 
      void setCtrl(int chan, int ctrl, int val);
76
 
      void nrpn(int chan, int ctrl, int val);
77
 
      void rpn(int chan, int ctrl, int val);
78
 
      void bender(int chn, int val);
79
 
 
80
 
      void clock() const;
81
 
      void putStart() const;
82
 
      void putContinue() const;
83
 
      void putEvent(const MidiPlayEvent*);
84
 
      void sysex(const unsigned char* p, int n);
85
 
 
86
 
      int masterVol() const { return _masterVol; }
87
 
 
88
 
      void setMasterVol(int chan);
89
 
      void resetRunstate();
90
 
      };
91
 
 
92
 
extern MidiPort midiPorts[MIDI_PORTS];
93
 
extern void initMidiPorts();
94
 
 
95
 
class QPopupMenu;
96
 
class QWidget;
97
 
extern QPopupMenu* midiPortsPopup(QWidget*);
98
 
#endif
99