diff --git a/gui/preload-main.js b/gui/preload-main.js index f07f100e..ab64178c 100644 --- a/gui/preload-main.js +++ b/gui/preload-main.js @@ -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(); } diff --git a/gui/sock.js b/gui/sock.js index 9bdb443d..25c52f35 100644 --- a/gui/sock.js +++ b/gui/sock.js @@ -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(); diff --git a/tnc/sock.py b/tnc/sock.py index 2348ea34..4e878997 100644 --- a/tnc/sock.py +++ b/tnc/sock.py @@ -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