Selaa lähdekoodia

Update weapons, start auditing audio

The bullets have been improved. Also, file structure for weapons is
being drafted.
feature/data-structs
TheoryOfNekomata 2 vuotta sitten
vanhempi
commit
f02e79d1c4
8 muutettua tiedostoa jossa 52 lisäystä ja 23 poistoa
  1. BIN
      assets/default/weapon-hitman/1-unload-var0.mp3
  2. BIN
      assets/default/weapon-hitman/1-unload-var1.mp3
  3. BIN
      assets/default/weapon-hitman/1-unload-var2.mp3
  4. BIN
      assets/default/weapon-paragon/1-unload-var (1).mp3
  5. BIN
      assets/default/weapon-paragon/1-unload-var (2).mp3
  6. BIN
      assets/default/weapon-paragon/1-unload-var (3).mp3
  7. BIN
      assets/gfx/weapons-rigged.cdr
  8. +52
    -23
      tools/audio-interval-test/index.js

BIN
assets/default/weapon-hitman/1-unload-var0.mp3 Näytä tiedosto


BIN
assets/default/weapon-hitman/1-unload-var1.mp3 Näytä tiedosto


BIN
assets/default/weapon-hitman/1-unload-var2.mp3 Näytä tiedosto


BIN
assets/default/weapon-paragon/1-unload-var (1).mp3 Näytä tiedosto


BIN
assets/default/weapon-paragon/1-unload-var (2).mp3 Näytä tiedosto


BIN
assets/default/weapon-paragon/1-unload-var (3).mp3 Näytä tiedosto


BIN
assets/gfx/weapons-rigged.cdr Näytä tiedosto


+ 52
- 23
tools/audio-interval-test/index.js Näytä tiedosto

@@ -7,6 +7,7 @@ function AudioForm(el) {
let audioIndex = 0
const items = 50

/*
for (let i = 0; i < items; i += 1) {
const newAudio = new Audio('./sfx/weapons/guns/smg-hkmp7/1_unload_var0.wav')
newAudio.volume = 0.2;
@@ -25,33 +26,61 @@ function AudioForm(el) {
}
newAudio.load()
}
*/
let started = false;
window.addEventListener('click', () => {
if (started) {
return;
}
started = true;
const audioContext = new AudioContext();

const playSound = () => {
for (let i = 0; i < items; i += 1) {
if (!audioPool[i].ready) {
return;
}
}
const gain = audioContext.createGain();
gain.gain.setValueAtTime(0, audioContext.currentTime);

audioPool[audioIndex].audio.play();
audioIndex = (audioIndex + 1) % items;
}
const oscillator = audioContext.createOscillator();

el.addEventListener('submit', (e) => {
e.preventDefault()

const ms = 60000 / Number(interval.value);
output.innerText = `${ms} ms`
if (play.checked) {
intervalHandle = window.setInterval(() => {
playSound()
}, ms)
} else {
window.clearInterval(intervalHandle);
}
oscillator.type = 'square';
oscillator.frequency.setValueAtTime(1000, audioContext.currentTime);
oscillator.start();

oscillator.connect(gain);
gain.connect(audioContext.destination);

const playSound = () => {
gain.gain.setValueAtTime(0.25, audioContext.currentTime);
setTimeout(() => {
gain.gain.setValueAtTime(0, audioContext.currentTime);
}, 10);
/*
for (let i = 0; i < items; i += 1) {
if (!audioPool[i].ready) {
return;
}
}

audioPool[audioIndex].audio.play();
audioIndex = (audioIndex + 1) % items;
*/
}

el.addEventListener('submit', (e) => {
e.preventDefault()

const ms = 60000 / Number(interval.value);
output.innerText = `${ms} ms`
if (play.checked) {
intervalHandle = window.setInterval(() => {
playSound()
}, ms)
} else {
gain.gain.setValueAtTime(0, audioContext.currentTime);
window.clearInterval(intervalHandle);
}

play.checked = !play.checked
})
play.checked = !play.checked
})
})
}

const audioForm = new AudioForm(window.document.getElementById('formAudio'))

Ladataan…
Peruuta
Tallenna