diff options
author | sletz <sletz@0c269be4-1314-0410-8aa9-9f06e86f4224> | 2011-04-21 08:12:03 +0000 |
---|---|---|
committer | sletz <sletz@0c269be4-1314-0410-8aa9-9f06e86f4224> | 2011-04-21 08:12:03 +0000 |
commit | d64bf92cc6dc8f022df9f4b9492b54ddf9d81fe1 (patch) | |
tree | 644a7aea5d14f93ef1841092a8caa89ccd63fbd4 | |
parent | 04f7bf87fdb5cfdae239cde08c9f4515491467e3 (diff) | |
parent | 15a862dc9cbad25e4229b949d008aa7aad9ee691 (diff) | |
download | jack2-d64bf92cc6dc8f022df9f4b9492b54ddf9d81fe1.tar.gz |
Merge branch 'newer-midi'
git-svn-id: http://subversion.jackaudio.org/jack/jack2/trunk/jackmp@4339 0c269be4-1314-0410-8aa9-9f06e86f4224
-rw-r--r-- | ChangeLog | 1 | ||||
-rw-r--r-- | example-clients/midi_dump.c | 23 | ||||
-rw-r--r-- | man/jack_iodelay.0 | 41 | ||||
-rw-r--r-- | windows/Setup/jack.ci | 1 | ||||
-rw-r--r-- | windows/Setup/jack64.ci | 1 | ||||
-rw-r--r-- | windows/jack_midi_dump.cbp | 152 | ||||
-rw-r--r-- | windows/jack_midi_latency_test.cbp | 152 | ||||
-rw-r--r-- | windows/jackd.workspace | 3 | ||||
-rw-r--r-- | windows/libjacknet.cbp | 9 | ||||
-rw-r--r-- | windows/winmme/JackWinMMEDriver.cpp | 8 | ||||
-rw-r--r-- | windows/winmme/JackWinMMEInputPort.cpp | 2 |
11 files changed, 364 insertions, 29 deletions
@@ -29,6 +29,7 @@ Jan Engelhardt Adrian Knoth David Garcia Garzon Valerio Pilo +Chris Caudle --------------------------- Jackdmp changes log diff --git a/example-clients/midi_dump.c b/example-clients/midi_dump.c index 81926283..07963a0f 100644 --- a/example-clients/midi_dump.c +++ b/example-clients/midi_dump.c @@ -10,16 +10,16 @@ static void describe (jack_midi_event_t* event, char* buffer, size_t buflen) { assert (buflen > 0); - + buffer[0] = '\0'; - + if (event->size == 0) { return; } - + int type = event->buffer[0] & 0xf0; int channel = event->buffer[0] & 0xf; - + switch (type) { case 0x90: assert (event->size == 3); @@ -48,12 +48,12 @@ process (jack_nframes_t frames, void* arg) buffer = jack_port_get_buffer (port, frames); assert (buffer); - + N = jack_midi_get_event_count (buffer); for (i = 0; i < N; ++i) { jack_midi_event_t event; int r; - + r = jack_midi_event_get (&event, buffer, i); if (r == 0) { size_t j; @@ -65,7 +65,7 @@ process (jack_nframes_t frames, void* arg) describe (&event, description, sizeof (description)); printf (" %s", description); - + printf ("\n"); } } @@ -108,7 +108,14 @@ main (int argc, char* argv[]) exit (EXIT_FAILURE); } - sleep (-1); + /* run until interrupted */ + while (1) { + #ifdef WIN32 + Sleep(1000); + #else + sleep(1); + #endif + }; return 0; } diff --git a/man/jack_iodelay.0 b/man/jack_iodelay.0 index 007e65a1..d6a9f753 100644 --- a/man/jack_iodelay.0 +++ b/man/jack_iodelay.0 @@ -15,17 +15,17 @@ hardware playback port, then use a physical loopback cable from the corresponding hardware output connector to an input connector, and to connect that corresponding hardware capture port to jack_iodelay's input port. This creates a roundtrip that goes through any -analog-to-digital or digital-converters that are present in the audio -hardware. +analog-to-digital and digital-to-analog converters that are present in +the audio hardware. .PP Although the hardware loopback latency is the expected use, it is also possible to use jack_iodelay to measure the latency along any fully connected signal path, such as those involving other JACK clients. .PP Once jack_iodelay completes its measurement it will print the total -latency it has detected. This will include the JACK period length in +latency it has detected. This will include the JACK buffer length in addition to any other latency in the signal path. It will continue to -print the value every 0.5 seconds or so so that if you wish you can +print the value every 0.5 seconds so that if you wish you can vary aspects of the signal path to see their effect on the measured latency. .PP @@ -34,20 +34,27 @@ will print .PP \fT Signal below threshold... .\fR .PP -every second until this changes (e.g. until you establish the correct connections). +every second until this changes (e.g. until you establish the correct +connections). .PP To use the value measured by jack_iodelay with the -I and -O arguments of a JACK backend (also called Input Latency and Output Latency in the -setup dialog of qjackctl), you must subtract the JACK period size from -the result. Then, if you believe that the latency is equally -distributed between the input and output parts of your audio hardware -(extremely likely), divide the result by two and use that for input -and/or output latency value. Doing this measurement will enable JACK -clients that use the JACK latency API to accurately position/delay -audio to keep signals synchronized even when there are inherent delays -in the end-to-end signal pathways. +setup dialog of qjackctl), you must subtract the JACK buffer size from +the result. The buffer size is determined by multiplying the number of +frames per period (given to the jackd backend by the -p or --period +option) by the number of periods per buffer (given to the jackd +backend by the -n or --nperiods option). Note that JACK2 will add an +implicit additional period when using the default asynchronous mode, +so for JACK1 or JACK2 in synchronous mode, the buffer size is n*p, but +for JACK2 in asynchronous mode the buffer size is (n+1)*p. Once the +JACK buffer size is subtracted from the measured latency, the result +is the "extra" latency due to the interface hardware. Then, if you +believe that the latency is equally distributed between the input and +output parts of your audio hardware (extremely likely), divide the +result by two and use that for input and output latency +values. Doing this measurement will enable JACK clients that use the +JACK latency API to accurately position/delay audio to keep signals +synchronized even when there are inherent delays in the end-to-end +signal pathways. .SH AUTHOR -Originally written in C++ by Fons Adriensen, ported to C by Torben Hohn. - - - +Originally written in C++ by Fons Adriaensen, ported to C by Torben Hohn. diff --git a/windows/Setup/jack.ci b/windows/Setup/jack.ci index 0b037e95..35d9e4ac 100644 --- a/windows/Setup/jack.ci +++ b/windows/Setup/jack.ci @@ -81,6 +81,7 @@ <_><src>..\Release\bin\jack\netmanager.dll</><dest>inst</><custom>jack</><ifexist>overnewer</><recurs>0</></>
<_><src>..\Release\bin\jack\audioadapter.dll</><dest>inst</><custom>jack</><ifexist>overnewer</><recurs>0</></>
<_><src>..\Release\bin\jack\netadapter.dll</><dest>inst</><custom>jack</><ifexist>overnewer</><recurs>0</></>
+<_><src>..\Release\bin\jack_midi_dump.exe</><dest>inst</><custom></><ifexist>overnewer</><recurs>0</></>
<_><src>..\..\common\jack\control.h</><dest>inst</><custom>includes\jack</><ifexist>overnewer</><recurs>0</></>
<_><src>..\..\common\jack\intclient.h</><dest>inst</><custom>includes\jack</><ifexist>overnewer</><recurs>0</></>
<_><src>..\..\common\jack\jack.h</><dest>inst</><custom>includes\jack</><ifexist>overnewer</><recurs>0</></>
diff --git a/windows/Setup/jack64.ci b/windows/Setup/jack64.ci index 086df7d6..a66c8258 100644 --- a/windows/Setup/jack64.ci +++ b/windows/Setup/jack64.ci @@ -90,6 +90,7 @@ <_><src>..\Release64\bin\jack\netmanager.dll</><dest>inst</><custom>jack</><ifexist>overnewer</><recurs>0</></>
<_><src>..\Release64\bin\jack\audioadapter.dll</><dest>inst</><custom>jack</><ifexist>overnewer</><recurs>0</></>
<_><src>..\Release64\bin\jack\netadapter.dll</><dest>inst</><custom>jack</><ifexist>overnewer</><recurs>0</></>
+<_><src>..\Release64\bin\jack_midi_dump.exe</><dest>inst</><custom></><ifexist>overnewer</><recurs>0</></>
<_><src>..\..\common\jack\control.h</><dest>inst</><custom>includes\jack</><ifexist>overnewer</><recurs>0</></>
<_><src>..\..\common\jack\intclient.h</><dest>inst</><custom>includes\jack</><ifexist>overnewer</><recurs>0</></>
<_><src>..\..\common\jack\jack.h</><dest>inst</><custom>includes\jack</><ifexist>overnewer</><recurs>0</></>
diff --git a/windows/jack_midi_dump.cbp b/windows/jack_midi_dump.cbp new file mode 100644 index 00000000..3e3da48b --- /dev/null +++ b/windows/jack_midi_dump.cbp @@ -0,0 +1,152 @@ +<?xml version="1.0" encoding="UTF-8" standalone="yes" ?> +<CodeBlocks_project_file> + <FileVersion major="1" minor="6" /> + <Project> + <Option title="jack_midi_dump" /> + <Option pch_mode="2" /> + <Option compiler="mingw_64" /> + <Build> + <Target title="Win32 Release 64bits"> + <Option output="Release64\bin\jack_midi_dump" prefix_auto="1" extension_auto="1" /> + <Option object_output="Release64\" /> + <Option type="1" /> + <Option compiler="mingw_64" /> + <Compiler> + <Add option="-O2" /> + <Add option="-Wall" /> + <Add directory="..\example-clients" /> + <Add directory="..\windows" /> + <Add directory="..\common\jack" /> + <Add directory="..\common" /> + </Compiler> + <Linker> + <Add library="libjack64" /> + <Add directory="Release64\bin" /> + </Linker> + </Target> + <Target title="Win32 Debug 64bits"> + <Option output="Debug64\bin\jack_midi_dump" prefix_auto="1" extension_auto="1" /> + <Option object_output="Debug64\" /> + <Option type="1" /> + <Option compiler="mingw_64" /> + <Compiler> + <Add option="-g" /> + <Add directory="..\example-clients" /> + <Add directory="..\windows" /> + <Add directory="..\common\jack" /> + <Add directory="..\common" /> + </Compiler> + <Linker> + <Add library="libjack64" /> + <Add directory="Debug64\bin" /> + </Linker> + </Target> + <Target title="Win32 Profiling 64bits"> + <Option output="Release64\bin\jack_midi_dump" prefix_auto="1" extension_auto="1" /> + <Option object_output="Release64\" /> + <Option type="1" /> + <Option compiler="mingw_64" /> + <Compiler> + <Add option="-O2" /> + <Add option="-Wall" /> + <Add directory="..\example-clients" /> + <Add directory="..\windows" /> + <Add directory="..\common\jack" /> + <Add directory="..\common" /> + </Compiler> + <Linker> + <Add library="libjack64" /> + <Add directory="Release64\bin" /> + </Linker> + </Target> + <Target title="Win32 Release 32bits"> + <Option output="Release\bin\jack_midi_dump" prefix_auto="1" extension_auto="1" /> + <Option object_output="Release\" /> + <Option type="1" /> + <Option compiler="mingw_64" /> + <Compiler> + <Add option="-O2" /> + <Add option="-Wall" /> + <Add option="-m32" /> + <Add directory="..\example-clients" /> + <Add directory="..\windows" /> + <Add directory="..\common\jack" /> + <Add directory="..\common" /> + </Compiler> + <Linker> + <Add option="-m32" /> + <Add library="libjack" /> + <Add directory="Release\bin" /> + </Linker> + </Target> + <Target title="Win32 Debug 32bits"> + <Option output="Debug\bin\jack_midi_dump" prefix_auto="1" extension_auto="1" /> + <Option object_output="Debug\" /> + <Option type="1" /> + <Option compiler="mingw_64" /> + <Compiler> + <Add option="-g" /> + <Add option="-m32" /> + <Add directory="..\example-clients" /> + <Add directory="..\windows" /> + <Add directory="..\common\jack" /> + <Add directory="..\common" /> + </Compiler> + <Linker> + <Add option="-m32" /> + <Add library="libjack" /> + <Add directory="Debug\bin" /> + </Linker> + </Target> + <Target title="Win32 Profiling 32bits"> + <Option output="Release\bin\jack_midi_dump" prefix_auto="1" extension_auto="1" /> + <Option object_output="Release\" /> + <Option type="1" /> + <Option compiler="mingw_64" /> + <Compiler> + <Add option="-O2" /> + <Add option="-Wall" /> + <Add option="-m32" /> + <Add directory="..\example-clients" /> + <Add directory="..\windows" /> + <Add directory="..\common\jack" /> + <Add directory="..\common" /> + </Compiler> + <Linker> + <Add option="-m32" /> + <Add library="libjack" /> + <Add directory="Release\bin" /> + </Linker> + </Target> + </Build> + <Compiler> + <Add option="-Wall" /> + </Compiler> + <Linker> + <Add library="kernel32" /> + <Add library="user32" /> + <Add library="gdi32" /> + <Add library="winspool" /> + <Add library="comdlg32" /> + <Add library="shell32" /> + <Add library="ole32" /> + <Add library="oleaut32" /> + <Add library="uuid" /> + <Add library="odbc32" /> + <Add library="odbccp32" /> + </Linker> + <Unit filename="..\example-clients\midi_dump.c"> + <Option compilerVar="CC" /> + </Unit> + <Extensions> + <code_completion /> + <envvars /> + <debugger /> + <AutoVersioning> + <Scheme minor_max="10" build_max="0" rev_max="0" rev_rand_max="10" build_times_to_increment_minor="100" /> + <Settings autoincrement="1" date_declarations="1" do_auto_increment="0" ask_to_increment="0" language="C++" svn="0" svn_directory="" header_path="version.h" /> + <Changes_Log show_changes_editor="0" app_title="released version %M.%m.%b of %p" changeslog_path="ChangesLog.txt" /> + </AutoVersioning> + </Extensions> + </Project> +</CodeBlocks_project_file> diff --git a/windows/jack_midi_latency_test.cbp b/windows/jack_midi_latency_test.cbp new file mode 100644 index 00000000..eb62a96b --- /dev/null +++ b/windows/jack_midi_latency_test.cbp @@ -0,0 +1,152 @@ +<?xml version="1.0" encoding="UTF-8" standalone="yes" ?> +<CodeBlocks_project_file> + <FileVersion major="1" minor="6" /> + <Project> + <Option title="jack_midi_latency_test" /> + <Option pch_mode="2" /> + <Option compiler="mingw_64" /> + <Build> + <Target title="Win32 Release 64bits"> + <Option output="Release64\bin\jack_midi_latency_test" prefix_auto="1" extension_auto="1" /> + <Option object_output="Release64\" /> + <Option type="1" /> + <Option compiler="mingw_64" /> + <Compiler> + <Add option="-O2" /> + <Add option="-Wall" /> + <Add directory="..\example-clients" /> + <Add directory="..\windows" /> + <Add directory="..\common\jack" /> + <Add directory="..\common" /> + </Compiler> + <Linker> + <Add library="libjack64" /> + <Add directory="Release64\bin" /> + </Linker> + </Target> + <Target title="Win32 Debug 64bits"> + <Option output="Debug64\bin\jack_midi_latency_test" prefix_auto="1" extension_auto="1" /> + <Option object_output="Debug64\" /> + <Option type="1" /> + <Option compiler="mingw_64" /> + <Compiler> + <Add option="-g" /> + <Add directory="..\example-clients" /> + <Add directory="..\windows" /> + <Add directory="..\common\jack" /> + <Add directory="..\common" /> + </Compiler> + <Linker> + <Add library="libjack64" /> + <Add directory="Debug64\bin" /> + </Linker> + </Target> + <Target title="Win32 Profiling 64bits"> + <Option output="Release64\bin\jack_midi_latency_test" prefix_auto="1" extension_auto="1" /> + <Option object_output="Release64\" /> + <Option type="1" /> + <Option compiler="mingw_64" /> + <Compiler> + <Add option="-O2" /> + <Add option="-Wall" /> + <Add directory="..\example-clients" /> + <Add directory="..\windows" /> + <Add directory="..\common\jack" /> + <Add directory="..\common" /> + </Compiler> + <Linker> + <Add library="libjack64" /> + <Add directory="Release64\bin" /> + </Linker> + </Target> + <Target title="Win32 Release 32bits"> + <Option output="Release\bin\jack_midi_latency_test" prefix_auto="1" extension_auto="1" /> + <Option object_output="Release\" /> + <Option type="1" /> + <Option compiler="mingw_64" /> + <Compiler> + <Add option="-O2" /> + <Add option="-Wall" /> + <Add option="-m32" /> + <Add directory="..\example-clients" /> + <Add directory="..\windows" /> + <Add directory="..\common\jack" /> + <Add directory="..\common" /> + </Compiler> + <Linker> + <Add option="-m32" /> + <Add library="libjack" /> + <Add directory="Release\bin" /> + </Linker> + </Target> + <Target title="Win32 Debug 32bits"> + <Option output="Debug\bin\jack_midi_latency_test" prefix_auto="1" extension_auto="1" /> + <Option object_output="Debug\" /> + <Option type="1" /> + <Option compiler="mingw_64" /> + <Compiler> + <Add option="-g" /> + <Add option="-m32" /> + <Add directory="..\example-clients" /> + <Add directory="..\windows" /> + <Add directory="..\common\jack" /> + <Add directory="..\common" /> + </Compiler> + <Linker> + <Add option="-m32" /> + <Add library="libjack" /> + <Add directory="Debug\bin" /> + </Linker> + </Target> + <Target title="Win32 Profiling 32bits"> + <Option output="Release\bin\jack_midi_latency_test" prefix_auto="1" extension_auto="1" /> + <Option object_output="Release\" /> + <Option type="1" /> + <Option compiler="mingw_64" /> + <Compiler> + <Add option="-O2" /> + <Add option="-Wall" /> + <Add option="-m32" /> + <Add directory="..\example-clients" /> + <Add directory="..\windows" /> + <Add directory="..\common\jack" /> + <Add directory="..\common" /> + </Compiler> + <Linker> + <Add option="-m32" /> + <Add library="libjack" /> + <Add directory="Release\bin" /> + </Linker> + </Target> + </Build> + <Compiler> + <Add option="-Wall" /> + </Compiler> + <Linker> + <Add library="kernel32" /> + <Add library="user32" /> + <Add library="gdi32" /> + <Add library="winspool" /> + <Add library="comdlg32" /> + <Add library="shell32" /> + <Add library="ole32" /> + <Add library="oleaut32" /> + <Add library="uuid" /> + <Add library="odbc32" /> + <Add library="odbccp32" /> + </Linker> + <Unit filename="..\example-clients\midi_latency_test.c"> + <Option compilerVar="CC" /> + </Unit> + <Extensions> + <code_completion /> + <envvars /> + <debugger /> + <AutoVersioning> + <Scheme minor_max="10" build_max="0" rev_max="0" rev_rand_max="10" build_times_to_increment_minor="100" /> + <Settings autoincrement="1" date_declarations="1" do_auto_increment="0" ask_to_increment="0" language="C++" svn="0" svn_directory="" header_path="version.h" /> + <Changes_Log show_changes_editor="0" app_title="released version %M.%m.%b of %p" changeslog_path="ChangesLog.txt" /> + </AutoVersioning> + </Extensions> + </Project> +</CodeBlocks_project_file> diff --git a/windows/jackd.workspace b/windows/jackd.workspace index c6921bb8..238330ab 100644 --- a/windows/jackd.workspace +++ b/windows/jackd.workspace @@ -24,6 +24,7 @@ <Project filename="jack_midi_latency_test.cbp" /> <Project filename="jack_netadapter.cbp" /> <Project filename="jack_netsource.cbp" /> - <Project filename="libjacknet.cbp" active="1" /> + <Project filename="libjacknet.cbp" /> + <Project filename="jack_midi_dump.cbp" active="1" /> </Workspace> </CodeBlocks_workspace_file> diff --git a/windows/libjacknet.cbp b/windows/libjacknet.cbp index 3d890ca4..1ea59e2d 100644 --- a/windows/libjacknet.cbp +++ b/windows/libjacknet.cbp @@ -128,6 +128,9 @@ <Add directory="Release\bin" /> <Add library="libsamplerate_x86" /> </Linker> + <ExtraCommands> + <Add before="windres -F pe-i386 -O coff -o Release/libjacknet.res libjacknet.rc" /> + </ExtraCommands> </Target> <Target title="Win32 Debug 32bits"> <Option output="Debug\bin\libjacknet" prefix_auto="1" extension_auto="1" /> @@ -160,6 +163,9 @@ <Add directory="Debug\bin" /> <Add library="libsamplerate_x86" /> </Linker> + <ExtraCommands> + <Add before="windres -F pe-i386 -O coff -o Debug/libjacknet.res libjacknet.rc" /> + </ExtraCommands> </Target> <Target title="Win32 Profiling 32bits"> <Option output="Release\bin\libjacknet" prefix_auto="1" extension_auto="1" /> @@ -193,6 +199,9 @@ <Add directory="Release\bin" /> <Add library="libsamplerate_x86" /> </Linker> + <ExtraCommands> + <Add before="windres -F pe-i386 -O coff -o Release/libjacknet.res libjacknet.rc" /> + </ExtraCommands> </Target> </Build> <Compiler> diff --git a/windows/winmme/JackWinMMEDriver.cpp b/windows/winmme/JackWinMMEDriver.cpp index b98158f7..5c1f82fc 100644 --- a/windows/winmme/JackWinMMEDriver.cpp +++ b/windows/winmme/JackWinMMEDriver.cpp @@ -18,6 +18,8 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +#include <cmath> + #include "JackEngineControl.h" #include "JackWinMMEDriver.h" @@ -47,7 +49,9 @@ JackWinMMEDriver::Attach() jack_latency_range_t latency_range; const char *name; JackPort *port; - latency_range.max = latency; + latency_range.max = latency + + ((jack_nframes_t) std::ceil((period / 1000.0) * + fEngineControl->fSampleRate)); latency_range.min = latency; jack_info("JackWinMMEDriver::Attach - fCaptureChannels %d", fCaptureChannels); @@ -149,7 +153,7 @@ JackWinMMEDriver::Open(bool capturing, bool playing, int in_channels, period = 0; TIMECAPS caps; - if (timeGetDevCaps(&caps, sizeof(TIMECAPS)) != TIMEERR_NOERROR) { + if (timeGetDevCaps(&caps, sizeof(TIMECAPS)) != TIMERR_NOERROR) { jack_error("JackWinMMEDriver::Open - could not get timer device " "capabilities. Continuing anyway ..."); } else { diff --git a/windows/winmme/JackWinMMEInputPort.cpp b/windows/winmme/JackWinMMEInputPort.cpp index f515ca66..c2895b64 100644 --- a/windows/winmme/JackWinMMEInputPort.cpp +++ b/windows/winmme/JackWinMMEInputPort.cpp @@ -21,7 +21,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. #include <memory> #include <stdexcept> -#include "JackError.h"
+#include "JackError.h" #include "JackTime.h" #include "JackMidiUtil.h" #include "JackWinMMEInputPort.h" |