0
0

I’ve created a sound sentence, much in the way one of the examples does. I’m calling FMOD_Channel_GetPosition() on the sound like this:

result = FMOD_Channel_GetPosition( ptFModChannel, &nCurrentSoundId, (FMOD_TIMEUNIT)(FMOD_TIMEUNIT_SENTENCE_SUBSOUND));

Occasionally, the ‘result’ returned is FMOD_OK, however ‘nCurrentSoundId’ will have the hex value ‘0xdeafdeaf’. The majority of the time, the result is FMOD_OK, and the nCurrentSoundId is either 0 or 1 (what I would expect).

-sam

  • You must to post comments
0
0

i’m not able to reproduce this, have you done this in the realtimestitching example.

  • You must to post comments
0
0

[quote="brett":1so7ltvr]i’m not able to reproduce this, have you done this in the realtimestitching example.[/quote:1so7ltvr]

Haven’t tried it in the example, have only seen it in my app.

-sam

  • You must to post comments
0
0

Hi,

I was able to spend some more time trying to track this down. I tried a few things in the example, but wasn’t able to reproduce the bug. However, I was able to get some more information about what is going on in my app.

First, for some background..

I’m trying to stitch sounds together into a sentence. I have 3 sounds that are each about 3 seconds in length, and I want to stitch them together in random order. I load potential multiple streams of the 3 samples because way back when I originally wrote this, you couldn’t stitch samples together.. they had to be streams. Maybe this is fixed? Can I finally stitch samples together?

Anyways–on to the issue. I have a parent sound sentence. It has 2 sound children. I play it to loop, and similar to the example, I swap my sound streams in and out of the sentence based on what is playing. The primary difference between my application and the example is that I’m trying to keep allocations to a minimum, so I keep around the old sound streams and re-use them if possible.

I have some memory checking devices in my application. The first device that we use is a small block (currently 16 bytes) at the front and end of each memory block. We write a signature into these blocks, and then when a block is free we validate the signature to make sure the memory block wasn’t being overflowed. It’s pretty simple.

In my original post, I reported that fmod was returning ‘0xdeafdeaf’ sometimes for the current sound id of my sentence. Tracking this bug down recently, 0xdeafdeaf just happens to be the value that we write into the 16 bytes around the memory blocks that we give to fmod. So, first of all, it appears there is a bug in fmod where it is stepping off a memory block it allocated.

I decided to track down which block this was, because I figured this could help you guys track down the bug. Instead of writing a generic ‘0xdeafdeaf’ to the block, I wrote the block allocation number. Since fmod would sometimes return this allocation number when I call FMOD_Channel_GetPosition, I could then figure out which block it was.

So I did this, and it turns out that the block is a 32-byte block allocated by fmod when I set the sound sentence up with this call:

[code:1jur7hnc]

int32 soundlist[2] = { 0, 1 };

result = FMOD_Sound_SetSubSoundSentence(ptFModSound, soundlist, 2);

[/code:1jur7hnc]

The only other thing I can offer you is the bytes of this 32-byte block fmod allocated at the point where fmod returns an invalid subsound index from the call to FMOD_Channel_GetPosition(). Here they are as dwords:

[0x0] 0x00000010 unsigned int
[0x1] 0x00000000 unsigned int
[0x2] 0xcdcdcdcd unsigned int
[0x3] 0x00000001 unsigned int
[0x4] 0x00000000 unsigned int
[0x5] 0x0001fe1c unsigned int
[0x6] 0x00000001 unsigned int
[0x7] 0x000210ac unsigned int

So, can you guys use this to maybe give me a hint if I’m doing something wrong, or what might be happening? Or maybe it would be possible for you to put some asserts or extra checks in your code for FMOD_Channel_GetPosition to validate that the index being returned is in a valid range?

In this most recent round of testing, I am using the win32 version 4.14.02 of fmod.

thanks,
sam

  • You must to post comments
0
0

Newer versions of fmod have sample stitching, and getposition was altered a bit to fix an accuracy issue to do with threading, i’d suggest you try it out.

  • You must to post comments
0
0

[quote="brett":t5gh3kxt]Newer versions of fmod have sample stitching, and getposition was altered a bit to fix an accuracy issue to do with threading, i’d suggest you try it out.[/quote:t5gh3kxt]

Hi,

My testing was with fmod version 4.14.02 on win32, which was the latest stable version available as of last Thursday or so. I see that 4.14.03 is now available, but it doesn’t look like it has any changes that would explain what I’m seeing.. Is there some other change you are aware of that would fix the bug that I’m reporting? Because otherwise I’d rather not waste my time testing this again..

-sam

  • You must to post comments
0
0

Sorry i missed the bit right at the bottom where you said that.
You won’t have to upgrade in this case, it wouldnt help.
We’ll see if any of the clues you provided make sense here.

  • You must to post comments
0
0

I noticed in your initial post you are not using the FMOD_TIMEUNIT_BUFFERED flag like in the realtimestitching example. This flag will give you the buffered position which is what you need if you are swapping subsound around.

I can see potential problems with getPosition (when not using the buffered flag) if you are calling getPosition from another thread, is this the case? When using setSubSoundSentence the sentence list is freed and reallocated, so there could be timing related issues here if you are using multiple threads.

  • You must to post comments
0
0

[quote="mathew":32wn6op0]I noticed in your initial post you are not using the FMOD_TIMEUNIT_BUFFERED flag like in the realtimestitching example. This flag will give you the buffered position which is what you need if you are swapping subsound around.

I can see potential problems with getPosition (when not using the buffered flag) if you are calling getPosition from another thread, is this the case? When using setSubSoundSentence the sentence list is freed and reallocated, so there could be timing related issues here if you are using multiple threads.[/quote:32wn6op0]

Hi Mathew,

I’m not using the buffered query because I’m trying to use this to find out the current playing sound for our debug sound display. In the case where I’m trying to figure out if it’s time to stitch in a new sound, I do use the buffered query, and I have never had any issue with that returning an invalid value.

I’m making both of these calls from our main application thread, so I don’t think that there is a multi-threading issue on the application end.. In fact, we only ever access the fmod api from our main application thread.

-sam

  • You must to post comments
0
0

I have found an internal threading issue concerning setSubSoundSentence that may be causing the corruption you are experiencing. The fix will be in the latest version of each supported branch after our next release.

Also to follow up on one of your above questions, we now support sample stitching, you don’t have to use streams if you don’t want to.

  • You must to post comments
0
0

[quote="mathew":1a2fjlgr]I have found an internal threading issue concerning setSubSoundSentence that may be causing the corruption you are experiencing. The fix will be in the latest version of each supported branch after our next release.

Also to follow up on one of your above questions, we now support sample stitching, you don’t have to use streams if you don’t want to.[/quote:1a2fjlgr]

Hi Matthew,

Thanks for looking into this.

I have a question about stitching in samples instead of streams. Typically what my sound designer does for sounds like this is to take 3 or 4 samples of about 2 seconds in length which are then stitched together in random order. He then drops instances of this sound in the app.

So when it comes time for me to play them, I load the 3 samples, then create the instance of the sound sentence to stitch them together, and then play it and update the stitching as the sound plays. I think this is fairly straight forward.

I’m running into an issue when the designer places 2 instances of these sounds within close proximity of each other. What I would ideally like to do in that case is just have 2 different instances of the stitching sounds that are sharing the 3 sampled sounds. However, when I do this, I run into this error:

[code:1a2fjlgr]
FMOD Error during ‘FMOD_Sound_SetSubSound’: This subsound is already being used by another sound, you cannot have more than one parent to a sound. Null out the other parent’s entry first.
[/code:1a2fjlgr]

Oddly enough, when I get this error, fmod will no longer play any sampled sound I try to play, but that’s another issue…

I realize I could fix this by duplicating the sound samples, but that seems like a waste of memory to me. It would be very helpful if the 2 sounds that are stitching in the samples could share the same set of samples. Is there a way to do this now? Maybe I’m just missing it..

thanks,
sam

  • You must to post comments
Showing 10 results
Your Answer

Please first to submit.