Commit f0a9512d authored by sletz's avatar sletz
Browse files

Improve some of example-clients, cleanup.

git-svn-id: http://subversion.jackaudio.org/jack/jack2/trunk/jackmp@4610 0c269be4-1314-0410-8aa9-9f06e86f4224
parent 9b6162f3
......@@ -31,7 +31,7 @@ jack_tls_key JackGlobals::fKeyLogFunction;
static bool fKeyLogFunctionInitialized = jack_tls_allocate_key(&JackGlobals::fKeyLogFunction);
JackMutex* JackGlobals::fOpenMutex = new JackMutex();
bool JackGlobals::fServerRunning = false;
volatile bool JackGlobals::fServerRunning = false;
JackClient* JackGlobals::fClientTable[CLIENT_NUM] = {};
#ifndef WIN32
......
......@@ -40,7 +40,7 @@ struct JackGlobals {
static jack_tls_key fRealTime;
static jack_tls_key fKeyLogFunction;
static JackMutex* fOpenMutex;
static bool fServerRunning;
static volatile bool fServerRunning;
static JackClient* fClientTable[];
static bool fVerbose;
#ifndef WIN32
......
......@@ -227,6 +227,24 @@ namespace Jack
return NET_PACKET_ERROR;
}
NetAudioBuffer* JackNetInterface::AudioBufferFactory(int nports, char* buffer)
{
switch (fParams.fSampleEncoder) {
case JackFloatEncoder:
return new NetFloatAudioBuffer(&fParams, nports, buffer);
case JackIntEncoder:
return new NetIntAudioBuffer(&fParams, nports, buffer);
case JackCeltEncoder:
#if HAVE_CELT
return new NetCeltAudioBuffer(&fParams, nports, buffer, fParams.fKBps);
#endif
}
return NULL;
}
// JackNetMasterInterface ************************************************************************************
bool JackNetMasterInterface::Init()
......@@ -316,46 +334,12 @@ namespace Jack
// audio net buffers
if (fParams.fSendAudioChannels > 0) {
switch (fParams.fSampleEncoder) {
case JackFloatEncoder:
fNetAudioCaptureBuffer = new NetFloatAudioBuffer(&fParams, fParams.fSendAudioChannels, fTxData);
break;
case JackIntEncoder:
fNetAudioCaptureBuffer = new NetIntAudioBuffer(&fParams, fParams.fSendAudioChannels, fTxData);
break;
case JackCeltEncoder:
#if HAVE_CELT
fNetAudioCaptureBuffer = new NetCeltAudioBuffer(&fParams, fParams.fSendAudioChannels, fTxData, fParams.fKBps);
#endif
break;
}
fNetAudioCaptureBuffer = AudioBufferFactory(fParams.fSendAudioChannels, fTxData);
assert(fNetAudioCaptureBuffer);
}
if (fParams.fReturnAudioChannels > 0) {
switch (fParams.fSampleEncoder) {
case JackFloatEncoder:
fNetAudioPlaybackBuffer = new NetFloatAudioBuffer(&fParams, fParams.fReturnAudioChannels, fRxData);
break;
case JackIntEncoder:
fNetAudioPlaybackBuffer = new NetIntAudioBuffer(&fParams, fParams.fReturnAudioChannels, fRxData);
break;
case JackCeltEncoder:
#if HAVE_CELT
fNetAudioPlaybackBuffer = new NetCeltAudioBuffer(&fParams, fParams.fReturnAudioChannels, fRxData, fParams.fKBps);
#endif
break;
}
fNetAudioPlaybackBuffer = AudioBufferFactory(fParams.fReturnAudioChannels, fRxData);
assert(fNetAudioPlaybackBuffer);
}
......@@ -809,46 +793,12 @@ namespace Jack
// audio net buffers
if (fParams.fSendAudioChannels > 0) {
switch (fParams.fSampleEncoder) {
case JackFloatEncoder:
fNetAudioCaptureBuffer = new NetFloatAudioBuffer(&fParams, fParams.fSendAudioChannels, fRxData);
break;
case JackIntEncoder:
fNetAudioCaptureBuffer = new NetIntAudioBuffer(&fParams, fParams.fSendAudioChannels, fRxData);
break;
case JackCeltEncoder:
#if HAVE_CELT
fNetAudioCaptureBuffer = new NetCeltAudioBuffer(&fParams, fParams.fSendAudioChannels, fRxData, fParams.fKBps);
#endif
break;
}
fNetAudioCaptureBuffer = AudioBufferFactory(fParams.fSendAudioChannels, fRxData);
assert(fNetAudioCaptureBuffer);
}
if (fParams.fReturnAudioChannels > 0) {
switch (fParams.fSampleEncoder) {
case JackFloatEncoder:
fNetAudioPlaybackBuffer = new NetFloatAudioBuffer(&fParams, fParams.fReturnAudioChannels, fTxData);
break;
case JackIntEncoder:
fNetAudioPlaybackBuffer = new NetIntAudioBuffer(&fParams, fParams.fReturnAudioChannels, fTxData);
break;
case JackCeltEncoder:
#if HAVE_CELT
fNetAudioPlaybackBuffer = new NetCeltAudioBuffer(&fParams, fParams.fReturnAudioChannels, fTxData, fParams.fKBps);
#endif
break;
}
fNetAudioPlaybackBuffer = AudioBufferFactory(fParams.fReturnAudioChannels, fTxData);
assert(fNetAudioPlaybackBuffer);
}
......
......@@ -107,6 +107,8 @@ namespace Jack
int FinishRecv(NetAudioBuffer* buffer);
NetAudioBuffer* AudioBufferFactory(int nports, char* buffer);
public:
JackNetInterface();
......
......@@ -158,9 +158,8 @@ process (jack_nframes_t nframes, void *arg)
static void
jack_shutdown (void *arg)
{
fprintf (stderr, "JACK shutdown\n");
// exit (0);
abort();
fprintf(stderr, "JACK shut down, exiting ...\n");
exit(1);
}
static void
......
......@@ -78,6 +78,7 @@ process (jack_nframes_t nframes, void *arg)
static void
jack_shutdown (void *arg)
{
fprintf(stderr, "JACK shut down, exiting ...\n");
exit (1);
}
......
......@@ -77,6 +77,7 @@ latency_cb (jack_latency_callback_mode_t mode, void *arg)
void
jack_shutdown (void *arg)
{
fprintf(stderr, "JACK shut down, exiting ...\n");
exit (1);
}
......
......@@ -111,6 +111,7 @@ static int srate(jack_nframes_t nframes, void *arg)
static void jack_shutdown(void *arg)
{
fprintf(stderr, "JACK shut down, exiting ...\n");
exit(1);
}
......
......@@ -477,6 +477,7 @@ process (jack_nframes_t nframes, void *arg)
void
jack_shutdown (void *arg)
{
fprintf(stderr, "JACK shut down, exiting ...\n");
exit (1);
}
......
......@@ -64,6 +64,7 @@ showtime ()
static void
jack_shutdown (void *arg)
{
fprintf(stderr, "JACK shut down, exiting ...\n");
exit (1);
}
......
......@@ -124,6 +124,7 @@ static void* jack_thread(void *arg)
static void
jack_shutdown (void *arg)
{
fprintf(stderr, "JACK shut down, exiting ...\n");
exit (1);
}
......
......@@ -6170,6 +6170,7 @@
isa = PBXProject;
buildConfigurationList = 4B699DD5097D427F00A18468 /* Build configuration list for PBXProject "Jackdmp" */;
compatibilityVersion = "Xcode 2.4";
developmentRegion = English;
hasScannedForEncodings = 1;
knownRegions = (
English,
......
......@@ -717,8 +717,7 @@ JackCoreMidiDriver::Write()
}
for (int i = 0; i < num_virtual_outputs; i++) {
virtual_output_ports[i]->
ProcessJack(GetOutputBuffer(num_physical_outputs + i),
buffer_size);
ProcessJack(GetOutputBuffer(num_physical_outputs + i), buffer_size);
}
Unlock();
return 0;
......
......@@ -167,7 +167,7 @@ JackCoreMidiOutputPort::Init()
{
set_threaded_log_function();
// OSX only, values read in RT CoreMidi thread
// OSX only, values read in RT CoreMIDI thread
UInt64 period = 0;
UInt64 computation = 250 * 1000;
UInt64 constraint = 500 * 1000;
......
......@@ -96,7 +96,7 @@ int process(jack_nframes_t nframes, void *arg)
void jack_shutdown(void *arg)
{
printf("Jack_cpu has been kicked out by jackd !\n");
fprintf(stderr, "JACK shut down, exiting ...\n");
exit (1);
}
......
......@@ -357,7 +357,7 @@ extern "C"
{
#endif
// singleton kind of driver
// singleton kind of driver
static Jack::JackDriverClientInterface* driver = NULL;
SERVER_EXPORT jack_driver_desc_t * driver_get_descriptor()
......
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