audio.html 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. <html>
  2. <head>
  3. <title>ArOZ Online Audio Tools</title>
  4. <link rel="stylesheet" href="../../../script/tocas/tocas.css">
  5. <script src="../../../script/tocas/tocas.js"></script>
  6. <script src="../../../script/jquery.min.js"></script>
  7. <!--<script src="ao_module.js"></script> DOES NOT EXIST IN GOLANG VERSION-->
  8. <style>
  9. .flip {
  10. -moz-transform: scale(-1, 1);
  11. -webkit-transform: scale(-1, 1);
  12. -o-transform: scale(-1, 1);
  13. -ms-transform: scale(-1, 1);
  14. transform: scale(-1, 1);
  15. }
  16. .selectable {
  17. padding: 15px !important;
  18. border: 1px solid transparent;
  19. border-radius: 10px;
  20. }
  21. .selectable:hover {
  22. border: 1px solid #839ff5;
  23. background-color: #ccd9ff;
  24. cursor: pointer;
  25. }
  26. </style>
  27. </head>
  28. <body>
  29. <div class="ts container">
  30. <div class="ts segment" align="center">
  31. <p>System Audio Settings</p>
  32. </div>
  33. <div class="ts grid">
  34. <div class="five wide column selectable" align="center" onClick="PlaySound('left');"><i class="volume up huge icon flip"></i><br>Left Speaker</div>
  35. <div class="six wide column selectable" align="center" onClick="PlaySound('both');"><i class="computer huge icon"></i><br>Speaker Test</div>
  36. <div class="five wide column selectable" align="center" onClick="PlaySound('right');"><i class="volume up huge icon"></i><br>Right Speaker</div>
  37. </div>
  38. <br>
  39. <div class="ts segment">
  40. <div class="ts horizontal divider">Master Volume</div>
  41. <div class="ts slider">
  42. <input id="gblvol" min="0" max="100" type="range" value="0">
  43. <div id="numdis" class="ts basic left pointing label">0%</div>
  44. </div>
  45. <small style="font-size:70%;">Some modules use stand-alone volume management system. Master volume may not be able to control all module's volume.</small>
  46. </div>
  47. <div style="display:none;">
  48. <audio id="both" controls><source src="../info/track/both.mp3" type="audio/mp3"></audio>
  49. <audio id="left" controls><source src="../info/track/left.mp3" type="audio/mp3"></audio>
  50. <audio id="right" controls><source src="../info/track/right.mp3" type="audio/mp3"></audio>
  51. </div>
  52. </div>
  53. <script>
  54. getGlobalVol();
  55. setInterval(getGlobalVol, 1000);
  56. function getGlobalVol() {
  57. var vol = localStorage.getItem("global_volume");
  58. if (vol == undefined || vol == "") {
  59. vol = 0;
  60. localStorage.setItem("global_volume", 0);
  61. }
  62. $("audio").prop("volume", parseFloat(vol));
  63. vol = parseFloat(vol) * 100; //Back to 0 - 100 scale
  64. vol = vol.toFixed(0);
  65. $("#gblvol").attr("value", vol);
  66. $("#numdis").html(vol + "%")
  67. }
  68. var b = document.getElementById("both");
  69. var l = document.getElementById("left");
  70. var r = document.getElementById("right");
  71. function PlaySound(keyword) {
  72. resetAllSoundTracks();
  73. if (keyword == "both") {
  74. b.play();
  75. } else if (keyword == "left") {
  76. l.play();
  77. } else {
  78. r.play();
  79. }
  80. }
  81. function resetAllSoundTracks() {
  82. b.pause();
  83. b.currentTime = 0;
  84. l.pause();
  85. l.currentTime = 0;
  86. r.pause();
  87. r.currentTime = 0;
  88. }
  89. $('input[type=range]').on('input', function() {
  90. $(this).trigger('change');
  91. var newval = ($(this).val());
  92. $("#numdis").html(newval + "%");
  93. newval = (newval / 100).toFixed(2);
  94. localStorage.setItem("global_volume", newval);
  95. });
  96. </script>
  97. </body>
  98. </html>