Adafruit_TinyUSB_Arduino icon indicating copy to clipboard operation
Adafruit_TinyUSB_Arduino copied to clipboard

USB MIDI device name not being changed

Open jhsa opened this issue 3 years ago • 0 comments

Operating System

Windows 10

IDE version

Arduino 1.8.19

Board

Wemos ESP32-S2 Mini

ArduinoCore version

Espressif Systems Version 2.0.3

TinyUSB Library version

Version 1.14.3

Sketch (attached txt file)

#include <Arduino.h>
#include <Adafruit_TinyUSB.h>
#include <MIDI.h>

// USB MIDI object
Adafruit_USBD_MIDI usb_midi;

// Create a new instance of the Arduino MIDI Library,
// and attach usb_midi as the transport.
MIDI_CREATE_INSTANCE(Adafruit_USBD_MIDI, usb_midi, MIDI);

// Variable that holds the current position in the sequence.
uint32_t position = 0;

// Store example melody as an array of note values
byte note_sequence[] = {
  74,78,81,86,90,93,98,102,57,61,66,69,73,78,81,85,88,92,97,100,97,92,88,85,81,78,
  74,69,66,62,57,62,66,69,74,78,81,86,90,93,97,102,97,93,90,85,81,78,73,68,64,61,
  56,61,64,68,74,78,81,86,90,93,98,102
};

void setup()
{
#if defined(ARDUINO_ARCH_MBED) && defined(ARDUINO_ARCH_RP2040)
  // Manual begin() is required on core without built-in support for TinyUSB such as mbed rp2040
  TinyUSB_Device_Init(0);
#endif

  pinMode(LED_BUILTIN, OUTPUT);
  
//  usb_midi.setStringDescriptor("TinyUSB MIDI");
  TinyUSBDevice.setProductDescriptor("TinyUSB MIDI");

  // Initialize MIDI, and listen to all MIDI channels
  // This will also call usb_midi's begin()
  MIDI.begin(MIDI_CHANNEL_OMNI);

  // Attach the handleNoteOn function to the MIDI Library. It will
  // be called whenever the Bluefruit receives MIDI Note On messages.
  MIDI.setHandleNoteOn(handleNoteOn);

  // Do the same for MIDI Note Off messages.
  MIDI.setHandleNoteOff(handleNoteOff);

  Serial.begin(115200);

  // wait until device mounted
  while( !TinyUSBDevice.mounted() ) delay(1);
}

What happened ?

The line:

TinyUSBDevice.setProductDescriptor("TinyUSB MIDI");

should apparently change the USB device's product name, but it doesn't. The Midi device is still detected as "LOLIN-S2-MINI"

Also the line: usb_midi.setStringDescriptor("TinyUSB MIDI"); doesn't seem to do anything.

How to reproduce ?

Flash the code to the ESP32-S2 Mini board, connect it to the computer's USB port, open the MIDI Monitor software, and check the MIDI device In/Out ports name. It should have changed to what I set in the code, but it doesn't.

There seems to be very little information about how to use this library on the internet, specially with midi. Perhaps I am doing something wrong as I am a beginner, but this looks like a bug to me. As I said, there is very little information on this subject. Or at least I cannot find it.

Debug Log

No response

Screenshots

No response

jhsa avatar Aug 22 '22 10:08 jhsa