- I seem to be loading the files correctly from the archive into memory.
- Creating a DMusic segment also seems to work fine.
Where things sometimes go weird is when my memory allocations end up starting at the same spot.
Step #1: Attempt to load file1.wav. To do this I find the length of the data, allocate a byte array to read it in and the load it into memory.
Step #2: Using that buffer I let DMusic create a DMusic segment.
Step #3: I delete the byte array so I'm not leaking memory.
This works fine until the following scenario:
Follow steps 1-3 for file foo.wav. Memory allocation takes place at 0xXXXXXXXX.
Follow steps 1-3 for file foo2.wav. Memory allocation also takes place at 0xXXXXXXXX.
This is a valid scenario since when you allocate memory it could be in the same space since you've already freed it. In the debugger I can see that that memory location contains new data and can even be a new size but my call to the DMusicLoader->GetObject() returns a pointer to the same DMusic segment. It's weird.
I'm pretty sure it's not a multi-threading issue as it happens in my single threaded mode as well.