Skip to content

USB Host Library SAMD MIDI transport layer for the FortySevenEffects Arduino MIDI Library

License

Notifications You must be signed in to change notification settings

YuuichiAkagawa/Arduino-USBHSAMD-MIDI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Arduino USB Host Library SAMD MIDI Transport

Pre-release of USB Host Library SAMD MIDI transport layer for the FortySevenEffects Arduino MIDI Library and uses the underlying USB Host Library SAMD.
Therefore, it depends on the behavior of the USB Host library SAMD.
This library is based on the Arduino-USBMIDI.

This libraries is EXTREMELY ALPHA!

Installation

copy it in "libraries" directory.

Usage

Basic / Default

#include <USBHSAMD-MIDI.h>
USBHost UsbH;
...
USBHSAMDMIDI_CREATE_DEFAULT_INSTANCE(&UsbH);
...
void setup()
{
   MIDI.begin(1);
...
void loop()
{
   UsbH.Task();
   MIDI.read();

will create a instance named MIDI (transport instance named __usbhsamdMIDI) and is by default connected to cable number 0 - and listens to incoming MIDI on channel 1.

Modified

#include <USBHSAMD-MIDI.h>
...
USBHSAMDMIDI_CREATE_INSTANCE(&UsbH, 4, MIDI);

will create a instance named MIDI (transport instance named __usbhsamdMIDI) and is connected to cable number 4.

Custom Settings

#include <USBHSAMD-MIDI.h>
...
struct MySettings : public midi::DefaultSettings
{
    static const unsigned SysExMaxSize = 512; // Accept SysEx messages up to 512 bytes long.
};
USB Usb;
USBHSAMDMIDI_CREATE_CUSTOM_INSTANCE(&UsbH, 0, MIDI, MySettings);

will create a instance named MIDI (transport instance named __usbhsamdMIDI) and change the maximum size of SysEx messages to 512 bytes.

Advanced

#include <USBHSAMD-MIDI.h>
...
USBHSAMDMIDI_NAMESPACE::usbhsamdMidiTransport usbhsamdMIDI2(&Usb, 5);
MIDI_NAMESPACE::MidiInterface<USBHSAMDMIDI_NAMESPACE::usbhsamdMidiTransport> MIDI2((UHS2MIDI_NAMESPACE::uhlsdMidiTransport&)usbhsamdMIDI2);

will create a instance named usbhsamdMIDI2 (and underlaying MIDI object MIDI2) and is by default connected to cable number 5.

Tested boards / modules

  • Arduino M0 Pro

Other Transport protocols:

The libraries below the same calling mechanism (API), making it easy to interchange the transport layer.

About

USB Host Library SAMD MIDI transport layer for the FortySevenEffects Arduino MIDI Library

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages