<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://www.w3.org/Bugs/Public/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4"
          urlbase="https://www.w3.org/Bugs/Public/"
          
          maintainer="sysbot+bugzilla@w3.org"
>

    <bug>
          <bug_id>20764</bug_id>
          
          <creation_ts>2013-01-24 22:57:14 +0000</creation_ts>
          <short_desc>It makes no sense to use EventListener for onaudioprocess if ScriptProcessorNode isn&apos;t EventTarget</short_desc>
          <delta_ts>2014-10-28 17:16:59 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>AudioWG</product>
          <component>Web Audio API</component>
          <version>unspecified</version>
          <rep_platform>PC</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>CLOSED</bug_status>
          <resolution>WONTFIX</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>TBD</target_milestone>
          
          <blocked>17351</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="Olli Pettay">bugs</reporter>
          <assigned_to name="Chris Rogers">crogers</assigned_to>
          <cc>dominicc</cc>
    
    <cc>ehsan</cc>
    
    <cc>olivier.thereaux</cc>
    
    <cc>roc</cc>
    
    <cc>srikumarks</cc>
          
          <qa_contact>public-audio</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>82112</commentid>
    <comment_count>0</comment_count>
    <who name="Olli Pettay">bugs</who>
    <bug_when>2013-01-24 22:57:14 +0000</bug_when>
    <thetext>First, EventListener should not be used for onfoo handlers.
EventHandler is the right type (or in very special legacy cases OnErrorEventHandler).

But more importantly, if ScriptProcessorNode isn&apos;t EventTarget dispatching
event to it isn&apos;t really possible, and the event wouldn&apos;t have any
.target.

So, either ScriptProcessorNode needs to become EventTarget somehow, and 
get normal event handling, or the callback needs to not use Event objects.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>83304</commentid>
    <comment_count>1</comment_count>
    <who name="Dominic Cooney">dominicc</who>
    <bug_when>2013-02-19 05:14:30 +0000</bug_when>
    <thetext>Bug 17493 comment 1 [1] is relevant.

ScriptProcessorNode should have its own type of callback for onaudioprocess.

[1] &lt;https://www.w3.org/Bugs/Public/show_bug.cgi?id=17493#c1&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>83305</commentid>
    <comment_count>2</comment_count>
    <who name="Ehsan Akhgari [:ehsan]">ehsan</who>
    <bug_when>2013-02-19 05:16:40 +0000</bug_when>
    <thetext>That works too, as long as it&apos;s not an event target.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>83306</commentid>
    <comment_count>3</comment_count>
    <who name="Ehsan Akhgari [:ehsan]">ehsan</who>
    <bug_when>2013-02-19 05:19:39 +0000</bug_when>
    <thetext>Also, in that case, we should rename onaudioprocess for consistency as well.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>83308</commentid>
    <comment_count>4</comment_count>
    <who name="Chris Rogers">crogers</who>
    <bug_when>2013-02-19 06:01:26 +0000</bug_when>
    <thetext>(In reply to comment #3)
&gt; Also, in that case, we should rename onaudioprocess for consistency as well.

This would be a breaking API change for shipping versions, so we&apos;d have to be careful to move it to the &quot;deprecated&quot; and recommended section if we thought it important to change.  Personally, I don&apos;t think there&apos;s any reason it can&apos;t still be called onaudioprocess even though it has nothing to do with EventListener</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>83309</commentid>
    <comment_count>5</comment_count>
    <who name="Ehsan Akhgari [:ehsan]">ehsan</who>
    <bug_when>2013-02-19 06:12:01 +0000</bug_when>
    <thetext>(In reply to comment #4)
&gt; (In reply to comment #3)
&gt; &gt; Also, in that case, we should rename onaudioprocess for consistency as well.
&gt; 
&gt; This would be a breaking API change for shipping versions, so we&apos;d have to
&gt; be careful to move it to the &quot;deprecated&quot; and recommended section if we
&gt; thought it important to change.  Personally, I don&apos;t think there&apos;s any
&gt; reason it can&apos;t still be called onaudioprocess even though it has nothing to
&gt; do with EventListener

webkit can still support the old API I guess, but the onXXX naming convention is used throughout the web platform for things using event targets, and using such a naming scheme will be very surprising to all web developers, so I think that is a really bad idea.

Also the usage of callbacks can enable us clean up the API by accepting the callback as an argument to the createScriptProcessor function, which makes it unnecessary to expose it on ScriptProcessorNode at all.  Speaking of which, I don&apos;t think exposing bufferSize on that node type makes much sense either.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>83310</commentid>
    <comment_count>6</comment_count>
    <who name="Srikumar Subramanian (Kumar)">srikumarks</who>
    <bug_when>2013-02-19 08:04:40 +0000</bug_when>
    <thetext>(In reply to comment #5)

&gt; Also the usage of callbacks can enable us clean up the API by accepting the
&gt; callback as an argument to the createScriptProcessor function, which makes
&gt; it unnecessary to expose it on ScriptProcessorNode at all.  Speaking of
&gt; which, I don&apos;t think exposing bufferSize on that node type makes much sense
&gt; either.

It is useful to be able to change the callback after creating the script node. Please lets not change that.

Exposing buffer size is also useful. The script node currently shares CPU with the main thread. Given this architecture, the amount of time available for audio can be different for different kinds of applications. A graphics rich application may not be able to guarantee enough callbacks just in time, in which case longer buffers would be desirable. An application that spends most of its time doing audio or being idle can use smaller buffer sizes to get lower latency. It is unnecessary to mandate an implementation to automatically determine the required buffering.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>83967</commentid>
    <comment_count>7</comment_count>
    <who name="Robert O&apos;Callahan (Mozilla)">roc</who>
    <bug_when>2013-03-04 22:40:05 +0000</bug_when>
    <thetext>(In reply to comment #6)
&gt; Exposing buffer size is also useful. The script node currently shares CPU
&gt; with the main thread. Given this architecture, the amount of time available
&gt; for audio can be different for different kinds of applications. A graphics
&gt; rich application may not be able to guarantee enough callbacks just in time,
&gt; in which case longer buffers would be desirable. An application that spends
&gt; most of its time doing audio or being idle can use smaller buffer sizes to
&gt; get lower latency. It is unnecessary to mandate an implementation to
&gt; automatically determine the required buffering.

The problem with the author choosing the buffer size is that they almost certainly won&apos;t be able to choose a size that will work on all kinds of platforms and devices. The UA is best placed to do that. Anyway, there has been discussion about this on the list, and further discussion should take place there, definitely not in this bug :-)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>84441</commentid>
    <comment_count>8</comment_count>
    <who name="Olivier Thereaux">olivier.thereaux</who>
    <bug_when>2013-03-14 17:36:06 +0000</bug_when>
    <thetext>At the 2013-03-14 teleconference, we agreed that the best solution was probably the one suggested by Dominic in http://lists.w3.org/Archives/Public/public-audio/2013JanMar/0387.html

Ehsan, would you be able to fill in the blanks and make the change?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>84456</commentid>
    <comment_count>9</comment_count>
    <who name="Dominic Cooney">dominicc</who>
    <bug_when>2013-03-15 02:05:55 +0000</bug_when>
    <thetext>I feel like the change proposed here is not in line with recent discussion on public-audio (&quot;The issue of ScriptProcessorNode not being an EventTarget.&quot;) &lt;http://lists.w3.org/Archives/Public/public-audio/2013JanMar/0216.html&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>84458</commentid>
    <comment_count>10</comment_count>
    <who name="Dominic Cooney">dominicc</who>
    <bug_when>2013-03-15 02:07:10 +0000</bug_when>
    <thetext>Please disregard Comment 9--I did not see Comment 8.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>84489</commentid>
    <comment_count>11</comment_count>
    <who name="Ehsan Akhgari [:ehsan]">ehsan</who>
    <bug_when>2013-03-15 22:36:02 +0000</bug_when>
    <thetext>OK, I edited the spec accordingly:

https://dvcs.w3.org/hg/audio/rev/c68c2551f6c8

Please let me know if it looks good.

Now&apos;s the time to talk about AudioProcessingEvent.node.  I don&apos;t think that it makes sense for that attribute to exist, since it will be the same as AudioProcessingEvent.target.  Do I need to file another bug on that?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>84493</commentid>
    <comment_count>12</comment_count>
    <who name="Olli Pettay">bugs</who>
    <bug_when>2013-03-15 22:45:17 +0000</bug_when>
    <thetext>&quot;This interface is a type of Event which is passed to the onaudioprocess event handler used by ScriptProcessorNode. &quot;
is still a bit odd, since event handling uses now the normal model.

And there is also
&quot;This value controls how frequently the onaudioprocess event handler is called&quot;

The spec also doesn&apos;t mention when audioprocess event is dispatched, only
vaguely talks about how bufferSize affects to the frequency of those events.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>84550</commentid>
    <comment_count>13</comment_count>
    <who name="Dominic Cooney">dominicc</who>
    <bug_when>2013-03-18 09:12:33 +0000</bug_when>
    <thetext>Where is EventHandler defined? In the [DOM] reference, only EventListener is defined. I think the spec might be missing a reference.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>84760</commentid>
    <comment_count>14</comment_count>
    <who name="Ehsan Akhgari [:ehsan]">ehsan</who>
    <bug_when>2013-03-21 03:56:45 +0000</bug_when>
    <thetext>(In reply to comment #12)
&gt; &quot;This interface is a type of Event which is passed to the onaudioprocess
&gt; event handler used by ScriptProcessorNode. &quot;
&gt; is still a bit odd, since event handling uses now the normal model.
&gt; 
&gt; And there is also
&gt; &quot;This value controls how frequently the onaudioprocess event handler is
&gt; called&quot;

I cleared up the wording in https://dvcs.w3.org/hg/audio/rev/e26b49247d95.

&gt; The spec also doesn&apos;t mention when audioprocess event is dispatched, only
&gt; vaguely talks about how bufferSize affects to the frequency of those events.

That is a good question.  I&apos;ll leave that part to crogers.

(In reply to comment #13)
&gt; Where is EventHandler defined? In the [DOM] reference, only EventListener is
&gt; defined. I think the spec might be missing a reference.

The HTML spec.  I added a reference in https://dvcs.w3.org/hg/audio/rev/2056740735fd.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>113888</commentid>
    <comment_count>15</comment_count>
    <who name="Olivier Thereaux">olivier.thereaux</who>
    <bug_when>2014-10-28 17:14:06 +0000</bug_when>
    <thetext>Web Audio API issues have been migrated to Github. 
See https://github.com/WebAudio/web-audio-api/issues</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>114034</commentid>
    <comment_count>16</comment_count>
    <who name="Olivier Thereaux">olivier.thereaux</who>
    <bug_when>2014-10-28 17:16:59 +0000</bug_when>
    <thetext>Closing. See https://github.com/WebAudio/web-audio-api/issues for up to date list of issues for the Web Audio API.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>