I have VS1000 Module with UartAudioModule code (VS1000UartVoiceMailSoftware120).
My goal is to play one short .ogg music file in endless loop without gap. I found Player with Seamless Looping code.
I simply copied gapless looping part of the code to UartAudioModule code and changed the PlayCurrentFile() function by MyPlayCurrentFile().
The project compiled without problems. But when Play is started I don't hear the music playing.
Could you help me to solve this problem?
Code: Select all
// ------------ Gapless looping functionality --------------
// Expose some ROM functions...
auto s_int16 CodVorbisGoTo(register struct CodecVorbis *cv,
register u_int16 seconds);
extern struct Codec *cod;
struct Codec *CodVorbisCreate(void);
extern struct CodecServices cs;
extern u_int16 ogg[];
extern s_int16 vFirstFrame;
// PlayCurrentFile with gapless looping
u_int16 MyPlayCurrentFile(void) {
register enum CodecError ret = ceFormatNotFound;
LoadCheck(NULL, 0); // set higher clock
if ((cod = CodVorbisCreate())) {
const char *eStr;
ret = cod->Decode(cod, &cs, &eStr); // play Ogg Vorbis
// if played to the end, start over
while (cs.fileLeft < 5) {
LoadCheck(NULL, 0); // set higher clock
CodVorbisGoTo(cod, 0); // go to beginning of file
ogg[1] = 0; // ogg.headerTypeFlag: reset lastFrame
ogg[14] = 0; // ogg.cont: set vorbis continuation
vFirstFrame = 1; // first ogg frame in file
cs.playTimeSamples = 0;
cs.playTimeSeconds = 0;
ret = cod->Decode(cod, &cs, &eStr); // play Ogg Vorbis
}
cod->Delete(cod);
}
return ret;
}