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.*; 013import Torello.Java.JSON.*; 014 015import static Torello.Java.JSON.JFlag.*; 016 017import Torello.Java.StrCmpr; 018import Torello.JavaDoc.StaticFunctional; 019import Torello.JavaDoc.JDHeaderBackgroundImg; 020import Torello.JavaDoc.Excuse; 021 022/** 023 * <SPAN CLASS=COPIEDJDK><B>This domain allows inspection of Web Audio API. 024 * https://webaudio.github.io/web-audio-api/</B></SPAN> 025 * 026 * <EMBED CLASS='external-html' DATA-FILE-ID=CODE_GEN_NOTE> 027 */ 028@StaticFunctional(Excused={"counter"}, Excuses={Excuse.CONFIGURATION}) 029@JDHeaderBackgroundImg(EmbedTagFileID="WOOD_PLANK_NOTE") 030public class WebAudio 031{ 032 // ******************************************************************************************** 033 // ******************************************************************************************** 034 // Class Header Stuff 035 // ******************************************************************************************** 036 // ******************************************************************************************** 037 038 039 // No Pubic Constructors 040 private WebAudio () { } 041 042 // These two Vector's are used by all the "Methods" exported by this class. java.lang.reflect 043 // is used to generate the JSON String's. It saves thousands of lines of Auto-Generated Code. 044 private static final Map<String, Vector<String>> parameterNames = new HashMap<>(); 045 private static final Map<String, Vector<Class<?>>> parameterTypes = new HashMap<>(); 046 047 // Some Methods do not take any parameters - for instance all the "enable()" and "disable()" 048 // I simply could not get ride of RAW-TYPES and UNCHECKED warnings... so there are now, 049 // offically, two empty-vectors. One for String's, and the other for Classes. 050 051 private static final Vector<String> EMPTY_VEC_STR = new Vector<>(); 052 private static final Vector<Class<?>> EMPTY_VEC_CLASS = new Vector<>(); 053 054 static 055 { 056 for (Method m : WebAudio.class.getMethods()) 057 { 058 // This doesn't work! The parameter names are all "arg0" ... "argN" 059 // It works for java.lang.reflect.Field, BUT NOT java.lang.reflect.Parameter! 060 // 061 // Vector<String> parameterNamesList = new Vector<>(); -- NOPE! 062 063 Vector<Class<?>> parameterTypesList = new Vector<>(); 064 065 for (Parameter p : m.getParameters()) parameterTypesList.add(p.getType()); 066 067 parameterTypes.put( 068 m.getName(), 069 (parameterTypesList.size() > 0) ? parameterTypesList : EMPTY_VEC_CLASS 070 ); 071 } 072 } 073 074 static 075 { 076 Vector<String> v = null; 077 078 parameterNames.put("enable", EMPTY_VEC_STR); 079 080 parameterNames.put("disable", EMPTY_VEC_STR); 081 082 v = new Vector<String>(1); 083 parameterNames.put("getRealtimeData", v); 084 Collections.addAll(v, new String[] 085 { "contextId", }); 086 } 087 088 089 // ******************************************************************************************** 090 // ******************************************************************************************** 091 // Types - Static Inner Classes 092 // ******************************************************************************************** 093 // ******************************************************************************************** 094 095 // public static class GraphObjectId => String 096 097 // public static class NodeType => String 098 099 // public static class ParamType => String 100 101 /** Enum of BaseAudioContext types */ 102 public static final String[] ContextType = 103 { "realtime", "offline", }; 104 105 /** Enum of AudioContextState from the spec */ 106 public static final String[] ContextState = 107 { "suspended", "running", "closed", }; 108 109 /** Enum of AudioNode::ChannelCountMode from the spec */ 110 public static final String[] ChannelCountMode = 111 { "clamped-max", "explicit", "max", }; 112 113 /** Enum of AudioNode::ChannelInterpretation from the spec */ 114 public static final String[] ChannelInterpretation = 115 { "discrete", "speakers", }; 116 117 /** Enum of AudioParam::AutomationRate from the spec */ 118 public static final String[] AutomationRate = 119 { "a-rate", "k-rate", }; 120 121 /** Fields in AudioContext that change in real-time. */ 122 public static class ContextRealtimeData 123 extends BaseType 124 implements java.io.Serializable 125 { 126 /** For Object Serialization. java.io.Serializable */ 127 protected static final long serialVersionUID = 1; 128 129 public boolean[] optionals() 130 { return new boolean[] { false, false, false, false, }; } 131 132 /** The current context time in second in BaseAudioContext. */ 133 public final Number currentTime; 134 135 /** 136 * The time spent on rendering graph divided by render quantum duration, 137 * and multiplied by 100. 100 means the audio renderer reached the full 138 * capacity and glitch may occur. 139 */ 140 public final Number renderCapacity; 141 142 /** A running mean of callback interval. */ 143 public final Number callbackIntervalMean; 144 145 /** A running variance of callback interval. */ 146 public final Number callbackIntervalVariance; 147 148 /** 149 * Constructor 150 * 151 * @param currentTime The current context time in second in BaseAudioContext. 152 * 153 * @param renderCapacity 154 * The time spent on rendering graph divided by render quantum duration, 155 * and multiplied by 100. 100 means the audio renderer reached the full 156 * capacity and glitch may occur. 157 * 158 * @param callbackIntervalMean A running mean of callback interval. 159 * 160 * @param callbackIntervalVariance A running variance of callback interval. 161 */ 162 public ContextRealtimeData( 163 Number currentTime, Number renderCapacity, Number callbackIntervalMean, 164 Number callbackIntervalVariance 165 ) 166 { 167 // Exception-Check(s) to ensure that if any parameters which are not declared as 168 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 169 170 if (currentTime == null) THROWS.throwNPE("currentTime"); 171 if (renderCapacity == null) THROWS.throwNPE("renderCapacity"); 172 if (callbackIntervalMean == null) THROWS.throwNPE("callbackIntervalMean"); 173 if (callbackIntervalVariance == null) THROWS.throwNPE("callbackIntervalVariance"); 174 175 this.currentTime = currentTime; 176 this.renderCapacity = renderCapacity; 177 this.callbackIntervalMean = callbackIntervalMean; 178 this.callbackIntervalVariance = callbackIntervalVariance; 179 } 180 181 /** 182 * JSON Object Constructor 183 * @param jo A Json-Object having data about an instance of {@code 'ContextRealtimeData'}. 184 */ 185 public ContextRealtimeData (JsonObject jo) 186 { 187 this.currentTime = ReadNumberJSON.get(jo, "currentTime", false, true); 188 this.renderCapacity = ReadNumberJSON.get(jo, "renderCapacity", false, true); 189 this.callbackIntervalMean = ReadNumberJSON.get(jo, "callbackIntervalMean", false, true); 190 this.callbackIntervalVariance = ReadNumberJSON.get(jo, "callbackIntervalVariance", false, true); 191 } 192 193 194 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 195 public boolean equals(Object other) 196 { 197 if (this == other) return true; 198 if (other == null) return false; 199 if (other.getClass() != this.getClass()) return false; 200 201 ContextRealtimeData o = (ContextRealtimeData) other; 202 203 return 204 Objects.equals(this.currentTime, o.currentTime) 205 && Objects.equals(this.renderCapacity, o.renderCapacity) 206 && Objects.equals(this.callbackIntervalMean, o.callbackIntervalMean) 207 && Objects.equals(this.callbackIntervalVariance, o.callbackIntervalVariance); 208 } 209 210 /** Generates a Hash-Code for {@code 'this'} instance */ 211 public int hashCode() 212 { 213 return 214 Objects.hashCode(this.currentTime) 215 + Objects.hashCode(this.renderCapacity) 216 + Objects.hashCode(this.callbackIntervalMean) 217 + Objects.hashCode(this.callbackIntervalVariance); 218 } 219 } 220 221 /** Protocol object for BaseAudioContext */ 222 public static class BaseAudioContext 223 extends BaseType 224 implements java.io.Serializable 225 { 226 /** For Object Serialization. java.io.Serializable */ 227 protected static final long serialVersionUID = 1; 228 229 public boolean[] optionals() 230 { return new boolean[] { false, false, false, true, false, false, false, }; } 231 232 /** <CODE>[No Description Provided by Google]</CODE> */ 233 public final String contextId; 234 235 /** <CODE>[No Description Provided by Google]</CODE> */ 236 public final String contextType; 237 238 /** <CODE>[No Description Provided by Google]</CODE> */ 239 public final String contextState; 240 241 /** 242 * <CODE>[No Description Provided by Google]</CODE> 243 * <BR /> 244 * <BR /><B>OPTIONAL</B> 245 */ 246 public final WebAudio.ContextRealtimeData realtimeData; 247 248 /** Platform-dependent callback buffer size. */ 249 public final Number callbackBufferSize; 250 251 /** Number of output channels supported by audio hardware in use. */ 252 public final Number maxOutputChannelCount; 253 254 /** Context sample rate. */ 255 public final Number sampleRate; 256 257 /** 258 * Constructor 259 * 260 * @param contextId - 261 * 262 * @param contextType - 263 * 264 * @param contextState - 265 * 266 * @param realtimeData - 267 * <BR /><B>OPTIONAL</B> 268 * 269 * @param callbackBufferSize Platform-dependent callback buffer size. 270 * 271 * @param maxOutputChannelCount Number of output channels supported by audio hardware in use. 272 * 273 * @param sampleRate Context sample rate. 274 */ 275 public BaseAudioContext( 276 String contextId, String contextType, String contextState, 277 WebAudio.ContextRealtimeData realtimeData, Number callbackBufferSize, 278 Number maxOutputChannelCount, Number sampleRate 279 ) 280 { 281 // Exception-Check(s) to ensure that if any parameters which are not declared as 282 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 283 284 if (contextId == null) THROWS.throwNPE("contextId"); 285 if (contextType == null) THROWS.throwNPE("contextType"); 286 if (contextState == null) THROWS.throwNPE("contextState"); 287 if (callbackBufferSize == null) THROWS.throwNPE("callbackBufferSize"); 288 if (maxOutputChannelCount == null) THROWS.throwNPE("maxOutputChannelCount"); 289 if (sampleRate == null) THROWS.throwNPE("sampleRate"); 290 291 // Exception-Check(s) to ensure that if any parameters which must adhere to a 292 // provided List of Enumerated Values, fails, then IllegalArgumentException shall throw. 293 294 THROWS.checkIAE("contextType", contextType, "WebAudio.ContextType", WebAudio.ContextType); 295 THROWS.checkIAE("contextState", contextState, "WebAudio.ContextState", WebAudio.ContextState); 296 297 this.contextId = contextId; 298 this.contextType = contextType; 299 this.contextState = contextState; 300 this.realtimeData = realtimeData; 301 this.callbackBufferSize = callbackBufferSize; 302 this.maxOutputChannelCount = maxOutputChannelCount; 303 this.sampleRate = sampleRate; 304 } 305 306 /** 307 * JSON Object Constructor 308 * @param jo A Json-Object having data about an instance of {@code 'BaseAudioContext'}. 309 */ 310 public BaseAudioContext (JsonObject jo) 311 { 312 this.contextId = ReadJSON.getString(jo, "contextId", false, true); 313 this.contextType = ReadJSON.getString(jo, "contextType", false, true); 314 this.contextState = ReadJSON.getString(jo, "contextState", false, true); 315 this.realtimeData = ReadJSON.getObject(jo, "realtimeData", WebAudio.ContextRealtimeData.class, true, false); 316 this.callbackBufferSize = ReadNumberJSON.get(jo, "callbackBufferSize", false, true); 317 this.maxOutputChannelCount = ReadNumberJSON.get(jo, "maxOutputChannelCount", false, true); 318 this.sampleRate = ReadNumberJSON.get(jo, "sampleRate", false, true); 319 } 320 321 322 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 323 public boolean equals(Object other) 324 { 325 if (this == other) return true; 326 if (other == null) return false; 327 if (other.getClass() != this.getClass()) return false; 328 329 BaseAudioContext o = (BaseAudioContext) other; 330 331 return 332 Objects.equals(this.contextId, o.contextId) 333 && Objects.equals(this.contextType, o.contextType) 334 && Objects.equals(this.contextState, o.contextState) 335 && Objects.equals(this.realtimeData, o.realtimeData) 336 && Objects.equals(this.callbackBufferSize, o.callbackBufferSize) 337 && Objects.equals(this.maxOutputChannelCount, o.maxOutputChannelCount) 338 && Objects.equals(this.sampleRate, o.sampleRate); 339 } 340 341 /** Generates a Hash-Code for {@code 'this'} instance */ 342 public int hashCode() 343 { 344 return 345 Objects.hashCode(this.contextId) 346 + Objects.hashCode(this.contextType) 347 + Objects.hashCode(this.contextState) 348 + this.realtimeData.hashCode() 349 + Objects.hashCode(this.callbackBufferSize) 350 + Objects.hashCode(this.maxOutputChannelCount) 351 + Objects.hashCode(this.sampleRate); 352 } 353 } 354 355 /** Protocol object for AudioListener */ 356 public static class AudioListener 357 extends BaseType 358 implements java.io.Serializable 359 { 360 /** For Object Serialization. java.io.Serializable */ 361 protected static final long serialVersionUID = 1; 362 363 public boolean[] optionals() 364 { return new boolean[] { false, false, }; } 365 366 /** <CODE>[No Description Provided by Google]</CODE> */ 367 public final String listenerId; 368 369 /** <CODE>[No Description Provided by Google]</CODE> */ 370 public final String contextId; 371 372 /** 373 * Constructor 374 * 375 * @param listenerId - 376 * 377 * @param contextId - 378 */ 379 public AudioListener(String listenerId, String contextId) 380 { 381 // Exception-Check(s) to ensure that if any parameters which are not declared as 382 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 383 384 if (listenerId == null) THROWS.throwNPE("listenerId"); 385 if (contextId == null) THROWS.throwNPE("contextId"); 386 387 this.listenerId = listenerId; 388 this.contextId = contextId; 389 } 390 391 /** 392 * JSON Object Constructor 393 * @param jo A Json-Object having data about an instance of {@code 'AudioListener'}. 394 */ 395 public AudioListener (JsonObject jo) 396 { 397 this.listenerId = ReadJSON.getString(jo, "listenerId", false, true); 398 this.contextId = ReadJSON.getString(jo, "contextId", false, true); 399 } 400 401 402 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 403 public boolean equals(Object other) 404 { 405 if (this == other) return true; 406 if (other == null) return false; 407 if (other.getClass() != this.getClass()) return false; 408 409 AudioListener o = (AudioListener) other; 410 411 return 412 Objects.equals(this.listenerId, o.listenerId) 413 && Objects.equals(this.contextId, o.contextId); 414 } 415 416 /** Generates a Hash-Code for {@code 'this'} instance */ 417 public int hashCode() 418 { 419 return 420 Objects.hashCode(this.listenerId) 421 + Objects.hashCode(this.contextId); 422 } 423 } 424 425 /** Protocol object for AudioNode */ 426 public static class AudioNode 427 extends BaseType 428 implements java.io.Serializable 429 { 430 /** For Object Serialization. java.io.Serializable */ 431 protected static final long serialVersionUID = 1; 432 433 public boolean[] optionals() 434 { return new boolean[] { false, false, false, false, false, false, false, false, }; } 435 436 /** <CODE>[No Description Provided by Google]</CODE> */ 437 public final String nodeId; 438 439 /** <CODE>[No Description Provided by Google]</CODE> */ 440 public final String contextId; 441 442 /** <CODE>[No Description Provided by Google]</CODE> */ 443 public final String nodeType; 444 445 /** <CODE>[No Description Provided by Google]</CODE> */ 446 public final Number numberOfInputs; 447 448 /** <CODE>[No Description Provided by Google]</CODE> */ 449 public final Number numberOfOutputs; 450 451 /** <CODE>[No Description Provided by Google]</CODE> */ 452 public final Number channelCount; 453 454 /** <CODE>[No Description Provided by Google]</CODE> */ 455 public final String channelCountMode; 456 457 /** <CODE>[No Description Provided by Google]</CODE> */ 458 public final String channelInterpretation; 459 460 /** 461 * Constructor 462 * 463 * @param nodeId - 464 * 465 * @param contextId - 466 * 467 * @param nodeType - 468 * 469 * @param numberOfInputs - 470 * 471 * @param numberOfOutputs - 472 * 473 * @param channelCount - 474 * 475 * @param channelCountMode - 476 * 477 * @param channelInterpretation - 478 */ 479 public AudioNode( 480 String nodeId, String contextId, String nodeType, Number numberOfInputs, 481 Number numberOfOutputs, Number channelCount, String channelCountMode, 482 String channelInterpretation 483 ) 484 { 485 // Exception-Check(s) to ensure that if any parameters which are not declared as 486 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 487 488 if (nodeId == null) THROWS.throwNPE("nodeId"); 489 if (contextId == null) THROWS.throwNPE("contextId"); 490 if (nodeType == null) THROWS.throwNPE("nodeType"); 491 if (numberOfInputs == null) THROWS.throwNPE("numberOfInputs"); 492 if (numberOfOutputs == null) THROWS.throwNPE("numberOfOutputs"); 493 if (channelCount == null) THROWS.throwNPE("channelCount"); 494 if (channelCountMode == null) THROWS.throwNPE("channelCountMode"); 495 if (channelInterpretation == null) THROWS.throwNPE("channelInterpretation"); 496 497 // Exception-Check(s) to ensure that if any parameters which must adhere to a 498 // provided List of Enumerated Values, fails, then IllegalArgumentException shall throw. 499 500 THROWS.checkIAE("channelCountMode", channelCountMode, "WebAudio.ChannelCountMode", WebAudio.ChannelCountMode); 501 THROWS.checkIAE("channelInterpretation", channelInterpretation, "WebAudio.ChannelInterpretation", WebAudio.ChannelInterpretation); 502 503 this.nodeId = nodeId; 504 this.contextId = contextId; 505 this.nodeType = nodeType; 506 this.numberOfInputs = numberOfInputs; 507 this.numberOfOutputs = numberOfOutputs; 508 this.channelCount = channelCount; 509 this.channelCountMode = channelCountMode; 510 this.channelInterpretation = channelInterpretation; 511 } 512 513 /** 514 * JSON Object Constructor 515 * @param jo A Json-Object having data about an instance of {@code 'AudioNode'}. 516 */ 517 public AudioNode (JsonObject jo) 518 { 519 this.nodeId = ReadJSON.getString(jo, "nodeId", false, true); 520 this.contextId = ReadJSON.getString(jo, "contextId", false, true); 521 this.nodeType = ReadJSON.getString(jo, "nodeType", false, true); 522 this.numberOfInputs = ReadNumberJSON.get(jo, "numberOfInputs", false, true); 523 this.numberOfOutputs = ReadNumberJSON.get(jo, "numberOfOutputs", false, true); 524 this.channelCount = ReadNumberJSON.get(jo, "channelCount", false, true); 525 this.channelCountMode = ReadJSON.getString(jo, "channelCountMode", false, true); 526 this.channelInterpretation = ReadJSON.getString(jo, "channelInterpretation", false, true); 527 } 528 529 530 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 531 public boolean equals(Object other) 532 { 533 if (this == other) return true; 534 if (other == null) return false; 535 if (other.getClass() != this.getClass()) return false; 536 537 AudioNode o = (AudioNode) other; 538 539 return 540 Objects.equals(this.nodeId, o.nodeId) 541 && Objects.equals(this.contextId, o.contextId) 542 && Objects.equals(this.nodeType, o.nodeType) 543 && Objects.equals(this.numberOfInputs, o.numberOfInputs) 544 && Objects.equals(this.numberOfOutputs, o.numberOfOutputs) 545 && Objects.equals(this.channelCount, o.channelCount) 546 && Objects.equals(this.channelCountMode, o.channelCountMode) 547 && Objects.equals(this.channelInterpretation, o.channelInterpretation); 548 } 549 550 /** Generates a Hash-Code for {@code 'this'} instance */ 551 public int hashCode() 552 { 553 return 554 Objects.hashCode(this.nodeId) 555 + Objects.hashCode(this.contextId) 556 + Objects.hashCode(this.nodeType) 557 + Objects.hashCode(this.numberOfInputs) 558 + Objects.hashCode(this.numberOfOutputs) 559 + Objects.hashCode(this.channelCount) 560 + Objects.hashCode(this.channelCountMode) 561 + Objects.hashCode(this.channelInterpretation); 562 } 563 } 564 565 /** Protocol object for AudioParam */ 566 public static class AudioParam 567 extends BaseType 568 implements java.io.Serializable 569 { 570 /** For Object Serialization. java.io.Serializable */ 571 protected static final long serialVersionUID = 1; 572 573 public boolean[] optionals() 574 { return new boolean[] { false, false, false, false, false, false, false, false, }; } 575 576 /** <CODE>[No Description Provided by Google]</CODE> */ 577 public final String paramId; 578 579 /** <CODE>[No Description Provided by Google]</CODE> */ 580 public final String nodeId; 581 582 /** <CODE>[No Description Provided by Google]</CODE> */ 583 public final String contextId; 584 585 /** <CODE>[No Description Provided by Google]</CODE> */ 586 public final String paramType; 587 588 /** <CODE>[No Description Provided by Google]</CODE> */ 589 public final String rate; 590 591 /** <CODE>[No Description Provided by Google]</CODE> */ 592 public final Number defaultValue; 593 594 /** <CODE>[No Description Provided by Google]</CODE> */ 595 public final Number minValue; 596 597 /** <CODE>[No Description Provided by Google]</CODE> */ 598 public final Number maxValue; 599 600 /** 601 * Constructor 602 * 603 * @param paramId - 604 * 605 * @param nodeId - 606 * 607 * @param contextId - 608 * 609 * @param paramType - 610 * 611 * @param rate - 612 * 613 * @param defaultValue - 614 * 615 * @param minValue - 616 * 617 * @param maxValue - 618 */ 619 public AudioParam( 620 String paramId, String nodeId, String contextId, String paramType, String rate, 621 Number defaultValue, Number minValue, Number maxValue 622 ) 623 { 624 // Exception-Check(s) to ensure that if any parameters which are not declared as 625 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 626 627 if (paramId == null) THROWS.throwNPE("paramId"); 628 if (nodeId == null) THROWS.throwNPE("nodeId"); 629 if (contextId == null) THROWS.throwNPE("contextId"); 630 if (paramType == null) THROWS.throwNPE("paramType"); 631 if (rate == null) THROWS.throwNPE("rate"); 632 if (defaultValue == null) THROWS.throwNPE("defaultValue"); 633 if (minValue == null) THROWS.throwNPE("minValue"); 634 if (maxValue == null) THROWS.throwNPE("maxValue"); 635 636 // Exception-Check(s) to ensure that if any parameters which must adhere to a 637 // provided List of Enumerated Values, fails, then IllegalArgumentException shall throw. 638 639 THROWS.checkIAE("rate", rate, "WebAudio.AutomationRate", WebAudio.AutomationRate); 640 641 this.paramId = paramId; 642 this.nodeId = nodeId; 643 this.contextId = contextId; 644 this.paramType = paramType; 645 this.rate = rate; 646 this.defaultValue = defaultValue; 647 this.minValue = minValue; 648 this.maxValue = maxValue; 649 } 650 651 /** 652 * JSON Object Constructor 653 * @param jo A Json-Object having data about an instance of {@code 'AudioParam'}. 654 */ 655 public AudioParam (JsonObject jo) 656 { 657 this.paramId = ReadJSON.getString(jo, "paramId", false, true); 658 this.nodeId = ReadJSON.getString(jo, "nodeId", false, true); 659 this.contextId = ReadJSON.getString(jo, "contextId", false, true); 660 this.paramType = ReadJSON.getString(jo, "paramType", false, true); 661 this.rate = ReadJSON.getString(jo, "rate", false, true); 662 this.defaultValue = ReadNumberJSON.get(jo, "defaultValue", false, true); 663 this.minValue = ReadNumberJSON.get(jo, "minValue", false, true); 664 this.maxValue = ReadNumberJSON.get(jo, "maxValue", false, true); 665 } 666 667 668 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 669 public boolean equals(Object other) 670 { 671 if (this == other) return true; 672 if (other == null) return false; 673 if (other.getClass() != this.getClass()) return false; 674 675 AudioParam o = (AudioParam) other; 676 677 return 678 Objects.equals(this.paramId, o.paramId) 679 && Objects.equals(this.nodeId, o.nodeId) 680 && Objects.equals(this.contextId, o.contextId) 681 && Objects.equals(this.paramType, o.paramType) 682 && Objects.equals(this.rate, o.rate) 683 && Objects.equals(this.defaultValue, o.defaultValue) 684 && Objects.equals(this.minValue, o.minValue) 685 && Objects.equals(this.maxValue, o.maxValue); 686 } 687 688 /** Generates a Hash-Code for {@code 'this'} instance */ 689 public int hashCode() 690 { 691 return 692 Objects.hashCode(this.paramId) 693 + Objects.hashCode(this.nodeId) 694 + Objects.hashCode(this.contextId) 695 + Objects.hashCode(this.paramType) 696 + Objects.hashCode(this.rate) 697 + Objects.hashCode(this.defaultValue) 698 + Objects.hashCode(this.minValue) 699 + Objects.hashCode(this.maxValue); 700 } 701 } 702 703 /** Notifies that a new BaseAudioContext has been created. */ 704 public static class contextCreated 705 extends BrowserEvent 706 implements java.io.Serializable 707 { 708 /** For Object Serialization. java.io.Serializable */ 709 protected static final long serialVersionUID = 1; 710 711 public boolean[] optionals() 712 { return new boolean[] { false, }; } 713 714 /** <CODE>[No Description Provided by Google]</CODE> */ 715 public final WebAudio.BaseAudioContext context; 716 717 /** 718 * Constructor 719 * 720 * @param context - 721 */ 722 public contextCreated(WebAudio.BaseAudioContext context) 723 { 724 super("WebAudio", "contextCreated", 1); 725 726 // Exception-Check(s) to ensure that if any parameters which are not declared as 727 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 728 729 if (context == null) THROWS.throwNPE("context"); 730 731 this.context = context; 732 } 733 734 /** 735 * JSON Object Constructor 736 * @param jo A Json-Object having data about an instance of {@code 'contextCreated'}. 737 */ 738 public contextCreated (JsonObject jo) 739 { 740 super("WebAudio", "contextCreated", 1); 741 742 this.context = ReadJSON.getObject(jo, "context", WebAudio.BaseAudioContext.class, false, true); 743 } 744 745 746 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 747 public boolean equals(Object other) 748 { 749 if (this == other) return true; 750 if (other == null) return false; 751 if (other.getClass() != this.getClass()) return false; 752 753 contextCreated o = (contextCreated) other; 754 755 return 756 Objects.equals(this.context, o.context); 757 } 758 759 /** Generates a Hash-Code for {@code 'this'} instance */ 760 public int hashCode() 761 { 762 return 763 this.context.hashCode(); 764 } 765 } 766 767 /** Notifies that an existing BaseAudioContext will be destroyed. */ 768 public static class contextWillBeDestroyed 769 extends BrowserEvent 770 implements java.io.Serializable 771 { 772 /** For Object Serialization. java.io.Serializable */ 773 protected static final long serialVersionUID = 1; 774 775 public boolean[] optionals() 776 { return new boolean[] { false, }; } 777 778 /** <CODE>[No Description Provided by Google]</CODE> */ 779 public final String contextId; 780 781 /** 782 * Constructor 783 * 784 * @param contextId - 785 */ 786 public contextWillBeDestroyed(String contextId) 787 { 788 super("WebAudio", "contextWillBeDestroyed", 1); 789 790 // Exception-Check(s) to ensure that if any parameters which are not declared as 791 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 792 793 if (contextId == null) THROWS.throwNPE("contextId"); 794 795 this.contextId = contextId; 796 } 797 798 /** 799 * JSON Object Constructor 800 * @param jo A Json-Object having data about an instance of {@code 'contextWillBeDestroyed'}. 801 */ 802 public contextWillBeDestroyed (JsonObject jo) 803 { 804 super("WebAudio", "contextWillBeDestroyed", 1); 805 806 this.contextId = ReadJSON.getString(jo, "contextId", false, true); 807 } 808 809 810 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 811 public boolean equals(Object other) 812 { 813 if (this == other) return true; 814 if (other == null) return false; 815 if (other.getClass() != this.getClass()) return false; 816 817 contextWillBeDestroyed o = (contextWillBeDestroyed) other; 818 819 return 820 Objects.equals(this.contextId, o.contextId); 821 } 822 823 /** Generates a Hash-Code for {@code 'this'} instance */ 824 public int hashCode() 825 { 826 return 827 Objects.hashCode(this.contextId); 828 } 829 } 830 831 /** Notifies that existing BaseAudioContext has changed some properties (id stays the same).. */ 832 public static class contextChanged 833 extends BrowserEvent 834 implements java.io.Serializable 835 { 836 /** For Object Serialization. java.io.Serializable */ 837 protected static final long serialVersionUID = 1; 838 839 public boolean[] optionals() 840 { return new boolean[] { false, }; } 841 842 /** <CODE>[No Description Provided by Google]</CODE> */ 843 public final WebAudio.BaseAudioContext context; 844 845 /** 846 * Constructor 847 * 848 * @param context - 849 */ 850 public contextChanged(WebAudio.BaseAudioContext context) 851 { 852 super("WebAudio", "contextChanged", 1); 853 854 // Exception-Check(s) to ensure that if any parameters which are not declared as 855 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 856 857 if (context == null) THROWS.throwNPE("context"); 858 859 this.context = context; 860 } 861 862 /** 863 * JSON Object Constructor 864 * @param jo A Json-Object having data about an instance of {@code 'contextChanged'}. 865 */ 866 public contextChanged (JsonObject jo) 867 { 868 super("WebAudio", "contextChanged", 1); 869 870 this.context = ReadJSON.getObject(jo, "context", WebAudio.BaseAudioContext.class, false, true); 871 } 872 873 874 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 875 public boolean equals(Object other) 876 { 877 if (this == other) return true; 878 if (other == null) return false; 879 if (other.getClass() != this.getClass()) return false; 880 881 contextChanged o = (contextChanged) other; 882 883 return 884 Objects.equals(this.context, o.context); 885 } 886 887 /** Generates a Hash-Code for {@code 'this'} instance */ 888 public int hashCode() 889 { 890 return 891 this.context.hashCode(); 892 } 893 } 894 895 /** Notifies that the construction of an AudioListener has finished. */ 896 public static class audioListenerCreated 897 extends BrowserEvent 898 implements java.io.Serializable 899 { 900 /** For Object Serialization. java.io.Serializable */ 901 protected static final long serialVersionUID = 1; 902 903 public boolean[] optionals() 904 { return new boolean[] { false, }; } 905 906 /** <CODE>[No Description Provided by Google]</CODE> */ 907 public final WebAudio.AudioListener listener; 908 909 /** 910 * Constructor 911 * 912 * @param listener - 913 */ 914 public audioListenerCreated(WebAudio.AudioListener listener) 915 { 916 super("WebAudio", "audioListenerCreated", 1); 917 918 // Exception-Check(s) to ensure that if any parameters which are not declared as 919 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 920 921 if (listener == null) THROWS.throwNPE("listener"); 922 923 this.listener = listener; 924 } 925 926 /** 927 * JSON Object Constructor 928 * @param jo A Json-Object having data about an instance of {@code 'audioListenerCreated'}. 929 */ 930 public audioListenerCreated (JsonObject jo) 931 { 932 super("WebAudio", "audioListenerCreated", 1); 933 934 this.listener = ReadJSON.getObject(jo, "listener", WebAudio.AudioListener.class, false, true); 935 } 936 937 938 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 939 public boolean equals(Object other) 940 { 941 if (this == other) return true; 942 if (other == null) return false; 943 if (other.getClass() != this.getClass()) return false; 944 945 audioListenerCreated o = (audioListenerCreated) other; 946 947 return 948 Objects.equals(this.listener, o.listener); 949 } 950 951 /** Generates a Hash-Code for {@code 'this'} instance */ 952 public int hashCode() 953 { 954 return 955 this.listener.hashCode(); 956 } 957 } 958 959 /** Notifies that a new AudioListener has been created. */ 960 public static class audioListenerWillBeDestroyed 961 extends BrowserEvent 962 implements java.io.Serializable 963 { 964 /** For Object Serialization. java.io.Serializable */ 965 protected static final long serialVersionUID = 1; 966 967 public boolean[] optionals() 968 { return new boolean[] { false, false, }; } 969 970 /** <CODE>[No Description Provided by Google]</CODE> */ 971 public final String contextId; 972 973 /** <CODE>[No Description Provided by Google]</CODE> */ 974 public final String listenerId; 975 976 /** 977 * Constructor 978 * 979 * @param contextId - 980 * 981 * @param listenerId - 982 */ 983 public audioListenerWillBeDestroyed(String contextId, String listenerId) 984 { 985 super("WebAudio", "audioListenerWillBeDestroyed", 2); 986 987 // Exception-Check(s) to ensure that if any parameters which are not declared as 988 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 989 990 if (contextId == null) THROWS.throwNPE("contextId"); 991 if (listenerId == null) THROWS.throwNPE("listenerId"); 992 993 this.contextId = contextId; 994 this.listenerId = listenerId; 995 } 996 997 /** 998 * JSON Object Constructor 999 * @param jo A Json-Object having data about an instance of {@code 'audioListenerWillBeDestroyed'}. 1000 */ 1001 public audioListenerWillBeDestroyed (JsonObject jo) 1002 { 1003 super("WebAudio", "audioListenerWillBeDestroyed", 2); 1004 1005 this.contextId = ReadJSON.getString(jo, "contextId", false, true); 1006 this.listenerId = ReadJSON.getString(jo, "listenerId", false, true); 1007 } 1008 1009 1010 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 1011 public boolean equals(Object other) 1012 { 1013 if (this == other) return true; 1014 if (other == null) return false; 1015 if (other.getClass() != this.getClass()) return false; 1016 1017 audioListenerWillBeDestroyed o = (audioListenerWillBeDestroyed) other; 1018 1019 return 1020 Objects.equals(this.contextId, o.contextId) 1021 && Objects.equals(this.listenerId, o.listenerId); 1022 } 1023 1024 /** Generates a Hash-Code for {@code 'this'} instance */ 1025 public int hashCode() 1026 { 1027 return 1028 Objects.hashCode(this.contextId) 1029 + Objects.hashCode(this.listenerId); 1030 } 1031 } 1032 1033 /** Notifies that a new AudioNode has been created. */ 1034 public static class audioNodeCreated 1035 extends BrowserEvent 1036 implements java.io.Serializable 1037 { 1038 /** For Object Serialization. java.io.Serializable */ 1039 protected static final long serialVersionUID = 1; 1040 1041 public boolean[] optionals() 1042 { return new boolean[] { false, }; } 1043 1044 /** <CODE>[No Description Provided by Google]</CODE> */ 1045 public final WebAudio.AudioNode node; 1046 1047 /** 1048 * Constructor 1049 * 1050 * @param node - 1051 */ 1052 public audioNodeCreated(WebAudio.AudioNode node) 1053 { 1054 super("WebAudio", "audioNodeCreated", 1); 1055 1056 // Exception-Check(s) to ensure that if any parameters which are not declared as 1057 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 1058 1059 if (node == null) THROWS.throwNPE("node"); 1060 1061 this.node = node; 1062 } 1063 1064 /** 1065 * JSON Object Constructor 1066 * @param jo A Json-Object having data about an instance of {@code 'audioNodeCreated'}. 1067 */ 1068 public audioNodeCreated (JsonObject jo) 1069 { 1070 super("WebAudio", "audioNodeCreated", 1); 1071 1072 this.node = ReadJSON.getObject(jo, "node", WebAudio.AudioNode.class, false, true); 1073 } 1074 1075 1076 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 1077 public boolean equals(Object other) 1078 { 1079 if (this == other) return true; 1080 if (other == null) return false; 1081 if (other.getClass() != this.getClass()) return false; 1082 1083 audioNodeCreated o = (audioNodeCreated) other; 1084 1085 return 1086 Objects.equals(this.node, o.node); 1087 } 1088 1089 /** Generates a Hash-Code for {@code 'this'} instance */ 1090 public int hashCode() 1091 { 1092 return 1093 this.node.hashCode(); 1094 } 1095 } 1096 1097 /** Notifies that an existing AudioNode has been destroyed. */ 1098 public static class audioNodeWillBeDestroyed 1099 extends BrowserEvent 1100 implements java.io.Serializable 1101 { 1102 /** For Object Serialization. java.io.Serializable */ 1103 protected static final long serialVersionUID = 1; 1104 1105 public boolean[] optionals() 1106 { return new boolean[] { false, false, }; } 1107 1108 /** <CODE>[No Description Provided by Google]</CODE> */ 1109 public final String contextId; 1110 1111 /** <CODE>[No Description Provided by Google]</CODE> */ 1112 public final String nodeId; 1113 1114 /** 1115 * Constructor 1116 * 1117 * @param contextId - 1118 * 1119 * @param nodeId - 1120 */ 1121 public audioNodeWillBeDestroyed(String contextId, String nodeId) 1122 { 1123 super("WebAudio", "audioNodeWillBeDestroyed", 2); 1124 1125 // Exception-Check(s) to ensure that if any parameters which are not declared as 1126 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 1127 1128 if (contextId == null) THROWS.throwNPE("contextId"); 1129 if (nodeId == null) THROWS.throwNPE("nodeId"); 1130 1131 this.contextId = contextId; 1132 this.nodeId = nodeId; 1133 } 1134 1135 /** 1136 * JSON Object Constructor 1137 * @param jo A Json-Object having data about an instance of {@code 'audioNodeWillBeDestroyed'}. 1138 */ 1139 public audioNodeWillBeDestroyed (JsonObject jo) 1140 { 1141 super("WebAudio", "audioNodeWillBeDestroyed", 2); 1142 1143 this.contextId = ReadJSON.getString(jo, "contextId", false, true); 1144 this.nodeId = ReadJSON.getString(jo, "nodeId", false, true); 1145 } 1146 1147 1148 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 1149 public boolean equals(Object other) 1150 { 1151 if (this == other) return true; 1152 if (other == null) return false; 1153 if (other.getClass() != this.getClass()) return false; 1154 1155 audioNodeWillBeDestroyed o = (audioNodeWillBeDestroyed) other; 1156 1157 return 1158 Objects.equals(this.contextId, o.contextId) 1159 && Objects.equals(this.nodeId, o.nodeId); 1160 } 1161 1162 /** Generates a Hash-Code for {@code 'this'} instance */ 1163 public int hashCode() 1164 { 1165 return 1166 Objects.hashCode(this.contextId) 1167 + Objects.hashCode(this.nodeId); 1168 } 1169 } 1170 1171 /** Notifies that a new AudioParam has been created. */ 1172 public static class audioParamCreated 1173 extends BrowserEvent 1174 implements java.io.Serializable 1175 { 1176 /** For Object Serialization. java.io.Serializable */ 1177 protected static final long serialVersionUID = 1; 1178 1179 public boolean[] optionals() 1180 { return new boolean[] { false, }; } 1181 1182 /** <CODE>[No Description Provided by Google]</CODE> */ 1183 public final WebAudio.AudioParam param; 1184 1185 /** 1186 * Constructor 1187 * 1188 * @param param - 1189 */ 1190 public audioParamCreated(WebAudio.AudioParam param) 1191 { 1192 super("WebAudio", "audioParamCreated", 1); 1193 1194 // Exception-Check(s) to ensure that if any parameters which are not declared as 1195 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 1196 1197 if (param == null) THROWS.throwNPE("param"); 1198 1199 this.param = param; 1200 } 1201 1202 /** 1203 * JSON Object Constructor 1204 * @param jo A Json-Object having data about an instance of {@code 'audioParamCreated'}. 1205 */ 1206 public audioParamCreated (JsonObject jo) 1207 { 1208 super("WebAudio", "audioParamCreated", 1); 1209 1210 this.param = ReadJSON.getObject(jo, "param", WebAudio.AudioParam.class, false, true); 1211 } 1212 1213 1214 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 1215 public boolean equals(Object other) 1216 { 1217 if (this == other) return true; 1218 if (other == null) return false; 1219 if (other.getClass() != this.getClass()) return false; 1220 1221 audioParamCreated o = (audioParamCreated) other; 1222 1223 return 1224 Objects.equals(this.param, o.param); 1225 } 1226 1227 /** Generates a Hash-Code for {@code 'this'} instance */ 1228 public int hashCode() 1229 { 1230 return 1231 this.param.hashCode(); 1232 } 1233 } 1234 1235 /** Notifies that an existing AudioParam has been destroyed. */ 1236 public static class audioParamWillBeDestroyed 1237 extends BrowserEvent 1238 implements java.io.Serializable 1239 { 1240 /** For Object Serialization. java.io.Serializable */ 1241 protected static final long serialVersionUID = 1; 1242 1243 public boolean[] optionals() 1244 { return new boolean[] { false, false, false, }; } 1245 1246 /** <CODE>[No Description Provided by Google]</CODE> */ 1247 public final String contextId; 1248 1249 /** <CODE>[No Description Provided by Google]</CODE> */ 1250 public final String nodeId; 1251 1252 /** <CODE>[No Description Provided by Google]</CODE> */ 1253 public final String paramId; 1254 1255 /** 1256 * Constructor 1257 * 1258 * @param contextId - 1259 * 1260 * @param nodeId - 1261 * 1262 * @param paramId - 1263 */ 1264 public audioParamWillBeDestroyed(String contextId, String nodeId, String paramId) 1265 { 1266 super("WebAudio", "audioParamWillBeDestroyed", 3); 1267 1268 // Exception-Check(s) to ensure that if any parameters which are not declared as 1269 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 1270 1271 if (contextId == null) THROWS.throwNPE("contextId"); 1272 if (nodeId == null) THROWS.throwNPE("nodeId"); 1273 if (paramId == null) THROWS.throwNPE("paramId"); 1274 1275 this.contextId = contextId; 1276 this.nodeId = nodeId; 1277 this.paramId = paramId; 1278 } 1279 1280 /** 1281 * JSON Object Constructor 1282 * @param jo A Json-Object having data about an instance of {@code 'audioParamWillBeDestroyed'}. 1283 */ 1284 public audioParamWillBeDestroyed (JsonObject jo) 1285 { 1286 super("WebAudio", "audioParamWillBeDestroyed", 3); 1287 1288 this.contextId = ReadJSON.getString(jo, "contextId", false, true); 1289 this.nodeId = ReadJSON.getString(jo, "nodeId", false, true); 1290 this.paramId = ReadJSON.getString(jo, "paramId", false, true); 1291 } 1292 1293 1294 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 1295 public boolean equals(Object other) 1296 { 1297 if (this == other) return true; 1298 if (other == null) return false; 1299 if (other.getClass() != this.getClass()) return false; 1300 1301 audioParamWillBeDestroyed o = (audioParamWillBeDestroyed) other; 1302 1303 return 1304 Objects.equals(this.contextId, o.contextId) 1305 && Objects.equals(this.nodeId, o.nodeId) 1306 && Objects.equals(this.paramId, o.paramId); 1307 } 1308 1309 /** Generates a Hash-Code for {@code 'this'} instance */ 1310 public int hashCode() 1311 { 1312 return 1313 Objects.hashCode(this.contextId) 1314 + Objects.hashCode(this.nodeId) 1315 + Objects.hashCode(this.paramId); 1316 } 1317 } 1318 1319 /** Notifies that two AudioNodes are connected. */ 1320 public static class nodesConnected 1321 extends BrowserEvent 1322 implements java.io.Serializable 1323 { 1324 /** For Object Serialization. java.io.Serializable */ 1325 protected static final long serialVersionUID = 1; 1326 1327 public boolean[] optionals() 1328 { return new boolean[] { false, false, false, true, true, }; } 1329 1330 /** <CODE>[No Description Provided by Google]</CODE> */ 1331 public final String contextId; 1332 1333 /** <CODE>[No Description Provided by Google]</CODE> */ 1334 public final String sourceId; 1335 1336 /** <CODE>[No Description Provided by Google]</CODE> */ 1337 public final String destinationId; 1338 1339 /** 1340 * <CODE>[No Description Provided by Google]</CODE> 1341 * <BR /> 1342 * <BR /><B>OPTIONAL</B> 1343 */ 1344 public final Number sourceOutputIndex; 1345 1346 /** 1347 * <CODE>[No Description Provided by Google]</CODE> 1348 * <BR /> 1349 * <BR /><B>OPTIONAL</B> 1350 */ 1351 public final Number destinationInputIndex; 1352 1353 /** 1354 * Constructor 1355 * 1356 * @param contextId - 1357 * 1358 * @param sourceId - 1359 * 1360 * @param destinationId - 1361 * 1362 * @param sourceOutputIndex - 1363 * <BR /><B>OPTIONAL</B> 1364 * 1365 * @param destinationInputIndex - 1366 * <BR /><B>OPTIONAL</B> 1367 */ 1368 public nodesConnected( 1369 String contextId, String sourceId, String destinationId, Number sourceOutputIndex, 1370 Number destinationInputIndex 1371 ) 1372 { 1373 super("WebAudio", "nodesConnected", 5); 1374 1375 // Exception-Check(s) to ensure that if any parameters which are not declared as 1376 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 1377 1378 if (contextId == null) THROWS.throwNPE("contextId"); 1379 if (sourceId == null) THROWS.throwNPE("sourceId"); 1380 if (destinationId == null) THROWS.throwNPE("destinationId"); 1381 1382 this.contextId = contextId; 1383 this.sourceId = sourceId; 1384 this.destinationId = destinationId; 1385 this.sourceOutputIndex = sourceOutputIndex; 1386 this.destinationInputIndex = destinationInputIndex; 1387 } 1388 1389 /** 1390 * JSON Object Constructor 1391 * @param jo A Json-Object having data about an instance of {@code 'nodesConnected'}. 1392 */ 1393 public nodesConnected (JsonObject jo) 1394 { 1395 super("WebAudio", "nodesConnected", 5); 1396 1397 this.contextId = ReadJSON.getString(jo, "contextId", false, true); 1398 this.sourceId = ReadJSON.getString(jo, "sourceId", false, true); 1399 this.destinationId = ReadJSON.getString(jo, "destinationId", false, true); 1400 this.sourceOutputIndex = ReadNumberJSON.get(jo, "sourceOutputIndex", true, false); 1401 this.destinationInputIndex = ReadNumberJSON.get(jo, "destinationInputIndex", true, false); 1402 } 1403 1404 1405 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 1406 public boolean equals(Object other) 1407 { 1408 if (this == other) return true; 1409 if (other == null) return false; 1410 if (other.getClass() != this.getClass()) return false; 1411 1412 nodesConnected o = (nodesConnected) other; 1413 1414 return 1415 Objects.equals(this.contextId, o.contextId) 1416 && Objects.equals(this.sourceId, o.sourceId) 1417 && Objects.equals(this.destinationId, o.destinationId) 1418 && Objects.equals(this.sourceOutputIndex, o.sourceOutputIndex) 1419 && Objects.equals(this.destinationInputIndex, o.destinationInputIndex); 1420 } 1421 1422 /** Generates a Hash-Code for {@code 'this'} instance */ 1423 public int hashCode() 1424 { 1425 return 1426 Objects.hashCode(this.contextId) 1427 + Objects.hashCode(this.sourceId) 1428 + Objects.hashCode(this.destinationId) 1429 + Objects.hashCode(this.sourceOutputIndex) 1430 + Objects.hashCode(this.destinationInputIndex); 1431 } 1432 } 1433 1434 /** Notifies that AudioNodes are disconnected. The destination can be null, and it means all the outgoing connections from the source are disconnected. */ 1435 public static class nodesDisconnected 1436 extends BrowserEvent 1437 implements java.io.Serializable 1438 { 1439 /** For Object Serialization. java.io.Serializable */ 1440 protected static final long serialVersionUID = 1; 1441 1442 public boolean[] optionals() 1443 { return new boolean[] { false, false, false, true, true, }; } 1444 1445 /** <CODE>[No Description Provided by Google]</CODE> */ 1446 public final String contextId; 1447 1448 /** <CODE>[No Description Provided by Google]</CODE> */ 1449 public final String sourceId; 1450 1451 /** <CODE>[No Description Provided by Google]</CODE> */ 1452 public final String destinationId; 1453 1454 /** 1455 * <CODE>[No Description Provided by Google]</CODE> 1456 * <BR /> 1457 * <BR /><B>OPTIONAL</B> 1458 */ 1459 public final Number sourceOutputIndex; 1460 1461 /** 1462 * <CODE>[No Description Provided by Google]</CODE> 1463 * <BR /> 1464 * <BR /><B>OPTIONAL</B> 1465 */ 1466 public final Number destinationInputIndex; 1467 1468 /** 1469 * Constructor 1470 * 1471 * @param contextId - 1472 * 1473 * @param sourceId - 1474 * 1475 * @param destinationId - 1476 * 1477 * @param sourceOutputIndex - 1478 * <BR /><B>OPTIONAL</B> 1479 * 1480 * @param destinationInputIndex - 1481 * <BR /><B>OPTIONAL</B> 1482 */ 1483 public nodesDisconnected( 1484 String contextId, String sourceId, String destinationId, Number sourceOutputIndex, 1485 Number destinationInputIndex 1486 ) 1487 { 1488 super("WebAudio", "nodesDisconnected", 5); 1489 1490 // Exception-Check(s) to ensure that if any parameters which are not declared as 1491 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 1492 1493 if (contextId == null) THROWS.throwNPE("contextId"); 1494 if (sourceId == null) THROWS.throwNPE("sourceId"); 1495 if (destinationId == null) THROWS.throwNPE("destinationId"); 1496 1497 this.contextId = contextId; 1498 this.sourceId = sourceId; 1499 this.destinationId = destinationId; 1500 this.sourceOutputIndex = sourceOutputIndex; 1501 this.destinationInputIndex = destinationInputIndex; 1502 } 1503 1504 /** 1505 * JSON Object Constructor 1506 * @param jo A Json-Object having data about an instance of {@code 'nodesDisconnected'}. 1507 */ 1508 public nodesDisconnected (JsonObject jo) 1509 { 1510 super("WebAudio", "nodesDisconnected", 5); 1511 1512 this.contextId = ReadJSON.getString(jo, "contextId", false, true); 1513 this.sourceId = ReadJSON.getString(jo, "sourceId", false, true); 1514 this.destinationId = ReadJSON.getString(jo, "destinationId", false, true); 1515 this.sourceOutputIndex = ReadNumberJSON.get(jo, "sourceOutputIndex", true, false); 1516 this.destinationInputIndex = ReadNumberJSON.get(jo, "destinationInputIndex", true, false); 1517 } 1518 1519 1520 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 1521 public boolean equals(Object other) 1522 { 1523 if (this == other) return true; 1524 if (other == null) return false; 1525 if (other.getClass() != this.getClass()) return false; 1526 1527 nodesDisconnected o = (nodesDisconnected) other; 1528 1529 return 1530 Objects.equals(this.contextId, o.contextId) 1531 && Objects.equals(this.sourceId, o.sourceId) 1532 && Objects.equals(this.destinationId, o.destinationId) 1533 && Objects.equals(this.sourceOutputIndex, o.sourceOutputIndex) 1534 && Objects.equals(this.destinationInputIndex, o.destinationInputIndex); 1535 } 1536 1537 /** Generates a Hash-Code for {@code 'this'} instance */ 1538 public int hashCode() 1539 { 1540 return 1541 Objects.hashCode(this.contextId) 1542 + Objects.hashCode(this.sourceId) 1543 + Objects.hashCode(this.destinationId) 1544 + Objects.hashCode(this.sourceOutputIndex) 1545 + Objects.hashCode(this.destinationInputIndex); 1546 } 1547 } 1548 1549 /** Notifies that an AudioNode is connected to an AudioParam. */ 1550 public static class nodeParamConnected 1551 extends BrowserEvent 1552 implements java.io.Serializable 1553 { 1554 /** For Object Serialization. java.io.Serializable */ 1555 protected static final long serialVersionUID = 1; 1556 1557 public boolean[] optionals() 1558 { return new boolean[] { false, false, false, true, }; } 1559 1560 /** <CODE>[No Description Provided by Google]</CODE> */ 1561 public final String contextId; 1562 1563 /** <CODE>[No Description Provided by Google]</CODE> */ 1564 public final String sourceId; 1565 1566 /** <CODE>[No Description Provided by Google]</CODE> */ 1567 public final String destinationId; 1568 1569 /** 1570 * <CODE>[No Description Provided by Google]</CODE> 1571 * <BR /> 1572 * <BR /><B>OPTIONAL</B> 1573 */ 1574 public final Number sourceOutputIndex; 1575 1576 /** 1577 * Constructor 1578 * 1579 * @param contextId - 1580 * 1581 * @param sourceId - 1582 * 1583 * @param destinationId - 1584 * 1585 * @param sourceOutputIndex - 1586 * <BR /><B>OPTIONAL</B> 1587 */ 1588 public nodeParamConnected 1589 (String contextId, String sourceId, String destinationId, Number sourceOutputIndex) 1590 { 1591 super("WebAudio", "nodeParamConnected", 4); 1592 1593 // Exception-Check(s) to ensure that if any parameters which are not declared as 1594 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 1595 1596 if (contextId == null) THROWS.throwNPE("contextId"); 1597 if (sourceId == null) THROWS.throwNPE("sourceId"); 1598 if (destinationId == null) THROWS.throwNPE("destinationId"); 1599 1600 this.contextId = contextId; 1601 this.sourceId = sourceId; 1602 this.destinationId = destinationId; 1603 this.sourceOutputIndex = sourceOutputIndex; 1604 } 1605 1606 /** 1607 * JSON Object Constructor 1608 * @param jo A Json-Object having data about an instance of {@code 'nodeParamConnected'}. 1609 */ 1610 public nodeParamConnected (JsonObject jo) 1611 { 1612 super("WebAudio", "nodeParamConnected", 4); 1613 1614 this.contextId = ReadJSON.getString(jo, "contextId", false, true); 1615 this.sourceId = ReadJSON.getString(jo, "sourceId", false, true); 1616 this.destinationId = ReadJSON.getString(jo, "destinationId", false, true); 1617 this.sourceOutputIndex = ReadNumberJSON.get(jo, "sourceOutputIndex", true, false); 1618 } 1619 1620 1621 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 1622 public boolean equals(Object other) 1623 { 1624 if (this == other) return true; 1625 if (other == null) return false; 1626 if (other.getClass() != this.getClass()) return false; 1627 1628 nodeParamConnected o = (nodeParamConnected) other; 1629 1630 return 1631 Objects.equals(this.contextId, o.contextId) 1632 && Objects.equals(this.sourceId, o.sourceId) 1633 && Objects.equals(this.destinationId, o.destinationId) 1634 && Objects.equals(this.sourceOutputIndex, o.sourceOutputIndex); 1635 } 1636 1637 /** Generates a Hash-Code for {@code 'this'} instance */ 1638 public int hashCode() 1639 { 1640 return 1641 Objects.hashCode(this.contextId) 1642 + Objects.hashCode(this.sourceId) 1643 + Objects.hashCode(this.destinationId) 1644 + Objects.hashCode(this.sourceOutputIndex); 1645 } 1646 } 1647 1648 /** Notifies that an AudioNode is disconnected to an AudioParam. */ 1649 public static class nodeParamDisconnected 1650 extends BrowserEvent 1651 implements java.io.Serializable 1652 { 1653 /** For Object Serialization. java.io.Serializable */ 1654 protected static final long serialVersionUID = 1; 1655 1656 public boolean[] optionals() 1657 { return new boolean[] { false, false, false, true, }; } 1658 1659 /** <CODE>[No Description Provided by Google]</CODE> */ 1660 public final String contextId; 1661 1662 /** <CODE>[No Description Provided by Google]</CODE> */ 1663 public final String sourceId; 1664 1665 /** <CODE>[No Description Provided by Google]</CODE> */ 1666 public final String destinationId; 1667 1668 /** 1669 * <CODE>[No Description Provided by Google]</CODE> 1670 * <BR /> 1671 * <BR /><B>OPTIONAL</B> 1672 */ 1673 public final Number sourceOutputIndex; 1674 1675 /** 1676 * Constructor 1677 * 1678 * @param contextId - 1679 * 1680 * @param sourceId - 1681 * 1682 * @param destinationId - 1683 * 1684 * @param sourceOutputIndex - 1685 * <BR /><B>OPTIONAL</B> 1686 */ 1687 public nodeParamDisconnected 1688 (String contextId, String sourceId, String destinationId, Number sourceOutputIndex) 1689 { 1690 super("WebAudio", "nodeParamDisconnected", 4); 1691 1692 // Exception-Check(s) to ensure that if any parameters which are not declared as 1693 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 1694 1695 if (contextId == null) THROWS.throwNPE("contextId"); 1696 if (sourceId == null) THROWS.throwNPE("sourceId"); 1697 if (destinationId == null) THROWS.throwNPE("destinationId"); 1698 1699 this.contextId = contextId; 1700 this.sourceId = sourceId; 1701 this.destinationId = destinationId; 1702 this.sourceOutputIndex = sourceOutputIndex; 1703 } 1704 1705 /** 1706 * JSON Object Constructor 1707 * @param jo A Json-Object having data about an instance of {@code 'nodeParamDisconnected'}. 1708 */ 1709 public nodeParamDisconnected (JsonObject jo) 1710 { 1711 super("WebAudio", "nodeParamDisconnected", 4); 1712 1713 this.contextId = ReadJSON.getString(jo, "contextId", false, true); 1714 this.sourceId = ReadJSON.getString(jo, "sourceId", false, true); 1715 this.destinationId = ReadJSON.getString(jo, "destinationId", false, true); 1716 this.sourceOutputIndex = ReadNumberJSON.get(jo, "sourceOutputIndex", true, false); 1717 } 1718 1719 1720 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 1721 public boolean equals(Object other) 1722 { 1723 if (this == other) return true; 1724 if (other == null) return false; 1725 if (other.getClass() != this.getClass()) return false; 1726 1727 nodeParamDisconnected o = (nodeParamDisconnected) other; 1728 1729 return 1730 Objects.equals(this.contextId, o.contextId) 1731 && Objects.equals(this.sourceId, o.sourceId) 1732 && Objects.equals(this.destinationId, o.destinationId) 1733 && Objects.equals(this.sourceOutputIndex, o.sourceOutputIndex); 1734 } 1735 1736 /** Generates a Hash-Code for {@code 'this'} instance */ 1737 public int hashCode() 1738 { 1739 return 1740 Objects.hashCode(this.contextId) 1741 + Objects.hashCode(this.sourceId) 1742 + Objects.hashCode(this.destinationId) 1743 + Objects.hashCode(this.sourceOutputIndex); 1744 } 1745 } 1746 1747 1748 // Counter for keeping the WebSocket Request ID's distinct. 1749 private static int counter = 1; 1750 1751 /** 1752 * Enables the WebAudio domain and starts sending context lifetime events. 1753 * 1754 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 1755 * {@link Ret0}></CODE> 1756 * 1757 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 1758 * browser receives the invocation-request. 1759 * 1760 * <BR /><BR />This Browser-Function <I>does not have</I> a return-value. You may choose to 1761 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0} 1762 * {@code >} to ensure the Browser Function has run to completion. 1763 */ 1764 public static Script<String, JsonObject, Ret0> enable() 1765 { 1766 final int webSocketID = 43000000 + counter++; 1767 final boolean[] optionals = new boolean[0]; 1768 1769 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 1770 String requestJSON = WriteJSON.get( 1771 parameterTypes.get("enable"), 1772 parameterNames.get("enable"), 1773 optionals, webSocketID, 1774 "WebAudio.enable" 1775 ); 1776 1777 // This Remote Command does not have a Return-Value. 1778 return new Script<> 1779 (webSocketID, requestJSON, VOID_RETURN.NoReturnValues); 1780 } 1781 1782 /** 1783 * Disables the WebAudio domain. 1784 * 1785 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 1786 * {@link Ret0}></CODE> 1787 * 1788 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 1789 * browser receives the invocation-request. 1790 * 1791 * <BR /><BR />This Browser-Function <I>does not have</I> a return-value. You may choose to 1792 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0} 1793 * {@code >} to ensure the Browser Function has run to completion. 1794 */ 1795 public static Script<String, JsonObject, Ret0> disable() 1796 { 1797 final int webSocketID = 43001000 + counter++; 1798 final boolean[] optionals = new boolean[0]; 1799 1800 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 1801 String requestJSON = WriteJSON.get( 1802 parameterTypes.get("disable"), 1803 parameterNames.get("disable"), 1804 optionals, webSocketID, 1805 "WebAudio.disable" 1806 ); 1807 1808 // This Remote Command does not have a Return-Value. 1809 return new Script<> 1810 (webSocketID, requestJSON, VOID_RETURN.NoReturnValues); 1811 } 1812 1813 /** 1814 * Fetch the realtime data from the registered contexts. 1815 * 1816 * @param contextId - 1817 * 1818 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 1819 * {@link WebAudio.ContextRealtimeData}></CODE> 1820 * 1821 * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using 1822 * {@link Script#exec()}, and afterwards, a {@link Promise}<CODE><JsonObject, 1823 * {@link WebAudio.ContextRealtimeData}></CODE> will be returned. 1824 * 1825 * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>, 1826 * using {@link Promise#await()}, <I>and the returned result of this Browser Function may 1827 * may be retrieved.</I> 1828 * 1829 * <BR /><BR />This Browser Function <B STYLE='color: red'>returns</B> 1830 * <BR /><BR /><UL CLASS=JDUL> 1831 * <LI><CODE>{@link WebAudio.ContextRealtimeData} (<B>realtimeData</B></CODE>) 1832 * <BR />- 1833 * </LI> 1834 * </UL> */ 1835 public static Script<String, JsonObject, WebAudio.ContextRealtimeData> getRealtimeData 1836 (String contextId) 1837 { 1838 // Exception-Check(s) to ensure that if any parameters which are not declared as 1839 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 1840 1841 if (contextId == null) THROWS.throwNPE("contextId"); 1842 1843 final int webSocketID = 43002000 + counter++; 1844 final boolean[] optionals = { false, }; 1845 1846 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 1847 String requestJSON = WriteJSON.get( 1848 parameterTypes.get("getRealtimeData"), 1849 parameterNames.get("getRealtimeData"), 1850 optionals, webSocketID, 1851 "WebAudio.getRealtimeData", 1852 contextId 1853 ); 1854 1855 // 'JSON Binding' ... Converts Browser Response-JSON to 'WebAudio.ContextRealtimeData' 1856 Function<JsonObject, WebAudio.ContextRealtimeData> responseProcessor = (JsonObject jo) -> 1857 ReadJSON.getObject(jo, "realtimeData", WebAudio.ContextRealtimeData.class, false, true); 1858 1859 return new Script<>(webSocketID, requestJSON, responseProcessor); 1860 } 1861 1862}