* Fades a track between two volumes. * * @param opts {object} * @param opts.track {string} track to fade * @param opts.from {number|undefined} start volume between 0 and 1 * @param opts.to {number} finish volume between 0 and 1 * @param opts.duration {number} duration o
({ state, dispatch }, { track, from, to, duration })
| 410 | * @throws {Error} when invalid track specified |
| 411 | */ |
| 412 | fadeTrack ({ state, dispatch }, { track, from, to, duration }) { |
| 413 | const trackData = state.tracks[track] |
| 414 | if (!trackData) { |
| 415 | throw new Error('Invalid track specified') |
| 416 | } |
| 417 | |
| 418 | const fades = Array.from(trackData.keys()) |
| 419 | .map(id => dispatch('fadeSound', { id, from, to, duration })) |
| 420 | |
| 421 | return Promise.all(fades) |
| 422 | }, |
| 423 | |
| 424 | /** |
| 425 | * Fades a sound between two volumes. |
nothing calls this directly
no test coverage detected