Skip to content
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

AudioBuffer should not be tied to a context #370

Closed
cwilso opened this issue Oct 14, 2014 · 8 comments
Closed

AudioBuffer should not be tied to a context #370

cwilso opened this issue Oct 14, 2014 · 8 comments
Assignees
Labels
Needs Discussion The issue needs more discussion before it can be fixed.
Milestone

Comments

@cwilso
Copy link
Contributor

cwilso commented Oct 14, 2014

AudioBuffers shouldn't really be tied to an AudioContext*. Therefore, AudioBuffers should have a constructor that works - i.e. "context.createBuffer(2, 88200, 44100);" should turn into "new AudioBuffer(2, 88200, 44100);"

*except when they're created by decodeAudioData - and even that shouldn't be "tied" to an AudioContext - i.e. I think they should be shareable - but the context currently resamples. We should also make decodeAudioData have a flag that disables the resampling.

@rtoy
Copy link
Member

rtoy commented Oct 15, 2014

But even with the resampling by decodeAudioData, the resulting AudioBuffer should be shareable.

Also, see Issue #30.

@cwilso
Copy link
Contributor Author

cwilso commented Oct 27, 2015

This is actually going to happen in v1, as part of #250.

@cwilso cwilso closed this as completed Oct 27, 2015
@joeberkovitz
Copy link
Contributor

I am reopening, moving to V1 and marking as needing discussion because it probably didn't happen in the way that @cwilso expected: the current AudioBuffer constructor takes a BaseAudioContext as its first argument. Which seems unnecessary; perhaps this was a mistake? Or is it nullable?

@joeberkovitz joeberkovitz reopened this Dec 15, 2016
@joeberkovitz joeberkovitz self-assigned this Dec 15, 2016
@joeberkovitz joeberkovitz added the Needs Discussion The issue needs more discussion before it can be fixed. label Dec 15, 2016
@joeberkovitz joeberkovitz changed the title AudioBuffer creation issues AudioBuffer should not be tied to a context Dec 15, 2016
@cwilso
Copy link
Contributor Author

cwilso commented Dec 15, 2016

Yeah, not sure why AudioContext is needed at all here?

@rtoy
Copy link
Member

rtoy commented Dec 16, 2016

Yeah, let's remove this. I think we just forgot about this issue when defining the constructor. So, something like

[ Constructor(AudioBufferOptions options)]

but AudioBufferOptions.sampleRate would now be required.

@danigb
Copy link

danigb commented Jan 10, 2017

Hi, thanks for the awesome work, and sorry for comment on a cloosed issue, but I have a question:

Does it means that in next version of WAA we will be able to create a buffer using the constructor instead of AudioContext's factory function?:

var buffer = new AudioBuffer(length, 44100);
buffer.copyToChannel(myArray);

Thanks

@rtoy
Copy link
Member

rtoy commented Jan 10, 2017 via email

@danigb
Copy link

danigb commented Jan 10, 2017

Great news! Thanks for the answer @rtoy !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Discussion The issue needs more discussion before it can be fixed.
Projects
None yet
Development

No branches or pull requests

6 participants
@danigb @joeberkovitz @cwilso @rtoy @mdjp and others