ecspresso
    Preparing search index...

    Function defineAudioChannels

    • Define audio channels with type-safe names and initial volumes. Mirrors defineCollisionLayers pattern.

      Type Parameters

      Parameters

      • channels: T

        Object mapping channel names to their configuration

      Returns Readonly<T>

      Frozen channel configuration with inferred channel name union

      const channels = defineAudioChannels({
      sfx: { volume: 1 },
      music: { volume: 0.7 },
      ui: { volume: 0.8 },
      });
      type Ch = ChannelsOf<typeof channels>; // 'sfx' | 'music' | 'ui'