Posts

Post not yet marked as solved
0 Replies
368 Views
Hello, I'm developing an open source .NET library to work with MIDI – DryWetMIDI. Recently the issue was reported – DllNotFoundException on Apple Silicon chips. So the multimedia API (devices, default playback) of the library is not working on macOS with Apple Silicon CPUs. The possible fix is ready and pushed to the test branch of the library repo. But I don't have a machine with macOS and Apple Silicon chip. So maybe someone can help me and would be so kind to run unit tests of the library on their machine? As I've noticed in the issue: But I should to note that complete tests run takes noticeable amount of time. Tests are logically divided into two categories: Core and Multimedia. Each category runs for about 20-25 minutes. Core tests can be run with your regular work on computer in parallel. But it's desired for Multimedia tests to be run without any user activity on a machine. It's because of the nature of those tests. Many of them checks that specific events occurred within a small amount of time (like 30 or even 15 ms), so any other activity can affect tests and they will fail. Of course I will give step-by-step instruction of how to run the tests.
Posted
by Max_Max.
Last updated
.
Post marked as solved
6 Replies
4.1k Views
Hello,Is there a high-precision timer API in MacOS like that Windows Multimedia Timers provide? I need execute my callback exactly every 1 ms, so I need an API allowing to fire events with this resolution. I can't find appropriate API for this. Ideally I want to use C++.As far as I know timers with such small intervals are platform-specific, so I suppose MacOS has it.There are a lot of answers on the web regarding accurate time measurements. But I need accurate timer.
Posted
by Max_Max.
Last updated
.
Post not yet marked as solved
3 Replies
837 Views
On API documentation I see Availability column to the right. For example: MIDIInputPortCreate: Availability iOS 4.2–14.0 Deprecated macOS 10.0–11.0 Deprecated Does it mean that this function is completely removed from the CoreMIDI in macOS 11.1+? Sounds terrible since I believe there are a lot of applications relying on "old" API. Or it means API still exists but is not supported?
Posted
by Max_Max.
Last updated
.
Post marked as solved
1 Replies
1.1k Views
I'm trying to write simple loopback virtual MIDI port on macOS using CoreMIDI in C. First of all, it seems I can't understand all the CoreMIDI terminology. Look please at the following picture: ┌─────────────┐ │ MIDI DEVICE │ │ │ └─OUT──────IN─┘ ↓ ↑ event event ↓ ↑ ──A─────────B── application ↓ ↑ So we have a MIDI device. This device has out port and in port from the device point of view. So via out port MIDI device sends MIDI data and via in port it receives data. But now let's look on this system from an application point of view. For application MIDI data that is going from a MIDI device, is actually received (point A on the picture above) by app from the device out port. And data that is going from the app, is received by device via its in port from app (point B). So my first question is what API represents A and B? There is four concepts in CoreMIDI: source destination input port output port So if we want to receive MIDI data from a MIDI device, what sould we use? I suppose we need something like that: void MyReadProc(const MIDIPacketList *pktlist, void *readProcRefCon, void *srcConnRefCon) { } ... MIDIClientRef client; MIDIClientCreate(CFSTR("CLIENT"), NULL, NULL, &client); MIDIPortRef inPort; MIDIInputPortCreate(client, CFSTR("TEST"), MyReadProc, NULL, &inPort); MIDIPortConnectSource(inPort, srcEndpoint, NULL); where srcEndpoint is MIDIEndpointRef representing source. Much funny things are happen when we want to send MIDI data to a device. Should we use MIDISend or MIDIReceived? Now I need to show my implementation of loopback port: #include <stdio.h> #include <CoreFoundation/CoreFoundation.h> #include <CoreMIDI/CoreMIDI.h> #include <mach/mach_time.h> #include <string.h> void MyReadProc(const MIDIPacketList *pktlist, void *readProcRefCon, void *srcConnRefCon) { if (readProcRefCon != NULL && srcConnRefCon != NULL) { MIDIPortRef portRef = *((MIDIPortRef*)readProcRefCon); MIDIEndpointRef destRef = *((MIDIEndpointRef*)srcConnRefCon); OSStatus result = MIDISend(portRef, destRef, pktlist); printf("B\n"); } } ... MIDIClientRef client; MIDIClientCreate(CFSTR("CLIENT"), NULL, NULL, &client); MIDIPortRef outPort; MIDIOutputPortCreate(client, CFSTR("TEST"), &outPort); MIDIEndpointRef destEndpoint; MIDIDestinationCreate(client, CFSTR("TEST"), MyReadProc, NULL, &destEndpoint); MIDIPortRef inPort; MIDIInputPortCreate(client, CFSTR("TEST"), MyReadProc, &outPort, &inPort); MIDIEndpointRef srcEndpoint; MIDISourceCreate(client, CFSTR("TEST"), &srcEndpoint); MIDIPortConnectSource(inPort, srcEndpoint, &destEndpoint); OK, I can create input MIDI port, connect it to source and receive events. But loopback means that if I send data to TEST out port (via out port, destination, source, MIDISend/Received, something else??), I want immediately receive that data from TEST in port. And I really don't understand how that loopback system should be built and how user will interact with it? So should be two ports in the system (or source and destination?). User somehow gets reference to out port (or source or destination?), sends data via it, and gets data back via reference to in port (or source or destination?). Seems like my head blows up.
Posted
by Max_Max.
Last updated
.
Post not yet marked as solved
0 Replies
1.9k Views
Is it possible to create virtual MIDI port via IAC driver programmatically? If IAC driver is turned off, the script must turn it on. I suppose it can be done somehow with AppleScript. Maybe there are other ways?
Posted
by Max_Max.
Last updated
.