First pass on MIDI out support [R. Belmont]
This commit is contained in:
parent
075c97a0c6
commit
520a27efd5
4
.gitattributes
vendored
4
.gitattributes
vendored
@ -1051,6 +1051,8 @@ src/emu/imagedev/harddriv.c svneol=native#text/plain
|
||||
src/emu/imagedev/harddriv.h svneol=native#text/plain
|
||||
src/emu/imagedev/midiin.c svneol=native#text/plain
|
||||
src/emu/imagedev/midiin.h svneol=native#text/plain
|
||||
src/emu/imagedev/midiout.c svneol=native#text/plain
|
||||
src/emu/imagedev/midiout.h svneol=native#text/plain
|
||||
src/emu/imagedev/printer.c svneol=native#text/plain
|
||||
src/emu/imagedev/printer.h svneol=native#text/plain
|
||||
src/emu/imagedev/serial.c svneol=native#text/plain
|
||||
@ -7219,6 +7221,8 @@ src/mess/machine/micropolis.h svneol=native#text/plain
|
||||
src/mess/machine/microtan.c svneol=native#text/plain
|
||||
src/mess/machine/midiinport.c svneol=native#text/plain
|
||||
src/mess/machine/midiinport.h svneol=native#text/plain
|
||||
src/mess/machine/midioutport.c svneol=native#text/plain
|
||||
src/mess/machine/midioutport.h svneol=native#text/plain
|
||||
src/mess/machine/mikro80.c svneol=native#text/plain
|
||||
src/mess/machine/mm58274c.c svneol=native#text/plain
|
||||
src/mess/machine/mm58274c.h svneol=native#text/plain
|
||||
|
@ -346,6 +346,7 @@ EMUIMAGEDEVOBJS = \
|
||||
$(EMUIMAGEDEV)/floppy.o \
|
||||
$(EMUIMAGEDEV)/harddriv.o \
|
||||
$(EMUIMAGEDEV)/midiin.o \
|
||||
$(EMUIMAGEDEV)/midiout.o \
|
||||
$(EMUIMAGEDEV)/printer.o \
|
||||
$(EMUIMAGEDEV)/serial.o \
|
||||
$(EMUIMAGEDEV)/snapquik.o \
|
||||
|
90
src/emu/imagedev/midiout.c
Normal file
90
src/emu/imagedev/midiout.c
Normal file
@ -0,0 +1,90 @@
|
||||
/*********************************************************************
|
||||
|
||||
midiout.c
|
||||
|
||||
MIDI Out image device and serial receiver
|
||||
|
||||
*********************************************************************/
|
||||
|
||||
#include "emu.h"
|
||||
#include "midiout.h"
|
||||
|
||||
/***************************************************************************
|
||||
IMPLEMENTATION
|
||||
***************************************************************************/
|
||||
|
||||
const device_type MIDIOUT = &device_creator<midiout_device>;
|
||||
|
||||
/*-------------------------------------------------
|
||||
ctor
|
||||
-------------------------------------------------*/
|
||||
|
||||
midiout_device::midiout_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
|
||||
: device_t(mconfig, MIDIOUT, "MIDI Out image device", tag, owner, clock),
|
||||
device_image_interface(mconfig, *this),
|
||||
device_serial_interface(mconfig, *this)
|
||||
{
|
||||
}
|
||||
|
||||
/*-------------------------------------------------
|
||||
device_start
|
||||
-------------------------------------------------*/
|
||||
|
||||
void midiout_device::device_start()
|
||||
{
|
||||
}
|
||||
|
||||
void midiout_device::device_reset()
|
||||
{
|
||||
// we don't Tx, we Rx at 31250 8-N-1
|
||||
set_rcv_rate(31250);
|
||||
set_tra_rate(0);
|
||||
set_data_frame(8, 1, SERIAL_PARITY_NONE);
|
||||
}
|
||||
|
||||
/*-------------------------------------------------
|
||||
device_config_complete
|
||||
-------------------------------------------------*/
|
||||
|
||||
void midiout_device::device_config_complete(void)
|
||||
{
|
||||
update_names();
|
||||
}
|
||||
|
||||
/*-------------------------------------------------
|
||||
call_load
|
||||
-------------------------------------------------*/
|
||||
|
||||
bool midiout_device::call_load(void)
|
||||
{
|
||||
m_midi = osd_open_midi_output(filename());
|
||||
|
||||
if (m_midi == NULL)
|
||||
{
|
||||
return IMAGE_INIT_FAIL;
|
||||
}
|
||||
|
||||
return IMAGE_INIT_PASS;
|
||||
}
|
||||
|
||||
/*-------------------------------------------------
|
||||
call_unload
|
||||
-------------------------------------------------*/
|
||||
|
||||
void midiout_device::call_unload(void)
|
||||
{
|
||||
osd_close_midi_channel(m_midi);
|
||||
}
|
||||
|
||||
void midiout_device::rcv_complete() // Rx completed receiving byte
|
||||
{
|
||||
receive_register_extract();
|
||||
UINT8 data = get_received_char();
|
||||
|
||||
osd_write_midi_channel(m_midi, data);
|
||||
}
|
||||
|
||||
void midiout_device::input_callback(UINT8 state)
|
||||
{
|
||||
}
|
||||
|
73
src/emu/imagedev/midiout.h
Normal file
73
src/emu/imagedev/midiout.h
Normal file
@ -0,0 +1,73 @@
|
||||
/*********************************************************************
|
||||
|
||||
midiout.h
|
||||
|
||||
MIDI Out image device
|
||||
|
||||
*********************************************************************/
|
||||
|
||||
#ifndef __MIDIOUT_H__
|
||||
#define __MIDIOUT_H__
|
||||
|
||||
#include "image.h"
|
||||
|
||||
/***************************************************************************
|
||||
CONSTANTS
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#define MCFG_MIDIOUT_ADD(_tag) \
|
||||
MCFG_DEVICE_ADD(_tag, MIDIOUT, 0)
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
TYPE DEFINITIONS
|
||||
***************************************************************************/
|
||||
|
||||
class midiout_device : public device_t,
|
||||
public device_image_interface,
|
||||
public device_serial_interface
|
||||
{
|
||||
public:
|
||||
// construction/destruction
|
||||
midiout_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
|
||||
|
||||
// image-level overrides
|
||||
virtual bool call_load();
|
||||
virtual void call_unload();
|
||||
|
||||
// image device
|
||||
virtual iodevice_t image_type() const { return IO_MIDIOUT; }
|
||||
virtual bool is_readable() const { return 0; }
|
||||
virtual bool is_writeable() const { return 1; }
|
||||
virtual bool is_creatable() const { return 0; }
|
||||
virtual bool must_be_loaded() const { return 0; }
|
||||
virtual bool is_reset_on_load() const { return 0; }
|
||||
virtual const char *file_extensions() const { return "mid"; }
|
||||
virtual bool core_opens_image_file() const { return FALSE; }
|
||||
virtual const option_guide *create_option_guide() const { return NULL; }
|
||||
|
||||
virtual void tx(UINT8 state) { check_for_start(state); }
|
||||
|
||||
protected:
|
||||
// device-level overrides
|
||||
virtual void device_start();
|
||||
virtual void device_reset();
|
||||
|
||||
virtual void device_config_complete();
|
||||
|
||||
// serial overrides
|
||||
virtual void rcv_complete(); // Rx completed receiving byte
|
||||
void input_callback(UINT8 state);
|
||||
|
||||
private:
|
||||
osd_midi_device *m_midi;
|
||||
};
|
||||
|
||||
// device type definition
|
||||
extern const device_type MIDIOUT;
|
||||
|
||||
// device iterator
|
||||
typedef device_type_iterator<&device_creator<midiout_device>, midiout_device> midiout_device_iterator;
|
||||
|
||||
#endif /* __MIDIOUT_H__ */
|
@ -110,6 +110,7 @@
|
||||
#include "machine/esqpanel.h"
|
||||
#include "machine/serial.h"
|
||||
#include "machine/midiinport.h"
|
||||
#include "machine/midioutport.h"
|
||||
|
||||
#define GENERIC (0)
|
||||
#define EPS (1)
|
||||
@ -137,7 +138,8 @@ public:
|
||||
m_epspanel(*this, "epspanel"),
|
||||
m_sq1panel(*this, "sq1panel"),
|
||||
m_panel(*this, "panel"),
|
||||
m_dmac(*this, "mc68450")
|
||||
m_dmac(*this, "mc68450"),
|
||||
m_mdout(*this, "mdout")
|
||||
{ }
|
||||
|
||||
required_device<m68000_device> m_maincpu;
|
||||
@ -147,6 +149,7 @@ public:
|
||||
optional_device<esqpanel2x40_sq1_device> m_sq1panel;
|
||||
optional_device<esqpanel2x40_device> m_panel;
|
||||
optional_device<hd63450_device> m_dmac;
|
||||
required_device<serial_port_device> m_mdout;
|
||||
|
||||
virtual void machine_reset();
|
||||
|
||||
@ -527,6 +530,7 @@ WRITE8_MEMBER(esq5505_state::duart_output)
|
||||
// MIDI send, we don't care yet
|
||||
WRITE_LINE_MEMBER(esq5505_state::duart_tx_a)
|
||||
{
|
||||
m_mdout->tx(state);
|
||||
}
|
||||
|
||||
WRITE_LINE_MEMBER(esq5505_state::duart_tx_b)
|
||||
@ -767,6 +771,7 @@ static const serial_port_interface midiin_intf =
|
||||
};
|
||||
|
||||
static SLOT_INTERFACE_START(midiout_slot)
|
||||
SLOT_INTERFACE("midiout", MIDIOUT_PORT)
|
||||
SLOT_INTERFACE_END
|
||||
|
||||
static const serial_port_interface midiout_intf =
|
||||
@ -783,7 +788,7 @@ static MACHINE_CONFIG_START( vfx, esq5505_state )
|
||||
MCFG_DUARTN68681_ADD("duart", 4000000, duart_config)
|
||||
|
||||
MCFG_SERIAL_PORT_ADD("mdin", midiin_intf, midiin_slot, "midiin", NULL)
|
||||
MCFG_SERIAL_PORT_ADD("mdout", midiout_intf, midiout_slot, NULL, NULL)
|
||||
MCFG_SERIAL_PORT_ADD("mdout", midiout_intf, midiout_slot, "midiout", NULL)
|
||||
|
||||
MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
|
||||
MCFG_SOUND_ADD("ensoniq", ES5505, XTAL_10MHz)
|
||||
@ -823,7 +828,7 @@ static MACHINE_CONFIG_START(vfx32, esq5505_state)
|
||||
MCFG_DUARTN68681_ADD("duart", 4000000, duart_config)
|
||||
|
||||
MCFG_SERIAL_PORT_ADD("mdin", midiin_intf, midiin_slot, "midiin", NULL)
|
||||
MCFG_SERIAL_PORT_ADD("mdout", midiout_intf, midiout_slot, NULL, NULL)
|
||||
MCFG_SERIAL_PORT_ADD("mdout", midiout_intf, midiout_slot, "midiout", NULL)
|
||||
|
||||
MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
|
||||
MCFG_SOUND_ADD("ensoniq", ES5505, XTAL_30_4761MHz / 2)
|
||||
|
27
src/mess/machine/midioutport.c
Normal file
27
src/mess/machine/midioutport.c
Normal file
@ -0,0 +1,27 @@
|
||||
/*********************************************************************
|
||||
|
||||
midioutport.c
|
||||
|
||||
MIDI Out serial port - glues the image device to the pluggable serial port
|
||||
|
||||
*********************************************************************/
|
||||
|
||||
#include "machine/midioutport.h"
|
||||
|
||||
const device_type MIDIOUT_PORT = &device_creator<midiout_port_device>;
|
||||
|
||||
midiout_port_device::midiout_port_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
|
||||
: device_t(mconfig, MIDIOUT_PORT, "MIDI Out port", tag, owner, clock),
|
||||
device_serial_port_interface(mconfig, *this),
|
||||
m_midiout(*this, "midiout")
|
||||
{
|
||||
}
|
||||
|
||||
static MACHINE_CONFIG_FRAGMENT(midiout_port_config)
|
||||
MCFG_MIDIOUT_ADD("midiout")
|
||||
MACHINE_CONFIG_END
|
||||
|
||||
machine_config_constructor midiout_port_device::device_mconfig_additions() const
|
||||
{
|
||||
return MACHINE_CONFIG_NAME(midiout_port_config);
|
||||
}
|
35
src/mess/machine/midioutport.h
Normal file
35
src/mess/machine/midioutport.h
Normal file
@ -0,0 +1,35 @@
|
||||
/*********************************************************************
|
||||
|
||||
midioutport.h
|
||||
|
||||
MIDI Out serial port - glues the image device to the pluggable serial port
|
||||
|
||||
*********************************************************************/
|
||||
|
||||
#ifndef _MIDIOUTPORT_H_
|
||||
#define _MIDIOUTPORT_H_
|
||||
|
||||
#include "emu.h"
|
||||
#include "machine/serial.h"
|
||||
#include "imagedev/midiout.h"
|
||||
|
||||
class midiout_port_device :
|
||||
public device_t,
|
||||
public device_serial_port_interface
|
||||
{
|
||||
public:
|
||||
midiout_port_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
|
||||
virtual machine_config_constructor device_mconfig_additions() const;
|
||||
DECLARE_WRITE_LINE_MEMBER( read ) { }
|
||||
virtual void tx(UINT8 state) { m_midiout->tx(state); }
|
||||
protected:
|
||||
virtual void device_start() { }
|
||||
virtual void device_reset() { }
|
||||
virtual void device_config_complete() { m_shortname = "midiout_port"; }
|
||||
private:
|
||||
serial_port_device *m_owner;
|
||||
required_device<midiout_device> m_midiout;
|
||||
};
|
||||
|
||||
extern const device_type MIDIOUT_PORT;
|
||||
#endif
|
@ -558,12 +558,13 @@ $(MESSOBJ)/shared.a: \
|
||||
$(MESS_DEVICES)/sonydriv.o \
|
||||
$(MESS_DEVICES)/appldriv.o \
|
||||
$(MESS_MACHINE)/dp8390.o \
|
||||
$(MESS_MACHINE)/midiinport.o \
|
||||
$(MESS_MACHINE)/ne1000.o \
|
||||
$(MESS_MACHINE)/ne2000.o \
|
||||
$(MESS_MACHINE)/3c503.o \
|
||||
$(MESS_FORMATS)/z80bin.o \
|
||||
$(MESS_MACHINE)/mb8795.o \
|
||||
$(MESS_MACHINE)/midiinport.o \
|
||||
$(MESS_MACHINE)/midioutport.o \
|
||||
$(MESS_MACHINE)/null_modem.o \
|
||||
$(MESS_MACHINE)/vcsctrl.o \
|
||||
$(MESS_MACHINE)/vcs_joy.o \
|
||||
|
@ -897,6 +897,7 @@ osd_midi_device *osd_open_midi_output(const char *devname);
|
||||
void osd_close_midi_channel(osd_midi_device *dev);
|
||||
bool osd_poll_midi_channel(osd_midi_device *dev);
|
||||
int osd_read_midi_channel(osd_midi_device *dev, UINT8 *pOut);
|
||||
void osd_write_midi_channel(osd_midi_device *dev, UINT8 data);
|
||||
|
||||
/***************************************************************************
|
||||
UNCATEGORIZED INTERFACES
|
||||
|
@ -16,7 +16,8 @@ struct osd_midi_device
|
||||
PortMidiStream *pmStream;
|
||||
PmEvent rx_evBuf[20]; // up to 20 events
|
||||
#endif
|
||||
UINT8 xmit_in[3]; // Pm_Messages mean we can at most have 3 residue bytes
|
||||
UINT8 xmit_in[4]; // Pm_Messages mean we can at most have 3 residue bytes
|
||||
int xmit_cnt;
|
||||
};
|
||||
|
||||
void osd_list_midi_devices(void)
|
||||
@ -234,6 +235,60 @@ int osd_read_midi_channel(osd_midi_device *dev, UINT8 *pOut)
|
||||
#endif
|
||||
}
|
||||
|
||||
void osd_write_midi_channel(osd_midi_device *dev, UINT8 data)
|
||||
{
|
||||
#ifndef DISABLE_MIDI
|
||||
int bytes_needed = 0;
|
||||
|
||||
dev->xmit_in[dev->xmit_cnt++] = data;
|
||||
|
||||
// are we there yet?
|
||||
switch ((dev->xmit_in[0]>>4) & 0xf)
|
||||
{
|
||||
case 0xc: // 2-byte messages
|
||||
case 0xd:
|
||||
bytes_needed = 2;
|
||||
break;
|
||||
|
||||
case 0xf: // system common
|
||||
switch (dev->xmit_in[0] & 0xf)
|
||||
{
|
||||
case 0: // System Exclusive
|
||||
printf("No SEx please!\n");
|
||||
break;
|
||||
|
||||
case 7: // End of System Exclusive
|
||||
bytes_needed = 1;
|
||||
break;
|
||||
|
||||
case 2: // song pos
|
||||
case 3: // song select
|
||||
bytes_needed = 3;
|
||||
break;
|
||||
|
||||
default: // all other defined Fx messages are 1 byte
|
||||
bytes_needed = 1;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
bytes_needed = 3;
|
||||
break;
|
||||
}
|
||||
|
||||
if (dev->xmit_cnt == bytes_needed)
|
||||
{
|
||||
PmEvent ev;
|
||||
ev.message = Pm_Message(dev->xmit_in[0], dev->xmit_in[1], dev->xmit_in[2]);
|
||||
ev.timestamp = 0; // use the current time
|
||||
Pm_Write(dev->pmStream, &ev, 1);
|
||||
dev->xmit_cnt = 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
void osd_init_midi(void)
|
||||
{
|
||||
#ifndef DISABLE_MIDI
|
||||
|
Loading…
Reference in New Issue
Block a user