I have the same VS1000b custom board using SPI FLASH + SD CARD.
The problem i have faced with for now is following:
I have vry massive pauses in player operationing while Stopping Sound by Button and loading another one.
Hook that scan keys and finds whether to stop sound or no is following:
Code: Select all
void KeyboadUserInterfaceHook()
{
//always active (OGG part)
///GLOBAL_SOUND_IS_ACTIVE = 1; //sound playing in VS1000
if (uiTrigger) //< Is non-zero 16 times per second when audio is played. (audio.h)
{
uiTrigger = 0;
KeyScan(); //calls KeyEventHandler()
}
}
it's connected to Hook Idle this way:
Code: Select all
SetHookFunction((u_int16)IdleHook, KeyboadUserInterfaceHook); // IdleHook is called inly during playback
SetHookFunction((u_int16)KeyEventHandler, MyKeyboadEventHandler);
Code: Select all
//\p is important in filename
void MyPlayFile(u_int16* filename, u_int16 startSec)
{
GLOBAL_SOUND_IS_ACTIVE = 1;
//player.currentFile = OpenFileNamed("\pLANG0001", FAT_MKID('O','G','G')); //OpenFileNamed(filename, FAT_MKID('O','G','G'));
player.currentFile = OpenFileNamed(filename, FAT_MKID('O','G','G'));
if (player.currentFile >= 0)
{
//puts("Playing file");
player.pauseOn = 0;
player.ffCount = 0;
cs.cancel = 0;
cs.goTo = startSec; //-1; /* start playing from the start */
cs.fileSize = cs.fileLeft = minifatInfo.fileSize;
cs.fastForward = 1; /* reset play speed to normal */
// start playing
PlayCurrentFile(); //sitting here while SOUND is PLAYED
// end playing, в том числе:
//if (common.cur_excursion)
// timer_autooff = 0; // reset timer autooff
}
else
{
//puts("No files found on SD");
}
}
Code: Select all
void StopPlayback(void)
{
player.pauseOn = 0;
cs.cancel = 1;
}
What i get is long ~ 1-1?5 sec pause between i have pressed button and when new filed is opens though sound is stopped almost immediately when button pressed.
Can it be IdleHook that is taking too much time before MyPlayFile return access to action
or smth else probably..?
Thanks, Peter