test/testmultiaudio.c
changeset 9269 d51f84c20b10
parent 9145 aa99e029b12e
child 9278 8900afb78a19
equal deleted inserted replaced
9268:7f2833a2191b 9269:d51f84c20b10
    52     int i;
    52     int i;
    53     
    53     
    54 #ifdef __ANDROID__  
    54 #ifdef __ANDROID__  
    55     SDL_Event event;
    55     SDL_Event event;
    56   
    56   
       
    57     /* Create a Window to get fully initialized event processing for testing pause on Android. */
    57     SDL_CreateWindow("testmultiaudio", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, 320, 240, 0);
    58     SDL_CreateWindow("testmultiaudio", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, 320, 240, 0);
    58 #endif
    59 #endif
    59 
    60 
    60     if (devcount > 64) {
    61     if (devcount > 64) {
    61         SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Too many devices (%d), clamping to 64...\n",
    62         SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Too many devices (%d), clamping to 64...\n",
    77             SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Open device failed: %s\n", SDL_GetError());
    78             SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Open device failed: %s\n", SDL_GetError());
    78         } else {
    79         } else {
    79             SDL_PauseAudioDevice(cbd[0].dev, 0);
    80             SDL_PauseAudioDevice(cbd[0].dev, 0);
    80             while (!cbd[0].done) {
    81             while (!cbd[0].done) {
    81 #ifdef __ANDROID__                
    82 #ifdef __ANDROID__                
       
    83                 /* Empty queue, some application events would prevent pause. */
    82                 while (SDL_PollEvent(&event)){}
    84                 while (SDL_PollEvent(&event)){}
    83 #endif                
    85 #endif                
    84                 SDL_Delay(100);
    86                 SDL_Delay(100);
    85             }
    87             }
    86             SDL_PauseAudioDevice(cbd[0].dev, 1);
    88             SDL_PauseAudioDevice(cbd[0].dev, 1);
   113             if ((cbd[i].dev) && (!cbd[i].done)) {
   115             if ((cbd[i].dev) && (!cbd[i].done)) {
   114                 keep_going = 1;
   116                 keep_going = 1;
   115             }
   117             }
   116         }
   118         }
   117 #ifdef __ANDROID__        
   119 #ifdef __ANDROID__        
       
   120         /* Empty queue, some application events would prevent pause. */
   118         while (SDL_PollEvent(&event)){}
   121         while (SDL_PollEvent(&event)){}
   119 #endif        
   122 #endif        
   120         SDL_Delay(100);
   123         SDL_Delay(100);
   121     }
   124     }
   122 
   125