// Synthesis engines generate audio buffers with given parameters
// The duration parameter should be used to scale time-based parameters (envelopes, LFOs, etc.)
// Time-based parameters should be stored as ratios (0-1) and scaled by duration during generation
// Engines must generate stereo output: [leftChannel, rightChannel]
// When pitch lock is provided, engines must use the locked frequency and preserve it across randomization/mutation

export type EngineType = 'generative' | 'sample' | 'input';

export type EngineCategory =
  | 'Additive'
  | 'Subtractive'
  | 'FM'
  | 'Percussion'
  | 'Noise'
  | 'Physical'
  | 'Modulation'
  | 'Experimental'
  | 'Utility';

export interface PitchLock {
  enabled: boolean;
  frequency: number; // Frequency in Hz
}

export interface SynthEngine<T = any> {
  getName(): string;
  getDescription(): string;
  getType(): EngineType;
  getCategory(): EngineCategory;
  generate(params: T, sampleRate: number, duration: number, pitchLock?: PitchLock): [Float32Array, Float32Array] | Promise<[Float32Array, Float32Array]>;
  randomParams(pitchLock?: PitchLock): T;
  mutateParams(params: T, mutationAmount?: number, pitchLock?: PitchLock): T;
}
