This commit is contained in:
cfif 2024-12-04 13:10:48 +03:00
commit c995973eb2
3 changed files with 67 additions and 0 deletions

View File

@ -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

View File

@ -0,0 +1,13 @@
//
// Created by zemon on 29.11.22.
//
#include <SystemDelayInterface.h>
#include "AudioRecorderInterface.h"
bool AudioRecordInterfaceRec(tAudioRecorderInterface *env, char *sampleName, uint16_t snLength) {
if (!AudioRecord_Start(env, sampleName, snLength) ){
return false;
}
return true;
}

12
modular.json Normal file
View File

@ -0,0 +1,12 @@
{
"dep": [
],
"cmake": {
"inc_dirs": [
"Inc"
],
"srcs": [
"Src/**.c"
]
}
}