Jump to content
  • Advertisement
  • entries
    205
  • comments
    228
  • views
    113473

Rip off my ears with a spoon!!

Sign in to follow this  
Mike Bossy

100 views

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.

ie.

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  


0 Comments


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 GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!