Comments (6)
Thanks for the info. I used to handle this case.
I think that at one point, my code was similar to yours but eventually decided to drop the C dependency for easiness when I realized that I think that your case mostly likely wont actually happen.
The reason for that is that I dont think that people are sending anything but notes or other short messages with their keyboardds. No one actually uses the dynamically sized messages. They might do it in MIDI files but definitely not for midi recording.
Lemme know what you think.
from webmidikit.
Thanks for the reply.
I agree, most people would use it that way.
I stumbled into this pointer issue when I tried to read data out of MusicEventUserData delivered by a sequence callback. I could not find a decent way to get a pointer to the data field of UnsafePointer< MusicEventUserData >. The only thing that worked in swift was calculating the offset of the data field in the struct but that indeed looked very ugly.
Using a simple c-function to return the pointer from the struct seemed much safer to me.
So I am dependent on c anyway (like anybody using CoreMIDI). The only effort to use this function is to include a bridging header.
The same problem would apply when reading meta events or sysex data from a sequence.
The only thing that would matter to me in reading packet lists would be performance.
I don't think that a c-function call will cause much overhead. When using CoreMIDI in swift you call c-functions all the time.
from webmidikit.
It was not a performance decision. You can always get a UnsafePointer to the data, or use the Data (aka NSData) class.
The overhead was due to the package structure not performance. Including C in an SPM package is annoying. I used to have it but removed it.
from webmidikit.
Thank for your reply.
Your remark 'you can always get a UnsafePointer to the data' made me think about it again.
With a little effort and some awkward lookin swift expressions I managed to remove all c-functions.
from webmidikit.
Are you aware of the audiokit project? https://github.com/AudioKit/AudioKit/ I'll invite you to the slack group, you'll fit right in.
from webmidikit.
What's your email?
from webmidikit.
Related Issues (17)
- Can't use package with SPM HOT 8
- No events received if app goes to background
- Looking to use in iOS and starting with CoreAudio macOS migration HOT 4
- Capacitor Plugin HOT 1
- Removing a Midi Device produces a crash HOT 8
- EXC_BAD_ACCESS on Midi Read HOT 18
- Failed to Run the Simplest Demo
- Swift package - missing manifest specification HOT 5
- WebMidi API
- When an Endpoint is gone you can't ask for kMIDIPropertyUniqueID, it is gone HOT 5
- this line is useless and worse it enforces crashing
- onMessageReceived seems to "leak/grow" MidiBuffer or never empties. HOT 1
- All messages are the same HOT 3
- Delete this repo HOT 3
- Not registering?
- Remove assertion for disconnect HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from webmidikit.