If i understand you correctly (i think this is multi threading which is new for me) it should be something like this??
HANDLE hThread;
DWORD CALLBACK ThreadProc(void *pArg)
{
while(playnow)
{
DWORD delay;
delay = PtrToUlong(pArg);
Sleep(delay);
FunctionB();
}
return 0;
}
void FunctionA()
{
//Code here; read file containing sounds
FunctionB();
}
void FunctionB()
{
if(runnow)
{
//Pick a random song from the file
//Play the song
fsystem->update();
{
//Set Volume
//Get song length (in miliseconds)
}
DWORD tid;
hThread = CreateThread(NULL, 0, ThreadProc, ULongToPtr(songlength), 0, &tid);
}
//More code; should still run and not only after X miliseconds as Sleep(); would do
}
void FunctionC()
{
//Close file etc
CloseHandle(hThread);
}
[Updated on: Mon, 18 January 2010 12:27]
Report message to a moderator