| 43 | } |
| 44 | |
| 45 | void AnalyserNode::shared_construction(int fftSize) |
| 46 | { |
| 47 | _detail = new Detail; |
| 48 | |
| 49 | _detail->m_analyser = new RealtimeAnalyser((uint32_t) fftSize); |
| 50 | |
| 51 | _detail->_fftSize = setting("fftSize"); |
| 52 | _detail->_minDecibels = setting("minDecibels"); |
| 53 | _detail->_maxDecibels = setting("maxDecibels"); |
| 54 | _detail->_smoothingTimeConstant = setting("smoothingTimeConstant"); |
| 55 | |
| 56 | _detail->_fftSize->setUint32(static_cast<uint32_t>(fftSize)); |
| 57 | _detail->_fftSize->setValueChanged( |
| 58 | [this]() { |
| 59 | delete _detail->m_analyser; |
| 60 | _detail->m_analyser = new RealtimeAnalyser(_detail->_fftSize->valueUint32()); |
| 61 | |
| 62 | // restore other values |
| 63 | _detail->m_analyser->setMinDecibels(_detail->_minDecibels->valueFloat()); |
| 64 | _detail->m_analyser->setMaxDecibels(_detail->_maxDecibels->valueFloat()); |
| 65 | }); |
| 66 | |
| 67 | _detail->_minDecibels->setFloat(-100.f); |
| 68 | _detail->_minDecibels->setValueChanged( |
| 69 | [this]() { |
| 70 | _detail->m_analyser->setMinDecibels(_detail->_minDecibels->valueFloat()); |
| 71 | }); |
| 72 | |
| 73 | _detail->_maxDecibels->setFloat(-30.f); |
| 74 | _detail->_maxDecibels->setValueChanged( |
| 75 | [this]() { |
| 76 | _detail->m_analyser->setMaxDecibels(_detail->_minDecibels->valueFloat()); |
| 77 | }); |
| 78 | |
| 79 | _detail->_smoothingTimeConstant->setFloat(0.8f); |
| 80 | _detail->_smoothingTimeConstant->setValueChanged( |
| 81 | [this]() { |
| 82 | _detail->m_analyser->setSmoothingTimeConstant(_detail->_smoothingTimeConstant->valueFloat()); |
| 83 | }); |
| 84 | |
| 85 | // N.B.: inputs and outputs added by AudioBasicInspectorNode... not here. |
| 86 | initialize(); |
| 87 | } |
| 88 | |
| 89 | AnalyserNode::AnalyserNode(AudioContext & ac, int fftSize) |
| 90 | : AudioBasicInspectorNode(ac, *desc(), 1) |
nothing calls this directly
no test coverage detected