1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-10-10 00:23:32 +02:00

Extensive changes to improve NoteTrack display and (some) editing, NoteTrack playback via MIDI, and Midi-to-Audio alignment.

This commit is contained in:
rbdannenberg
2010-09-18 21:02:36 +00:00
parent f6327602e8
commit a1f0e5ed5b
96 changed files with 5679 additions and 3566 deletions

View File

@@ -1,28 +1,74 @@
README_LINUX.txt for PortMidi
Roger Dannenberg
29 Aug 2006
14 Oct 2009
To make PortMidi and PortTime, go back up to the portmidi
directory and type
To make PortMidi, you need cmake and the Java SDK.
Go back up to the portmidi directory and type:
make -f pm_linux/Makefile
ccmake .
(You can also copy pm_linux/Makefile to the portmidi
directory and just type "make".)
Type 'c' (configure) and then 'g' (generate). You may have
to manually set JAVA_INCLUDE_PATH and JAVA_JVM_LIBRARY
by typing 't' (toggle to advanced mode) and using the
editor to change the fields. You can find possible values
for JAVA_INCLUDE_PATH by typing "locate jni.h", and for
JAVA_JVM_LIBRARY by typing locate libjvm".
You also need JAVA_INCLUDE_PATH2, but this will normally
be set automatically after you set JAVA_INCLUDE_PATH and
run "configure" (type "c" to ccmake). Normally,
JAVA_INCLUDE_PATH2 is the linux subdirectory within
JAVA_INCLUDE_PATH.
Notice that the CMAKE_BUILD_TYPE can be Debug or Release.
Stick with Release if you are not debugging.
After successfully generating make files with ccmake, you
can run make:
make
The Makefile will build all test programs and the portmidi
library. You may want to modify the Makefile to remove the
PM_CHECK_ERRORS definition. For experimental software,
library. For experimental software,
especially programs running from the command line, we
recommend using PM_CHECK_ERRORS -- it will terminate your
recommend using the Debug version -- it will terminate your
program and print a helpful message if any PortMidi
function returns an error code.
function returns an error code. (Released software should
check for error codes and handle them, but for quick,
non-critical projects, the automatic "print and die"
handling can save some work.)
If you do not compile with PM_CHECK_ERRORS, you should
check for errors yourself.
THE pmdefaults PROGRAM
You should install pmdefaults. It provides a graphical interface
for selecting default MIDI IN and OUT devices so that you don't
have to build device selection interfaces into all your programs
and so users have a single place to set a preference.
Follow the instructions above to run ccmake, making sure that
CMAKE_BUILD_TYPE is Release. Run make as described above. Then:
sudo make install
This will install PortMidi libraries and the pmdefault program.
You must alos have the environment variable LD_LIBRARY_PATH set
to include /usr/local/lib (where libpmjni.so is installed).
Now, you can run pmdefault.
SETTING LD_LIBRARY_PATH
pmdefaults will not work unless LD_LIBRARY_PATH includes a
directory (normally /usr/local/lib) containing libpmjni.so,
installed as described above.
To set LD_LIBRARY_PATH, you might want to add this to your
~/.profile (if you use the bash shell):
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
export LD_LIBRARY_PATH
This code has not been carefully tested; however,
all test programs in pm_test seem to run properly.
A NOTE ABOUT AMD64:
@@ -44,6 +90,12 @@ be "PIC-enabled".
CHANGELOG
22-jan-2010 Roger B. Dannenberg
Updated instructions about Java paths
14-oct-2009 Roger B. Dannenberg
Using CMake now for building and configuration
29-aug-2006 Roger B. Dannenberg
Fixed PortTime to join with time thread for clean exit.

View File

@@ -12,6 +12,9 @@
#include "stdlib.h"
#include "portmidi.h"
#include "pmutil.h"
#include "pminternal.h"
#ifdef PMALSA
#include "pmlinuxalsa.h"
#endif
@@ -20,7 +23,10 @@
#include "pmlinuxnull.h"
#endif
PmError pm_init()
PmDeviceID pm_default_input_device_id = -1;
PmDeviceID pm_default_output_device_id = -1;
void pm_init()
{
/* Note: it is not an error for PMALSA to fail to initialize.
* It may be a design error that the client cannot query what subsystems
@@ -33,7 +39,15 @@ PmError pm_init()
#ifdef PMNULL
pm_linuxnull_init();
#endif
return pmNoError;
// this is set when we return to Pm_Initialize, but we need it
// now in order to (successfully) call Pm_CountDevices()
pm_initialized = TRUE;
pm_default_input_device_id = find_default_device(
"/PortMidi/PM_RECOMMENDED_INPUT_DEVICE", TRUE,
pm_default_input_device_id);
pm_default_output_device_id = find_default_device(
"/PortMidi/PM_RECOMMENDED_OUTPUT_DEVICE", FALSE,
pm_default_output_device_id);
}
void pm_term(void)
@@ -43,14 +57,13 @@ void pm_term(void)
#endif
}
PmDeviceID pm_default_input_device_id = -1;
PmDeviceID pm_default_output_device_id = -1;
PmDeviceID Pm_GetDefaultInputDeviceID() {
Pm_Initialize();
return pm_default_input_device_id;
}
PmDeviceID Pm_GetDefaultOutputDeviceID() {
Pm_Initialize();
return pm_default_output_device_id;
}

View File

@@ -37,7 +37,6 @@
#define GET_DESCRIPTOR_PORT(info) (((int)(info)) & 0xff)
#define BYTE unsigned char
#define UINT unsigned long
extern pm_fns_node pm_linuxalsa_in_dictionary;
extern pm_fns_node pm_linuxalsa_out_dictionary;
@@ -383,12 +382,12 @@ static PmError alsa_abort(PmInternal *midi)
#ifdef GARBAGE
This is old code here temporarily for reference
static PmError alsa_write(PmInternal *midi, PmEvent *buffer, long length)
static PmError alsa_write(PmInternal *midi, PmEvent *buffer, int32_t length)
{
alsa_descriptor_type desc = (alsa_descriptor_type) midi->descriptor;
int i, bytes;
unsigned char byte;
long msg;
PmMessage msg;
desc->error = 0;
for (; length > 0; length--, buffer++) {
@@ -421,7 +420,7 @@ static PmError alsa_write(PmInternal *midi, PmEvent *buffer, long length)
}
if (desc->error < 0) return pmHostError;
VERBOSE printf("snd_seq_drain_output: 0x%x\n", seq);
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;
@@ -446,7 +445,7 @@ static PmError alsa_write_flush(PmInternal *midi, PmTimestamp timestamp)
static PmError alsa_write_short(PmInternal *midi, PmEvent *event)
{
int bytes = midi_message_length(event->message);
long msg = event->message;
PmMessage msg = event->message;
int i;
alsa_descriptor_type desc = (alsa_descriptor_type) midi->descriptor;
for (i = 0; i < bytes; i++) {