opt: enum

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-05-05 15:06:19 +08:00
parent 4e68c765c5
commit 2f4c739f0b
116 changed files with 577 additions and 554 deletions

View File

@@ -0,0 +1,30 @@
// ignore_for_file: constant_identifier_names
enum AudioQuality { k64, k132, k192, dolby, hiRes }
extension AudioQualityExt on AudioQuality {
static const List<int> _codeList = [
30216,
30232,
30280,
30250,
30251,
];
int get code => _codeList[index];
static AudioQuality? fromCode(int code) {
final index = _codeList.indexOf(code);
if (index != -1) {
return AudioQuality.values[index];
}
return null;
}
String get description => const [
'64K',
'132K',
'192K',
'杜比全景声',
'Hi-Res无损',
][index];
}