Re: MIDI conjunction device
- From: "Michael R. Kesti" <mrkesti@xxxxxxxxxx>
- Date: Fri, 17 Mar 2006 18:27:30 -0800
Paul Keinanen wrote:
Originally a flag variable InputSelected=NONE. When stat0 Rx interrupt
is processed, the byte is written to OUT UART and setting
InputSelected=IN0. When there is an interrupt IN1, it notices, that
InputSelected is not NONE and stat1 is put into a queue. When dat0A is
received, InputSelected is still IN0 and dat0A is written to OUT.
dat1A goes to queue.
When dat0B is received, it goes to OUT and sets InputSelected to NONE
(if no queued messages exists) or in this case to InputSelected=QUEUE,
which will send out the queued bytes each time the TxEmpty interrupt
from the OUT UART are activated. After the queue is empty
InputSelected=NONE.
Thus the sequence would be
IN0-|stat0|dat0A|dat0B|----------------------------------------------
IN1----|stat1|dat1A|dat1B|-------------------------------------------
OUT-------|stat0|dat0A|dat0B|stat1|dat1A|dat1B|------------
Thus, the delay for the first (or non-overlapped) message is 1 byte
time and no garbling occurs.
This should be easily handled completely in interrupt state without
any polling or timer interrupts by using IN0 and IN1 RxFull interrupt
and OUT TxEmpty interrupts.
To allow more channels and multiple queued messages, each input
channel would need a buffer capable of holding a full input message
and the OUT channel a queue of arbitrary length (even kilobytes). If
the OUT UART is free, the received bytes are immediately sent. If the
UART is in use by some other input channel, the local buffers for all
other channels are transferred to the global queue when datxB Rx
interrupt is processed. When the first message has been completely
transmitted, the global output queue is drained using TxEmpty
interrupts.
This structure has the disadvantage that if only dat0B and stat1
overlap, the transfer from IN1 local buffer to global buffer would be
delayed until dat1B is received. Thus, when OUT datxB TxEmpty
interrupt is received and the global OUT queue is empty, a check needs
to be made for all input channel to find the input channel with most
bytes in the local input buffer and select it for transmission and
empty this buffer using TxEmpty interupts.
Sure, Paul, this is certainly doable and shaves a few hundred micro-
seconds of the time it takes data to get through the merger. It also
precludes performing any kind of filtering, transforming or utilization
of data as well as preventing the generation of running status on the
output.
Consider that, at 120 BPM, a 64th note is more than 31.25 milliseconds
in duration and that the instruments that receive MIDI data take 10
milliseconds or more to even begin sounding the notes specified for
it in received MIDI streams. Even several milliseconds of delay
through a merger is just plain musically insignificant.
I think that the benefits of queueing complete received messages far
outweighs the drawbacks.
--
========================================================================
Michael Kesti | "And like, one and one don't make
| two, one and one make one."
mrkesti at comcast dot net | - The Who, Bargain
.
- Follow-Ups:
- Re: MIDI conjunction device
- From: Michael R. Kesti
- Re: MIDI conjunction device
- References:
- Re: MIDI conjunction device
- From: ahmed.sharifi@xxxxxxxxx
- Re: MIDI conjunction device
- From: Michael R. Kesti
- Re: MIDI conjunction device
- From: ahmed.sharifi@xxxxxxxxx
- Re: MIDI conjunction device
- From: Michael R. Kesti
- Re: MIDI conjunction device
- From: Paul Keinanen
- Re: MIDI conjunction device
- From: Michael R. Kesti
- Re: MIDI conjunction device
- From: Paul Keinanen
- Re: MIDI conjunction device
- Prev by Date: Re: Parallel Slave Port of PIC18F452
- Next by Date: Looking for plain printer OEM module
- Previous by thread: Re: MIDI conjunction device
- Next by thread: Re: MIDI conjunction device
- Index(es):
Relevant Pages
|