infrared_scene_universal_audio.c 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. #include "../infrared_i.h"
  2. #include "common/infrared_scene_universal_common.h"
  3. void infrared_scene_universal_audio_on_enter(void* context) {
  4. infrared_scene_universal_common_on_enter(context);
  5. Infrared* infrared = context;
  6. ButtonPanel* button_panel = infrared->button_panel;
  7. InfraredBruteForce* brute_force = infrared->brute_force;
  8. infrared_brute_force_set_db_filename(brute_force, EXT_PATH("infrared/assets/audio.ir"));
  9. button_panel_reserve(button_panel, 2, 4);
  10. uint32_t i = 0;
  11. button_panel_add_item(
  12. button_panel,
  13. i,
  14. 0,
  15. 0,
  16. 3,
  17. 11,
  18. &I_Power_25x27,
  19. &I_Power_hvr_25x27,
  20. infrared_scene_universal_common_item_callback,
  21. context);
  22. infrared_brute_force_add_record(brute_force, i++, "Power");
  23. button_panel_add_item(
  24. button_panel,
  25. i,
  26. 1,
  27. 0,
  28. 36,
  29. 11,
  30. &I_Mute_25x27,
  31. &I_Mute_hvr_25x27,
  32. infrared_scene_universal_common_item_callback,
  33. context);
  34. infrared_brute_force_add_record(brute_force, i++, "Mute");
  35. button_panel_add_item(
  36. button_panel,
  37. i,
  38. 0,
  39. 1,
  40. 3,
  41. 41,
  42. &I_Play_25x27,
  43. &I_Play_hvr_25x27,
  44. infrared_scene_universal_common_item_callback,
  45. context);
  46. infrared_brute_force_add_record(brute_force, i++, "Play");
  47. button_panel_add_item(
  48. button_panel,
  49. i,
  50. 1,
  51. 1,
  52. 36,
  53. 41,
  54. &I_Pause_25x27,
  55. &I_Pause_hvr_25x27,
  56. infrared_scene_universal_common_item_callback,
  57. context);
  58. infrared_brute_force_add_record(brute_force, i++, "Pause");
  59. button_panel_add_item(
  60. button_panel,
  61. i,
  62. 0,
  63. 2,
  64. 3,
  65. 71,
  66. &I_TrackPrev_25x27,
  67. &I_TrackPrev_hvr_25x27,
  68. infrared_scene_universal_common_item_callback,
  69. context);
  70. infrared_brute_force_add_record(brute_force, i++, "Prev");
  71. button_panel_add_item(
  72. button_panel,
  73. i,
  74. 1,
  75. 2,
  76. 36,
  77. 71,
  78. &I_TrackNext_25x27,
  79. &I_TrackNext_hvr_25x27,
  80. infrared_scene_universal_common_item_callback,
  81. context);
  82. infrared_brute_force_add_record(brute_force, i++, "Next");
  83. button_panel_add_item(
  84. button_panel,
  85. i,
  86. 0,
  87. 3,
  88. 3,
  89. 101,
  90. &I_Vol_down_25x27,
  91. &I_Vol_down_hvr_25x27,
  92. infrared_scene_universal_common_item_callback,
  93. context);
  94. infrared_brute_force_add_record(brute_force, i++, "Vol_dn");
  95. button_panel_add_item(
  96. button_panel,
  97. i,
  98. 1,
  99. 3,
  100. 36,
  101. 101,
  102. &I_Vol_up_25x27,
  103. &I_Vol_up_hvr_25x27,
  104. infrared_scene_universal_common_item_callback,
  105. context);
  106. infrared_brute_force_add_record(brute_force, i++, "Vol_up");
  107. button_panel_add_label(button_panel, 1, 8, FontPrimary, "Mus. remote");
  108. view_set_orientation(view_stack_get_view(infrared->view_stack), ViewOrientationVertical);
  109. view_dispatcher_switch_to_view(infrared->view_dispatcher, InfraredViewStack);
  110. infrared_show_loading_popup(infrared, true);
  111. bool success = infrared_brute_force_calculate_messages(brute_force);
  112. infrared_show_loading_popup(infrared, false);
  113. if(!success) {
  114. scene_manager_next_scene(infrared->scene_manager, InfraredSceneErrorDatabases);
  115. }
  116. }
  117. bool infrared_scene_universal_audio_on_event(void* context, SceneManagerEvent event) {
  118. return infrared_scene_universal_common_on_event(context, event);
  119. }
  120. void infrared_scene_universal_audio_on_exit(void* context) {
  121. infrared_scene_universal_common_on_exit(context);
  122. }