-
Notifications
You must be signed in to change notification settings - Fork 68
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add out of band audio support ios - abstracted audio!
Follow up to #7048! I nuked the custom defines and the miniaudio include. I think this fixes the need for miniaudio and the custom defines @mjtalbot! Give it a shot 🔫 Diffs= 89053041a add out of band audio support ios - abstracted audio! (#7079) Co-authored-by: Luigi Rosso <[email protected]> Co-authored-by: Maxwell Talbot <[email protected]>
- Loading branch information
1 parent
2248645
commit 216240b
Showing
25 changed files
with
321 additions
and
15 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
99d28e1ac65672076b08f3a044218ec60268c4ae | ||
89053041aea1e6c8559afc4273c4e466e9ff547a |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
4bdc4c4f5e53d18678bd985df4371b4c3370add3 | ||
938f5040166c949ae45d991b837b46eab3137ead |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains 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
25 changes: 25 additions & 0 deletions
25
Example-iOS/Source/Examples/SwiftUI/SwiftAudioAssets.swift
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// | ||
// SwiftAudioAssets.swift | ||
// RiveExample | ||
// | ||
// Created by Maxwell Talbot on 11/04/2024. | ||
// Copyright © 2024 Rive. All rights reserved. | ||
// | ||
|
||
import Foundation | ||
|
||
import SwiftUI | ||
import RiveRuntime | ||
|
||
struct SwiftAudioAssets: DismissableView { | ||
var dismiss: () -> Void = {} | ||
@StateObject private var riveViewModel = RiveViewModel( | ||
fileName: "lip-sync_test", | ||
stateMachineName: "State Machine 1", | ||
artboardName: "Lip_sync_2" | ||
); | ||
|
||
var body: some View { | ||
riveViewModel.view() | ||
} | ||
} |
47 changes: 47 additions & 0 deletions
47
Example-iOS/Source/Examples/SwiftUI/SwiftOutOfBandAudioAssets.swift
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
// | ||
// SwiftAudioAssets.swift | ||
// RiveExample | ||
// | ||
// Created by Maxwell Talbot on 11/04/2024. | ||
// Copyright © 2024 Rive. All rights reserved. | ||
// | ||
|
||
import Foundation | ||
|
||
|
||
import SwiftUI | ||
import RiveRuntime | ||
|
||
struct SwiftOutOfBandAudioAssets: DismissableView { | ||
var dismiss: () -> Void = {} | ||
@StateObject private var riveViewModel = RiveViewModel( | ||
fileName: "ping_pong_audio_demo", | ||
stateMachineName: "State Machine 1", | ||
autoPlay: true, | ||
loadCdn: false, | ||
customLoader: { (asset: RiveFileAsset, data: Data, factory: RiveFactory) -> Bool in | ||
|
||
if (asset is RiveAudioAsset){ | ||
guard let url = (.main as Bundle).url(forResource: asset.uniqueName(), withExtension: asset.fileExtension()) else { | ||
fatalError("Failed to load asset \(asset.uniqueFilename()) from bundle.") | ||
} | ||
guard let data = try? Data(contentsOf: url) else { | ||
fatalError("Failed to load \(url) from bundle.") | ||
} | ||
|
||
(asset as! RiveAudioAsset).audio( | ||
factory.decodeAudio(data) | ||
) | ||
return true; | ||
|
||
} | ||
// | ||
return true; | ||
} | ||
); | ||
|
||
var body: some View { | ||
|
||
riveViewModel.view() | ||
} | ||
} |
This file contains 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
This file contains 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
Oops, something went wrong.