Refactored demodulator panel a bit, added freq to recording names.
This commit is contained in:
parent
3b581f84e7
commit
8f5bf9df75
|
|
@ -334,7 +334,8 @@ AudioEngine.prototype.startRecording = function() {
|
||||||
if (!this.recording) {
|
if (!this.recording) {
|
||||||
var date = new Date(Date.now()).toISOString().slice(2,19)
|
var date = new Date(Date.now()).toISOString().slice(2,19)
|
||||||
.replaceAll('-','').replaceAll(':','').replaceAll('T','-');
|
.replaceAll('-','').replaceAll(':','').replaceAll('T','-');
|
||||||
this.mp3fileName = "REC-" + date + ".mp3";
|
var freq = Math.round(UI.getFrequency() / 1000);
|
||||||
|
this.mp3fileName = "REC-" + date + '-' + freq + ".mp3";
|
||||||
this.recording = true;
|
this.recording = true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,8 @@ function BookmarkBar() {
|
||||||
me.$container.find('.bookmark').removeClass('selected');
|
me.$container.find('.bookmark').removeClass('selected');
|
||||||
var b = $bookmark.data();
|
var b = $bookmark.data();
|
||||||
if (!b || !b.frequency || !b.modulation) return;
|
if (!b || !b.frequency || !b.modulation) return;
|
||||||
me.getDemodulator().set_offset_frequency(b.frequency - center_freq);
|
UI.setFrequency(b.frequency);
|
||||||
me.getDemodulatorPanel().setMode(b.modulation, b.underlying);
|
UI.setModulation(b.modulation, b.underlying);
|
||||||
$bookmark.addClass('selected');
|
$bookmark.addClass('selected');
|
||||||
stopScanner();
|
stopScanner();
|
||||||
});
|
});
|
||||||
|
|
@ -106,21 +106,16 @@ BookmarkBar.prototype.render = function(){
|
||||||
|
|
||||||
BookmarkBar.prototype.showEditDialog = function(bookmark) {
|
BookmarkBar.prototype.showEditDialog = function(bookmark) {
|
||||||
if (!bookmark) {
|
if (!bookmark) {
|
||||||
var mode1 = this.getDemodulator().get_secondary_demod()
|
var mode1 = UI.getModulation();
|
||||||
var mode2 = this.getDemodulator().get_modulation();
|
var mode2 = UI.getUnderlying();
|
||||||
if (!mode2) mode2 = '';
|
if (!!mode1 && !!mode2) {
|
||||||
if (!mode1) {
|
|
||||||
// if no secondary demod, use the primary one
|
|
||||||
mode1 = mode2;
|
|
||||||
mode2 = '';
|
|
||||||
} else {
|
|
||||||
// check for default underlying demod
|
// check for default underlying demod
|
||||||
var m = Modes.findByModulation(mode1);
|
var m = Modes.findByModulation(mode1);
|
||||||
if (m && m.underlying.indexOf(mode2) == 0) mode2 = '';
|
if (m && m.underlying.indexOf(mode2) == 0) mode2 = '';
|
||||||
}
|
}
|
||||||
bookmark = {
|
bookmark = {
|
||||||
name: '',
|
name: '',
|
||||||
frequency: center_freq + this.getDemodulator().get_offset_frequency(),
|
frequency: UI.getFrequency(),
|
||||||
modulation: mode1,
|
modulation: mode1,
|
||||||
underlying: mode2,
|
underlying: mode2,
|
||||||
description: '',
|
description: '',
|
||||||
|
|
@ -186,14 +181,6 @@ BookmarkBar.prototype.storeBookmark = function() {
|
||||||
me.$dialog.hide();
|
me.$dialog.hide();
|
||||||
};
|
};
|
||||||
|
|
||||||
BookmarkBar.prototype.getDemodulatorPanel = function() {
|
|
||||||
return $('#openwebrx-panel-receiver').demodulatorPanel();
|
|
||||||
};
|
|
||||||
|
|
||||||
BookmarkBar.prototype.getDemodulator = function() {
|
|
||||||
return this.getDemodulatorPanel().getDemodulator();
|
|
||||||
};
|
|
||||||
|
|
||||||
BookmarkBar.prototype.getAllBookmarks = function() {
|
BookmarkBar.prototype.getAllBookmarks = function() {
|
||||||
var sb = this.bookmarks['server'];
|
var sb = this.bookmarks['server'];
|
||||||
var lb = this.bookmarks['local'];
|
var lb = this.bookmarks['local'];
|
||||||
|
|
|
||||||
|
|
@ -585,7 +585,7 @@ function HdrMetaPanel(el) {
|
||||||
$select.hide();
|
$select.hide();
|
||||||
$select.on("change", function() {
|
$select.on("change", function() {
|
||||||
var id = parseInt($(this).val());
|
var id = parseInt($(this).val());
|
||||||
$('#openwebrx-panel-receiver').demodulatorPanel().getDemodulator().setAudioServiceId(id);
|
UI.getDemodulator().setAudioServiceId(id);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -639,7 +639,7 @@ function DabMetaPanel(el) {
|
||||||
this.$select = $('<select id="dab-service-id"></select>');
|
this.$select = $('<select id="dab-service-id"></select>');
|
||||||
this.$select.on("change", function() {
|
this.$select.on("change", function() {
|
||||||
me.service_id = parseInt($(this).val());
|
me.service_id = parseInt($(this).val());
|
||||||
$('#openwebrx-panel-receiver').demodulatorPanel().getDemodulator().setAudioServiceId(me.service_id);
|
UI.getDemodulator().setAudioServiceId(me.service_id);
|
||||||
});
|
});
|
||||||
var $container = $(
|
var $container = $(
|
||||||
'<div class="dab-container">' +
|
'<div class="dab-container">' +
|
||||||
|
|
|
||||||
|
|
@ -11,9 +11,8 @@ Scanner.prototype.tuneBookmark = function(b) {
|
||||||
//console.log("TUNE: " + b.name + " at " + b.frequency + ": " + b.modulation);
|
//console.log("TUNE: " + b.name + " at " + b.frequency + ": " + b.modulation);
|
||||||
|
|
||||||
// Tune to the bookmark frequency
|
// Tune to the bookmark frequency
|
||||||
var panel = $('#openwebrx-panel-receiver').demodulatorPanel();
|
UI.setFrequency(b.frequency);
|
||||||
panel.getDemodulator().set_offset_frequency(b.frequency - center_freq);
|
UI.setModulation(b.modulation, b.underlying);
|
||||||
panel.setMode(b.modulation, b.underlying);
|
|
||||||
|
|
||||||
// Done
|
// Done
|
||||||
return true;
|
return true;
|
||||||
|
|
|
||||||
|
|
@ -66,6 +66,50 @@ UI.loadSettings = function() {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//
|
||||||
|
// Frequency and Modulation Controls
|
||||||
|
//
|
||||||
|
|
||||||
|
UI.getDemodulatorPanel = function() {
|
||||||
|
return $('#openwebrx-panel-receiver').demodulatorPanel();
|
||||||
|
};
|
||||||
|
|
||||||
|
UI.getDemodulator = function() {
|
||||||
|
return this.getDemodulatorPanel().getDemodulator();
|
||||||
|
}
|
||||||
|
|
||||||
|
UI.getOffsetFrequency = function() {
|
||||||
|
return this.getDemodulator().get_offset_frequency();
|
||||||
|
};
|
||||||
|
|
||||||
|
UI.setOffsetFrequency = function(offset) {
|
||||||
|
return this.getDemodulator().set_offset_frequency(offset);
|
||||||
|
};
|
||||||
|
|
||||||
|
UI.getFrequency = function() {
|
||||||
|
return center_freq + this.getOffsetFrequency();
|
||||||
|
};
|
||||||
|
|
||||||
|
UI.setFrequency = function(freq) {
|
||||||
|
return this.setOffsetFrequency(freq - center_freq);
|
||||||
|
};
|
||||||
|
|
||||||
|
UI.getModulation = function() {
|
||||||
|
var mode1 = this.getDemodulator().get_secondary_demod();
|
||||||
|
var mode2 = this.getDemodulator().get_modulation();
|
||||||
|
return !!mode1? mode1 : !mode2? '' : mode2;
|
||||||
|
};
|
||||||
|
|
||||||
|
UI.getUnderlying = function() {
|
||||||
|
var mode1 = this.getDemodulator().get_secondary_demod();
|
||||||
|
var mode2 = this.getDemodulator().get_modulation();
|
||||||
|
return !mode1? '' : !mode2? '' : mode2;
|
||||||
|
};
|
||||||
|
|
||||||
|
UI.setModulation = function(mode, underlying) {
|
||||||
|
this.getDemodulatorPanel().setMode(mode, underlying);
|
||||||
|
};
|
||||||
|
|
||||||
//
|
//
|
||||||
// Volume Controls
|
// Volume Controls
|
||||||
//
|
//
|
||||||
|
|
|
||||||
|
|
@ -60,9 +60,7 @@ function zoomOutTotal() {
|
||||||
function tuneBySteps(steps) {
|
function tuneBySteps(steps) {
|
||||||
steps = Math.round(steps);
|
steps = Math.round(steps);
|
||||||
if (steps != 0) {
|
if (steps != 0) {
|
||||||
var demodulator = $('#openwebrx-panel-receiver').demodulatorPanel().getDemodulator();
|
UI.setOffsetFrequency(UI.getOffsetFrequency() + steps * tuning_step);
|
||||||
var f = demodulator.get_offset_frequency();
|
|
||||||
demodulator.set_offset_frequency(f + steps * tuning_step);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -76,8 +74,7 @@ function tuneBySquelch(dir) {
|
||||||
var squelch = $slider.val() - 13.0;
|
var squelch = $slider.val() - 13.0;
|
||||||
|
|
||||||
// Start from the current offset within the waterfall
|
// Start from the current offset within the waterfall
|
||||||
var demodulator = $('#openwebrx-panel-receiver').demodulatorPanel().getDemodulator();
|
var f = UI.getOffsetFreqency();
|
||||||
var f = demodulator.get_offset_frequency();
|
|
||||||
|
|
||||||
// Scan up or down the waterfall
|
// Scan up or down the waterfall
|
||||||
dir = tuning_step * (dir>=0? 1 : -1);
|
dir = tuning_step * (dir>=0? 1 : -1);
|
||||||
|
|
@ -86,7 +83,7 @@ function tuneBySquelch(dir) {
|
||||||
if (i < 0 || i >= wf_data.length) {
|
if (i < 0 || i >= wf_data.length) {
|
||||||
break;
|
break;
|
||||||
} else if (wf_data[i] >= squelch) {
|
} else if (wf_data[i] >= squelch) {
|
||||||
demodulator.set_offset_frequency(f);
|
UI.setOffsetFrequency(f);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -109,7 +106,7 @@ function monitorLevels(data) {
|
||||||
function jumpBySteps(steps) {
|
function jumpBySteps(steps) {
|
||||||
steps = Math.round(steps);
|
steps = Math.round(steps);
|
||||||
if (steps != 0) {
|
if (steps != 0) {
|
||||||
var key = $('#openwebrx-panel-receiver').demodulatorPanel().getMagicKey();
|
var key = UI.getDemodulatorPanel().getMagicKey();
|
||||||
var f = center_freq + steps * bandwidth / 4;
|
var f = center_freq + steps * bandwidth / 4;
|
||||||
ws.send(JSON.stringify({
|
ws.send(JSON.stringify({
|
||||||
"type": "setfrequency", "params": { "frequency": f, "key": key }
|
"type": "setfrequency", "params": { "frequency": f, "key": key }
|
||||||
|
|
@ -179,11 +176,7 @@ function typeInAnimation(element, timeout, what, onFinish) {
|
||||||
// ========================================================
|
// ========================================================
|
||||||
|
|
||||||
function getDemodulators() {
|
function getDemodulators() {
|
||||||
return [
|
return [ UI.getDemodulator() ].filter(function(d) { return !!d; });
|
||||||
$('#openwebrx-panel-receiver').demodulatorPanel().getDemodulator()
|
|
||||||
].filter(function(d) {
|
|
||||||
return !!d;
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function mkenvelopes(visible_range) //called from mkscale
|
function mkenvelopes(visible_range) //called from mkscale
|
||||||
|
|
@ -285,7 +278,7 @@ function scale_canvas_mousemove(evt) {
|
||||||
|
|
||||||
function frequency_container_mousemove(evt) {
|
function frequency_container_mousemove(evt) {
|
||||||
var frequency = center_freq + scale_offset_freq_from_px(evt.pageX);
|
var frequency = center_freq + scale_offset_freq_from_px(evt.pageX);
|
||||||
$('#openwebrx-panel-receiver').demodulatorPanel().setMouseFrequency(frequency);
|
UI.getDemodulatorPanel().setMouseFrequency(frequency);
|
||||||
}
|
}
|
||||||
|
|
||||||
function scale_canvas_end_drag(x) {
|
function scale_canvas_end_drag(x) {
|
||||||
|
|
@ -711,7 +704,7 @@ function canvas_mousemove(evt) {
|
||||||
if (!waterfall_setup_done) return;
|
if (!waterfall_setup_done) return;
|
||||||
var relativeX = get_relative_x(evt);
|
var relativeX = get_relative_x(evt);
|
||||||
if (!canvas_mouse_down) {
|
if (!canvas_mouse_down) {
|
||||||
$('#openwebrx-panel-receiver').demodulatorPanel().setMouseFrequency(canvas_get_frequency(relativeX));
|
UI.getDemodulatorPanel().setMouseFrequency(canvas_get_frequency(relativeX));
|
||||||
} else {
|
} else {
|
||||||
if (!canvas_drag && Math.abs(evt.pageX - canvas_drag_start_x) > canvas_drag_min_delta) {
|
if (!canvas_drag && Math.abs(evt.pageX - canvas_drag_start_x) > canvas_drag_min_delta) {
|
||||||
canvas_drag = true;
|
canvas_drag = true;
|
||||||
|
|
@ -751,16 +744,12 @@ function canvas_mouseup(evt) {
|
||||||
var relativeX = get_relative_x(evt);
|
var relativeX = get_relative_x(evt);
|
||||||
|
|
||||||
if (!canvas_drag) {
|
if (!canvas_drag) {
|
||||||
var demodulator = $('#openwebrx-panel-receiver').demodulatorPanel().getDemodulator();
|
|
||||||
var f = canvas_get_freq_offset(relativeX);
|
var f = canvas_get_freq_offset(relativeX);
|
||||||
// For CW, move offset 800Hz below the actual carrier
|
// For CW, move offset 800Hz below the actual carrier
|
||||||
if (demodulator.get_modulation() === 'cw') {
|
if (UI.getModulation() === 'cw') f = f - 800;
|
||||||
f = f - 800;
|
UI.setOffsetFrequency(f);
|
||||||
}
|
|
||||||
demodulator.set_offset_frequency(f);
|
|
||||||
stopScanner();
|
stopScanner();
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
canvas_end_drag();
|
canvas_end_drag();
|
||||||
}
|
}
|
||||||
canvas_mouse_down = false;
|
canvas_mouse_down = false;
|
||||||
|
|
@ -853,7 +842,7 @@ function zoom_set(level) {
|
||||||
level = parseInt(level);
|
level = parseInt(level);
|
||||||
zoom_level = level;
|
zoom_level = level;
|
||||||
//zoom_center_rel=canvas_get_freq_offset(-canvases[0].offsetLeft+waterfallWidth()/2); //zoom to screen center instead of demod envelope
|
//zoom_center_rel=canvas_get_freq_offset(-canvases[0].offsetLeft+waterfallWidth()/2); //zoom to screen center instead of demod envelope
|
||||||
var demodulator = $('#openwebrx-panel-receiver').demodulatorPanel().getDemodulator();
|
var demodulator = UI.getDemodulator();
|
||||||
zoom_center_rel = demodulator != null? demodulator.get_offset_frequency() : 0;
|
zoom_center_rel = demodulator != null? demodulator.get_offset_frequency() : 0;
|
||||||
zoom_center_where = 0.5 + (zoom_center_rel / bandwidth); //this is a kind of hack
|
zoom_center_where = 0.5 + (zoom_center_rel / bandwidth); //this is a kind of hack
|
||||||
resize_canvases(true);
|
resize_canvases(true);
|
||||||
|
|
@ -940,11 +929,14 @@ function on_ws_recv(evt) {
|
||||||
|
|
||||||
waterfall_init();
|
waterfall_init();
|
||||||
|
|
||||||
var demodulatorPanel = $('#openwebrx-panel-receiver').demodulatorPanel();
|
var demodulatorPanel = UI.getDemodulatorPanel();
|
||||||
|
|
||||||
demodulatorPanel.setCenterFrequency(center_freq);
|
demodulatorPanel.setCenterFrequency(center_freq);
|
||||||
demodulatorPanel.setInitialParams(initial_demodulator_params);
|
demodulatorPanel.setInitialParams(initial_demodulator_params);
|
||||||
|
|
||||||
if ('squelch_auto_margin' in config)
|
if ('squelch_auto_margin' in config)
|
||||||
demodulatorPanel.setSquelchMargin(config['squelch_auto_margin']);
|
demodulatorPanel.setSquelchMargin(config['squelch_auto_margin']);
|
||||||
|
|
||||||
bookmarks.loadLocalBookmarks();
|
bookmarks.loadLocalBookmarks();
|
||||||
|
|
||||||
if ('sdr_id' in config || 'profile_id' in config) {
|
if ('sdr_id' in config || 'profile_id' in config) {
|
||||||
|
|
@ -963,7 +955,7 @@ function on_ws_recv(evt) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ('tuning_precision' in config)
|
if ('tuning_precision' in config)
|
||||||
$('#openwebrx-panel-receiver').demodulatorPanel().setTuningPrecision(config['tuning_precision']);
|
demodulatorPanel.setTuningPrecision(config['tuning_precision']);
|
||||||
|
|
||||||
if ('tuning_step' in config) {
|
if ('tuning_step' in config) {
|
||||||
tuning_step_default = config['tuning_step'];
|
tuning_step_default = config['tuning_step'];
|
||||||
|
|
@ -1072,7 +1064,7 @@ function on_ws_recv(evt) {
|
||||||
var $overlay = $('#openwebrx-error-overlay');
|
var $overlay = $('#openwebrx-error-overlay');
|
||||||
$overlay.find('.errormessage').text(json['value']);
|
$overlay.find('.errormessage').text(json['value']);
|
||||||
$overlay.show();
|
$overlay.show();
|
||||||
$("#openwebrx-panel-receiver").demodulatorPanel().stopDemodulator();
|
UI.getDemodulatorPanel().stopDemodulator();
|
||||||
break;
|
break;
|
||||||
case "demodulator_error":
|
case "demodulator_error":
|
||||||
divlog(json['value'], true);
|
divlog(json['value'], true);
|
||||||
|
|
@ -1242,7 +1234,7 @@ function onAudioStart(apiType){
|
||||||
var reconnect_timeout = false;
|
var reconnect_timeout = false;
|
||||||
|
|
||||||
function on_ws_closed() {
|
function on_ws_closed() {
|
||||||
var demodulatorPanel = $("#openwebrx-panel-receiver").demodulatorPanel();
|
var demodulatorPanel = UI.getDemodulatorPanel();
|
||||||
demodulatorPanel.stopDemodulator();
|
demodulatorPanel.stopDemodulator();
|
||||||
demodulatorPanel.resetInitialParams();
|
demodulatorPanel.resetInitialParams();
|
||||||
if (reconnect_timeout) {
|
if (reconnect_timeout) {
|
||||||
|
|
@ -1496,7 +1488,7 @@ function update_dmr_timeslot_filtering() {
|
||||||
}).toArray().reduce(function (acc, v) {
|
}).toArray().reduce(function (acc, v) {
|
||||||
return acc | v;
|
return acc | v;
|
||||||
}, 0);
|
}, 0);
|
||||||
$('#openwebrx-panel-receiver').demodulatorPanel().getDemodulator().setDmrFilter(filter);
|
UI.getDemodulator().setDmrFilter(filter);
|
||||||
}
|
}
|
||||||
|
|
||||||
function hideOverlay() {
|
function hideOverlay() {
|
||||||
|
|
@ -1760,7 +1752,7 @@ function secondary_demod_update_channel_freq_from_event(evt) {
|
||||||
if (!secondary_demod_waiting_for_set) {
|
if (!secondary_demod_waiting_for_set) {
|
||||||
secondary_demod_waiting_for_set = true;
|
secondary_demod_waiting_for_set = true;
|
||||||
window.setTimeout(function () {
|
window.setTimeout(function () {
|
||||||
$('#openwebrx-panel-receiver').demodulatorPanel().getDemodulator().set_secondary_offset_freq(Math.floor(secondary_demod_channel_freq));
|
UI.getDemodulator().set_secondary_offset_freq(Math.floor(secondary_demod_channel_freq));
|
||||||
secondary_demod_waiting_for_set = false;
|
secondary_demod_waiting_for_set = false;
|
||||||
},
|
},
|
||||||
50
|
50
|
||||||
|
|
@ -1819,7 +1811,7 @@ function secondary_demod_waterfall_set_zoom(low_cut, high_cut) {
|
||||||
|
|
||||||
function sdr_profile_changed() {
|
function sdr_profile_changed() {
|
||||||
var value = $('#openwebrx-sdr-profiles-listbox').val();
|
var value = $('#openwebrx-sdr-profiles-listbox').val();
|
||||||
var key = $('#openwebrx-panel-receiver').demodulatorPanel().getMagicKey();
|
var key = UI.getDemodulatorPanel().getMagicKey();
|
||||||
ws.send(JSON.stringify({
|
ws.send(JSON.stringify({
|
||||||
"type": "selectprofile", "params": { "profile": value, "key": key }
|
"type": "selectprofile", "params": { "profile": value, "key": key }
|
||||||
}));
|
}));
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue