FreeDATA/gui_vue/src/store/audioStore.js

26 lines
814 B
JavaScript
Raw Normal View History

2023-10-03 13:15:17 +00:00
import { defineStore } from "pinia";
import { ref, computed } from "vue";
2023-09-05 09:22:00 +00:00
2023-10-03 13:15:17 +00:00
export const useAudioStore = defineStore("audioStore", () => {
var inputDevices = ref([{ id: 0, name: "no input devices" }]);
var outputDevices = ref([{ id: 0, name: "no output devices" }]);
2023-09-05 09:22:00 +00:00
2023-10-03 13:15:17 +00:00
function getInputDevices() {
var html = "";
for (var key in inputDevices.value) {
html += `<option value=${inputDevices.value[key]["id"]}>${inputDevices.value[key]["name"]}</option>`;
2023-09-05 09:22:00 +00:00
}
2023-10-03 13:15:17 +00:00
return html;
}
2023-09-05 09:22:00 +00:00
2023-10-03 13:15:17 +00:00
function getOutputDevices() {
var html = "";
for (var key in outputDevices.value) {
html += `<option value="${outputDevices.value[key]["id"]}">${outputDevices.value[key]["name"]}</option>`;
2023-09-05 09:22:00 +00:00
}
2023-10-03 13:15:17 +00:00
return html;
}
2023-09-05 09:22:00 +00:00
return { inputDevices, outputDevices, getInputDevices, getOutputDevices };
});