record audio update

This commit is contained in:
DJ2LS 2022-12-26 12:27:13 +01:00
parent c0e4f14da0
commit 7691ba09ac
3 changed files with 10 additions and 4 deletions

View file

@ -45,7 +45,6 @@ window.addEventListener('DOMContentLoaded', () => {
let Data = {
type: "set",
command: "record_audio",
state: "True",
};
ipcRenderer.send('run-tnc-command', Data);
@ -2105,6 +2104,9 @@ ipcRenderer.on('run-tnc-command', (event, arg) => {
if (arg.command == 'set_tx_audio_level') {
sock.setTxAudioLevel(arg.tx_audio_level);
}
if (arg.command == 'record_audio') {
sock.record_audio();
}
if (arg.command == 'send_test_frame') {
sock.sendTestFrame();
}

View file

@ -586,7 +586,11 @@ exports.sendTestFrame = function() {
writeTncCommand(command)
}
// RECORD AUDIO
exports.record_audio = function() {
command = '{"type" : "set", "command" : "record_audio"}'
writeTncCommand(command)
}
ipcRenderer.on('action-update-tnc-ip', (event, arg) => {
client.destroy();

View file

@ -230,8 +230,8 @@ def process_tnc_commands(data):
# START STOP AUDIO RECORDING -----------------------------------------------------
if received_json["type"] == "set" and received_json["command"] == "record_audio":
try:
if received_json["state"] in ['true', 'True', True]:
static.AUDIO_RECORD_FILE = open(f"{int(time.time())}_audio_recording", 'wb')
if not static.AUDIO_RECORD:
static.AUDIO_RECORD_FILE = open(f"{int(time.time())}_audio_recording.raw", 'wb')
static.AUDIO_RECORD = True
else:
static.AUDIO_RECORD = False