mirror of
https://github.com/DJ2LS/FreeDATA
synced 2024-05-14 08:04:33 +00:00
preselect tx/rx audio device
This commit is contained in:
parent
3df0265ffc
commit
df95f4b82c
|
@ -10,15 +10,32 @@ const state = useStateStore(pinia);
|
|||
import { useSettingsStore } from "../store/settingsStore.js";
|
||||
const settings = useSettingsStore(pinia);
|
||||
|
||||
import { useAudioStore } from "../store/audioStore.js";
|
||||
const audioStore = useAudioStore(pinia);
|
||||
|
||||
import { startModem, stopModem } from "../js/daemon.js";
|
||||
import { saveSettingsToFile } from "../js/settingsHandler";
|
||||
|
||||
function startStopModem() {
|
||||
switch (state.modem_running_state) {
|
||||
case "stopped":
|
||||
|
||||
settings.rx_audio = (<HTMLInputElement>document.getElementById("audio_input_selectbox")).value;
|
||||
settings.tx_audio = (<HTMLInputElement>document.getElementById("audio_output_selectbox")).value;
|
||||
let startupInputDeviceValue = (<HTMLInputElement>document.getElementById("audio_input_selectbox")).value;
|
||||
let startupOutputDeviceValue = (<HTMLInputElement>document.getElementById("audio_output_selectbox")).value;
|
||||
|
||||
let startupInputDeviceIndex = (<HTMLInputElement>document.getElementById("audio_input_selectbox")).selectedIndex;
|
||||
let startupOutputDeviceIndex = (<HTMLInputElement>document.getElementById("audio_output_selectbox")).selectedIndex;
|
||||
|
||||
|
||||
audioStore.startupInputDevice = startupInputDeviceValue
|
||||
audioStore.startupOutputDevice = startupOutputDeviceValue
|
||||
|
||||
// get full name of audio device
|
||||
settings.rx_audio = (<HTMLInputElement>document.getElementById("audio_input_selectbox")).options[startupInputDeviceIndex].text;
|
||||
settings.tx_audio = (<HTMLInputElement>document.getElementById("audio_output_selectbox")).options[startupOutputDeviceIndex].text;
|
||||
|
||||
|
||||
saveSettingsToFile();
|
||||
|
||||
startModem();
|
||||
|
||||
|
|
|
@ -203,8 +203,8 @@ export function startModem() {
|
|||
{
|
||||
mycall: settings.mycall,
|
||||
mygrid: settings.mygrid,
|
||||
rx_audio: settings.rx_audio,
|
||||
tx_audio: settings.tx_audio,
|
||||
rx_audio: audioStore.startupInputDevice,
|
||||
tx_audio: audioStore.startupOutputDevice,
|
||||
radiocontrol: settings.radiocontrol,
|
||||
devicename: settings.devicename,
|
||||
deviceport: settings.deviceport,
|
||||
|
|
|
@ -65,11 +65,13 @@ const configDefaultSettings =
|
|||
"modem_port": 3000,\
|
||||
"daemon_host": "127.0.0.1",\
|
||||
"daemon_port": 3001,\
|
||||
"mycall": "AA0AA",\
|
||||
"rx_audio" : "",\
|
||||
"tx_audio" : "",\
|
||||
"mycall": "AA0AA-0",\
|
||||
"myssid": "0",\
|
||||
"mygrid": "JN40aa",\
|
||||
"radiocontrol" : "disabled",\
|
||||
"hamlib_deviceid": "RIG_MODEL_DUMMY_NOVFO",\
|
||||
"hamlib_deviceid": 6,\
|
||||
"hamlib_deviceport": "ignore",\
|
||||
"hamlib_stop_bits": "ignore",\
|
||||
"hamlib_data_bits": "ignore",\
|
||||
|
|
|
@ -1,14 +1,33 @@
|
|||
import { defineStore } from "pinia";
|
||||
import { ref, computed } from "vue";
|
||||
|
||||
import { setActivePinia } from "pinia";
|
||||
import pinia from "../store/index";
|
||||
setActivePinia(pinia);
|
||||
|
||||
import { useSettingsStore } from "../store/settingsStore.js";
|
||||
const settings = useSettingsStore(pinia);
|
||||
|
||||
export const useAudioStore = defineStore("audioStore", () => {
|
||||
var inputDevices = ref([{ id: 0, name: "no input devices" }]);
|
||||
var outputDevices = ref([{ id: 0, name: "no output devices" }]);
|
||||
|
||||
var startupInputDevice = ref(0)
|
||||
var startupOutputDevice = ref(0)
|
||||
|
||||
|
||||
function getInputDevices() {
|
||||
var html = "";
|
||||
for (var key in inputDevices.value) {
|
||||
html += `<option value=${inputDevices.value[key]["id"]}>${inputDevices.value[key]["name"]}</option>`;
|
||||
|
||||
let selected = ''
|
||||
if (inputDevices.value[key]["name"] == settings.rx_audio){
|
||||
selected = "selected"
|
||||
} else {
|
||||
selected = ''
|
||||
}
|
||||
|
||||
html += `<option value=${inputDevices.value[key]["id"]} ${selected}>${inputDevices.value[key]["name"]}</option>`;
|
||||
}
|
||||
return html;
|
||||
}
|
||||
|
@ -16,10 +35,17 @@ export const useAudioStore = defineStore("audioStore", () => {
|
|||
function getOutputDevices() {
|
||||
var html = "";
|
||||
for (var key in outputDevices.value) {
|
||||
html += `<option value="${outputDevices.value[key]["id"]}">${outputDevices.value[key]["name"]}</option>`;
|
||||
|
||||
let selected = ''
|
||||
if (outputDevices.value[key]["name"] == settings.tx_audio){
|
||||
selected = "selected"
|
||||
} else {
|
||||
selected = ''
|
||||
}
|
||||
html += `<option value=${outputDevices.value[key]["id"]} ${selected}>${outputDevices.value[key]["name"]}</option>`;
|
||||
}
|
||||
return html;
|
||||
}
|
||||
|
||||
return { inputDevices, outputDevices, getInputDevices, getOutputDevices };
|
||||
return { inputDevices, outputDevices, getInputDevices, getOutputDevices, startupInputDevice, startupOutputDevice };
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue