diff options
Diffstat (limited to 'macosx')
-rw-r--r-- | macosx/Jack-Info.plist | 4 | ||||
-rw-r--r-- | macosx/JackMachThread.cpp | 6 | ||||
-rw-r--r-- | macosx/JackMachThread.h | 2 | ||||
-rw-r--r-- | macosx/Jackdmp.xcodeproj/project.pbxproj | 2 | ||||
-rw-r--r-- | macosx/coreaudio/JackCoreAudioAdapter.cpp | 2 | ||||
-rw-r--r-- | macosx/coreaudio/JackCoreAudioDriver.cpp | 35 | ||||
-rw-r--r-- | macosx/coreaudio/JackCoreAudioDriver.h | 4 |
7 files changed, 40 insertions, 15 deletions
diff --git a/macosx/Jack-Info.plist b/macosx/Jack-Info.plist index 924e644a..1e5eb07e 100644 --- a/macosx/Jack-Info.plist +++ b/macosx/Jack-Info.plist @@ -7,7 +7,7 @@ <key>CFBundleExecutable</key> <string>Jackservermp</string> <key>CFBundleGetInfoString</key> - <string>Jackdmp 1.9.3, @03-09 Paul Davis, Grame</string> + <string>Jackdmp 1.9.4, @03-09 Paul Davis, Grame</string> <key>CFBundleIdentifier</key> <string>com.grame.Jackmp</string> <key>CFBundleInfoDictionaryVersion</key> @@ -19,6 +19,6 @@ <key>CFBundleSignature</key> <string>????</string> <key>CFBundleVersion</key> - <string>1.9.3</string> + <string>1.9.4</string> </dict> </plist> diff --git a/macosx/JackMachThread.cpp b/macosx/JackMachThread.cpp index 7b45d239..fa836fb4 100644 --- a/macosx/JackMachThread.cpp +++ b/macosx/JackMachThread.cpp @@ -126,13 +126,13 @@ UInt32 JackMachThread::GetThreadPriority(pthread_t thread, int inWhichPriority) return 0; } -int JackMachThread::GetParams(UInt64* period, UInt64* computation, UInt64* constraint) +int JackMachThread::GetParams(pthread_t thread, UInt64* period, UInt64* computation, UInt64* constraint) { thread_time_constraint_policy_data_t theTCPolicy; mach_msg_type_number_t count = THREAD_TIME_CONSTRAINT_POLICY_COUNT; boolean_t get_default = false; - kern_return_t res = thread_policy_get(pthread_mach_thread_np(pthread_self()), + kern_return_t res = thread_policy_get(pthread_mach_thread_np(thread), THREAD_TIME_CONSTRAINT_POLICY, (thread_policy_t) & theTCPolicy, &count, @@ -187,7 +187,7 @@ int JackMachThread::AcquireRealTimeImp(pthread_t thread, UInt64 period, UInt64 c UInt64 int_period; UInt64 int_computation; UInt64 int_constraint; - GetParams(&int_period, &int_computation, &int_constraint); + GetParams(thread, &int_period, &int_computation, &int_constraint); return 0; } diff --git a/macosx/JackMachThread.h b/macosx/JackMachThread.h index 4dc8d509..e8105803 100644 --- a/macosx/JackMachThread.h +++ b/macosx/JackMachThread.h @@ -109,7 +109,7 @@ class SERVER_EXPORT JackMachThread : public JackPosixThread int AcquireRealTime(int priority); int DropRealTime(); void SetParams(UInt64 period, UInt64 computation, UInt64 constraint); - static int GetParams(UInt64* period, UInt64* computation, UInt64* constraint); + static int GetParams(pthread_t thread, UInt64* period, UInt64* computation, UInt64* constraint); static int SetThreadToPriority(pthread_t thread, UInt32 inPriority, Boolean inIsFixed, UInt64 period, UInt64 computation, UInt64 constraint); static int AcquireRealTimeImp(pthread_t thread, UInt64 period, UInt64 computation, UInt64 constraint); diff --git a/macosx/Jackdmp.xcodeproj/project.pbxproj b/macosx/Jackdmp.xcodeproj/project.pbxproj index e0839f84..d6c37727 100644 --- a/macosx/Jackdmp.xcodeproj/project.pbxproj +++ b/macosx/Jackdmp.xcodeproj/project.pbxproj @@ -10846,7 +10846,7 @@ CoreFoundation, ); OTHER_REZFLAGS = ""; - PRODUCT_NAME = jack_midiseq; + PRODUCT_NAME = jack_showtime; REZ_EXECUTABLE = YES; SDKROOT = ""; SECTORDER_FLAGS = ""; diff --git a/macosx/coreaudio/JackCoreAudioAdapter.cpp b/macosx/coreaudio/JackCoreAudioAdapter.cpp index a0222cab..60f187cb 100644 --- a/macosx/coreaudio/JackCoreAudioAdapter.cpp +++ b/macosx/coreaudio/JackCoreAudioAdapter.cpp @@ -21,6 +21,8 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. #include "JackError.h" #include <unistd.h> +#include <CoreServices/CoreServices.h> + namespace Jack { diff --git a/macosx/coreaudio/JackCoreAudioDriver.cpp b/macosx/coreaudio/JackCoreAudioDriver.cpp index 6c2222e7..d0815cd1 100644 --- a/macosx/coreaudio/JackCoreAudioDriver.cpp +++ b/macosx/coreaudio/JackCoreAudioDriver.cpp @@ -218,7 +218,12 @@ OSStatus JackCoreAudioDriver::MeasureCallback(AudioDeviceID inDevice, AudioDeviceStop(driver->fDeviceID, MeasureCallback); jack_log("JackCoreAudioDriver::MeasureCallback called"); - JackMachThread::GetParams(&driver->fEngineControl->fPeriod, &driver->fEngineControl->fComputation, &driver->fEngineControl->fConstraint); + JackMachThread::GetParams(pthread_self(), &driver->fEngineControl->fPeriod, &driver->fEngineControl->fComputation, &driver->fEngineControl->fConstraint); + + if (driver->fComputationGrain > 0) { + jack_log("JackCoreAudioDriver::MeasureCallback : RT thread computation setup to %ld percent of period", int(driver->fComputationGrain * 100)); + driver->fEngineControl->fComputation = driver->fEngineControl->fPeriod * driver->fComputationGrain; + } // Setup threadded based log function set_threaded_log_function(); @@ -441,7 +446,7 @@ OSStatus JackCoreAudioDriver::GetTotalChannels(AudioDeviceID device, int& channe } JackCoreAudioDriver::JackCoreAudioDriver(const char* name, const char* alias, JackLockedEngine* engine, JackSynchro* table) - : JackAudioDriver(name, alias, engine, table), fJackInputData(NULL), fDriverOutputData(NULL), fState(false), fIOUsage(1.f) + : JackAudioDriver(name, alias, engine, table), fJackInputData(NULL), fDriverOutputData(NULL), fState(false), fIOUsage(1.f),fComputationGrain(-1.f) {} JackCoreAudioDriver::~JackCoreAudioDriver() @@ -1103,7 +1108,8 @@ int JackCoreAudioDriver::Open(jack_nframes_t buffer_size, const char* playback_driver_uid, jack_nframes_t capture_latency, jack_nframes_t playback_latency, - int async_output_latency) + int async_output_latency, + int computation_grain) { int in_nChannels = 0; int out_nChannels = 0; @@ -1120,7 +1126,8 @@ int JackCoreAudioDriver::Open(jack_nframes_t buffer_size, strcpy(fPlaybackUID, playback_driver_uid); fCaptureLatency = capture_latency; fPlaybackLatency = playback_latency; - fIOUsage = float(async_output_latency)/ 100.f; + fIOUsage = float(async_output_latency) / 100.f; + fComputationGrain = float(computation_grain) / 100.f; if (SetupDevices(capture_driver_uid, playback_driver_uid, capture_driver_name, playback_driver_name) < 0) return -1; @@ -1259,12 +1266,13 @@ int JackCoreAudioDriver::Attach() // Monitor ports if (fWithMonitorPorts) { jack_log("Create monitor port "); - snprintf(name, sizeof(name) - 1, "%s:%s:monitor_%u", fAliasName, fPlaybackDriverName, i + 1); + snprintf(name, sizeof(name) - 1, "%s:monitor_%u", fClientControl.fName, i + 1); if ((port_index = fGraphManager->AllocatePort(fClientControl.fRefNum, name, JACK_DEFAULT_AUDIO_TYPE, JackPortIsOutput, fEngineControl->fBufferSize)) == NO_PORT) { jack_error("Cannot register monitor port for %s", name); return -1; } else { port = fGraphManager->GetPort(port_index); + port->SetAlias(alias); port->SetLatency(fEngineControl->fBufferSize); fMonitorPortList[i] = port_index; } @@ -1364,7 +1372,7 @@ extern "C" strcpy(desc->name, "coreaudio"); // size MUST be less then JACK_DRIVER_NAME_MAX + 1 strcpy(desc->desc, "Apple CoreAudio API based audio backend"); // size MUST be less then JACK_DRIVER_PARAM_DESC + 1 - desc->nparams = 14; + desc->nparams = 15; desc->params = (jack_driver_param_desc_t*)calloc(desc->nparams, sizeof(jack_driver_param_desc_t)); i = 0; @@ -1478,6 +1486,14 @@ extern "C" desc->params[i].value.i = 100; strcpy(desc->params[i].short_desc, "Extra output latency in aynchronous mode (percent)"); strcpy(desc->params[i].long_desc, desc->params[i].short_desc); + + i++; + strcpy(desc->params[i].name, "grain"); + desc->params[i].character = 'G'; + desc->params[i].type = JackDriverParamUInt; + desc->params[i].value.i = 100; + strcpy(desc->params[i].short_desc, "Computation grain in RT thread (percent)"); + strcpy(desc->params[i].long_desc, desc->params[i].short_desc); return desc; } @@ -1498,6 +1514,7 @@ extern "C" jack_nframes_t systemic_input_latency = 0; jack_nframes_t systemic_output_latency = 0; int async_output_latency = 100; + int computation_grain = -1; for (node = params; node; node = jack_slist_next(node)) { param = (const jack_driver_param_t *) node->data; @@ -1567,6 +1584,10 @@ extern "C" case 'L': async_output_latency = param->value.ui; break; + + case 'G': + computation_grain = param->value.ui; + break; } } @@ -1578,7 +1599,7 @@ extern "C" Jack::JackCoreAudioDriver* driver = new Jack::JackCoreAudioDriver("system", "coreaudio", engine, table); if (driver->Open(frames_per_interrupt, srate, capture, playback, chan_in, chan_out, monitor, capture_driver_uid, - playback_driver_uid, systemic_input_latency, systemic_output_latency, async_output_latency) == 0) { + playback_driver_uid, systemic_input_latency, systemic_output_latency, async_output_latency, computation_grain) == 0) { return driver; } else { delete driver; diff --git a/macosx/coreaudio/JackCoreAudioDriver.h b/macosx/coreaudio/JackCoreAudioDriver.h index 62de09fb..fb680b3f 100644 --- a/macosx/coreaudio/JackCoreAudioDriver.h +++ b/macosx/coreaudio/JackCoreAudioDriver.h @@ -72,6 +72,7 @@ class JackCoreAudioDriver : public JackAudioDriver bool fMonitor; float fIOUsage; + float fComputationGrain; /* #ifdef MAC_OS_X_VERSION_10_5 @@ -164,7 +165,8 @@ class JackCoreAudioDriver : public JackAudioDriver const char* playback_driver_name, jack_nframes_t capture_latency, jack_nframes_t playback_latency, - int async_output_latency); + int async_output_latency, + int computation_grain); int Close(); int Attach(); |