Add slider to change volume
Add mute button
This commit is contained in:
parent
7635093679
commit
b05da52ade
@ -72,7 +72,7 @@
|
|||||||
<!-- add canvas here by javascript -->
|
<!-- add canvas here by javascript -->
|
||||||
</div>
|
</div>
|
||||||
<div id="openwebrx-panels-container">
|
<div id="openwebrx-panels-container">
|
||||||
<div class="openwebrx-panel" id="openwebrx-panel-receiver" data-panel-name="client-params" data-panel-pos="right" data-panel-order="0" data-panel-size="215,70">
|
<div class="openwebrx-panel" id="openwebrx-panel-receiver" data-panel-name="client-params" data-panel-pos="right" data-panel-order="0" data-panel-size="215,115">
|
||||||
<div id="webrx-actual-freq">---.--- MHz</div>
|
<div id="webrx-actual-freq">---.--- MHz</div>
|
||||||
<div id="webrx-mouse-freq">---.--- MHz</div>
|
<div id="webrx-mouse-freq">---.--- MHz</div>
|
||||||
<!--<div class="openwebrx-button" onclick="ws.send('SET mod=wfm');" >WFM</div>-->
|
<!--<div class="openwebrx-button" onclick="ws.send('SET mod=wfm');" >WFM</div>-->
|
||||||
@ -81,7 +81,14 @@
|
|||||||
<div class="openwebrx-button" onclick="demodulator_analog_replace('lsb');">LSB</div>
|
<div class="openwebrx-button" onclick="demodulator_analog_replace('lsb');">LSB</div>
|
||||||
<div class="openwebrx-button" onclick="demodulator_analog_replace('usb');">USB</div>
|
<div class="openwebrx-button" onclick="demodulator_analog_replace('usb');">USB</div>
|
||||||
<div class="openwebrx-button" onclick="demodulator_analog_replace('cw');">CW</div>
|
<div class="openwebrx-button" onclick="demodulator_analog_replace('cw');">CW</div>
|
||||||
|
|
||||||
|
<span>Volume:</span>
|
||||||
|
<input id="openwebrx-panel-volume" type="range" min="0" max="150" value="50" step="1" onchange="updateVolume()" oninput="updateVolume()">
|
||||||
|
|
||||||
|
<div id="openwebrx-mute-off" class="openwebrx-button" onclick="toggleMute()">Mute</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="openwebrx-panel" id="openwebrx-panel-log" data-panel-name="debug" data-panel-pos="left" data-panel-order="1" data-panel-size="619,142">
|
<div class="openwebrx-panel" id="openwebrx-panel-log" data-panel-name="debug" data-panel-pos="left" data-panel-order="1" data-panel-size="619,142">
|
||||||
<div class="openwebrx-panel-inner" id="openwebrx-log-scroll">
|
<div class="openwebrx-panel-inner" id="openwebrx-log-scroll">
|
||||||
<div id="openwebrx-client-log-title">OpenWebRX (beta) client log<span style="color: #ff5900;"></span> </strong><span id="openwebrx-problems"></span></div>
|
<div id="openwebrx-client-log-title">OpenWebRX (beta) client log<span style="color: #ff5900;"></span> </strong><span id="openwebrx-problems"></span></div>
|
||||||
|
@ -28,6 +28,11 @@ html, body
|
|||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
input
|
||||||
|
{
|
||||||
|
vertical-align:middle;
|
||||||
|
}
|
||||||
|
|
||||||
#webrx-top-container
|
#webrx-top-container
|
||||||
{
|
{
|
||||||
position: relative;
|
position: relative;
|
||||||
@ -539,3 +544,13 @@ html, body
|
|||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#openwebrx-mute-on
|
||||||
|
{
|
||||||
|
color: lime;
|
||||||
|
}
|
||||||
|
|
||||||
|
#openwebrx-mute-off
|
||||||
|
{
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
@ -118,6 +118,31 @@ function style_value(of_what,which)
|
|||||||
else if (window.getComputedStyle) return document.defaultView.getComputedStyle(of_what,null).getPropertyValue(which);
|
else if (window.getComputedStyle) return document.defaultView.getComputedStyle(of_what,null).getPropertyValue(which);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function setVolume(str)
|
||||||
|
{
|
||||||
|
volume = mute ? 0 : parseFloat(str)/100;
|
||||||
|
}
|
||||||
|
|
||||||
|
function updateVolume()
|
||||||
|
{
|
||||||
|
setVolume(e("openwebrx-panel-volume").value);
|
||||||
|
}
|
||||||
|
|
||||||
|
function toggleMute()
|
||||||
|
{
|
||||||
|
if (mute) {
|
||||||
|
mute = false;
|
||||||
|
e("openwebrx-mute-on").id="openwebrx-mute-off";
|
||||||
|
} else {
|
||||||
|
mute = true;
|
||||||
|
e("openwebrx-mute-off").id="openwebrx-mute-on"
|
||||||
|
}
|
||||||
|
|
||||||
|
updateVolume();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// ========================================================
|
// ========================================================
|
||||||
// ================= ANIMATION ROUTINES =================
|
// ================= ANIMATION ROUTINES =================
|
||||||
// ========================================================
|
// ========================================================
|
||||||
@ -1119,6 +1144,8 @@ function divlog(what, is_error)
|
|||||||
|
|
||||||
var audio_context;
|
var audio_context;
|
||||||
var audio_initialized=0;
|
var audio_initialized=0;
|
||||||
|
var volume;
|
||||||
|
var mute = false;
|
||||||
|
|
||||||
var audio_received = Array();
|
var audio_received = Array();
|
||||||
var audio_buffer_index = 0;
|
var audio_buffer_index = 0;
|
||||||
@ -1156,9 +1183,9 @@ function audio_prepare(data)
|
|||||||
//audio_rebuffer.push(sdrjs.ConvertI16_F(data));//no resampling
|
//audio_rebuffer.push(sdrjs.ConvertI16_F(data));//no resampling
|
||||||
//audio_rebuffer.push(audio_resampler.process(sdrjs.ConvertI16_F(data)));//resampling without ADPCM
|
//audio_rebuffer.push(audio_resampler.process(sdrjs.ConvertI16_F(data)));//resampling without ADPCM
|
||||||
if(audio_compression=="none")
|
if(audio_compression=="none")
|
||||||
audio_rebuffer.push(audio_resampler.process(gain_ff(0.9,sdrjs.ConvertI16_F(data))));//resampling without ADPCM
|
audio_rebuffer.push(audio_resampler.process(gain_ff(volume,sdrjs.ConvertI16_F(data))));//resampling without ADPCM
|
||||||
else if(audio_compression=="adpcm")
|
else if(audio_compression=="adpcm")
|
||||||
audio_rebuffer.push(audio_resampler.process(gain_ff(0.9,sdrjs.ConvertI16_F(audio_codec.decode(data))))); //resampling & ADPCM
|
audio_rebuffer.push(audio_resampler.process(gain_ff(volume,sdrjs.ConvertI16_F(audio_codec.decode(data))))); //resampling & ADPCM
|
||||||
else return;
|
else return;
|
||||||
|
|
||||||
//console.log("prepare",data.length,audio_rebuffer.remaining());
|
//console.log("prepare",data.length,audio_rebuffer.remaining());
|
||||||
@ -1699,6 +1726,9 @@ function openwebrx_init()
|
|||||||
window.setTimeout(function(){window.setInterval(debug_audio,1000);},1000);
|
window.setTimeout(function(){window.setInterval(debug_audio,1000);},1000);
|
||||||
window.addEventListener("resize",openwebrx_resize);
|
window.addEventListener("resize",openwebrx_resize);
|
||||||
check_top_bar_congestion();
|
check_top_bar_congestion();
|
||||||
|
|
||||||
|
//Synchronise volume with slider
|
||||||
|
updateVolume();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
Reference in New Issue
Block a user