github.com/primecitizens/pcz/std@v0.2.1/plat/js/webext/audio/bindings/ffi_bindings.ts (about) 1 import { importModule, Application, heap, Pointer } from "@ffi"; 2 3 importModule("plat/js/webext/audio", (A: Application) => { 4 const WEBEXT = typeof globalThis.browser === "undefined" ? globalThis.chrome : globalThis.browser; 5 6 return { 7 "constof_StreamType": (ref: heap.Ref<string>): number => { 8 const idx = ["INPUT", "OUTPUT"].indexOf(A.H.get(ref)); 9 return idx < 0 ? 0 : idx + 1; 10 }, 11 "constof_DeviceType": (ref: heap.Ref<string>): number => { 12 const idx = [ 13 "HEADPHONE", 14 "MIC", 15 "USB", 16 "BLUETOOTH", 17 "HDMI", 18 "INTERNAL_SPEAKER", 19 "INTERNAL_MIC", 20 "FRONT_MIC", 21 "REAR_MIC", 22 "KEYBOARD_MIC", 23 "HOTWORD", 24 "LINEOUT", 25 "POST_MIX_LOOPBACK", 26 "POST_DSP_LOOPBACK", 27 "ALSA_LOOPBACK", 28 "OTHER", 29 ].indexOf(A.H.get(ref)); 30 return idx < 0 ? 0 : idx + 1; 31 }, 32 33 "store_AudioDeviceInfo": (ptr: Pointer, ref: heap.Ref<any>) => { 34 const x = A.H.get<any>(ref); 35 36 if (typeof x === "undefined") { 37 A.store.Bool(ptr + 34, false); 38 A.store.Ref(ptr + 0, undefined); 39 A.store.Enum(ptr + 4, -1); 40 A.store.Enum(ptr + 8, -1); 41 A.store.Ref(ptr + 12, undefined); 42 A.store.Ref(ptr + 16, undefined); 43 A.store.Bool(ptr + 32, false); 44 A.store.Bool(ptr + 20, false); 45 A.store.Bool(ptr + 33, false); 46 A.store.Int32(ptr + 24, 0); 47 A.store.Ref(ptr + 28, undefined); 48 } else { 49 A.store.Bool(ptr + 34, true); 50 A.store.Ref(ptr + 0, x["id"]); 51 A.store.Enum(ptr + 4, ["INPUT", "OUTPUT"].indexOf(x["streamType"] as string)); 52 A.store.Enum( 53 ptr + 8, 54 [ 55 "HEADPHONE", 56 "MIC", 57 "USB", 58 "BLUETOOTH", 59 "HDMI", 60 "INTERNAL_SPEAKER", 61 "INTERNAL_MIC", 62 "FRONT_MIC", 63 "REAR_MIC", 64 "KEYBOARD_MIC", 65 "HOTWORD", 66 "LINEOUT", 67 "POST_MIX_LOOPBACK", 68 "POST_DSP_LOOPBACK", 69 "ALSA_LOOPBACK", 70 "OTHER", 71 ].indexOf(x["deviceType"] as string) 72 ); 73 A.store.Ref(ptr + 12, x["displayName"]); 74 A.store.Ref(ptr + 16, x["deviceName"]); 75 A.store.Bool(ptr + 32, "isActive" in x ? true : false); 76 A.store.Bool(ptr + 20, x["isActive"] ? true : false); 77 A.store.Bool(ptr + 33, "level" in x ? true : false); 78 A.store.Int32(ptr + 24, x["level"] === undefined ? 0 : (x["level"] as number)); 79 A.store.Ref(ptr + 28, x["stableDeviceId"]); 80 } 81 }, 82 "load_AudioDeviceInfo": (ptr: Pointer, create: heap.Ref<boolean>, ref: heap.Ref<any>): heap.Ref<any> => { 83 const x = create === A.H.TRUE ? {} : A.H.get<any>(ref); 84 85 x["id"] = A.load.Ref(ptr + 0, undefined); 86 x["streamType"] = A.load.Enum(ptr + 4, ["INPUT", "OUTPUT"]); 87 x["deviceType"] = A.load.Enum(ptr + 8, [ 88 "HEADPHONE", 89 "MIC", 90 "USB", 91 "BLUETOOTH", 92 "HDMI", 93 "INTERNAL_SPEAKER", 94 "INTERNAL_MIC", 95 "FRONT_MIC", 96 "REAR_MIC", 97 "KEYBOARD_MIC", 98 "HOTWORD", 99 "LINEOUT", 100 "POST_MIX_LOOPBACK", 101 "POST_DSP_LOOPBACK", 102 "ALSA_LOOPBACK", 103 "OTHER", 104 ]); 105 x["displayName"] = A.load.Ref(ptr + 12, undefined); 106 x["deviceName"] = A.load.Ref(ptr + 16, undefined); 107 if (A.load.Bool(ptr + 32)) { 108 x["isActive"] = A.load.Bool(ptr + 20); 109 } else { 110 delete x["isActive"]; 111 } 112 if (A.load.Bool(ptr + 33)) { 113 x["level"] = A.load.Int32(ptr + 24); 114 } else { 115 delete x["level"]; 116 } 117 x["stableDeviceId"] = A.load.Ref(ptr + 28, undefined); 118 return create === A.H.TRUE ? A.H.push(x) : ref; 119 }, 120 121 "store_DeviceFilter": (ptr: Pointer, ref: heap.Ref<any>) => { 122 const x = A.H.get<any>(ref); 123 124 if (typeof x === "undefined") { 125 A.store.Bool(ptr + 6, false); 126 A.store.Ref(ptr + 0, undefined); 127 A.store.Bool(ptr + 5, false); 128 A.store.Bool(ptr + 4, false); 129 } else { 130 A.store.Bool(ptr + 6, true); 131 A.store.Ref(ptr + 0, x["streamTypes"]); 132 A.store.Bool(ptr + 5, "isActive" in x ? true : false); 133 A.store.Bool(ptr + 4, x["isActive"] ? true : false); 134 } 135 }, 136 "load_DeviceFilter": (ptr: Pointer, create: heap.Ref<boolean>, ref: heap.Ref<any>): heap.Ref<any> => { 137 const x = create === A.H.TRUE ? {} : A.H.get<any>(ref); 138 139 x["streamTypes"] = A.load.Ref(ptr + 0, undefined); 140 if (A.load.Bool(ptr + 5)) { 141 x["isActive"] = A.load.Bool(ptr + 4); 142 } else { 143 delete x["isActive"]; 144 } 145 return create === A.H.TRUE ? A.H.push(x) : ref; 146 }, 147 148 "store_DeviceIdLists": (ptr: Pointer, ref: heap.Ref<any>) => { 149 const x = A.H.get<any>(ref); 150 151 if (typeof x === "undefined") { 152 A.store.Bool(ptr + 8, false); 153 A.store.Ref(ptr + 0, undefined); 154 A.store.Ref(ptr + 4, undefined); 155 } else { 156 A.store.Bool(ptr + 8, true); 157 A.store.Ref(ptr + 0, x["input"]); 158 A.store.Ref(ptr + 4, x["output"]); 159 } 160 }, 161 "load_DeviceIdLists": (ptr: Pointer, create: heap.Ref<boolean>, ref: heap.Ref<any>): heap.Ref<any> => { 162 const x = create === A.H.TRUE ? {} : A.H.get<any>(ref); 163 164 x["input"] = A.load.Ref(ptr + 0, undefined); 165 x["output"] = A.load.Ref(ptr + 4, undefined); 166 return create === A.H.TRUE ? A.H.push(x) : ref; 167 }, 168 169 "store_DeviceProperties": (ptr: Pointer, ref: heap.Ref<any>) => { 170 const x = A.H.get<any>(ref); 171 172 if (typeof x === "undefined") { 173 A.store.Bool(ptr + 5, false); 174 A.store.Bool(ptr + 4, false); 175 A.store.Int32(ptr + 0, 0); 176 } else { 177 A.store.Bool(ptr + 5, true); 178 A.store.Bool(ptr + 4, "level" in x ? true : false); 179 A.store.Int32(ptr + 0, x["level"] === undefined ? 0 : (x["level"] as number)); 180 } 181 }, 182 "load_DeviceProperties": (ptr: Pointer, create: heap.Ref<boolean>, ref: heap.Ref<any>): heap.Ref<any> => { 183 const x = create === A.H.TRUE ? {} : A.H.get<any>(ref); 184 185 if (A.load.Bool(ptr + 4)) { 186 x["level"] = A.load.Int32(ptr + 0); 187 } else { 188 delete x["level"]; 189 } 190 return create === A.H.TRUE ? A.H.push(x) : ref; 191 }, 192 193 "store_LevelChangedEvent": (ptr: Pointer, ref: heap.Ref<any>) => { 194 const x = A.H.get<any>(ref); 195 196 if (typeof x === "undefined") { 197 A.store.Bool(ptr + 9, false); 198 A.store.Ref(ptr + 0, undefined); 199 A.store.Bool(ptr + 8, false); 200 A.store.Int32(ptr + 4, 0); 201 } else { 202 A.store.Bool(ptr + 9, true); 203 A.store.Ref(ptr + 0, x["deviceId"]); 204 A.store.Bool(ptr + 8, "level" in x ? true : false); 205 A.store.Int32(ptr + 4, x["level"] === undefined ? 0 : (x["level"] as number)); 206 } 207 }, 208 "load_LevelChangedEvent": (ptr: Pointer, create: heap.Ref<boolean>, ref: heap.Ref<any>): heap.Ref<any> => { 209 const x = create === A.H.TRUE ? {} : A.H.get<any>(ref); 210 211 x["deviceId"] = A.load.Ref(ptr + 0, undefined); 212 if (A.load.Bool(ptr + 8)) { 213 x["level"] = A.load.Int32(ptr + 4); 214 } else { 215 delete x["level"]; 216 } 217 return create === A.H.TRUE ? A.H.push(x) : ref; 218 }, 219 220 "store_MuteChangedEvent": (ptr: Pointer, ref: heap.Ref<any>) => { 221 const x = A.H.get<any>(ref); 222 223 if (typeof x === "undefined") { 224 A.store.Bool(ptr + 6, false); 225 A.store.Enum(ptr + 0, -1); 226 A.store.Bool(ptr + 5, false); 227 A.store.Bool(ptr + 4, false); 228 } else { 229 A.store.Bool(ptr + 6, true); 230 A.store.Enum(ptr + 0, ["INPUT", "OUTPUT"].indexOf(x["streamType"] as string)); 231 A.store.Bool(ptr + 5, "isMuted" in x ? true : false); 232 A.store.Bool(ptr + 4, x["isMuted"] ? true : false); 233 } 234 }, 235 "load_MuteChangedEvent": (ptr: Pointer, create: heap.Ref<boolean>, ref: heap.Ref<any>): heap.Ref<any> => { 236 const x = create === A.H.TRUE ? {} : A.H.get<any>(ref); 237 238 x["streamType"] = A.load.Enum(ptr + 0, ["INPUT", "OUTPUT"]); 239 if (A.load.Bool(ptr + 5)) { 240 x["isMuted"] = A.load.Bool(ptr + 4); 241 } else { 242 delete x["isMuted"]; 243 } 244 return create === A.H.TRUE ? A.H.push(x) : ref; 245 }, 246 "has_GetDevices": (): heap.Ref<boolean> => { 247 if (WEBEXT?.audio && "getDevices" in WEBEXT?.audio) { 248 return A.H.TRUE; 249 } 250 return A.H.FALSE; 251 }, 252 "func_GetDevices": (fn: Pointer): void => { 253 A.store.Ref(fn, WEBEXT.audio.getDevices); 254 }, 255 "call_GetDevices": (retPtr: Pointer, filter: Pointer): void => { 256 const filter_ffi = {}; 257 258 filter_ffi["streamTypes"] = A.load.Ref(filter + 0, undefined); 259 if (A.load.Bool(filter + 5)) { 260 filter_ffi["isActive"] = A.load.Bool(filter + 4); 261 } 262 263 const _ret = WEBEXT.audio.getDevices(filter_ffi); 264 A.store.Ref(retPtr, _ret); 265 }, 266 "try_GetDevices": (retPtr: Pointer, errPtr: Pointer, filter: Pointer): heap.Ref<boolean> => { 267 try { 268 const filter_ffi = {}; 269 270 filter_ffi["streamTypes"] = A.load.Ref(filter + 0, undefined); 271 if (A.load.Bool(filter + 5)) { 272 filter_ffi["isActive"] = A.load.Bool(filter + 4); 273 } 274 275 const _ret = WEBEXT.audio.getDevices(filter_ffi); 276 A.store.Ref(retPtr, _ret); 277 return A.H.TRUE; 278 } catch (err: any) { 279 A.store.Ref(errPtr, err); 280 return A.H.FALSE; 281 } 282 }, 283 "has_GetMute": (): heap.Ref<boolean> => { 284 if (WEBEXT?.audio && "getMute" in WEBEXT?.audio) { 285 return A.H.TRUE; 286 } 287 return A.H.FALSE; 288 }, 289 "func_GetMute": (fn: Pointer): void => { 290 A.store.Ref(fn, WEBEXT.audio.getMute); 291 }, 292 "call_GetMute": (retPtr: Pointer, streamType: number): void => { 293 const _ret = WEBEXT.audio.getMute( 294 streamType > 0 && streamType <= 2 ? ["INPUT", "OUTPUT"][streamType - 1] : undefined 295 ); 296 A.store.Ref(retPtr, _ret); 297 }, 298 "try_GetMute": (retPtr: Pointer, errPtr: Pointer, streamType: number): heap.Ref<boolean> => { 299 try { 300 const _ret = WEBEXT.audio.getMute( 301 streamType > 0 && streamType <= 2 ? ["INPUT", "OUTPUT"][streamType - 1] : undefined 302 ); 303 A.store.Ref(retPtr, _ret); 304 return A.H.TRUE; 305 } catch (err: any) { 306 A.store.Ref(errPtr, err); 307 return A.H.FALSE; 308 } 309 }, 310 "has_OnDeviceListChanged": (): heap.Ref<boolean> => { 311 if (WEBEXT?.audio?.onDeviceListChanged && "addListener" in WEBEXT?.audio?.onDeviceListChanged) { 312 return A.H.TRUE; 313 } 314 return A.H.FALSE; 315 }, 316 "func_OnDeviceListChanged": (fn: Pointer): void => { 317 A.store.Ref(fn, WEBEXT.audio.onDeviceListChanged.addListener); 318 }, 319 "call_OnDeviceListChanged": (retPtr: Pointer, callback: heap.Ref<object>): void => { 320 const _ret = WEBEXT.audio.onDeviceListChanged.addListener(A.H.get<object>(callback)); 321 }, 322 "try_OnDeviceListChanged": (retPtr: Pointer, errPtr: Pointer, callback: heap.Ref<object>): heap.Ref<boolean> => { 323 try { 324 const _ret = WEBEXT.audio.onDeviceListChanged.addListener(A.H.get<object>(callback)); 325 return A.H.TRUE; 326 } catch (err: any) { 327 A.store.Ref(errPtr, err); 328 return A.H.FALSE; 329 } 330 }, 331 "has_OffDeviceListChanged": (): heap.Ref<boolean> => { 332 if (WEBEXT?.audio?.onDeviceListChanged && "removeListener" in WEBEXT?.audio?.onDeviceListChanged) { 333 return A.H.TRUE; 334 } 335 return A.H.FALSE; 336 }, 337 "func_OffDeviceListChanged": (fn: Pointer): void => { 338 A.store.Ref(fn, WEBEXT.audio.onDeviceListChanged.removeListener); 339 }, 340 "call_OffDeviceListChanged": (retPtr: Pointer, callback: heap.Ref<object>): void => { 341 const _ret = WEBEXT.audio.onDeviceListChanged.removeListener(A.H.get<object>(callback)); 342 }, 343 "try_OffDeviceListChanged": (retPtr: Pointer, errPtr: Pointer, callback: heap.Ref<object>): heap.Ref<boolean> => { 344 try { 345 const _ret = WEBEXT.audio.onDeviceListChanged.removeListener(A.H.get<object>(callback)); 346 return A.H.TRUE; 347 } catch (err: any) { 348 A.store.Ref(errPtr, err); 349 return A.H.FALSE; 350 } 351 }, 352 "has_HasOnDeviceListChanged": (): heap.Ref<boolean> => { 353 if (WEBEXT?.audio?.onDeviceListChanged && "hasListener" in WEBEXT?.audio?.onDeviceListChanged) { 354 return A.H.TRUE; 355 } 356 return A.H.FALSE; 357 }, 358 "func_HasOnDeviceListChanged": (fn: Pointer): void => { 359 A.store.Ref(fn, WEBEXT.audio.onDeviceListChanged.hasListener); 360 }, 361 "call_HasOnDeviceListChanged": (retPtr: Pointer, callback: heap.Ref<object>): void => { 362 const _ret = WEBEXT.audio.onDeviceListChanged.hasListener(A.H.get<object>(callback)); 363 A.store.Bool(retPtr, _ret); 364 }, 365 "try_HasOnDeviceListChanged": (retPtr: Pointer, errPtr: Pointer, callback: heap.Ref<object>): heap.Ref<boolean> => { 366 try { 367 const _ret = WEBEXT.audio.onDeviceListChanged.hasListener(A.H.get<object>(callback)); 368 A.store.Bool(retPtr, _ret); 369 return A.H.TRUE; 370 } catch (err: any) { 371 A.store.Ref(errPtr, err); 372 return A.H.FALSE; 373 } 374 }, 375 "has_OnLevelChanged": (): heap.Ref<boolean> => { 376 if (WEBEXT?.audio?.onLevelChanged && "addListener" in WEBEXT?.audio?.onLevelChanged) { 377 return A.H.TRUE; 378 } 379 return A.H.FALSE; 380 }, 381 "func_OnLevelChanged": (fn: Pointer): void => { 382 A.store.Ref(fn, WEBEXT.audio.onLevelChanged.addListener); 383 }, 384 "call_OnLevelChanged": (retPtr: Pointer, callback: heap.Ref<object>): void => { 385 const _ret = WEBEXT.audio.onLevelChanged.addListener(A.H.get<object>(callback)); 386 }, 387 "try_OnLevelChanged": (retPtr: Pointer, errPtr: Pointer, callback: heap.Ref<object>): heap.Ref<boolean> => { 388 try { 389 const _ret = WEBEXT.audio.onLevelChanged.addListener(A.H.get<object>(callback)); 390 return A.H.TRUE; 391 } catch (err: any) { 392 A.store.Ref(errPtr, err); 393 return A.H.FALSE; 394 } 395 }, 396 "has_OffLevelChanged": (): heap.Ref<boolean> => { 397 if (WEBEXT?.audio?.onLevelChanged && "removeListener" in WEBEXT?.audio?.onLevelChanged) { 398 return A.H.TRUE; 399 } 400 return A.H.FALSE; 401 }, 402 "func_OffLevelChanged": (fn: Pointer): void => { 403 A.store.Ref(fn, WEBEXT.audio.onLevelChanged.removeListener); 404 }, 405 "call_OffLevelChanged": (retPtr: Pointer, callback: heap.Ref<object>): void => { 406 const _ret = WEBEXT.audio.onLevelChanged.removeListener(A.H.get<object>(callback)); 407 }, 408 "try_OffLevelChanged": (retPtr: Pointer, errPtr: Pointer, callback: heap.Ref<object>): heap.Ref<boolean> => { 409 try { 410 const _ret = WEBEXT.audio.onLevelChanged.removeListener(A.H.get<object>(callback)); 411 return A.H.TRUE; 412 } catch (err: any) { 413 A.store.Ref(errPtr, err); 414 return A.H.FALSE; 415 } 416 }, 417 "has_HasOnLevelChanged": (): heap.Ref<boolean> => { 418 if (WEBEXT?.audio?.onLevelChanged && "hasListener" in WEBEXT?.audio?.onLevelChanged) { 419 return A.H.TRUE; 420 } 421 return A.H.FALSE; 422 }, 423 "func_HasOnLevelChanged": (fn: Pointer): void => { 424 A.store.Ref(fn, WEBEXT.audio.onLevelChanged.hasListener); 425 }, 426 "call_HasOnLevelChanged": (retPtr: Pointer, callback: heap.Ref<object>): void => { 427 const _ret = WEBEXT.audio.onLevelChanged.hasListener(A.H.get<object>(callback)); 428 A.store.Bool(retPtr, _ret); 429 }, 430 "try_HasOnLevelChanged": (retPtr: Pointer, errPtr: Pointer, callback: heap.Ref<object>): heap.Ref<boolean> => { 431 try { 432 const _ret = WEBEXT.audio.onLevelChanged.hasListener(A.H.get<object>(callback)); 433 A.store.Bool(retPtr, _ret); 434 return A.H.TRUE; 435 } catch (err: any) { 436 A.store.Ref(errPtr, err); 437 return A.H.FALSE; 438 } 439 }, 440 "has_OnMuteChanged": (): heap.Ref<boolean> => { 441 if (WEBEXT?.audio?.onMuteChanged && "addListener" in WEBEXT?.audio?.onMuteChanged) { 442 return A.H.TRUE; 443 } 444 return A.H.FALSE; 445 }, 446 "func_OnMuteChanged": (fn: Pointer): void => { 447 A.store.Ref(fn, WEBEXT.audio.onMuteChanged.addListener); 448 }, 449 "call_OnMuteChanged": (retPtr: Pointer, callback: heap.Ref<object>): void => { 450 const _ret = WEBEXT.audio.onMuteChanged.addListener(A.H.get<object>(callback)); 451 }, 452 "try_OnMuteChanged": (retPtr: Pointer, errPtr: Pointer, callback: heap.Ref<object>): heap.Ref<boolean> => { 453 try { 454 const _ret = WEBEXT.audio.onMuteChanged.addListener(A.H.get<object>(callback)); 455 return A.H.TRUE; 456 } catch (err: any) { 457 A.store.Ref(errPtr, err); 458 return A.H.FALSE; 459 } 460 }, 461 "has_OffMuteChanged": (): heap.Ref<boolean> => { 462 if (WEBEXT?.audio?.onMuteChanged && "removeListener" in WEBEXT?.audio?.onMuteChanged) { 463 return A.H.TRUE; 464 } 465 return A.H.FALSE; 466 }, 467 "func_OffMuteChanged": (fn: Pointer): void => { 468 A.store.Ref(fn, WEBEXT.audio.onMuteChanged.removeListener); 469 }, 470 "call_OffMuteChanged": (retPtr: Pointer, callback: heap.Ref<object>): void => { 471 const _ret = WEBEXT.audio.onMuteChanged.removeListener(A.H.get<object>(callback)); 472 }, 473 "try_OffMuteChanged": (retPtr: Pointer, errPtr: Pointer, callback: heap.Ref<object>): heap.Ref<boolean> => { 474 try { 475 const _ret = WEBEXT.audio.onMuteChanged.removeListener(A.H.get<object>(callback)); 476 return A.H.TRUE; 477 } catch (err: any) { 478 A.store.Ref(errPtr, err); 479 return A.H.FALSE; 480 } 481 }, 482 "has_HasOnMuteChanged": (): heap.Ref<boolean> => { 483 if (WEBEXT?.audio?.onMuteChanged && "hasListener" in WEBEXT?.audio?.onMuteChanged) { 484 return A.H.TRUE; 485 } 486 return A.H.FALSE; 487 }, 488 "func_HasOnMuteChanged": (fn: Pointer): void => { 489 A.store.Ref(fn, WEBEXT.audio.onMuteChanged.hasListener); 490 }, 491 "call_HasOnMuteChanged": (retPtr: Pointer, callback: heap.Ref<object>): void => { 492 const _ret = WEBEXT.audio.onMuteChanged.hasListener(A.H.get<object>(callback)); 493 A.store.Bool(retPtr, _ret); 494 }, 495 "try_HasOnMuteChanged": (retPtr: Pointer, errPtr: Pointer, callback: heap.Ref<object>): heap.Ref<boolean> => { 496 try { 497 const _ret = WEBEXT.audio.onMuteChanged.hasListener(A.H.get<object>(callback)); 498 A.store.Bool(retPtr, _ret); 499 return A.H.TRUE; 500 } catch (err: any) { 501 A.store.Ref(errPtr, err); 502 return A.H.FALSE; 503 } 504 }, 505 "has_SetActiveDevices": (): heap.Ref<boolean> => { 506 if (WEBEXT?.audio && "setActiveDevices" in WEBEXT?.audio) { 507 return A.H.TRUE; 508 } 509 return A.H.FALSE; 510 }, 511 "func_SetActiveDevices": (fn: Pointer): void => { 512 A.store.Ref(fn, WEBEXT.audio.setActiveDevices); 513 }, 514 "call_SetActiveDevices": (retPtr: Pointer, ids: Pointer): void => { 515 const ids_ffi = {}; 516 517 ids_ffi["input"] = A.load.Ref(ids + 0, undefined); 518 ids_ffi["output"] = A.load.Ref(ids + 4, undefined); 519 520 const _ret = WEBEXT.audio.setActiveDevices(ids_ffi); 521 A.store.Ref(retPtr, _ret); 522 }, 523 "try_SetActiveDevices": (retPtr: Pointer, errPtr: Pointer, ids: Pointer): heap.Ref<boolean> => { 524 try { 525 const ids_ffi = {}; 526 527 ids_ffi["input"] = A.load.Ref(ids + 0, undefined); 528 ids_ffi["output"] = A.load.Ref(ids + 4, undefined); 529 530 const _ret = WEBEXT.audio.setActiveDevices(ids_ffi); 531 A.store.Ref(retPtr, _ret); 532 return A.H.TRUE; 533 } catch (err: any) { 534 A.store.Ref(errPtr, err); 535 return A.H.FALSE; 536 } 537 }, 538 "has_SetMute": (): heap.Ref<boolean> => { 539 if (WEBEXT?.audio && "setMute" in WEBEXT?.audio) { 540 return A.H.TRUE; 541 } 542 return A.H.FALSE; 543 }, 544 "func_SetMute": (fn: Pointer): void => { 545 A.store.Ref(fn, WEBEXT.audio.setMute); 546 }, 547 "call_SetMute": (retPtr: Pointer, streamType: number, isMuted: heap.Ref<boolean>): void => { 548 const _ret = WEBEXT.audio.setMute( 549 streamType > 0 && streamType <= 2 ? ["INPUT", "OUTPUT"][streamType - 1] : undefined, 550 isMuted === A.H.TRUE 551 ); 552 A.store.Ref(retPtr, _ret); 553 }, 554 "try_SetMute": ( 555 retPtr: Pointer, 556 errPtr: Pointer, 557 streamType: number, 558 isMuted: heap.Ref<boolean> 559 ): heap.Ref<boolean> => { 560 try { 561 const _ret = WEBEXT.audio.setMute( 562 streamType > 0 && streamType <= 2 ? ["INPUT", "OUTPUT"][streamType - 1] : undefined, 563 isMuted === A.H.TRUE 564 ); 565 A.store.Ref(retPtr, _ret); 566 return A.H.TRUE; 567 } catch (err: any) { 568 A.store.Ref(errPtr, err); 569 return A.H.FALSE; 570 } 571 }, 572 "has_SetProperties": (): heap.Ref<boolean> => { 573 if (WEBEXT?.audio && "setProperties" in WEBEXT?.audio) { 574 return A.H.TRUE; 575 } 576 return A.H.FALSE; 577 }, 578 "func_SetProperties": (fn: Pointer): void => { 579 A.store.Ref(fn, WEBEXT.audio.setProperties); 580 }, 581 "call_SetProperties": (retPtr: Pointer, id: heap.Ref<object>, properties: Pointer): void => { 582 const properties_ffi = {}; 583 584 if (A.load.Bool(properties + 4)) { 585 properties_ffi["level"] = A.load.Int32(properties + 0); 586 } 587 588 const _ret = WEBEXT.audio.setProperties(A.H.get<object>(id), properties_ffi); 589 A.store.Ref(retPtr, _ret); 590 }, 591 "try_SetProperties": ( 592 retPtr: Pointer, 593 errPtr: Pointer, 594 id: heap.Ref<object>, 595 properties: Pointer 596 ): heap.Ref<boolean> => { 597 try { 598 const properties_ffi = {}; 599 600 if (A.load.Bool(properties + 4)) { 601 properties_ffi["level"] = A.load.Int32(properties + 0); 602 } 603 604 const _ret = WEBEXT.audio.setProperties(A.H.get<object>(id), properties_ffi); 605 A.store.Ref(retPtr, _ret); 606 return A.H.TRUE; 607 } catch (err: any) { 608 A.store.Ref(errPtr, err); 609 return A.H.FALSE; 610 } 611 }, 612 }; 613 });