speechrecorderng 3.3.1 → 3.3.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.
@@ -1,2 +1,2 @@
1
- export const VERSION = '3.3.1';
2
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3ByLm1vZHVsZS52ZXJzaW9uLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vcHJvamVjdHMvc3BlZWNocmVjb3JkZXJuZy9zcmMvbGliL3Nwci5tb2R1bGUudmVyc2lvbi50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxNQUFNLENBQUMsTUFBTSxPQUFPLEdBQUMsT0FBTyxDQUFBIiwic291cmNlc0NvbnRlbnQiOlsiZXhwb3J0IGNvbnN0IFZFUlNJT049JzMuMy4xJyJdfQ==
1
+ export const VERSION = '3.3.2';
2
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3ByLm1vZHVsZS52ZXJzaW9uLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vcHJvamVjdHMvc3BlZWNocmVjb3JkZXJuZy9zcmMvbGliL3Nwci5tb2R1bGUudmVyc2lvbi50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxNQUFNLENBQUMsTUFBTSxPQUFPLEdBQUMsT0FBTyxDQUFBIiwic291cmNlc0NvbnRlbnQiOlsiZXhwb3J0IGNvbnN0IFZFUlNJT049JzMuMy4yJyJdfQ==
@@ -2562,6 +2562,7 @@ class AudioPlayer {
2562
2562
  return this._stopAction;
2563
2563
  }
2564
2564
  set audioClip(audioClip) {
2565
+ this._audioClip = audioClip;
2565
2566
  let length = 0;
2566
2567
  let chs = 0;
2567
2568
  if (audioClip && audioClip.audioDataHolder) {
@@ -2584,7 +2585,6 @@ class AudioPlayer {
2584
2585
  else {
2585
2586
  this.audioSource = null;
2586
2587
  }
2587
- this._audioClip = audioClip;
2588
2588
  }
2589
2589
  get audioSource() {
2590
2590
  return this._audioSource;
@@ -13069,7 +13069,7 @@ class SessionManager extends BasicRecorder {
13069
13069
  this.transportActions.fwdAction.disabled = true;
13070
13070
  this.transportActions.fwdNextAction.disabled = true;
13071
13071
  this.transportActions.bwdAction.disabled = true;
13072
- this.displayRecFile = null;
13072
+ this.updateDisplayRecFile(null);
13073
13073
  this.displayRecFileVersion = 0;
13074
13074
  this.displayAudioClip = null;
13075
13075
  this.liveLevelDisplay.reset(true);
@@ -13167,6 +13167,9 @@ class SessionManager extends BasicRecorder {
13167
13167
  }
13168
13168
  set displayRecFile(displayRecFile) {
13169
13169
  this._displayRecFile = displayRecFile;
13170
+ }
13171
+ updateDisplayRecFile(displayRecFile, fetchAndApplyRecordingFile = true) {
13172
+ this.displayRecFile = displayRecFile;
13170
13173
  if (this._displayRecFile) {
13171
13174
  if (this.items) {
13172
13175
  this.items.currentRecordingFile = this._displayRecFile;
@@ -13183,47 +13186,88 @@ class SessionManager extends BasicRecorder {
13183
13186
  if (this.controlAudioPlayer) {
13184
13187
  this.controlAudioPlayer.audioClip = null;
13185
13188
  }
13186
- if (this._controlAudioPlayer && this._session) {
13187
- //... and try to fetch from server
13188
- this.liveLevelDisplayState = State.LOADING;
13189
- const rf = this._displayRecFile;
13190
- let audioDownloadType = this._clientAudioStorageType;
13191
- if (AudioStorageType.MEM_ENTIRE_AUTO_NET_CHUNKED === this._clientAudioStorageType || AudioStorageType.MEM_CHUNKED_AUTO_NET_CHUNKED === this._clientAudioStorageType) {
13192
- // Default is network mode
13193
- audioDownloadType = AudioStorageType.NET_CHUNKED;
13194
- if (rf.channels && rf.frames) {
13195
- const samples = rf.channels * rf.frames;
13196
- if (samples <= this._maxAutoNetMemStoreSamples) {
13197
- // But if audio file is small, load in continuous resp. chunked mode
13198
- if (AudioStorageType.MEM_ENTIRE_AUTO_NET_CHUNKED === this._clientAudioStorageType) {
13199
- audioDownloadType = AudioStorageType.MEM_ENTIRE;
13200
- }
13201
- else if (AudioStorageType.MEM_CHUNKED_AUTO_NET_CHUNKED === this._clientAudioStorageType) {
13202
- audioDownloadType = AudioStorageType.MEM_CHUNKED;
13189
+ if (fetchAndApplyRecordingFile) {
13190
+ if (this._controlAudioPlayer && this._session) {
13191
+ //... and try to fetch from server
13192
+ this.liveLevelDisplayState = State.LOADING;
13193
+ const rf = this._displayRecFile;
13194
+ let audioDownloadType = this._clientAudioStorageType;
13195
+ if (AudioStorageType.MEM_ENTIRE_AUTO_NET_CHUNKED === this._clientAudioStorageType || AudioStorageType.MEM_CHUNKED_AUTO_NET_CHUNKED === this._clientAudioStorageType) {
13196
+ // Default is network mode
13197
+ audioDownloadType = AudioStorageType.NET_CHUNKED;
13198
+ if (rf.channels && rf.frames) {
13199
+ const samples = rf.channels * rf.frames;
13200
+ if (samples <= this._maxAutoNetMemStoreSamples) {
13201
+ // But if audio file is small, load in continuous resp. chunked mode
13202
+ if (AudioStorageType.MEM_ENTIRE_AUTO_NET_CHUNKED === this._clientAudioStorageType) {
13203
+ audioDownloadType = AudioStorageType.MEM_ENTIRE;
13204
+ }
13205
+ else if (AudioStorageType.MEM_CHUNKED_AUTO_NET_CHUNKED === this._clientAudioStorageType) {
13206
+ audioDownloadType = AudioStorageType.MEM_CHUNKED;
13207
+ }
13203
13208
  }
13204
13209
  }
13205
13210
  }
13206
- }
13207
- console.debug("Audio download type: " + audioDownloadType);
13208
- if (AudioStorageType.DB_CHUNKED === this._clientAudioStorageType) {
13209
- // Fetch chunked indexed db audio buffer
13210
- let nextIab = null;
13211
- if (!this._persistentAudioStorageTarget) {
13212
- throw Error('Error: Persistent storage target not set.');
13211
+ console.debug("Audio download type: " + audioDownloadType);
13212
+ if (AudioStorageType.DB_CHUNKED === this._clientAudioStorageType) {
13213
+ // Fetch chunked indexed db audio buffer
13214
+ let nextIab = null;
13215
+ if (!this._persistentAudioStorageTarget) {
13216
+ throw Error('Error: Persistent storage target not set.');
13217
+ }
13218
+ else {
13219
+ //console.debug("Fetch audio and store to indexed db...");
13220
+ this.audioFetchSubscription = this.recFileService.fetchSprRecordingFileIndDbAudioBuffer(this._controlAudioPlayer.context, this._persistentAudioStorageTarget, this._session.project, rf).subscribe({
13221
+ next: (iab) => {
13222
+ //console.debug("Sessionmanager: Received inddb audio buffer: "+iab);
13223
+ nextIab = iab;
13224
+ },
13225
+ complete: () => {
13226
+ this.liveLevelDisplayState = State.READY;
13227
+ let fabDh = null;
13228
+ if (nextIab) {
13229
+ if (rf && this.items) {
13230
+ fabDh = new AudioDataHolder(nextIab);
13231
+ this.items.setSprRecFileAudioData(rf, fabDh);
13232
+ }
13233
+ }
13234
+ else {
13235
+ // Should actually be handled by the error resolver
13236
+ this.statusMsg = 'Recording file could not be loaded.';
13237
+ this.statusAlertType = 'error';
13238
+ }
13239
+ if (fabDh) {
13240
+ // this.displayAudioClip could have been changed meanwhile, but the recorder unsubcribes before changing the item, therefore there should be no risk to set to wrong item
13241
+ this.displayAudioClip = new AudioClip(fabDh);
13242
+ }
13243
+ this.controlAudioPlayer.audioClip = this.displayAudioClip;
13244
+ this.showRecording();
13245
+ },
13246
+ error: err => {
13247
+ console.error("Could not load recording file from server: " + err);
13248
+ this.liveLevelDisplayState = State.READY;
13249
+ this.statusMsg = 'Recording file could not be loaded: ' + err;
13250
+ this.statusAlertType = 'error';
13251
+ this.changeDetectorRef.detectChanges();
13252
+ }
13253
+ });
13254
+ }
13213
13255
  }
13214
- else {
13215
- //console.debug("Fetch audio and store to indexed db...");
13216
- this.audioFetchSubscription = this.recFileService.fetchSprRecordingFileIndDbAudioBuffer(this._controlAudioPlayer.context, this._persistentAudioStorageTarget, this._session.project, rf).subscribe({
13217
- next: (iab) => {
13218
- //console.debug("Sessionmanager: Received inddb audio buffer: "+iab);
13219
- nextIab = iab;
13256
+ else if (AudioStorageType.NET_CHUNKED === audioDownloadType) {
13257
+ // Fetch chunked audio buffer from network
13258
+ let nextNetAb = null;
13259
+ //console.debug("Fetch chunked audio from network");
13260
+ this.audioFetchSubscription = this.recFileService.fetchSprRecordingFileNetAudioBuffer(this._controlAudioPlayer.context, this._session.project, rf).subscribe({
13261
+ next: (netAb) => {
13262
+ //console.debug("Sessionmanager: Received net audio buffer: "+netAb);
13263
+ nextNetAb = netAb;
13220
13264
  },
13221
13265
  complete: () => {
13222
13266
  this.liveLevelDisplayState = State.READY;
13223
13267
  let fabDh = null;
13224
- if (nextIab) {
13268
+ if (nextNetAb) {
13225
13269
  if (rf && this.items) {
13226
- fabDh = new AudioDataHolder(nextIab);
13270
+ fabDh = new AudioDataHolder(nextNetAb);
13227
13271
  this.items.setSprRecFileAudioData(rf, fabDh);
13228
13272
  }
13229
13273
  }
@@ -13234,6 +13278,7 @@ class SessionManager extends BasicRecorder {
13234
13278
  }
13235
13279
  if (fabDh) {
13236
13280
  // this.displayAudioClip could have been changed meanwhile, but the recorder unsubcribes before changing the item, therefore there should be no risk to set to wrong item
13281
+ //console.debug("set displayRecFile(): fetch net ab complete, set displayAudioClip.")
13237
13282
  this.displayAudioClip = new AudioClip(fabDh);
13238
13283
  }
13239
13284
  this.controlAudioPlayer.audioClip = this.displayAudioClip;
@@ -13248,126 +13293,86 @@ class SessionManager extends BasicRecorder {
13248
13293
  }
13249
13294
  });
13250
13295
  }
13251
- }
13252
- else if (AudioStorageType.NET_CHUNKED === audioDownloadType) {
13253
- // Fetch chunked audio buffer from network
13254
- let nextNetAb = null;
13255
- //console.debug("Fetch chunked audio from network");
13256
- this.audioFetchSubscription = this.recFileService.fetchSprRecordingFileNetAudioBuffer(this._controlAudioPlayer.context, this._session.project, rf).subscribe({
13257
- next: (netAb) => {
13258
- //console.debug("Sessionmanager: Received net audio buffer: "+netAb);
13259
- nextNetAb = netAb;
13260
- },
13261
- complete: () => {
13262
- this.liveLevelDisplayState = State.READY;
13263
- let fabDh = null;
13264
- if (nextNetAb) {
13265
- if (rf && this.items) {
13266
- fabDh = new AudioDataHolder(nextNetAb);
13267
- this.items.setSprRecFileAudioData(rf, fabDh);
13296
+ else if (AudioStorageType.MEM_CHUNKED === audioDownloadType) {
13297
+ // Fetch chunked array audio buffer
13298
+ let nextAab = null;
13299
+ //console.debug("Fetch audio and store to (chunked) array buffer...");
13300
+ this.audioFetchSubscription = this.recFileService.fetchSprRecordingFileArrayAudioBuffer(this._controlAudioPlayer.context, this._session.project, rf).subscribe({
13301
+ next: (aab) => {
13302
+ nextAab = aab;
13303
+ },
13304
+ complete: () => {
13305
+ this.liveLevelDisplayState = State.READY;
13306
+ let fabDh = null;
13307
+ if (nextAab) {
13308
+ if (rf && this.items) {
13309
+ fabDh = new AudioDataHolder(nextAab);
13310
+ this.items.setSprRecFileAudioData(rf, fabDh);
13311
+ }
13268
13312
  }
13269
- }
13270
- else {
13271
- // Should actually be handled by the error resolver
13272
- this.statusMsg = 'Recording file could not be loaded.';
13273
- this.statusAlertType = 'error';
13274
- }
13275
- if (fabDh) {
13276
- // this.displayAudioClip could have been changed meanwhile, but the recorder unsubcribes before changing the item, therefore there should be no risk to set to wrong item
13277
- //console.debug("set displayRecFile(): fetch net ab complete, set displayAudioClip.")
13278
- this.displayAudioClip = new AudioClip(fabDh);
13279
- }
13280
- this.controlAudioPlayer.audioClip = this.displayAudioClip;
13281
- this.showRecording();
13282
- },
13283
- error: err => {
13284
- console.error("Could not load recording file from server: " + err);
13285
- this.liveLevelDisplayState = State.READY;
13286
- this.statusMsg = 'Recording file could not be loaded: ' + err;
13287
- this.statusAlertType = 'error';
13288
- this.changeDetectorRef.detectChanges();
13289
- }
13290
- });
13291
- }
13292
- else if (AudioStorageType.MEM_CHUNKED === audioDownloadType) {
13293
- // Fetch chunked array audio buffer
13294
- let nextAab = null;
13295
- //console.debug("Fetch audio and store to (chunked) array buffer...");
13296
- this.audioFetchSubscription = this.recFileService.fetchSprRecordingFileArrayAudioBuffer(this._controlAudioPlayer.context, this._session.project, rf).subscribe({
13297
- next: (aab) => {
13298
- nextAab = aab;
13299
- },
13300
- complete: () => {
13301
- this.liveLevelDisplayState = State.READY;
13302
- let fabDh = null;
13303
- if (nextAab) {
13304
- if (rf && this.items) {
13305
- fabDh = new AudioDataHolder(nextAab);
13306
- this.items.setSprRecFileAudioData(rf, fabDh);
13313
+ else {
13314
+ // Should actually be handled by the error resolver
13315
+ this.statusMsg = 'Recording file could not be loaded.';
13316
+ this.statusAlertType = 'error';
13307
13317
  }
13308
- }
13309
- else {
13310
- // Should actually be handled by the error resolver
13311
- this.statusMsg = 'Recording file could not be loaded.';
13318
+ if (fabDh) {
13319
+ // this.displayAudioClip could have been changed meanwhile, but the recorder unsubcribes before changing the item, therefore there should be no risk to set to wrong item
13320
+ this.displayAudioClip = new AudioClip(fabDh);
13321
+ }
13322
+ this.controlAudioPlayer.audioClip = this.displayAudioClip;
13323
+ this.showRecording();
13324
+ },
13325
+ error: err => {
13326
+ console.error("Could not load recording file from server: " + err);
13327
+ this.liveLevelDisplayState = State.READY;
13328
+ this.statusMsg = 'Recording file could not be loaded: ' + err;
13312
13329
  this.statusAlertType = 'error';
13313
13330
  }
13314
- if (fabDh) {
13315
- // this.displayAudioClip could have been changed meanwhile, but the recorder unsubcribes before changing the item, therefore there should be no risk to set to wrong item
13316
- this.displayAudioClip = new AudioClip(fabDh);
13317
- }
13318
- this.controlAudioPlayer.audioClip = this.displayAudioClip;
13319
- this.showRecording();
13320
- },
13321
- error: err => {
13322
- console.error("Could not load recording file from server: " + err);
13323
- this.liveLevelDisplayState = State.READY;
13324
- this.statusMsg = 'Recording file could not be loaded: ' + err;
13325
- this.statusAlertType = 'error';
13326
- }
13327
- });
13328
- }
13329
- else {
13330
- // Fetch regular audio buffer
13331
- //console.debug("Fetch audio and store to audio buffer...");
13332
- this.audioFetchSubscription = this.recFileService.fetchSprRecordingFileAudioBuffer(this._controlAudioPlayer.context, this._session.project, rf).subscribe({
13333
- next: (ab) => {
13334
- this.liveLevelDisplayState = State.READY;
13335
- let fabDh = null;
13336
- if (ab) {
13337
- if (rf && this.items) {
13338
- if (SessionManager.FORCE_ARRRAY_AUDIO_BUFFER) {
13339
- let aab = ArrayAudioBuffer.fromAudioBuffer(ab);
13340
- fabDh = new AudioDataHolder(aab);
13341
- }
13342
- else {
13343
- fabDh = new AudioDataHolder(new AudioBufferSource(ab));
13331
+ });
13332
+ }
13333
+ else {
13334
+ // Fetch regular audio buffer
13335
+ //console.debug("Fetch audio and store to audio buffer...");
13336
+ this.audioFetchSubscription = this.recFileService.fetchSprRecordingFileAudioBuffer(this._controlAudioPlayer.context, this._session.project, rf).subscribe({
13337
+ next: (ab) => {
13338
+ this.liveLevelDisplayState = State.READY;
13339
+ let fabDh = null;
13340
+ if (ab) {
13341
+ if (rf && this.items) {
13342
+ if (SessionManager.FORCE_ARRRAY_AUDIO_BUFFER) {
13343
+ let aab = ArrayAudioBuffer.fromAudioBuffer(ab);
13344
+ fabDh = new AudioDataHolder(aab);
13345
+ }
13346
+ else {
13347
+ fabDh = new AudioDataHolder(new AudioBufferSource(ab));
13348
+ }
13349
+ this.items.setSprRecFileAudioData(rf, fabDh);
13344
13350
  }
13345
- this.items.setSprRecFileAudioData(rf, fabDh);
13346
13351
  }
13347
- }
13348
- else {
13349
- // Should actually be handled by the error resolver
13350
- this.statusMsg = 'Recording file could not be loaded.';
13352
+ else {
13353
+ // Should actually be handled by the error resolver
13354
+ this.statusMsg = 'Recording file could not be loaded.';
13355
+ this.statusAlertType = 'error';
13356
+ }
13357
+ if (fabDh) {
13358
+ // this.displayAudioClip could have been changed meanwhile, but the recorder unsubcribes before changing the item, therefore there should be no risk to set to wrong item
13359
+ this.displayAudioClip = new AudioClip(fabDh);
13360
+ }
13361
+ this.controlAudioPlayer.audioClip = this.displayAudioClip;
13362
+ this.showRecording();
13363
+ }, error: err => {
13364
+ console.error("Could not load recording file from server: " + err);
13365
+ this.liveLevelDisplayState = State.READY;
13366
+ this.statusMsg = 'Recording file could not be loaded: ' + err;
13351
13367
  this.statusAlertType = 'error';
13352
13368
  }
13353
- if (fabDh) {
13354
- // this.displayAudioClip could have been changed meanwhile, but the recorder unsubcribes before changing the item, therefore there should be no risk to set to wrong item
13355
- this.displayAudioClip = new AudioClip(fabDh);
13356
- }
13357
- this.controlAudioPlayer.audioClip = this.displayAudioClip;
13358
- this.showRecording();
13359
- }, error: err => {
13360
- console.error("Could not load recording file from server: " + err);
13361
- this.liveLevelDisplayState = State.READY;
13362
- this.statusMsg = 'Recording file could not be loaded: ' + err;
13363
- this.statusAlertType = 'error';
13364
- }
13365
- });
13369
+ });
13370
+ }
13371
+ }
13372
+ else {
13373
+ this.statusMsg = 'Recording file could not be decoded. Audio context unavailable.';
13374
+ this.statusAlertType = 'error';
13366
13375
  }
13367
- }
13368
- else {
13369
- this.statusMsg = 'Recording file could not be decoded. Audio context unavailable.';
13370
- this.statusAlertType = 'error';
13371
13376
  }
13372
13377
  }
13373
13378
  }
@@ -13407,7 +13412,7 @@ class SessionManager extends BasicRecorder {
13407
13412
  this.applyPrompt();
13408
13413
  }
13409
13414
  if (isNonrecording) {
13410
- this.displayRecFile = null;
13415
+ this.updateDisplayRecFile(null);
13411
13416
  this.displayRecFileVersion = 0;
13412
13417
  this.startStopSignalState = 4 /* OFF */;
13413
13418
  }
@@ -13422,11 +13427,11 @@ class SessionManager extends BasicRecorder {
13422
13427
  if (availRecfiles > 0) {
13423
13428
  let rfVers = availRecfiles - 1;
13424
13429
  recentRecFile = it.recs[rfVers];
13425
- this.displayRecFile = recentRecFile;
13430
+ this.updateDisplayRecFile(recentRecFile, !temporary);
13426
13431
  this.displayRecFileVersion = rfVers;
13427
13432
  }
13428
13433
  else {
13429
- this.displayRecFile = null;
13434
+ this.updateDisplayRecFile(null);
13430
13435
  this.displayRecFileVersion = 0;
13431
13436
  }
13432
13437
  }
@@ -17492,7 +17497,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImpo
17492
17497
  }]
17493
17498
  }] });
17494
17499
 
17495
- const VERSION = '3.3.1';
17500
+ const VERSION = '3.3.2';
17496
17501
 
17497
17502
  /*
17498
17503
  * Public API Surface of speechrecorderng