conditional = SDL_CreateCond();
mutex = SDL_CreateMutex();
mutex2 = SDL_CreateMutex();// Let's try real signalling...
- SDL_mutexP(mutex); // Must lock the mutex for the cond to work properly...
+// SDL_mutexP(mutex); // Must lock the mutex for the cond to work properly...
soundBufferPos = 0;
sampleBase = 0;
lastToggleCycles = 0;
// Hm.
// This might not empty the buffer enough, causing hash and trash. !!! FIX !!!
SDL_mutexV(mutex2);//Release it so sound thread can get it,
+ SDL_mutexP(mutex); // Must lock the mutex for the cond to work properly...
SDL_CondWait(conditional, mutex);//Sleep/wait for the sound thread
+ SDL_mutexV(mutex); // Must unlock the mutex for the cond to work properly...
SDL_mutexP(mutex2);//Re-lock it until we're done with it...
// currentPos = sampleBase + (uint32)((double)deltaCycles / CYCLES_PER_SAMPLE);
// Hm.
// This might not empty the buffer enough, causing hash and trash. !!! FIX !!! [DONE]
SDL_mutexV(mutex2);//Release it so sound thread can get it,
+ SDL_mutexP(mutex); // Must lock the mutex for the cond to work properly...
SDL_CondWait(conditional, mutex);//Sleep/wait for the sound thread
+ SDL_mutexV(mutex); // Must unlock the mutex for the cond to work properly...
SDL_mutexP(mutex2);//Re-lock it until we're done with it...
//HMM, this doesn't need to lock or recalculate this value