@onjmin/dtm
    Preparing search index...

    Type Alias PlayMmlOptions

    type PlayMmlOptions = {
        audioContext?: AudioContext;
        cues?: PlaybackCue[];
        defaultBpm?: number;
        destination?: AudioNode;
        drumPatterns?: Record<string, DrumPattern>;
        loop?: boolean | LoopConfig;
        onCue?: (cueId: string) => void;
        onPlayDrum?: (e: PlayDrumEvent) => void;
        onPlayNote?: (e: PlayNoteEvent) => void;
        onResumeAudio?: () => void | Promise<void>;
        onStop?: () => void;
        pauseWhenHidden?: boolean;
        synth?: boolean;
        volume?: number;
    }
    Index

    Properties

    audioContext?: AudioContext

    使用する AudioContext。省略時は内部生成し、destroy()/stop() で閉じる。 onPlayNote で自前シンセを鳴らす場合は、時計をそろえるため自分の ctx を渡すこと。

    cues?: PlaybackCue[]

    再生中にイベントを発火させるタイミング

    defaultBpm?: number

    BPM未検出時のフォールバック。既定120

    destination?: AudioNode

    出力先ノード(省略時は ctx.destination)。ゲームのマスターGain 等へ繋ぐ。

    drumPatterns?: Record<string, DrumPattern>

    ドラムパターン辞書。#drum=<キー> の解決に使う。既定 DRUM_PATTERNS

    loop?: boolean | LoopConfig

    ループ設定(true=全体ループ、LoopConfig=特定範囲ループ、false/省略=ループなし)

    onCue?: (cueId: string) => void

    キューポイント通過時のコールバック

    onPlayDrum?: (e: PlayDrumEvent) => void

    ドラムノートの発音要求。

    onPlayNote?: (e: PlayNoteEvent) => void

    メロディックノートの発音要求(自前シンセに繋ぐ)。

    onResumeAudio?: () => void | Promise<void>

    再生開始時に呼ばれる(追加の resume 処理等に使う)。

    onStop?: () => void

    ループ無効時に曲末(または stop())で呼ばれる。

    pauseWhenHidden?: boolean

    タブ非アクティブ時に自動で suspend/resume するか。 既定は「内部生成 ctx のとき true / 注入 ctx のとき false」。 注入 ctx で true にすると、共有 ctx ごと suspend する点に注意。

    synth?: boolean

    内蔵 square synth を使うか。既定は onPlayNote 未指定なら true

    volume?: number

    0-100 のマスタ音量。既定は MML の #volume → このオプション → 100 の順で解決。