Post

Replies

Boosts

Views

Activity

CoreMIDI The simplest MIDI output function
I am trying to implement what should be the simplest MIDI function of all for an iOS app but getting my head around the CoreMIDI framework is painful and I'm a bit of a newbie coder...I just want to send a MIDI note or simple sequence of notes out of my iPhone via a MIDI Interface (iRig2) to my old synthesizer.so for now a simple function that will run when I press a button and send the MIDI packet to a MIDI port of my choosing with the basic Note On Note Off.This is part of a more complex app I'm developing and now I'm at the MIDI implementation part I've hit a wall. Not much out there in tutorial form to explain MIDI in Swift. And most dont seem interested in sending MIDI data out to external hardwareHelp much appreciated!
1
0
965
Dec ’19
Audio Unit v3 Setup
I have just begun to start building plugins for Logic using the AUv3 format. After a few teething problems to say the least I have a basic plug in working (integrated with SwiftUI which is handy) but the install and validation process is still buggy and bugging me! Does the stand alone app which Xcode generates to create the plugin have to always be running separately to Logic for the AUv3 to be available? Is there no way to have it as a permanently available plugin without running that? If anyone has any links to a decent tutorial please.. there are very few I can find on YouTube or anywhere else and the Apple tutorials and examples aren't great.
2
0
1.4k
Aug ’21
present SwiftUI view from SpriteKit scene
Is it possible to present a SwiftUI view from a SpriteKit scene? I have various sprites in the game scene. I want a SwiftUI view to pop up when I tap on a SpriteNode in the SKScene. In the past I have used something like this to present another UI view. if bloqsLogo.contains(location) { if instructionsOn == false { let pop = InstructionsPopUp() pop.tag = 104 self.view?.addSubview(pop) instructionsOn = true } else if instructionsOn == true { if let viewWithTag = self.view!.viewWithTag(104) { viewWithTag.removeFromSuperview() instructionsOn = false }else{ print("nah") } } } How can I do something similar but present a SwiftUI scene rather than a Subview or a UIView? My SKScene is an instance of another SwiftUI view and presented there. A good part of my GUI is done in SwiftUI. I am basically wanting to code as much of my App as I can in SwiftUI while keeping the physics and sprites in a SKScene. All of which is going rather well besides this!
0
0
966
Oct ’21
Submit for review - AudioKit branch?
I have my first App ready and crash free (I think!) using AudioKit. While coding it I used the develop branch. I assume I should submit it with the main branch packages? Trouble is I updated my iPad to iOS15 (yesterday) so then had to move onto Xcode 13 and ended up have a lot of broken AudioKit code with the main branch of AudioKit. As well as a couple of issues with the develop branch - which I managed to fix. This is my first App submission so I'd like to get it right - excuse my newbie idiocy. Seems like it may have been a bad idea moving to iOS15 & Xcode 13 right now. Should I go back to 12? Main question though is what 3rd party framework branches should be used in a final App release?
0
0
474
Sep ’21
Fixed landscape mode with SwiftUI and Spritekit Scene
I have a pretty standard Spritekit Scene that loads from a SwiftUI view. All settings are set to landscape only. Scene dimensions are correct. How can I stop the GameScene from rotating when I go into portrait mode? I didn't have this issue when using regular Swift before. Is this a SwiftUI issue? Also I have managed to get my Preview window to be in Landscape but when I run Live Preview it returns to portrait. This is my ContentView code with the SKScene. struct ContentView: View {          var scene: SKScene {         let scene = GameScene()         scene.size = CGSize(width: 1080, height: 800)         scene.scaleMode = .fill         scene.backgroundColor = .black                  return scene     }          var body: some View {         SpriteView(scene: scene)             .frame(width: 1080, height: 800, alignment: .center)                  }      } struct ContentView_Previews: PreviewProvider {     static var previews: some View {         ContentView()             .previewDevice("iPad (8th generation)")             .previewLayout(.fixed(width: 1080, height: 800))                                        } }
0
0
589
Sep ’21
AUv3 with SwiftUI and Spritekit crash
I have the bare bones of an AUv3 plug in. I have used UIHostingController to allow me to add a SwiftUI view. Then from the SwiftUI I have added a SprikeKit scene which I want to use to start building an interface for the AU. It's a very basic GameScene for now. If I run one instance of it in Logic then it's OK. If I add another instance it crashes with a Thread 1: EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0) error. This seems to be down to how I declare a SpriteNode variable. If I declare it within the GameScene as a "let" then it's fine. If I declare it outside the class - (see hashed code) then it will crash with two instances. It would be useful to me later on for this to be a public variable as I want to perform functions on it outside of the class. Is there a better way to declare the SpriteNode variable to make it stable? import SpriteKit //public var ball = SKShapeNode(circleOfRadius: 30) var ball = SKShapeNode(circleOfRadius: 30) class GameScene: SKScene {         let ball = SKShapeNode(circleOfRadius: 30)     override func didMove(to view: SKView) {            //physicsBody = SKPhysicsBody(edgeLoopFrom: frame)         ball.position = CGPoint(x: 200, y: 200)         ball.fillColor = .lightGray         self.addChild(ball)          }
0
0
574
Sep ’21
SKScene using full resolution of iPad in SwiftUI
Coming back to coding after a break I am now trying to use SpriteKit within SwiftUI I would like to use the full resolution of the iPad (2160 x 1620) for my Game Scene however the code I have renders the scene beyond the bounds of the screen. It's not scaled properly I suppose is what I mean. It seems the display is still in the 1024x768 size and my scene is rendering beyond the viewable area. Sorry if I am over explaining things here! This is the code in my ContentView         let screenSize: CGRect = UIScreen.main.nativeBounds         let screenWidth = screenSize.width         let screenHeight = screenSize.height         print("Screen width = \(screenWidth), screen height = \(screenHeight)")         let scene = GameScene()         scene.size = CGSize(width: screenWidth, height: screenHeight)         scene.scaleMode = .aspectFit                  return scene     }     var body: some View {         let screenSize: CGRect = UIScreen.main.nativeBounds         let screenWidth = screenSize.width         let screenHeight = screenSize.height         SpriteView(scene: scene)             .frame(width: screenWidth, height: screenHeight)                                                              }
0
0
531
Aug ’21
Physics world slows. Not perfect restitution
For some reason my SpriteKit physics world has now stopped giving perfect bounce.Was not having this issue prevouslyBuilding simple sprite set up from bare bones programatically I am not getting prefect restututionif I build sprites using the SKS then no problem but building up from plain code I need to set the restitution to about 1.3 to get closeSo where can I be loosing enerygy? Have tweaked with literally every value
2
0
724
Dec ’19