channel splitting and channels parameter

This commit is contained in:
Jade Rowland 2023-11-23 01:04:53 -05:00
parent f0b458cd17
commit e419733716
2 changed files with 42 additions and 34 deletions

View file

@ -4,7 +4,7 @@ Copyright (C) 2022 Strudel contributors - see <https://github.com/tidalcycles/st
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
import { Pattern, register, sequence } from './pattern.mjs';
import { Pattern, register, reify, sequence } from './pattern.mjs';
import { zipWith } from './util.mjs';
const controls = {};
@ -381,18 +381,18 @@ const generic_params = [
*/
['coarse'],
/**
* Allows you to set the output channels on the interface
*
* @name channels
* @synonyms ch
*
* @param {!Float32Array} channels Array<int>
* @example
* note("e a d b g").channels([2, 3]).room(1)
*
*/
['channels', 'ch'],
// /**
// * Allows you to set the output channels on the interface
// *
// * @name channels
// * @synonyms ch
// *
// * @param {!Float32Array} channels Array<int>
// * @example
// * note("e a d b g").channels([2, 3]).room(1)
// *
// */
// ['channels', 'ch'],
['phaserrate', 'phasr'], // superdirt only
@ -1390,4 +1390,13 @@ controls.ds = register('ds', (ds, pat) => {
return pat.set({ decay, sustain });
});
controls.ch = register(['channels', 'ch'], (channels, pat) => {
channels = !Array.isArray(channels) ? [channels] : channels;
// channels = channels.map(reify).map((channelPat) => {
// // How do I return the current value of the channel pattern here?
// });
return pat.set({ channels });
});
export default controls;