From c995973eb2ea06dcd69b17ebf80a432110fe6d2e Mon Sep 17 00:00:00 2001 From: cfif Date: Wed, 4 Dec 2024 13:10:48 +0300 Subject: [PATCH] Init --- Inc/AudioRecorderInterface.h | 42 ++++++++++++++++++++++++++++++++++++ Src/AudioRecorderInterface.c | 13 +++++++++++ modular.json | 12 +++++++++++ 3 files changed, 67 insertions(+) create mode 100644 Inc/AudioRecorderInterface.h create mode 100644 Src/AudioRecorderInterface.c create mode 100644 modular.json diff --git a/Inc/AudioRecorderInterface.h b/Inc/AudioRecorderInterface.h new file mode 100644 index 0000000..b122927 --- /dev/null +++ b/Inc/AudioRecorderInterface.h @@ -0,0 +1,42 @@ +// +// Created by zemon on 29.11.22. +// + +#ifndef UVEOS_ON_NATION_AUDIORECORDERINTERFACE_H +#define UVEOS_ON_NATION_AUDIORECORDERINTERFACE_H + +#include "stdint.h" +#include "stddef.h" +#include "stdbool.h" + +typedef bool (*audioRecordStart)(void *env, char *sampleName, uint16_t sampleNameLength); +typedef bool (*audioRecordStop)(void *env, uint32_t timeout); +typedef bool (*audioRecordDel)(void *env, char *name, uint16_t nameLen); +typedef bool (*audioRecordWaitStop)(void *env, uint32_t timeout); + +typedef struct { + void *env; + audioRecordStart start; + audioRecordStop stop; + audioRecordDel del; + audioRecordWaitStop waitStop; +} tAudioRecorderInterface; + +bool AudioRecordInterfaceRec(tAudioRecorderInterface *env, char *sampleName, uint16_t snLength); + +#define AudioRecord_Rec(RECORDER, NAME, LEN) AudioRecordInterfaceRec(RECORDER,NAME,LEN) +#define AudioRecord_Start(RECORDER, NAME, LEN) RECORDER->start(RECORDER->env,NAME,LEN) +#define AudioRecord_WaitStop(RECORDER, TIMEOUT) RECORDER->waitStop(RECORDER->env,TIMEOUT) +#define AudioRecord_Del(RECORDER, NAME, LEN) RECORDER->del(RECORDER->env,NAME,LEN) +#define AudioRecord_Stop(RECORDER, TIMEOUT) RECORDER->stop(RECORDER->env,TIMEOUT) + + + +#define AudioRecord_RecStatic(RECORDER, NAME, TIMEOUT) \ + AudioRecord_Del(RECORDER,NAME,sizeof(NAME)-1); \ + AudioRecord_Rec(RECORDER,NAME,sizeof(NAME)-1); \ + AudioRecord_WaitStop(RECORDER,TIMEOUT) + +#endif //UVEOS_ON_NATION_AUDIORECORDERINTERFACE_H + + diff --git a/Src/AudioRecorderInterface.c b/Src/AudioRecorderInterface.c new file mode 100644 index 0000000..0528489 --- /dev/null +++ b/Src/AudioRecorderInterface.c @@ -0,0 +1,13 @@ +// +// Created by zemon on 29.11.22. +// + +#include +#include "AudioRecorderInterface.h" + +bool AudioRecordInterfaceRec(tAudioRecorderInterface *env, char *sampleName, uint16_t snLength) { + if (!AudioRecord_Start(env, sampleName, snLength) ){ + return false; + } + return true; +} diff --git a/modular.json b/modular.json new file mode 100644 index 0000000..d4d574e --- /dev/null +++ b/modular.json @@ -0,0 +1,12 @@ +{ + "dep": [ + ], + "cmake": { + "inc_dirs": [ + "Inc" + ], + "srcs": [ + "Src/**.c" + ] + } +} \ No newline at end of file