This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import AVFoundation | |
import PlaygroundSupport | |
PlaygroundPage.current.needsIndefiniteExecution = true | |
class AudioPlayer { | |
var topAudioFiles: [AVAudioFile] = [] | |
var engine:AVAudioEngine | |
var topAudioAudioNodes = [AVAudioPlayerNode]() | |
var mixer: AVAudioMixerNode |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import AVFoundation | |
class AudioPlayer: NSObject { | |
private let engine = AVAudioEngine() | |
private let playerNode = AVAudioPlayerNode() | |
private var file: AVAudioFile! | |
private var isPlaying = false | |
private let audioPlayerQueue = DispatchQueue(label: "AudioPlayerQueue") | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Cocoa | |
class ViewController: NSViewController { | |
private var audioPlayer: AudioPlayer! | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
guard let url = Bundle.main.url(forResource: "z", withExtension: "wav") else { | |
fatalError("can't create url from resource") | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//TestsFrameworkSwift.swift | |
import Foundation | |
public class TestsFrameworkSwift { | |
public init () { } | |
public func fromTestFrameworkSwift()-> String { | |
let testFrameworkObjc = TestFrameworkObjc() | |
return testFrameworkObjc.fromTestFrameworkObjc() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//TestFrameworkObjc.h | |
#import <Foundation/Foundation.h> | |
NS_ASSUME_NONNULL_BEGIN | |
@interface TestFrameworkObjc : NSObject | |
- (NSString *) fromTestFrameworkObjc; | |
@end | |
NS_ASSUME_NONNULL_END |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//TestFrameworkObjc.m | |
#import "TestFrameworkObjc.h" | |
@implementation TestFrameworkObjc | |
- (NSString *) fromTestFrameworkObjc{ | |
return @"fromTestFrameworkObjc with love"; | |
} | |
@end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//TestFramework.h | |
#import <Cocoa/Cocoa.h> | |
//! Project version number for TestFramework. | |
FOUNDATION_EXPORT double TestFrameworkVersionNumber; | |
//! Project version string for TestFramework. | |
FOUNDATION_EXPORT const unsigned char TestFrameworkVersionString[]; | |
#import <TestFramework/TestFrameworkObjc.h> // TestFrameworkObjc.h needs to be public! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ViewController.swift | |
import Cocoa | |
import TestFramework | |
class ViewController: NSViewController { | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
let testFrameworkSwift = TestsFrameworkSwift() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//AUFramework.h | |
#import <Cocoa/Cocoa.h> | |
FOUNDATION_EXPORT double AUFrameworkVersionNumber; | |
FOUNDATION_EXPORT const unsigned char AUFrameworkVersionString[]; | |
#import <AUFramework/VolumePluginAudioUnit.h> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<dict> | |
<key>NSExtensionAttributes</key> | |
<dict> | |
<key>AudioComponentBundle</key> // key required to load audio unit in-process | |
<string>co.borama.AUFramework</string> // framework bundle identifier | |
<key>AudioComponents</key> | |
<array> | |
<dict> | |
<key>description</key> | |
<string>VolumePlugin</string> |