I detects a change in basically I am trying to call different songs whenever sensors movement. .. If any movement does not know the play song then 1. When the movement is detected then the lyrics of the song 2. Else if the movement again closes the song.
So far, I have been successful and where I now have the first two statements above, though, I can not take it back in 1 without singing myself without the music player. I .pause ();
, but it only takes a break for a second and plays itself again and again on song 1.
This is what I have done so far:
Sensor changed on public zero (from sensor event) {Float X = C property [0]; Boat y = se.values [1]; Float z = s.values [2]; MAccelLast = mAccelCurrent; MAccelCurrent = (float) Math.sqrt ((double) (x * x + y * y + z * z)); Float Delta = Mclecient - McClelst; Maize = mxcel * 0.9 f + delta; // low-cut filter mp1.start (); // song starts 1 if (macal> 5) {// movement mp2.start (); // start song2 if (mp2.isplaying ()) {// if the song 2 stop song is running 1 mp1.stop (); }}}}
Use 1 media player object, 2 of them not. By re-using the media player, you will ensure that only one sound is played at a time, while the use of system resources is reduced.
Create a new function that will stop the media player and then release it:
Prevent Private Zero () {if (mp! = Null) {mp. Stop (); Mp.release (); Mp = null; }}
Then add a function to recreate the media player with the new audio and start over.
No comments:
Post a Comment