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