import type { EffectConfig } from '../types/effects' export const ENGINE_CONTROLS: EffectConfig[] = [ { id: 'engine', name: 'Engine', parameters: [ { id: 'sampleRate', label: 'Sample Rate', min: 0, max: 3, default: 1, step: 1, unit: '' }, { id: 'loopDuration', label: 'Loop', min: 2, max: 8, default: 4, step: 2, unit: 's' }, { id: 'complexity', label: 'Complexity', min: 0, max: 2, default: 1, step: 1, unit: '' }, { id: 'bitDepth', label: 'Bit Depth', min: 0, max: 2, default: 0, step: 1, unit: '' }, { id: 'masterVolume', label: 'Volume', min: 0, max: 100, default: 75, step: 1, unit: '%' }, { id: 'pitch', label: 'Pitch', min: 0.1, max: 4, default: 1, step: 0.01, unit: 'x' } ] } ] export const EFFECTS: EffectConfig[] = [ { id: 'filter', name: 'Filter', parameters: [ { id: 'hpEnable', label: 'HP', min: 0, max: 1, default: 0, step: 1, unit: '' }, { id: 'hpFreq', label: 'HP Freq', min: 20, max: 10000, default: 1000, step: 10, unit: 'Hz' }, { id: 'hpRes', label: 'HP Q', min: 0.1, max: 20, default: 1, step: 0.1, unit: '' }, { id: 'lpEnable', label: 'LP', min: 0, max: 1, default: 0, step: 1, unit: '' }, { id: 'lpFreq', label: 'LP Freq', min: 20, max: 20000, default: 5000, step: 10, unit: 'Hz' }, { id: 'lpRes', label: 'LP Q', min: 0.1, max: 20, default: 1, step: 0.1, unit: '' }, { id: 'bpEnable', label: 'BP', min: 0, max: 1, default: 0, step: 1, unit: '' }, { id: 'bpFreq', label: 'BP Freq', min: 20, max: 10000, default: 1000, step: 10, unit: 'Hz' }, { id: 'bpRes', label: 'BP Q', min: 0.1, max: 20, default: 1, step: 0.1, unit: '' } ] }, { id: 'foldcrush', name: 'Fold and Crush', bypassable: true, parameters: [ { id: 'clipMode', label: 'Mode', min: 0, max: 2, default: 0, step: 1, unit: '' }, { id: 'wavefolderDrive', label: 'Drive', min: 1, max: 10, default: 1, step: 0.1, unit: 'x' }, { id: 'bitcrushDepth', label: 'Depth', min: 1, max: 16, default: 16, step: 1, unit: 'bit' }, { id: 'bitcrushRate', label: 'Rate', min: 0, max: 100, default: 0, step: 1, unit: '%' } ] }, { id: 'delay', name: 'Delay', bypassable: true, parameters: [ { id: 'delayTime', label: 'Time', min: 10, max: 2000, default: 250, step: 10, unit: 'ms' }, { id: 'delayFeedback', label: 'Feedback', min: 0, max: 100, default: 50, step: 1, unit: '%' }, { id: 'delayWetDry', label: 'Mix', min: 0, max: 100, default: 50, step: 1, unit: '%' }, { id: 'delayTone', label: 'Tone', min: 0, max: 100, default: 70, step: 1, unit: '%' }, { id: 'delaySaturation', label: 'Saturation', min: 0, max: 100, default: 20, step: 1, unit: '%' }, { id: 'delayFlutter', label: 'Flutter', min: 0, max: 100, default: 15, step: 1, unit: '%' } ] }, { id: 'reverb', name: 'Reverb', bypassable: true, parameters: [ { id: 'reverbWetDry', label: 'Amount', min: 0, max: 100, default: 0, step: 1, unit: '%' }, { id: 'reverbDecay', label: 'Decay', min: 0.1, max: 5, default: 2, step: 0.1, unit: 's' }, { id: 'reverbDamping', label: 'Damping', min: 0, max: 100, default: 50, step: 1, unit: '%' }, { id: 'reverbPanRate', label: 'Pan Rate', min: 0, max: 10, default: 0, step: 0.1, unit: 'Hz' }, { id: 'reverbPanWidth', label: 'Pan Width', min: 0, max: 100, default: 50, step: 1, unit: '%' } ] } ] export function getDefaultEffectValues(): Record { const defaults: Record = {} EFFECTS.forEach(effect => { effect.parameters.forEach(param => { defaults[param.id] = param.default }) if (effect.bypassable) { defaults[`${effect.id}Bypass`] = true } }) return defaults } export function getDefaultEngineValues(): Record { const defaults: Record = {} ENGINE_CONTROLS.forEach(control => { control.parameters.forEach(param => { defaults[param.id] = param.default }) }) return defaults } export const SAMPLE_RATES = [8000, 11025, 22050, 44100] export function getSampleRateFromIndex(index: number): number { return SAMPLE_RATES[index] || 8000 }