git-svn-id: http://subversion.jackaudio.org/jack/jack2/trunk/jackmp@4339 0c269be4-1314-0410-8aa9-9f06e86f4224tags/1.9.8
@@ -29,6 +29,7 @@ Jan Engelhardt | |||
Adrian Knoth | |||
David Garcia Garzon | |||
Valerio Pilo | |||
Chris Caudle | |||
--------------------------- | |||
Jackdmp changes log | |||
@@ -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; | |||
} |
@@ -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. |
@@ -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</></> | |||
@@ -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</></> | |||
@@ -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> |
@@ -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> |
@@ -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> |
@@ -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> | |||
@@ -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 { | |||
@@ -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" | |||