use binrw::{binrw, io::Cursor, BinRead, BinWrite, Endian, NullString};
use parse_display::Display;
use std::ffi::OsStr;
use std::path::Path;
use super::error::{Error, Result};
#[binrw]
#[derive(Display, Debug, PartialEq, Eq, Default, Clone, Copy)]
#[brw(repr = u8)]
pub enum OnAirDisplay {
Off = 0x80,
#[default]
On,
}
impl TryFrom<String> for OnAirDisplay {
type Error = Error;
fn try_from(value: String) -> std::result::Result<OnAirDisplay, Self::Error> {
match value.as_str() {
"Off" => Ok(Self::Off),
"On" => Ok(Self::On),
_ => Err(Error::SettingInvalidValue("OnAirDisplay".into(), value)),
}
}
}
#[binrw]
#[derive(Display, Debug, PartialEq, Eq, Default, Clone, Copy)]
#[brw(repr = u8)]
pub enum LCDBrightness {
#[display("1")]
One = 0x81,
#[display("2")]
Two,
#[display("3")]
#[default]
Three,
#[display("4")]
Four,
#[display("5")]
Five,
}
impl TryFrom<String> for LCDBrightness {
type Error = Error;
fn try_from(value: String) -> std::result::Result<LCDBrightness, Self::Error> {
match value.as_str() {
"One" => Ok(Self::One),
"Two" => Ok(Self::Two),
"Three" => Ok(Self::Three),
"Four" => Ok(Self::Four),
"Five" => Ok(Self::Five),
x => Err(Error::SettingInvalidValue("LCDBrightness".into(), x.into())),
}
}
}
#[binrw]
#[derive(Display, Debug, PartialEq, Eq, Default, Clone, Copy)]
#[brw(repr = u8)]
pub enum Quantize {
Off = 0x80,
#[default]
On,
}
impl TryFrom<String> for Quantize {
type Error = Error;
fn try_from(value: String) -> std::result::Result<Quantize, Self::Error> {
match value.as_str() {
"Off" => Ok(Self::Off),
"On" => Ok(Self::On),
_ => Err(Error::SettingInvalidValue("Quantize".into(), value)),
}
}
}
#[binrw]
#[derive(Display, Debug, PartialEq, Eq, Default, Clone, Copy)]
#[brw(repr = u8)]
pub enum AutoCueLevel {
#[display("-78dB")]
Minus78dB = 0x87,
#[display("-72dB")]
Minus72dB = 0x86,
#[display("-66dB")]
Minus66dB = 0x85,
#[display("-60dB")]
Minus60dB = 0x84,
#[display("-54dB")]
Minus54dB = 0x83,
#[display("-48dB")]
Minus48dB = 0x82,
#[display("-42dB")]
Minus42dB = 0x81,
#[display("-36dB")]
Minus36dB = 0x80,
#[default]
Memory = 0x88,
}
impl TryFrom<String> for AutoCue {
type Error = Error;
fn try_from(value: String) -> std::result::Result<AutoCue, Self::Error> {
match value.as_str() {
"Off" => Ok(Self::Off),
"On" => Ok(Self::On),
_ => Err(Error::SettingInvalidValue("AutoCue".into(), value)),
}
}
}
impl TryFrom<String> for AutoCueLevel {
type Error = Error;
fn try_from(value: String) -> std::result::Result<AutoCueLevel, Self::Error> {
match value.as_str() {
"Minus78dB" => Ok(Self::Minus78dB),
"Minus72dB" => Ok(Self::Minus72dB),
"Minus66dB" => Ok(Self::Minus66dB),
"Minus60dB" => Ok(Self::Minus60dB),
"Minus54dB" => Ok(Self::Minus54dB),
"Minus48dB" => Ok(Self::Minus48dB),
"Minus42dB" => Ok(Self::Minus42dB),
"Minus36dB" => Ok(Self::Minus36dB),
"Memory" => Ok(Self::Memory),
_ => Err(Error::SettingInvalidValue("AutoCueLevel".into(), value)),
}
}
}
#[binrw]
#[derive(Display, Debug, PartialEq, Eq, Default, Clone, Copy)]
#[brw(repr = u8)]
pub enum Language {
#[default]
English = 0x81,
#[display("Français")]
French,
#[display("Deutsch")]
German,
#[display("Italiano")]
Italian,
#[display("Nederlands")]
Dutch,
#[display("Español")]
Spanish,
#[display("Русский")]
Russian,
#[display("한국어")]
Korean,
ChineseSimplified,
#[display("简体中文")]
#[display("繁體中文")]
ChineseTraditional,
#[display("日本語")]
Japanese,
#[display("Português")]
Portuguese,
#[display("Svenska")]
Swedish,
#[display("Čeština")]
Czech,
#[display("Magyar")]
Hungarian,
#[display("Dansk")]
Danish,
#[display("Ελληνικά")]
Greek,
#[display("Türkçe")]
Turkish,
}
impl TryFrom<String> for Language {
type Error = Error;
fn try_from(value: String) -> std::result::Result<Language, Self::Error> {
match value.as_str() {
"English" => Ok(Self::English),
"French" => Ok(Self::French),
"German" => Ok(Self::German),
"Italian" => Ok(Self::Italian),
"Dutch" => Ok(Self::Dutch),
"Spanish" => Ok(Self::Spanish),
"Russian" => Ok(Self::Russian),
"Korean" => Ok(Self::Korean),
"ChineseSimplified" => Ok(Self::ChineseSimplified),
"ChineseTraditional" => Ok(Self::ChineseTraditional),
"Japanese" => Ok(Self::Japanese),
"Portuguese" => Ok(Self::Portuguese),
"Swedish" => Ok(Self::Swedish),
"Czech" => Ok(Self::Czech),
"Hungarian" => Ok(Self::Hungarian),
"Danish" => Ok(Self::Danish),
"Greek" => Ok(Self::Greek),
"Turkish" => Ok(Self::Turkish),
_ => Err(Error::SettingInvalidValue("Language".into(), value)),
}
}
}
#[binrw]
#[derive(Display, Debug, PartialEq, Eq, Default, Clone, Copy)]
#[brw(repr = u8)]
pub enum JogRingBrightness {
Off = 0x80,
#[display("1 (Dark)")]
Dark,
#[display("2 (Bright)")]
#[default]
Bright,
}
impl TryFrom<String> for JogRingBrightness {
type Error = Error;
fn try_from(value: String) -> std::result::Result<JogRingBrightness, Self::Error> {
match value.as_str() {
"Off" => Ok(Self::Off),
"Dark" => Ok(Self::Dark),
"Bright" => Ok(Self::Bright),
_ => Err(Error::SettingInvalidValue(
"JogRingBrightness".into(),
value,
)),
}
}
}
#[binrw]
#[derive(Display, Debug, PartialEq, Eq, Default, Clone, Copy)]
#[brw(repr = u8)]
pub enum JogRingIndicator {
Off = 0x80,
#[default]
On,
}
impl TryFrom<String> for JogRingIndicator {
type Error = Error;
fn try_from(value: String) -> std::result::Result<JogRingIndicator, Self::Error> {
match value.as_str() {
"Off" => Ok(Self::Off),
"On" => Ok(Self::On),
_ => Err(Error::SettingInvalidValue("JogRingIndicator".into(), value)),
}
}
}
#[binrw]
#[derive(Display, Debug, PartialEq, Eq, Default, Clone, Copy)]
#[brw(repr = u8)]
pub enum SlipFlashing {
Off = 0x80,
#[default]
On,
}
impl TryFrom<String> for SlipFlashing {
type Error = Error;
fn try_from(value: String) -> std::result::Result<SlipFlashing, Self::Error> {
match value.as_str() {
"Off" => Ok(Self::Off),
"On" => Ok(Self::On),
_ => Err(Error::SettingInvalidValue("SlipFlashing".into(), value)),
}
}
}
#[binrw]
#[derive(Display, Debug, PartialEq, Eq, Default, Clone, Copy)]
#[brw(repr = u8)]
pub enum DiscSlotIllumination {
Off = 0x80,
#[display("1 (Dark)")]
Dark,
#[display("2 (Bright)")]
#[default]
Bright,
}
impl TryFrom<String> for DiscSlotIllumination {
type Error = Error;
fn try_from(value: String) -> std::result::Result<DiscSlotIllumination, Self::Error> {
match value.as_str() {
"Off" => Ok(Self::Off),
"Dark" => Ok(Self::Dark),
"Bright" => Ok(Self::Bright),
_ => Err(Error::SettingInvalidValue(
"DiscSlotIllumination".into(),
value,
)),
}
}
}
#[binrw]
#[derive(Display, Debug, PartialEq, Eq, Default, Clone, Copy)]
#[brw(repr = u8)]
pub enum EjectLock {
#[default]
Unlock = 0x80,
Lock,
}
impl TryFrom<String> for EjectLock {
type Error = Error;
fn try_from(value: String) -> std::result::Result<EjectLock, Self::Error> {
match value.as_str() {
"Unlock" => Ok(Self::Unlock),
"Lock" => Ok(Self::Lock),
_ => Err(Error::SettingInvalidValue("EjectLock".into(), value)),
}
}
}
#[binrw]
#[derive(Display, Debug, PartialEq, Eq, Default, Clone, Copy)]
#[brw(repr = u8)]
pub enum Sync {
#[default]
Off = 0x80,
On,
}
impl TryFrom<String> for Sync {
type Error = Error;
fn try_from(value: String) -> std::result::Result<Sync, Self::Error> {
match value.as_str() {
"Off" => Ok(Self::Off),
"On" => Ok(Self::On),
_ => Err(Error::SettingInvalidValue("Sync".into(), value)),
}
}
}
#[binrw]
#[derive(Display, Debug, PartialEq, Eq, Default, Clone, Copy)]
#[brw(repr = u8)]
pub enum PlayMode {
#[display("Continue / On")]
Continue = 0x80,
#[display("Single / Off")]
#[default]
Single,
}
impl TryFrom<String> for PlayMode {
type Error = Error;
fn try_from(value: String) -> std::result::Result<PlayMode, Self::Error> {
match value.as_str() {
"Continue" => Ok(Self::Continue),
"Single" => Ok(Self::Single),
_ => Err(Error::SettingInvalidValue("PlayMode".into(), value)),
}
}
}
#[binrw]
#[derive(Display, Debug, PartialEq, Eq, Default, Clone, Copy)]
#[brw(repr = u8)]
pub enum QuantizeBeatValue {
#[display("1/8 Beat")]
EighthBeat = 0x83,
#[display("1/4 Beat")]
QuarterBeat = 0x82,
#[display("1/2 Beat")]
HalfBeat = 0x81,
#[default]
#[display("1 Beat")]
FullBeat = 0x80,
}
impl TryFrom<String> for QuantizeBeatValue {
type Error = Error;
fn try_from(value: String) -> std::result::Result<QuantizeBeatValue, Self::Error> {
match value.as_str() {
"EighthBeat" => Ok(Self::EighthBeat),
"QuarterBeat" => Ok(Self::QuarterBeat),
"HalfBeat" => Ok(Self::HalfBeat),
"FullBeat" => Ok(Self::FullBeat),
_ => Err(Error::SettingInvalidValue(
"QuantizeBeatValue".into(),
value,
)),
}
}
}
#[binrw]
#[derive(Display, Debug, PartialEq, Eq, Default, Clone, Copy)]
#[brw(repr = u8)]
pub enum HotCueAutoLoad {
Off = 0x80,
#[display("rekordbox SETTING")]
RekordboxSetting = 0x82,
#[default]
On = 0x81,
}
impl TryFrom<String> for HotCueAutoLoad {
type Error = Error;
fn try_from(value: String) -> std::result::Result<HotCueAutoLoad, Self::Error> {
match value.as_str() {
"Off" => Ok(Self::Off),
"RekordboxSetting" => Ok(Self::RekordboxSetting),
"On" => Ok(Self::On),
_ => Err(Error::SettingInvalidValue("HotCueAutoLoad".into(), value)),
}
}
}
#[binrw]
#[derive(Display, Debug, PartialEq, Eq, Default, Clone, Copy)]
#[brw(repr = u8)]
pub enum HotCueColor {
#[default]
Off = 0x80,
On,
}
impl TryFrom<String> for HotCueColor {
type Error = Error;
fn try_from(value: String) -> std::result::Result<HotCueColor, Self::Error> {
match value.as_str() {
"Off" => Ok(Self::Off),
"On" => Ok(Self::On),
_ => Err(Error::SettingInvalidValue("HotCueColor".into(), value)),
}
}
}
#[binrw]
#[derive(Display, Debug, PartialEq, Eq, Default, Clone, Copy)]
#[brw(repr = u8)]
pub enum NeedleLock {
Unlock = 0x80,
#[default]
Lock,
}
impl TryFrom<String> for NeedleLock {
type Error = Error;
fn try_from(value: String) -> std::result::Result<NeedleLock, Self::Error> {
match value.as_str() {
"Unlock" => Ok(Self::Unlock),
"Lock" => Ok(Self::Lock),
_ => Err(Error::SettingInvalidValue("NeedleLock".into(), value)),
}
}
}
#[binrw]
#[derive(Display, Debug, PartialEq, Eq, Default, Clone, Copy)]
#[brw(repr = u8)]
pub enum TimeMode {
Elapsed = 0x80,
#[default]
Remain,
}
impl TryFrom<String> for TimeMode {
type Error = Error;
fn try_from(value: String) -> std::result::Result<TimeMode, Self::Error> {
match value.as_str() {
"Elapsed" => Ok(Self::Elapsed),
"Remain" => Ok(Self::Remain),
_ => Err(Error::SettingInvalidValue("TimeMode".into(), value)),
}
}
}
#[binrw]
#[derive(Display, Debug, PartialEq, Eq, Default, Clone, Copy)]
#[brw(repr = u8)]
pub enum JogMode {
#[default]
Vinyl = 0x81,
CDJ = 0x80,
}
impl TryFrom<String> for JogMode {
type Error = Error;
fn try_from(value: String) -> std::result::Result<JogMode, Self::Error> {
match value.as_str() {
"Vinyl" => Ok(Self::Vinyl),
"CDJ" => Ok(Self::CDJ),
_ => Err(Error::SettingInvalidValue("JogMode".into(), value)),
}
}
}
#[binrw]
#[derive(Display, Debug, PartialEq, Eq, Default, Clone, Copy)]
#[brw(repr = u8)]
pub enum AutoCue {
Off = 0x80,
#[default]
On,
}
#[binrw]
#[derive(Display, Debug, PartialEq, Eq, Default, Clone, Copy)]
#[brw(repr = u8)]
pub enum MasterTempo {
#[default]
Off = 0x80,
On,
}
impl TryFrom<String> for MasterTempo {
type Error = Error;
fn try_from(value: String) -> std::result::Result<MasterTempo, Self::Error> {
match value.as_str() {
"Off" => Ok(Self::Off),
"On" => Ok(Self::On),
_ => Err(Error::SettingInvalidValue("MasterTempo".into(), value)),
}
}
}
#[binrw]
#[derive(Display, Debug, PartialEq, Eq, Default, Clone, Copy)]
#[brw(repr = u8)]
pub enum TempoRange {
#[display("±6%")]
SixPercent = 0x80,
#[display("±10%")]
#[default]
TenPercent,
#[display("±16%")]
SixteenPercent,
Wide,
}
impl TryFrom<String> for TempoRange {
type Error = Error;
fn try_from(value: String) -> std::result::Result<TempoRange, Self::Error> {
match value.as_str() {
"SixPercent" => Ok(Self::SixPercent),
"TenPercent" => Ok(Self::TenPercent),
"SixteenPercent" => Ok(Self::SixteenPercent),
"Wide" => Ok(Self::Wide),
_ => Err(Error::SettingInvalidValue("TempoRange".into(), value)),
}
}
}
#[binrw]
#[derive(Display, Debug, PartialEq, Eq, Default, Clone, Copy)]
#[brw(repr = u8)]
pub enum PhaseMeter {
#[default]
#[display("Type 1")]
Type1 = 0x80,
#[display("Type 2")]
Type2,
}
impl TryFrom<String> for PhaseMeter {
type Error = Error;
fn try_from(value: String) -> std::result::Result<PhaseMeter, Self::Error> {
match value.as_str() {
"Type1" => Ok(Self::Type1),
"Type2" => Ok(Self::Type2),
_ => Err(Error::SettingInvalidValue("PhaseMeter".into(), value)),
}
}
}
#[binrw]
#[derive(Debug, PartialEq, Eq, Clone)]
#[brw(little)]
pub struct MySetting {
unknown1: [u8; 8],
pub on_air_display: OnAirDisplay,
pub lcd_brightness: LCDBrightness,
pub quantize: Quantize,
pub auto_cue_level: AutoCueLevel,
pub language: Language,
unknown2: u8,
pub jog_ring_brightness: JogRingBrightness,
pub jog_ring_indicator: JogRingIndicator,
pub slip_flashing: SlipFlashing,
unknown3: [u8; 3],
pub disc_slot_illumination: DiscSlotIllumination,
pub eject_lock: EjectLock,
pub sync: Sync,
pub play_mode: PlayMode,
pub quantize_beat_value: QuantizeBeatValue,
pub hotcue_autoload: HotCueAutoLoad,
pub hotcue_color: HotCueColor,
#[br(assert(unknown4 == 0))]
unknown4: u16,
pub needle_lock: NeedleLock,
#[br(assert(unknown5 == 0))]
unknown5: u16,
pub time_mode: TimeMode,
pub jog_mode: JogMode,
pub auto_cue: AutoCue,
pub master_tempo: MasterTempo,
pub tempo_range: TempoRange,
pub phase_meter: PhaseMeter,
#[br(assert(unknown6 == 0))]
unknown6: u16,
}
impl Default for MySetting {
fn default() -> Self {
Self {
unknown1: [0x78, 0x56, 0x34, 0x12, 0x02, 0x00, 0x00, 0x00],
on_air_display: OnAirDisplay::default(),
lcd_brightness: LCDBrightness::default(),
quantize: Quantize::default(),
auto_cue_level: AutoCueLevel::default(),
language: Language::default(),
unknown2: 0x01,
jog_ring_brightness: JogRingBrightness::default(),
jog_ring_indicator: JogRingIndicator::default(),
slip_flashing: SlipFlashing::default(),
unknown3: [0x01, 0x01, 0x01],
disc_slot_illumination: DiscSlotIllumination::default(),
eject_lock: EjectLock::default(),
sync: Sync::default(),
play_mode: PlayMode::default(),
quantize_beat_value: QuantizeBeatValue::default(),
hotcue_autoload: HotCueAutoLoad::default(),
hotcue_color: HotCueColor::default(),
unknown4: 0x0000,
needle_lock: NeedleLock::default(),
unknown5: 0x0000,
time_mode: TimeMode::default(),
jog_mode: JogMode::default(),
auto_cue: AutoCue::default(),
master_tempo: MasterTempo::default(),
tempo_range: TempoRange::default(),
phase_meter: PhaseMeter::default(),
unknown6: 0x0000,
}
}
}
impl MySetting {
fn file_name() -> String {
"MYSETTING.DAT".into()
}
}
#[binrw]
#[derive(Display, Debug, PartialEq, Eq, Default, Clone, Copy)]
#[brw(repr = u8)]
pub enum VinylSpeedAdjust {
#[display("Touch & Release")]
TouchRelease = 0x80,
#[default]
Touch,
Release,
}
impl TryFrom<String> for VinylSpeedAdjust {
type Error = Error;
fn try_from(value: String) -> std::result::Result<VinylSpeedAdjust, Self::Error> {
match value.as_str() {
"TouchRelease" => Ok(Self::TouchRelease),
"Touch" => Ok(Self::Touch),
"Release" => Ok(Self::Release),
_ => Err(Error::SettingInvalidValue("VinylSpeedAdjust".into(), value)),
}
}
}
#[binrw]
#[derive(Display, Debug, PartialEq, Eq, Default, Clone, Copy)]
#[brw(repr = u8)]
pub enum JogDisplayMode {
#[default]
Auto = 0x80,
Info,
Simple,
Artwork,
}
impl TryFrom<String> for JogDisplayMode {
type Error = Error;
fn try_from(value: String) -> std::result::Result<JogDisplayMode, Self::Error> {
match value.as_str() {
"Auto" => Ok(Self::Auto),
"Info" => Ok(Self::Info),
"Simple" => Ok(Self::Simple),
"Artwork" => Ok(Self::Artwork),
_ => Err(Error::SettingInvalidValue("JogDisplayMode".into(), value)),
}
}
}
#[binrw]
#[derive(Display, Debug, PartialEq, Eq, Default, Clone, Copy)]
#[brw(repr = u8)]
pub enum PadButtonBrightness {
#[display("1")]
One = 0x81,
#[display("2")]
Two,
#[display("3")]
#[default]
Three,
#[display("4")]
Four,
}
impl TryFrom<String> for PadButtonBrightness {
type Error = Error;
fn try_from(value: String) -> std::result::Result<PadButtonBrightness, Self::Error> {
match value.as_str() {
"One" => Ok(Self::One),
"Two" => Ok(Self::Two),
"Three" => Ok(Self::Three),
"Four" => Ok(Self::Four),
_ => Err(Error::SettingInvalidValue(
"PadButtonBrightness".into(),
value,
)),
}
}
}
#[binrw]
#[derive(Display, Debug, PartialEq, Eq, Default, Clone, Copy)]
#[brw(repr = u8)]
pub enum JogLCDBrightness {
#[display("1")]
One = 0x81,
#[display("2")]
Two,
#[display("3")]
#[default]
Three,
#[display("4")]
Four,
#[display("5")]
Five,
}
impl TryFrom<String> for JogLCDBrightness {
type Error = Error;
fn try_from(value: String) -> std::result::Result<JogLCDBrightness, Self::Error> {
match value.as_str() {
"One" => Ok(Self::One),
"Two" => Ok(Self::Two),
"Three" => Ok(Self::Three),
"Four" => Ok(Self::Four),
"Five" => Ok(Self::Five),
_ => Err(Error::SettingInvalidValue("JogLCDBrightness".into(), value)),
}
}
}
#[binrw]
#[derive(Display, Debug, PartialEq, Eq, Default, Clone, Copy)]
#[brw(repr = u8)]
pub enum WaveformDivisions {
#[display("Time Scale")]
TimeScale = 0x80,
#[default]
Phrase,
}
impl TryFrom<String> for Waveform {
type Error = Error;
fn try_from(value: String) -> std::result::Result<Waveform, Self::Error> {
match value.as_str() {
"Waveform" => Ok(Self::Waveform),
"PhaseMeter" => Ok(Self::PhaseMeter),
_ => Err(Error::SettingInvalidValue("Waveform".into(), value)),
}
}
}
impl TryFrom<String> for WaveformDivisions {
type Error = Error;
fn try_from(value: String) -> std::result::Result<WaveformDivisions, Self::Error> {
match value.as_str() {
"TimeScale" => Ok(Self::TimeScale),
"Phrase" => Ok(Self::Phrase),
_ => Err(Error::SettingInvalidValue(
"WaveformDivisions".into(),
value,
)),
}
}
}
#[binrw]
#[derive(Display, Debug, PartialEq, Eq, Default, Clone, Copy)]
#[brw(repr = u8)]
pub enum Waveform {
#[default]
Waveform = 0x80,
#[display("Phase Meter")]
PhaseMeter,
}
#[binrw]
#[derive(Display, Debug, PartialEq, Eq, Default, Clone, Copy)]
#[brw(repr = u8)]
pub enum BeatJumpBeatValue {
#[display("1/2 Beat")]
HalfBeat = 0x80,
#[display("1 Beat")]
OneBeat,
#[display("2 Beat")]
TwoBeat,
#[display("4 Beat")]
FourBeat,
#[display("8 Beat")]
EightBeat,
#[display("16 Beat")]
#[default]
SixteenBeat,
#[display("32 Beat")]
ThirtytwoBeat,
#[display("64 Beat")]
SixtyfourBeat,
}
impl TryFrom<String> for BeatJumpBeatValue {
type Error = Error;
fn try_from(value: String) -> std::result::Result<BeatJumpBeatValue, Self::Error> {
match value.as_str() {
"HalfBeat" => Ok(Self::HalfBeat),
"OneBeat" => Ok(Self::OneBeat),
"TwoBeat" => Ok(Self::TwoBeat),
"FourBeat" => Ok(Self::FourBeat),
"EightBeat" => Ok(Self::EightBeat),
"SixteenBeat" => Ok(Self::SixteenBeat),
"ThirtytwoBeat" => Ok(Self::ThirtytwoBeat),
"SixtyfourBeat" => Ok(Self::SixtyfourBeat),
_ => Err(Error::SettingInvalidValue(
"BeatJumpBeatValue".into(),
value,
)),
}
}
}
#[binrw]
#[derive(Debug, PartialEq, Eq, Clone)]
#[brw(little)]
pub struct MySetting2 {
pub vinyl_speed_adjust: VinylSpeedAdjust,
pub jog_display_mode: JogDisplayMode,
pub pad_button_brightness: PadButtonBrightness,
pub jog_lcd_brightness: JogLCDBrightness,
pub waveform_divisions: WaveformDivisions,
#[br(assert(unknown1 == [0; 5]))]
unknown1: [u8; 5],
pub waveform: Waveform,
unknown2: u8,
pub beat_jump_beat_value: BeatJumpBeatValue,
#[br(assert(unknown3 == [0; 27]))]
unknown3: [u8; 27],
}
impl Default for MySetting2 {
fn default() -> Self {
Self {
vinyl_speed_adjust: VinylSpeedAdjust::default(),
jog_display_mode: JogDisplayMode::default(),
pad_button_brightness: PadButtonBrightness::default(),
jog_lcd_brightness: JogLCDBrightness::default(),
waveform_divisions: WaveformDivisions::default(),
unknown1: [0; 5],
waveform: Waveform::default(),
unknown2: 0x81,
beat_jump_beat_value: BeatJumpBeatValue::default(),
unknown3: [0; 27],
}
}
}
impl MySetting2 {
fn file_name() -> String {
"MYSETTING2.DAT".into()
}
}
#[binrw]
#[derive(Display, Debug, PartialEq, Eq, Default, Clone, Copy)]
#[brw(repr = u8)]
pub enum ChannelFaderCurve {
#[display("Steep Top")]
SteepTop = 0x80,
#[display("Linear")]
#[default]
Linear,
#[display("Steep Bottom")]
SteepBottom,
}
impl TryFrom<String> for ChannelFaderCurve {
type Error = Error;
fn try_from(value: String) -> std::result::Result<ChannelFaderCurve, Self::Error> {
match value.as_str() {
"SteepTop" => Ok(Self::SteepTop),
"Linear" => Ok(Self::Linear),
"SteepBottom" => Ok(Self::SteepBottom),
_ => Err(Error::SettingInvalidValue(
"ChannelFaderCurve".into(),
value,
)),
}
}
}
#[binrw]
#[derive(Display, Debug, PartialEq, Eq, Default, Clone, Copy)]
#[brw(repr = u8)]
pub enum CrossfaderCurve {
#[display("Constant Power")]
ConstantPower = 0x80,
#[display("Slow Cut")]
SlowCut,
#[display("Fast Cut")]
#[default]
FastCut,
}
impl TryFrom<String> for CrossfaderCurve {
type Error = Error;
fn try_from(value: String) -> std::result::Result<CrossfaderCurve, Self::Error> {
match value.as_str() {
"ConstantPower" => Ok(Self::ConstantPower),
"SlowCut" => Ok(Self::SlowCut),
"FastCut" => Ok(Self::FastCut),
_ => Err(Error::SettingInvalidValue("CrossfaderCurve".into(), value)),
}
}
}
#[binrw]
#[derive(Display, Debug, PartialEq, Eq, Default, Clone, Copy)]
#[brw(repr = u8)]
pub enum HeadphonesPreEQ {
#[default]
#[display("Post EQ")]
PostEQ = 0x80,
#[display("Pre EQ")]
PreEQ,
}
impl TryFrom<String> for HeadphonesPreEQ {
type Error = Error;
fn try_from(value: String) -> std::result::Result<HeadphonesPreEQ, Self::Error> {
match value.as_str() {
"PostEQ" => Ok(Self::PostEQ),
"PreEQ" => Ok(Self::PreEQ),
_ => Err(Error::SettingInvalidValue("HeadphonesPreEQ".into(), value)),
}
}
}
#[binrw]
#[derive(Display, Debug, PartialEq, Eq, Default, Clone, Copy)]
#[brw(repr = u8)]
pub enum HeadphonesMonoSplit {
#[display("Mono Split")]
MonoSplit = 0x81,
#[default]
Stereo = 0x80,
}
impl TryFrom<String> for HeadphonesMonoSplit {
type Error = Error;
fn try_from(value: String) -> std::result::Result<HeadphonesMonoSplit, Self::Error> {
match value.as_str() {
"MonoSplit" => Ok(Self::MonoSplit),
"Stereo" => Ok(Self::Stereo),
_ => Err(Error::SettingInvalidValue(
"HeadphonesMonoSplit".into(),
value,
)),
}
}
}
#[binrw]
#[derive(Display, Debug, PartialEq, Eq, Default, Clone, Copy)]
#[brw(repr = u8)]
pub enum BeatFXQuantize {
Off = 0x80,
#[default]
On,
}
impl TryFrom<String> for BeatFXQuantize {
type Error = Error;
fn try_from(value: String) -> std::result::Result<BeatFXQuantize, Self::Error> {
match value.as_str() {
"Off" => Ok(Self::Off),
"On" => Ok(Self::On),
_ => Err(Error::SettingInvalidValue("BeatFXQuantize".into(), value)),
}
}
}
#[binrw]
#[derive(Display, Debug, PartialEq, Eq, Default, Clone, Copy)]
#[brw(repr = u8)]
pub enum MicLowCut {
Off = 0x80,
#[default]
On,
}
impl TryFrom<String> for MicLowCut {
type Error = Error;
fn try_from(value: String) -> std::result::Result<MicLowCut, Self::Error> {
match value.as_str() {
"Off" => Ok(Self::Off),
"On" => Ok(Self::On),
_ => Err(Error::SettingInvalidValue("MicLowCut".into(), value)),
}
}
}
#[binrw]
#[derive(Display, Debug, PartialEq, Eq, Default, Clone, Copy)]
#[brw(repr = u8)]
pub enum TalkOverMode {
#[default]
Advanced = 0x80,
Normal,
}
impl TryFrom<String> for TalkOverMode {
type Error = Error;
fn try_from(value: String) -> std::result::Result<TalkOverMode, Self::Error> {
match value.as_str() {
"Advanced" => Ok(Self::Advanced),
"Normal" => Ok(Self::Normal),
_ => Err(Error::SettingInvalidValue("TalkOverMode".into(), value)),
}
}
}
#[binrw]
#[derive(Display, Debug, PartialEq, Eq, Default, Clone, Copy)]
#[brw(repr = u8)]
pub enum TalkOverLevel {
#[display("-24dB")]
Minus24dB = 0x80,
#[default]
#[display("-18dB")]
Minus18dB,
#[display("-12dB")]
Minus12dB,
#[display("-6dB")]
Minus6dB,
}
impl TryFrom<String> for TalkOverLevel {
type Error = Error;
fn try_from(value: String) -> std::result::Result<TalkOverLevel, Self::Error> {
match value.as_str() {
"Minus24dB" => Ok(Self::Minus24dB),
"Minus18dB" => Ok(Self::Minus18dB),
"Minus12dB" => Ok(Self::Minus12dB),
"Minus6dB" => Ok(Self::Minus6dB),
_ => Err(Error::SettingInvalidValue("TalkOverLevel".into(), value)),
}
}
}
#[binrw]
#[derive(Display, Debug, PartialEq, Eq, Default, Clone, Copy)]
#[brw(repr = u8)]
pub enum MidiChannel {
#[default]
#[display("1")]
One = 0x80,
#[display("2")]
Two,
#[display("3")]
Three,
#[display("4")]
Four,
#[display("5")]
Five,
#[display("6")]
Six,
#[display("7")]
Seven,
#[display("8")]
Eight,
#[display("9")]
Nine,
#[display("10")]
Ten,
#[display("11")]
Eleven,
#[display("12")]
Twelve,
#[display("13")]
Thirteen,
#[display("14")]
Fourteen,
#[display("15")]
Fifteen,
#[display("16")]
Sixteen,
}
impl TryFrom<String> for MidiChannel {
type Error = Error;
fn try_from(value: String) -> std::result::Result<MidiChannel, Self::Error> {
match value.as_str() {
"One" => Ok(Self::One),
"Two" => Ok(Self::Two),
"Three" => Ok(Self::Three),
"Four" => Ok(Self::Four),
"Five" => Ok(Self::Five),
"Six" => Ok(Self::Six),
"Seven" => Ok(Self::Seven),
"Eight" => Ok(Self::Eight),
"Nine" => Ok(Self::Nine),
"Ten" => Ok(Self::Ten),
"Eleven" => Ok(Self::Eleven),
"Twelve" => Ok(Self::Twelve),
"Thirteen" => Ok(Self::Thirteen),
"Fourteen" => Ok(Self::Fourteen),
"Fifteen" => Ok(Self::Fifteen),
"Sixteen" => Ok(Self::Sixteen),
_ => Err(Error::SettingInvalidValue("MidiChannel".into(), value)),
}
}
}
#[binrw]
#[derive(Display, Debug, PartialEq, Eq, Default, Clone, Copy)]
#[brw(repr = u8)]
pub enum MidiButtonType {
#[default]
Toggle = 0x80,
Trigger,
}
impl TryFrom<String> for MidiButtonType {
type Error = Error;
fn try_from(value: String) -> std::result::Result<MidiButtonType, Self::Error> {
match value.as_str() {
"Toggle" => Ok(Self::Toggle),
"Trigger" => Ok(Self::Trigger),
_ => Err(Error::SettingInvalidValue("MidiButtonType".into(), value)),
}
}
}
#[binrw]
#[derive(Display, Debug, PartialEq, Eq, Default, Clone, Copy)]
#[brw(repr = u8)]
pub enum MixerDisplayBrightness {
White = 0x80,
#[display("1")]
One,
#[display("2")]
Two,
#[display("3")]
Three,
#[display("4")]
Four,
#[default]
#[display("5")]
Five,
}
impl TryFrom<String> for MixerDisplayBrightness {
type Error = Error;
fn try_from(value: String) -> std::result::Result<MixerDisplayBrightness, Self::Error> {
match value.as_str() {
"White" => Ok(Self::White),
"One" => Ok(Self::One),
"Two" => Ok(Self::Two),
"Three" => Ok(Self::Three),
"Four" => Ok(Self::Four),
"Five" => Ok(Self::Five),
_ => Err(Error::SettingInvalidValue(
"MixerDisplayBrightness".into(),
value,
)),
}
}
}
#[binrw]
#[derive(Display, Debug, PartialEq, Eq, Default, Clone, Copy)]
#[brw(repr = u8)]
pub enum MixerIndicatorBrightness {
#[display("1")]
One = 0x80,
#[display("2")]
Two,
#[display("3")]
#[default]
Three,
}
impl TryFrom<String> for MixerIndicatorBrightness {
type Error = Error;
fn try_from(value: String) -> std::result::Result<MixerIndicatorBrightness, Self::Error> {
match value.as_str() {
"One" => Ok(Self::One),
"Two" => Ok(Self::Two),
"Three" => Ok(Self::Three),
_ => Err(Error::SettingInvalidValue(
"MixerIndicatorBrightness".into(),
value,
)),
}
}
}
#[binrw]
#[derive(Display, Debug, PartialEq, Eq, Default, Clone, Copy)]
#[brw(repr = u8)]
pub enum ChannelFaderCurveLongFader {
#[default]
Exponential = 0x80,
Smooth,
Linear,
}
impl TryFrom<String> for ChannelFaderCurveLongFader {
type Error = Error;
fn try_from(value: String) -> std::result::Result<ChannelFaderCurveLongFader, Self::Error> {
match value.as_str() {
"Exponential" => Ok(Self::Exponential),
"Smooth" => Ok(Self::Smooth),
"Linear" => Ok(Self::Linear),
_ => Err(Error::SettingInvalidValue(
"ChannelFaderCurveLongFader".into(),
value,
)),
}
}
}
#[binrw]
#[derive(Debug, PartialEq, Eq, Clone)]
#[brw(little)]
pub struct DJMMySetting {
unknown1: [u8; 12],
pub channel_fader_curve: ChannelFaderCurve,
pub crossfader_curve: CrossfaderCurve,
pub headphones_pre_eq: HeadphonesPreEQ,
pub headphones_mono_split: HeadphonesMonoSplit,
pub beat_fx_quantize: BeatFXQuantize,
pub mic_low_cut: MicLowCut,
pub talk_over_mode: TalkOverMode,
pub talk_over_level: TalkOverLevel,
pub midi_channel: MidiChannel,
pub midi_button_type: MidiButtonType,
pub display_brightness: MixerDisplayBrightness,
pub indicator_brightness: MixerIndicatorBrightness,
pub channel_fader_curve_long_fader: ChannelFaderCurveLongFader,
#[br(assert(unknown2 == [0; 27]))]
unknown2: [u8; 27],
}
impl Default for DJMMySetting {
fn default() -> Self {
Self {
unknown1: [
0x78, 0x56, 0x34, 0x12, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
],
channel_fader_curve: ChannelFaderCurve::default(),
crossfader_curve: CrossfaderCurve::default(),
headphones_pre_eq: HeadphonesPreEQ::default(),
headphones_mono_split: HeadphonesMonoSplit::default(),
beat_fx_quantize: BeatFXQuantize::default(),
mic_low_cut: MicLowCut::default(),
talk_over_mode: TalkOverMode::default(),
talk_over_level: TalkOverLevel::default(),
midi_channel: MidiChannel::default(),
midi_button_type: MidiButtonType::default(),
display_brightness: MixerDisplayBrightness::default(),
indicator_brightness: MixerIndicatorBrightness::default(),
channel_fader_curve_long_fader: ChannelFaderCurveLongFader::default(),
unknown2: [0; 27],
}
}
}
impl DJMMySetting {
fn file_name() -> String {
"DJMMYSETTING.DAT".into()
}
}
#[binrw]
#[derive(Display, Debug, PartialEq, Eq, Default, Clone, Copy)]
#[brw(repr = u8)]
pub enum OverviewWaveformType {
#[default]
#[display("Half Waveform")]
HalfWaveform = 0x01,
#[display("Full Waveform")]
FullWaveform,
}
impl TryFrom<String> for OverviewWaveformType {
type Error = Error;
fn try_from(value: String) -> std::result::Result<OverviewWaveformType, Self::Error> {
match value.as_str() {
"HalfWaveform" => Ok(Self::HalfWaveform),
"FullWaveform" => Ok(Self::FullWaveform),
_ => Err(Error::SettingInvalidValue(
"OverviewWaveformType".into(),
value,
)),
}
}
}
#[binrw]
#[derive(Display, Debug, PartialEq, Eq, Default, Clone, Copy)]
#[brw(repr = u8)]
pub enum WaveformColor {
#[default]
Blue = 0x01,
#[display("RGB")]
Rgb = 0x03,
#[display("3Band")]
TriBand = 0x04,
}
impl TryFrom<String> for WaveformColor {
type Error = Error;
fn try_from(value: String) -> std::result::Result<WaveformColor, Self::Error> {
match value.as_str() {
"Blue" => Ok(Self::Blue),
"Rgb" => Ok(Self::Rgb),
"TriBand" => Ok(Self::TriBand),
_ => Err(Error::SettingInvalidValue("WaveformColor".into(), value)),
}
}
}
#[binrw]
#[derive(Display, Debug, PartialEq, Eq, Default, Clone, Copy)]
#[brw(repr = u8)]
pub enum KeyDisplayFormat {
#[default]
Classic = 0x01,
Alphanumeric,
}
impl TryFrom<String> for KeyDisplayFormat {
type Error = Error;
fn try_from(value: String) -> std::result::Result<KeyDisplayFormat, Self::Error> {
match value.as_str() {
"Classic" => Ok(Self::Classic),
"Alphanumeric" => Ok(Self::Alphanumeric),
_ => Err(Error::SettingInvalidValue("KeyDisplayFormat".into(), value)),
}
}
}
#[binrw]
#[derive(Display, Debug, PartialEq, Eq, Default, Clone, Copy)]
#[brw(repr = u8)]
pub enum WaveformCurrentPosition {
Left = 0x02,
#[default]
Center = 0x01,
}
impl TryFrom<String> for WaveformCurrentPosition {
type Error = Error;
fn try_from(value: String) -> std::result::Result<WaveformCurrentPosition, Self::Error> {
match value.as_str() {
"Left" => Ok(Self::Left),
"Center" => Ok(Self::Center),
_ => Err(Error::SettingInvalidValue(
"WaveformCurrentPosition".into(),
value,
)),
}
}
}
#[binrw]
#[derive(Debug, PartialEq, Eq, Clone)]
#[brw(little)]
pub struct DevSetting {
#[br(assert(unknown1 == [0x78, 0x56, 0x34, 0x12, 0x01, 0x00, 0x00, 0x00, 0x01]))]
unknown1: [u8; 9],
pub overview_waveform_type: OverviewWaveformType,
pub waveform_color: WaveformColor,
#[br(assert(unknown2 == 0x01))]
unknown2: u8,
pub key_display_format: KeyDisplayFormat,
pub waveform_current_position: WaveformCurrentPosition,
#[br(assert(unknown3 == [0x00; 18]))]
unknown3: [u8; 18],
}
impl Default for DevSetting {
fn default() -> Self {
Self {
unknown1: [0x78, 0x56, 0x34, 0x12, 0x01, 0x00, 0x00, 0x00, 0x01],
overview_waveform_type: OverviewWaveformType::default(),
waveform_color: WaveformColor::default(),
key_display_format: KeyDisplayFormat::default(),
unknown2: 0x01,
waveform_current_position: WaveformCurrentPosition::default(),
unknown3: [0x00; 18],
}
}
}
impl DevSetting {
fn file_name() -> String {
"DEVSETTING.DAT".into()
}
}
#[binrw]
#[derive(Debug, PartialEq, Eq, Clone)]
#[brw(little)]
#[br(import(len: u32))]
pub enum SettingContent {
#[br(pre_assert(len == 40))]
MySetting(MySetting),
#[br(pre_assert(len == 40))]
MySetting2(MySetting2),
#[br(pre_assert(len == 52))]
DJMMySetting(DJMMySetting),
#[br(pre_assert(len == 32))]
DevSetting(DevSetting),
}
impl SettingContent {
fn size(&self) -> u32 {
match &self {
Self::MySetting(_) => 40,
Self::MySetting2(_) => 40,
Self::DJMMySetting(_) => 52,
Self::DevSetting(_) => 32,
}
}
}
#[binrw]
#[derive(Debug, PartialEq, Eq, Clone)]
#[brw(little)]
#[bw(import(no_checksum: bool))]
pub struct SettingData {
#[br(temp, assert(len_stringdata == 0x60))]
#[bw(calc = 0x60)]
len_stringdata: u32,
#[brw(pad_size_to = 0x20, assert(brand.len() <= (0x20 - 1)))]
pub brand: NullString,
#[brw(pad_size_to = 0x20, assert(software.len() <= (0x20 - 1)))]
pub software: NullString,
#[brw(pad_size_to = 0x20, assert(version.len() <= (0x20 - 1)))]
pub version: NullString,
#[br(temp)]
#[bw(calc = content.size())]
len_data: u32,
#[br(args(len_data))]
pub content: SettingContent,
#[br(temp)]
#[bw(calc = no_checksum.then_some(0).unwrap_or_else(|| self.calculate_checksum()))]
_checksum: u16,
#[br(temp)]
#[br(assert(unknown == 0))]
#[bw(calc = 0u16)]
unknown: u16,
}
impl SettingData
where
SettingData: BinWrite,
{
fn calculate_checksum(&self) -> u16 {
let mut data = Vec::<u8>::with_capacity(156);
let mut writer = Cursor::new(&mut data);
self.write_options(&mut writer, Endian::Little, (true,))
.unwrap();
let start = match self.content {
SettingContent::DJMMySetting(_) => 0,
_ => 104,
};
let end = data.len() - 4;
crc16::State::<crc16::XMODEM>::calculate(&data[start..end])
}
}
impl SettingData {
#[must_use]
fn default_with_brand_and_data(brand: NullString, content: SettingContent) -> Self {
Self {
brand,
software: "rekordbox".into(),
version: "6.6.1".into(),
content,
}
}
#[must_use]
pub fn default_mysetting() -> Self {
Self::default_with_brand_and_data(
"PIONEER".into(),
SettingContent::MySetting(MySetting::default()),
)
}
#[must_use]
pub fn default_mysetting2() -> Self {
Self::default_with_brand_and_data(
"PIONEER".into(),
SettingContent::MySetting2(MySetting2::default()),
)
}
#[must_use]
pub fn default_djmmysetting() -> Self {
Self::default_with_brand_and_data(
"PioneerDJ".into(),
SettingContent::DJMMySetting(DJMMySetting::default()),
)
}
#[must_use]
pub fn default_devsetting() -> Self {
Self::default_with_brand_and_data(
"PIONEER DJ".into(),
SettingContent::DevSetting(DevSetting::default()),
)
}
fn file_name(&self) -> &str {
match &self.content {
SettingContent::MySetting(_) => "MYSETTING.DAT",
SettingContent::MySetting2(_) => "MYSETTING2.DAT",
SettingContent::DJMMySetting(_) => "DJMMYSETTING.DAT",
SettingContent::DevSetting(_) => "DEVSETTING.DAT",
}
}
}
pub struct Setting {
path: std::path::PathBuf,
pub data: SettingData,
}
impl Setting {
pub fn new_mysetting<P: AsRef<Path> + AsRef<OsStr>>(path: P) -> Result<Self> {
let p = Path::new(&path).to_path_buf();
let file_name = p.file_name().unwrap().to_str().unwrap();
if file_name != &MySetting::file_name() {
return Err(Error::SettingInvalidFile(MySetting::file_name()));
}
let data = SettingData::default_mysetting();
Ok(Self { path: p, data })
}
pub fn new_mysetting2<P: AsRef<Path> + AsRef<OsStr>>(path: P) -> Result<Self> {
let p = Path::new(&path).to_path_buf();
let file_name = p.file_name().unwrap().to_str().unwrap();
if file_name != &MySetting2::file_name() {
return Err(Error::SettingInvalidFile(MySetting2::file_name()));
}
let data = SettingData::default_mysetting2();
Ok(Self { path: p, data })
}
pub fn new_djmmysetting<P: AsRef<Path> + AsRef<OsStr>>(path: P) -> Result<Self> {
let p = Path::new(&path).to_path_buf();
let file_name = p.file_name().unwrap().to_str().unwrap();
if file_name != &DJMMySetting::file_name() {
return Err(Error::SettingInvalidFile(DJMMySetting::file_name()));
}
let data = SettingData::default_djmmysetting();
Ok(Self { path: p, data })
}
pub fn new_devsetting<P: AsRef<Path> + AsRef<OsStr>>(path: P) -> Result<Self> {
let p = Path::new(&path).to_path_buf();
let file_name = p.file_name().unwrap().to_str().unwrap();
if file_name != &DevSetting::file_name() {
return Err(Error::SettingInvalidFile(DevSetting::file_name()));
}
let data = SettingData::default_devsetting();
Ok(Self { path: p, data })
}
pub fn load<P: AsRef<Path> + AsRef<OsStr>>(path: P) -> Result<Self> {
let p = Path::new(&path).to_path_buf();
let mut file = std::fs::File::open(&p)?;
let data = SettingData::read(&mut file)?;
Ok(Self { path: p, data })
}
pub fn dump_copy<P: AsRef<Path> + AsRef<OsStr>>(&mut self, path: P) -> Result<()> {
let p = Path::new(&path).to_path_buf();
let file_name = p.file_name().unwrap().to_str().unwrap();
if file_name != self.data.file_name() {
return Err(Error::SettingInvalidFile(self.data.file_name().into()));
}
let mut file = std::fs::File::create(path)?;
self.data.write(&mut file)?;
Ok(())
}
pub fn dump(&mut self) -> Result<()> {
let path = &self.path.clone();
self.dump_copy(path)?;
Ok(())
}
pub fn get_on_air_display(&self) -> Result<OnAirDisplay> {
if let SettingContent::MySetting(content) = &self.data.content {
Ok(content.on_air_display)
} else {
Err(Error::SettingInvalidFile(MySetting::file_name()))
}
}
pub fn set_on_air_display(&mut self, on_air_display: OnAirDisplay) -> Result<()> {
if let SettingContent::MySetting(content) = &mut self.data.content {
content.on_air_display = on_air_display;
Ok(())
} else {
Err(Error::SettingInvalidFile(MySetting::file_name()))
}
}
pub fn get_lcd_brightness(&self) -> Result<LCDBrightness> {
if let SettingContent::MySetting(content) = &self.data.content {
Ok(content.lcd_brightness)
} else {
Err(Error::SettingInvalidFile(MySetting::file_name()))
}
}
pub fn set_lcd_brightness(&mut self, lcd_brightness: LCDBrightness) -> Result<()> {
if let SettingContent::MySetting(content) = &mut self.data.content {
content.lcd_brightness = lcd_brightness;
Ok(())
} else {
Err(Error::SettingInvalidFile(MySetting::file_name()))
}
}
pub fn get_quantize(&self) -> Result<Quantize> {
if let SettingContent::MySetting(content) = &self.data.content {
Ok(content.quantize)
} else {
Err(Error::SettingInvalidFile(MySetting::file_name()))
}
}
pub fn set_quantize(&mut self, quantize: Quantize) -> Result<()> {
if let SettingContent::MySetting(content) = &mut self.data.content {
content.quantize = quantize;
Ok(())
} else {
Err(Error::SettingInvalidFile(MySetting::file_name()))
}
}
pub fn get_auto_cue_level(&self) -> Result<AutoCueLevel> {
if let SettingContent::MySetting(content) = &self.data.content {
Ok(content.auto_cue_level)
} else {
Err(Error::SettingInvalidFile(MySetting::file_name()))
}
}
pub fn set_auto_cue_level(&mut self, auto_cue_level: AutoCueLevel) -> Result<()> {
if let SettingContent::MySetting(content) = &mut self.data.content {
content.auto_cue_level = auto_cue_level;
Ok(())
} else {
Err(Error::SettingInvalidFile(MySetting::file_name()))
}
}
pub fn get_language(&self) -> Result<Language> {
if let SettingContent::MySetting(content) = &self.data.content {
Ok(content.language)
} else {
Err(Error::SettingInvalidFile(MySetting::file_name()))
}
}
pub fn set_language(&mut self, language: Language) -> Result<()> {
if let SettingContent::MySetting(content) = &mut self.data.content {
content.language = language;
Ok(())
} else {
Err(Error::SettingInvalidFile(MySetting::file_name()))
}
}
pub fn get_jog_ring_brightness(&self) -> Result<JogRingBrightness> {
if let SettingContent::MySetting(content) = &self.data.content {
Ok(content.jog_ring_brightness)
} else {
Err(Error::SettingInvalidFile(MySetting::file_name()))
}
}
pub fn set_jog_ring_brightness(
&mut self,
jog_ring_brightness: JogRingBrightness,
) -> Result<()> {
if let SettingContent::MySetting(content) = &mut self.data.content {
content.jog_ring_brightness = jog_ring_brightness;
Ok(())
} else {
Err(Error::SettingInvalidFile(MySetting::file_name()))
}
}
pub fn get_jog_ring_indicator(&self) -> Result<JogRingIndicator> {
if let SettingContent::MySetting(content) = &self.data.content {
Ok(content.jog_ring_indicator)
} else {
Err(Error::SettingInvalidFile(MySetting::file_name()))
}
}
pub fn set_jog_ring_indicator(&mut self, jog_ring_indicator: JogRingIndicator) -> Result<()> {
if let SettingContent::MySetting(content) = &mut self.data.content {
content.jog_ring_indicator = jog_ring_indicator;
Ok(())
} else {
Err(Error::SettingInvalidFile(MySetting::file_name()))
}
}
pub fn get_slip_flashing(&self) -> Result<SlipFlashing> {
if let SettingContent::MySetting(content) = &self.data.content {
Ok(content.slip_flashing)
} else {
Err(Error::SettingInvalidFile(MySetting::file_name()))
}
}
pub fn set_slip_flashing(&mut self, slip_flashing: SlipFlashing) -> Result<()> {
if let SettingContent::MySetting(content) = &mut self.data.content {
content.slip_flashing = slip_flashing;
Ok(())
} else {
Err(Error::SettingInvalidFile(MySetting::file_name()))
}
}
pub fn get_disc_slot_illumination(&self) -> Result<DiscSlotIllumination> {
if let SettingContent::MySetting(content) = &self.data.content {
Ok(content.disc_slot_illumination)
} else {
Err(Error::SettingInvalidFile(MySetting::file_name()))
}
}
pub fn set_disc_slot_illumination(
&mut self,
disc_slot_illumination: DiscSlotIllumination,
) -> Result<()> {
if let SettingContent::MySetting(content) = &mut self.data.content {
content.disc_slot_illumination = disc_slot_illumination;
Ok(())
} else {
Err(Error::SettingInvalidFile(MySetting::file_name()))
}
}
pub fn get_eject_lock(&self) -> Result<EjectLock> {
if let SettingContent::MySetting(content) = &self.data.content {
Ok(content.eject_lock)
} else {
Err(Error::SettingInvalidFile(MySetting::file_name()))
}
}
pub fn set_eject_lock(&mut self, eject_lock: EjectLock) -> Result<()> {
if let SettingContent::MySetting(content) = &mut self.data.content {
content.eject_lock = eject_lock;
Ok(())
} else {
Err(Error::SettingInvalidFile(MySetting::file_name()))
}
}
pub fn get_sync(&self) -> Result<Sync> {
if let SettingContent::MySetting(content) = &self.data.content {
Ok(content.sync)
} else {
Err(Error::SettingInvalidFile(MySetting::file_name()))
}
}
pub fn set_sync(&mut self, sync: Sync) -> Result<()> {
if let SettingContent::MySetting(content) = &mut self.data.content {
content.sync = sync;
Ok(())
} else {
Err(Error::SettingInvalidFile(MySetting::file_name()))
}
}
pub fn get_play_mode(&self) -> Result<PlayMode> {
if let SettingContent::MySetting(content) = &self.data.content {
Ok(content.play_mode)
} else {
Err(Error::SettingInvalidFile(MySetting::file_name()))
}
}
pub fn set_play_mode(&mut self, play_mode: PlayMode) -> Result<()> {
if let SettingContent::MySetting(content) = &mut self.data.content {
content.play_mode = play_mode;
Ok(())
} else {
Err(Error::SettingInvalidFile(MySetting::file_name()))
}
}
pub fn get_quantize_beat_value(&self) -> Result<QuantizeBeatValue> {
if let SettingContent::MySetting(content) = &self.data.content {
Ok(content.quantize_beat_value)
} else {
Err(Error::SettingInvalidFile(MySetting::file_name()))
}
}
pub fn set_quantize_beat_value(
&mut self,
quantize_beat_value: QuantizeBeatValue,
) -> Result<()> {
if let SettingContent::MySetting(content) = &mut self.data.content {
content.quantize_beat_value = quantize_beat_value;
Ok(())
} else {
Err(Error::SettingInvalidFile(MySetting::file_name()))
}
}
pub fn get_hotcue_autoload(&self) -> Result<HotCueAutoLoad> {
if let SettingContent::MySetting(content) = &self.data.content {
Ok(content.hotcue_autoload)
} else {
Err(Error::SettingInvalidFile(MySetting::file_name()))
}
}
pub fn set_hotcue_autoload(&mut self, hotcue_autoload: HotCueAutoLoad) -> Result<()> {
if let SettingContent::MySetting(content) = &mut self.data.content {
content.hotcue_autoload = hotcue_autoload;
Ok(())
} else {
Err(Error::SettingInvalidFile(MySetting::file_name()))
}
}
pub fn get_hotcue_color(&self) -> Result<HotCueColor> {
if let SettingContent::MySetting(content) = &self.data.content {
Ok(content.hotcue_color)
} else {
Err(Error::SettingInvalidFile(MySetting::file_name()))
}
}
pub fn set_hotcue_color(&mut self, hotcue_color: HotCueColor) -> Result<()> {
if let SettingContent::MySetting(content) = &mut self.data.content {
content.hotcue_color = hotcue_color;
Ok(())
} else {
Err(Error::SettingInvalidFile(MySetting::file_name()))
}
}
pub fn get_needle_lock(&self) -> Result<NeedleLock> {
if let SettingContent::MySetting(content) = &self.data.content {
Ok(content.needle_lock)
} else {
Err(Error::SettingInvalidFile(MySetting::file_name()))
}
}
pub fn set_needle_lock(&mut self, needle_lock: NeedleLock) -> Result<()> {
if let SettingContent::MySetting(content) = &mut self.data.content {
content.needle_lock = needle_lock;
Ok(())
} else {
Err(Error::SettingInvalidFile(MySetting::file_name()))
}
}
pub fn get_time_mode(&self) -> Result<TimeMode> {
if let SettingContent::MySetting(content) = &self.data.content {
Ok(content.time_mode)
} else {
Err(Error::SettingInvalidFile(MySetting::file_name()))
}
}
pub fn set_time_mode(&mut self, time_mode: TimeMode) -> Result<()> {
if let SettingContent::MySetting(content) = &mut self.data.content {
content.time_mode = time_mode;
Ok(())
} else {
Err(Error::SettingInvalidFile(MySetting::file_name()))
}
}
pub fn get_jog_mode(&self) -> Result<JogMode> {
if let SettingContent::MySetting(content) = &self.data.content {
Ok(content.jog_mode)
} else {
Err(Error::SettingInvalidFile(MySetting::file_name()))
}
}
pub fn set_jog_mode(&mut self, jog_mode: JogMode) -> Result<()> {
if let SettingContent::MySetting(content) = &mut self.data.content {
content.jog_mode = jog_mode;
Ok(())
} else {
Err(Error::SettingInvalidFile(MySetting::file_name()))
}
}
pub fn get_auto_cue(&self) -> Result<AutoCue> {
if let SettingContent::MySetting(content) = &self.data.content {
Ok(content.auto_cue)
} else {
Err(Error::SettingInvalidFile(MySetting::file_name()))
}
}
pub fn set_auto_cue(&mut self, auto_cue: AutoCue) -> Result<()> {
if let SettingContent::MySetting(content) = &mut self.data.content {
content.auto_cue = auto_cue;
Ok(())
} else {
Err(Error::SettingInvalidFile(MySetting::file_name()))
}
}
pub fn get_master_tempo(&self) -> Result<MasterTempo> {
if let SettingContent::MySetting(content) = &self.data.content {
Ok(content.master_tempo)
} else {
Err(Error::SettingInvalidFile(MySetting::file_name()))
}
}
pub fn set_master_tempo(&mut self, master_tempo: MasterTempo) -> Result<()> {
if let SettingContent::MySetting(content) = &mut self.data.content {
content.master_tempo = master_tempo;
Ok(())
} else {
Err(Error::SettingInvalidFile(MySetting::file_name()))
}
}
pub fn get_tempo_range(&self) -> Result<TempoRange> {
if let SettingContent::MySetting(content) = &self.data.content {
Ok(content.tempo_range)
} else {
Err(Error::SettingInvalidFile(MySetting::file_name()))
}
}
pub fn set_tempo_range(&mut self, tempo_range: TempoRange) -> Result<()> {
if let SettingContent::MySetting(content) = &mut self.data.content {
content.tempo_range = tempo_range;
Ok(())
} else {
Err(Error::SettingInvalidFile(MySetting::file_name()))
}
}
pub fn get_phase_meter(&self) -> Result<PhaseMeter> {
if let SettingContent::MySetting(content) = &self.data.content {
Ok(content.phase_meter)
} else {
Err(Error::SettingInvalidFile(MySetting::file_name()))
}
}
pub fn set_phase_meter(&mut self, phase_meter: PhaseMeter) -> Result<()> {
if let SettingContent::MySetting(content) = &mut self.data.content {
content.phase_meter = phase_meter;
Ok(())
} else {
Err(Error::SettingInvalidFile(MySetting::file_name()))
}
}
pub fn get_vinyl_speed_adjust(&self) -> Result<VinylSpeedAdjust> {
if let SettingContent::MySetting2(content) = &self.data.content {
Ok(content.vinyl_speed_adjust)
} else {
Err(Error::SettingInvalidFile(MySetting2::file_name()))
}
}
pub fn set_vinyl_speed_adjust(&mut self, vinyl_speed_adjust: VinylSpeedAdjust) -> Result<()> {
if let SettingContent::MySetting2(content) = &mut self.data.content {
content.vinyl_speed_adjust = vinyl_speed_adjust;
Ok(())
} else {
Err(Error::SettingInvalidFile(MySetting2::file_name()))
}
}
pub fn get_jog_display_mode(&self) -> Result<JogDisplayMode> {
if let SettingContent::MySetting2(content) = &self.data.content {
Ok(content.jog_display_mode)
} else {
Err(Error::SettingInvalidFile(MySetting2::file_name()))
}
}
pub fn set_jog_display_mode(&mut self, jog_display_mode: JogDisplayMode) -> Result<()> {
if let SettingContent::MySetting2(content) = &mut self.data.content {
content.jog_display_mode = jog_display_mode;
Ok(())
} else {
Err(Error::SettingInvalidFile(MySetting2::file_name()))
}
}
pub fn get_pad_button_brightness(&self) -> Result<PadButtonBrightness> {
if let SettingContent::MySetting2(content) = &self.data.content {
Ok(content.pad_button_brightness)
} else {
Err(Error::SettingInvalidFile(MySetting2::file_name()))
}
}
pub fn set_pad_button_brightness(
&mut self,
pad_button_brightness: PadButtonBrightness,
) -> Result<()> {
if let SettingContent::MySetting2(content) = &mut self.data.content {
content.pad_button_brightness = pad_button_brightness;
Ok(())
} else {
Err(Error::SettingInvalidFile(MySetting2::file_name()))
}
}
pub fn get_jog_lcd_brightness(&self) -> Result<JogLCDBrightness> {
if let SettingContent::MySetting2(content) = &self.data.content {
Ok(content.jog_lcd_brightness)
} else {
Err(Error::SettingInvalidFile(MySetting2::file_name()))
}
}
pub fn set_jog_lcd_brightness(&mut self, jog_lcd_brightness: JogLCDBrightness) -> Result<()> {
if let SettingContent::MySetting2(content) = &mut self.data.content {
content.jog_lcd_brightness = jog_lcd_brightness;
Ok(())
} else {
Err(Error::SettingInvalidFile(MySetting2::file_name()))
}
}
pub fn get_waveform_divisions(&self) -> Result<WaveformDivisions> {
if let SettingContent::MySetting2(content) = &self.data.content {
Ok(content.waveform_divisions)
} else {
Err(Error::SettingInvalidFile(MySetting2::file_name()))
}
}
pub fn set_waveform_divisions(&mut self, waveform_divisions: WaveformDivisions) -> Result<()> {
if let SettingContent::MySetting2(content) = &mut self.data.content {
content.waveform_divisions = waveform_divisions;
Ok(())
} else {
Err(Error::SettingInvalidFile(MySetting2::file_name()))
}
}
pub fn get_waveform(&self) -> Result<Waveform> {
if let SettingContent::MySetting2(content) = &self.data.content {
Ok(content.waveform)
} else {
Err(Error::SettingInvalidFile(MySetting2::file_name()))
}
}
pub fn set_waveform(&mut self, waveform: Waveform) -> Result<()> {
if let SettingContent::MySetting2(content) = &mut self.data.content {
content.waveform = waveform;
Ok(())
} else {
Err(Error::SettingInvalidFile(MySetting2::file_name()))
}
}
pub fn get_beat_jump_beat_value(&self) -> Result<BeatJumpBeatValue> {
if let SettingContent::MySetting2(content) = &self.data.content {
Ok(content.beat_jump_beat_value)
} else {
Err(Error::SettingInvalidFile(MySetting2::file_name()))
}
}
pub fn set_beat_jump_beat_value(
&mut self,
beat_jump_beat_value: BeatJumpBeatValue,
) -> Result<()> {
if let SettingContent::MySetting2(content) = &mut self.data.content {
content.beat_jump_beat_value = beat_jump_beat_value;
Ok(())
} else {
Err(Error::SettingInvalidFile(MySetting2::file_name()))
}
}
pub fn get_channel_fader_curve(&self) -> Result<ChannelFaderCurve> {
if let SettingContent::DJMMySetting(content) = &self.data.content {
Ok(content.channel_fader_curve)
} else {
Err(Error::SettingInvalidFile(DJMMySetting::file_name()))
}
}
pub fn set_channel_fader_curve(
&mut self,
channel_fader_curve: ChannelFaderCurve,
) -> Result<()> {
if let SettingContent::DJMMySetting(content) = &mut self.data.content {
content.channel_fader_curve = channel_fader_curve;
Ok(())
} else {
Err(Error::SettingInvalidFile(DJMMySetting::file_name()))
}
}
pub fn get_crossfader_curve(&self) -> Result<CrossfaderCurve> {
if let SettingContent::DJMMySetting(content) = &self.data.content {
Ok(content.crossfader_curve)
} else {
Err(Error::SettingInvalidFile(DJMMySetting::file_name()))
}
}
pub fn set_crossfader_curve(&mut self, crossfader_curve: CrossfaderCurve) -> Result<()> {
if let SettingContent::DJMMySetting(content) = &mut self.data.content {
content.crossfader_curve = crossfader_curve;
Ok(())
} else {
Err(Error::SettingInvalidFile(DJMMySetting::file_name()))
}
}
pub fn get_headphones_pre_eq(&self) -> Result<HeadphonesPreEQ> {
if let SettingContent::DJMMySetting(content) = &self.data.content {
Ok(content.headphones_pre_eq)
} else {
Err(Error::SettingInvalidFile(DJMMySetting::file_name()))
}
}
pub fn set_headphones_pre_eq(&mut self, headphones_pre_eq: HeadphonesPreEQ) -> Result<()> {
if let SettingContent::DJMMySetting(content) = &mut self.data.content {
content.headphones_pre_eq = headphones_pre_eq;
Ok(())
} else {
Err(Error::SettingInvalidFile(DJMMySetting::file_name()))
}
}
pub fn get_headphones_mono_split(&self) -> Result<HeadphonesMonoSplit> {
if let SettingContent::DJMMySetting(content) = &self.data.content {
Ok(content.headphones_mono_split)
} else {
Err(Error::SettingInvalidFile(DJMMySetting::file_name()))
}
}
pub fn set_headphones_mono_split(
&mut self,
headphones_mono_split: HeadphonesMonoSplit,
) -> Result<()> {
if let SettingContent::DJMMySetting(content) = &mut self.data.content {
content.headphones_mono_split = headphones_mono_split;
Ok(())
} else {
Err(Error::SettingInvalidFile(DJMMySetting::file_name()))
}
}
pub fn get_beat_fx_quantize(&self) -> Result<BeatFXQuantize> {
if let SettingContent::DJMMySetting(content) = &self.data.content {
Ok(content.beat_fx_quantize)
} else {
Err(Error::SettingInvalidFile(DJMMySetting::file_name()))
}
}
pub fn set_beat_fx_quantize(&mut self, beat_fx_quantize: BeatFXQuantize) -> Result<()> {
if let SettingContent::DJMMySetting(content) = &mut self.data.content {
content.beat_fx_quantize = beat_fx_quantize;
Ok(())
} else {
Err(Error::SettingInvalidFile(DJMMySetting::file_name()))
}
}
pub fn get_mic_low_cut(&self) -> Result<MicLowCut> {
if let SettingContent::DJMMySetting(content) = &self.data.content {
Ok(content.mic_low_cut)
} else {
Err(Error::SettingInvalidFile(DJMMySetting::file_name()))
}
}
pub fn set_mic_low_cut(&mut self, mic_low_cut: MicLowCut) -> Result<()> {
if let SettingContent::DJMMySetting(content) = &mut self.data.content {
content.mic_low_cut = mic_low_cut;
Ok(())
} else {
Err(Error::SettingInvalidFile(DJMMySetting::file_name()))
}
}
pub fn get_talk_over_mode(&self) -> Result<TalkOverMode> {
if let SettingContent::DJMMySetting(content) = &self.data.content {
Ok(content.talk_over_mode)
} else {
Err(Error::SettingInvalidFile(DJMMySetting::file_name()))
}
}
pub fn set_talk_over_mode(&mut self, talk_over_mode: TalkOverMode) -> Result<()> {
if let SettingContent::DJMMySetting(content) = &mut self.data.content {
content.talk_over_mode = talk_over_mode;
Ok(())
} else {
Err(Error::SettingInvalidFile(DJMMySetting::file_name()))
}
}
pub fn get_talk_over_level(&self) -> Result<TalkOverLevel> {
if let SettingContent::DJMMySetting(content) = &self.data.content {
Ok(content.talk_over_level)
} else {
Err(Error::SettingInvalidFile(DJMMySetting::file_name()))
}
}
pub fn set_talk_over_level(&mut self, talk_over_level: TalkOverLevel) -> Result<()> {
if let SettingContent::DJMMySetting(content) = &mut self.data.content {
content.talk_over_level = talk_over_level;
Ok(())
} else {
Err(Error::SettingInvalidFile(DJMMySetting::file_name()))
}
}
pub fn get_midi_channel(&self) -> Result<MidiChannel> {
if let SettingContent::DJMMySetting(content) = &self.data.content {
Ok(content.midi_channel)
} else {
Err(Error::SettingInvalidFile(DJMMySetting::file_name()))
}
}
pub fn set_midi_channel(&mut self, midi_channel: MidiChannel) -> Result<()> {
if let SettingContent::DJMMySetting(content) = &mut self.data.content {
content.midi_channel = midi_channel;
Ok(())
} else {
Err(Error::SettingInvalidFile(DJMMySetting::file_name()))
}
}
pub fn get_midi_button_type(&self) -> Result<MidiButtonType> {
if let SettingContent::DJMMySetting(content) = &self.data.content {
Ok(content.midi_button_type)
} else {
Err(Error::SettingInvalidFile(DJMMySetting::file_name()))
}
}
pub fn set_midi_button_type(&mut self, midi_button_type: MidiButtonType) -> Result<()> {
if let SettingContent::DJMMySetting(content) = &mut self.data.content {
content.midi_button_type = midi_button_type;
Ok(())
} else {
Err(Error::SettingInvalidFile(DJMMySetting::file_name()))
}
}
pub fn get_mixer_display_brightness(&self) -> Result<MixerDisplayBrightness> {
if let SettingContent::DJMMySetting(content) = &self.data.content {
Ok(content.display_brightness)
} else {
Err(Error::SettingInvalidFile(DJMMySetting::file_name()))
}
}
pub fn set_mixer_display_brightness(
&mut self,
mixer_display_brightness: MixerDisplayBrightness,
) -> Result<()> {
if let SettingContent::DJMMySetting(content) = &mut self.data.content {
content.display_brightness = mixer_display_brightness;
Ok(())
} else {
Err(Error::SettingInvalidFile(DJMMySetting::file_name()))
}
}
pub fn get_mixer_indicator_brightness(&self) -> Result<MixerIndicatorBrightness> {
if let SettingContent::DJMMySetting(content) = &self.data.content {
Ok(content.indicator_brightness)
} else {
Err(Error::SettingInvalidFile(DJMMySetting::file_name()))
}
}
pub fn set_mixer_indicator_brightness(
&mut self,
mixer_indicator_brightness: MixerIndicatorBrightness,
) -> Result<()> {
if let SettingContent::DJMMySetting(content) = &mut self.data.content {
content.indicator_brightness = mixer_indicator_brightness;
Ok(())
} else {
Err(Error::SettingInvalidFile(DJMMySetting::file_name()))
}
}
pub fn get_channel_fader_curve_long_fader(&self) -> Result<ChannelFaderCurveLongFader> {
if let SettingContent::DJMMySetting(content) = &self.data.content {
Ok(content.channel_fader_curve_long_fader)
} else {
Err(Error::SettingInvalidFile(DJMMySetting::file_name()))
}
}
pub fn set_channel_fader_curve_long_fader(
&mut self,
channel_fader_curve_long_fader: ChannelFaderCurveLongFader,
) -> Result<()> {
if let SettingContent::DJMMySetting(content) = &mut self.data.content {
content.channel_fader_curve_long_fader = channel_fader_curve_long_fader;
Ok(())
} else {
Err(Error::SettingInvalidFile(DJMMySetting::file_name()))
}
}
pub fn get_overview_waveform_type(&self) -> Result<OverviewWaveformType> {
if let SettingContent::DevSetting(content) = &self.data.content {
Ok(content.overview_waveform_type)
} else {
Err(Error::SettingInvalidFile(DevSetting::file_name()))
}
}
pub fn set_overview_waveform_type(
&mut self,
overview_waveform_type: OverviewWaveformType,
) -> Result<()> {
if let SettingContent::DevSetting(content) = &mut self.data.content {
content.overview_waveform_type = overview_waveform_type;
Ok(())
} else {
Err(Error::SettingInvalidFile(DevSetting::file_name()))
}
}
pub fn get_waveform_color(&self) -> Result<WaveformColor> {
if let SettingContent::DevSetting(content) = &self.data.content {
Ok(content.waveform_color)
} else {
Err(Error::SettingInvalidFile(DevSetting::file_name()))
}
}
pub fn set_waveform_color(&mut self, waveform_color: WaveformColor) -> Result<()> {
if let SettingContent::DevSetting(content) = &mut self.data.content {
content.waveform_color = waveform_color;
Ok(())
} else {
Err(Error::SettingInvalidFile(DevSetting::file_name()))
}
}
pub fn get_key_display_format(&self) -> Result<KeyDisplayFormat> {
if let SettingContent::DevSetting(content) = &self.data.content {
Ok(content.key_display_format)
} else {
Err(Error::SettingInvalidFile(DevSetting::file_name()))
}
}
pub fn set_key_display_format(&mut self, key_display_format: KeyDisplayFormat) -> Result<()> {
if let SettingContent::DevSetting(content) = &mut self.data.content {
content.key_display_format = key_display_format;
Ok(())
} else {
Err(Error::SettingInvalidFile(DevSetting::file_name()))
}
}
pub fn get_waveform_current_position(&self) -> Result<WaveformCurrentPosition> {
if let SettingContent::DevSetting(content) = &self.data.content {
Ok(content.waveform_current_position)
} else {
Err(Error::SettingInvalidFile(DevSetting::file_name()))
}
}
pub fn set_waveform_current_position(
&mut self,
waveform_current_position: WaveformCurrentPosition,
) -> Result<()> {
if let SettingContent::DevSetting(content) = &mut self.data.content {
content.waveform_current_position = waveform_current_position;
Ok(())
} else {
Err(Error::SettingInvalidFile(DevSetting::file_name()))
}
}
}