Jesus, I've been trying to learn it, and the more and more I try, the more and more it looks like Durkadurkanese.
What the hell is this?
[code:1]
LONG lInService = FALSE; // reentrancy semaphore
BOOL AudioStream::ServiceBuffer (void)
{
BOOL fRtn = TRUE;
// Check for reentrance
if (InterlockedExchange (&lInService, TRUE) == FALSE)
{ // Not reentered, proceed normally
// Maintain elapsed time count
m_nTimeElapsed = timeGetTime () - m_nTimeStarted;
// Stop if all of sound has played
if (m_nTimeElapsed < m_nDuration)
{
// All of sound not played yet, send more data to buffer
DWORD dwFreeSpace = GetMaxWriteSize ();
// Determine free space in sound buffer
if (dwFreeSpace)
{
// See how much wave data remains to be sent to buffer
DWORD dwDataRemaining = m_pwavefile->GetNumBytesRemaining ();
if (dwDataRemaining == 0)
{ // All wave data has been sent to buffer
// Fill free space with silence
if (WriteSilence (dwFreeSpace) == FAILURE)
{ // Error writing silence data
fRtn = FALSE;
}
}
else if (dwDataRemaining >= dwFreeSpace)
{ // Enough wave data remains to fill free space in buffer
// Fill free space in buffer with wave data
if (WriteWaveData (dwFreeSpace) == FAILURE)
{ // Error writing wave data
fRtn = FALSE;
}
}
else
{ // Some wave data remains, but not enough to fill free space
// Write wave data, fill remainder of free space with silence
if (WriteWaveData (dwDataRemaining) == SUCCESS)
{
if (WriteSilence (dwFreeSpace - dwDataRemaining) == FAILURE)
{ // Error writing silence data
fRtn = FALSE;
}
}
else
{ // Error writing wave data
fRtn = FALSE;
}
}
}
else
{ // No free space in buffer for some reason
fRtn = FALSE;
}
}
else
{ // All of sound has played, stop playback
Stop ();
}
// Reset reentrancy semaphore
InterlockedExchange (&lInService, FALSE);
}
else
{ // Service routine reentered. Do nothing, just return
fRtn = FALSE;
}
return (fRtn);
}[/code:1]
Dont get me wrong, I get functions, switch statements, if-then, arrays, else, for loops, and all that good basic stuff, I just dont understand why people make shit tutorials on things like structures and classes, and other advanced-beginner things.
For example. lets look at multiple files. As far as I know, to include one file into another, you can use include "<Filename goes here>" for .cpp files, or header files, according to one tutorial, but another says they execute in the order they are listed in the makefile (whatever the hell that is)!
Another says that to declare a structure you can just go like this:
[code:1]
struct blah
{
int blahblah;
int blahblahblah;
int blahblehblah;
} blah1,blah2,blah3; //Like this
blah blah4;//Or this
[/code:1]
..yet another says you have to use a "new" statement to declare one.
And what kind of damn idiot trys to make us learn with cout and cin??? Its 2000-freaking-7 for christ sake, not 1985!
I dont know, maybe I'm a dumbass, and I'm not reading the tutorals right.
It just seems like every one of them out there is designed for 10 year old console applications, and/or is too complex or does not go into it enough.
Gawd.
[/rant]
If you jump high enough you'll hurt your ankles when you land.