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

« back to all changes in this revision

Viewing changes to minstrument.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: minstrument.h,v 1.1.1.1 2003/10/29 10:05:10 wschweer Exp $
5
 
//
6
 
//  (C) Copyright 2000 Werner Schweer (ws@seh.de)
7
 
//=========================================================
8
 
 
9
 
#ifndef __MINSTRUMENT_H__
10
 
#define __MINSTRUMENT_H__
11
 
 
12
 
#include "globaldefs.h"
13
 
#include <list>
14
 
#include <vector>
15
 
#include <qstring.h>
16
 
 
17
 
class MidiPort;
18
 
class QPopupMenu;
19
 
class MidiPlayEvent;
20
 
class Xml;
21
 
class EventList;
22
 
 
23
 
//---------------------------------------------------------
24
 
//   Patch
25
 
//---------------------------------------------------------
26
 
 
27
 
struct Patch {
28
 
      signed char typ;                     // 1 - GM  2 - GS  4 - XG
29
 
      signed char hbank, lbank, prog;
30
 
      QString name;
31
 
      bool drum;
32
 
      void read(Xml&);
33
 
      };
34
 
 
35
 
//---------------------------------------------------------
36
 
//   MidiInstrument
37
 
//---------------------------------------------------------
38
 
 
39
 
class MidiInstrument {
40
 
 
41
 
   protected:
42
 
      EventList* _midiInit;
43
 
      EventList* _midiReset;
44
 
      EventList* _midiState;
45
 
      QString _name;
46
 
 
47
 
   public:
48
 
      MidiInstrument();
49
 
      virtual ~MidiInstrument();
50
 
      MidiInstrument(const QString& txt);
51
 
      const QString& iname() const      { return _name; }
52
 
      void setIName(const QString& txt) { _name = txt; }
53
 
 
54
 
      EventList* midiInit() const       { return _midiInit; }
55
 
      EventList* midiReset() const      { return _midiReset; }
56
 
      EventList* midiState() const      { return _midiState; }
57
 
 
58
 
      void readMidiState(Xml& xml);
59
 
      virtual bool guiVisible() const   { return false; }
60
 
      virtual void showGui(bool)        {}
61
 
      virtual bool hasGui() const       { return false; }
62
 
      virtual void writeToGui(const MidiPlayEvent*) {}
63
 
 
64
 
      virtual void reset(int, MType);
65
 
      virtual const char* getPatchName(int,int,int,int,MType);
66
 
      virtual void populatePatchPopup(QPopupMenu*, int, MType) {}
67
 
      };
68
 
 
69
 
//---------------------------------------------------------
70
 
//   MidiInstrumentList
71
 
//---------------------------------------------------------
72
 
 
73
 
class MidiInstrumentList : public std::list<MidiInstrument*> {
74
 
 
75
 
   public:
76
 
      MidiInstrumentList() {}
77
 
      };
78
 
 
79
 
typedef std::list<MidiInstrument*>::iterator iMidiInstrument;
80
 
typedef std::list<Patch> PatchList;
81
 
 
82
 
//---------------------------------------------------------
83
 
//   PatchGroup
84
 
//---------------------------------------------------------
85
 
 
86
 
struct PatchGroup {
87
 
      QString name;
88
 
      PatchList patches;
89
 
      void read(Xml&);
90
 
      };
91
 
 
92
 
//---------------------------------------------------------
93
 
//   MidiIDFInstrument
94
 
//---------------------------------------------------------
95
 
 
96
 
class MidiIDFInstrument : public MidiInstrument {
97
 
      std::vector<PatchGroup> pg;
98
 
 
99
 
   public:
100
 
      MidiIDFInstrument() {};
101
 
      virtual void reset(int port, MType type);
102
 
      virtual const char* getPatchName(int, int, int, int, MType);
103
 
      virtual void populatePatchPopup(QPopupMenu*, int, MType);
104
 
      void read(Xml&);
105
 
      };
106
 
 
107
 
extern MidiInstrumentList midiInstruments;
108
 
extern MidiInstrument* genericMidiInstrument;
109
 
extern void initMidiInstruments();
110
 
extern MidiInstrument* registerMidiInstrument(const QString&);
111
 
extern void removeMidiInstrument(const QString& name);
112
 
 
113
 
#endif
114