brand-music
Version:
Strongly typed music theory library
92 lines (89 loc) • 2.38 kB
JavaScript
import {
ALL,
EMPTY,
isTwelveBits,
masked,
values
} from "./chunk-2U4535RW.js";
import {
from
} from "./chunk-AVZSITO3.js";
import {
__export
} from "./chunk-YLMQSMVX.js";
// src/PitchIntervalClassSet.ts
var PitchIntervalClassSet_exports = {};
__export(PitchIntervalClassSet_exports, {
ALL: () => ALL2,
EMPTY: () => EMPTY2,
add: () => add,
difference: () => difference,
from: () => from2,
fromRaw: () => fromRaw,
fromRawMasked: () => fromRawMasked,
fromRawUnknown: () => fromRawUnknown,
has: () => has,
hasShape: () => hasShape,
intersection: () => intersection,
isSubset: () => isSubset,
isSuperset: () => isSuperset,
mark: () => mark,
markRaw: () => markRaw,
markRawUnknown: () => markRawUnknown,
remove: () => remove,
symmetricDifference: () => symmetricDifference,
toggle: () => toggle,
toggleAll: () => toggleAll,
union: () => union,
values: () => values2
});
// src/internal/PitchIntervalClassSet.ts
var hasShape = isTwelveBits;
var mark = (_v) => true;
var markRaw = (v) => hasShape(v);
var markRawUnknown = (v) => hasShape(v);
var fromRaw = (v) => v;
var fromRawMasked = (v) => fromRaw(masked(v));
var fromRawUnknown = (v) => isTwelveBits(v) ? fromRaw(v) : void 0;
var EMPTY2 = fromRaw(EMPTY);
var ALL2 = fromRaw(ALL);
var one = (pc) => 1 << pc;
var from2 = (...values3) => values3.map(one).reduce(union);
var toggleAll = (pcs) => ~pcs & ALL2;
var union = (a, b) => a | b;
var intersection = (a, b) => a & b;
var symmetricDifference = (a, b) => a ^ b;
var difference = (a, b) => intersection(a, toggleAll(b));
var has = (pcs, pc) => Boolean(intersection(pcs, from2(pc)));
var add = (pcs, pc) => union(pcs, from2(pc));
var remove = (pcs, pc) => intersection(pcs, toggleAll(from2(pc)));
var toggle = (pcs, pc) => symmetricDifference(pcs, from2(pc));
var isSuperset = (value, of) => !intersection(toggleAll(value), of);
var isSubset = (value, of) => isSuperset(of, value);
var values2 = (pics) => values(pics).map(from);
export {
hasShape,
mark,
markRaw,
markRawUnknown,
fromRaw,
fromRawMasked,
fromRawUnknown,
EMPTY2 as EMPTY,
ALL2 as ALL,
from2 as from,
toggleAll,
union,
intersection,
symmetricDifference,
difference,
has,
add,
remove,
toggle,
isSuperset,
isSubset,
values2 as values,
PitchIntervalClassSet_exports
};
//# sourceMappingURL=chunk-CUJG4C7C.js.map