Hello everyone, first post here. A bit easier for me to follow info on a forum than on discord so here I go.
Currently looking to get usb midi working on the daisy patch.init. This is mostly for development purposes/ having an under the hood interface that speaks to a max patch using midi sysex messages but will eventually get wrapped into some other projects that I want to use with usb MIDI on the daisy submodule so I want to make sure I know how to do this properly.
I have slightly modified the usb_midi example that was made for the daisy seed but it seems like there are some bits that are either not needed anymore (thinking specifically of the “hw.Configure()” function) or some bits that are done differently now (thinking of the “DaisySeed hw;” declaration) but I might have done those parts wrong as well. I have my code compiling and loading correctly to the daisy but don’t see a usb midi device showing up in any software that speaks MIDI.
I tried reinstalling the driver for the daisy using zadig/ WinUSB and the daisy shows up under the “USB Serial Bus Devices” category on my Device Manager but I don’t see it under the normal “sound, video and game controllers” category where a MIDI device would normally show up.
Here is my modified code for reference, any suggestions on what I could be doing wrong?
#include "daisy_patch_sm.h"
#include "daisysp.h"
using namespace daisy;
using namespace patch_sm;
using namespace daisysp;
DaisyPatchSM patch;
MidiUsbHandler midi;
Oscillator osc;
void AudioCallback(AudioHandle::InputBuffer in,
AudioHandle::OutputBuffer out,
size_t size)
{
for(size_t i = 0; i < size; i++)
out[0][i] = out[1][i] = osc.Process();
}
int main(void)
{
//the line below is from the example code but I get an error saying that DaisyPatchSM has no member "configure"
//patch.Configure();
patch.Init();
MidiUsbHandler::Config midi_cfg;
midi_cfg.transport_config.periph = MidiUsbTransport::Config::INTERNAL;
midi.Init(midi_cfg);
osc.Init(patch.AudioSampleRate());
osc.SetWaveform( 2 ) ;
//osc.SetAmp ( 1 ) ;
patch.StartAudio(AudioCallback);
while(1) {
/** Listen to MIDI for new changes */
midi.Listen();
/** When there are messages waiting in the queue... */
while(midi.HasEvents())
{
/** Pull the oldest one from the list... */
auto msg = midi.PopEvent();
switch(msg.type)
{
case NoteOn:
{
/** and change the frequency of the oscillator */
auto note_msg = msg.AsNoteOn();
if(note_msg.velocity != 0)
osc.SetFreq(mtof(note_msg.note));
}
break;
// Since we only care about note-on messages in this example
// we'll ignore all other message types
default: break;
}
}
}
}
As you can see I have barely changed anything in the examples, basically just changing the harware declarations to match the patch_sm instead of the seed and commenting out a line that was causing errors but according to the documentation the “Configure” function has been deprecated.
Thank you for your time and any help.