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
4 changed files with 54 additions and 9 deletions
|
@ -10,15 +10,32 @@ const state = useStateStore(pinia);
|
||||||
import { useSettingsStore } from "../store/settingsStore.js";
|
import { useSettingsStore } from "../store/settingsStore.js";
|
||||||
const settings = useSettingsStore(pinia);
|
const settings = useSettingsStore(pinia);
|
||||||
|
|
||||||
|
import { useAudioStore } from "../store/audioStore.js";
|
||||||
|
const audioStore = useAudioStore(pinia);
|
||||||
|
|
||||||
import { startModem, stopModem } from "../js/daemon.js";
|
import { startModem, stopModem } from "../js/daemon.js";
|
||||||
|
import { saveSettingsToFile } from "../js/settingsHandler";
|
||||||
|
|
||||||
function startStopModem() {
|
function startStopModem() {
|
||||||
switch (state.modem_running_state) {
|
switch (state.modem_running_state) {
|
||||||
case "stopped":
|
case "stopped":
|
||||||
|
|
||||||
settings.rx_audio = (<HTMLInputElement>document.getElementById("audio_input_selectbox")).value;
|
let startupInputDeviceValue = (<HTMLInputElement>document.getElementById("audio_input_selectbox")).value;
|
||||||
settings.tx_audio = (<HTMLInputElement>document.getElementById("audio_output_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();
|
startModem();
|
||||||
|
|
||||||
|
|
|
@ -203,8 +203,8 @@ export function startModem() {
|
||||||
{
|
{
|
||||||
mycall: settings.mycall,
|
mycall: settings.mycall,
|
||||||
mygrid: settings.mygrid,
|
mygrid: settings.mygrid,
|
||||||
rx_audio: settings.rx_audio,
|
rx_audio: audioStore.startupInputDevice,
|
||||||
tx_audio: settings.tx_audio,
|
tx_audio: audioStore.startupOutputDevice,
|
||||||
radiocontrol: settings.radiocontrol,
|
radiocontrol: settings.radiocontrol,
|
||||||
devicename: settings.devicename,
|
devicename: settings.devicename,
|
||||||
deviceport: settings.deviceport,
|
deviceport: settings.deviceport,
|
||||||
|
|
|
@ -65,11 +65,13 @@ const configDefaultSettings =
|
||||||
"modem_port": 3000,\
|
"modem_port": 3000,\
|
||||||
"daemon_host": "127.0.0.1",\
|
"daemon_host": "127.0.0.1",\
|
||||||
"daemon_port": 3001,\
|
"daemon_port": 3001,\
|
||||||
"mycall": "AA0AA",\
|
"rx_audio" : "",\
|
||||||
|
"tx_audio" : "",\
|
||||||
|
"mycall": "AA0AA-0",\
|
||||||
"myssid": "0",\
|
"myssid": "0",\
|
||||||
"mygrid": "JN40aa",\
|
"mygrid": "JN40aa",\
|
||||||
"radiocontrol" : "disabled",\
|
"radiocontrol" : "disabled",\
|
||||||
"hamlib_deviceid": "RIG_MODEL_DUMMY_NOVFO",\
|
"hamlib_deviceid": 6,\
|
||||||
"hamlib_deviceport": "ignore",\
|
"hamlib_deviceport": "ignore",\
|
||||||
"hamlib_stop_bits": "ignore",\
|
"hamlib_stop_bits": "ignore",\
|
||||||
"hamlib_data_bits": "ignore",\
|
"hamlib_data_bits": "ignore",\
|
||||||
|
|
|
@ -1,14 +1,33 @@
|
||||||
import { defineStore } from "pinia";
|
import { defineStore } from "pinia";
|
||||||
import { ref, computed } from "vue";
|
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", () => {
|
export const useAudioStore = defineStore("audioStore", () => {
|
||||||
var inputDevices = ref([{ id: 0, name: "no input devices" }]);
|
var inputDevices = ref([{ id: 0, name: "no input devices" }]);
|
||||||
var outputDevices = ref([{ id: 0, name: "no output devices" }]);
|
var outputDevices = ref([{ id: 0, name: "no output devices" }]);
|
||||||
|
|
||||||
|
var startupInputDevice = ref(0)
|
||||||
|
var startupOutputDevice = ref(0)
|
||||||
|
|
||||||
|
|
||||||
function getInputDevices() {
|
function getInputDevices() {
|
||||||
var html = "";
|
var html = "";
|
||||||
for (var key in inputDevices.value) {
|
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;
|
return html;
|
||||||
}
|
}
|
||||||
|
@ -16,10 +35,17 @@ export const useAudioStore = defineStore("audioStore", () => {
|
||||||
function getOutputDevices() {
|
function getOutputDevices() {
|
||||||
var html = "";
|
var html = "";
|
||||||
for (var key in outputDevices.value) {
|
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 html;
|
||||||
}
|
}
|
||||||
|
|
||||||
return { inputDevices, outputDevices, getInputDevices, getOutputDevices };
|
return { inputDevices, outputDevices, getInputDevices, getOutputDevices, startupInputDevice, startupOutputDevice };
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue