ym2149-common
Shared traits, types, and utilities for YM2149 chiptune replayers.
Overview
This crate provides the unified interface that all replayer crates (ym2149-ym-replayer, ym2149-arkos-replayer, ym2149-ay-replayer, ym2149-sndh-replayer) implement. It also provides shared utilities for register parsing, frequency calculations, and visualization.
Key exports:
- Player traits:
ChiptunePlayer,ChiptunePlayerBase - State types:
PlaybackState,ChannelStates,BasicMetadata - Register utilities:
channel_period,period_to_frequency,channel_frequencies - Constants:
PSG_MASTER_CLOCK_HZ,NOTE_NAMES
Key Types
Trait Hierarchy
ChiptunePlayerBase (object-safe)
│
└── ChiptunePlayer (adds metadata access)
ChiptunePlayerBase trait
Object-safe base trait for playback operations. Use this when you need trait objects (Box<dyn ChiptunePlayerBase>):
use ;
ChiptunePlayer trait
Extends ChiptunePlayerBase with metadata access. Use this when you need the specific metadata type:
use ;
PlaybackMetadata trait
Unified metadata access across all formats:
use PlaybackMetadata;
PlaybackState enum
Standard playback states used by all players:
use PlaybackState;
match player.state
BasicMetadata struct
A concrete metadata type for simple use cases:
use BasicMetadata;
let meta = BasicMetadata ;
Usage
Add to your Cargo.toml:
[]
= "0.7"
All replayer crates re-export these types, so you typically don't need to depend on ym2149-common directly:
// These are equivalent:
use ;
use ;
use ;
use ;
use ;
License
MIT