109 lines
2.5 KiB
Dart
109 lines
2.5 KiB
Dart
// Converted with: https://app.quicktype.io/?l=dart
|
|
|
|
import 'dart:convert';
|
|
|
|
MixerState mixerStateFromJson(String str) =>
|
|
MixerState.fromJson(json.decode(str));
|
|
|
|
String mixerStateToJson(MixerState data) => json.encode(data.toJson());
|
|
|
|
class MixerState {
|
|
List<Port> inputs;
|
|
List<Port> outputs;
|
|
|
|
MixerState({
|
|
required this.inputs,
|
|
required this.outputs,
|
|
});
|
|
|
|
factory MixerState.fromJson(Map<String, dynamic> json) => MixerState(
|
|
inputs: List<Port>.from(json["inputs"].map((x) => Port.fromJson(x))),
|
|
outputs: List<Port>.from(json["outputs"].map((x) => Port.fromJson(x))),
|
|
);
|
|
|
|
Map<String, dynamic> toJson() => {
|
|
"inputs": List<dynamic>.from(inputs.map((x) => x.toJson())),
|
|
"outputs": List<dynamic>.from(outputs.map((x) => x.toJson())),
|
|
};
|
|
}
|
|
|
|
class Port {
|
|
String uuid;
|
|
String name;
|
|
Properties properties;
|
|
State state;
|
|
List<State> route;
|
|
|
|
Port({
|
|
required this.uuid,
|
|
required this.name,
|
|
required this.properties,
|
|
required this.state,
|
|
required this.route,
|
|
});
|
|
|
|
factory Port.fromJson(Map<String, dynamic> json) => Port(
|
|
uuid: json["UUID"],
|
|
name: json["name"],
|
|
properties: Properties.fromJson(json["properties"]),
|
|
state: State.fromJson(json["state"]),
|
|
route: List<State>.from(json["route"].map((x) => State.fromJson(x))),
|
|
);
|
|
|
|
Map<String, dynamic> toJson() => {
|
|
"UUID": uuid,
|
|
"name": name,
|
|
"properties": properties.toJson(),
|
|
"state": state.toJson(),
|
|
"route": List<dynamic>.from(route.map((x) => x.toJson())),
|
|
};
|
|
}
|
|
|
|
class Properties {
|
|
String backend;
|
|
int channels;
|
|
|
|
Properties({
|
|
required this.backend,
|
|
required this.channels,
|
|
});
|
|
|
|
factory Properties.fromJson(Map<String, dynamic> json) => Properties(
|
|
backend: json["backend"],
|
|
channels: json["channels"],
|
|
);
|
|
|
|
Map<String, dynamic> toJson() => {
|
|
"backend": backend,
|
|
"channels": channels,
|
|
};
|
|
}
|
|
|
|
class State {
|
|
String? toUuid;
|
|
bool mute;
|
|
double volume;
|
|
double balance;
|
|
|
|
State({
|
|
this.toUuid,
|
|
required this.mute,
|
|
required this.volume,
|
|
required this.balance,
|
|
});
|
|
|
|
factory State.fromJson(Map<String, dynamic> json) => State(
|
|
toUuid: json["toUUID"],
|
|
mute: json["mute"],
|
|
volume: json["volume"]?.toDouble(),
|
|
balance: json["balance"]?.toDouble(),
|
|
);
|
|
|
|
Map<String, dynamic> toJson() => {
|
|
"toUUID": toUuid,
|
|
"mute": mute,
|
|
"volume": volume,
|
|
"balance": balance,
|
|
};
|
|
}
|