File: midiseq.h

package info (click to toggle)
muse 0.8.1a-4
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 14,128 kB
  • ctags: 8,595
  • sloc: cpp: 68,637; sh: 8,640; ansic: 1,457; makefile: 854; python: 579
file content (93 lines) | stat: -rw-r--r-- 2,523 bytes parent folder | download | duplicates (3)
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
//=========================================================
//  MusE
//  Linux Music Editor
//  $Id: midiseq.h,v 1.6.2.9 2006/03/02 22:27:23 spamatica Exp $
//
//  (C) Copyright 2003 Werner Schweer (ws@seh.de)
//=========================================================

#ifndef __MIDISEQ_H__
#define __MIDISEQ_H__

#include "thread.h"
#include "mpevent.h"
#include "driver/alsatimer.h"
#include "driver/rtctimer.h"

class MPEventList;
class SynthI;
class MTC;
class MidiPort;
class MidiDevice;

//---------------------------------------------------------
//   MidiSeq
//---------------------------------------------------------

class MidiSeq : public Thread {
      int realRtcTicks;
      int timerFd;
      int idle;
      int prio;   // realtime priority
      int midiClock;
      static int ticker;

/* Testing */
      bool playStateExt;       // used for keeping play state in sync functions
      int recTick;            // ext sync tick position
//      int lastTickPos;        // position of last sync tick
      // run values:
//      unsigned _midiTick;
      double mclock1, mclock2;
      double songtick1, songtick2;
      int recTick1, recTick2;
      int lastTempo;
      double timediff[24];
      int storedtimediffs;

      void alignAllTicks(int frameOverride = 0);
/* Testing */

      Timer *timer;

      signed int selectTimer();
      bool setRtcTicks();
      static void midiTick(void* p, void*);
      void processTimerTick();
      void processSeek();
      void processStop();
      void processMidiClock();
      virtual void processMsg(const ThreadMsg*);
      void updatePollFd();

      void mtcSyncMsg(const MTC& mtc, bool seekFlag);
      void mtcInputFull(const unsigned char* p, int n);
      void nonRealtimeSystemSysex(const unsigned char* p, int n);

   public:
      MidiSeq(int prio, const char* name);
      ~MidiSeq();
      bool start();
      virtual void threadStop();
      virtual void threadStart(void*);

      void realtimeSystemInput(int, int);
      void mtcInputQuarter(int, unsigned char);
      void setSongPosition(int, int);
      // void eventReceived(MidiRecordEvent& event);
      void mmcInput(const unsigned char* p, int n);

      void msgMsg(int id);
      void msgProcess();
      void msgSeek();
      void msgStop();
      void msgSetRtc();
      void msgUpdatePollFd();
      void msgAddSynthI(SynthI* synth);
      void msgRemoveSynthI(SynthI* synth);
      void msgSetMidiDevice(MidiPort*, MidiDevice*);
      };

extern MidiSeq* midiSeq;
#endif