Commit 8273564a authored by sletz's avatar sletz
Browse files

Cleanup, renaming.

git-svn-id: http://subversion.jackaudio.org/jack/jack2/trunk/jackmp@3119 0c269be4-1314-0410-8aa9-9f06e86f4224
parent 88c195d4
......@@ -69,7 +69,7 @@ def build(bld):
prog.target = example_program
#if bld.env['BUILD_EXAMPLE_CLIENT_TRANSPORT']
if bld.env['BUILD_EXAMPLE_CLIENT_TRANSPORT'] == True and bld.env['IS_LINUX'] == True:
if bld.env['BUILD_EXAMPLE_CLIENT_TRANSPORT'] == True:
prog = bld.new_task_gen('cc', 'program')
prog.includes = os_incdir + ['../common/jack', '../common']
prog.source = 'transport.c'
......
......@@ -277,8 +277,8 @@
4B35C57D0D4731D2000DE7AE /* testAtomic.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF8D23E0834F1C300C94B91 /* testAtomic.cpp */; };
4B35C58D0D4731D2000DE7AE /* testSem.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF8D2470834F20600C94B91 /* testSem.cpp */; };
4B35C59F0D4731D2000DE7AE /* zombie.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BF8D1670834EDD900C94B91 /* zombie.c */; };
4B35C5AB0D4731D2000DE7AE /* jack_test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BE6C6AC0A3E0A65005A203A /* jack_test.cpp */; };
4B35C5B70D4731D2000DE7AE /* jack_cpu.c in Sources */ = {isa = PBXBuildFile; fileRef = 4B3F49070AD8503300491C6E /* jack_cpu.c */; };
4B35C5AB0D4731D2000DE7AE /* test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BE6C6AC0A3E0A65005A203A /* test.cpp */; };
4B35C5B70D4731D2000DE7AE /* cpu.c in Sources */ = {isa = PBXBuildFile; fileRef = 4B3F49070AD8503300491C6E /* cpu.c */; };
4B35C5C30D4731D2000DE7AE /* ipload.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BA692B20CBE4C2D00EAD520 /* ipload.c */; };
4B35C5CF0D4731D2000DE7AE /* ipunload.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BA692D60CBE4CC600EAD520 /* ipunload.c */; };
4B35C5DA0D4731D2000DE7AE /* JackError.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF8D1770834EE4800C94B91 /* JackError.h */; };
......@@ -298,7 +298,7 @@
4B363F230DEB0AB0001F72D9 /* monitor_client.c in Sources */ = {isa = PBXBuildFile; fileRef = 4B363F220DEB0AB0001F72D9 /* monitor_client.c */; };
4B363F3E0DEB0C31001F72D9 /* showtime.c in Sources */ = {isa = PBXBuildFile; fileRef = 4B363F3D0DEB0C31001F72D9 /* showtime.c */; };
4B363F760DEB0D7D001F72D9 /* impulse_grabber.c in Sources */ = {isa = PBXBuildFile; fileRef = 4B363F750DEB0D7D001F72D9 /* impulse_grabber.c */; };
4B3F49080AD8503300491C6E /* jack_cpu.c in Sources */ = {isa = PBXBuildFile; fileRef = 4B3F49070AD8503300491C6E /* jack_cpu.c */; };
4B3F49080AD8503300491C6E /* cpu.c in Sources */ = {isa = PBXBuildFile; fileRef = 4B3F49070AD8503300491C6E /* cpu.c */; };
4B4CA9750E02CF9600F4BFDA /* JackRestartThreadedDriver.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B4CA9730E02CF9600F4BFDA /* JackRestartThreadedDriver.h */; };
4B4CA9760E02CF9600F4BFDA /* JackRestartThreadedDriver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B4CA9740E02CF9600F4BFDA /* JackRestartThreadedDriver.cpp */; };
4B4CA9770E02CF9600F4BFDA /* JackRestartThreadedDriver.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B4CA9730E02CF9600F4BFDA /* JackRestartThreadedDriver.h */; };
......@@ -565,7 +565,7 @@
4BE5FECE0E725C090020B576 /* JackCoreAudioDriver.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BE5FECC0E725C090020B576 /* JackCoreAudioDriver.h */; };
4BE5FED10E725C320020B576 /* JackCoreAudioAdapter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BE5FECF0E725C320020B576 /* JackCoreAudioAdapter.cpp */; };
4BE5FED20E725C320020B576 /* JackCoreAudioAdapter.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BE5FED00E725C320020B576 /* JackCoreAudioAdapter.h */; };
4BE6C6AD0A3E0A65005A203A /* jack_test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BE6C6AC0A3E0A65005A203A /* jack_test.cpp */; };
4BE6C6AD0A3E0A65005A203A /* test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BE6C6AC0A3E0A65005A203A /* test.cpp */; };
4BF4BAB10E3480AB00403CDF /* JackAudioAdapterFactory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF4BAB00E3480AB00403CDF /* JackAudioAdapterFactory.cpp */; };
4BF520530CB8D0E80037470E /* timestamps.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BF520520CB8D0E80037470E /* timestamps.c */; };
4BF520540CB8D0E80037470E /* timestamps.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BF520520CB8D0E80037470E /* timestamps.c */; };
......@@ -1210,7 +1210,7 @@
4B37C20306DF1FBE0016E567 /* CALatencyLog.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = CALatencyLog.cpp; path = /Developer/Examples/CoreAudio/PublicUtility/CALatencyLog.cpp; sourceTree = "<absolute>"; };
4B37C20406DF1FBE0016E567 /* CALatencyLog.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = CALatencyLog.h; path = /Developer/Examples/CoreAudio/PublicUtility/CALatencyLog.h; sourceTree = "<absolute>"; };
4B37C20906DF1FE20016E567 /* latency.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = latency.c; path = /Developer/Examples/CoreAudio/PublicUtility/latency.c; sourceTree = "<absolute>"; };
4B3F49070AD8503300491C6E /* jack_cpu.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = jack_cpu.c; path = ../tests/jack_cpu.c; sourceTree = SOURCE_ROOT; };
4B3F49070AD8503300491C6E /* cpu.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = cpu.c; path = ../tests/cpu.c; sourceTree = SOURCE_ROOT; };
4B4259E5076B635E00C1ECE1 /* JackMacEngineRPC.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JackMacEngineRPC.cpp; sourceTree = SOURCE_ROOT; };
4B464301076CAC7700E5077C /* Jack-Info.plist */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text.plist.xml; path = "Jack-Info.plist"; sourceTree = SOURCE_ROOT; };
4B4CA9730E02CF9600F4BFDA /* JackRestartThreadedDriver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JackRestartThreadedDriver.h; path = ../common/JackRestartThreadedDriver.h; sourceTree = SOURCE_ROOT; };
......@@ -1332,7 +1332,7 @@
4BE5FECF0E725C320020B576 /* JackCoreAudioAdapter.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = JackCoreAudioAdapter.cpp; path = coreaudio/JackCoreAudioAdapter.cpp; sourceTree = SOURCE_ROOT; };
4BE5FED00E725C320020B576 /* JackCoreAudioAdapter.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = JackCoreAudioAdapter.h; path = coreaudio/JackCoreAudioAdapter.h; sourceTree = SOURCE_ROOT; };
4BE6C6A30A3E096F005A203A /* jack_test */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = jack_test; sourceTree = BUILT_PRODUCTS_DIR; };
4BE6C6AC0A3E0A65005A203A /* jack_test.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = jack_test.cpp; path = ../tests/jack_test.cpp; sourceTree = SOURCE_ROOT; };
4BE6C6AC0A3E0A65005A203A /* test.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = test.cpp; path = ../tests/test.cpp; sourceTree = SOURCE_ROOT; };
4BE99D300AD7A04800C59091 /* jack_cpu */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = jack_cpu; sourceTree = BUILT_PRODUCTS_DIR; };
4BF3937C0626BF3600CC67FA /* JackMacLibClientRPC.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JackMacLibClientRPC.cpp; sourceTree = SOURCE_ROOT; };
4BF4BAB00E3480AB00403CDF /* JackAudioAdapterFactory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JackAudioAdapterFactory.cpp; path = ../common/JackAudioAdapterFactory.cpp; sourceTree = SOURCE_ROOT; };
......@@ -2262,7 +2262,7 @@
4B6BEB4A07A6CCDC00A5DBDA /* Tests */ = {
isa = PBXGroup;
children = (
4B3F49070AD8503300491C6E /* jack_cpu.c */,
4B3F49070AD8503300491C6E /* cpu.c */,
4BFA99A90AAAF40C009E916C /* jdelay.cpp */,
4BF8D23E0834F1C300C94B91 /* testAtomic.cpp */,
4BF8D2470834F20600C94B91 /* testSem.cpp */,
......@@ -2270,7 +2270,7 @@
4BA577FB08BF8E4600F82DE1 /* testSynchroServer.cpp */,
4BBD13CC08C71EB40079F7FF /* testSynchroServerClient.cpp */,
4BFA5E9E0DEC4DD900FA4CDB /* testMutex.cpp */,
4BE6C6AC0A3E0A65005A203A /* jack_test.cpp */,
4BE6C6AC0A3E0A65005A203A /* test.cpp */,
);
name = Tests;
sourceTree = "<group>";
......@@ -5481,7 +5481,7 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
4B35C5AB0D4731D2000DE7AE /* jack_test.cpp in Sources */,
4B35C5AB0D4731D2000DE7AE /* test.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
......@@ -5489,7 +5489,7 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
4B35C5B70D4731D2000DE7AE /* jack_cpu.c in Sources */,
4B35C5B70D4731D2000DE7AE /* cpu.c in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
......@@ -5916,7 +5916,7 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
4BE6C6AD0A3E0A65005A203A /* jack_test.cpp in Sources */,
4BE6C6AD0A3E0A65005A203A /* test.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
......@@ -5924,7 +5924,7 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
4B3F49080AD8503300491C6E /* jack_cpu.c in Sources */,
4B3F49080AD8503300491C6E /* cpu.c in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
......
/*
Copyright (C) 2003 Fons Adriaensen <fons.adriaensen@skynet.be>
Copyright (C) 2003-2008 Fons Adriaensen <fons@kokkinizita.net>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
......@@ -23,12 +23,9 @@
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <unistd.h>
#include <jack/jack.h>
#ifdef WIN32
#define M_PI 3.141562653
#else
#include <unistd.h>
#endif
class Freq
{
......@@ -91,6 +88,7 @@ MTDM::MTDM (void) : _cnt (0), _inv (0)
}
}
int MTDM::process (size_t len, float *ip, float *op)
{
int i;
......@@ -103,7 +101,7 @@ int MTDM::process (size_t len, float *ip, float *op)
vip = *ip++;
for (i = 0, F = _freq; i < 5; i++, F++)
{
a = 2 * M_PI * (F->p & 0xFFFF) / 65536.0;
a = 2 * (float) M_PI * (F->p & 65535) / 65536.0;
F->p += F->f;
c = cosf (a);
s = -sinf (a);
......@@ -127,6 +125,7 @@ int MTDM::process (size_t len, float *ip, float *op)
return 0;
}
int MTDM::resolve (void)
{
int i, k, m;
......@@ -159,88 +158,77 @@ int MTDM::resolve (void)
return 0;
}
// --------------------------------------------------------------------------------
static MTDM mtdm;
static jack_client_t *jack_handle;
static jack_port_t *jack_capt;
static jack_port_t *jack_play;
static void jack_shutdown (void *arg)
{
exit (1);
}
static int jack_callback (jack_nframes_t nframes, void *arg)
int jack_callback (jack_nframes_t nframes, void *arg)
{
float *ip, *op;
ip = (float *)(jack_port_get_buffer (jack_capt, nframes));
op = (float *)(jack_port_get_buffer (jack_play, nframes));
return mtdm.process (nframes, ip, op);;
mtdm.process (nframes, ip, op);
return 0;
}
int main (int ac, char *av [])
{
const char** ports;
float t;
jack_status_t s;
if ((jack_handle = jack_client_new ("jdelay")) == 0)
jack_handle = jack_client_open ("jack_delay", JackNoStartServer, &s);
if (jack_handle == 0)
{
fprintf (stderr, "Can't connect to JACK\n");
return 1;
fprintf (stderr, "Can't connect to Jack, is the server running ?\n");
exit (1);
}
jack_set_process_callback (jack_handle, jack_callback, 0);
jack_on_shutdown (jack_handle, jack_shutdown, 0);
jack_capt = jack_port_register (jack_handle, "in", JACK_DEFAULT_AUDIO_TYPE, JackPortIsInput, 0);
jack_play = jack_port_register (jack_handle, "out", JACK_DEFAULT_AUDIO_TYPE, JackPortIsOutput, 0);
printf ("capture latency = %d\n",
jack_port_get_latency (jack_port_by_name (jack_handle, "system:capture_1")));
printf ("playback_latency = %d\n",
jack_port_get_latency (jack_port_by_name (jack_handle, "system:playback_1")));
t = 1000.0f / jack_get_sample_rate (jack_handle);
if (jack_activate (jack_handle))
{
fprintf(stderr, "Can't activate JACK");
fprintf(stderr, "Can't activate Jack");
return 1;
}
if ((ports = jack_get_ports(jack_handle, NULL, NULL, JackPortIsPhysical | JackPortIsOutput)) == NULL) {
printf("Cannot find any physical capture ports\n");
} else {
for (int i = 0; i < 8 && ports[i] ; i++) {
jack_connect(jack_handle, ports[i], jack_port_name(jack_capt));
}
free(ports);
}
if ((ports = jack_get_ports(jack_handle, NULL, NULL, JackPortIsPhysical | JackPortIsInput)) == NULL) {
printf("Cannot find any physical playback ports");
} else {
for (int i = 0; i < 8 && ports[i]; i++) {
jack_connect(jack_handle, jack_port_name(jack_play), ports[i]);
}
free(ports);
}
while (1)
{
#ifdef WIN32
Sleep (250);
#else
usleep (250000);
#endif
if (mtdm.resolve () < 0) printf ("Signal below threshold...\n");
else
{
if (mtdm.err () > 0.3)
{
mtdm.invert ();
mtdm.resolve ();
}
printf ("%10.3lf frames", mtdm.del ());
if (mtdm.err () > 0.2) printf (" ??");
if (mtdm.inv ()) printf (" Inv");
printf ("\n");
}
usleep (250000);
if (mtdm.resolve () < 0) printf ("Signal below threshold...\n");
else
{
if (mtdm.err () > 0.3)
{
mtdm.invert ();
mtdm.resolve ();
}
printf ("%10.3lf frames %10.3lf ms", mtdm.del (), mtdm.del () * t);
if (mtdm.err () > 0.2) printf (" ??");
if (mtdm.inv ()) printf (" Inv");
printf ("\n");
}
}
return 0;
}
// --------------------------------------------------------------------------------
......@@ -2,13 +2,14 @@
# encoding: utf-8
test_programs = {
# For testing purposes
#'synchroClient': ['testSynchroClient.cpp'],
#'synchroServer': ['testSynchroServer.cpp'],
#'synchroServerClient': ['testSynchroServerClient.cpp'],
'testSem': ['testSem.cpp'],
'jack_test': ['jack_test.cpp'],
'jack_cpu': ['jack_cpu.c'],
'jdelay': ['jdelay.cpp'],
#'testSem': ['testSem.cpp'],
'jack_test': ['test.cpp'],
'jack_cpu': ['cpu.c'],
'jack_delay': ['jdelay.cpp'],
'jack_multiple_metro' : ['external_metro.cpp'],
}
......
......@@ -77,7 +77,7 @@
<Add library="odbccp32" />
<Add library="libjack" />
</Linker>
<Unit filename="..\tests\jack_test.cpp">
<Unit filename="..\tests\test.cpp">
<Option compilerVar="CC" />
</Unit>
<Extensions>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment