Brought back portmidi with conditional compilation
This commit is contained in:
parent
adf32aa9f4
commit
8783bf12b2
|
@ -6,7 +6,7 @@ An assembler and emulator for the [Uxn stack-machine](https://wiki.xxiivv.com/si
|
||||||
|
|
||||||
### Linux
|
### Linux
|
||||||
|
|
||||||
To build the Uxn emulator, you must have [SDL2](https://wiki.libsdl.org/).
|
To build the Uxn emulator, you must have [SDL2](https://wiki.libsdl.org/). If you wish to use the `Midi` device, you must also have [Portmidi](http://portmedia.sourceforge.net/portmidi/) installed. The build script indicates whether it has detected Portmidi or not, but will build Uxn either way.
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
./build.sh
|
./build.sh
|
||||||
|
|
9
build.sh
9
build.sh
|
@ -19,10 +19,17 @@ rm -f ./bin/uxnemu
|
||||||
rm -f ./bin/uxncli
|
rm -f ./bin/uxncli
|
||||||
rm -f ./bin/boot.rom
|
rm -f ./bin/boot.rom
|
||||||
|
|
||||||
echo "Building.."
|
|
||||||
mkdir -p bin
|
mkdir -p bin
|
||||||
CFLAGS="-std=c89 -Wall -Wno-unknown-pragmas"
|
CFLAGS="-std=c89 -Wall -Wno-unknown-pragmas"
|
||||||
UXNEMU_LDFLAGS="-L/usr/local/lib $(sdl2-config --cflags --libs)"
|
UXNEMU_LDFLAGS="-L/usr/local/lib $(sdl2-config --cflags --libs)"
|
||||||
|
if cc ${CFLAGS} -c src/devices/mpu.c -o bin/mpu.o 2>/dev/null; then
|
||||||
|
rm -f bin/mpu.o
|
||||||
|
echo "Building with portmidi.."
|
||||||
|
UXNEMU_LDFLAGS="${UXNEMU_LDFLAGS} -lportmidi"
|
||||||
|
else
|
||||||
|
echo "Building without portmidi.."
|
||||||
|
CFLAGS="${CFLAGS} -DNO_PORTMIDI"
|
||||||
|
fi
|
||||||
if [ "${1}" = '--debug' ];
|
if [ "${1}" = '--debug' ];
|
||||||
then
|
then
|
||||||
echo "[debug]"
|
echo "[debug]"
|
||||||
|
|
|
@ -15,7 +15,7 @@ WITH REGARD TO THIS SOFTWARE.
|
||||||
int
|
int
|
||||||
initmpu(Mpu *m, Uint8 device)
|
initmpu(Mpu *m, Uint8 device)
|
||||||
{
|
{
|
||||||
/*
|
#ifndef NO_PORTMIDI
|
||||||
int i;
|
int i;
|
||||||
Pm_Initialize();
|
Pm_Initialize();
|
||||||
for(i = 0; i < Pm_CountDevices(); ++i)
|
for(i = 0; i < Pm_CountDevices(); ++i)
|
||||||
|
@ -26,7 +26,7 @@ initmpu(Mpu *m, Uint8 device)
|
||||||
Pm_OpenInput(&m->midi, device, NULL, 128, 0, NULL);
|
Pm_OpenInput(&m->midi, device, NULL, 128, 0, NULL);
|
||||||
m->queue = 0;
|
m->queue = 0;
|
||||||
m->error = pmNoError;
|
m->error = pmNoError;
|
||||||
*/
|
#endif
|
||||||
(void)m;
|
(void)m;
|
||||||
(void)device;
|
(void)device;
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -35,7 +35,7 @@ initmpu(Mpu *m, Uint8 device)
|
||||||
void
|
void
|
||||||
listenmpu(Mpu *m)
|
listenmpu(Mpu *m)
|
||||||
{
|
{
|
||||||
/*
|
#ifndef NO_PORTMIDI
|
||||||
const int result = Pm_Read(m->midi, m->events, 32);
|
const int result = Pm_Read(m->midi, m->events, 32);
|
||||||
if(result < 0) {
|
if(result < 0) {
|
||||||
m->error = (PmError)result;
|
m->error = (PmError)result;
|
||||||
|
@ -43,6 +43,6 @@ listenmpu(Mpu *m)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
m->queue = result;
|
m->queue = result;
|
||||||
*/
|
#endif
|
||||||
(void)m;
|
(void)m;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
/* #include <portmidi.h> */
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Copyright (c) 2021 Devine Lu Linvega
|
Copyright (c) 2021 Devine Lu Linvega
|
||||||
|
@ -14,19 +13,23 @@ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||||
WITH REGARD TO THIS SOFTWARE.
|
WITH REGARD TO THIS SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
typedef unsigned char Uint8;
|
#ifndef NO_PORTMIDI
|
||||||
|
#include <portmidi.h>
|
||||||
|
#else
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int message;
|
int message;
|
||||||
} PmEvent;
|
} PmEvent;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
typedef unsigned char Uint8;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
Uint8 queue;
|
Uint8 queue;
|
||||||
PmEvent events[32];
|
PmEvent events[32];
|
||||||
/*
|
#ifndef NO_PORTMIDI
|
||||||
PmStream *midi;
|
PmStream *midi;
|
||||||
PmError error;
|
PmError error;
|
||||||
*/
|
#endif
|
||||||
} Mpu;
|
} Mpu;
|
||||||
|
|
||||||
int initmpu(Mpu *m, Uint8 device);
|
int initmpu(Mpu *m, Uint8 device);
|
||||||
|
|
Loading…
Reference in New Issue