VS1000b , StopPlayback

Writing software that controls the system and peripherals such as displays, SD cards, Buttons, LEDs, Serial Ports etc.
Post Reply
HeLiO
Senior User
Posts: 94
Joined: Thu 2011-04-14 12:47

VS1000b , StopPlayback

Post by HeLiO » Thu 2013-01-31 12:50

Hi, VLSI Team!

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);
Sound is starting by this fucntion:

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");
	}	
}
and finishes by spoecial button handled in MyKeyboadEventHandler by next func:

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

HeLiO
Senior User
Posts: 94
Joined: Thu 2011-04-14 12:47

Re: VS1000b , StopPlayback

Post by HeLiO » Thu 2013-01-31 13:28

Code: Select all

	//Patch a decoding problem (when left channel is digital zero)
	//plus returns faster after finishing a file. 
	SetHookFunction((u_int16)PlayCurrentFile, PatchPlayCurrentFile);

Solved problem brilliantely!!

HeLiO
Senior User
Posts: 94
Joined: Thu 2011-04-14 12:47

Re: VS1000b , StopPlayback

Post by HeLiO » Thu 2013-01-31 14:02

Code: Select all

	//Patch a decoding problem (when left channel is digital zero)
	//plus returns faster after finishing a file. 
	SetHookFunction((u_int16)PlayCurrentFile, PatchPlayCurrentFile);

Solved problem brilliantely!!

Post Reply