File: alsamidi.h

package info (click to toggle)
muse 0.6.3-3
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 8,936 kB
  • ctags: 7,446
  • sloc: cpp: 66,262; sh: 8,355; makefile: 755; ansic: 172
file content (67 lines) | stat: -rw-r--r-- 1,730 bytes parent folder | download
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
//=========================================================
//  MusE
//  Linux Music Editor
//  $Id: alsamidi.h,v 1.1.1.1 2003/10/29 10:06:12 wschweer Exp $
//  (C) Copyright 2001 Werner Schweer (ws@seh.de)
//=========================================================

#ifndef __ALSAMIDI_H__
#define __ALSAMIDI_H__

// use autoconf configuration
#include <config.h>

#include <alsa/asoundlib.h>

#include "mididev.h"

extern int alsaSeqFd;
extern snd_seq_addr_t musePort;

//---------------------------------------------------------
//   MidiAlsaDevice
//---------------------------------------------------------

class MidiAlsaDevice : public MidiDevice {
   public:
      snd_seq_addr_t adr;

   private:
      int rwFlag;

      virtual QString open(int);
      virtual void close();
      virtual void processInput()  {}
      virtual int selectRfd()      { return -1; }
      virtual int selectWfd();

      void prepareEvent(snd_seq_event_t* event) {
            memset(event, 0, sizeof(event));
            event->queue   = SND_SEQ_QUEUE_DIRECT;
            event->source  = musePort;
            event->dest    = adr;
            }
      void putEvent(snd_seq_event_t*);

   public:
      MidiAlsaDevice() {}
      MidiAlsaDevice(const snd_seq_addr_t&, const QString& name);
      virtual ~MidiAlsaDevice() {}
      virtual void putEvent(const MidiPlayEvent*);
      virtual void putClock();
      virtual void putStart();
      virtual void putStop();
      virtual void putContinue();
      virtual void putSongpos(int);
      };

extern bool initMidiAlsa();
extern int alsaSelectRfd();
extern int alsaSelectWfd();
extern void alsaProcessMidiInput();
extern void alsaScanMidiPorts();
extern snd_seq_t* alsaSeq;

#endif