initialize demodulator with configured start values, fixes #9

This commit is contained in:
Jakob Ketterl 2019-10-03 00:36:26 +02:00
parent 7431e4d7c0
commit 6ae934e461

View File

@ -1197,7 +1197,7 @@ function on_ws_recv(evt)
waterfallColorsDefault(); waterfallColorsDefault();
window.starting_mod = config.start_mod window.starting_mod = config.start_mod
window.starting_offset_frequency = config.start_offset_frequency; window.starting_offset_frequency = config.start_offset_freq;
window.audio_buffering_fill_to = config.client_audio_buffer_size; window.audio_buffering_fill_to = config.client_audio_buffer_size;
bandwidth = config.samp_rate; bandwidth = config.samp_rate;
center_freq = config.center_freq + config.lfo_offset; center_freq = config.center_freq + config.lfo_offset;
@ -1217,7 +1217,13 @@ function on_ws_recv(evt)
audio_preinit(); audio_preinit();
loadLocalBookmarks(); loadLocalBookmarks();
if (audio_allowed && !audio_initialized) audio_init(); if (audio_allowed) {
if (audio_initialized) {
initialize_demodulator();
} else {
audio_init();
}
}
waterfall_clear(); waterfall_clear();
break; break;
case "secondary_config": case "secondary_config":
@ -2108,18 +2114,7 @@ function audio_init()
window.setInterval(audio_flush,audio_flush_interval_ms); window.setInterval(audio_flush,audio_flush_interval_ms);
divlog('Web Audio API succesfully initialized, sample rate: '+audio_context.sampleRate.toString()+ " sps"); divlog('Web Audio API succesfully initialized, sample rate: '+audio_context.sampleRate.toString()+ " sps");
/*audio_source=audio_context.createBufferSource(); initialize_demodulator();
audio_buffer = audio_context.createBuffer(xhr.response, false);
audio_source.buffer = buffer;
audio_source.noteOn(0);*/
demodulator_analog_replace(starting_mod);
if(starting_offset_frequency)
{
demodulators[0].offset_frequency = starting_offset_frequency;
e("webrx-actual-freq").innerHTML=format_frequency("{x} MHz",center_freq+starting_offset_frequency,1e6,4);
demodulators[0].set();
mkscale();
}
//hide log panel in a second (if user has not hidden it yet) //hide log panel in a second (if user has not hidden it yet)
window.setTimeout(function(){ window.setTimeout(function(){
@ -2133,6 +2128,17 @@ function audio_init()
} }
function initialize_demodulator() {
demodulator_analog_replace(starting_mod);
if(starting_offset_frequency)
{
demodulators[0].offset_frequency = starting_offset_frequency;
e("webrx-actual-freq").innerHTML=format_frequency("{x} MHz",center_freq+starting_offset_frequency,1e6,4);
demodulators[0].set();
mkscale();
}
}
var reconnect_timeout = false; var reconnect_timeout = false;
function on_ws_closed() function on_ws_closed()