From: Brent B. <br...@ke...> - 2018-07-02 15:55:33
|
Ricky Zhang <zha...@gm...> writes: > I’m not clear what is the in and out of your application running > inside BII. What’s the connection between virtual tty in host OS Linux > and your application in guest OS? Well, Midi applications in the old classic Mac environment usually offered a choice of using your modem or printer port, and Basilisk connects both of those to serial device nodes on the UNIX side. For telecomm programs, this seems to work flawlessly. ZTerm works so well in Basilisk that I could hookup a Hayes modem and call BBS's if I knew any dialup BBS's to call these days. For Midi, it seems that things are more complicated on the classic Mac platform than it is in emulators for other OS's, due to old style Mac serial ports being asynchronous. Midi runs at the oddball baud rate of 31250bps, not a multiple of 300 like one normally expects. Since serial ports on a Mac don't really have any baud rate of their own, they depend on an adapter device to send a 1MHz clock signal _into_ the port, then divide that into 1/32nds to obtain that exact baud rate of 31250bps. I don't know what would be needed to fake that, but I think that's why on any other platform emulator, getting Midi bytes out just amounts to letting the data go out the port, but the old m68k Mac is depending on some external hardware to do something from the outside to generate sync. Pin 7 of the DIN connector was the GPi pin, which received this signal (potentially 500kHz, 1MHz, or 2MHz, but usually 1MHz). The serial ports were capable of being driven very fast this way, and could even be used as network ports for AppleTalk, but Midi doesn't need to clock them anywhere near that fast. And yet...wouldn't it need the same thing from a modem, and have the same problem? The port is asynchronous when modems use it too, and yet programs like ZTerm are able to get bytes in and out just fine. Perhaps it's because the term program is providing the baud rate itself, whereas a classic Mac Midi program would be expecting some sort of 1MHz sync to be provided in hardware externally? That's what I'm not understanding. If the Mac serial port needs external clock to get anything done, how come a terminal program can use it but a Midi application can't? > A side topic — Basilisk II can build with SDL V1. We can enable > playing midi by SDL mixer — > https://www.libsdl.org/projects/SDL_mixer/docs/index.html > <https://www.libsdl.org/projects/SDL_mixer/docs/index.html>. > > Don’t count on anyone implement this feature for you. You’d better get your hand dirty. Believe me, I've already been digging around in the source for Basilisk, ttymidi, hairless-midiserial, the Alsa libraries, etc. I'm convinced now though that the data is being stopped in Basilisk. If the Mac application producing the data is a terminal program like ZTerm, all I need to get data from the serial device on the Linux side is 'cat': cat /dev/tnt1 will echo to my terminal whatever goes into ZTerm, and I don't even have to care about the baud rate on either end. That means it's trivial to get data from the serial device if it went in at all. But Midi data never comes out, not with cat, not with ttymidi, not with anything. I think what I'm wanting though is guidance from people who already know how the Basilisk code works. I've been digging around in serial.cpp and serial_unix.cpp, and I'm afraid I don't understand the state of the code as it is now enough to make any changes to it. |