Вот продолжения кода
decades = absNumber % 100;
hundreds = absNumber - decades;
soundHowl = new Howl({
src: [`${voiceUrl}${hundreds}_.mp3`],
});
soundHowl.play();
decadesDuration = parseInt(soundHowl.duration() * 1000);
setTimeout(function () {
soundHowl = new Howl({
src: [`${voiceUrl}${decades}.mp3`],
});
soundHowl.play();
}, decadesDuration - 20)
}
}
} else {
if (absNumber <= 10) {
soundHowl = new Howl({
src: [`6d64cbf7b17425e.mp3`],
});
soundHowl.play();
} else {
if (sound.indexOf('+') !== -1) {
soundHowl = new Howl({
src: [`6d64cbf7b17425e.mp3`],
});
soundHowl.play();
setTimeout(function () {
filename = sound.replace("+", "").replace("-", "");
soundHowl = new Howl({
src: [`6d64cbf7b17425e.mp3`],
});
soundHowl.play();
}, sound_interval)
} else if (sound.indexOf('-') !== -1) {
soundHowl = new Howl({
src: [`6d64cbf7b17425e.mp3`],
});
soundHowl.play();
setTimeout(function () {
filename = sound.replace("+", "").replace("-", "");
soundHowl = new Howl({
src: [`6d64cbf7b17425e.mp3`],
});
soundHowl.play();
}, sound_interval)
} else {
filename = sound.replace("+", "").replace("-", "");
soundHowl = new Howl({
src: [`6d64cbf7b17425e.mp3`],
});
soundHowl.play();
}
}
}
} else {
soundHowl = new Howl({
src: [`/static/games_audio/new/numbers/ru3/${filename}.mp3`],
});
soundHowl.play();
}
break;
}
}
function soundNumber(example, numSummand) {
const maxIntervalToVoiceNumber1 = 0.6;
const maxIntervalToVoiceNumber2 = 1;
const maxIntervalToVoiceNumber3 = 1.4;
var voiceMethodic = $("#voice_methodic").val();
summand = example[numSummand];
var newVoice = true;
if (lang === 'ru') {
newVoice = false
}
for (var el of example) {
if (Math.abs(el) > 100) {
newVoice = true;
break;
}
}
var isDecimal = false;
if (Math.round(summand) !== summand) {
isDecimal = true;
}
var soundEnabled = GLOBAL_STATE.voice
&& GLOBAL_STATE.screens_nmb === 1
&& !exist_in_array("disorder", GLOBAL_STATE.modes)
&& GLOBAL_STATE[1].parameters.digits_nmb <= 3
&& !isDecimal;
if ((GLOBAL_STATE[1].parameters.digits_nmb === 1 && GLOBAL_STATE[1].parameters.interval < maxIntervalToVoiceNumber1)
||
(GLOBAL_STATE[1].parameters.digits_nmb === 2 && GLOBAL_STATE[1].parameters.interval < maxIntervalToVoiceNumber2)
||
(GLOBAL_STATE[1].parameters.digits_nmb === 3 && GLOBAL_STATE[1].parameters.interval < maxIntervalToVoiceNumber3)
) {
soundEnabled = false
}
if (!soundEnabled) {
playSound('click')
} else {
if (voiceMethodic === 'voice_sign_on_change') {
if (numSummand === 0) {
playSound(summand.toString(), 0, newVoice)
} else if (numSummand === 1) {
if (summand > 0) {
playSound(`+${summand}`, 0, newVoice)
} else {
playSound(`${summand}`, 0, newVoice)
}
} else {
if (example[numSummand - 1] * summand > 0) {
playSound(Math.abs(summand).toString(), 0, newVoice)
} else {
if (summand > 0) {
playSound(`+${summand}`, 0, newVoice)
} else {
playSound(`${summand}`, 0, newVoice)
}
}
}
} else if (voiceMethodic === 'voice_just_minus') {
if (summand > 0) {
playSound(`${summand}`, 0, newVoice)
} else {
playSound(`${summand}`, 0, newVoice)
}
} else {
if (summand > 0) {
playSound(`+${summand}`, 0, newVoice)
} else {
playSound(`${summand}`, 0, newVoice)
}
}
}
}
[/JS]
помогите пожплуйста
|