001package Torello.Browser; 002 003import java.util.*; 004import javax.json.*; 005import javax.json.stream.*; 006import java.io.*; 007 008import java.lang.reflect.Method; 009import java.lang.reflect.Parameter; 010import java.util.function.Function; 011 012import Torello.Java.Additional.*; 013 014import static Torello.Java.Additional.JFlag.*; 015 016import Torello.Java.StrCmpr; 017import Torello.JavaDoc.StaticFunctional; 018import Torello.JavaDoc.JDHeaderBackgroundImg; 019import Torello.JavaDoc.Excuse; 020 021/** 022 * <SPAN CLASS=CopiedJDK><B>This domain allows inspection of Web Audio API. 023 * https://webaudio.github.io/web-audio-api/</B></SPAN> 024 * 025 * <EMBED CLASS='external-html' DATA-FILE-ID=CODE_GEN_NOTE> 026 */ 027@StaticFunctional(Excused={"counter"}, Excuses={Excuse.CONFIGURATION}) 028@JDHeaderBackgroundImg(EmbedTagFileID="WOOD_PLANK_NOTE") 029public class WebAudio 030{ 031 // ******************************************************************************************** 032 // ******************************************************************************************** 033 // Class Header Stuff 034 // ******************************************************************************************** 035 // ******************************************************************************************** 036 037 038 // No Pubic Constructors 039 private WebAudio () { } 040 041 // These two Vector's are used by all the "Methods" exported by this class. java.lang.reflect 042 // is used to generate the JSON String's. It saves thousands of lines of Auto-Generated Code. 043 private static final Map<String, Vector<String>> parameterNames = new HashMap<>(); 044 private static final Map<String, Vector<Class<?>>> parameterTypes = new HashMap<>(); 045 046 // Some Methods do not take any parameters - for instance all the "enable()" and "disable()" 047 // I simply could not get ride of RAW-TYPES and UNCHECKED warnings... so there are now, 048 // offically, two empty-vectors. One for String's, and the other for Classes. 049 050 private static final Vector<String> EMPTY_VEC_STR = new Vector<>(); 051 private static final Vector<Class<?>> EMPTY_VEC_CLASS = new Vector<>(); 052 053 static 054 { 055 for (Method m : WebAudio.class.getMethods()) 056 { 057 // This doesn't work! The parameter names are all "arg0" ... "argN" 058 // It works for java.lang.reflect.Field, BUT NOT java.lang.reflect.Parameter! 059 // 060 // Vector<String> parameterNamesList = new Vector<>(); -- NOPE! 061 062 Vector<Class<?>> parameterTypesList = new Vector<>(); 063 064 for (Parameter p : m.getParameters()) parameterTypesList.add(p.getType()); 065 066 parameterTypes.put( 067 m.getName(), 068 (parameterTypesList.size() > 0) ? parameterTypesList : EMPTY_VEC_CLASS 069 ); 070 } 071 } 072 073 static 074 { 075 Vector<String> v = null; 076 077 parameterNames.put("enable", EMPTY_VEC_STR); 078 079 parameterNames.put("disable", EMPTY_VEC_STR); 080 081 v = new Vector<String>(1); 082 parameterNames.put("getRealtimeData", v); 083 Collections.addAll(v, new String[] 084 { "contextId", }); 085 } 086 087 088 // ******************************************************************************************** 089 // ******************************************************************************************** 090 // Types - Static Inner Classes 091 // ******************************************************************************************** 092 // ******************************************************************************************** 093 094 // public static class GraphObjectId => String 095 096 // public static class NodeType => String 097 098 // public static class ParamType => String 099 100 /** Enum of BaseAudioContext types */ 101 public static final String[] ContextType = 102 { "realtime", "offline", }; 103 104 /** Enum of AudioContextState from the spec */ 105 public static final String[] ContextState = 106 { "suspended", "running", "closed", }; 107 108 /** Enum of AudioNode::ChannelCountMode from the spec */ 109 public static final String[] ChannelCountMode = 110 { "clamped-max", "explicit", "max", }; 111 112 /** Enum of AudioNode::ChannelInterpretation from the spec */ 113 public static final String[] ChannelInterpretation = 114 { "discrete", "speakers", }; 115 116 /** Enum of AudioParam::AutomationRate from the spec */ 117 public static final String[] AutomationRate = 118 { "a-rate", "k-rate", }; 119 120 /** Fields in AudioContext that change in real-time. */ 121 public static class ContextRealtimeData extends BaseType 122 { 123 /** For Object Serialization. java.io.Serializable */ 124 protected static final long serialVersionUID = 1; 125 126 public boolean[] optionals() 127 { return new boolean[] { false, false, false, false, }; } 128 129 /** The current context time in second in BaseAudioContext. */ 130 public final Number currentTime; 131 132 /** 133 * The time spent on rendering graph divided by render quantum duration, 134 * and multiplied by 100. 100 means the audio renderer reached the full 135 * capacity and glitch may occur. 136 */ 137 public final Number renderCapacity; 138 139 /** A running mean of callback interval. */ 140 public final Number callbackIntervalMean; 141 142 /** A running variance of callback interval. */ 143 public final Number callbackIntervalVariance; 144 145 /** 146 * Constructor 147 * 148 * @param currentTime The current context time in second in BaseAudioContext. 149 * 150 * @param renderCapacity 151 * The time spent on rendering graph divided by render quantum duration, 152 * and multiplied by 100. 100 means the audio renderer reached the full 153 * capacity and glitch may occur. 154 * 155 * @param callbackIntervalMean A running mean of callback interval. 156 * 157 * @param callbackIntervalVariance A running variance of callback interval. 158 */ 159 public ContextRealtimeData( 160 Number currentTime, Number renderCapacity, Number callbackIntervalMean, 161 Number callbackIntervalVariance 162 ) 163 { 164 // Exception-Check(s) to ensure that if any parameters which are not declared as 165 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 166 167 if (currentTime == null) BRDPC.throwNPE("currentTime"); 168 if (renderCapacity == null) BRDPC.throwNPE("renderCapacity"); 169 if (callbackIntervalMean == null) BRDPC.throwNPE("callbackIntervalMean"); 170 if (callbackIntervalVariance == null) BRDPC.throwNPE("callbackIntervalVariance"); 171 172 this.currentTime = currentTime; 173 this.renderCapacity = renderCapacity; 174 this.callbackIntervalMean = callbackIntervalMean; 175 this.callbackIntervalVariance = callbackIntervalVariance; 176 } 177 178 /** 179 * JSON Object Constructor 180 * @param jo A Json-Object having data about an instance of {@code 'ContextRealtimeData'}. 181 */ 182 public ContextRealtimeData (JsonObject jo) 183 { 184 this.currentTime = ReadJSON.getNUMBER(jo, "currentTime", false, true); 185 this.renderCapacity = ReadJSON.getNUMBER(jo, "renderCapacity", false, true); 186 this.callbackIntervalMean = ReadJSON.getNUMBER(jo, "callbackIntervalMean", false, true); 187 this.callbackIntervalVariance = ReadJSON.getNUMBER(jo, "callbackIntervalVariance", false, true); 188 } 189 190 } 191 192 /** Protocol object for BaseAudioContext */ 193 public static class BaseAudioContext extends BaseType 194 { 195 /** For Object Serialization. java.io.Serializable */ 196 protected static final long serialVersionUID = 1; 197 198 public boolean[] optionals() 199 { return new boolean[] { false, false, false, true, false, false, false, }; } 200 201 /** <CODE>[No Description Provided by Google]</CODE> */ 202 public final String contextId; 203 204 /** <CODE>[No Description Provided by Google]</CODE> */ 205 public final String contextType; 206 207 /** <CODE>[No Description Provided by Google]</CODE> */ 208 public final String contextState; 209 210 /** 211 * <CODE>[No Description Provided by Google]</CODE> 212 * <BR /> 213 * <BR /><B>OPTIONAL</B> 214 */ 215 public final WebAudio.ContextRealtimeData realtimeData; 216 217 /** Platform-dependent callback buffer size. */ 218 public final Number callbackBufferSize; 219 220 /** Number of output channels supported by audio hardware in use. */ 221 public final Number maxOutputChannelCount; 222 223 /** Context sample rate. */ 224 public final Number sampleRate; 225 226 /** 227 * Constructor 228 * 229 * @param contextId - 230 * 231 * @param contextType - 232 * 233 * @param contextState - 234 * 235 * @param realtimeData - 236 * <BR /><B>OPTIONAL</B> 237 * 238 * @param callbackBufferSize Platform-dependent callback buffer size. 239 * 240 * @param maxOutputChannelCount Number of output channels supported by audio hardware in use. 241 * 242 * @param sampleRate Context sample rate. 243 */ 244 public BaseAudioContext( 245 String contextId, String contextType, String contextState, 246 WebAudio.ContextRealtimeData realtimeData, Number callbackBufferSize, 247 Number maxOutputChannelCount, Number sampleRate 248 ) 249 { 250 // Exception-Check(s) to ensure that if any parameters which are not declared as 251 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 252 253 if (contextId == null) BRDPC.throwNPE("contextId"); 254 if (contextType == null) BRDPC.throwNPE("contextType"); 255 if (contextState == null) BRDPC.throwNPE("contextState"); 256 if (callbackBufferSize == null) BRDPC.throwNPE("callbackBufferSize"); 257 if (maxOutputChannelCount == null) BRDPC.throwNPE("maxOutputChannelCount"); 258 if (sampleRate == null) BRDPC.throwNPE("sampleRate"); 259 260 // Exception-Check(s) to ensure that if any parameters which must adhere to a 261 // provided List of Enumerated Values, fails, then IllegalArgumentException shall throw. 262 263 BRDPC.checkIAE("contextType", contextType, "WebAudio.ContextType", WebAudio.ContextType); 264 BRDPC.checkIAE("contextState", contextState, "WebAudio.ContextState", WebAudio.ContextState); 265 266 this.contextId = contextId; 267 this.contextType = contextType; 268 this.contextState = contextState; 269 this.realtimeData = realtimeData; 270 this.callbackBufferSize = callbackBufferSize; 271 this.maxOutputChannelCount = maxOutputChannelCount; 272 this.sampleRate = sampleRate; 273 } 274 275 /** 276 * JSON Object Constructor 277 * @param jo A Json-Object having data about an instance of {@code 'BaseAudioContext'}. 278 */ 279 public BaseAudioContext (JsonObject jo) 280 { 281 this.contextId = ReadJSON.getString(jo, "contextId", false, true); 282 this.contextType = ReadJSON.getString(jo, "contextType", false, true); 283 this.contextState = ReadJSON.getString(jo, "contextState", false, true); 284 this.realtimeData = ReadJSON.XL.getObject(jo, "realtimeData", WebAudio.ContextRealtimeData.class, true, false); 285 this.callbackBufferSize = ReadJSON.getNUMBER(jo, "callbackBufferSize", false, true); 286 this.maxOutputChannelCount = ReadJSON.getNUMBER(jo, "maxOutputChannelCount", false, true); 287 this.sampleRate = ReadJSON.getNUMBER(jo, "sampleRate", false, true); 288 } 289 290 } 291 292 /** Protocol object for AudioListener */ 293 public static class AudioListener extends BaseType 294 { 295 /** For Object Serialization. java.io.Serializable */ 296 protected static final long serialVersionUID = 1; 297 298 public boolean[] optionals() 299 { return new boolean[] { false, false, }; } 300 301 /** <CODE>[No Description Provided by Google]</CODE> */ 302 public final String listenerId; 303 304 /** <CODE>[No Description Provided by Google]</CODE> */ 305 public final String contextId; 306 307 /** 308 * Constructor 309 * 310 * @param listenerId - 311 * 312 * @param contextId - 313 */ 314 public AudioListener(String listenerId, String contextId) 315 { 316 // Exception-Check(s) to ensure that if any parameters which are not declared as 317 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 318 319 if (listenerId == null) BRDPC.throwNPE("listenerId"); 320 if (contextId == null) BRDPC.throwNPE("contextId"); 321 322 this.listenerId = listenerId; 323 this.contextId = contextId; 324 } 325 326 /** 327 * JSON Object Constructor 328 * @param jo A Json-Object having data about an instance of {@code 'AudioListener'}. 329 */ 330 public AudioListener (JsonObject jo) 331 { 332 this.listenerId = ReadJSON.getString(jo, "listenerId", false, true); 333 this.contextId = ReadJSON.getString(jo, "contextId", false, true); 334 } 335 336 } 337 338 /** Protocol object for AudioNode */ 339 public static class AudioNode extends BaseType 340 { 341 /** For Object Serialization. java.io.Serializable */ 342 protected static final long serialVersionUID = 1; 343 344 public boolean[] optionals() 345 { return new boolean[] { false, false, false, false, false, false, false, false, }; } 346 347 /** <CODE>[No Description Provided by Google]</CODE> */ 348 public final String nodeId; 349 350 /** <CODE>[No Description Provided by Google]</CODE> */ 351 public final String contextId; 352 353 /** <CODE>[No Description Provided by Google]</CODE> */ 354 public final String nodeType; 355 356 /** <CODE>[No Description Provided by Google]</CODE> */ 357 public final Number numberOfInputs; 358 359 /** <CODE>[No Description Provided by Google]</CODE> */ 360 public final Number numberOfOutputs; 361 362 /** <CODE>[No Description Provided by Google]</CODE> */ 363 public final Number channelCount; 364 365 /** <CODE>[No Description Provided by Google]</CODE> */ 366 public final String channelCountMode; 367 368 /** <CODE>[No Description Provided by Google]</CODE> */ 369 public final String channelInterpretation; 370 371 /** 372 * Constructor 373 * 374 * @param nodeId - 375 * 376 * @param contextId - 377 * 378 * @param nodeType - 379 * 380 * @param numberOfInputs - 381 * 382 * @param numberOfOutputs - 383 * 384 * @param channelCount - 385 * 386 * @param channelCountMode - 387 * 388 * @param channelInterpretation - 389 */ 390 public AudioNode( 391 String nodeId, String contextId, String nodeType, Number numberOfInputs, 392 Number numberOfOutputs, Number channelCount, String channelCountMode, 393 String channelInterpretation 394 ) 395 { 396 // Exception-Check(s) to ensure that if any parameters which are not declared as 397 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 398 399 if (nodeId == null) BRDPC.throwNPE("nodeId"); 400 if (contextId == null) BRDPC.throwNPE("contextId"); 401 if (nodeType == null) BRDPC.throwNPE("nodeType"); 402 if (numberOfInputs == null) BRDPC.throwNPE("numberOfInputs"); 403 if (numberOfOutputs == null) BRDPC.throwNPE("numberOfOutputs"); 404 if (channelCount == null) BRDPC.throwNPE("channelCount"); 405 if (channelCountMode == null) BRDPC.throwNPE("channelCountMode"); 406 if (channelInterpretation == null) BRDPC.throwNPE("channelInterpretation"); 407 408 // Exception-Check(s) to ensure that if any parameters which must adhere to a 409 // provided List of Enumerated Values, fails, then IllegalArgumentException shall throw. 410 411 BRDPC.checkIAE("channelCountMode", channelCountMode, "WebAudio.ChannelCountMode", WebAudio.ChannelCountMode); 412 BRDPC.checkIAE("channelInterpretation", channelInterpretation, "WebAudio.ChannelInterpretation", WebAudio.ChannelInterpretation); 413 414 this.nodeId = nodeId; 415 this.contextId = contextId; 416 this.nodeType = nodeType; 417 this.numberOfInputs = numberOfInputs; 418 this.numberOfOutputs = numberOfOutputs; 419 this.channelCount = channelCount; 420 this.channelCountMode = channelCountMode; 421 this.channelInterpretation = channelInterpretation; 422 } 423 424 /** 425 * JSON Object Constructor 426 * @param jo A Json-Object having data about an instance of {@code 'AudioNode'}. 427 */ 428 public AudioNode (JsonObject jo) 429 { 430 this.nodeId = ReadJSON.getString(jo, "nodeId", false, true); 431 this.contextId = ReadJSON.getString(jo, "contextId", false, true); 432 this.nodeType = ReadJSON.getString(jo, "nodeType", false, true); 433 this.numberOfInputs = ReadJSON.getNUMBER(jo, "numberOfInputs", false, true); 434 this.numberOfOutputs = ReadJSON.getNUMBER(jo, "numberOfOutputs", false, true); 435 this.channelCount = ReadJSON.getNUMBER(jo, "channelCount", false, true); 436 this.channelCountMode = ReadJSON.getString(jo, "channelCountMode", false, true); 437 this.channelInterpretation = ReadJSON.getString(jo, "channelInterpretation", false, true); 438 } 439 440 } 441 442 /** Protocol object for AudioParam */ 443 public static class AudioParam extends BaseType 444 { 445 /** For Object Serialization. java.io.Serializable */ 446 protected static final long serialVersionUID = 1; 447 448 public boolean[] optionals() 449 { return new boolean[] { false, false, false, false, false, false, false, false, }; } 450 451 /** <CODE>[No Description Provided by Google]</CODE> */ 452 public final String paramId; 453 454 /** <CODE>[No Description Provided by Google]</CODE> */ 455 public final String nodeId; 456 457 /** <CODE>[No Description Provided by Google]</CODE> */ 458 public final String contextId; 459 460 /** <CODE>[No Description Provided by Google]</CODE> */ 461 public final String paramType; 462 463 /** <CODE>[No Description Provided by Google]</CODE> */ 464 public final String rate; 465 466 /** <CODE>[No Description Provided by Google]</CODE> */ 467 public final Number defaultValue; 468 469 /** <CODE>[No Description Provided by Google]</CODE> */ 470 public final Number minValue; 471 472 /** <CODE>[No Description Provided by Google]</CODE> */ 473 public final Number maxValue; 474 475 /** 476 * Constructor 477 * 478 * @param paramId - 479 * 480 * @param nodeId - 481 * 482 * @param contextId - 483 * 484 * @param paramType - 485 * 486 * @param rate - 487 * 488 * @param defaultValue - 489 * 490 * @param minValue - 491 * 492 * @param maxValue - 493 */ 494 public AudioParam( 495 String paramId, String nodeId, String contextId, String paramType, String rate, 496 Number defaultValue, Number minValue, Number maxValue 497 ) 498 { 499 // Exception-Check(s) to ensure that if any parameters which are not declared as 500 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 501 502 if (paramId == null) BRDPC.throwNPE("paramId"); 503 if (nodeId == null) BRDPC.throwNPE("nodeId"); 504 if (contextId == null) BRDPC.throwNPE("contextId"); 505 if (paramType == null) BRDPC.throwNPE("paramType"); 506 if (rate == null) BRDPC.throwNPE("rate"); 507 if (defaultValue == null) BRDPC.throwNPE("defaultValue"); 508 if (minValue == null) BRDPC.throwNPE("minValue"); 509 if (maxValue == null) BRDPC.throwNPE("maxValue"); 510 511 // Exception-Check(s) to ensure that if any parameters which must adhere to a 512 // provided List of Enumerated Values, fails, then IllegalArgumentException shall throw. 513 514 BRDPC.checkIAE("rate", rate, "WebAudio.AutomationRate", WebAudio.AutomationRate); 515 516 this.paramId = paramId; 517 this.nodeId = nodeId; 518 this.contextId = contextId; 519 this.paramType = paramType; 520 this.rate = rate; 521 this.defaultValue = defaultValue; 522 this.minValue = minValue; 523 this.maxValue = maxValue; 524 } 525 526 /** 527 * JSON Object Constructor 528 * @param jo A Json-Object having data about an instance of {@code 'AudioParam'}. 529 */ 530 public AudioParam (JsonObject jo) 531 { 532 this.paramId = ReadJSON.getString(jo, "paramId", false, true); 533 this.nodeId = ReadJSON.getString(jo, "nodeId", false, true); 534 this.contextId = ReadJSON.getString(jo, "contextId", false, true); 535 this.paramType = ReadJSON.getString(jo, "paramType", false, true); 536 this.rate = ReadJSON.getString(jo, "rate", false, true); 537 this.defaultValue = ReadJSON.getNUMBER(jo, "defaultValue", false, true); 538 this.minValue = ReadJSON.getNUMBER(jo, "minValue", false, true); 539 this.maxValue = ReadJSON.getNUMBER(jo, "maxValue", false, true); 540 } 541 542 } 543 544 /** Notifies that a new BaseAudioContext has been created. */ 545 public static class contextCreated extends BrowserEvent 546 { 547 /** For Object Serialization. java.io.Serializable */ 548 protected static final long serialVersionUID = 1; 549 550 public boolean[] optionals() 551 { return new boolean[] { false, }; } 552 553 /** <CODE>[No Description Provided by Google]</CODE> */ 554 public final WebAudio.BaseAudioContext context; 555 556 /** 557 * Constructor 558 * 559 * @param context - 560 */ 561 public contextCreated(WebAudio.BaseAudioContext context) 562 { 563 super("WebAudio", "contextCreated", 1); 564 565 // Exception-Check(s) to ensure that if any parameters which are not declared as 566 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 567 568 if (context == null) BRDPC.throwNPE("context"); 569 570 this.context = context; 571 } 572 573 /** 574 * JSON Object Constructor 575 * @param jo A Json-Object having data about an instance of {@code 'contextCreated'}. 576 */ 577 public contextCreated (JsonObject jo) 578 { 579 super("WebAudio", "contextCreated", 1); 580 581 this.context = ReadJSON.XL.getObject(jo, "context", WebAudio.BaseAudioContext.class, false, true); 582 } 583 584 } 585 586 /** Notifies that an existing BaseAudioContext will be destroyed. */ 587 public static class contextWillBeDestroyed extends BrowserEvent 588 { 589 /** For Object Serialization. java.io.Serializable */ 590 protected static final long serialVersionUID = 1; 591 592 public boolean[] optionals() 593 { return new boolean[] { false, }; } 594 595 /** <CODE>[No Description Provided by Google]</CODE> */ 596 public final String contextId; 597 598 /** 599 * Constructor 600 * 601 * @param contextId - 602 */ 603 public contextWillBeDestroyed(String contextId) 604 { 605 super("WebAudio", "contextWillBeDestroyed", 1); 606 607 // Exception-Check(s) to ensure that if any parameters which are not declared as 608 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 609 610 if (contextId == null) BRDPC.throwNPE("contextId"); 611 612 this.contextId = contextId; 613 } 614 615 /** 616 * JSON Object Constructor 617 * @param jo A Json-Object having data about an instance of {@code 'contextWillBeDestroyed'}. 618 */ 619 public contextWillBeDestroyed (JsonObject jo) 620 { 621 super("WebAudio", "contextWillBeDestroyed", 1); 622 623 this.contextId = ReadJSON.getString(jo, "contextId", false, true); 624 } 625 626 } 627 628 /** Notifies that existing BaseAudioContext has changed some properties (id stays the same).. */ 629 public static class contextChanged extends BrowserEvent 630 { 631 /** For Object Serialization. java.io.Serializable */ 632 protected static final long serialVersionUID = 1; 633 634 public boolean[] optionals() 635 { return new boolean[] { false, }; } 636 637 /** <CODE>[No Description Provided by Google]</CODE> */ 638 public final WebAudio.BaseAudioContext context; 639 640 /** 641 * Constructor 642 * 643 * @param context - 644 */ 645 public contextChanged(WebAudio.BaseAudioContext context) 646 { 647 super("WebAudio", "contextChanged", 1); 648 649 // Exception-Check(s) to ensure that if any parameters which are not declared as 650 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 651 652 if (context == null) BRDPC.throwNPE("context"); 653 654 this.context = context; 655 } 656 657 /** 658 * JSON Object Constructor 659 * @param jo A Json-Object having data about an instance of {@code 'contextChanged'}. 660 */ 661 public contextChanged (JsonObject jo) 662 { 663 super("WebAudio", "contextChanged", 1); 664 665 this.context = ReadJSON.XL.getObject(jo, "context", WebAudio.BaseAudioContext.class, false, true); 666 } 667 668 } 669 670 /** Notifies that the construction of an AudioListener has finished. */ 671 public static class audioListenerCreated extends BrowserEvent 672 { 673 /** For Object Serialization. java.io.Serializable */ 674 protected static final long serialVersionUID = 1; 675 676 public boolean[] optionals() 677 { return new boolean[] { false, }; } 678 679 /** <CODE>[No Description Provided by Google]</CODE> */ 680 public final WebAudio.AudioListener listener; 681 682 /** 683 * Constructor 684 * 685 * @param listener - 686 */ 687 public audioListenerCreated(WebAudio.AudioListener listener) 688 { 689 super("WebAudio", "audioListenerCreated", 1); 690 691 // Exception-Check(s) to ensure that if any parameters which are not declared as 692 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 693 694 if (listener == null) BRDPC.throwNPE("listener"); 695 696 this.listener = listener; 697 } 698 699 /** 700 * JSON Object Constructor 701 * @param jo A Json-Object having data about an instance of {@code 'audioListenerCreated'}. 702 */ 703 public audioListenerCreated (JsonObject jo) 704 { 705 super("WebAudio", "audioListenerCreated", 1); 706 707 this.listener = ReadJSON.XL.getObject(jo, "listener", WebAudio.AudioListener.class, false, true); 708 } 709 710 } 711 712 /** Notifies that a new AudioListener has been created. */ 713 public static class audioListenerWillBeDestroyed extends BrowserEvent 714 { 715 /** For Object Serialization. java.io.Serializable */ 716 protected static final long serialVersionUID = 1; 717 718 public boolean[] optionals() 719 { return new boolean[] { false, false, }; } 720 721 /** <CODE>[No Description Provided by Google]</CODE> */ 722 public final String contextId; 723 724 /** <CODE>[No Description Provided by Google]</CODE> */ 725 public final String listenerId; 726 727 /** 728 * Constructor 729 * 730 * @param contextId - 731 * 732 * @param listenerId - 733 */ 734 public audioListenerWillBeDestroyed(String contextId, String listenerId) 735 { 736 super("WebAudio", "audioListenerWillBeDestroyed", 2); 737 738 // Exception-Check(s) to ensure that if any parameters which are not declared as 739 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 740 741 if (contextId == null) BRDPC.throwNPE("contextId"); 742 if (listenerId == null) BRDPC.throwNPE("listenerId"); 743 744 this.contextId = contextId; 745 this.listenerId = listenerId; 746 } 747 748 /** 749 * JSON Object Constructor 750 * @param jo A Json-Object having data about an instance of {@code 'audioListenerWillBeDestroyed'}. 751 */ 752 public audioListenerWillBeDestroyed (JsonObject jo) 753 { 754 super("WebAudio", "audioListenerWillBeDestroyed", 2); 755 756 this.contextId = ReadJSON.getString(jo, "contextId", false, true); 757 this.listenerId = ReadJSON.getString(jo, "listenerId", false, true); 758 } 759 760 } 761 762 /** Notifies that a new AudioNode has been created. */ 763 public static class audioNodeCreated extends BrowserEvent 764 { 765 /** For Object Serialization. java.io.Serializable */ 766 protected static final long serialVersionUID = 1; 767 768 public boolean[] optionals() 769 { return new boolean[] { false, }; } 770 771 /** <CODE>[No Description Provided by Google]</CODE> */ 772 public final WebAudio.AudioNode node; 773 774 /** 775 * Constructor 776 * 777 * @param node - 778 */ 779 public audioNodeCreated(WebAudio.AudioNode node) 780 { 781 super("WebAudio", "audioNodeCreated", 1); 782 783 // Exception-Check(s) to ensure that if any parameters which are not declared as 784 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 785 786 if (node == null) BRDPC.throwNPE("node"); 787 788 this.node = node; 789 } 790 791 /** 792 * JSON Object Constructor 793 * @param jo A Json-Object having data about an instance of {@code 'audioNodeCreated'}. 794 */ 795 public audioNodeCreated (JsonObject jo) 796 { 797 super("WebAudio", "audioNodeCreated", 1); 798 799 this.node = ReadJSON.XL.getObject(jo, "node", WebAudio.AudioNode.class, false, true); 800 } 801 802 } 803 804 /** Notifies that an existing AudioNode has been destroyed. */ 805 public static class audioNodeWillBeDestroyed extends BrowserEvent 806 { 807 /** For Object Serialization. java.io.Serializable */ 808 protected static final long serialVersionUID = 1; 809 810 public boolean[] optionals() 811 { return new boolean[] { false, false, }; } 812 813 /** <CODE>[No Description Provided by Google]</CODE> */ 814 public final String contextId; 815 816 /** <CODE>[No Description Provided by Google]</CODE> */ 817 public final String nodeId; 818 819 /** 820 * Constructor 821 * 822 * @param contextId - 823 * 824 * @param nodeId - 825 */ 826 public audioNodeWillBeDestroyed(String contextId, String nodeId) 827 { 828 super("WebAudio", "audioNodeWillBeDestroyed", 2); 829 830 // Exception-Check(s) to ensure that if any parameters which are not declared as 831 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 832 833 if (contextId == null) BRDPC.throwNPE("contextId"); 834 if (nodeId == null) BRDPC.throwNPE("nodeId"); 835 836 this.contextId = contextId; 837 this.nodeId = nodeId; 838 } 839 840 /** 841 * JSON Object Constructor 842 * @param jo A Json-Object having data about an instance of {@code 'audioNodeWillBeDestroyed'}. 843 */ 844 public audioNodeWillBeDestroyed (JsonObject jo) 845 { 846 super("WebAudio", "audioNodeWillBeDestroyed", 2); 847 848 this.contextId = ReadJSON.getString(jo, "contextId", false, true); 849 this.nodeId = ReadJSON.getString(jo, "nodeId", false, true); 850 } 851 852 } 853 854 /** Notifies that a new AudioParam has been created. */ 855 public static class audioParamCreated extends BrowserEvent 856 { 857 /** For Object Serialization. java.io.Serializable */ 858 protected static final long serialVersionUID = 1; 859 860 public boolean[] optionals() 861 { return new boolean[] { false, }; } 862 863 /** <CODE>[No Description Provided by Google]</CODE> */ 864 public final WebAudio.AudioParam param; 865 866 /** 867 * Constructor 868 * 869 * @param param - 870 */ 871 public audioParamCreated(WebAudio.AudioParam param) 872 { 873 super("WebAudio", "audioParamCreated", 1); 874 875 // Exception-Check(s) to ensure that if any parameters which are not declared as 876 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 877 878 if (param == null) BRDPC.throwNPE("param"); 879 880 this.param = param; 881 } 882 883 /** 884 * JSON Object Constructor 885 * @param jo A Json-Object having data about an instance of {@code 'audioParamCreated'}. 886 */ 887 public audioParamCreated (JsonObject jo) 888 { 889 super("WebAudio", "audioParamCreated", 1); 890 891 this.param = ReadJSON.XL.getObject(jo, "param", WebAudio.AudioParam.class, false, true); 892 } 893 894 } 895 896 /** Notifies that an existing AudioParam has been destroyed. */ 897 public static class audioParamWillBeDestroyed extends BrowserEvent 898 { 899 /** For Object Serialization. java.io.Serializable */ 900 protected static final long serialVersionUID = 1; 901 902 public boolean[] optionals() 903 { return new boolean[] { false, false, false, }; } 904 905 /** <CODE>[No Description Provided by Google]</CODE> */ 906 public final String contextId; 907 908 /** <CODE>[No Description Provided by Google]</CODE> */ 909 public final String nodeId; 910 911 /** <CODE>[No Description Provided by Google]</CODE> */ 912 public final String paramId; 913 914 /** 915 * Constructor 916 * 917 * @param contextId - 918 * 919 * @param nodeId - 920 * 921 * @param paramId - 922 */ 923 public audioParamWillBeDestroyed(String contextId, String nodeId, String paramId) 924 { 925 super("WebAudio", "audioParamWillBeDestroyed", 3); 926 927 // Exception-Check(s) to ensure that if any parameters which are not declared as 928 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 929 930 if (contextId == null) BRDPC.throwNPE("contextId"); 931 if (nodeId == null) BRDPC.throwNPE("nodeId"); 932 if (paramId == null) BRDPC.throwNPE("paramId"); 933 934 this.contextId = contextId; 935 this.nodeId = nodeId; 936 this.paramId = paramId; 937 } 938 939 /** 940 * JSON Object Constructor 941 * @param jo A Json-Object having data about an instance of {@code 'audioParamWillBeDestroyed'}. 942 */ 943 public audioParamWillBeDestroyed (JsonObject jo) 944 { 945 super("WebAudio", "audioParamWillBeDestroyed", 3); 946 947 this.contextId = ReadJSON.getString(jo, "contextId", false, true); 948 this.nodeId = ReadJSON.getString(jo, "nodeId", false, true); 949 this.paramId = ReadJSON.getString(jo, "paramId", false, true); 950 } 951 952 } 953 954 /** Notifies that two AudioNodes are connected. */ 955 public static class nodesConnected extends BrowserEvent 956 { 957 /** For Object Serialization. java.io.Serializable */ 958 protected static final long serialVersionUID = 1; 959 960 public boolean[] optionals() 961 { return new boolean[] { false, false, false, true, true, }; } 962 963 /** <CODE>[No Description Provided by Google]</CODE> */ 964 public final String contextId; 965 966 /** <CODE>[No Description Provided by Google]</CODE> */ 967 public final String sourceId; 968 969 /** <CODE>[No Description Provided by Google]</CODE> */ 970 public final String destinationId; 971 972 /** 973 * <CODE>[No Description Provided by Google]</CODE> 974 * <BR /> 975 * <BR /><B>OPTIONAL</B> 976 */ 977 public final Number sourceOutputIndex; 978 979 /** 980 * <CODE>[No Description Provided by Google]</CODE> 981 * <BR /> 982 * <BR /><B>OPTIONAL</B> 983 */ 984 public final Number destinationInputIndex; 985 986 /** 987 * Constructor 988 * 989 * @param contextId - 990 * 991 * @param sourceId - 992 * 993 * @param destinationId - 994 * 995 * @param sourceOutputIndex - 996 * <BR /><B>OPTIONAL</B> 997 * 998 * @param destinationInputIndex - 999 * <BR /><B>OPTIONAL</B> 1000 */ 1001 public nodesConnected( 1002 String contextId, String sourceId, String destinationId, Number sourceOutputIndex, 1003 Number destinationInputIndex 1004 ) 1005 { 1006 super("WebAudio", "nodesConnected", 5); 1007 1008 // Exception-Check(s) to ensure that if any parameters which are not declared as 1009 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 1010 1011 if (contextId == null) BRDPC.throwNPE("contextId"); 1012 if (sourceId == null) BRDPC.throwNPE("sourceId"); 1013 if (destinationId == null) BRDPC.throwNPE("destinationId"); 1014 1015 this.contextId = contextId; 1016 this.sourceId = sourceId; 1017 this.destinationId = destinationId; 1018 this.sourceOutputIndex = sourceOutputIndex; 1019 this.destinationInputIndex = destinationInputIndex; 1020 } 1021 1022 /** 1023 * JSON Object Constructor 1024 * @param jo A Json-Object having data about an instance of {@code 'nodesConnected'}. 1025 */ 1026 public nodesConnected (JsonObject jo) 1027 { 1028 super("WebAudio", "nodesConnected", 5); 1029 1030 this.contextId = ReadJSON.getString(jo, "contextId", false, true); 1031 this.sourceId = ReadJSON.getString(jo, "sourceId", false, true); 1032 this.destinationId = ReadJSON.getString(jo, "destinationId", false, true); 1033 this.sourceOutputIndex = ReadJSON.getNUMBER(jo, "sourceOutputIndex", true, false); 1034 this.destinationInputIndex = ReadJSON.getNUMBER(jo, "destinationInputIndex", true, false); 1035 } 1036 1037 } 1038 1039 /** Notifies that AudioNodes are disconnected. The destination can be null, and it means all the outgoing connections from the source are disconnected. */ 1040 public static class nodesDisconnected extends BrowserEvent 1041 { 1042 /** For Object Serialization. java.io.Serializable */ 1043 protected static final long serialVersionUID = 1; 1044 1045 public boolean[] optionals() 1046 { return new boolean[] { false, false, false, true, true, }; } 1047 1048 /** <CODE>[No Description Provided by Google]</CODE> */ 1049 public final String contextId; 1050 1051 /** <CODE>[No Description Provided by Google]</CODE> */ 1052 public final String sourceId; 1053 1054 /** <CODE>[No Description Provided by Google]</CODE> */ 1055 public final String destinationId; 1056 1057 /** 1058 * <CODE>[No Description Provided by Google]</CODE> 1059 * <BR /> 1060 * <BR /><B>OPTIONAL</B> 1061 */ 1062 public final Number sourceOutputIndex; 1063 1064 /** 1065 * <CODE>[No Description Provided by Google]</CODE> 1066 * <BR /> 1067 * <BR /><B>OPTIONAL</B> 1068 */ 1069 public final Number destinationInputIndex; 1070 1071 /** 1072 * Constructor 1073 * 1074 * @param contextId - 1075 * 1076 * @param sourceId - 1077 * 1078 * @param destinationId - 1079 * 1080 * @param sourceOutputIndex - 1081 * <BR /><B>OPTIONAL</B> 1082 * 1083 * @param destinationInputIndex - 1084 * <BR /><B>OPTIONAL</B> 1085 */ 1086 public nodesDisconnected( 1087 String contextId, String sourceId, String destinationId, Number sourceOutputIndex, 1088 Number destinationInputIndex 1089 ) 1090 { 1091 super("WebAudio", "nodesDisconnected", 5); 1092 1093 // Exception-Check(s) to ensure that if any parameters which are not declared as 1094 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 1095 1096 if (contextId == null) BRDPC.throwNPE("contextId"); 1097 if (sourceId == null) BRDPC.throwNPE("sourceId"); 1098 if (destinationId == null) BRDPC.throwNPE("destinationId"); 1099 1100 this.contextId = contextId; 1101 this.sourceId = sourceId; 1102 this.destinationId = destinationId; 1103 this.sourceOutputIndex = sourceOutputIndex; 1104 this.destinationInputIndex = destinationInputIndex; 1105 } 1106 1107 /** 1108 * JSON Object Constructor 1109 * @param jo A Json-Object having data about an instance of {@code 'nodesDisconnected'}. 1110 */ 1111 public nodesDisconnected (JsonObject jo) 1112 { 1113 super("WebAudio", "nodesDisconnected", 5); 1114 1115 this.contextId = ReadJSON.getString(jo, "contextId", false, true); 1116 this.sourceId = ReadJSON.getString(jo, "sourceId", false, true); 1117 this.destinationId = ReadJSON.getString(jo, "destinationId", false, true); 1118 this.sourceOutputIndex = ReadJSON.getNUMBER(jo, "sourceOutputIndex", true, false); 1119 this.destinationInputIndex = ReadJSON.getNUMBER(jo, "destinationInputIndex", true, false); 1120 } 1121 1122 } 1123 1124 /** Notifies that an AudioNode is connected to an AudioParam. */ 1125 public static class nodeParamConnected extends BrowserEvent 1126 { 1127 /** For Object Serialization. java.io.Serializable */ 1128 protected static final long serialVersionUID = 1; 1129 1130 public boolean[] optionals() 1131 { return new boolean[] { false, false, false, true, }; } 1132 1133 /** <CODE>[No Description Provided by Google]</CODE> */ 1134 public final String contextId; 1135 1136 /** <CODE>[No Description Provided by Google]</CODE> */ 1137 public final String sourceId; 1138 1139 /** <CODE>[No Description Provided by Google]</CODE> */ 1140 public final String destinationId; 1141 1142 /** 1143 * <CODE>[No Description Provided by Google]</CODE> 1144 * <BR /> 1145 * <BR /><B>OPTIONAL</B> 1146 */ 1147 public final Number sourceOutputIndex; 1148 1149 /** 1150 * Constructor 1151 * 1152 * @param contextId - 1153 * 1154 * @param sourceId - 1155 * 1156 * @param destinationId - 1157 * 1158 * @param sourceOutputIndex - 1159 * <BR /><B>OPTIONAL</B> 1160 */ 1161 public nodeParamConnected 1162 (String contextId, String sourceId, String destinationId, Number sourceOutputIndex) 1163 { 1164 super("WebAudio", "nodeParamConnected", 4); 1165 1166 // Exception-Check(s) to ensure that if any parameters which are not declared as 1167 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 1168 1169 if (contextId == null) BRDPC.throwNPE("contextId"); 1170 if (sourceId == null) BRDPC.throwNPE("sourceId"); 1171 if (destinationId == null) BRDPC.throwNPE("destinationId"); 1172 1173 this.contextId = contextId; 1174 this.sourceId = sourceId; 1175 this.destinationId = destinationId; 1176 this.sourceOutputIndex = sourceOutputIndex; 1177 } 1178 1179 /** 1180 * JSON Object Constructor 1181 * @param jo A Json-Object having data about an instance of {@code 'nodeParamConnected'}. 1182 */ 1183 public nodeParamConnected (JsonObject jo) 1184 { 1185 super("WebAudio", "nodeParamConnected", 4); 1186 1187 this.contextId = ReadJSON.getString(jo, "contextId", false, true); 1188 this.sourceId = ReadJSON.getString(jo, "sourceId", false, true); 1189 this.destinationId = ReadJSON.getString(jo, "destinationId", false, true); 1190 this.sourceOutputIndex = ReadJSON.getNUMBER(jo, "sourceOutputIndex", true, false); 1191 } 1192 1193 } 1194 1195 /** Notifies that an AudioNode is disconnected to an AudioParam. */ 1196 public static class nodeParamDisconnected extends BrowserEvent 1197 { 1198 /** For Object Serialization. java.io.Serializable */ 1199 protected static final long serialVersionUID = 1; 1200 1201 public boolean[] optionals() 1202 { return new boolean[] { false, false, false, true, }; } 1203 1204 /** <CODE>[No Description Provided by Google]</CODE> */ 1205 public final String contextId; 1206 1207 /** <CODE>[No Description Provided by Google]</CODE> */ 1208 public final String sourceId; 1209 1210 /** <CODE>[No Description Provided by Google]</CODE> */ 1211 public final String destinationId; 1212 1213 /** 1214 * <CODE>[No Description Provided by Google]</CODE> 1215 * <BR /> 1216 * <BR /><B>OPTIONAL</B> 1217 */ 1218 public final Number sourceOutputIndex; 1219 1220 /** 1221 * Constructor 1222 * 1223 * @param contextId - 1224 * 1225 * @param sourceId - 1226 * 1227 * @param destinationId - 1228 * 1229 * @param sourceOutputIndex - 1230 * <BR /><B>OPTIONAL</B> 1231 */ 1232 public nodeParamDisconnected 1233 (String contextId, String sourceId, String destinationId, Number sourceOutputIndex) 1234 { 1235 super("WebAudio", "nodeParamDisconnected", 4); 1236 1237 // Exception-Check(s) to ensure that if any parameters which are not declared as 1238 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 1239 1240 if (contextId == null) BRDPC.throwNPE("contextId"); 1241 if (sourceId == null) BRDPC.throwNPE("sourceId"); 1242 if (destinationId == null) BRDPC.throwNPE("destinationId"); 1243 1244 this.contextId = contextId; 1245 this.sourceId = sourceId; 1246 this.destinationId = destinationId; 1247 this.sourceOutputIndex = sourceOutputIndex; 1248 } 1249 1250 /** 1251 * JSON Object Constructor 1252 * @param jo A Json-Object having data about an instance of {@code 'nodeParamDisconnected'}. 1253 */ 1254 public nodeParamDisconnected (JsonObject jo) 1255 { 1256 super("WebAudio", "nodeParamDisconnected", 4); 1257 1258 this.contextId = ReadJSON.getString(jo, "contextId", false, true); 1259 this.sourceId = ReadJSON.getString(jo, "sourceId", false, true); 1260 this.destinationId = ReadJSON.getString(jo, "destinationId", false, true); 1261 this.sourceOutputIndex = ReadJSON.getNUMBER(jo, "sourceOutputIndex", true, false); 1262 } 1263 1264 } 1265 1266 1267 // Counter for keeping the WebSocket Request ID's distinct. 1268 private static int counter = 1; 1269 1270 /** 1271 * Enables the WebAudio domain and starts sending context lifetime events. 1272 * 1273 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 1274 * {@link Ret0}></CODE> 1275 * 1276 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 1277 * browser receives the invocation-request. 1278 * 1279 * <BR /><BR />This Browser-Function <I>does not have</I> a return-value. You may choose to 1280 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0} 1281 * {@code >} to ensure the Browser Function has run to completion. 1282 */ 1283 public static Script<String, JsonObject, Ret0> enable() 1284 { 1285 final int webSocketID = 43000000 + counter++; 1286 final boolean[] optionals = new boolean[0]; 1287 1288 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 1289 String requestJSON = WriteJSON.get( 1290 parameterTypes.get("enable"), 1291 parameterNames.get("enable"), 1292 optionals, webSocketID, 1293 "WebAudio.enable" 1294 ); 1295 1296 // This Remote Command does not have a Return-Value. 1297 return new Script<> 1298 (BRDPC.defaultSender, webSocketID, requestJSON, BRDPC.NoReturnValues); 1299 } 1300 1301 /** 1302 * Disables the WebAudio domain. 1303 * 1304 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 1305 * {@link Ret0}></CODE> 1306 * 1307 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 1308 * browser receives the invocation-request. 1309 * 1310 * <BR /><BR />This Browser-Function <I>does not have</I> a return-value. You may choose to 1311 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0} 1312 * {@code >} to ensure the Browser Function has run to completion. 1313 */ 1314 public static Script<String, JsonObject, Ret0> disable() 1315 { 1316 final int webSocketID = 43001000 + counter++; 1317 final boolean[] optionals = new boolean[0]; 1318 1319 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 1320 String requestJSON = WriteJSON.get( 1321 parameterTypes.get("disable"), 1322 parameterNames.get("disable"), 1323 optionals, webSocketID, 1324 "WebAudio.disable" 1325 ); 1326 1327 // This Remote Command does not have a Return-Value. 1328 return new Script<> 1329 (BRDPC.defaultSender, webSocketID, requestJSON, BRDPC.NoReturnValues); 1330 } 1331 1332 /** 1333 * Fetch the realtime data from the registered contexts. 1334 * 1335 * @param contextId - 1336 * 1337 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 1338 * {@link WebAudio.ContextRealtimeData}></CODE> 1339 * 1340 * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using 1341 * {@link Script#exec()}, and afterwards, a {@link Promise}<CODE><JsonObject, 1342 * {@link WebAudio.ContextRealtimeData}></CODE> will be returned. 1343 * 1344 * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>, 1345 * using {@link Promise#await()}, <I>and the returned result of this Browser Function may 1346 * may be retrieved.</I> 1347 * 1348 * <BR /><BR />This Browser Function <B STYLE='color: red'>returns</B> 1349 * <BR /><BR /><UL CLASS=JDUL> 1350 * <LI><CODE>{@link WebAudio.ContextRealtimeData} (<B>realtimeData</B></CODE>) 1351 * <BR />- 1352 * </LI> 1353 * </UL> */ 1354 public static Script<String, JsonObject, WebAudio.ContextRealtimeData> getRealtimeData 1355 (String contextId) 1356 { 1357 // Exception-Check(s) to ensure that if any parameters which are not declared as 1358 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 1359 1360 if (contextId == null) BRDPC.throwNPE("contextId"); 1361 1362 final int webSocketID = 43002000 + counter++; 1363 final boolean[] optionals = { false, }; 1364 1365 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 1366 String requestJSON = WriteJSON.get( 1367 parameterTypes.get("getRealtimeData"), 1368 parameterNames.get("getRealtimeData"), 1369 optionals, webSocketID, 1370 "WebAudio.getRealtimeData", 1371 contextId 1372 ); 1373 1374 // 'JSON Binding' ... Converts Browser Response-JSON to 'WebAudio.ContextRealtimeData' 1375 Function<JsonObject, WebAudio.ContextRealtimeData> responseProcessor = (JsonObject jo) -> 1376 ReadJSON.XL.getObject(jo, "realtimeData", WebAudio.ContextRealtimeData.class, false, true); 1377 1378 // Pass the 'defaultSender' to Script-Constructor 1379 // The sender that is used can be changed before executing script. 1380 return new Script<>(BRDPC.defaultSender, webSocketID, requestJSON, responseProcessor); 1381 } 1382 1383}