expo-juce 0.2.1 → 0.2.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/ios/ExpoJuceBridge.h +1 -1
- package/ios/ExpoJuceBridge.m +3 -2
- package/ios/ExpoJuceModule.swift +1 -1
- package/ios/JuceToneGenerator.mm +26 -4
- package/package.json +1 -1
package/ios/ExpoJuceBridge.h
CHANGED
package/ios/ExpoJuceBridge.m
CHANGED
|
@@ -3,8 +3,9 @@
|
|
|
3
3
|
|
|
4
4
|
@implementation ExpoJuceBridge
|
|
5
5
|
|
|
6
|
-
+ (void)
|
|
7
|
-
|
|
6
|
+
+ (void)setup {
|
|
7
|
+
// Access the singleton — audio engine is initialized in its -init
|
|
8
|
+
[JuceToneGenerator sharedInstance];
|
|
8
9
|
}
|
|
9
10
|
|
|
10
11
|
+ (void)shutdown {
|
package/ios/ExpoJuceModule.swift
CHANGED
package/ios/JuceToneGenerator.mm
CHANGED
|
@@ -136,19 +136,34 @@ private:
|
|
|
136
136
|
}
|
|
137
137
|
|
|
138
138
|
- (void)initialize {
|
|
139
|
+
if (self.audioEngine) {
|
|
140
|
+
NSLog(@"[ExpoJuce] Audio engine already initialized, skipping");
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
NSLog(@"[ExpoJuce] Initializing audio engine...");
|
|
139
145
|
NSError *error = nil;
|
|
140
146
|
|
|
141
147
|
AVAudioSession *audioSession = [AVAudioSession sharedInstance];
|
|
142
148
|
[audioSession setCategory:AVAudioSessionCategoryPlayback
|
|
143
149
|
withOptions:AVAudioSessionCategoryOptionMixWithOthers
|
|
144
150
|
error:&error];
|
|
145
|
-
if (error)
|
|
151
|
+
if (error) {
|
|
152
|
+
NSLog(@"[ExpoJuce] Error setting audio session category: %@", error);
|
|
153
|
+
error = nil;
|
|
154
|
+
}
|
|
146
155
|
|
|
147
156
|
[audioSession setPreferredIOBufferDuration:0.005 error:&error]; // 5ms
|
|
148
|
-
if (error)
|
|
157
|
+
if (error) {
|
|
158
|
+
NSLog(@"[ExpoJuce] Error setting buffer duration: %@", error);
|
|
159
|
+
error = nil;
|
|
160
|
+
}
|
|
149
161
|
|
|
150
162
|
[audioSession setActive:YES error:&error];
|
|
151
|
-
if (error)
|
|
163
|
+
if (error) {
|
|
164
|
+
NSLog(@"[ExpoJuce] Error activating audio session: %@", error);
|
|
165
|
+
error = nil;
|
|
166
|
+
}
|
|
152
167
|
|
|
153
168
|
self.audioEngine = [[AVAudioEngine alloc] init];
|
|
154
169
|
AVAudioFormat *format = [[AVAudioFormat alloc] initStandardFormatWithSampleRate:44100.0 channels:2];
|
|
@@ -174,7 +189,11 @@ private:
|
|
|
174
189
|
|
|
175
190
|
[self.audioEngine prepare];
|
|
176
191
|
[self.audioEngine startAndReturnError:&error];
|
|
177
|
-
if (error)
|
|
192
|
+
if (error) {
|
|
193
|
+
NSLog(@"[ExpoJuce] Error starting audio engine: %@", error);
|
|
194
|
+
} else {
|
|
195
|
+
NSLog(@"[ExpoJuce] Audio engine started successfully");
|
|
196
|
+
}
|
|
178
197
|
}
|
|
179
198
|
|
|
180
199
|
- (void)shutdown {
|
|
@@ -186,6 +205,7 @@ private:
|
|
|
186
205
|
}
|
|
187
206
|
|
|
188
207
|
- (void)playToneWithFrequency:(double)frequency duration:(double)duration {
|
|
208
|
+
NSLog(@"[ExpoJuce] playTone freq=%.1f dur=%.0f engine=%p running=%d", frequency, duration, self.engine, self.audioEngine.isRunning);
|
|
189
209
|
if (!self.engine) return;
|
|
190
210
|
|
|
191
211
|
self.engine->setFrequency(frequency);
|
|
@@ -229,10 +249,12 @@ private:
|
|
|
229
249
|
}
|
|
230
250
|
|
|
231
251
|
- (void)noteOn {
|
|
252
|
+
NSLog(@"[ExpoJuce] noteOn (engine=%p, audioEngine running=%d)", self.engine, self.audioEngine.isRunning);
|
|
232
253
|
if (self.engine) self.engine->noteOn();
|
|
233
254
|
}
|
|
234
255
|
|
|
235
256
|
- (void)noteOff {
|
|
257
|
+
NSLog(@"[ExpoJuce] noteOff");
|
|
236
258
|
if (self.engine) self.engine->noteOff();
|
|
237
259
|
}
|
|
238
260
|
|