1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-10-10 08:33:36 +02:00

Update portmidi to SVN r227.

This commit is contained in:
lllucius
2013-10-31 07:33:41 +00:00
parent a30f9e913b
commit bb63fa0d07
118 changed files with 15017 additions and 12291 deletions

View File

@@ -1,98 +0,0 @@
# MAKEFILE FOR PORTMIDI AND PORTTIME
# NOTE: make should be run from the portmidi directory, but this
# Makefile is in pm_linux, so you should run:
# make -f pm_linux/Makefile
# I suggest putting this command line into a script or alias, e.g.
# do this:
#-----------------
# cd; cd portmidi; cat > m
# make -f pm_linux/Makefile
# <CONTROL-D>
# chmod +x m
#-----------------
# Now you can just type ./m to run make. (the script "m" is not
# part of PortMidi because it is different for OS X and it's so
# simple to create.)
# For debugging, define PM_CHECK_ERRORS
PMFLAGS = -DPM_CHECK_ERRORS
# Otherwise do not define PM_CHECK_ERRORS
# PMFLAGS =
# Use this for linux alsa (0.9x) version
versions = pm_linux/pmlinuxalsa.o
ALSALIB = -lasound
VFLAGS = -DPMALSA
# Use this for null (a dummy implementation for no Midi I/O:
# versions = pmlinuxnull.o
# ALSALIB =
# VFLAGS = -DPMNULL
pmlib = pm_linux/libportmidi.a
ptlib = porttime/libporttime.a
CC = gcc $(VFLAGS) $(PMFLAGS) -g -Ipm_common -Iporttime
pmobjects = pm_common/pmutil.o $(versions) pm_linux/pmlinux.o \
pm_common/portmidi.o
ptobjects = porttime/porttime.o porttime/ptlinux.o
current: all
all: $(pmlib) $(ptlib) pm_test/test pm_test/sysex pm_test/midithread \
pm_test/latency pm_test/midithru pm_test/qtest pm_test/mm
$(pmlib): pm_linux/Makefile $(pmobjects)
ar -cr $(pmlib) $(pmobjects)
$(ptlib): pm_linux/Makefile $(ptobjects)
ar -cr $(ptlib) $(ptobjects)
pm_linux/pmlinuxalsa.o: pm_linux/Makefile pm_linux/pmlinuxalsa.c pm_linux/pmlinuxalsa.h
$(CC) -c pm_linux/pmlinuxalsa.c -o pm_linux/pmlinuxalsa.o
pm_test/test: pm_linux/Makefile pm_test/test.o $(pmlib) $(ptlib)
$(CC) pm_test/test.o -o pm_test/test $(pmlib) $(ptlib) $(ALSALIB)
pm_test/sysex: pm_linux/Makefile pm_test/sysex.o $(pmlib) $(ptlib)
$(CC) pm_test/sysex.o -o pm_test/sysex $(pmlib) $(ptlib) $(ALSALIB)
pm_test/midithread: pm_linux/Makefile pm_test/midithread.o $(pmlib) $(ptlib)
$(CC) pm_test/midithread.o -o pm_test/midithread \
$(pmlib) $(ptlib) $(ALSALIB)
pm_test/latency: pm_linux/Makefile $(ptlib) pm_test/latency.o
$(CC) pm_test/latency.o -o pm_test/latency $(pmlib) $(ptlib) \
$(ALSALIB) -lpthread -lm
pm_test/midithru: pm_linux/Makefile $(ptlib) pm_test/midithru.o
$(CC) pm_test/midithru.o -o pm_test/midithru $(pmlib) $(ptlib) \
$(ALSALIB) -lpthread -lm
pm_test/mm: pm_linux/Makefile $(ptlib) pm_test/mm.o
$(CC) pm_test/mm.o -o pm_test/mm $(pmlib) $(ptlib) \
$(ALSALIB) -lpthread -lm
porttime/ptlinux.o: pm_linux/Makefile porttime/ptlinux.c
$(CC) -c porttime/ptlinux.c -o porttime/ptlinux.o
pm_test/qtest: pm_linux/Makefile pm_test/qtest.o $(pmlib) $(ptlib)
$(CC) pm_test/qtest.o -o pm_test/qtest $(pmlib) $(ptlib) $(ALSALIB)
clean:
rm -f *.o *~ core* */*.o */*.so */*~ */core* pm_test/*/pm_dll.dll
rm -f *.opt *.ncb *.plg pm_win/Debug/pm_dll.lib pm_win/Release/pm_dll.lib
rm -f pm_test/*.opt pm_test/*.ncb
cleaner: clean
cleanest: cleaner
rm -f $(pmlib) $(ptlib) pm_test/test pm_test/sysex pm_test/midithread
rm -f pm_test/latency pm_test/midithru pm_test/qtest pm_test/mm
backup: cleanest
cd ..; zip -r portmidi.zip portmidi

View File

@@ -1,6 +1,6 @@
README_LINUX.txt for PortMidi
Roger Dannenberg
14 Oct 2009
6 Dec 2012
Contents:
To make PortMidi
@@ -137,6 +137,9 @@ Finally, run make to create
CHANGELOG
6-dec-2012 Roger B. Dannenberg
Copied notes on Autoconf from Audacity sources
22-jan-2010 Roger B. Dannenberg
Updated instructions about Java paths

View File

@@ -5,10 +5,7 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include "portmidi.h"
#include "pmutil.h"
#include "pminternal.h"
#define STRING_MAX 256
@@ -30,7 +27,7 @@ int match_string(FILE *inf, char *s)
/*
* Parse preference files, find default device, search devices --
/* Parse preference files, find default device, search devices --
*/
PmDeviceID find_default_device(char *path, int input, PmDeviceID id)
/* path -- the name of the preference we are searching for

View File

@@ -201,7 +201,7 @@ static PmError alsa_write_byte(PmInternal *midi, unsigned char byte,
/* compute relative time of event = timestamp - now + latency */
PmTimestamp now = (midi->time_proc ?
midi->time_proc(midi->time_info) :
Pt_Time());
Pt_Time(NULL));
int when = timestamp;
/* if timestamp is zero, send immediately */
/* otherwise compute time delay and use delay if positive */
@@ -339,6 +339,7 @@ static PmError alsa_in_close(PmInternal *midi)
pm_hosterror = snd_seq_delete_port(seq, desc->this_port);
}
alsa_unuse_queue();
midi->descriptor = NULL;
pm_free(desc);
if (pm_hosterror) {
get_alsa_error_text(pm_hosterror_text, PM_HOST_ERROR_MSG_LEN,
@@ -433,6 +434,7 @@ static PmError alsa_write(PmInternal *midi, PmEvent *buffer, int32_t length)
static PmError alsa_write_flush(PmInternal *midi, PmTimestamp timestamp)
{
alsa_descriptor_type desc = (alsa_descriptor_type) midi->descriptor;
if (!desc) return pmBadPtr;
VERBOSE printf("snd_seq_drain_output: 0x%x\n", (unsigned int) seq);
desc->error = snd_seq_drain_output(seq);
if (desc->error < 0) return pmHostError;
@@ -448,6 +450,7 @@ static PmError alsa_write_short(PmInternal *midi, PmEvent *event)
PmMessage msg = event->message;
int i;
alsa_descriptor_type desc = (alsa_descriptor_type) midi->descriptor;
if (!desc) return pmBadPtr;
for (i = 0; i < bytes; i++) {
unsigned char byte = msg;
VERBOSE printf("sending 0x%x\n", byte);
@@ -481,6 +484,12 @@ static void handle_event(snd_seq_event_t *ev)
{
int device_id = ev->dest.port;
PmInternal *midi = descriptors[device_id].internalDescriptor;
// There is a race condition when closing a device and
// continuing to poll other open devices. The closed device may
// have outstanding events from before the close operation.
if (!midi) {
return;
}
PmEvent pm_ev;
PmTimeProcPtr time_proc = midi->time_proc;
PmTimestamp timestamp;
@@ -650,6 +659,7 @@ static PmError alsa_poll(PmInternal *midi)
static unsigned int alsa_has_host_error(PmInternal *midi)
{
alsa_descriptor_type desc = (alsa_descriptor_type) midi->descriptor;
if (!desc) return 0;
return desc->error;
}
@@ -657,6 +667,7 @@ static unsigned int alsa_has_host_error(PmInternal *midi)
static void alsa_get_host_error(PmInternal *midi, char *msg, unsigned int len)
{
alsa_descriptor_type desc = (alsa_descriptor_type) midi->descriptor;
if (!desc) return;
int err = (pm_hosterror || desc->error);
get_alsa_error_text(msg, len, err);
}

View File

@@ -3,5 +3,4 @@
PmError pm_linuxalsa_init(void);
void pm_linuxalsa_term(void);
PmDeviceID find_default_device(char *path, int input, PmDeviceID id);