Zongzi.Score.Tempo.Segment behaviour (zongzi v0.3.0)

Copy Markdown

Behaviour definition for tempo segments.

Summary

Types

Actual duration in seconds.

A struct implementing a tempo segment.

Types

duration()

@type duration() :: float() | :infinity

Actual duration in seconds.

segment()

@type segment() :: struct()

A struct implementing a tempo segment.

Callbacks

build_from_event(start_tick, end_tick, event)

@callback build_from_event(
  start_tick :: Zongzi.Score.Tick.numeric_tick(),
  end_tick :: Zongzi.Score.Tick.t(),
  event :: Zongzi.Score.Tempo.Event.context()
) :: {:ok, segment()} | {:error, term()}

duration_sec(segment, tpqn)

@callback duration_sec(segment(), tpqn :: pos_integer()) :: duration()

sec_to_tick(segment, sec_offset, tpqn)

@callback sec_to_tick(
  segment(),
  sec_offset :: Zongzi.Score.Tempo.physical_time(),
  tpqn :: pos_integer()
) ::
  Zongzi.Score.Tick.numeric_tick()

tick_to_sec(segment, tick_offset, tpqn)

@callback tick_to_sec(
  segment(),
  tick_offset :: Zongzi.Score.Tick.numeric_tick(),
  tpqn :: pos_integer()
) ::
  duration()