Skip to content

DartVM - checked mode throws strange error with 'AudioGainNode' #6292

Closed
@DartBot

Description

@DartBot

This issue was originally filed by @bp74


What steps will reproduce the problem?

import 'dart:html';

void main() {
  AudioContext audioContext = new AudioContext();
  AudioGainNode audioGainNode = audioContext.createGainNode();
  audioGainNode.connect(audioContext.destination, 0, 0);
}

What is the expected output? What do you see instead?

Exception: 'http://127.0.0.1:3030/C:/Users/Bernhard/dart/Test/web/Test.dart': Error: line 5 pos 3: type 'AudioGainNode' is not loaded
  AudioGainNode audioGainNode = audioContext.createGainNode();
  ^
type '_GainNodeImpl' is not a subtype of type 'malformed' of 'audioGainNode'.
Stack Trace: #­0 main (http://127.0.0.1:3030/C:/Users/Bernhard/dart/Test/web/Test.dart:5:60)

What version of the product are you using? On what operating system?

Dart Editor Build 14127, Windows 7 64 bit

Please provide any additional information below.

Activity

sethladd

sethladd commented on Oct 27, 2012

@sethladd
Contributor

This might be a Dartium issue.


Added Area-Dartium, Triaged labels.

DartBot

DartBot commented on Oct 29, 2012

@DartBot
Author

This comment was originally written by antonm@google.com


AudioGainNode has been recently renamed to GainNode in WebKit. Alas, our IDLs haven't caught up.


cc @vsmenon.
Set owner to antonm@google.com.
Added this to the M2 milestone.
Removed Area-Dartium label.
Added Area-HTML, Fixed labels.

DartBot

DartBot commented on Oct 29, 2012

@DartBot
Author

This comment was originally written by @bp74


But is there a workaround to use the "Web Audio API" on current builds of Chrome and Safari? We saw a similar problem with method renames like "noteOn" to "start" and "noteOff" to "stop". Which made "Web Audio API" in combination with DART unusable on current browsers.

DartBot

DartBot commented on Oct 29, 2012

@DartBot
Author

This comment was originally written by antonm@google.com


That's tough.

Dartium as of now is best regarded as Chromium's dev channel siblings. So any changes which made into dev channel, got into Dartium very quickly.

Overall, we'd rather not provide additional buffering for APIs in flux like, apparently, Web Audio, but if you really suffer, we can to some extent mitigate by, e.g., renaming new names to old and alike. Another option for you, in this particular case, would be to switch to typeless variant.

How much do you need it?

Please. consider that we're very small team and if we spend additional time on maintaing backward compatibility, we have less cycles to work on new features.

Anyway, we'll definitely discuss that.

DartBot

DartBot commented on Oct 29, 2012

@DartBot
Author

This comment was originally written by @bp74


Sure i understand, especially in this case where the API is changing all the time. Maybe it will work anyway because the AudioGainNode (GainNode) is not instantiated but returned by the method "audioContext.createGainNode". I keep my fingers crossed! If we can't use the Web Audio API until Chrome get's to version 24 or 25, that would be unfortunate.

sethladd

sethladd commented on Oct 29, 2012

@sethladd
Contributor

Could we make GainNode subclass AudioGainNode for a release or two? And then mark AudioGainNode as deprecated and remove it in the next milestone?

DartBot

DartBot commented on Oct 29, 2012

@DartBot
Author

This comment was originally written by @bp74


I did a quick test:

* With Dart Editor Build r14167 (current official version, before IDL update AudioGainNode->GainNode)

  var gainNode = context.createGainNode();
  gainNode.connect(context.destination, 0, 0);
 
This works in Dartium (checked mode) because we don't specify the Type of gainNode and it works in Chrome (dart2js):

* With Dart Editor Build r14212 (has the updated IDL and now it's GainNode)

  GainNode gainNode = context.createGainNode();
  gainNode.connect(context.destination, 0, 0);

This works in Dartium (checked mode) because GainNode is the correct type, but as soon as you compile it with dart2js you get an error. Therefore you can't use Web Audio API in Chrome and Safari.

"Uncaught TypeError: connect$3 is not a function" -> It's the connect method of the gainNode.

DartBot

DartBot commented on Oct 29, 2012

@DartBot
Author

This comment was originally written by @bp74


To make it short: After the IDL update it's not a problem with Dartium anymore, it's a problem with dart2js. There are many renames for cross browser compatibility in dart2js already, maybe it's easy for the compiler guys to fix it!?

rakudrama

rakudrama commented on Oct 29, 2012

@rakudrama
Member

Each time a class name changes, the type tag we use for the first-time dynamic dispatch changes. We need to update the mapping from the old type tag to the new type tag as a backwards compatibility issue.

Seth:
The trick of subclassing does not really work.
It is ugly and a maintenance bear if the class has constructors.
On browsers that have AudioGainNode it should pretend to be GainNode.

Lars:
Tracking changing APIs would be less expensive if we could simply add a typedef, something like this:

@deprecated('Please update your program to use GainNode')
typedef AudioGainNode = GainNode;


Added Triaged label.

rakudrama

rakudrama commented on Oct 29, 2012

@rakudrama
Member
rakudrama

rakudrama commented on Oct 30, 2012

@rakudrama
Member

Emily, can you add the mappings AudioGainNode -> GainNode and others from the recent IDL roll to the mapping in dart2js.

It affects webkit browsers, i.e. Chrome and Safari.


Set owner to @efortuna.

efortuna

efortuna commented on Oct 30, 2012

@efortuna
Contributor

On it.


Added Accepted label.

efortuna

efortuna commented on Oct 30, 2012

@efortuna
Contributor

Fix committed in 14310.
https://codereview.chromium.org/11345038
let me know if there are other issues.


Added Fixed label.

added this to the M2 milestone on Oct 30, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

web-librariesIssues impacting dart:html, etc., libraries

Type

No type

Projects

No projects

Relationships

None yet

    Development

    No branches or pull requests

      Participants

      @sethladd@rakudrama@efortuna@DartBot

      Issue actions

        DartVM - checked mode throws strange error with 'AudioGainNode' · Issue #6292 · dart-lang/sdk