Selaa lähdekoodia

test 360 audio

Sanjay Govind 10 kuukautta sitten
vanhempi
commit
49919b6a5e
3 muutettua tiedostoa jossa 9 lisäystä ja 4 poistoa
  1. 2 2
      scenes/pof_scene_type_select.c
  2. 6 2
      virtual_portal.c
  3. 1 0
      virtual_portal.h

+ 2 - 2
scenes/pof_scene_type_select.c

@@ -36,12 +36,12 @@ bool pof_scene_type_select_on_event(void* context, SceneManagerEvent event) {
     PoFApp* pof = context;
     if(event.type == SceneManagerEventTypeCustom) {
         if (event.event == SubmenuIndexSwapHid) {
-            pof->virtual_portal->type = PoFHid;
+            virtual_portal_set_type(pof->virtual_portal, PoFHid);
             pof_start(pof);
             scene_manager_next_scene(pof->scene_manager, PoFSceneMain);
             return true;
         } else if (event.event == SubmenuIndexSwapXbox360) {
-            pof->virtual_portal->type = PoFXbox360;
+            virtual_portal_set_type(pof->virtual_portal, PoFXbox360);
             pof_start(pof);
             scene_manager_next_scene(pof->scene_manager, PoFSceneMain);
             return true;

+ 6 - 2
virtual_portal.c

@@ -215,6 +215,12 @@ VirtualPortal* virtual_portal_alloc(NotificationApp* notifications) {
     virtual_portal->end = &virtual_portal->current_audio_buffer[SAMPLES_COUNT_BUFFERED];
 
     furi_timer_start(virtual_portal->led_timer, 10);
+
+    return virtual_portal;
+}
+
+void virtual_portal_set_type(VirtualPortal* virtual_portal, PoFType type) {
+    virtual_portal->type = type;
     if (furi_hal_speaker_acquire(1000)) {
         wav_player_speaker_init(virtual_portal->type == PoFHid ? 8000 : 4000);
         wav_player_dma_init((uint32_t)virtual_portal->audio_buffer, SAMPLES_COUNT);
@@ -224,8 +230,6 @@ VirtualPortal* virtual_portal_alloc(NotificationApp* notifications) {
         wav_player_speaker_start();
         wav_player_dma_start();
     }
-
-    return virtual_portal;
 }
 
 void virtual_portal_cleanup(VirtualPortal* virtual_portal) {

+ 1 - 0
virtual_portal.h

@@ -70,6 +70,7 @@ typedef struct {
 } VirtualPortal;
 
 VirtualPortal* virtual_portal_alloc(NotificationApp* notifications);
+void virtual_portal_set_type(VirtualPortal* virtual_portal, PoFType type);
 
 void virtual_portal_free(VirtualPortal* virtual_portal);
 void virtual_portal_cleanup(VirtualPortal* virtual_portal);