Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

All sound is permanently disabled after receiving phone call. #166

Closed
SDLBugzilla opened this issue Feb 11, 2021 · 0 comments
Closed

All sound is permanently disabled after receiving phone call. #166

SDLBugzilla opened this issue Feb 11, 2021 · 0 comments

Comments

@SDLBugzilla
Copy link
Collaborator

This bug report was migrated from our old Bugzilla tracker.

Reported in version: 2.0.0
Reported for operating system, platform: iOS (All), iPhone/iPod touch

Comments on the original bug report:

On 2014-06-03 15:52:50 +0000, Diego wrote:

When music or channels are playing sound and a phone call is received, all sound is then permanently disabled. An app restart is required to restart the sound (or maybe just a Mix_CloseAudio and Mix_OpenAudio, this was untested).
The error is reproduced when a phone call is received while running the following code on an iPhone 4S running iOS 7.1.1 and an iPhone 5C running 7.0.4.

////CODE
#include "SDL.h"
#include "SDL_mixer.h"

#define SCREEN_WIDTH 320
#define SCREEN_HEIGHT 480

int main(int argc, char *argv[]) {

SDL_Window *window;
SDL_Renderer *renderer;
int done;
SDL_Event event;

if (SDL_Init(SDL_INIT_VIDEO) < 0) {
    printf("Could not initialize SDL\n");
    return 1;
}

if (Mix_OpenAudio(44100, MIX_DEFAULT_FORMAT, 2, 4096) < 0)
    printf("Unable to init audio: %s\n", Mix_GetError());

Mix_Music *music = Mix_LoadMUS("music.wav");

window = SDL_CreateWindow(NULL, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, SDL_WINDOW_OPENGL);
renderer = SDL_CreateRenderer(window, -1, 0);

done = 0;
while (!done) {
    while (SDL_PollEvent(&event)) {
        if (event.type == SDL_QUIT) {
            done = 1;
        }
    }
    
    SDL_SetRenderDrawColor(renderer, 0, 0, 0, 255);
    SDL_RenderClear(renderer);
    SDL_RenderPresent(renderer);
    
    Mix_PlayMusic(music,0);
    SDL_Delay(3000);

}

SDL_Quit();

return 0;

}

On 2015-02-21 23:30:17 +0000, Diego wrote:

A Mix_CloseAudio and Mix_OpenAudio does allow the sound to restart.

On 2016-09-18 22:22:53 +0000, Alex Szpakowski wrote:

This should be fixed as of https://hg.libsdl.org/SDL/rev/e9c3e64fdc84

On 2016-11-30 19:12:24 +0000, Diego wrote:

Works great! Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant