@@ -19,15 +19,8 @@ typedef struct {
19
19
20
20
class USBMIDI {
21
21
private:
22
- static const char * deviceName;
23
- static char nameBuffer[32 ]; // Buffer to store the device name
24
- /* *
25
- * @brief Get the default device name
26
- * @return Default name "TinyUSB MIDI" if no other name is set
27
- */
28
- static const char * getDefaultDeviceName () {
29
- return " TinyUSB MIDI" ;
30
- }
22
+ static char * midiUserDeviceName; // user device name
23
+ static void setDeviceName (const char * name); // set user device name limites to 32 characters
31
24
32
25
public:
33
26
/* *
@@ -38,11 +31,15 @@ class USBMIDI {
38
31
USBMIDI (void );
39
32
40
33
/* *
41
- * @brief Constructor with custom device name
42
- * @param name The device name to use. This takes precedence over any
43
- * compile-time name set via SET_USB_MIDI_DEVICE_NAME()
44
- */
34
+ * @brief Set the current device name
35
+ * 1. Name set via constructor (if any)
36
+ * 2. Name set via SET_USB_MIDI_DEVICE_NAME() macro (if defined)
37
+ * 3. Default name "TinyUSB MIDI"
38
+ * It has no effect if name is set as NULL or ""
39
+ */
45
40
USBMIDI (const char * name);
41
+
42
+ ~USBMIDI ();
46
43
47
44
void begin (void );
48
45
void end (void );
@@ -53,18 +50,8 @@ class USBMIDI {
53
50
* 1. Name set via constructor (if any)
54
51
* 2. Name set via SET_USB_MIDI_DEVICE_NAME() macro (if defined)
55
52
* 3. Default name "TinyUSB MIDI"
56
- */
57
- static const char * getCurrentDeviceName (void ) {
58
- return deviceName ? deviceName : getDefaultDeviceName ();
59
- }
60
-
61
- /* *
62
- * @brief Set the default name at compile time
63
- * @param name The name to set as default if no runtime name is provided
64
- */
65
- static void setDefaultName (const char * name) {
66
- if (!deviceName) deviceName = name;
67
- }
53
+ */
54
+ static const char * getCurrentDeviceName (void );
68
55
69
56
/* User-level API */
70
57
0 commit comments