@edkimmel/expo-audio-stream 0.6.3 → 0.6.4

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.
@@ -31,6 +31,7 @@ public class ExpoPlayAudioStreamModule: Module, MicrophoneDataDelegate, Pipeline
31
31
  }
32
32
 
33
33
  private var isAudioSessionInitialized: Bool = false
34
+ private var micTotalDataSize: Int = 0
34
35
 
35
36
  // ── PipelineEventSender conformance ───────────────────────────────
36
37
  func sendPipelineEvent(_ eventName: String, _ params: [String: Any]) {
@@ -150,6 +151,7 @@ public class ExpoPlayAudioStreamModule: Module, MicrophoneDataDelegate, Pipeline
150
151
  "sampleRate": result.sampleRate ?? 48000,
151
152
  "mimeType": result.mimeType ?? "",
152
153
  ]
154
+ micTotalDataSize = 0
153
155
  promise.resolve(resultDict)
154
156
  }
155
157
  } else {
@@ -328,13 +330,15 @@ public class ExpoPlayAudioStreamModule: Module, MicrophoneDataDelegate, Pipeline
328
330
 
329
331
  func onMicrophoneData(_ microphoneData: Data, _ soundLevel: Float?, _ frequencyBands: FrequencyBands?) {
330
332
  let encodedData = microphoneData.base64EncodedString()
333
+ let deltaSize = microphoneData.count
334
+ micTotalDataSize += deltaSize
331
335
  var eventBody: [String: Any] = [
332
336
  "fileUri": "",
333
337
  "lastEmittedSize": 0,
334
338
  "position": 0,
335
339
  "encoded": encodedData,
336
- "deltaSize": 0,
337
- "totalSize": 0,
340
+ "deltaSize": deltaSize,
341
+ "totalSize": micTotalDataSize,
338
342
  "mimeType": "",
339
343
  "soundLevel": soundLevel ?? -160
340
344
  ]
@@ -301,7 +301,8 @@ class Microphone: SharedAudioEngineDelegate {
301
301
 
302
302
  let data: Data
303
303
  if isSilent {
304
- let byteCount = Int(currentBuffer.frameCapacity) * Int(currentBuffer.format.streamDescription.pointee.mBytesPerFrame)
304
+ let bytesPerSample = targetBitDepth / 8
305
+ let byteCount = Int(currentBuffer.frameLength) * Int(currentBuffer.format.channelCount) * bytesPerSample
305
306
  data = Data(repeating: 0, count: byteCount)
306
307
  } else if targetBitDepth == 16 && currentBuffer.format.commonFormat == .pcmFormatFloat32,
307
308
  let floatData = currentBuffer.floatChannelData {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@edkimmel/expo-audio-stream",
3
- "version": "0.6.3",
3
+ "version": "0.6.4",
4
4
  "description": "Expo Play Audio Stream module",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",
File without changes
@@ -1,2 +0,0 @@
1
- #Thu Jun 04 15:44:34 EDT 2026
2
- gradle.version=8.9
File without changes