DOSBox-X
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines
include/midi.h
00001 /*
00002  *  Copyright (C) 2002-2020  The DOSBox Team
00003  *
00004  *  This program is free software; you can redistribute it and/or modify
00005  *  it under the terms of the GNU General Public License as published by
00006  *  the Free Software Foundation; either version 2 of the License, or
00007  *  (at your option) any later version.
00008  *
00009  *  This program is distributed in the hope that it will be useful,
00010  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  *  GNU General Public License for more details.
00013  *
00014  *  You should have received a copy of the GNU General Public License along
00015  *  with this program; if not, write to the Free Software Foundation, Inc.,
00016  *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00017  */
00018 
00019 
00020 #ifndef DOSBOX_MIDI_H
00021 #define DOSBOX_MIDI_H
00022 
00023 #ifndef DOSBOX_PROGRAMS_H
00024 #include "programs.h"
00025 #endif
00026 
00027 class MidiHandler {
00028 public:
00029         MidiHandler();
00030         virtual bool Open(const char * /*conf*/) { return true; };
00031         virtual void Close(void) {};
00032         virtual void PlayMsg(Bit8u * /*msg*/) {};
00033         virtual void PlaySysex(Bit8u * /*sysex*/,Bitu /*len*/) {};
00034         virtual const char * GetName(void) { return "none"; };
00035         virtual void ListAll(Program * /*base*/) {};
00036         virtual ~MidiHandler() { };
00037         MidiHandler * next;
00038 };
00039 
00040 
00041 #define SYSEX_SIZE 8192
00042 struct DB_Midi {
00043         Bitu status;
00044         Bitu cmd_len;
00045         Bitu cmd_pos;
00046     Bit8u cmd_buf[8] = {};
00047     Bit8u rt_buf[8] = {};
00048         struct midi_state_sysex_t {
00049         Bit8u buf[SYSEX_SIZE] = {};
00050                 Bitu used;
00051                 Bitu delay;
00052                 Bit32u start;
00053 
00054                 midi_state_sysex_t() : used(0), delay(0), start(0) { }
00055         } sysex;
00056         bool available;
00057         MidiHandler * handler;
00058 
00059         DB_Midi() : status(0x00), cmd_len(0), cmd_pos(0), available(false), handler(NULL) { }
00060 };
00061 
00062 extern DB_Midi midi;
00063 
00064 #endif