Browse Source

Add C++ support

Add extern statement. Also fix the strlwr definition on Windows.
master
TheoryOfNekomata 1 year ago
parent
commit
c41eb2823f
3 changed files with 12 additions and 4 deletions
  1. +1
    -1
      CMakeLists.txt
  2. +1
    -1
      midi-utils.c
  3. +10
    -2
      midi-utils.h

+ 1
- 1
CMakeLists.txt View File

@@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.24) cmake_minimum_required(VERSION 3.24)
project(midi_note_id_utils C)
project(midi_utils C)


set(CMAKE_C_STANDARD 11) set(CMAKE_C_STANDARD 11)




+ 1
- 1
midi-utils.c View File

@@ -1,6 +1,6 @@
#include "midi-utils.h" #include "midi-utils.h"


#if !defined __WIN32
#if !defined _WIN32
void _strlwr(char* dest) { void _strlwr(char* dest) {
for (unsigned int i = 0; i < strlen(dest); i += 1) { for (unsigned int i = 0; i < strlen(dest); i += 1) {
if ('A' <= dest[i] && dest[i] <= 'Z') { if ('A' <= dest[i] && dest[i] <= 'Z') {


+ 10
- 2
midi-utils.h View File

@@ -11,8 +11,16 @@
#define MIDI_CC_SOSTENUTO 0x42u #define MIDI_CC_SOSTENUTO 0x42u
#define MIDI_CC_UNACORDA 0x43u #define MIDI_CC_UNACORDA 0x43u


char* MIDI_GetNoteName(unsigned char);
#if defined __cplusplus
extern "C" {
#endif

char *MIDI_GetNoteName(unsigned char);


unsigned char MIDI_GetNoteFromName(const char*);
unsigned char MIDI_GetNoteFromName(const char *);

#if defined __cplusplus
}
#endif


#endif #endif

Loading…
Cancel
Save