# Playing 3D sounds in 2.1 crashes

**URL:** https://qa.fmod.com/t/playing-3d-sounds-in-2-1-crashes/15940
**Category:** FMOD Engine
**Created:** [July 3, 2020, 10:23am UTC](https://qa.fmod.com/t/playing-3d-sounds-in-2-1-crashes/15940 "2020-07-03T10:23:07Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![ed\_welch](https://avatars.discourse-cdn.com/v4/letter/e/8baadc/32.png) [@ed\_welch](https://qa.fmod.com/u/ed_welch)
#### Post date: [July 3, 2020, 10:23am UTC](https://qa.fmod.com/t/playing-3d-sounds-in-2-1-crashes/15940/1 "2020-07-03T10:23:07Z")

</div>

I tried upgrading FMod from version 1.10 to 2.1. Normal sounds work find, however playing any 3D sounds causes an immediate crash. This is the code I use

> Blockquote  
> FMOD\_RESULT result;  
> if (type == normal3D || !IsPlaying())  
> {  
> result = FMOD\_System\_PlaySound(  
> m\_pSoundManager-\>m\_pSystem, m\_pFModSound, 0, true, &m\_pChannel);  
> paused = true;  
> if (result != FMOD\_OK)  
> {  
> throw RacException(“FMOD System\_PlaySound error:”, FMOD\_ErrorString(result));  
> }  
> result = FMOD\_Channel\_Set3DMinMaxDistance(m\_pChannel, minDist, 10000.0f);  
> racAssert(result == FMOD\_OK);  
> }  
> racAssert(m\_pChannel != NULL);  
> FMOD\_VECTOR fmPos;  
> fmPos.x = x;  
> fmPos.y = z;  
> fmPos.z = -y;  
> result = FMOD\_Channel\_Set3DAttributes(m\_pChannel, &fmPos, &fmVelocity);  
> racAssert(result == FMOD\_OK);  
> if (paused)  
> {  
> result = FMOD\_Channel\_SetPaused(m\_pChannel, false);  
> racAssert(result == FMOD\_OK);  
> }  
> The crash comes after FMOD\_Channel\_SetPaused, “Run-Time Check Failure #0 - The value of ESP was not properly saved across a function call”

This code worked fine in version 1.10

Also, I notice that FMOD\_Channel\_Set3DAttributes has changed in new version, previously it had 4 parameters

---

<div class="post-metadata">

### Author: ![ed\_welch](https://avatars.discourse-cdn.com/v4/letter/e/8baadc/32.png) [@ed\_welch](https://qa.fmod.com/u/ed_welch)
#### Post date: [July 4, 2020, 11:38am UTC](https://qa.fmod.com/t/playing-3d-sounds-in-2-1-crashes/15940/2 "2020-07-04T11:38:15Z")

</div>

I have been looking at this a bit more and see that it’s the FMOD\_Channel\_Set3DAttributes function that causes the crash. If I remove that call then eveything works fine.

---

<div class="post-metadata">

### Author: ![brett](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/brett/32/261_2.png) [@brett](https://qa.fmod.com/u/brett)
#### Post date: [July 5, 2020, 1:04am UTC](https://qa.fmod.com/t/playing-3d-sounds-in-2-1-crashes/15940/3 "2020-07-05T01:04:34Z")

</div>

Hi, I wonder which compiler you are using? That type of error is usually a marshalling or calling convention issue, it may be to do with a wrapper for a non MS compiler that hasnt been adjusted for the parameter list change.

---

<div class="post-metadata">

### Author: ![brett](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/brett/32/261_2.png) [@brett](https://qa.fmod.com/u/brett)
#### Post date: [July 5, 2020, 1:11am UTC](https://qa.fmod.com/t/playing-3d-sounds-in-2-1-crashes/15940/4 "2020-07-05T01:11:46Z")

</div>

Just checking up on this with a new theory, because i’ve scanned all our files and there are no set3DAttributes mixups with 3 or 4 parameters, everything looks correct.

I’m leaning towards you have a mixed fmod header with a different version of the fmod binary/dll. Have you made sure you have fully upgraded fmod and there are no old files being included?

You can also call System\_GetVersion at runtime to double check against FMOD\_VERSION in the fmod header file.

---

<div class="post-metadata">

### Author: ![ed\_welch](https://avatars.discourse-cdn.com/v4/letter/e/8baadc/32.png) [@ed\_welch](https://qa.fmod.com/u/ed_welch)
#### Post date: [July 5, 2020, 12:57pm UTC](https://qa.fmod.com/t/playing-3d-sounds-in-2-1-crashes/15940/5 "2020-07-05T12:57:33Z")

</div>

> [@brett](#):
>
> System\_GetVersion

I use both visual studio and GCC. Using the GCC version does not cause any problems and FMOD\_Channel\_Set3DAttributes has 4 parameters, back the way it used to be.  
The problem is only when I build with visual studio.  
System\_GetVersion returns 131330 for the visual studio version and 69648 for GCC version

---

<div class="post-metadata">

### Author: ![ed\_welch](https://avatars.discourse-cdn.com/v4/letter/e/8baadc/32.png) [@ed\_welch](https://qa.fmod.com/u/ed_welch)
#### Post date: [July 5, 2020, 1:24pm UTC](https://qa.fmod.com/t/playing-3d-sounds-in-2-1-crashes/15940/6 "2020-07-05T13:24:00Z")

</div>

I just realised that I forgot to copy the new fmod.dll to exe directory and that’s what was causing the crash.

---

<div class="post-metadata">

### Author: ![brett](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/brett/32/261_2.png) [@brett](https://qa.fmod.com/u/brett)
#### Post date: [July 6, 2020, 12:28am UTC](https://qa.fmod.com/t/playing-3d-sounds-in-2-1-crashes/15940/7 "2020-07-06T00:28:22Z")

</div>

ok, you mentioned 2 version numbers, so there was obviously a clash of dlls somewhere. 69648 = 0x11010 = 1.10.10 and 131330 = 0x20102 = 2.01.02

---

<div class="post-metadata">

### Author: ![ed\_welch](https://avatars.discourse-cdn.com/v4/letter/e/8baadc/32.png) [@ed\_welch](https://qa.fmod.com/u/ed_welch)
#### Post date: [July 6, 2020, 8:12am UTC](https://qa.fmod.com/t/playing-3d-sounds-in-2-1-crashes/15940/8 "2020-07-06T08:12:37Z")

</div>

Yes, the GCC was linked to an older version. That was my mistake, sorry. Thanks for the help anyways.
