|
| 1 | +/** Documentation is thanks to Mozilla Contributors at https://developer.mozilla.org/en-US/docs/Web/API and available |
| 2 | + * under the Creative Commons Attribution-ShareAlike v2.5 or later. http://creativecommons.org/licenses/by-sa/2.5/ |
| 3 | + * |
| 4 | + * Everything else is under the MIT License http://opensource.org/licenses/MIT |
| 5 | + */ |
| 6 | +package org.scalajs.dom |
| 7 | + |
| 8 | +import scala.scalajs.js |
| 9 | + |
| 10 | +/** The AnalyserNode interface represents a node able to provide real-time frequency and time-domain analysis |
| 11 | + * information. It is an AudioNode that passes the audio stream unchanged from the input to the output, but allows you |
| 12 | + * to take the generated data,process it, and create audio visualizations. |
| 13 | + * |
| 14 | + * An AnalyzerNode has exactly one input and one output. The node works even if the output is not connected. |
| 15 | + * |
| 16 | + * - Number of inputs: 1 |
| 17 | + * - Number of outputs: 1 (but may be left unconnected) |
| 18 | + * - Channel count mode: "explicit" |
| 19 | + * - Channel count: 1 |
| 20 | + * - Channel interpretation: "speakers" |
| 21 | + */ |
| 22 | +@js.native |
| 23 | +trait AnalyserNode extends AudioNode { |
| 24 | + |
| 25 | + /** Is an unsigned long value representing the size of the FFT (Fast Fourier Transform) to be used to determine the |
| 26 | + * frequency domain. |
| 27 | + */ |
| 28 | + var fftSize: Int = js.native |
| 29 | + |
| 30 | + /** Is an unsigned long value half that of the FFT size. This generally equates to the number of data values you will |
| 31 | + * have to play with for the visualization. |
| 32 | + */ |
| 33 | + val frequencyBinCount: Int = js.native |
| 34 | + |
| 35 | + /** Is a double value representing the minimum power value in the scaling range for the FFT analysis data, for |
| 36 | + * conversion to unsigned byte values — basically, this specifies the minimum value for the range of results when |
| 37 | + * using getByteFrequencyData(). |
| 38 | + */ |
| 39 | + var minDecibels: Double = js.native |
| 40 | + |
| 41 | + /** Is a double value representing the maximum power value in the scaling range for the FFT analysis data, for |
| 42 | + * conversion to unsigned byte values — basically, this specifies the maximum value for the range of results when |
| 43 | + * using getByteFrequencyData(). |
| 44 | + */ |
| 45 | + var maxDecibels: Double = js.native |
| 46 | + |
| 47 | + /** Is a double value representing the averaging constant with the last analysis frame — basically, it makes the |
| 48 | + * transition between values over time smoother. |
| 49 | + */ |
| 50 | + var smoothingTimeConstant: Double = js.native |
| 51 | + |
| 52 | + /** Copies the current frequency data into a Float32Array array passed into it. |
| 53 | + * |
| 54 | + * If the array has fewer elements than the AnalyserNode.frequencyBinCount, excess elements are dropped. If it has |
| 55 | + * more elements than needed, excess elements are ignored. |
| 56 | + * |
| 57 | + * @param array |
| 58 | + * The Float32Array that the frequency domain data will be copied to. |
| 59 | + */ |
| 60 | + def getFloatFrequencyData(array: js.typedarray.Float32Array): Unit = js.native |
| 61 | + |
| 62 | + /** Copies the current frequency data into a Uint8Array (unsigned byte array) passed into it. |
| 63 | + * |
| 64 | + * If the array has fewer elements than the AnalyserNode.frequencyBinCount, excess elements are dropped. If it has |
| 65 | + * more elements than needed, excess elements are ignored. |
| 66 | + * |
| 67 | + * @param array |
| 68 | + * The Uint8Array that the frequency domain data will be copied to. |
| 69 | + */ |
| 70 | + def getByteFrequencyData(array: js.typedarray.Uint8Array): Unit = js.native |
| 71 | + |
| 72 | + /** Copies the current waveform, or time-domain, data into a Float32Array array passed into it. |
| 73 | + * |
| 74 | + * If the array has fewer elements than the AnalyserNode.fftSize, excess elements are dropped. If it has more |
| 75 | + * elements than needed, excess elements are ignored. |
| 76 | + * |
| 77 | + * @param array |
| 78 | + * The Float32Array that the time domain data will be copied to. |
| 79 | + */ |
| 80 | + def getFloatTimeDomainData(array: js.typedarray.Float32Array): Unit = js.native |
| 81 | + |
| 82 | + /** Copies the current waveform, or time-domain, data into a Uint8Array (unsigned byte array) passed into it. |
| 83 | + * |
| 84 | + * If the array has fewer elements than the AnalyserNode.fftSize, excess elements are dropped. If it has more |
| 85 | + * elements than needed, excess elements are ignored. |
| 86 | + * |
| 87 | + * @param array |
| 88 | + * The Uint8Array that the time domain data will be copied to. |
| 89 | + */ |
| 90 | + def getByteTimeDomainData(array: js.typedarray.Uint8Array): Unit = js.native |
| 91 | +} |
0 commit comments