audio.html 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. <html>
  2. <head>
  3. <title>ArozOS Audio Test</title>
  4. <link rel="stylesheet" href="../../script/semantic/semantic.min.js">
  5. <script src="../../script/semantic/semantic.min.css"></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="ui container">
  30. <div class="ui basic segment">
  31. <div class="ui header">
  32. System Audio
  33. <div class="sub header">Test and adjust your global audio / volume settings</div>
  34. </div>
  35. </div>
  36. <div class="ui grid">
  37. <div class="five wide column selectable" align="center" onClick="PlaySound('left');"><i class="volume up huge icon flip"></i><br>Left Speaker</div>
  38. <div class="six wide column selectable" align="center" onClick="PlaySound('both');"><i class="computer huge icon"></i><br>Speaker Test</div>
  39. <div class="five wide column selectable" align="center" onClick="PlaySound('right');"><i class="volume up huge icon"></i><br>Right Speaker</div>
  40. </div>
  41. <br>
  42. <div class="ui segment">
  43. <h5>Master Volume</h5>
  44. <div class="ui slider">
  45. <input id="gblvol" min="0" max="100" type="range" value="0" style="width: 100%;">
  46. </div>
  47. <p>This Device Global Volume: <span id="numdis">0%</span></p>
  48. <small style="font-size:80%;">Some modules use stand-alone volume management system. Master volume may not be able to control all module's volume.</small>
  49. </div>
  50. <div style="display:none;">
  51. <audio id="both" controls><source src="../info/track/both.mp3" type="audio/mp3"></audio>
  52. <audio id="left" controls><source src="../info/track/left.mp3" type="audio/mp3"></audio>
  53. <audio id="right" controls><source src="../info/track/right.mp3" type="audio/mp3"></audio>
  54. </div>
  55. </div>
  56. <script>
  57. getGlobalVol();
  58. setInterval(getGlobalVol, 1000);
  59. function getGlobalVol() {
  60. var vol = localStorage.getItem("global_volume");
  61. if (vol == undefined || vol == "") {
  62. vol = 0;
  63. localStorage.setItem("global_volume", 0);
  64. }
  65. $("audio").prop("volume", parseFloat(vol));
  66. vol = parseFloat(vol) * 100; //Back to 0 - 100 scale
  67. vol = vol.toFixed(0);
  68. $("#gblvol").attr("value", vol);
  69. $("#numdis").html(vol + "%")
  70. }
  71. var b = document.getElementById("both");
  72. var l = document.getElementById("left");
  73. var r = document.getElementById("right");
  74. function PlaySound(keyword) {
  75. resetAllSoundTracks();
  76. if (keyword == "both") {
  77. b.play();
  78. } else if (keyword == "left") {
  79. l.play();
  80. } else {
  81. r.play();
  82. }
  83. }
  84. function resetAllSoundTracks() {
  85. b.pause();
  86. b.currentTime = 0;
  87. l.pause();
  88. l.currentTime = 0;
  89. r.pause();
  90. r.currentTime = 0;
  91. }
  92. $('input[type=range]').on('input', function() {
  93. $(this).trigger('change');
  94. var newval = ($(this).val());
  95. $("#numdis").html(newval + "%");
  96. newval = (newval / 100).toFixed(2);
  97. localStorage.setItem("global_volume", newval);
  98. });
  99. </script>
  100. </body>
  101. </html>