sezo-audio-engine 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +51 -0
- package/android/build.gradle +44 -0
- package/android/cpp/CMakeLists.txt +23 -0
- package/android/cpp/NativeBridge.cpp +6 -0
- package/android/settings.gradle +12 -0
- package/android/src/main/java/expo/modules/audioengine/ExpoAudioEngineModule.kt +549 -0
- package/dist/AudioEngineModule.d.ts +2 -0
- package/dist/AudioEngineModule.js +46 -0
- package/dist/AudioEngineModule.types.d.ts +108 -0
- package/dist/AudioEngineModule.types.js +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/expo-module.config.json +9 -0
- package/ios/AudioEngine/AudioEngineConfig.swift +13 -0
- package/ios/AudioEngine/AudioSessionManager.swift +61 -0
- package/ios/AudioEngine/AudioTrack.swift +72 -0
- package/ios/AudioEngine/NativeAudioEngine.swift +1180 -0
- package/ios/ExpoAudioEngine.podspec +26 -0
- package/ios/ExpoAudioEngineModule.swift +156 -0
- package/package.json +60 -0
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
require 'json'
|
|
2
|
+
|
|
3
|
+
package = JSON.parse(File.read(File.join(__dir__, '..', 'package.json')))
|
|
4
|
+
|
|
5
|
+
Pod::Spec.new do |s|
|
|
6
|
+
s.name = 'ExpoAudioEngine'
|
|
7
|
+
s.version = package['version']
|
|
8
|
+
s.summary = package['description'] || 'Sezo Audio Engine Expo Module'
|
|
9
|
+
s.description = package['description'] || 'Sezo Audio Engine Expo Module'
|
|
10
|
+
s.license = { :type => 'MIT', :file => '../../../LICENSE' }
|
|
11
|
+
s.authors = 'Sezo'
|
|
12
|
+
s.homepage = package['homepage'] || 'https://sepzie.github.io/SezoAudioEngine/'
|
|
13
|
+
s.platforms = { :ios => '15.1' }
|
|
14
|
+
s.swift_version = '5.4'
|
|
15
|
+
s.source = { :git => 'https://github.com/sepzie/SezoAudioEngine.git' }
|
|
16
|
+
s.static_framework = true
|
|
17
|
+
|
|
18
|
+
s.dependency 'ExpoModulesCore'
|
|
19
|
+
|
|
20
|
+
# Swift/Objective-C compatibility
|
|
21
|
+
s.pod_target_xcconfig = {
|
|
22
|
+
'DEFINES_MODULE' => 'YES'
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
s.source_files = "**/*.{h,m,swift}"
|
|
26
|
+
end
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import ExpoModulesCore
|
|
2
|
+
|
|
3
|
+
public class ExpoAudioEngineModule: Module {
|
|
4
|
+
private let engine = NativeAudioEngine()
|
|
5
|
+
|
|
6
|
+
public func definition() -> ModuleDefinition {
|
|
7
|
+
Name("ExpoAudioEngineModule")
|
|
8
|
+
|
|
9
|
+
AsyncFunction("initialize") { (config: [String: Any]) in
|
|
10
|
+
engine.initialize(config: config)
|
|
11
|
+
}
|
|
12
|
+
AsyncFunction("release") {
|
|
13
|
+
engine.releaseResources()
|
|
14
|
+
}
|
|
15
|
+
AsyncFunction("loadTracks") { (tracks: [[String: Any]]) in
|
|
16
|
+
engine.loadTracks(tracks)
|
|
17
|
+
}
|
|
18
|
+
AsyncFunction("unloadTrack") { (trackId: String) in
|
|
19
|
+
engine.unloadTrack(trackId)
|
|
20
|
+
}
|
|
21
|
+
AsyncFunction("unloadAllTracks") {
|
|
22
|
+
engine.unloadAllTracks()
|
|
23
|
+
}
|
|
24
|
+
Function("getLoadedTracks") {
|
|
25
|
+
return engine.getLoadedTracks()
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
Function("play") {
|
|
29
|
+
engine.play()
|
|
30
|
+
}
|
|
31
|
+
Function("pause") {
|
|
32
|
+
engine.pause()
|
|
33
|
+
}
|
|
34
|
+
Function("stop") {
|
|
35
|
+
engine.stop()
|
|
36
|
+
}
|
|
37
|
+
Function("seek") { (positionMs: Double) in
|
|
38
|
+
engine.seek(positionMs: positionMs)
|
|
39
|
+
}
|
|
40
|
+
Function("isPlaying") {
|
|
41
|
+
return engine.isPlaying()
|
|
42
|
+
}
|
|
43
|
+
Function("getCurrentPosition") {
|
|
44
|
+
return engine.getCurrentPosition()
|
|
45
|
+
}
|
|
46
|
+
Function("getDuration") {
|
|
47
|
+
return engine.getDuration()
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
Function("setTrackVolume") { (trackId: String, volume: Double) in
|
|
51
|
+
engine.setTrackVolume(trackId: trackId, volume: volume)
|
|
52
|
+
}
|
|
53
|
+
Function("setTrackMuted") { (trackId: String, muted: Bool) in
|
|
54
|
+
engine.setTrackMuted(trackId: trackId, muted: muted)
|
|
55
|
+
}
|
|
56
|
+
Function("setTrackSolo") { (trackId: String, solo: Bool) in
|
|
57
|
+
engine.setTrackSolo(trackId: trackId, solo: solo)
|
|
58
|
+
}
|
|
59
|
+
Function("setTrackPan") { (trackId: String, pan: Double) in
|
|
60
|
+
engine.setTrackPan(trackId: trackId, pan: pan)
|
|
61
|
+
}
|
|
62
|
+
Function("setTrackPitch") { (trackId: String, semitones: Double) in
|
|
63
|
+
engine.setTrackPitch(trackId: trackId, semitones: semitones)
|
|
64
|
+
}
|
|
65
|
+
Function("getTrackPitch") { (trackId: String) in
|
|
66
|
+
return engine.getTrackPitch(trackId: trackId)
|
|
67
|
+
}
|
|
68
|
+
Function("setTrackSpeed") { (trackId: String, rate: Double) in
|
|
69
|
+
engine.setTrackSpeed(trackId: trackId, rate: rate)
|
|
70
|
+
}
|
|
71
|
+
Function("getTrackSpeed") { (trackId: String) in
|
|
72
|
+
return engine.getTrackSpeed(trackId: trackId)
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
Function("setMasterVolume") { (volume: Double) in
|
|
76
|
+
engine.setMasterVolume(volume)
|
|
77
|
+
}
|
|
78
|
+
Function("getMasterVolume") {
|
|
79
|
+
return engine.getMasterVolume()
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
Function("setPitch") { (semitones: Double) in
|
|
83
|
+
engine.setPitch(semitones)
|
|
84
|
+
}
|
|
85
|
+
Function("getPitch") {
|
|
86
|
+
return engine.getPitch()
|
|
87
|
+
}
|
|
88
|
+
Function("setSpeed") { (rate: Double) in
|
|
89
|
+
engine.setSpeed(rate)
|
|
90
|
+
}
|
|
91
|
+
Function("getSpeed") {
|
|
92
|
+
return engine.getSpeed()
|
|
93
|
+
}
|
|
94
|
+
Function("setTempoAndPitch") { (tempo: Double, pitch: Double) in
|
|
95
|
+
engine.setTempoAndPitch(tempo: tempo, pitch: pitch)
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
AsyncFunction("startRecording") { (config: [String: Any]?) in
|
|
99
|
+
engine.startRecording(config: config)
|
|
100
|
+
}
|
|
101
|
+
AsyncFunction("stopRecording") {
|
|
102
|
+
return engine.stopRecording()
|
|
103
|
+
}
|
|
104
|
+
Function("isRecording") {
|
|
105
|
+
return engine.isRecording()
|
|
106
|
+
}
|
|
107
|
+
Function("setRecordingVolume") { (volume: Double) in
|
|
108
|
+
engine.setRecordingVolume(volume)
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
AsyncFunction("extractTrack") { (trackId: String, config: [String: Any]?) in
|
|
112
|
+
return engine.extractTrack(trackId: trackId, config: config)
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
AsyncFunction("extractAllTracks") { (config: [String: Any]?) in
|
|
116
|
+
return engine.extractAllTracks(config: config)
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
Function("cancelExtraction") { (jobId: Double?) in
|
|
120
|
+
return engine.cancelExtraction(jobId: jobId)
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
Function("getInputLevel") {
|
|
124
|
+
return engine.getInputLevel()
|
|
125
|
+
}
|
|
126
|
+
Function("getOutputLevel") {
|
|
127
|
+
return engine.getOutputLevel()
|
|
128
|
+
}
|
|
129
|
+
Function("getTrackLevel") { (trackId: String) in
|
|
130
|
+
return engine.getTrackLevel(trackId: trackId)
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
AsyncFunction("enableBackgroundPlayback") { (metadata: [String: Any]) in
|
|
134
|
+
engine.enableBackgroundPlayback(metadata: metadata)
|
|
135
|
+
}
|
|
136
|
+
Function("updateNowPlayingInfo") { (metadata: [String: Any]) in
|
|
137
|
+
engine.updateNowPlayingInfo(metadata: metadata)
|
|
138
|
+
}
|
|
139
|
+
AsyncFunction("disableBackgroundPlayback") {
|
|
140
|
+
engine.disableBackgroundPlayback()
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
Events(
|
|
144
|
+
"playbackStateChange",
|
|
145
|
+
"positionUpdate",
|
|
146
|
+
"playbackComplete",
|
|
147
|
+
"trackLoaded",
|
|
148
|
+
"trackUnloaded",
|
|
149
|
+
"recordingStarted",
|
|
150
|
+
"recordingStopped",
|
|
151
|
+
"extractionProgress",
|
|
152
|
+
"extractionComplete",
|
|
153
|
+
"error"
|
|
154
|
+
)
|
|
155
|
+
}
|
|
156
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "sezo-audio-engine",
|
|
3
|
+
"version": "0.0.2",
|
|
4
|
+
"description": "Cross-platform Expo module for the Sezo Audio Engine with iOS implementation and background playback.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"author": "Sezo",
|
|
7
|
+
"homepage": "https://sepzie.github.io/SezoAudioEngine/expo/overview/",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "https://github.com/Sepzie/SezoAudioEngine.git",
|
|
11
|
+
"directory": "packages/expo-module"
|
|
12
|
+
},
|
|
13
|
+
"bugs": {
|
|
14
|
+
"url": "https://github.com/Sepzie/SezoAudioEngine/issues"
|
|
15
|
+
},
|
|
16
|
+
"keywords": [
|
|
17
|
+
"expo",
|
|
18
|
+
"react-native",
|
|
19
|
+
"audio",
|
|
20
|
+
"android",
|
|
21
|
+
"ios",
|
|
22
|
+
"multitrack",
|
|
23
|
+
"playback",
|
|
24
|
+
"recording",
|
|
25
|
+
"sezo"
|
|
26
|
+
],
|
|
27
|
+
"type": "module",
|
|
28
|
+
"main": "dist/index.js",
|
|
29
|
+
"types": "dist/index.d.ts",
|
|
30
|
+
"exports": {
|
|
31
|
+
".": {
|
|
32
|
+
"types": "./dist/index.d.ts",
|
|
33
|
+
"default": "./dist/index.js"
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
"files": [
|
|
37
|
+
"android/src",
|
|
38
|
+
"android/cpp",
|
|
39
|
+
"android/build.gradle",
|
|
40
|
+
"android/settings.gradle",
|
|
41
|
+
"ios",
|
|
42
|
+
"dist",
|
|
43
|
+
"expo-module.config.json",
|
|
44
|
+
"README.md",
|
|
45
|
+
"LICENSE"
|
|
46
|
+
],
|
|
47
|
+
"scripts": {
|
|
48
|
+
"build": "tsc -p tsconfig.json",
|
|
49
|
+
"clean": "rm -rf dist",
|
|
50
|
+
"test": "echo \"TODO: add tests\"",
|
|
51
|
+
"prepublishOnly": "npm run build"
|
|
52
|
+
},
|
|
53
|
+
"peerDependencies": {
|
|
54
|
+
"expo": ">=51.0.0 <54.0.0",
|
|
55
|
+
"react-native": ">=0.74.0"
|
|
56
|
+
},
|
|
57
|
+
"devDependencies": {
|
|
58
|
+
"typescript": "^5.4.5"
|
|
59
|
+
}
|
|
60
|
+
}
|