speaker-calibration 2.2.24 → 2.2.25

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "speaker-calibration",
3
- "version": "2.2.24",
3
+ "version": "2.2.25",
4
4
  "description": "Speaker calibration library for auditory testing",
5
5
  "main": "dist/main.js",
6
6
  "directories": {
@@ -1079,6 +1079,15 @@ class Combination extends AudioCalibrator {
1079
1079
  return false;
1080
1080
  };
1081
1081
 
1082
+ addMicrophoneInfo = async (speakerID, OEM, micInfo) => {
1083
+ // add to database if /info does not exist
1084
+ const dbRef = ref(database);
1085
+ const snapshot = await get(child(dbRef, `Microphone2/${OEM}/${speakerID}/info`));
1086
+ if (!snapshot.exists()) {
1087
+ await set(ref(database, `Microphone2/${OEM}/${speakerID}/info`), micInfo);
1088
+ }
1089
+ };
1090
+
1082
1091
  convertToDB = gain => {
1083
1092
  return Math.log10(gain) * 20;
1084
1093
  };
@@ -1152,6 +1161,17 @@ class Combination extends AudioCalibrator {
1152
1161
  //based on zeroing of 1000hz, search for "*1000Hz"
1153
1162
  const ID = isSmartPhone ? micModelNumber : micSerialNumber;
1154
1163
  const OEM = isSmartPhone ? this.deviceInfo.OEM : micManufacturer;
1164
+ const micInfo = {
1165
+ OEM: OEM,
1166
+ ID: ID,
1167
+ HardwareName: isSmartPhone ? this.deviceInfo.hardwarename : micModelName,
1168
+ hardwareFamily: isSmartPhone ? this.deviceInfo.hardwarefamily : micModelName,
1169
+ HardwareModel: isSmartPhone ? this.deviceInfo.hardwaremodel : micModelName,
1170
+ PlatformName: isSmartPhone ? this.deviceInfo.platformname : 'N/A',
1171
+ PlatformVersion: isSmartPhone ? this.deviceInfo.platformversion : 'N/A',
1172
+ DeviceType: isSmartPhone ? this.deviceInfo.devicetype : 'N/A',
1173
+ };
1174
+ this.addMicrophoneInfo(ID, OEM, micInfo);
1155
1175
  if (componentIR == null) {
1156
1176
  //mode 'ir'
1157
1177
  //global variable this.componentIR must be set
@@ -1208,7 +1228,7 @@ class Combination extends AudioCalibrator {
1208
1228
  micModelName: micModelName,
1209
1229
  ID: ID,
1210
1230
  OEM: OEM,
1211
- micInfo: this.deviceInfo,
1231
+ micInfo: micInfo,
1212
1232
  };
1213
1233
  console.log('total results');
1214
1234
  console.log(total_results);