File tree Expand file tree Collapse file tree 2 files changed +43
-0
lines changed
Expand file tree Collapse file tree 2 files changed +43
-0
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ mod hardware;
1111mod input;
1212mod ram;
1313mod screen;
14+ mod sound;
1415mod timedate;
1516
1617pub static OS_MENU : menu:: Menu < Ctx > = menu:: Menu {
@@ -29,6 +30,7 @@ pub static OS_MENU: menu::Menu<Ctx> = menu::Menu {
2930 & screen:: CLS_ITEM ,
3031 & input:: KBTEST_ITEM ,
3132 & hardware:: SHUTDOWN_ITEM ,
33+ & sound:: MIXER_ITEM ,
3234 ] ,
3335 entry : None ,
3436 exit : None ,
Original file line number Diff line number Diff line change 1+ //! Sound related commands for Neotron OS
2+
3+ use crate :: { osprintln, Ctx , API } ;
4+
5+ pub static MIXER_ITEM : menu:: Item < Ctx > = menu:: Item {
6+ item_type : menu:: ItemType :: Callback {
7+ function : mixer,
8+ parameters : & [ ] ,
9+ } ,
10+ command : "mixer" ,
11+ help : Some ( "Control the audio mixer" ) ,
12+ } ;
13+
14+ /// Called when the "mixer" command is executed.
15+ fn mixer ( _menu : & menu:: Menu < Ctx > , _item : & menu:: Item < Ctx > , _args : & [ & str ] , _ctx : & mut Ctx ) {
16+ let api = API . get ( ) ;
17+ osprintln ! ( "Mixers:" ) ;
18+ for mixer_id in 0u8 ..=255u8 {
19+ match ( api. audio_mixer_channel_get_info ) ( mixer_id) {
20+ neotron_common_bios:: FfiOption :: Some ( mixer_info) => {
21+ let dir_str = match mixer_info. direction {
22+ neotron_common_bios:: audio:: Direction :: Input => "In" ,
23+ neotron_common_bios:: audio:: Direction :: Loopback => "Loop" ,
24+ neotron_common_bios:: audio:: Direction :: Output => "Out" ,
25+ } ;
26+ osprintln ! (
27+ "#{}: {} ({}) {}/{}" ,
28+ mixer_id,
29+ mixer_info. name,
30+ dir_str,
31+ mixer_info. current_level,
32+ mixer_info. max_level
33+ ) ;
34+ }
35+ neotron_common_bios:: FfiOption :: None => {
36+ // Run out of mixers
37+ break ;
38+ }
39+ }
40+ }
41+ }
You can’t perform that action at this time.
0 commit comments