Hi All,
I know this has been already talked about but I found no real solution to this issue and I am in need of pointers or directions to solve this.
on Android, the volume keys do not work at all.
I’ve read that implementing OnKeyPressed(const Osp::Ui::Control& source, Osp::Ui::KeyCode keyCode) is the possible solution, but that funcion is not available in CCApplication_android.h so I am not sure how to override such method…
// Create your audio engine
[[SimpleAudioEngine sharedEngine] playBackgroundMusic:@"music.mp3"];
// Create the slider
CCControlSlider *slider = [CCControlSlider sliderWithBackgroundFile:@"sliderTrack.png" progressFile:@"sliderProgress.png" thumbFile:@"sliderThumb.png"];
slider.minimumValue = 0.0f; // Sets the min value of range
slider.maximumValue = 1.0f; // Sets the max value of range
// When the value of the slider will change, the given selector will be call
[slider addTarget:self action:@selector(valueChanged:) forControlEvents:CCControlEventValueChanged];
[self addChild:slider];
//...
- (void)valueChanged:(CCControlSlider *)sender
{
// Change volume of your sounds
[[SimpleAudioEngine sharedEngine] setEffectsVolume:sender.value];
[[SimpleAudioEngine sharedEngine] setBackgroundMusicVolume:sender.value];
}