Advertisement Jump to content
  • Advertisement
  • entries
  • comments
  • views

Rip off my ears with a spoon!!

Sign in to follow this  
Mike Bossy


Today was all about getting audio files to load from an archive using PhysFS. Everything looked to be really straight forward and I had things up and running in about 30 minutes. I was overjoyed until I started testing the game and found that every once in a while my audio files were getting mixed up. This was totally weird so I started doing some debugging and have narrowed it down a bit.

- 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.
Sign in to follow this  


Recommended Comments

There are no comments to display.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!