Skip to content

Commit 305fc36

Browse files
committed
FEAT: initial MIDI port scheme implementation - macOS version
The MIDI device is now also optional and must be enabled using `USE_MIDI_DEVICE` compilation define.
1 parent 3591edf commit 305fc36

File tree

9 files changed

+520
-16
lines changed

9 files changed

+520
-16
lines changed

make/make-settings.r

+3
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ Defines: [
1515
;USE_WAV_CODEC ;-- deprecated; using Rebol codec instead
1616
;USE_NO_INFINITY ;-- use when you don't want to support IEEE infinity
1717
USE_LZMA ;-- adds support for LZMA [de]compression
18+
USE_MIDI_DEVICE ;-- includes MIDI device when possible (Windows & macOS)
1819

1920
;@@ optional fine tuning:
2021
;DO_NOT_NORMALIZE_MAP_KEYS
@@ -30,4 +31,6 @@ Defines: [
3031
;FORCE_ANSI_ESC_EMULATION_ON_WINDOWS ;-- would not try to use MS' built-in VIRTUAL_TERMINAL_PROCESSING
3132
;EXCLUDE_VECTOR_MATH ;-- don't include vector math support (like: 3 * #[vector! integer! 8 3 [1 2 3]])
3233

34+
;DEBUG_MIDI ;-- prints some of internal traces from MIDI device handler
35+
3336
]

src/core/c-port.c

+3-1
Original file line numberDiff line numberDiff line change
@@ -630,6 +630,8 @@ SCHEME_ACTIONS *Scheme_Actions; // Initial Global (not threaded)
630630
Init_Checksum_Scheme();
631631
#ifndef MIN_OS
632632
Init_Clipboard_Scheme();
633-
//Init_MIDI_Scheme();
633+
#endif
634+
#ifdef USE_MIDI_DEVICE
635+
Init_MIDI_Scheme();
634636
#endif
635637
}

src/include/reb-config.h

+6
Original file line numberDiff line numberDiff line change
@@ -160,16 +160,22 @@ These are now obsolete (as of A107) and should be removed:
160160
#define API_IMPORT
161161
#endif
162162

163+
#ifdef TO_LINUX
164+
#undef USE_MIDI_DEVICE // Not implemented!
165+
#endif
166+
163167
#ifdef TO_OSX // OSX/PPC
164168
#define OLD_COMPILER
165169
#endif
166170

167171
#ifdef TO_OBSD // OpenBSD
172+
#undef USE_MIDI_DEVICE // Not implemented!
168173
#define COPY_STR(d,s,m) strlcpy(d,s,m)
169174
#define JOIN_STR(d,s,m) strlcat(d,s,m)
170175
#endif
171176

172177
#ifdef TO_AMIGA // Target for OS4
178+
#undef USE_MIDI_DEVICE // Not implemented!
173179
#define HAS_BOOL
174180
#define HAS_SMART_CONSOLE
175181
#define NO_DL_LIB

src/include/reb-device.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ enum {
3939
RDI_DNS,
4040
RDI_CHECKSUM,
4141
RDI_CLIPBOARD,
42-
//RDI_MIDI,
42+
RDI_MIDI,
4343
RDI_MAX,
4444
RDI_LIMIT = 32
4545
};

src/os/host-device.c

+11-7
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,15 @@ extern REBDEV Dev_DNS;
7373
extern REBDEV Dev_Checksum;
7474
#ifndef MIN_OS
7575
extern REBDEV Dev_Clipboard;
76-
//extern REBDEV Dev_MIDI;
76+
#define DEVICE_PTR_CLIPBOARD &Dev_Clipboard
77+
#else
78+
#define DEVICE_PTR_CLIPBOARD 0
79+
#endif
80+
#ifdef USE_MIDI_DEVICE
81+
extern REBDEV Dev_MIDI;
82+
#define DEVICE_PTR_MIDI &Dev_MIDI
83+
#else
84+
#define DEVICE_PTR_MIDI 0
7785
#endif
7886

7987
REBDEV *Devices[RDI_LIMIT] =
@@ -86,12 +94,8 @@ REBDEV *Devices[RDI_LIMIT] =
8694
&Dev_Net,
8795
&Dev_DNS,
8896
0,//&Dev_Checksum,
89-
#ifndef MIN_OS
90-
&Dev_Clipboard,
91-
// &Dev_MIDI,
92-
#else
93-
0
94-
#endif
97+
DEVICE_PTR_CLIPBOARD,
98+
DEVICE_PTR_MIDI
9599
};
96100

97101

0 commit comments

Comments
 (0)