SDL2TestApplicationMixer::SDL2TestApplicationMixer() : SDL2TestApplication(1, 1) , sample(NULL) , audio_resource(NULL) , mix_opened(false) { // Here, we declare a new audio resource that we want to later acquire - this is // a game, and every time the acquired value changes, on_audio_resource_acquired // will be called with "this" as user_data pointer. audio_resource = audioresource_init(AUDIO_RESOURCE_GAME, on_audio_resource_acquired, this); }
static int sailfish_init(int gles_version) { if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_JOYSTICK) < 0) { return 0; } SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, gles_version); SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16); priv.window = SDL_CreateWindow( "apkenv", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 0, 0, SDL_WINDOW_OPENGL|SDL_WINDOW_FULLSCREEN ); priv.glcontext = SDL_GL_CreateContext(priv.window); /* TODO: swipe lock? */ SDL_ShowCursor(0); apkenv_accelerometer_register(sdl_accelerometer); l_audioresource = audioresource_init(AUDIO_RESOURCE_MEDIA, on_audioresource_acquired, NULL); audioresource_acquire(l_audioresource); printf("Waiting for audioresource...\n"); while(!l_audioresource_acquired) { g_main_context_iteration(NULL, false); } apkenv_audio_register(sdl_audio); apkenv_mixer_register(sdl_mixer); return 1; }