midi_read_msg   xtlang


Defined in:  https://github.com/digego/extempore/tree/v0.8.9/libs/external/midi.xtm

Implementation

(bind-func midi_read_msg
  (let ((buffer_length 1024)
        (input_buffer:PmEvent* (zalloc buffer_length))
        (msg:PmMessage 0)
        (timestamp:i32 0)
        (read_count 0)
        (i:i32 0))
    (lambda ()
      (set! read_count 0)
      ;; if you have more than one midi input device, you should call
      ;; Pm_Read on all your devices here
      (set! read_count (Pm_Read midi_in input_buffer buffer_length))
      (if (> read_count 0)
          (begin
            (dotimes (i read_count)
              (set! msg (tref (pref-ptr input_buffer i) 0))
              (set! timestamp (tref (pref-ptr input_buffer i) 1))
              (cond ((= (Pm_Message_Type msg) MIDI_NOTE_ON)
                     (enqueue_midi_event msg timestamp)
                     (if (= (Pm_Message_Data2 msg) 0)
                         (midi_note_off timestamp
                                        (Pm_Message_Data1 msg)
                                        (Pm_Message_Data2 msg)
                                        (Pm_Message_Channel msg))
                         (midi_note_on timestamp
                                       (Pm_Message_Data1 msg)
                                       (Pm_Message_Data2 msg)
                                       (Pm_Message_Channel msg))))
                    ((= (Pm_Message_Type msg) MIDI_NOTE_OFF)
                     (enqueue_midi_event msg timestamp)
                     (midi_note_off timestamp
                                    (Pm_Message_Data1 msg)
                                    (Pm_Message_Data2 msg)
                                    (Pm_Message_Channel msg)))
                    ((= (Pm_Message_Type msg) MIDI_CONTROL_CHANGE)
                     (if XTM_MIDI_CC_QUEUEING (enqueue_midi_event msg timestamp))
                     (midi_cc timestamp
                              (Pm_Message_Data1 msg)
                              (Pm_Message_Data2 msg)
                              (Pm_Message_Channel msg)))
                    (else
                     (midi_msg timestamp
                               (Pm_Message_Type msg)
                               (Pm_Message_Data1 msg)
                               (Pm_Message_Data2 msg)
                               (Pm_Message_Channel msg)
                               msg)))
              void)
            void)
          void))))


Back to Index

Similar Entries

  • *midioffset*    scheme    /digego/extempore/tree/v0.8.9/libs/external/portmidi.xtm
  • AudioBuffer_read    xtlang    /digego/extempore/tree/v0.8.9/libs/core/audiobuffer.xtm
  • AudioBuffer_read    xtlang    /digego/extempore/tree/v0.8.9/libs/core/audiobuffer.xtm
  • AudioBuffer_read_interp    xtlang    /digego/extempore/tree/v0.8.9/libs/core/audiobuffer.xtm
  • AudioBuffer_read_interp_mix    xtlang    /digego/extempore/tree/v0.8.9/libs/core/audiobuffer.xtm
  • AudioBuffer_read_interp_pw    xtlang    /digego/extempore/tree/v0.8.9/libs/core/audiobuffer.xtm
  • AudioBuffer_read_looped    xtlang    /digego/extempore/tree/v0.8.9/libs/core/audiobuffer.xtm
  • AudioBuffer_read_looped    xtlang    /digego/extempore/tree/v0.8.9/libs/core/audiobuffer.xtm
  • astra_readX    xtlang    /digego/extempore/tree/v0.8.9/examples/contrib/orbbec_test.xtm
  • astra_reader    xtlang    /digego/extempore/tree/v0.8.9/examples/contrib/orbbec_test.xtm
  • audiofile_aiff_read_samples    xtlang    /digego/extempore/tree/v0.8.9/libs/core/audiobuffer.xtm
  • audiofile_read_samples    xtlang    /digego/extempore/tree/v0.8.9/libs/core/audiobuffer.xtm
  • audiofile_wave_read_samples    xtlang    /digego/extempore/tree/v0.8.9/libs/core/audiobuffer.xtm
  • available_midi_events    xtlang    /digego/extempore/tree/v0.8.9/libs/external/midi.xtm
  • dequeue_midi_event    xtlang    /digego/extempore/tree/v0.8.9/libs/external/midi.xtm
  • enqueue_midi_event    xtlang    /digego/extempore/tree/v0.8.9/libs/external/midi.xtm
  • get-midi-device-names-alist    scheme    /digego/extempore/tree/v0.8.9/examples/sharedsystem/midisetup.xtm
  • get-midi-input-device-names-alist    scheme    /digego/extempore/tree/v0.8.9/examples/sharedsystem/midisetup.xtm
  • get-midi-output-device-names-alist    scheme    /digego/extempore/tree/v0.8.9/examples/sharedsystem/midisetup.xtm
  • get_midi_evt_a    xtlang    /digego/extempore/tree/v0.8.9/libs/external/midi.xtm
  • get_midi_evt_b    xtlang    /digego/extempore/tree/v0.8.9/libs/external/midi.xtm
  • get_midi_evt_channel    xtlang    /digego/extempore/tree/v0.8.9/libs/external/midi.xtm
  • get_midi_evt_clocktime    xtlang    /digego/extempore/tree/v0.8.9/libs/external/midi.xtm
  • get_midi_evt_timestamp    xtlang    /digego/extempore/tree/v0.8.9/libs/external/midi.xtm
  • get_midi_evt_type    xtlang    /digego/extempore/tree/v0.8.9/libs/external/midi.xtm
  • get_midi_in    xtlang    /digego/extempore/tree/v0.8.9/libs/external/portmidi.xtm
  • get_midi_out    xtlang    /digego/extempore/tree/v0.8.9/libs/external/portmidi.xtm
  • gl_print_error_no_msg    xtlang    /digego/extempore/tree/v0.8.9/libs/external/opengl.xtm
  • gl_print_error_with_msg    xtlang    /digego/extempore/tree/v0.8.9/libs/external/opengl.xtm
  • homo-play-midi-note    scheme    /digego/extempore/tree/v0.8.9/libs/contrib/rtmidi-scm.xtm
  • homo-play-midi-note    scheme    /digego/extempore/tree/v0.8.9/libs/external/portmidi.xtm
  • impc:compiler:print-already-bound-error    scheme    /digego/extempore/tree/v0.8.9/runtime/llvmti.xtm
  • midi-cc    scheme    /digego/extempore/tree/v0.8.9/libs/external/midi.xtm
  • midi-loop    scheme    /digego/extempore/tree/v0.8.9/examples/external/portmidi.xtm
  • midi-loop    scheme    /digego/extempore/tree/v0.8.9/examples/external/portmidi-output.xtm
  • midi-note-off    scheme    /digego/extempore/tree/v0.8.9/libs/external/midi.xtm
  • midi-note-on    scheme    /digego/extempore/tree/v0.8.9/libs/external/midi.xtm
  • midi2frq    scheme    /digego/extempore/tree/v0.8.9/libs/core/pc_ivl.xtm
  • midi_cc    xtlang    /digego/extempore/tree/v0.8.9/libs/core/instruments/channel_strip.xtm
  • midi_cc    xtlang    /digego/extempore/tree/v0.8.9/libs/external/midi.xtm
  • midi_cc    xtlang    /digego/extempore/tree/v0.8.9/examples/sharedsystem/setup.xtm
  • midi_cc    xtlang    /digego/extempore/tree/v0.8.9/examples/sharedsystem/midisetup.xtm
  • midi_high_shelf    xtlang    /digego/extempore/tree/v0.8.9/libs/core/instruments/channel_strip.xtm
  • midi_input_polling    xtlang    /digego/extempore/tree/v0.8.9/libs/external/midi.xtm
  • midi_input_port_id    xtlang    /digego/extempore/tree/v0.8.9/libs/external/midi.xtm
  • midi_low_shelf    xtlang    /digego/extempore/tree/v0.8.9/libs/core/instruments/channel_strip.xtm
  • midi_lower_mid    xtlang    /digego/extempore/tree/v0.8.9/libs/core/instruments/channel_strip.xtm
  • midi_msg    xtlang    /digego/extempore/tree/v0.8.9/libs/external/midi.xtm
  • midi_note_off    xtlang    /digego/extempore/tree/v0.8.9/libs/external/midi.xtm
  • midi_note_off    xtlang    /digego/extempore/tree/v0.8.9/examples/core/midi_synth.xtm
  • midi_note_off    xtlang    /digego/extempore/tree/v0.8.9/examples/sharedsystem/midisetup.xtm
  • midi_note_on    xtlang    /digego/extempore/tree/v0.8.9/libs/external/midi.xtm
  • midi_note_on    xtlang    /digego/extempore/tree/v0.8.9/examples/core/midi_synth.xtm
  • midi_note_on    xtlang    /digego/extempore/tree/v0.8.9/examples/sharedsystem/midisetup.xtm
  • midi_output_port_id    xtlang    /digego/extempore/tree/v0.8.9/libs/external/midi.xtm
  • midi_read_loop    xtlang    /digego/extempore/tree/v0.8.9/examples/external/portmidi.xtm
  • midi_upper_mid    xtlang    /digego/extempore/tree/v0.8.9/libs/core/instruments/channel_strip.xtm
  • nonblocking_read_loop    xtlang    /digego/extempore/tree/v0.8.9/examples/contrib/nanomsg-request.xtm
  • nonblocking_read_loop    xtlang    /digego/extempore/tree/v0.8.9/examples/contrib/nanomsg-reply.xtm
  • nonblocking_read_loop    xtlang    /digego/extempore/tree/v0.8.9/examples/contrib/nanomsg-respondent.xtm
  • nonblocking_read_loop    xtlang    /digego/extempore/tree/v0.8.9/examples/contrib/nanomsg-surveyor.xtm
  • ocv_imread    xtlang    /digego/extempore/tree/v0.8.9/libs/contrib/xtmcv.xtm
  • ocv_imread    xtlang    /digego/extempore/tree/v0.8.9/libs/contrib/xtmcv.xtm
  • ocv_imread    scheme    /digego/extempore/tree/v0.8.9/libs/contrib/xtmcv.xtm
  • ocv_imread1    xtlang    /digego/extempore/tree/v0.8.9/libs/contrib/xtmcv.xtm
  • ocv_imread2    xtlang    /digego/extempore/tree/v0.8.9/libs/contrib/xtmcv.xtm
  • ocv_read    xtlang    /digego/extempore/tree/v0.8.9/libs/contrib/xtmcv.xtm
  • ocv_read    xtlang    /digego/extempore/tree/v0.8.9/libs/contrib/xtmcv.xtm
  • ocv_read    scheme    /digego/extempore/tree/v0.8.9/libs/contrib/xtmcv.xtm
  • ocv_read1    xtlang    /digego/extempore/tree/v0.8.9/libs/contrib/xtmcv.xtm
  • ocv_read2    xtlang    /digego/extempore/tree/v0.8.9/libs/contrib/xtmcv.xtm
  • play-midi-note    scheme    /digego/extempore/tree/v0.8.9/libs/contrib/rtmidi-scm.xtm
  • play-midi-note    scheme    /digego/extempore/tree/v0.8.9/libs/external/portmidi.xtm
  • print_midi_devices    xtlang    /digego/extempore/tree/v0.8.9/libs/external/portmidi.xtm
  • read_and_write_frame    xtlang    /digego/extempore/tree/v0.8.9/examples/contrib/opencv_test.xtm
  • rtmidi_default_callback:RtMidiCCallback    xtlang    /digego/extempore/tree/v0.8.9/libs/contrib/rtmidi.xtm
  • rtmidi_print_ports    xtlang    /digego/extempore/tree/v0.8.9/libs/contrib/rtmidi.xtm
  • rtmidi_process_message    xtlang    /digego/extempore/tree/v0.8.9/examples/contrib/rtmidi.xtm
  • rtmidi_register_callback    xtlang    /digego/extempore/tree/v0.8.9/libs/contrib/rtmidi.xtm
  • rtmidi_send    xtlang    /digego/extempore/tree/v0.8.9/libs/contrib/rtmidi.xtm
  • sampler-parse-midinote-filename    scheme    /digego/extempore/tree/v0.8.9/libs/external/instruments_ext-scm.xtm
  • scheme-midi-listener    scheme    /digego/extempore/tree/v0.8.9/libs/external/midi.xtm
  • scientific-pitch-notation-to-midi-number    scheme    /digego/extempore/tree/v0.8.9/libs/external/instruments_ext-scm.xtm
  • send-midi-cc    scheme    /digego/extempore/tree/v0.8.9/libs/external/portmidi.xtm
  • set_midi_in    xtlang    /digego/extempore/tree/v0.8.9/libs/external/portmidi.xtm
  • set_midi_out    xtlang    /digego/extempore/tree/v0.8.9/libs/external/portmidi.xtm
  • sf_read_file_into_buffer    xtlang    /digego/extempore/tree/v0.8.9/libs/external/sndfile.xtm
  • start_midi    xtlang    /digego/extempore/tree/v0.8.9/libs/external/portmidi.xtm
  • start_midi_scheduler    xtlang    /digego/extempore/tree/v0.8.9/libs/external/midi.xtm
  • svm_read_line    xtlang    /digego/extempore/tree/v0.8.9/libs/contrib/svm.xtm
  • svm_read_problem    xtlang    /digego/extempore/tree/v0.8.9/libs/contrib/svm.xtm
  • sys_file_read    xtlang    /digego/extempore/tree/v0.8.9/libs/external/system.xtm
  • thread_native_call    xtlang    /digego/extempore/tree/v0.8.9/libs/core/xthread.xtm
  • thread_native_call_with_zone    xtlang    /digego/extempore/tree/v0.8.9/libs/core/xthread.xtm
  • xhid_read    xtlang    /digego/extempore/tree/v0.8.9/examples/contrib/hid.xtm