cutechicken commited on
Commit
b28fe0b
ยท
verified ยท
1 Parent(s): a212afa

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +38 -24
index.html CHANGED
@@ -579,58 +579,72 @@
579
  // ๊ฐ ๊ฒฝ๊ณ ์Œ ์ดˆ๊ธฐํ™”
580
  try {
581
  this.warningAudios.altitude = new Audio('sounds/altitude.ogg');
582
- this.warningAudios.altitude.loop = true;
583
- this.warningAudios.altitude.volume = 0.5;
584
 
585
  this.warningAudios.pullup = new Audio('sounds/pullup.ogg');
586
- this.warningAudios.pullup.loop = true;
587
- this.warningAudios.pullup.volume = 0.6;
588
 
589
  this.warningAudios.overg = new Audio('sounds/overg.ogg');
590
- this.warningAudios.overg.loop = true;
591
- this.warningAudios.overg.volume = 0.5;
592
 
593
  this.warningAudios.stall = new Audio('sounds/alert.ogg');
594
- this.warningAudios.stall.loop = true;
595
- this.warningAudios.stall.volume = 0.5;
 
 
 
 
 
 
 
 
 
596
  } catch (e) {
597
  console.log('Warning audio initialization failed:', e);
598
  }
599
  }
600
 
601
  updateWarningAudios() {
 
 
 
602
  // Pull up ๊ฒฝ๊ณ  (250m ์ดํ•˜) - ์ตœ์šฐ์„  ์ˆœ์œ„
603
  if (this.altitude < 250) {
604
- this.stopAllWarningAudios();
605
- this.playWarningAudio('pullup');
606
  }
607
  // Altitude ๊ฒฝ๊ณ  (250-500m)
608
  else if (this.altitude < 500) {
609
- this.stopAllWarningAudios();
610
- this.playWarningAudio('altitude');
611
  }
612
  // Over-G ๊ฒฝ๊ณ 
613
  else if (this.overG) {
614
- this.stopAllWarningAudios();
615
- this.playWarningAudio('overg');
616
  }
617
  // Stall ๊ฒฝ๊ณ 
618
  else if (this.stallWarning) {
619
- this.stopAllWarningAudios();
620
- this.playWarningAudio('stall');
621
  }
622
- // ๋ชจ๋“  ๊ฒฝ๊ณ  ํ•ด์ œ
623
- else {
624
- this.stopAllWarningAudios();
 
 
 
 
 
 
 
 
 
 
 
 
 
625
  }
626
  }
627
 
628
  playWarningAudio(type) {
629
- if (this.warningAudios[type] && this.warningAudios[type].paused) {
630
- this.warningAudios[type].play().catch(e => {
631
- // ์ž๋™ ์žฌ์ƒ ์ฐจ๋‹จ ์‹œ ๋ฌด์‹œ
632
- });
633
- }
634
  }
635
 
636
  stopAllWarningAudios() {
 
579
  // ๊ฐ ๊ฒฝ๊ณ ์Œ ์ดˆ๊ธฐํ™”
580
  try {
581
  this.warningAudios.altitude = new Audio('sounds/altitude.ogg');
582
+ this.warningAudios.altitude.volume = 0.75; // 150% ์Œ๋Ÿ‰ (0.5 * 1.5)
 
583
 
584
  this.warningAudios.pullup = new Audio('sounds/pullup.ogg');
585
+ this.warningAudios.pullup.volume = 0.9; // 150% ์Œ๋Ÿ‰ (0.6 * 1.5)
 
586
 
587
  this.warningAudios.overg = new Audio('sounds/overg.ogg');
588
+ this.warningAudios.overg.volume = 0.75; // 150% ์Œ๋Ÿ‰ (0.5 * 1.5)
 
589
 
590
  this.warningAudios.stall = new Audio('sounds/alert.ogg');
591
+ this.warningAudios.stall.volume = 0.75; // 150% ์Œ๋Ÿ‰ (0.5 * 1.5)
592
+
593
+ // ๊ฐ ์˜ค๋””์˜ค์— ended ์ด๋ฒคํŠธ ๋ฆฌ์Šค๋„ˆ ์ถ”๊ฐ€
594
+ Object.keys(this.warningAudios).forEach(key => {
595
+ if (this.warningAudios[key]) {
596
+ this.warningAudios[key].addEventListener('ended', () => {
597
+ // ์˜ค๋””์˜ค๊ฐ€ ๋๋‚ฌ์„ ๋•Œ ๋‹ค์‹œ ์žฌ์ƒ ์กฐ๊ฑด ์ฒดํฌ
598
+ this.updateWarningAudios();
599
+ });
600
+ }
601
+ });
602
  } catch (e) {
603
  console.log('Warning audio initialization failed:', e);
604
  }
605
  }
606
 
607
  updateWarningAudios() {
608
+ // ํ˜„์žฌ ์žฌ์ƒ ์ค‘์ธ ๊ฒฝ๊ณ ์Œ ์ถ”์ 
609
+ let currentWarning = null;
610
+
611
  // Pull up ๊ฒฝ๊ณ  (250m ์ดํ•˜) - ์ตœ์šฐ์„  ์ˆœ์œ„
612
  if (this.altitude < 250) {
613
+ currentWarning = 'pullup';
 
614
  }
615
  // Altitude ๊ฒฝ๊ณ  (250-500m)
616
  else if (this.altitude < 500) {
617
+ currentWarning = 'altitude';
 
618
  }
619
  // Over-G ๊ฒฝ๊ณ 
620
  else if (this.overG) {
621
+ currentWarning = 'overg';
 
622
  }
623
  // Stall ๊ฒฝ๊ณ 
624
  else if (this.stallWarning) {
625
+ currentWarning = 'stall';
 
626
  }
627
+
628
+ // ๋‹ค๋ฅธ ๊ฒฝ๊ณ ์Œ๋“ค ์ •์ง€
629
+ Object.keys(this.warningAudios).forEach(key => {
630
+ if (key !== currentWarning && this.warningAudios[key] && !this.warningAudios[key].paused) {
631
+ this.warningAudios[key].pause();
632
+ this.warningAudios[key].currentTime = 0;
633
+ }
634
+ });
635
+
636
+ // ํ˜„์žฌ ๊ฒฝ๊ณ ์Œ ์žฌ์ƒ (์žฌ์ƒ ์ค‘์ด ์•„๋‹ ๋•Œ๋งŒ)
637
+ if (currentWarning && this.warningAudios[currentWarning]) {
638
+ if (this.warningAudios[currentWarning].paused) {
639
+ this.warningAudios[currentWarning].play().catch(e => {
640
+ // ์ž๋™ ์žฌ์ƒ ์ฐจ๋‹จ ์‹œ ๋ฌด์‹œ
641
+ });
642
+ }
643
  }
644
  }
645
 
646
  playWarningAudio(type) {
647
+ // ์ด ํ•จ์ˆ˜๋Š” ๋” ์ด์ƒ ์‚ฌ์šฉํ•˜์ง€ ์•Š์Œ (updateWarningAudios์—์„œ ์ง์ ‘ ์ฒ˜๋ฆฌ)
 
 
 
 
648
  }
649
 
650
  stopAllWarningAudios() {