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