I am porting an android music score application over to iOS, using swift and SwiftUI.
One of the elements of music notation is a glissando.
The form of this line can be seen here. - could not see how to add an image here.
When I draw the glissando in the android app, I can create a shape which represents a single "wave" of this line and then use it as a stamp which is repeated by the graphics system along the defined path, in this manner :
m_StampPath = new Path();
m_StampPath.moveTo(...);
m_StampPath.cubicTo(...);
m_StampPath.cubicTo(...);
...
m_StampPath.close();
m_WavyLine = new PathDashPathEffect(m_StampPath, fStampOffset, 0.0f, PathDashPathEffect.Style.MORPH);
// this is a Paint object
pt.setPathEffect(m_WavyLine);
pt.setStyle(Paint.Style.STROKE);
LinePath = new Path();
LinePath.moveTo(...);
LinePath.lineTo(...);
canvas.drawPath(LinePath, pt);
How can I achieve the same thing within swift, taking into account that the angle of the line is not always the same ?
Post
Replies
Boosts
Views
Activity
I have been asked to start using CoreML and convert our tensorflow ML model.
So I wanted to follow the quickstart example documentation to see how to do this.
Here are the steps I took :
- Installation steps :
1. install Conda package installer
- download Miniconda3 v3.9 package : https://repo.anaconda.com/miniconda/Miniconda3-py39_4.10.3-MacOSX-x86_64.pkg
- run the package installation
- create an environment shell : conda create --name coremltools-env
- creates in <user>/opt/miniconda3/envs/coremltools-env
- activate the environment : conda activate coremltools-env
- install pip for this environment : conda install pip
2. install CoreML tools in the conda environment
- pip install coremltools==5.0b5 (note this is a beta version, could not find the previous stable version)
3. install tensorflow within the conda environment
- pip install tensorflow
4. install h5py
- pip install h5py
- run the python script to load (from a distance) the tensorflow model and convert it to CoreML
I then run the python scripts as described in the documentation (except the test), and I get this error message :
RuntimeWarning: You will not be able to run predict() on this Core ML model. Underlying exception message was: Error compiling model: "Error reading protobuf spec. validator error: Model specification version field missing or corrupt.".
_warnings.warn(
Note - I have included all the text of the message.
Is this a problem with CoreML tools v5.0 beta 5 ?
Should I try a previous version of CoreML tools, if so, where can I find the correct version numbers ?
I am compiling our multiplatform c++ code for inclusion in apps on iOS.
When I run the build (through cmake with an appropriate ios toolchain), an error is reported saying it cannot find std::to_string
I have iOS sdk 14,2 installed with XCode 12.2
As this is a standard part of C++11 and my compile options indicate that I need this : -std=c++11 -stdlib=libc++, I expected no problems.
Is this missing from the apple c++11 implementation ?
Is there something I have missed ?
In my Obj-C wrapper object, I am wanting to surround some code with #define checking to be able to target specific targets - arm64 or Simulator.
It would appear that we can "create" custom defines in the project settings : Apple Clang - Preprocessing -> Preprocessor Macros
I have tried defining 'ARM64' under the section 'Debug' for 'Any IOS Sdk', presuming that this will be for a real iPad and thus an arm64 environment - as opposed to the simulator, an x86 environment.
I then put
#ifdef ARM64
...
#else
...
#endif
around my code, but the compiler is still complaining about 64bit calls.
Can this actually be done, as we are able to do from within swift ?
Am I going about this the right way ?
Hi,
I am creating an example app to demonstrate the integration of our text to speech (university research) C++ api.
This app is specifically for iOS using swift/swiftui.
The C++ api makes use of exceptions when things are not as it wants it - yep, it basically sits down and sulks !
At this stage, I cannot change that.
My research has done no more than confuse me as to if I can catch any C++ exception from within swift.
I am not interested in backtraces, just being able to access the reason for the exception (std::exception.what()).
Can this be done ?
If so, how, please ?
Hello,
I am building a sample/example iOS app with SwiftUI to demonstrate the integration of our text to speech library (university research team).
I have create a bridging header and added the line to import the .h file exposing the C type functions.
However, when I try the preview build, it falls over on the imported header.
At the top of the header is this :
#if defined(__APPLE__)
#define TTS_API extern "C" __attribute__((visibility("default")))
#else
#define TTS_API extern "C"
#endif
TTS_API void run_process(...)
The error message states :
Expected identifier or '('
At the beginning of the line holding the function definition (parameters removed for simplicity),with a reference to the macro expansion of TTS_API.
This macro (2nd line), however, is necessary for building the library for iOS.
What needs to be done in order to get the swift compiler to correctly handle this, please ?
Note that I am using XCode v12.2
We are in the process of developing our text to speech and speech analysis tools over to mobile platforms = cross platform development.
The tools are written in C++ and are compiled using CMake with an ios specific toolchain targetting the correct platform sdk.
One of the parts of this toolkit is the dynamic loading of language specific dylibs via dlopen.
I have seen that this can only be done if the dylib has been signed with the same certificate as the application.
Note that we are still using "free" developer certificates generated automatically by XCode.
When I run the test application, at the point where the dylib should be loaded via dlopen, the load fails and dlerror returns the following :
dlopen(&lt;path to dylib&gt;, 0x0001): code signature invalid (errno=1) sliceOffset=0x00000000, codeBlobOffset=0x0205D0F0, codeBlobSize=0x000453B0 for '&lt;path to dylib&gt;' However, when I check the code signature with :
codesign -d --verbose=2 --extract-certificates &lt;path&gt;
I get the same certificate output from both the application bundle and the dylib in question.
For example :
Identifier=libnormaliser_fr Format=Mach-O thin (arm64) CodeDirectory v=20400 size=265332 flags=0x0(none) hashes=8286+2 location=embedded Signature size=4755 Authority=Apple Development: &lt;our apple id&gt; Authority=Apple Worldwide Developer Relations Certification Authority Authority=Apple Root CA Signed Time=4 Jan 2021 at 09:27:14 Info.plist=not bound TeamIdentifier=&lt;our team id&gt; Sealed Resources=none Internal requirements count=1 size=192 Now, when I run the command :
codesign --verify --deep --verbose=2 it outputs :
./libxxx.dylib: valid on disk ./libxxx.dylib: satisfies its Designated Requirement I am testing on an iPad with iOS version 14.0.1, by the way.
So, something is still missing, but what ?
Can anyone help me with this please ?