CoreMIDI app not showing in other software - swift

I am playing around a bit with CoreMIDI in Swift on OSX, and got most of the things to work properly.
The only issue I have now is that my app is not seen by other software and apps and an available input/output. This is the case for in GarageBand, MIDIMonitor and the VVMidi test apps.
I tried multiple things, including this which seems to be the correct approach :
let clientCreateResult = MIDIClientCreate("MIDIApp", { (notification, _) -> Void in
print("Configuration Changed")
}, nil, &midiClient)
if (clientCreateResult != noErr) {
printError(clientCreateResult)
return;
}
let inputCreateResult = MIDIInputPortCreateWithBlock(midiClient, "MIDIApp In", &inputPort, MyMIDIReadBlock)
if (inputCreateResult != noErr) {
printError(inputCreateResult)
return;
}
let outputCreateResult = MIDIOutputPortCreate(midiClient, "MIDIAPP Out", &outputPort)
if (outputCreateResult != noErr) {
printError(inputCreateResult)
return;
}
Sadly no luck. I'm not sure what I'm doing wrong, I tried reproducing the exact same code as existing frameworks with no significant result.
I could really use some pointers as of why my app isn't listed in other ones.
Thanks!

Create a virtual destination. See the docs for MIDIDestinationCreateWithBlock

Related

Shortcut/Action on Siri Watch Face with independent WatchOS app

I'm relatively new to making apps, and even newer to independent watch apps. As training, I'm making a watch app that I can use to log my water intake throughout the day. I've created a new intent definition file (see image 1) on which I've checked the marks for all the target memberships (the app, the WatchKit app, and the WatchKit extension). Furthermore, the target membership class is a public intent for the WatchKit extension.
When logging my water I execute the following code:
let intent = INManager.intent(drink: item)
INManager.donateShortcuts(withIntent: intent)
and my IntentManager looks like this:
import Foundation
import Intents
class IntentManager {
func intent(drink: Drink) -> LogDrinkIntent {
let intent = LogDrinkIntent()
intent.uuid = drink.id.uuidString
intent.name = drink.name
intent.emoji = drink.emoji
return intent
}
func donateShortcuts(withIntent intent:INIntent) {
var relevantShortcuts: [INRelevantShortcut] = []
if let relevantShortcut = defaultRelevantShortcut(withIntent: intent) {
relevantShortcuts.append(relevantShortcut)
}
INRelevantShortcutStore.default.setRelevantShortcuts(relevantShortcuts) { (error) in
if let error = error {
print("Failed to set relevant shortcuts: \(error))")
} else {
print("Relevant shortcuts set.")
}
}
}
private func defaultRelevantShortcut(withIntent intent: INIntent) -> INRelevantShortcut? {
if let shortcut = INShortcut(intent: intent) {
let relevantShortcut = INRelevantShortcut(shortcut: shortcut)
relevantShortcut.shortcutRole = .action
let template = INDefaultCardTemplate(title: "Log Drink")
relevantShortcut.watchTemplate = template
print("Returning relevant shortcut.")
return relevantShortcut
}
return nil
}
}
When logging a drink the confirmation Returning relevant shortcut. and Relevant shortcuts set. are printed. However, the Siri watch face doesn't update to include a link to my action. I got the code for the IntentManager from this Medium article.
I really appreciate your time and help. I've had a hard time trying to find any details about this functionality and Apple's documentation is imo inferior. Thank you! If you need more details or such, feel free to ask.
Image 1
Let's saddle the horse from behind: Generally speaking, you want to make use of Soup Chef. Now you can categorize Siri suggestions into two sub-groups, being donated shortcuts and relevant shortcuts.
In your specific example of a "water intake" logging app, you should work with donating the INIntent to INIteraction. The reason for that is quite simple: Your suggestion is due to an action a user has committed within your application, not based upon plainly relevance, thus your passage about INRelevantShortcutStore isn't necessary and/or should be replaced with INInteraction.
To re-phrase myself: The issue is that you parse INRelevantShortcutStore as a donation, see here:
func donateShortcuts(withIntent intent:INIntent) {
var relevantShortcuts: [INRelevantShortcut] = []
if let relevantShortcut = defaultRelevantShortcut(withIntent: intent) {
relevantShortcuts.append(relevantShortcut)
}
INRelevantShortcutStore.default.setRelevantShortcuts(relevantShortcuts) { (error) in
if let error = error {
print("Failed to set relevant shortcuts: \(error))")
} else {
print("Relevant shortcuts set.")
}
}
}
... as explained above, that is not the correct usage for INIntent in your specific example.
I highly suggest to read through Soup Chef in general as well as specifically donating shortcuts to Siri (what you want to do!). The documentation is very detailed and explanative!

TWTRComposer() Application crashes when I try to open Composer

I am having an issue with TWTRComposer. I installed TwitterKit using pods followed all other instructions i.e. updated info.Plist , AppDelegate and so on. I am using Swift. When I call the func that handles the code the app crashes here, sample code below. On the line where composer.show(from: self.navigationController!) the error message is Thread 1:EXC_BREAKPOINT(code=1, subcode=0x1024ff1ac) I have no clue what this means. Any explanation and help is appreciated.
let composer = TWTRComposer()
composer.setText("just setting up my Twitter Kit")
composer.setImage(UIImage(named: "twitterkit"))
// Called from a UIViewController
composer.show(from: self.navigationController!) { (result) in
if (result == .done) {
print("Successfully composed Tweet")
} else {
print("Cancelled composing")
}
}

Getting some chinese characters when trying to access google play username with Unity3D

I'm getting some chinese characters when trying to access google play username with Unity3D:
void Start () {
PlayGamesPlatform.Activate();
// Social.localUser.Authenticate(ProcessAuthentication);
PlayGamesPlatform.DebugLogEnabled = true;
Social.localUser.Authenticate(success => {
if (success)
{
Debug.Log("Authentication successful");
userInfo = Social.localUser.userName ;
Debug.Log(userInfo);
}
else
Debug.Log("Authentication failed");
});
}
void Update () {
txt = GameObject.Find("txt").GetComponent<Text>();
txt.text = userInfo;
}
}
I have checked if user is really authenticated with google play, and he is. I'm getting this error on my mobile phone (Samsung S6).
Any ideas how to solve this?
I had the same problem, solved by updating google play games plugin
I was having the same problem as well with the 0.9.38 version of GPGS. They committed a fix 2 days ago (v0.9.38a) that appears to have fixed the issue. From the commit log:
Fixing string marshaling from C to C#.
Make sure you follow the upgrade instructions when upgrading.

Chartboost with Swift - Interstitial: prefetch if NOT complete. wait... but no ad?

I am trying to integrate Chartboost ads in Swift into my project and have followed the tutorial verbatim:
https://answers.chartboost.com/hc/en-us/articles/205853276
Everything is imported and in App delegate I have:
Chartboost.startWithAppId(//stuff)
Chartboost.setShouldRequestInterstitialsInFirstSession(false)
Chartboost.cacheMoreApps(CBLocationHomeScreen)
//Chartboost
class func showChartboostAds()
{
Chartboost.showInterstitial(CBLocationHomeScreen);
}
func didFailToLoadInterstitial(location :String!, withError error: CBLoadError)
{
}
func didDismissInterstitial(location :String! )
{
if(location == CBLocationHomeScreen)
{
Chartboost.cacheInterstitial(CBLocationMainMenu)
}
else if(location == CBLocationMainMenu)
{
Chartboost.cacheInterstitial(CBLocationGameOver)
}
else if(location == CBLocationGameOver)
{
Chartboost.cacheInterstitial(CBLocationLevelComplete)
}
else if(location == CBLocationLevelComplete)
{
Chartboost.cacheInterstitial(CBLocationHomeScreen)
}
}
Then in my main view controlleR:
AppDelegate.showChartboostAds()
I have my app in test mode in the dashboard and am running on a real device but I just get Interstitial: prefetch if NOT complete. wait... in the console.
Why won't it show any ads?
Just an aside, the reason this solution works is because of the prefetch method. It seems when you call the ad the Chartboost prefetch isn't completing on time, which is causing the show call to fail.
Chartboost does have a delegate method that will give you the all-clear when prefetch completes, that may be worth a look: - (void)didPrefetchVideos;
Here's a link to the rest of the page.
Hope this helps.
I think you're trying to show the AD to quickly. Try delaying the AD, that solved it for me.

DigitalDJ / AudioStreamer not connect to streaming server

I downloaded the code DigitalDJ / AudioStreamer to use in a player I'm doing, here's the project that I downloaded: https://github.com/DigitalDJ/AudioStreamer
Have used this library before I decided to upgrade it supports multi-thread,
but when I change the address of the streaming server http:// thor.nickpack.com:9000 to the address of my server, it does not run the audio.
to replace the server path that is in a TextField in viewController to my path: http:// 184.154.37.132:7075 see my problem.
Another solution would be to modify the old player that supports multi thread, I've tried several codes and could not, that was when I found the DigitalDJ / AudioStreamer, but I came across the problem I mentioned above,
this is the link for a sample app that does not have multi thread: http://www.mediafire.com/?eb7a6a87e8tqcbc
if someone has a clue how to implement audio in backgorund or how to solve the problem of streaming server I am grateful.
after a long time and almost going crazy trying to solved the problem by commenting the code in this trexo AudioStreamer.m
// hintForMIMEType
//
// Make a more informed guess on the file type based on the MIME type
//
// Parameters:
// mimeType - the MIME type
//
// returns a file type hint that can be passed to the AudioFileStream
//
/*
+ (AudioFileTypeID)hintForMIMEType:(NSString *)mimeType
{
AudioFileTypeID fileTypeHint = kAudioFileMP3Type;
if ([mimeType isEqual:#"audio/mpeg"])
{
fileTypeHint = kAudioFileMP3Type;
}
else if ([mimeType isEqual:#"audio/x-wav"])
{
fileTypeHint = kAudioFileWAVEType;
}
else if ([mimeType isEqual:#"audio/x-aiff"])
{
fileTypeHint = kAudioFileAIFFType;
}
else if ([mimeType isEqual:#"audio/x-m4a"])
{
fileTypeHint = kAudioFileM4AType;
}
else if ([mimeType isEqual:#"audio/mp4"])
{
fileTypeHint = kAudioFileMPEG4Type;
}
else if ([mimeType isEqual:#"audio/x-caf"])
{
fileTypeHint = kAudioFileCAFType;
}
else if ([mimeType isEqual:#"audio/aac"] || [mimeType isEqual:#"audio/aacp"])
{
fileTypeHint = kAudioFileAAC_ADTSType;
}
return fileTypeHint;
}*/
with this code commented out the audio played without problems on my server
I had problems connecting to MP3 stream with AudioStreamer. The sample would work on Simulator but not on device. I think because simulator isnt exact copy of ios device. On Simulator it uses the quicktime installed on the mac.
For local MP3 files use AVAudioPlayer.
For remote MP3 streams Use AVPlayer.
A good sample project is at
https://github.com/valvoline/CPStreamPlayer
Often remote streams take time to connect to time out. This sample shows that its buffering.
Search Github for AVPlayer theres a few samples.
CPStreamPlayer/AVPlayer supports redirects so for us we had
http://stream.fireplayer.com/greyhound/dyn?action=stream.StreamMix&id=1785
BUT THIS REDIRECTED TO GENERATE Mp3 file/stream on Amazon
http://s3.amazonaws.com/fireplayer_mp3/1785.mp3?AWSAccessKeyId=AKIAJAHV5HUV4TVRF5VA&Expires=1337595252&Signature=c%2FH%2FO9AACkovm%2BAhbWyD7E9Hb6A%3D";