react-native-simple-note-pitch-detector 0.7.4 → 0.7.5
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.
|
@@ -25,11 +25,13 @@ public class ReactNativeSimpleNotePitchDetectorModule: Module {
|
|
|
25
25
|
do {
|
|
26
26
|
try session.setCategory(
|
|
27
27
|
.playAndRecord,
|
|
28
|
-
mode: .measurement,
|
|
29
28
|
options: [.defaultToSpeaker, .allowBluetooth]
|
|
30
29
|
)
|
|
31
30
|
try session.setActive(true, options: .notifyOthersOnDeactivation)
|
|
32
|
-
self.sendStatus(
|
|
31
|
+
self.sendStatus(
|
|
32
|
+
"debug",
|
|
33
|
+
"AVAudioSession configured: category=playAndRecord, sampleRate=\(session.sampleRate), inputChannels=\(session.inputNumberOfChannels), inputAvailable=\(session.isInputAvailable)"
|
|
34
|
+
)
|
|
33
35
|
} catch {
|
|
34
36
|
self.sendStatus("error", "Failed to configure AVAudioSession: \(error.localizedDescription)")
|
|
35
37
|
}
|
|
@@ -179,7 +181,12 @@ extension ReactNativeSimpleNotePitchDetectorModule: PitchEngineDelegate {
|
|
|
179
181
|
self.sendStatus("error", "PitchEngine error: \(error.localizedDescription)")
|
|
180
182
|
}
|
|
181
183
|
|
|
184
|
+
private var belowThresholdLogged = false
|
|
182
185
|
public func pitchEngineWentBelowLevelThreshold(_ pitchEngine: PitchEngine) {
|
|
183
|
-
//
|
|
186
|
+
// Log once per session to avoid spamming
|
|
187
|
+
if !belowThresholdLogged {
|
|
188
|
+
self.sendStatus("debug", "Audio level below threshold (audio is reaching Beethoven but too quiet)")
|
|
189
|
+
belowThresholdLogged = true
|
|
190
|
+
}
|
|
184
191
|
}
|
|
185
192
|
}
|
package/package.json
CHANGED