Browse Source

MIDI thread RT priority reworked a bit on OSX.

tags/1.9.8
Stephane Letz 14 years ago
parent
commit
e843289af8
8 changed files with 22 additions and 19 deletions
  1. +4
    -3
      macosx/Jackdmp.xcodeproj/project.pbxproj
  2. +4
    -5
      macosx/coremidi/JackCoreMidiDriver.cpp
  3. +9
    -3
      macosx/coremidi/JackCoreMidiOutputPort.cpp
  4. +1
    -2
      macosx/coremidi/JackCoreMidiOutputPort.h
  5. +2
    -2
      macosx/coremidi/JackCoreMidiPhysicalOutputPort.cpp
  6. +0
    -1
      macosx/coremidi/JackCoreMidiPhysicalOutputPort.h
  7. +2
    -2
      macosx/coremidi/JackCoreMidiVirtualOutputPort.cpp
  8. +0
    -1
      macosx/coremidi/JackCoreMidiVirtualOutputPort.h

+ 4
- 3
macosx/Jackdmp.xcodeproj/project.pbxproj View File

@@ -1861,7 +1861,7 @@
4BF8D2470834F20600C94B91 /* testSem.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = testSem.cpp; path = ../tests/testSem.cpp; sourceTree = SOURCE_ROOT; };
4BF8FB0D08AC88EF00D1A344 /* JackFrameTimer.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = JackFrameTimer.cpp; path = ../common/JackFrameTimer.cpp; sourceTree = SOURCE_ROOT; };
4BF8FB0E08AC88EF00D1A344 /* JackFrameTimer.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = JackFrameTimer.h; path = ../common/JackFrameTimer.h; sourceTree = SOURCE_ROOT; };
4BFA5E980DEC4D9C00FA4CDB /* testSem */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = testSem; sourceTree = BUILT_PRODUCTS_DIR; };
4BFA5E980DEC4D9C00FA4CDB /* testMutex */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = testMutex; sourceTree = BUILT_PRODUCTS_DIR; };
4BFA5E9E0DEC4DD900FA4CDB /* testMutex.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = testMutex.cpp; path = ../tests/testMutex.cpp; sourceTree = SOURCE_ROOT; };
4BFA828C0DF6A9E40087B4E1 /* jack_evmon */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = jack_evmon; sourceTree = BUILT_PRODUCTS_DIR; };
4BFA829F0DF6A9E40087B4E1 /* jack_bufsize */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = jack_bufsize; sourceTree = BUILT_PRODUCTS_DIR; };
@@ -2662,7 +2662,7 @@
4B363F1E0DEB0A6A001F72D9 /* jack_monitor_client */,
4B363F350DEB0BD1001F72D9 /* jack_showtime */,
4B363F720DEB0D4E001F72D9 /* jack_impulse_grabber */,
4BFA5E980DEC4D9C00FA4CDB /* testSem */,
4BFA5E980DEC4D9C00FA4CDB /* testMutex */,
4BFA828C0DF6A9E40087B4E1 /* jack_evmon */,
4BFA829F0DF6A9E40087B4E1 /* jack_bufsize */,
4BFA82AB0DF6A9E40087B4E1 /* jack_rec */,
@@ -5871,7 +5871,7 @@
name = "testMutex Universal";
productInstallPath = /usr/local/bin;
productName = testSem;
productReference = 4BFA5E980DEC4D9C00FA4CDB /* testSem */;
productReference = 4BFA5E980DEC4D9C00FA4CDB /* testMutex */;
productType = "com.apple.product-type.tool";
};
4BFA82820DF6A9E40087B4E1 /* jack_evmon 64 bits */ = {
@@ -9502,6 +9502,7 @@
"-D__SMP__",
"-DMACH_RPC_MACH_SEMA",
"$(OTHER_CPLUSPLUSFLAGS_QUOTED_FOR_TARGET_1)",
"$(OTHER_CPLUSPLUSFLAGS_QUOTED_FOR_TARGET_2)",
);
OTHER_CPLUSPLUSFLAGS_QUOTED_FOR_TARGET_1 = "-DADDON_DIR=\\\"/usr/local/lib/jackmp\\\"";
OTHER_LDFLAGS = (


+ 4
- 5
macosx/coremidi/JackCoreMidiDriver.cpp View File

@@ -267,8 +267,10 @@ JackCoreMidiDriver::Open(bool capturing, bool playing, int in_channels,
"client name string");
return -1;
}

OSStatus status = MIDIClientCreate(name, HandleNotificationEvent, this,
&client);

CFRelease(name);
if (status != noErr) {
WriteMacOSError("JackCoreMidiDriver::Close", "MIDIClientCreate",
@@ -276,7 +278,6 @@ JackCoreMidiDriver::Open(bool capturing, bool playing, int in_channels,
return -1;
}
char *client_name = fClientControl.fName;
int port_rt_priority = fEngineControl->fServerPriority + 1;

// Allocate and connect virtual inputs
if (in_channels) {
@@ -319,8 +320,7 @@ JackCoreMidiDriver::Open(bool capturing, bool playing, int in_channels,
new JackCoreMidiVirtualOutputPort(fAliasName, client_name,
playback_driver_name,
vo_count, client,
time_ratio,
port_rt_priority);
time_ratio);
} catch (std::exception e) {
jack_error("JackCoreMidiDriver::Open - while creating virtual "
"output port: %s", e.what());
@@ -387,8 +387,7 @@ JackCoreMidiDriver::Open(bool capturing, bool playing, int in_channels,
new JackCoreMidiPhysicalOutputPort(fAliasName, client_name,
playback_driver_name, i,
client, internal_output,
time_ratio,
port_rt_priority);
time_ratio);
} catch (std::exception e) {
jack_error("JackCoreMidiDriver::Open - while creating "
"physical output port: %s", e.what());


+ 9
- 3
macosx/coremidi/JackCoreMidiOutputPort.cpp View File

@@ -26,7 +26,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
using Jack::JackCoreMidiOutputPort;

JackCoreMidiOutputPort::JackCoreMidiOutputPort(double time_ratio,
int realtime_priority,
size_t max_bytes,
size_t max_messages):
JackCoreMidiPort(time_ratio)
@@ -36,7 +35,6 @@ JackCoreMidiOutputPort::JackCoreMidiOutputPort(double time_ratio,
thread_queue = new JackMidiAsyncWaitQueue(max_bytes, max_messages);
std::auto_ptr<JackMidiAsyncWaitQueue> thread_ptr(thread_queue);
thread = new JackThread(this);
this->realtime_priority = realtime_priority;
thread_ptr.release();
read_ptr.release();
}
@@ -137,7 +135,15 @@ bool
JackCoreMidiOutputPort::Init()
{
set_threaded_log_function();
if (thread->AcquireSelfRealTime(realtime_priority)) {

// OSX only...
UInt64 period = 0;
UInt64 computation = 500 * 1000;
UInt64 constraint = 500 * 1000;
thread->SetParams(period, computation, constraint);

// Use the server priority : y
if (thread->AcquireSelfRealTime()) {
jack_error("JackCoreMidiOutputPort::Init - could not acquire realtime "
"scheduling. Continuing anyway.");
}


+ 1
- 2
macosx/coremidi/JackCoreMidiOutputPort.h View File

@@ -39,7 +39,6 @@ namespace Jack {

char packet_buffer[PACKET_BUFFER_SIZE];
JackMidiBufferReadQueue *read_queue;
int realtime_priority;
JackThread *thread;
JackMidiAsyncWaitQueue *thread_queue;

@@ -55,7 +54,7 @@ namespace Jack {

public:

JackCoreMidiOutputPort(double time_ratio, int realtime_priority, size_t max_bytes=4096,
JackCoreMidiOutputPort(double time_ratio, size_t max_bytes=4096,
size_t max_messages=1024);

virtual


+ 2
- 2
macosx/coremidi/JackCoreMidiPhysicalOutputPort.cpp View File

@@ -30,9 +30,9 @@ JackCoreMidiPhysicalOutputPort(const char *alias_name, const char *client_name,
const char *driver_name, int index,
MIDIClientRef client,
MIDIPortRef internal_output, double time_ratio,
int realtime_priority, size_t max_bytes,
size_t max_bytes,
size_t max_messages):
JackCoreMidiOutputPort(time_ratio, realtime_priority, max_bytes,
JackCoreMidiOutputPort(time_ratio, max_bytes,
max_messages)
{
MIDIEndpointRef destination = MIDIGetDestination(index);


+ 0
- 1
macosx/coremidi/JackCoreMidiPhysicalOutputPort.h View File

@@ -43,7 +43,6 @@ namespace Jack {
MIDIClientRef client,
MIDIPortRef internal_output,
double time_ratio,
int realtime_priority,
size_t max_bytes=4096,
size_t max_messages=1024);



+ 2
- 2
macosx/coremidi/JackCoreMidiVirtualOutputPort.cpp View File

@@ -29,9 +29,9 @@ JackCoreMidiVirtualOutputPort::
JackCoreMidiVirtualOutputPort(const char *alias_name, const char *client_name,
const char *driver_name, int index,
MIDIClientRef client, double time_ratio,
int realtime_priority, size_t max_bytes,
size_t max_bytes,
size_t max_messages):
JackCoreMidiOutputPort(time_ratio, realtime_priority, max_bytes,
JackCoreMidiOutputPort(time_ratio, max_bytes,
max_messages)
{
std::stringstream stream;


+ 0
- 1
macosx/coremidi/JackCoreMidiVirtualOutputPort.h View File

@@ -37,7 +37,6 @@ namespace Jack {
const char *client_name,
const char *driver_name, int index,
MIDIClientRef client, double time_ratio,
int realtime_priority,
size_t max_bytes=4096,
size_t max_messages=1024);



Loading…
Cancel
Save