2023-10-30 16:20:35 +00:00
|
|
|
#include "../infrared_app_i.h"
|
2022-10-28 16:43:54 +00:00
|
|
|
|
|
|
|
#include "common/infrared_scene_universal_common.h"
|
|
|
|
|
|
|
|
void infrared_scene_universal_audio_on_enter(void* context) {
|
|
|
|
infrared_scene_universal_common_on_enter(context);
|
|
|
|
|
2023-10-30 16:20:35 +00:00
|
|
|
InfraredApp* infrared = context;
|
2022-10-28 16:43:54 +00:00
|
|
|
ButtonPanel* button_panel = infrared->button_panel;
|
|
|
|
InfraredBruteForce* brute_force = infrared->brute_force;
|
|
|
|
|
|
|
|
infrared_brute_force_set_db_filename(brute_force, EXT_PATH("infrared/assets/audio.ir"));
|
|
|
|
|
|
|
|
button_panel_reserve(button_panel, 2, 4);
|
|
|
|
uint32_t i = 0;
|
|
|
|
button_panel_add_item(
|
|
|
|
button_panel,
|
|
|
|
i,
|
|
|
|
0,
|
|
|
|
0,
|
2023-08-23 18:24:47 +00:00
|
|
|
6,
|
|
|
|
13,
|
|
|
|
&I_power_19x20,
|
|
|
|
&I_power_hover_19x20,
|
2022-10-28 16:43:54 +00:00
|
|
|
infrared_scene_universal_common_item_callback,
|
|
|
|
context);
|
2023-08-23 18:24:47 +00:00
|
|
|
button_panel_add_icon(button_panel, 4, 35, &I_power_text_24x5);
|
2022-10-28 16:43:54 +00:00
|
|
|
infrared_brute_force_add_record(brute_force, i++, "Power");
|
|
|
|
button_panel_add_item(
|
|
|
|
button_panel,
|
|
|
|
i,
|
|
|
|
1,
|
|
|
|
0,
|
2023-08-23 18:24:47 +00:00
|
|
|
39,
|
|
|
|
13,
|
|
|
|
&I_mute_19x20,
|
|
|
|
&I_mute_hover_19x20,
|
2022-10-28 16:43:54 +00:00
|
|
|
infrared_scene_universal_common_item_callback,
|
|
|
|
context);
|
2023-08-23 18:24:47 +00:00
|
|
|
button_panel_add_icon(button_panel, 39, 35, &I_mute_text_19x5);
|
2022-10-28 16:43:54 +00:00
|
|
|
infrared_brute_force_add_record(brute_force, i++, "Mute");
|
|
|
|
button_panel_add_item(
|
|
|
|
button_panel,
|
|
|
|
i,
|
|
|
|
0,
|
|
|
|
1,
|
2023-08-23 18:24:47 +00:00
|
|
|
6,
|
|
|
|
42,
|
|
|
|
&I_play_19x20,
|
|
|
|
&I_play_hover_19x20,
|
2022-10-28 16:43:54 +00:00
|
|
|
infrared_scene_universal_common_item_callback,
|
|
|
|
context);
|
2023-08-23 18:24:47 +00:00
|
|
|
button_panel_add_icon(button_panel, 6, 64, &I_play_text_19x5);
|
2022-10-28 16:43:54 +00:00
|
|
|
infrared_brute_force_add_record(brute_force, i++, "Play");
|
|
|
|
button_panel_add_item(
|
|
|
|
button_panel,
|
|
|
|
i,
|
2023-08-23 18:24:47 +00:00
|
|
|
0,
|
|
|
|
2,
|
|
|
|
6,
|
|
|
|
71,
|
|
|
|
&I_pause_19x20,
|
|
|
|
&I_pause_hover_19x20,
|
2022-10-28 16:43:54 +00:00
|
|
|
infrared_scene_universal_common_item_callback,
|
|
|
|
context);
|
2023-08-23 18:24:47 +00:00
|
|
|
button_panel_add_icon(button_panel, 4, 93, &I_pause_text_23x5);
|
2022-10-28 16:43:54 +00:00
|
|
|
infrared_brute_force_add_record(brute_force, i++, "Pause");
|
|
|
|
button_panel_add_item(
|
|
|
|
button_panel,
|
|
|
|
i,
|
|
|
|
0,
|
|
|
|
3,
|
2023-08-23 18:24:47 +00:00
|
|
|
6,
|
|
|
|
101,
|
|
|
|
&I_prev_19x20,
|
|
|
|
&I_prev_hover_19x20,
|
2022-10-28 16:43:54 +00:00
|
|
|
infrared_scene_universal_common_item_callback,
|
|
|
|
context);
|
2023-08-23 18:24:47 +00:00
|
|
|
button_panel_add_icon(button_panel, 6, 123, &I_prev_text_19x5);
|
2022-10-28 16:43:54 +00:00
|
|
|
infrared_brute_force_add_record(brute_force, i++, "Prev");
|
|
|
|
button_panel_add_item(
|
|
|
|
button_panel,
|
|
|
|
i,
|
|
|
|
1,
|
2023-08-23 18:24:47 +00:00
|
|
|
3,
|
|
|
|
39,
|
|
|
|
101,
|
|
|
|
&I_next_19x20,
|
|
|
|
&I_next_hover_19x20,
|
2022-10-28 16:43:54 +00:00
|
|
|
infrared_scene_universal_common_item_callback,
|
|
|
|
context);
|
2023-08-23 18:24:47 +00:00
|
|
|
button_panel_add_icon(button_panel, 39, 123, &I_next_text_19x6);
|
2022-10-28 16:43:54 +00:00
|
|
|
infrared_brute_force_add_record(brute_force, i++, "Next");
|
|
|
|
button_panel_add_item(
|
|
|
|
button_panel,
|
|
|
|
i,
|
2023-08-23 18:24:47 +00:00
|
|
|
1,
|
|
|
|
2,
|
|
|
|
37,
|
|
|
|
77,
|
|
|
|
&I_voldown_24x21,
|
|
|
|
&I_voldown_hover_24x21,
|
2022-10-28 16:43:54 +00:00
|
|
|
infrared_scene_universal_common_item_callback,
|
|
|
|
context);
|
|
|
|
infrared_brute_force_add_record(brute_force, i++, "Vol_dn");
|
|
|
|
button_panel_add_item(
|
|
|
|
button_panel,
|
|
|
|
i,
|
|
|
|
1,
|
2023-08-23 18:24:47 +00:00
|
|
|
1,
|
|
|
|
37,
|
|
|
|
43,
|
|
|
|
&I_volup_24x21,
|
|
|
|
&I_volup_hover_24x21,
|
2022-10-28 16:43:54 +00:00
|
|
|
infrared_scene_universal_common_item_callback,
|
|
|
|
context);
|
|
|
|
infrared_brute_force_add_record(brute_force, i++, "Vol_up");
|
|
|
|
|
2023-08-23 18:24:47 +00:00
|
|
|
button_panel_add_label(button_panel, 1, 10, FontPrimary, "Mus. remote");
|
|
|
|
button_panel_add_icon(button_panel, 34, 56, &I_vol_ac_text_30x30);
|
2022-10-28 16:43:54 +00:00
|
|
|
|
|
|
|
view_set_orientation(view_stack_get_view(infrared->view_stack), ViewOrientationVertical);
|
|
|
|
view_dispatcher_switch_to_view(infrared->view_dispatcher, InfraredViewStack);
|
|
|
|
|
|
|
|
infrared_show_loading_popup(infrared, true);
|
|
|
|
bool success = infrared_brute_force_calculate_messages(brute_force);
|
|
|
|
infrared_show_loading_popup(infrared, false);
|
|
|
|
|
|
|
|
if(!success) {
|
|
|
|
scene_manager_next_scene(infrared->scene_manager, InfraredSceneErrorDatabases);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
bool infrared_scene_universal_audio_on_event(void* context, SceneManagerEvent event) {
|
|
|
|
return infrared_scene_universal_common_on_event(context, event);
|
|
|
|
}
|
|
|
|
|
|
|
|
void infrared_scene_universal_audio_on_exit(void* context) {
|
|
|
|
infrared_scene_universal_common_on_exit(context);
|
|
|
|
}
|