Skip to content
This repository has been archived by the owner on May 16, 2023. It is now read-only.

Soundfont.instrument with options.destination not taken into account #56

Open
dengarcia opened this issue Feb 26, 2018 · 4 comments
Open

Comments

@dengarcia
Copy link
Contributor

When we load an instrument using Soundfont.instrument with the options.destination set to a node a create (for example GainNode), it is not taken into account.

The doc tells us about the option destination which is not used:

Here what I changed in the code to make it work:

`function instrument (ac, name, options) {
if (arguments.length === 1) return function (n, o) { return instrument(ac, n, o) }
var opts = options || {}
var isUrl = opts.isSoundfontURL || isSoundfontURL
var toUrl = opts.nameToUrl || nameToUrl
var url = isUrl(name) ? name : toUrl(name, opts.soundfont, opts.format)

return load(ac, url, { only: opts.only || opts.notes }).then(function (buffers) {
var p = player(ac, buffers, opts).connect(opts.destination ? opts.destination : ac.destination)
p.url = url
p.name = name
return p
})
}
`

instead of this code
`function instrument (ac, name, options) {
if (arguments.length === 1) return function (n, o) { return instrument(ac, n, o) }
var opts = options || {}
var isUrl = opts.isSoundfontURL || isSoundfontURL
var toUrl = opts.nameToUrl || nameToUrl
var url = isUrl(name) ? name : toUrl(name, opts.soundfont, opts.format)

return load(ac, url, { only: opts.only || opts.notes }).then(function (buffers) {
var p = player(ac, buffers, opts).connect(ac.destination)
var p = player(ac, buffers, opts).connect(opts.destination ? opts.destination : ac.destination)
p.url = url
p.name = name
return p
})
}
`

@ryohey
Copy link

ryohey commented Jun 30, 2018

This seems to have been resolved in #57
@danigb Could you release new version?

@danigb
Copy link
Owner

danigb commented Jul 1, 2018

Yes, is true. Sorry for not release. I'll do it ASAP

@danigb
Copy link
Owner

danigb commented Jul 1, 2018

Done: published 0.10.7 👍

@ryohey
Copy link

ryohey commented Jul 2, 2018

@danigb Thank you so much!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants