Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
DartBot opened this issue Oct 26, 2012 · 13 comments
Closed

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

DartBot opened this issue Oct 26, 2012 · 13 comments
Assignees
Labels
web-libraries Issues impacting dart:html, etc., libraries
Milestone

Comments

@DartBot
Copy link

DartBot commented Oct 26, 2012

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.

@sethladd
Copy link
Contributor

This might be a Dartium issue.


Added Area-Dartium, Triaged labels.

@DartBot
Copy link
Author

DartBot commented Oct 29, 2012

This comment was originally written by [email protected]


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


cc @vsmenon.
Set owner to [email protected].
Added this to the M2 milestone.
Removed Area-Dartium label.
Added Area-HTML, Fixed labels.

@DartBot
Copy link
Author

DartBot commented Oct 29, 2012

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
Copy link
Author

DartBot commented Oct 29, 2012

This comment was originally written by [email protected]


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
Copy link
Author

DartBot commented Oct 29, 2012

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
Copy link
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
Copy link
Author

DartBot commented Oct 29, 2012

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
Copy link
Author

DartBot commented Oct 29, 2012

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
Copy link
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
Copy link
Member

cc @larsbak.

@rakudrama
Copy link
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
Copy link
Contributor

On it.


Added Accepted label.

@efortuna
Copy link
Contributor

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


Added Fixed label.

@DartBot DartBot added Type-Defect web-libraries Issues impacting dart:html, etc., libraries labels Oct 30, 2012
@DartBot DartBot added this to the M2 milestone Oct 30, 2012
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
web-libraries Issues impacting dart:html, etc., libraries
Projects
None yet
Development

No branches or pull requests

4 participants