Init
This commit is contained in:
commit
c116263346
|
|
@ -0,0 +1,31 @@
|
|||
//
|
||||
// Created by xemon on 17.11.22.
|
||||
//
|
||||
|
||||
#ifndef UVEOS_ON_NATION_AUDIOPLAYERINTERFACE_H
|
||||
#define UVEOS_ON_NATION_AUDIOPLAYERINTERFACE_H
|
||||
|
||||
#include "stdint.h"
|
||||
#include "stddef.h"
|
||||
#include "stdbool.h"
|
||||
|
||||
typedef bool (*audioPlayerCallStart)(void *env, char *sampleName, uint16_t sampleNameLength, uint32_t timeout);
|
||||
|
||||
typedef bool (*audioPlayerCall)(void *env, uint32_t timeout);
|
||||
|
||||
typedef struct {
|
||||
void *env;
|
||||
audioPlayerCallStart start;
|
||||
audioPlayerCall wait;
|
||||
audioPlayerCall stop;
|
||||
} tAudioPlayerInterface;
|
||||
|
||||
bool AudioPlayerInterfacePlay(tAudioPlayerInterface *env, char *sampleName, uint16_t snLength, uint32_t timeout);
|
||||
|
||||
#define AudioPlayer_Start(PLAYER, NAME, LEN, TIMEOUT) PLAYER->start(PLAYER->env,NAME,LEN,TIMEOUT)
|
||||
#define AudioPlayer_Wait(PLAYER, TIMEOUT) PLAYER->wait(PLAYER->env,TIMEOUT)
|
||||
#define AudioPlayer_Stop(PLAYER, TIMEOUT) PLAYER->stop(PLAYER->env,TIMEOUT)
|
||||
#define AudioPlayer_Play(PLAYER, NAME, LEN, TIMEOUT) AudioPlayerInterfacePlay(PLAYER,NAME,LEN,TIMEOUT)
|
||||
#define AudioPlayer_PlayStatic(PLAYER, NAME, TIMEOUT) AudioPlayer_Play(PLAYER,NAME,sizeof(NAME)-1,TIMEOUT)
|
||||
|
||||
#endif //UVEOS_ON_NATION_AUDIOPLAYERINTERFACE_H
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
//
|
||||
// Created by xemon on 17.11.22.
|
||||
//
|
||||
#include <SystemDelayInterface.h>
|
||||
#include "AudioPlayerInterface.h"
|
||||
|
||||
bool AudioPlayerInterfacePlay(tAudioPlayerInterface *env, char *sampleName, uint16_t snLength, uint32_t timeout) {
|
||||
uint32_t end = SystemGetMs() + timeout;
|
||||
|
||||
while (end > SystemGetMs()){
|
||||
if (AudioPlayer_Start(env, sampleName, snLength, timeout)) {
|
||||
return true;
|
||||
}
|
||||
SystemDelayMs(250);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
"dep": [
|
||||
],
|
||||
"cmake": {
|
||||
"inc_dirs": [
|
||||
"Inc"
|
||||
],
|
||||
"srcs": [
|
||||
"Src/**.c"
|
||||
]
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue