summaryrefslogtreecommitdiff
path: root/muse_qt4_evolution/midiplugins/libmidiplugin/mempi.h
blob: a5f114b6c31d9a25cf6d1d39cae240fb148e830d (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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
//=========================================================
//  MusE
//  Linux Music Editor
//    $Id: mempi.h,v 1.10 2005/07/16 09:31:50 wschweer Exp $
//  (C) Copyright 2005 Werner Schweer (ws@seh.de)
//=========================================================

//
//    MusE experimental midi plugin interface
//

#ifndef __MEMPI_H__
#define __MEMPI_H__

#define MEMPI_MAJOR_VERSION 1
#define MEMPI_MINOR_VERSION 1

#include <set>
#include "evdata.h"
#include "memory.h"
#include "midievent.h"

class MempiP;

//---------------------------------------------------------
//  MempiHost
//    Host Infos
//---------------------------------------------------------

struct MempiHost {
      virtual int division() const;   // midi division
      virtual int tempo(unsigned tick) const;
      virtual unsigned tick2frame(unsigned tick) const;
      virtual unsigned frame2tick(unsigned frame) const;
      virtual void bar(int tick, int* bar, int* beat, unsigned* rest) const;
      virtual unsigned bar2tick(int bar, int beat, int tick) const;
      virtual ~MempiHost() {}
      };

//---------------------------------------------------------
//  Mempi
//    Instance class
//    MusE experimental midi plugin interface
//    Instance virtual interface class
//---------------------------------------------------------

class Mempi {
      MempiP* d;
      const char* _name;      // mempi instance name

   protected:
      const MempiHost* host;

   public:
      // modul interface
      Mempi(const char* name, const MempiHost*);
      virtual ~Mempi();
      virtual bool init()             { return false;  }
      const char* name() const        { return _name;  }

      // process interface
      virtual void process(unsigned, unsigned, MidiEventList*, MidiEventList*) = 0;

      // session interface
      virtual void getInitData(int*, const unsigned char**) const {}
      virtual void setInitData(int, const unsigned char*) {}

      // GUI interface routines
      virtual bool hasGui() const     { return false; }
      virtual bool guiVisible() const { return false; }
      virtual void showGui(bool)      {}
      virtual void getGeometry(int* x, int* y, int* w, int* h) const;
      virtual void setGeometry(int, int, int, int) {}
      };

//---------------------------------------------------------
//   MEMPI
//    Class descriptor
//---------------------------------------------------------

enum MempiType { MEMPI_FILTER = 0, MEMPI_GENERATOR = 1 };

struct MEMPI {
      const char* name;
      const char* description;
      const char* version;
      MempiType type;
      int majorMempiVersion, minorMempiVersion;
      Mempi* (*instantiate)(const char* name, const MempiHost*);
      };

extern "C" {
      const MEMPI* mempi_descriptor();
      }

#endif