AudioPlayerInterface/Src/AudioPlayerInterface.c

34 lines
940 B
C

//
// 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(500);
}
SystemDelayMs(500);
return false;
}
bool AudioPlayerInterfacePlayTone(tAudioPlayerInterface *env, uint16_t count) {
if (AudioPlayer_PlayTone(env, count)) {
return true;
}
SystemDelayMs(500);
return false;
}
bool AudioPlayerInterfacePlayToEnd(tAudioPlayerInterface *env, char *sampleName, uint16_t snLength, uint32_t timeout) {
if (AudioPlayer_StartToEnd(env, sampleName, snLength, timeout)) {
return true;
}
SystemDelayMs(500);
return false;
}