mirror of
https://github.com/smittix/intercept.git
synced 2026-07-25 01:08:11 -07:00
Fix volume control not applying initial knob value
- Apply volume knob value when scanner audio starts on signal detection - Apply volume knob value when direct listening starts - Fix visualizer to use correct scannerAudioPlayer element ID - Add console logging for volume changes
This commit is contained in:
@@ -516,6 +516,14 @@ function handleSignalFound(data) {
|
|||||||
const streamUrl = getStreamUrl(data.frequency, data.modulation);
|
const streamUrl = getStreamUrl(data.frequency, data.modulation);
|
||||||
console.log('[SCANNER] Starting audio for signal:', data.frequency, 'MHz');
|
console.log('[SCANNER] Starting audio for signal:', data.frequency, 'MHz');
|
||||||
scannerAudio.src = streamUrl;
|
scannerAudio.src = streamUrl;
|
||||||
|
// Apply current volume from knob
|
||||||
|
const volumeKnob = document.getElementById('radioVolumeKnob');
|
||||||
|
if (volumeKnob && volumeKnob._knob) {
|
||||||
|
scannerAudio.volume = volumeKnob._knob.getValue() / 100;
|
||||||
|
} else if (volumeKnob) {
|
||||||
|
const knobValue = parseFloat(volumeKnob.dataset.value) || 80;
|
||||||
|
scannerAudio.volume = knobValue / 100;
|
||||||
|
}
|
||||||
scannerAudio.play().catch(e => console.warn('[SCANNER] Audio autoplay blocked:', e));
|
scannerAudio.play().catch(e => console.warn('[SCANNER] Audio autoplay blocked:', e));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -991,7 +999,7 @@ async function tuneToFrequency(freq, mod) {
|
|||||||
// ============== AUDIO VISUALIZER ==============
|
// ============== AUDIO VISUALIZER ==============
|
||||||
|
|
||||||
function initAudioVisualizer() {
|
function initAudioVisualizer() {
|
||||||
const audioPlayer = document.getElementById('audioPlayer');
|
const audioPlayer = document.getElementById('scannerAudioPlayer');
|
||||||
if (!audioPlayer) return;
|
if (!audioPlayer) return;
|
||||||
|
|
||||||
if (!visualizerContext) {
|
if (!visualizerContext) {
|
||||||
@@ -1163,10 +1171,7 @@ function initRadioKnobControls() {
|
|||||||
const audioPlayer = document.getElementById('scannerAudioPlayer');
|
const audioPlayer = document.getElementById('scannerAudioPlayer');
|
||||||
if (audioPlayer) {
|
if (audioPlayer) {
|
||||||
audioPlayer.volume = e.detail.value / 100;
|
audioPlayer.volume = e.detail.value / 100;
|
||||||
}
|
console.log('[VOLUME] Set to', Math.round(e.detail.value) + '%');
|
||||||
const manualPlayer = document.getElementById('audioPlayer');
|
|
||||||
if (manualPlayer) {
|
|
||||||
manualPlayer.volume = e.detail.value / 100;
|
|
||||||
}
|
}
|
||||||
// Update knob value display
|
// Update knob value display
|
||||||
const valueDisplay = document.getElementById('radioVolumeValue');
|
const valueDisplay = document.getElementById('radioVolumeValue');
|
||||||
@@ -1787,6 +1792,15 @@ async function _startDirectListenInternal() {
|
|||||||
console.log('[LISTEN] Connecting to stream:', streamUrl);
|
console.log('[LISTEN] Connecting to stream:', streamUrl);
|
||||||
audioPlayer.src = streamUrl;
|
audioPlayer.src = streamUrl;
|
||||||
|
|
||||||
|
// Apply current volume from knob
|
||||||
|
const volumeKnob = document.getElementById('radioVolumeKnob');
|
||||||
|
if (volumeKnob && volumeKnob._knob) {
|
||||||
|
audioPlayer.volume = volumeKnob._knob.getValue() / 100;
|
||||||
|
} else if (volumeKnob) {
|
||||||
|
const knobValue = parseFloat(volumeKnob.dataset.value) || 80;
|
||||||
|
audioPlayer.volume = knobValue / 100;
|
||||||
|
}
|
||||||
|
|
||||||
// Wait for audio to be ready then play
|
// Wait for audio to be ready then play
|
||||||
audioPlayer.oncanplay = () => {
|
audioPlayer.oncanplay = () => {
|
||||||
console.log('[LISTEN] Audio can play');
|
console.log('[LISTEN] Audio can play');
|
||||||
|
|||||||
Reference in New Issue
Block a user