android - AndEngine : Music isn't working properly -
i'm using following code in onscenetouchevent
:
if(audiocontrolbutton.contains(pscenetouchevent.getx(), pscenetouchevent.gety()) && pscenetouchevent.getaction() == touchevent.action_down) { togglevolume(); }
and works fine, method invoking when has to. togglevolume()
has implementation :
if(levelmusic.getvolume() != 0f) { levelmusic.setvolume(0f); } else { levelmusic.setvolume(100f); }
all of condition seems work, issue comes here: if levelmusic.setvolume(0f) ivoked music volume disables should be, if levelmusic.setvolume(100f) invokes still can't hear music
note : i've tried pause()
, resume()
, it's not working well
my levelmusic variable:
music levelmusic; //field in scene class levelmusic = data.getlevelmusic(); levelmusic.play();
in onresourcesloadingfinished
edit : i've tried set value 60 instead of 100 , 0,9f(if max malue 1f), it's not working too
if have problem :
use levelmusic.setvolume(0.0f, 0.0f); // 0f wont work
so, whole method should looking this:
if(levelmusic.getvolume() != 0.0f) { levelmusic.setvolume(0.0f, 0.0f); } else { levelmusic.setvolume(1f); }
Comments
Post a Comment