int count = 0;
if (action_sound.isPlaying()) {
//startVol();
a[count] = RPM_value;
int vol = a[5] / 500;
if (count == 5) {
if (a[0] > a[5]) {
volDown(vol);
} else if (a[0] < a[5]) {
volUp(vol);
}
count = 0;
}
} else if (base_sound.isPlaying()) {
stopVol();
}
}
private void stopVol() {
int currVol = audioManager.getStreamVolume(AudioManager.STREAM_MUSIC);
currVol = (currVol * 0) + 6;
audioManager.setStreamVolume(AudioManager.STREAM_MUSIC, currVol,
AudioManager.FLAG_PLAY_SOUND);
}
private void volUp(int vol) {
int currVol = audioManager.getStreamVolume(AudioManager.STREAM_MUSIC);
currVol = currVol + vol;
audioManager.setStreamVolume(AudioManager.STREAM_MUSIC, currVol,
AudioManager.FLAG_PLAY_SOUND);
}
private void volDown(int vol) {
int currVol = audioManager.getStreamVolume(AudioManager.STREAM_MUSIC);
currVol = currVol - vol;
audioManager.setStreamVolume(AudioManager.STREAM_MUSIC, currVol,
AudioManager.FLAG_PLAY_SOUND);
}
Handle{
if (RPM_value > 850) {
base_sound.pause();
action_sound.start();
} else {
action_sound.pause();
base_sound.start();
}
}
RPM이 증가 할 때 볼륨 증가, 감소 하면 볼륨 감소 하는 것을 하려고 합니다.
일단 위의 소스 처럼 배열을 이용해서 값을 비교 하는 것을 하는데 사운드가 나오지 않습니다. 무엇이 문제인지....
문제점이나 다른 좋은 방법이 있는지 알려주시면 감사하겠습니다 ㅜㅜ