Hi, I have a quick question. Do you have to use DuplicateBuffer(), if you want to be playing a buffer from two different locations. Can you just do what you would do in directdraw with a surface:
LPDIRECTDRAWSURFACE7 Surface1, Surface2;
CreateSurface(Surface1); // Create the surface
LoadImageIntoSurface(Surface1, "Something.bmp); // Fill it with data
Surface2 = Surface1; // Have Surface2 point to Surface1
Surface1->AddRef(); // Add a reference to Surface1
Well, I am pretty sure you have to use DuplicateBuffer(), but it seems quite slow so I want to make sure. Also, this doesn't pertain to DirectSound, but, is there any way to get a random number between 2 numbers. For instance, I want to get a number between 12 and 50. I have written a function to do this, but it is quite pimitive. Here is the source:
int RandomIntBetween(int RangeLow, int RangeHigh) {
int RandomNumber; // Random Number holder
for(;;) {
// Get a random number using 'RangeHigh'
RandomNumber = rand() * (RangeHigh+1) / (RAND_MAX + 1);
// If the random number is not between RaneLow
//and RangeHigh, try again.
if(RandomNumber >= RangeLow ) break;
}
return RandomNumber;
};
Although it works, it has the potential to be very slow. If I were to try to get a random number between 50,000 and 51,000 it could take awhile. Well if anyone could help me with either of these two questions, I would definitely appreciate it.
Thanks for your time.
James
Edited by - JSCFaith on October 30, 2001 10:31:04 PM