W
W
wolf-98302014-03-11 16:58:08
Android
wolf-9830, 2014-03-11 16:58:08

Why don't volume keys work in android app?

Hello, dear users of the site toster.ru. I have a question for you. Why don't volume buttons work for me in my android app using SDL_Mixer (and C++ native)?
The buttons are working, because. in the "Music" menu, they adjust the volume. It's the same on the phone. I hope for your help.
The code is very simple:
#include "SDL.h"
#include "SDL_image.h"
#include "SDL_mixer.h"
#include "SDL_ttf.h"
#include
#define LOG(...) __android_log_print(ANDROID_LOG_DEBUG, "sdldemo", __VA_ARGS__)
SDL_Window *window;
SDL_Renderer *render;
Mix_Music *mus;
int SDL_main(int argv,
window = SDL_CreateWindow("program",SDL_WINDOWPOS_CENTERED,SDL_WINDOWPOS_CENTERED,800,600,SDL_WINDOW_SHOWN);
render = SDL_CreateRenderer(window,-1,SDL_RENDERER_PRESENTVSYNC |SDL_RENDERER_ACCELERATED);
SDL_Event _event;
bool program_run = true;
Mix_OpenAudio(22050,MIX_DEFAULT_FORMAT,2,4096);
mus = Mix_LoadMUS("data/music.ogg");
Mix_PlayMusic(mus,0);
while(program_run)
{
while(SDL_PollEvent(&_event))
{
if(_event.key.keysym.scancode == SDL_SCANCODE_AC_BACK)
{
program_run = false;
}
}
SDL_RenderClear(render);
SDL_RenderPresent(render);
}
SDL_DestroyRenderer(render);
SDL_DestroyWindow(window);
SDL_Quit();
}

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question