W3C home > Mailing lists > Public > public-audio@w3.org > July to September 2013

AudioBuffer channel read/write APIs

From: Robert O'Callahan <robert@ocallahan.org>
Date: Fri, 6 Sep 2013 14:34:52 +1200
Message-ID: <CAOp6jLZw9-sMK1EkYx-Jfo8g7FEs7AKLY8XG4e9RO3asLb4rDA@mail.gmail.com>
To: "public-audio@w3.org" <public-audio@w3.org>
This is what I proposed:

partial interface AudioBuffer {
  void copyChannelDataTo(long channelNumber, unsigned long start, unsigned
long length, Float32Array destination);
}

I agree with Jer that it makes sense to have a corresponding method to
write into channel buffers.

We could call it copyChannelDataFrom but i think that might get a little
confusing. We can also make 'length' optional. So here's my revised
proposal:

partial interface AudioBuffer {
  void copyFromChannel(Float32Array destination, long channelNumber,
unsigned long start, optional unsigned long length);
  void copyToChannel(Float32Array source, long channelNumber, unsigned long
start, optional unsigned long length);
}

In both methods, 'length' defaults to the array's length. An exception is
thrown if start+length is greater than the ArrayBuffer's length or if the
array length is less than 'length'. I put the array first so that the
parameters identifying the channel and the channel data range are together.

I'd like to get this implemented in Gecko ASAP, so please bikeshed in a
timely manner :-).

Rob
-- 
Jtehsauts  tshaei dS,o n" Wohfy  Mdaon  yhoaus  eanuttehrotraiitny  eovni
le atrhtohu gthot sf oirng iyvoeu rs ihnesa.r"t sS?o  Whhei csha iids  teoa
stiheer :p atroa lsyazye,d  'mYaonu,r  "sGients  uapr,e  tfaokreg iyvoeunr,
'm aotr  atnod  sgaoy ,h o'mGee.t"  uTph eann dt hwea lmka'n?  gBoutt  uIp
waanndt  wyeonut  thoo mken.o w  *
*
Received on Friday, 6 September 2013 02:35:21 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:50:10 UTC