<?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>20512</bug_id>
          
          <creation_ts>2012-12-24 10:45:24 +0000</creation_ts>
          <short_desc>MIDIEvent lacking constructor</short_desc>
          <delta_ts>2013-01-11 08:59:46 +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>MIDI API</component>
          <version>unspecified</version>
          <rep_platform>PC</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>CLOSED</bug_status>
          <resolution>MOVED</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>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Marcos Caceres">w3c</reporter>
          <assigned_to name="This bug has no owner yet - up for the taking">dave.null</assigned_to>
          <cc>chris</cc>
    
    <cc>cwilso</cc>
    
    <cc>olivier.thereaux</cc>
    
    <cc>w3c</cc>
          
          <qa_contact>public-audio</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>80563</commentid>
    <comment_count>0</comment_count>
    <who name="Marcos Caceres">w3c</who>
    <bug_when>2012-12-24 10:45:24 +0000</bug_when>
    <thetext>The MIDIEvent is lacking a way for authors to construct MIDI events. 

[Constructor(DOMString type, optional MIDIEventInit eventInitDict)]
interface MIDIEvent : Event {
    readonly attribute DOMHighResTimeStamp timestamp;
    readonly attribute Uint8Array          data;
};

dictionary MIDIEventInit : EventInit {
  any data;
};

(note that I left data as any, assuming UInt8Array conversion will be performed automatically).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>80593</commentid>
    <comment_count>1</comment_count>
    <who name="Chris Wilson">cwilso</who>
    <bug_when>2012-12-26 17:10:53 +0000</bug_when>
    <thetext>Why should you ever need to construct a MIDIEvent?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>80594</commentid>
    <comment_count>2</comment_count>
    <who name="Marcos Caceres">w3c</who>
    <bug_when>2012-12-26 17:17:47 +0000</bug_when>
    <thetext>(In reply to comment #1)
&gt; Why should you ever need to construct a MIDIEvent?

This one is for consistency with the rest of the Web platform (every event in the platform has a public constructor, AFAIK).  

Use case is primarily for testing through constructing and firing synthetic events....</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>81057</commentid>
    <comment_count>3</comment_count>
    <who name="Chris Lilley">chris</who>
    <bug_when>2013-01-08 16:45:45 +0000</bug_when>
    <thetext>(In reply to comment #1)
&gt; Why should you ever need to construct a MIDIEvent?

Because you are writing a sequencer, auto-chord maker, arpeggiator, etc?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>81068</commentid>
    <comment_count>4</comment_count>
    <who name="Chris Wilson">cwilso</who>
    <bug_when>2013-01-08 17:46:04 +0000</bug_when>
    <thetext>(In reply to comment #3)
&gt; (In reply to comment #1)
&gt; &gt; Why should you ever need to construct a MIDIEvent?
&gt; 
&gt; Because you are writing a sequencer, auto-chord maker, arpeggiator, etc?

That&apos;s a great reason why you should need to maintain MIDI event data - but not really a justification for why you would want to create an Event-derived object that contains said data.  This isn&apos;t just a data container - it has all the Event stuff, too - and it&apos;s no longer used for sending data.  (For an arpeggiator, for example, you&apos;d just create the data array for each note and call send().)

Marcos&apos; &quot;primarily for testing, firing synthetic events&quot; is a justifiable reason, I suppose; however, I&apos;m not sure I see how this is done in other specs.  Is there a TouchEvent constructor somewhere?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>81075</commentid>
    <comment_count>5</comment_count>
    <who name="Marcos Caceres">w3c</who>
    <bug_when>2013-01-08 19:19:28 +0000</bug_when>
    <thetext>(In reply to comment #4) 
&gt; Marcos&apos; &quot;primarily for testing, firing synthetic events&quot; is a justifiable
&gt; reason, I suppose; however, I&apos;m not sure I see how this is done in other
&gt; specs.  Is there a TouchEvent constructor somewhere?

The TouchEvent spec is not a good guide as it lacks a link to UIEvent (maybe that spec has not been well reviewed, but not sure). 

I recommend looking at the new DOM UI Events spec... there is a whole section on constructors for events (the spec is currently not loading well in Chrome, so use FF or something else to view it):

https://dvcs.w3.org/hg/d4e/raw-file/tip/source_respec.htm

As an aside, the Event interface, from which MIDIEvent inherits, has a constructor. But I&apos;m having trouble finding in WebIDL what it means to inherit from an interface that has a constructor on it.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>81076</commentid>
    <comment_count>6</comment_count>
    <who name="Chris Wilson">cwilso</who>
    <bug_when>2013-01-08 19:26:57 +0000</bug_when>
    <thetext>(In reply to comment #5)
&gt; (In reply to comment #4) 
&gt; &gt; Marcos&apos; &quot;primarily for testing, firing synthetic events&quot; is a justifiable
&gt; &gt; reason, I suppose; however, I&apos;m not sure I see how this is done in other
&gt; &gt; specs.  Is there a TouchEvent constructor somewhere?
&gt; 
&gt; The TouchEvent spec is not a good guide as it lacks a link to UIEvent (maybe
&gt; that spec has not been well reviewed, but not sure). 
&gt; 
&gt; I recommend looking at the new DOM UI Events spec... there is a whole
&gt; section on constructors for events (the spec is currently not loading well
&gt; in Chrome, so use FF or something else to view it):
&gt; 
&gt; https://dvcs.w3.org/hg/d4e/raw-file/tip/source_respec.htm
&gt; 
&gt; As an aside, the Event interface, from which MIDIEvent inherits, has a
&gt; constructor. But I&apos;m having trouble finding in WebIDL what it means to
&gt; inherit from an interface that has a constructor on it.

I would think this would be symmetric with UI Events - so the answer to &quot;how do I synthesize a MIDIEvent&quot; would be:

var event = new Event(&quot;message&quot;, {data: [...], timestamp: t });</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>81220</commentid>
    <comment_count>7</comment_count>
    <who name="Olivier Thereaux">olivier.thereaux</who>
    <bug_when>2013-01-11 08:59:39 +0000</bug_when>
    <thetext>This issue now tracked at: 
https://github.com/WebAudio/web-midi-api/issues/1</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>