I just write cos i want to implement faster dsound routines. What im currently doing is to have my own write cursor and a function "CanWrite()" that tell me if there is enoughf space to stream the data. But there is a cons to this when i fill my own buffer with NES sound data (2048 bytes) and then i send you to the function that will play the buffer, the only way to get more or less good sound (no distorded, etc) is to have inside de playbuffer func. a line of code like:
CanWrite return the number of bytes that can be written.
that is done in the playbuffer function and the problem is that the while nevers exits if the amount of memory in the dsound buffer is, as the code line says < buffer_size.
It actually works (dont get stuck), but it keeps waiting to have a razonable amount of mem to write to the buffer which make my emulation slower.
I thought that making it MultiThreaded could solve the problem, but i dont want to do it that way.
Any idea/suggestion?
Code:
While (CanWrite() < buffer_size);
CanWrite return the number of bytes that can be written.
that is done in the playbuffer function and the problem is that the while nevers exits if the amount of memory in the dsound buffer is, as the code line says < buffer_size.
It actually works (dont get stuck), but it keeps waiting to have a razonable amount of mem to write to the buffer which make my emulation slower.
I thought that making it MultiThreaded could solve the problem, but i dont want to do it that way.
Any idea/suggestion?