Subversion Repositories svn.mios

Rev

Blame | Last modification | View Log | RSS feed

HEADER 3 MIDIfilter/Processor Example 4

<H1>MIDIfilter/Processor Example 4</H1>
<H3>Output Note Number on PortB</H3>

<PRE>
;
; MIDI Processor
;
; EXAMPLE 4: Output Note Number on PortB, 
;            set PortC.0 on Note On Event, clear PortC.0 on Note Off Event
;
; Copyright 2001 by Thorsten Klose
; Commercial use without my permission is strictly forbidden!
;

;; --------------------------------------------------------------------------
;;  PROC Received 8n: called on a Note Off Event
;;  In: MIDI_LASTEVENT0: 8n, n = midi channel
;;      MIDI_LASTEVENT1: note number
;;      MIDI_LASTEVENT2: velocity
;; --------------------------------------------------------------------------
PROC_Received8n
    ;; output note number on PortB
    movf    MIDI_LASTEVENT1, W
    movwf   PORTB

    ;; clear PortC.0
    bcf PORTC, 0
    return

;; --------------------------------------------------------------------------
;;  PROC Received 9n: called on a Note On Event
;;  In: MIDI_LASTEVENT0: 9n, n = midi channel
;;      MIDI_LASTEVENT1: note number
;;      MIDI_LASTEVENT2: velocity
;; --------------------------------------------------------------------------
PROC_Received9n
    ;; output note number on PortB
    movf    MIDI_LASTEVENT1, W
    movwf   PORTB

    ;; set PortC.0 if MIDI_LASTEVENT2>0x00, else clear it
    movf    MIDI_LASTEVENT2, W
    bz  PROC_Received_9n_NoVelocity
PROC_Received_9n_Velocity
    bsf PORTC, 0
    return
    
PROC_Received_9n_NoVelocity
    bcf PORTC, 0
    return

;; --------------------------------------------------------------------------
;;  PROC Received An: called on an Aftertouch Event
;;  In: MIDI_LASTEVENT0: An, n = midi channel
;;      MIDI_LASTEVENT1: note number
;;      MIDI_LASTEVENT2: preasure
;; --------------------------------------------------------------------------
PROC_ReceivedAn
    ;; nothing to do
    return

;; --------------------------------------------------------------------------
;;  PROC Received Bn: called on a Controller Event
;;  In: MIDI_LASTEVENT0: Bn, n = midi channel
;;      MIDI_LASTEVENT1: CC number
;;      MIDI_LASTEVENT2: CC value
;; --------------------------------------------------------------------------
PROC_ReceivedBn
    ;; nothing to do
    return
    
;; --------------------------------------------------------------------------
;;  PROC Received Cn: called on a Controller Event
;;  In: MIDI_LASTEVENT0: Cn, n = midi channel
;;      MIDI_LASTEVENT2: program number (AND NOT MIDI_LASTEVENT1!)
;; --------------------------------------------------------------------------
PROC_ReceivedCn
    ;; nothing to do
    return

;; --------------------------------------------------------------------------
;;  PROC Received Dn: called on a Poly Aftertouch Event
;;  In: MIDI_LASTEVENT0: Dn, n = midi channel
;;      MIDI_LASTEVENT2: note number (AND NOT MIDI_LASTEVENT1!)
;; --------------------------------------------------------------------------
PROC_ReceivedDn
    ;; nothing to do
    return

;; --------------------------------------------------------------------------
;;  PROC Received En: called on an Pitch Bender Event
;;  In: MIDI_LASTEVENT0: En, n = midi channel
;;      MIDI_LASTEVENT1: Pitch Bender High Byte
;;      MIDI_LASTEVENT2: Pitch Bender Low Byte
;; --------------------------------------------------------------------------
PROC_ReceivedEn
    ;; nothing to do
    return

;; --------------------------------------------------------------------------
;;  PROC Received Fx: called on an System Event
;;  In: MIDI_LASTEVENT0: Fx, x = System Service
;;      MIDI_LASTEVENT1: contains the byte of a sysex or MTC stream when
;;                       MIDI_FxSTATUS != 0
;;      MIDI_FxSTATUS:   if 0, send MIDI_LASTEVENT0, else MIDI_LASTEVENT1
;; --------------------------------------------------------------------------
PROC_ReceivedFx
        ;; nothing to do
        return
</PRE>

FOOTER