1

I'm trying to understand this Dart web-audio demo: https://www.dartlang.org/samples/webaudio/

This demo is a port of this javascript-demo posted on html5rocks.com: http://www.html5rocks.com/en/tutorials/webaudio/intro/#toc-filter

The Dart port is identical to the version on html5rocks except for the input range response. The example on html5 rocks is real-time. It's not necessary to release the mousebutton to hear the difference. Though in the Dart port you have to release the mouse button to fire the event listener.

This is the event listener in the Dart code:

querySelector("#frequency-range").onChange.listen((Event e) {
  num value = double.parse((e.currentTarget as InputElement).value);
  _changeFrequency(value);
});

The querySelector is refering to this input field:

<input type="range" min="0" max="1" step="0.01" value="1" id="frequency-range">

Does somebody know how to make the onChange event fire realtime, without having to release the click-button?

Edit: The dart webaudio intro example has been updated so that the Dart port is now functionally identical to the Javascript demo. Thanks to whoever read this question and changed it! :)

Tomasito665
  • 1,188
  • 1
  • 12
  • 24
  • I think the question is still relevant. It's always difficult to figure out what events are available and which one is the right one for the case at hand. Sure the demo was updated, but others might stumble upon this question when searching for `dart range event`, or similar, without care about the demo that caused you to ask this question. Just my 2c – Günter Zöchbauer Nov 24 '15 at 11:06
  • 1
    Good point. I still think it's good to mention it has been updated. I removed the 'not relevant anymore' part and changed it a little bit so that it gets less attention. – Tomasito665 Nov 24 '15 at 11:27

1 Answers1

1

The HTML5 rocks demo uses onInput instead. and this also works the same in Dart.

See also onchange event on input type=range is not triggering in firefox while dragging

Community
  • 1
  • 1
Günter Zöchbauer
  • 623,577
  • 216
  • 2,003
  • 1,567