coremidi

Pass Pointer to First Packet Between Methods (Obj-C)

孤者浪人 提交于 2019-12-25 06:48:57
问题 I'm missing something here, but I'm not sure how to fix it. The first version of this works: - (void) sendBytes:(const UInt8*)bytes size:(UInt32)size { Byte packetBuffer[size+100]; MIDIPacketList *packetList = (MIDIPacketList*)packetBuffer; MIDIPacket *packet = MIDIPacketListInit(packetList); MIDIPacketListAdd(packetList, sizeof(packetBuffer), packet, 0, size, bytes); [self sendPacketList:packetList]; } For DRYness, I try to make a method out of the packet list creation: - (MIDIPacketList*)

Access self from a C style pointer [duplicate]

雨燕双飞 提交于 2019-12-24 07:03:22
问题 This question already has an answer here : Swift: Pass data to a closure that captures context (1 answer) Closed 2 years ago . I'm working on an application that utilises MIDI equipment. After some fooling around in a playground with CoreMIDI, I found how to get MIDI input signal, so I implemented this: func makeInputSource() { var midiClient : MIDIClientRef = 0 var inPort : MIDIPortRef = 0 MIDIClientCreate("WobClient" as CFString, nil, nil, &midiClient) MIDIInputPortCreate(midiClient,

iOS Simulator in Sierra - Studio Midi does not work

蓝咒 提交于 2019-12-23 03:28:06
问题 I am encountering very bad problem using Sierra + xcode 8 + iOS Simulator: I develop midi application, but now , when I start the iOS Simulator I get no midi-port available, I mean: Usualle using Studio Midi is possible to see the virtual iOS device, plus you can see se the session, typically named Session 1. being this is possible to re-route the MidiNetwork ( midi_driver ) to a physical port, but now, using Sierra the iOS Simulatore is not visible no longer, and I do not know ( and where to

MIDIClientCreate does not work for 32 bit processors in Swift

我与影子孤独终老i 提交于 2019-12-23 00:53:48
问题 I am able to create a midiclient via MIDIClientCreate when the scheme is a 64 bit processor (iPhone 5 and later). It does not work for 32 bit processors e.g. iPhone 4s. #if !arch(arm64) || !arch(x86_64) var status = OSStatus(noErr) var s:CFString = "MyClient" var client : Unmanaged<MIDIClient>? status = MIDIClientCreate(s, MIDINotifyProc( COpaquePointer( [ MyMIDINotifyProc ] ) ), nil, &client) if status == OSStatus(noErr) { if let c = client { var val = c.takeRetainedValue() Blammo. Bad

Using MIDIPacketList in swift

扶醉桌前 提交于 2019-12-22 05:23:37
问题 I am looking at some of the examples of midi output using core midi. Specifically this question and this I have code that works based on these in objC and I now want to try to translate that to swift. the line I least understand is this one: MIDIPacketList* pktList = (MIDIPacketList*) pktBuffer; I read this as declaring a pointer pktlist of type MIDIPacketList and assigning it the value of pktBuffer, cast to the type MIDIPacketList I'm new to C and objC and this makes no sense to me.

Initializing MIDIMetaEvent structure

≯℡__Kan透↙ 提交于 2019-12-21 02:45:12
问题 I am struggling to initialize the MIDIMetaEvent structure found in MusicPlayer.h with swift The header file defines the structure as follows: struct MIDIMetaEvent { var metaEventType: UInt8 var unused1: UInt8 var unused2: UInt8 var unused3: UInt8 var dataLength: UInt32 var data: (UInt8) } Which seems fairly straightforward up until that 'data' member. Is that a 1 element tuple definition? I can easily initialize all other struct elements but have tried in vain to set 'data' to anything else

How to use CoreMIDI on iOS?

情到浓时终转凉″ 提交于 2019-12-18 12:26:18
问题 I have been unable to find much information on CoreMIDI for iOS. Is it even possible to play a MIDI sound by sending a message to the device itself. Does the iPhone or iPad have a MIDI device installed or do you have to have a device connected to interface with? 回答1: You should give a look at pete goodliffe's blog and he generously provides an example project. It helped me a lot to start programming CoreMIDI. Now about your questions, on iOS, mostly CoreMIDI network sessions are used. The

Using Swift CFunctionPointer to pass a callback to CoreMIDI API

China☆狼群 提交于 2019-12-17 07:31:59
问题 It may be that this is actually not possible currently, which would be unfortunate. I'm trying to call the CoreMIDI API to set up a MIDI input. This is what I'm trying to do in Swift: var midiClient = MIDIClientRef() var inputPort = MIDIEndpointRef() var status: OSStatus func readProc(packetList: UnsafePointer<MIDIPacketList>, readProcRefCon: UnsafeMutablePointer<Void>, srcConnRefCon: UnsafeMutablePointer<Void>) -> Void { } status = MIDIClientCreate("MIDI client", nil, nil, &midiClient);

OSX Core MIDI- Calling MIDIPacketListAdd from NSTimer

岁酱吖の 提交于 2019-12-12 01:52:20
问题 I'm sending a string of MIDI packets using MIDIPacketListAdd. I want to change the packets dynamically during playback, so I'm using a NSTimer to add each packet before the scheduled time the packet should go out. The code works perfectly, the address of the current packet is updated correctly, I have verified that all the data is correct. However, no MIDI data is being sent when MIDIPacketListAdd is called from the timer. I add the first two packets before starting the timer to make sure

How do I define a MIDINotifyProc in Swift?

会有一股神秘感。 提交于 2019-12-11 07:11:00
问题 I'm trying to get MIDI sessions working with swift code and am running into issues with some of the delegates. This is a working example in Objective-C . OSStatus status = MIDIClientCreate(CFSTR("MIDI Client"), MIDIStateChangedHandler, nil, &client); void MIDIStateChangedHandler(const MIDINotification *message, void *refCon) { NSLog(@"MIDIStateChanged!"); } This is what I'm trying with Swift : var status = MIDIClientCreate("the client", notifyProc: MIDIStateChangedHandler, notifyRefCon: nil,