coremidi

passing a bytearray as a parameter of a method (CoreMIDI implementation)

谁说胖子不能爱 提交于 2019-12-11 06:46:28
问题 I'm trying to create a method that outputs MIDI information to a virtual client using CoreMIDI. The "action" method is MIDIReceived, which sends midi data in the form of MIDI packets to a virtual client. Below, I've created a method that accepts a MIDI byte as a parameter, which the method should add to a MIDI Packet List which is then sent to a virtual client with MIDIReceived. It doesn't work. I've tested this code without trying to use a custom method-- that is, manually inputing midi byte

Best strategy to handle incoming midi signal from MIDIReadProc in cocoa

限于喜欢 提交于 2019-12-11 02:45:07
问题 I have to move some NSSlider by hardware midi controller, I have programmed a midi learn procedure to assign hardware cursor to NSSlider (sub class of), and up there it's all right. Inside MIDIReadProc , I handle moving NSSlider wich depends from incoming control and value, but now when I move hardware cursor, Sliders can be move one for time, it is like moving cursor stop the others. My question is, what is best strategy to handle cursor moving concurrently ? 1 . Should I have to handle with

MIDI MusicDevice AudioUnit: Playing two notes of same pitch, stop one?

心不动则不痛 提交于 2019-12-10 17:38:40
问题 I am quite a novice when it comes to AudioUnits, so please forgive me if my question is very basic. I am using the MusicDevice AudioUnit to playback some notes. I am using MusicDeviceMIDIEvent to send the note-on and note-off messages. It works well. Sometimes more than one note should sound simultaneously, so I may send two note-on messages in a row. Sometimes these notes happen to have the same pitch. Then when I want to turn off one of the notes, I send a note-off event for this pitch. But

MIDIClientCreate does not work for 32 bit processors in Swift

只愿长相守 提交于 2019-12-08 18:36:25
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 access exception on takeRetainedValue. As you see, the status is OK, and I'm unwrapping the optional. Do you

Delta calculation between MIDIPackets do not seem to be right

ⅰ亾dé卋堺 提交于 2019-12-08 15:54:32
I am trying to read a midi file, and play all the midi events with a synthesizer. The way the synth works is, it has a circular buffer which you write midi data to, and then call GenerateSamples() on it, and it will process that midi data, and give you back the number of samples you want. I'm using AudioToolbox's music player, and have setup a MidiReadProc where I write those midi packets to a buffer, and then have a separate thread polling that buffer, and writing the data to the ring buffer, and generating the appropriate number of samples. I'm taking the delta of the timestamp of the

Optional Framework Not Working (CoreAudioKit not on Simulator)

若如初见. 提交于 2019-12-07 01:42:40
问题 To get MIDI over Bluetooth working, I need to use the CoreAudioKit framework. This works perfectly, but I am not able to compile on the simulator. Making the framework "optional" doesn't help, error is ld: framework not found CoreAudioKit I think it should work according to the docs Deleting the framework allows my code to compile I've got this in code, which is why I can delete the framework without issues. #if !TARGET_IPHONE_SIMULATOR #import <CoreAudioKit/CoreAudioKit.h> #endif How can I

CoreMIDI: rock solid midi sync

社会主义新天地 提交于 2019-12-06 13:38:41
问题 I'm having troubles with midi synchronization. Following posts in the syntheticbits.com, I use a PGMidi class. Sync works, but is constantly shifting to 1-2 bpm. Here is the code that I use: - (void)sendMidiClockInMidiThread { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; [lock lock]; const int64_t kOneMillion = 1000 * 1000; const UInt8 tick[] = { 0xF8 }; // Calculate tick time // returns sample for sixteen note (5512 if current bpm is 120) SInt32 sixteen = AGGetSamples

CoreMIDI/PGMidi Virtual midi error in iOS6

社会主义新天地 提交于 2019-12-05 17:16:00
问题 Faced with two errors. This code worked in iOS 4 and 5, but after update to 6, it is not working ( I found following, but don't know how to fix it in the code. Beginning in iOS 6, apps need to have the audio key in their UIBackgroundModes in order to use CoreMIDI’s MIDISourceCreate and MIDIDestinationCreate functions. Without the key set, these functions will return kMIDINotPermitted (-10844). 2012-09-23 03:40:04.773 MidiStudio[1017:907] Error (Create MIDI virtual source): -10844:Error Domain

Optional Framework Not Working (CoreAudioKit not on Simulator)

感情迁移 提交于 2019-12-05 05:27:45
To get MIDI over Bluetooth working, I need to use the CoreAudioKit framework. This works perfectly, but I am not able to compile on the simulator. Making the framework "optional" doesn't help, error is ld: framework not found CoreAudioKit I think it should work according to the docs Deleting the framework allows my code to compile I've got this in code, which is why I can delete the framework without issues. #if !TARGET_IPHONE_SIMULATOR #import <CoreAudioKit/CoreAudioKit.h> #endif How can I get this optional compilation to work? Nate I actually would have thought that would work, but I think

Initializing MIDIMetaEvent structure

感情迁移 提交于 2019-12-03 08:18:23
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 than a single value. In my code I used an UInt8 array called myData and attempted to init the structure