0
0

4.08.05

Windows Vista Home
Laptop (el80)
http://www.asimobile.com/inetpub/ftproot/

1)
FMOD_System_Init()
Causes a click/tick sound sometimes with reverb

2)
And this one, is difficult to ignore and replicate. I actually menionned it yesterday but deleted the topic when I tought it was my code… But, after intense trouble shooting (keep in mind, I can’t run fmodexL), I’m pretty confident it’s a genuine bug.

I have 1 2d sound initialised with FMOD_LOOP_OFF | FMOD_HARDWARE… A midi sound
I have 75+ sounds (wav) initialized with FMOD_LOOP_OFF | FMOD_3D | FMOD_HARDWARE | FMOD_3D_LINEARROLLOFF

I have an option to stream or not
[code:3s7jrnxk]
if(streamed)
{
FMODASSERT(FMOD_System_CreateStream(mainsystem, soundfile, flags, 0, &sound));
}
else
{
FMODASSERT(FMOD_System_CreateSound(mainsystem, soundfile, flags, 0, &sound));
}
[/code:3s7jrnxk]

I have a listenner and do the proper calls related to that…
If I play/loop the 3d sounds, world relative, at one point, When getChannelsPlaying reaches 75 or higher, my 2d sound becoumes 3d world relative on it’s own and stops playing depending on where my listenner is. The other 3d sounds which were fine when count < 75 will stop, and sometimes, later one, will seem to "fight" with each other to play

My 2d sound is priority 128
my 3d sounds are priority 192
My system is initialized with 1000 possible channels.

If the sounds are streamed, the problem does not occure (I had a bug before wich made all my sounds streamed which I fixed and discovered this bug).

I noticed that getChannelsPlaying almost never drop, it gradually keeps climbing every time I play a sound (not looped)… It actually drops once in a while but the drop is not relative to the sounds I played…

rehashed-
If I have 30 looped sounds, the count will be 30. Then I play a sound (once) and the count goes to 31 but does not go back to 30 when the sound is done.

I know it’s possible that I am at fault her so here are the functions pertinent to loading/playind sounds for your review. If you want the whole code, tell me
[code:3s7jrnxk]
export double FMODSoundAdd(LPCSTR soundfile, double threed, double streamed)
{
if(!inited) return 0;
FMOD_SOUND *sound;

DWORD flags = FMOD_LOOP_OFF | FMOD_HARDWARE;
if(threed) flags = FMOD_LOOP_OFF | FMOD_3D | FMOD_HARDWARE | FMOD_3D_LINEARROLLOFF;

if(streamed)
{
    FMODASSERT(FMOD_System_CreateStream(mainsystem, soundfile, flags, 0, &amp;sound));
}
else
{
    FMODASSERT(FMOD_System_CreateSound(mainsystem, soundfile, flags, 0, &amp;sound));
}

myinfo *mi = (myinfo *)GlobalAllocPtr(GMEM_FIXED|GMEM_ZEROINIT,(sizeof(myinfo)));
if(mi == NULL) {FMODASSERT(FMOD_ERR_MEMORY);}
mi-&gt;maxvolume = 1;
//all other members set by GMEM_ZEROINIT

FMODASSERT(FMOD_Sound_SetUserData(sound, (void *)mi));

return (DWORD) sound;

}

export double FMODSoundInstanciate(double sound)
{
if(!inited) return 0;
if(!(sound>0)) return 0;

void *a;

FMODASSERT(FMOD_Sound_GetUserData((FMOD_SOUND *)(DWORD)sound, &amp;a));

FMOD_CHANNEL *channel;
FMODASSERT(FMOD_System_PlaySound(mainsystem, FMOD_CHANNEL_FREE, (FMOD_SOUND *)(DWORD)sound, true, &amp;channel));

myinfo *mi = (myinfo *) a;
mi-&gt;channel = channel;
FMODASSERT(FMOD_Channel_SetVolume(channel,mi-&gt;maxvolume));
if(mi-&gt;group == 1)
{
    FMODASSERT(FMOD_Channel_SetChannelGroup(channel,priority));
    FMODASSERT(FMOD_Channel_SetPriority(channel,0));
}
else if(mi-&gt;group == 2)
{
    FMODASSERT(FMOD_Channel_SetChannelGroup(channel,effects));
    FMODASSERT(FMOD_Channel_SetPriority(channel,64));
}
else if(mi-&gt;group == 3)
{
    FMODASSERT(FMOD_Channel_SetChannelGroup(channel,ambientmusic));
    FMODASSERT(FMOD_Channel_SetPriority(channel,128));
}
else if(mi-&gt;group == 4)
{
    FMODASSERT(FMOD_Channel_SetChannelGroup(channel,ambienteffects));
    FMODASSERT(FMOD_Channel_SetPriority(channel,192));
}

if(mi-&gt;effects)
{
    if(mi-&gt;chorus)
    {
        FMODASSERT(FMOD_Channel_AddDSP(channel,mi-&gt;chorus));
    }
    if(mi-&gt;echo)
    {
        FMODASSERT(FMOD_Channel_AddDSP(channel,mi-&gt;echo));
    }
    if(mi-&gt;gargle)
    {
        FMODASSERT(FMOD_Channel_AddDSP(channel,mi-&gt;gargle));
    }
    if(mi-&gt;flanger)
    {
        FMODASSERT(FMOD_Channel_AddDSP(channel,mi-&gt;flanger));
    }
    if(mi-&gt;reverb)
    {
        FMODASSERT(FMOD_Channel_AddDSP(channel,mi-&gt;reverb));
    }
    if(mi-&gt;compressor)
    {
        FMODASSERT(FMOD_Channel_AddDSP(channel,mi-&gt;compressor));
    }
    if(mi-&gt;equalizer)
    {
        FMODASSERT(FMOD_Channel_AddDSP(channel,mi-&gt;equalizer));
    }
}
return (DWORD) channel;

}
export double FMODSoundLoop(double sound, double paused)
{
if(!inited) return 0;
if(!(sound>0)) return 0;

FMOD_CHANNEL * channel = (FMOD_CHANNEL *)(DWORD) FMODSoundInstanciate(sound);
if(channel == NULL) return 0;

FMODASSERT(FMOD_Channel_SetLoopCount(channel,-1));
FMODASSERT(FMOD_Channel_SetMode(channel,FMOD_LOOP_NORMAL));
if(!paused) {FMODASSERT(FMOD_Channel_SetPaused(channel,false));}
return (DWORD) channel;

}
export double FMODSoundPlay(double sound, double paused)
{
if(!inited) return 0;
if(!(sound>0)) return 0;

FMOD_CHANNEL * channel = (FMOD_CHANNEL *)(DWORD) FMODSoundInstanciate(sound);
if(channel == NULL) return 0;

if(!paused) FMODASSERT(FMOD_Channel_SetPaused(channel,false));
return (DWORD) channel;

}
export double FMODSoundLoop3d(double sound, double x, double y, double z, double paused)
{
if(!inited) return 0;
if(!(sound>0)) return 0;

FMOD_CHANNEL * channel = (FMOD_CHANNEL *)(DWORD) FMODSoundInstanciate(sound);
if(channel == NULL) return 0;

FMODASSERT(FMOD_Channel_SetLoopCount(channel,-1));
FMODASSERT(FMOD_Channel_SetMode(channel,FMOD_3D_WORLDRELATIVE | FMOD_LOOP_NORMAL));

FMOD_VECTOR pos;
pos.x = x;//* worldscale;
pos.y = y;//* worldscale;
pos.z = z;//* worldscale;
FMOD_VECTOR vel = {  0.0f, 0.0f, 0.0f };
FMODASSERT(FMOD_Channel_Set3DAttributes(channel,&amp;pos,&amp;vel));

void *a;
FMODASSERT(FMOD_Sound_GetUserData((FMOD_SOUND *)(DWORD)sound, &amp;a));
myinfo *mi = (myinfo *) a;
if(mi-&gt;minmaxset)
{
    FMODASSERT(FMOD_Channel_Set3DMinMaxDistance(channel, mi-&gt;mind,mi-&gt;maxd));
    FMODASSERT(FMOD_Sound_Set3DMinMaxDistance((FMOD_SOUND *)(DWORD)sound, mi-&gt;mind,mi-&gt;maxd));
}
if(mi-&gt;coneset)
{
    FMODASSERT(FMOD_Channel_Set3DConeSettings(channel, mi-&gt;insideconeangle,mi-&gt;outsideconeangle,mi-&gt;outsidevolume));
    FMODASSERT(FMOD_Sound_Set3DConeSettings((FMOD_SOUND *)(DWORD)sound,  mi-&gt;insideconeangle,mi-&gt;outsideconeangle,mi-&gt;outsidevolume));
}
if(mi-&gt;maxdopplerset)
{
    FMODASSERT(FMOD_Channel_Set3DDopplerLevel(channel, mi-&gt;maxdoppler));
}
if(!paused) FMODASSERT(FMOD_Channel_SetPaused(channel,false));
return (DWORD) channel;

}

export double FMODSoundPlay3d(double sound, double x, double y, double z, double paused)
{
if(!inited) return 0;
if(!(sound>0)) return 0;

FMOD_CHANNEL * channel = (FMOD_CHANNEL *)(DWORD) FMODSoundInstanciate(sound);
if(channel == NULL) return 0;

FMODASSERT(FMOD_Channel_SetMode(channel,FMOD_3D_WORLDRELATIVE));

FMOD_VECTOR pos;
pos.x = x;//* worldscale;
pos.y = y;//* worldscale;
pos.z = z;//* worldscale;
FMOD_VECTOR vel = {  0.0f, 0.0f, 0.0f };
FMODASSERT(FMOD_Channel_Set3DAttributes(channel,&amp;pos,&amp;vel));

void *a;
FMODASSERT(FMOD_Sound_GetUserData((FMOD_SOUND *)(DWORD)sound, &amp;a));
myinfo *mi = (myinfo *) a;

if(mi-&gt;minmaxset)
{
    FMODASSERT(FMOD_Channel_Set3DMinMaxDistance(channel, mi-&gt;mind,mi-&gt;maxd));
    FMODASSERT(FMOD_Sound_Set3DMinMaxDistance((FMOD_SOUND *)(DWORD)sound, mi-&gt;mind,mi-&gt;maxd));
}
if(mi-&gt;coneset)
{
    FMODASSERT(FMOD_Channel_Set3DConeSettings(channel, mi-&gt;insideconeangle,mi-&gt;outsideconeangle,mi-&gt;outsidevolume));
    FMODASSERT(FMOD_Sound_Set3DConeSettings((FMOD_SOUND *)(DWORD)sound,  mi-&gt;insideconeangle,mi-&gt;outsideconeangle,mi-&gt;outsidevolume));
}
if(mi-&gt;maxdopplerset)
{
    FMODASSERT(FMOD_Channel_Set3DDopplerLevel(channel, mi-&gt;maxdoppler));
}

if(!paused) FMODASSERT(FMOD_Channel_SetPaused(channel,false));
return (DWORD) channel;

}

export double FMODInstanceSet3dPosition(double channel,double x,double y,double z)
{
if(!inited) return 0;
if(!(channel>0)) return 0;
FMOD_VECTOR pos;

FMOD_VECTOR vel = {  0.0f, 0.0f, 0.0f };
if(deltatime)
{
    FMODASSERT(FMOD_Channel_Get3DAttributes((FMOD_CHANNEL*)(DWORD)channel,&amp;pos,0));
    vel.x = (x-pos.x)*worldscale * deltatime;
    vel.y = (y-pos.y)*worldscale * deltatime;
    vel.z = (z-pos.z)*worldscale * deltatime;
}
pos.x = x;//* worldscale;
pos.y = y;//* worldscale;
pos.z = z;//* worldscale;
FMODASSERT(FMOD_Channel_Set3DAttributes((FMOD_CHANNEL*)(DWORD)channel,&amp;pos,&amp;vel));

return 1;

}
[/code:3s7jrnxk]

  • You must to post comments
0
0

Ok i didnt realize ‘.gmk’ was a source file. I was looking for c or cpp source.
The line "You need gameMaker 7 Pro" is going to make this really difficult we’re stretched for time as it is an overly complicated repro steps like this is just going to take to much time when it is [i:37qigfbr]most likely an issue in this wrapper[/i:37qigfbr]. As mentioned if you can repro the issue outside of that wrapper i’ll be happy to take a look at it personally. If not we’ll have to possibly try a debug dll replacement and debug it that way using the executable.

  • You must to post comments
0
0

You specified FMOD_HARDWARE even you want to add software effects, you should be using FMOD_SOFTWARE.

The problem is probably your soundcard driver. You can either switch to FMOD_SOFTWARE or try clamping the maximum possible hw voices with System::setHardwareChannels.

As for your 1st bug that is not an FMOD bug, it is probably your soundcard resetting when dsound is initialized. You said ‘with reverb’ but there is no reverb with FMOD until after FMOD is initialized and you call System::setReverbProperties?

  • You must to post comments
0
0

[quote="mac_bug":2ugpqxmf]Why don’t you go into the fmod examples and modify one of the existing ones instead of having us all download and run your seemingly overly complicated setup. the playsound example itself has channels playing stat and it shows proper number of channels playing when i press a key to play[/quote:2ugpqxmf]

Real the whole thread…

[quote="brett":2ugpqxmf]Ok i didnt realize ‘.gmk’ was a source file. I was looking for c or cpp source.
The line "You need gameMaker 7 Pro" is going to make this really difficult we’re stretched for time as it is an overly complicated repro steps like this is just going to take to much time when it is [i:2ugpqxmf]most likely an issue in this wrapper[/i:2ugpqxmf]. As mentioned if you can repro the issue outside of that wrapper i’ll be happy to take a look at it personally. If not we’ll have to possibly try a debug dll replacement and debug it that way using the executable.[/quote:2ugpqxmf]

The PM I sent with the password protected download file (which I know you got) shows you the code in the doc file. You can also download GM here… If you really want to see the code in context.

http://www.yoyogames.com/make

If you want to compile and run the code from GM then you’re gonna have to dish out the 20$. It takes 2 minutes to download, install register and use.

You don’t need it. You have the exe and the dll code which you can compile with debug information and debug the dll. Just set the calling application to the test harness… Put a break point in the dll code right before the System_SoundPlay call. If you have another debugger set up for your dll, usually, you can tell the debugger to "wait for the dll to start" you should be able to step through my and your dll code.

If you have bounds checker, you can simply run the exe within BC and it will tell you everything from the start, overruns, bad calls, anything you can think that can go wrong, it will report. You don’t even need to do anything else but start the exe from BC. If it finds a problem in a dll and it was compiled with debug information and it knows were the source code it, it will show exactly where the “potential” problem is.

Bounds Checker or not, there are 1001 ways to set this up. You don’t need the original exe source to debug a dll. And, since I don’t know what GM does, I surely cannot write an exe that will replicate it’s internals to bring the whole setup into the context where this problem occurs.

BTW. I would be done by now… and have a preliminary report on the bounds checker/debug result to confirm or not what is going on. At least confirm the extra channel… Since you are so much stressed for time, why did you not do it right away?

I did not plan to turn this into a GD tennis match… We’ve wasted so much time talking about this, pointing fingers back and forth. I mean WHY. All that was needed was 5 minutes of debugging which could have been done from day 1 and this thread would not be filled with all this nonsense.

In return you would have had access to a knowledgeable GM user which is well respected in the Game Maker Community (50000+ potential customers of your product). Now, I have a good mind to terminate this endeavour and simply state in my sound extension thread that I cannot publish the sound engine due to incompatibility issues.

Frankly, I would much rather you a find a major flaw in my code than simply terminate the project. If you have problem running within GM and my wrapper, surely there are other context where you will have difficulties running under.

  • You must to post comments
0
0

[quote="brett":2srderso]You specified FMOD_HARDWARE even you want to add software effects, you should be using FMOD_SOFTWARE.

The problem is probably your soundcard driver. You can either switch to FMOD_SOFTWARE or try clamping the maximum possible hw voices with System::setHardwareChannels.

As for your 1st bug that is not an FMOD bug, it is probably your soundcard resetting when dsound is initialized. You said ‘with reverb’ but there is no reverb with FMOD until after FMOD is initialized and you call System::setReverbProperties?[/quote:2srderso]

The tic (with reverb sometimes) is gone with v4.08.06

As for the multi channels freaking out using unstreamed sound, I still have the problem

Init code
[code:2srderso]
export double FMODinit(double maxsounds)
{
if(inited) {FMODASSERT(FMOD_ERR_INITIALIZED);}
memset(curpassword,0,256);
FMOD_RESULT result;
unsigned int version;
FMOD_SPEAKERMODE speakermode;
FMOD_CAPS caps;

/*
    Create a System object and initialize.
*/

FMODASSERT(FMOD_System_Create(&amp;mainsystem));        // Create the main system object.

FMODASSERT(FMOD_System_GetVersion(mainsystem,&amp;version));

if (version &lt; FMOD_VERSION)
{
    MessageBeep(MB_ICONWARNING);
    MessageBoxA(GetActiveWindow(),&quot;initFMOD-Incompatible fmodex.dll found. It's possible another game or product is running using and older version of this dll or the supplied fmod dll is incompatible.&quot;, &quot;FMOD Error&quot;, MB_ICONSTOP);
    FMODASSERT(FMOD_ERR_VERSION);
}

FMODASSERT(FMOD_System_GetDriverCaps(mainsystem, 0, &amp;caps, 0, 0, &amp;speakermode));
FMODASSERT(FMOD_System_SetSpeakerMode(mainsystem,speakermode));       /* Set the user selected speaker mode. */

if (caps &amp; FMOD_CAPS_HARDWARE_EMULATED)             /* The user has the 'Acceleration' slider set to off!  This is really bad for latency!. */
{                                                   /* You might want to warn the user about this. */
    MessageBeep(MB_ICONWARNING);
    MessageBoxA(GetActiveWindow(),&quot;You've turned windows 'Acceleration' too low and will experience major slow downs. You can fix this in the control panel's hardware acceleration options. Location varies depending your Windows version.&quot;, &quot;FMOD Warning&quot;, MB_ICONWARNING);
    //Dont care if this fails
    FMOD_System_SetDSPBufferSize(mainsystem,1024, 10);    /* At 48khz, the latency between issuing an fmod command and hearing it will now be about 213ms. */
}
FMOD_System_SetHardwareChannels(mainsystem, 32, 64, 32, 64);
FMOD_System_SetSoftwareChannels(mainsystem,100);

result = FMOD_System_Init(mainsystem,(int)maxsounds, FMOD_INIT_NORMAL /*|FMOD_INIT_VOL0_BECOMES_VIRTUAL*/ , 0); // Initialize FMOD.
if (result == FMOD_ERR_OUTPUT_CREATEBUFFER) 
{ 
   FMOD_System_SetSpeakerMode(mainsystem,FMOD_SPEAKERMODE_STEREO);
   result = FMOD_System_Init(mainsystem,(int)maxsounds, FMOD_INIT_NORMAL /*| FMOD_INIT_VOL0_BECOMES_VIRTUAL*/ , 0);
}
FMODASSERT(result);

FMODASSERT(FMOD_System_CreateChannelGroup(mainsystem, &quot;priority&quot;, &amp;priority));
FMODASSERT(FMOD_System_CreateChannelGroup(mainsystem, &quot;effects&quot;, &amp;effects));
FMODASSERT(FMOD_System_CreateChannelGroup(mainsystem, &quot;ambientmusic&quot;, &amp;ambientmusic));
FMODASSERT(FMOD_System_CreateChannelGroup(mainsystem, &quot;ambienteffects&quot;, &amp;ambienteffects));
FMOD_CHANNELGROUP *maingrp;
FMODASSERT(FMOD_System_GetMasterChannelGroup(mainsystem, &amp;maingrp));
FMODASSERT(FMOD_ChannelGroup_AddGroup(maingrp,priority));
FMODASSERT(FMOD_ChannelGroup_AddGroup(maingrp,effects));
FMODASSERT(FMOD_ChannelGroup_AddGroup(maingrp,ambientmusic));
FMODASSERT(FMOD_ChannelGroup_AddGroup(maingrp,ambienteffects));


FMODASSERT(FMOD_System_SetFileSystem(mainsystem,myopen, myclose, myread, myseek,2048));

inited = true;
return (double) 1;

}
[/code:2srderso]

Sound add code
[code:2srderso]
export double FMODSoundAdd(LPCSTR soundfile, double threed, double streamed)
{
if(!inited) {{FMODASSERT(FMOD_ERR_INITIALIZATION);}}
FMOD_SOUND *sound = NULL;

DWORD flags = FMOD_LOOP_OFF | FMOD_2D | FMOD_SOFTWARE;
if(threed)
{
    //MessageBoxA(GetActiveWindow(),soundfile,(LPCSTR)&quot;3d&quot;,MB_ICONINFORMATION);
    flags = FMOD_LOOP_OFF | FMOD_3D | FMOD_SOFTWARE | FMOD_3D_LINEARROLLOFF;
}
else
{
    //      MessageBoxA(GetActiveWindow(),soundfile,(LPCSTR)&quot;2D&quot;,MB_ICONINFORMATION);
}
if(streamed)
{
   FMODASSERT(FMOD_System_CreateStream(mainsystem, soundfile, flags, 0, &amp;sound));
}
else
{
    FMODASSERT(FMOD_System_CreateSound(mainsystem, soundfile, flags, 0, &amp;sound));
}

if(sound == NULL) {{FMODASSERT(FMOD_ERR_INVALID_HANDLE);}}

myinfo *mi = (myinfo *)GlobalAllocPtr(GMEM_FIXED|GMEM_ZEROINIT,(sizeof(myinfo)));
if(mi == NULL) {FMODASSERT(FMOD_ERR_MEMORY);}
mi-&gt;maxvolume = 1;
strcpy(mi-&gt;file,soundfile);
mi-&gt;threed =(threed);
mi-&gt;streamed =(streamed);
//all other members set by GMEM_ZEROINIT

FMODASSERT(FMOD_Sound_SetUserData(sound, (void *)mi));

return (double) (DWORD) sound;

}

[/code:2srderso]

I added FMOD_System_SetHardwareChannels(mainsystem, 32, 64, 32, 64);

then, when that failed

FMOD_System_SetSoftwareChannels(mainsystem,100);

I still have the problem.

To rehash, re explain, creating multiple channels playing the same unstreamed sound, the channel count (System::getChannelsPlaying) keeps going up and never drops when the sound stops. After a period of time, the system freaks out (see below)

OK, this sample actually has the same problem with one difference. I play one instance per sound, except the crash sound wich is shared (multi instance/channel of the same sound)…

[url=http://host-a.net/icuurd12b42/GMFMODSimpleDemoBUG.zip:2srderso][img:2srderso]http://host-a.net/icuurd12b42/GMFMODSimpleDemoBUG.zip/link.png[/img:2srderso][/url:2srderso]
I included both streamed and unstreamed version… The streamed version works flawlesly. You can see the count at the upper left go up and down.

When it hits 70-80 (120-150 if i started with 4-10 sounds playing. 70-80 is when I started with 30 sounds initially), my 2d sound becomes 3d and stops/start playing depending on where the listenner is and all my 3d sounds stop. And the system freezes, depending on my location in the "world" and tries to play a few sounds and I hear a few blurbs.

Each car has 2 sounds that they load. Motor and beep (or siren for cops)
Each car loops the motor sound (1 instance/sound/car) and plays (once) the beep if you get in from of it (1 instance/sound/car). So, If you have 10 cars, you start with 20 sounds, 10 instances (motors looping) When you pass in from of the car you will see the count climb when it beeps.

You car just has it’s motor sound (2d)

Another sound is loaded (the crash sound wich is shared) but I only play it if the listenner is close enough to hear it… Same for the beep and sirens

Finally, 1 2D background music

asdw to move, up down arrow to zoom. Space to enter edit mode to change settings and add/change sounds.

Anyway. it’s simpler to see it in action than to try to explain it all. You can add sounds of any setting and start them up. You can even click a car to set it’s own music. Pretty funny, like turning it’s stereo ON.

So, to recap, the streamed works fine.
The non streamed version will crap out right away if you leave the settings at 100 cars, 10 cops. If you lower the car count to 10 and cops to 10, it should crap out after you crash with cars a few (20-30) times or make them beep.

Anyway.
I fail to see why streamed sound dont have the problem… If it’s really related to my sounds not being in SW mode or my sound card not having enough channels/not initialised properly, both test bench should fail in the same manner no? just trying to reason out loud here.

If I am at fault, I would be more than happy if you would provide me with the proper initialization sequence so my simple dll is compatible with most every sound cards so people can use it in a similar setup as the test bench.

Regards,
icuurd12b42

  • You must to post comments
0
0

I’m not sure what part of ‘stressed for time’ you dont understand but it doesnt mean ‘i’ll get onto your issue straight away’ because we have many developers trying to ship games now and they are taking priority. Please just be a bit patient, we’ll try using a debug dll on the executable when one of us has time and see what’s happening.

  • You must to post comments
0
0

You didnt provide any source for that zip file so I’m not sure I can do anything there. You’re going to have to create a simple void main example to illustrate your problem.
If channel count is going up, have you checked all of your voices to see if they’re still playing. If they’re still playing, then check why they are still playing. They’re probably looping and you haven’t made them stop yet.

  • You must to post comments
0
0

icuurd12b42 can you tone down on the insults? I’m sure Brett has had much more experience in this regard than you. He’s a busy man who probably has to deal with many large clients from the game industry, making assumptions about him isn’t going to get you anywhere. Give the man some respect and let him do his job.

  • You must to post comments
0
0

[quote="brett":212vv2sh]You didnt provide any source for that zip file so I’m not sure I can do anything there. You’re going to have to create a simple void main example to illustrate your problem.
If channel count is going up, have you checked all of your voices to see if they’re still playing. If they’re still playing, then check why they are still playing. They’re probably looping and you haven’t made them stop yet.[/quote:212vv2sh]

OK. My internet connection crashed sending you a PM so I will add this here to make sure it’s goes through

I pin pointed the proplem to
FMODASSERT(FMOD_System_PlaySound(mainsystem, FMOD_CHANNEL_FREE, (FMOD_SOUND *)(DWORD)sound, true, &channel));

Turns out, when the sound is not streamed, this creates [b:212vv2sh]2[/b:212vv2sh] channel instances. Verified by FMD_System_GetCannelsPlaying().

When I unpause the channel later on once I am done setting it up (I started the sound with pause ON), it unpauses the channel returned but not the paused [b:212vv2sh]ghost[/b:212vv2sh] channel.

The effect is that I get a ton of "ghost" paused channels that are never unpaused or updated… and consequently, never removed from the playing stack.

If i use
FMODASSERT(FMOD_System_PlaySound(mainsystem, FMOD_CHANNEL_FREE, (FMOD_SOUND *)(DWORD)sound, [b:212vv2sh]false[/b:212vv2sh], &channel));

Then I actually hear the 2 sounds… Since I updated the retuned channel’s 3d position and doppler, I hear a regular sound playing and the real one with movement and doppler.

This stops the freaking out issue but the side effect of hearing an extra sound out of nowhere makes this solution nill.

  • You must to post comments
0
0

[quote="sgugler":224yhzc4]Hmm, couple of random thoughts from a fellow developer.

Have you tried calling PlaySound directly, without the FMODASSERT? Is it possible your macro is causing its argument to be evaluated twice?

Are you calling FMOD_System_Update often enough?[/quote:224yhzc4]

FMOD_System_Update is called every frame and the assert macro should not be at fault. You can verify the code in the download link.

[quote="brett":224yhzc4]I’m not sure what part of ‘stressed for time’ you dont understand but it doesnt mean ‘i’ll get onto your issue straight away’ because we have many developers trying to ship games now and they are taking priority. Please just be a bit patient, we’ll try using a debug dll on the executable when one of us has time and see what’s happening.[/quote:224yhzc4]

Sorry and thanks… And I do understand what stressed for time means. So don’t worry about fixing it right away. I am not stressed for time myself. My issue with this is not the speed of execution but the impression that the issue was repeatedly dismissed after all that was needed to verify the problem was given. Emphasis on Impression… Not to say you haven’t tried, I don’t know if you did. Really that is the point. When I was in your situation, a long time ago, dealing with this kind of problem report, standard procedure was to execute and debug the problem right away and report back to confirm the problem. The industry, over the last ten years seems to have taken an odd turn somewhere. Where it seems a lot of effort is wasted passing on blame than taking action. Considering I was in your shoes 20 years ago and looking at the overall state of the industry, compounded with a few personal bad experiences with a few tech support departments this year. I guess you got on the receiving end of cumulated crap.

[quote="Bladezor":224yhzc4]icuurd12b42 can you tone down on the insults? I’m sure Brett has had much more experience in this regard than you. He’s a busy man who probably has to deal with many large clients from the game industry, making assumptions about him isn’t going to get you anywhere. Give the man some respect and let him do his job.[/quote:224yhzc4]

No prob and reread my thread. You will find I lost patience when it was stated the code was never included when the password protected download showed it was downloaded. That was enough to make me snap and go on the offensive. I’m not saying I had the rights to do so.

  • You must to post comments
0
0

This cannot be an fmod bug it has to be a logic issue with your code. Is your playsound being called twice accidently? There’s no way 2 voices get spawned from 1 playsound, it’s just not possible. Please show me a simple void main test app that reproduces your issue .

  • You must to post comments
0
0

icuurd12b42, you may wish to do more debugging on your end. I tried to replicate the bug you suggested with my own API wrapper (thus, the only common things were Game Maker 7.0 Pro and fmodex.dll) and couldn’t replicate the behavior.

However, maybe I am mis reading the exact error here (if so, please clarify so I can try a better replication test). After playing the the demo, it appears that the bug is your sound, when not streamed, is not clearing a channel. Thus, eventually all channels become ‘full’ and you are unable to play anymore sounds.

[i:1x022ioo]The Test[/i:1x022ioo]
Now I’ve tried to understand your source code…but quite frankly, it’s a mess. So I decided instead to see if I could replicate the error myself, with my own API wrapper…in those tests, I was unable to re-create the bug.

In my example, I loaded a single sound without streaming (similar to your example) and then played it over and over and over. For me, the channels cleared just fine and I never got to a point where all my channels would ‘fill’. Thus causing sound dropping/etc.

[i:1x022ioo]Personal Note[/i:1x022ioo]
Anyway, the best thing you can do here for Brett is to make a C/C++ program that shows the same behavior. If you can’t, then Brett (and the others) will assume it’s the wrapper at fault since you can’t show the bug in an environment fmod was designed to run in. They aren’t here to debug your wrapper issue, they have many more important matters to deal with.

So what I recommend is seeing if you can reproduce this error outside of GM and more importantly, outside your API. If not, then the fault is probably not the fmodex.dll, but rather your own coding.

~Brandon

  • You must to post comments
0
0

[quote="brett":22lmy3b0]This cannot be an fmod bug it has to be a logic issue with your code. Is your playsound being called twice accidently? There’s no way 2 voices get spawned from 1 playsound, it’s just not possible. Please show me a simple void main test app that reproduces your issue .[/quote:22lmy3b0]

Never say never my friend… Nobody writes perfect code for multiple platforms…

And don’t be so defensive… Did you read my PM about possible memory issues? You have not replied so I have no clue if you actually read my stuff… You have the dll code and the test bench. I can send you the new test bench and you can compile the dll and try it for yourself. I already told you (though it’s at a time where I had a bad internet connection, so I’ll give you the benifit of the doubt), that your and my dll work fine in a regular winmain C program. So does your example. So, like I said in the PM, memory issue?

wsprintf( t, "%ld", (int)FMODGetNumInstances());
MessageBoxA(GetActiveWindow(),t,"",0);
FMODASSERT(FMOD_System_PlaySound(mainsystem, FMOD_CHANNEL_FREE, (FMOD_SOUND *)(DWORD)sound, true, &channel));
wsprintf(t,"%ld", (int) FMODGetNumInstances());
MessageBoxA(GetActiveWindow(),t,"",0);

First message shows n

Second message shows n+2 AND THE SOUND IS F$%^& playing!!! It happens on a wav file. The mid is fine since it is streamed automatically no mater what.

Sorry. Did I mention I’m getting frustrated by this little ping pong game?

Like I told you in my first pm I’ve been doing this for 20 years. I did not send you a detailed PM for nothing… Did I?

You have all my code. I’m sure you’ve read it and realise I not playing around here.

Are you using malloc or calloc under windows by any chance? Because this sounds just like the sort of weird problems we get from the unix guys writing windows code at work.

And the game system was written by a university teacher… No doubt he also did the malloc nono under windows too. I’m thinking global/local heap problems or possibly stack issues.

Now, go back to your code and check. Please… I’ve been on this thing for weeks now and this code above shows the problem is yours to figure. It’s FMOD_SystemPlaySound… The proof is in front of my eyes. I could get an avi recorder and record it if you want… You seem like a hard guy to convince and even harder to get a straigth answer from (like I said, sorry, frustrated). I have no control on what goes on in there. Nor do I have control over the stack/memory usage on both end. I stand in the middle with no control of what goes on before or after my call. I never spend more that 3 days with this kind of stuff. And I no longer feel like playing ping pong with this issue.

So, you have my code right there. It was im my first PM and that PM I am 99% sure you got. Press the compile button and try it out.

Sorry if this post offends you but I feel you are only half reading my information and jumping too soon to a conclusion and I feel you would still play the ping pong game if I did not put my foot down a little.

Regards
icuurd12b42

  • You must to post comments
0
0

[quote="Shaltif":2xmh66lk]icuurd12b42, you may wish to do more debugging on your end. I tried to replicate the bug you suggested with my own API wrapper (thus, the only common things were Game Maker 7.0 Pro and fmodex.dll) and couldn’t replicate the behavior.

However, maybe I am mis reading the exact error here (if so, please clarify so I can try a better replication test). After playing the the demo, it appears that the bug is your sound, when not streamed, is not clearing a channel. Thus, eventually all channels become ‘full’ and you are unable to play anymore sounds.

[i:2xmh66lk]The Test[/i:2xmh66lk]
Now I’ve tried to understand your source code…but quite frankly, it’s a mess. So I decided instead to see if I could replicate the error myself, with my own API wrapper…in those tests, I was unable to re-create the bug.

In my example, I loaded a single sound without streaming (similar to your example) and then played it over and over and over. For me, the channels cleared just fine and I never got to a point where all my channels would ‘fill’. Thus causing sound dropping/etc.

[i:2xmh66lk]Personal Note[/i:2xmh66lk]
Anyway, the best thing you can do here for Brett is to make a C/C++ program that shows the same behavior. If you can’t, then Brett (and the others) will assume it’s the wrapper at fault since you can’t show the bug in an environment fmod was designed to run in. They aren’t here to debug your wrapper issue, they have many more important matters to deal with.

So what I recommend is seeing if you can reproduce this error outside of GM and more importantly, outside your API. If not, then the fault is probably not the fmodex.dll, but rather your own coding.

~Brandon[/quote:2xmh66lk]

Ah… Good. Believe me that helps a lot. Though, like I said, I did all I could on my end trying to replicate this in a standalone exe with both straight FMOD calls and through my API to no avail. But you offer something I can use to further the investigation.

Like I said many times, I’d rather have a major bug in my code than have stack problems.

  • You must to post comments
0
0

Ok firstly there is no PM about memory issues.

When you say [i:3n7ine4k]"I already told you , that your and my dll work fine in a regular winmain C program."[/i:3n7ine4k] , what are we debugging here, the wrapper dll? If it is a memory issue, it is not us and any ‘malloc/calloc’ issue. You might be experiencing that sort of thing but we develop on 12 platforms simultaneously we know what we’re doing in this regard. If it is the dll stomping on something of ours then you should verify it with memory auditing tools.

Lastly, there was no supplied code in your zip, just exes and dlls. If you want us to help you please make it easy for us to reproduce and look at the issue.

  • You must to post comments
0
0

I have taken a look at your program by running from our debugger using a debug build of FMOD.

What I have noticed is when you create your sound, you do it twice for some reason. So I get two breakpoint hits in CreateSound coming from your code, both for the same wav file.

Then later you do a playSound, which also happens twice, but here is where the problem is, because this happens twice, 2 channels are allocated since you used FMOD_CHANNEL_FREE, but since you call this twice, you are reusing your channel variable.

Since you are creating the sounds paused, both channels are now paused. Your code then calls setPaused(false) on the channel twice, but this is only the second channel created as the variable was overridden with your second playSound.

Now you are left with 1 channel that you can no longer reference, stuck paused, and 1 channel that is fine, which stops normally when finished. With streams you don’t get this problem because the second play of the stream stops the first.

I am not sure what is going on in your code, but for some reason everything is happening twice, so if you solve that issue, then your audio problems will be resolved.

  • You must to post comments
0
0

Hmm, couple of random thoughts from a fellow developer.

Have you tried calling PlaySound directly, without the FMODASSERT? Is it possible your macro is causing its argument to be evaluated twice?

Are you calling FMOD_System_Update often enough?

  • You must to post comments
0
0

[quote="mathew":2z857prd]I have taken a look at your program by running from our debugger using a debug build of FMOD.

What I have noticed is when you create your sound, you do it twice for some reason. So I get two breakpoint hits in CreateSound coming from your code, both for the same wav file.

Then later you do a playSound, which also happens twice, but here is where the problem is, because this happens twice, 2 channels are allocated since you used FMOD_CHANNEL_FREE, but since you call this twice, you are reusing your channel variable.

Since you are creating the sounds paused, both channels are now paused. Your code then calls setPaused(false) on the channel twice, but this is only the second channel created as the variable was overridden with your second playSound.

Now you are left with 1 channel that you can no longer reference, stuck paused, and 1 channel that is fine, which stops normally when finished. With streams you don’t get this problem because the second play of the stream stops the first.

I am not sure what is going on in your code, but for some reason everything is happening twice, so if you solve that issue, then your audio problems will be resolved.[/quote:2z857prd]

Indeed… Thank you.
Yes. By George we found the problem… Thanks to Shaltif for removing any doubt that FMOD was at fault by doing a few test and proving to me that my code must be at fault. Wich encouraged me to revisit, yet again, but with certitude every inch of my code.

And thanks to sgugler for the big hint…
[quote="sgugler":2z857prd]Hmm, couple of random thoughts from a fellow developer.

Have you tried calling PlaySound directly, without the [b:2z857prd]FMODASSERT[/b:2z857prd]? Is it possible your macro is causing its argument to be evaluated twice?

Are you calling FMOD_System_Update often enough?[/quote:2z857prd]

And thanks to you brett.

I actually just solved it and came here to find your post(s)…

[code:2z857prd]

define FMODASSERT(x) {lasterror = x; if(x!=FMOD_OK) {return (double) 0;}}

[/code:2z857prd]

wich the compiler resolves to
lasterror = FMOD_FunctionCall(..); if(FMOD_FunctionCall(..,)!=FMOD_OK) {return (double) 0;}}

Indeed the poorly designed macro was at fault. Indeed every single functions called using the macro was called twice… Indeed the problem is all mine. Indeed it was it front of my face all this time.

[code:2z857prd]

define FMODASSERT(x) {lasterror = x; if(lasterror !=FMOD_OK) {return (double) 0;}}

[/code:2z857prd]

So, thank you all for baring with me and again I am truely sorry for letting my temper get the best of me.

  • You must to post comments
0
0

[quote="brett":2in45b2p]Ok firstly there is no PM about memory issues.

When you say [i:2in45b2p]"I already told you , that your and my dll work fine in a regular winmain C program."[/i:2in45b2p] , what are we debugging here, the wrapper dll? If it is a memory issue, it is not us and any ‘malloc/calloc’ issue. You might be experiencing that sort of thing but we develop on 12 platforms simultaneously we know what we’re doing in this regard. If it is the dll stomping on something of ours then you should verify it with memory auditing tools.

Lastly, there was no supplied code in your zip, just exes and dlls. If you want us to help you please make it easy for us to reproduce and look at the issue.[/quote:2in45b2p]

Listen… you have the code, I PMed it to you with a password protected download link and the download count is now one, so I know you downloaded the code. You could have spent 2 minutes to compile it and debug it with my test harness as the caller instead of playing ping pong…

And you know what you are doing so resolving this should be child’s play to you…

Here. I repackaged everything to help you.
[url=http://host-a.net/icuurd12b42/GMFMODSimpleDemo0and9Keys.zip:2in45b2p][img:2in45b2p]http://host-a.net/icuurd12b42/GMFMODSimpleDemo0and9Keys.zip/link.png[/img:2in45b2p][/url:2in45b2p]

It’s not password protected. So if anybody is interested in helping out, go ahead.

The zip contains:
The sounds needed to test it out in the bks and car folders
fmodex.dll (v 4.08.06)
GMFMODSimple.dll
GMFMODSimpleDemo0and9Keys.exe (The test harness)
FMODSimplePasswordProtect.exe (The password encryptor)
GMFMODSimpleDemo.gmk (The test harness code (you need GameMaker 7 Pro)
dllmain.encryption.cpp (the DLL source code)

The test harness is set up to start with a simple test screen when you start.

Press 0 and the following code is executed
FMODSoundPlay(FMODSoundAdd("car\beep1.wav",false,true));
The result will be the dll showing you a message box with n followed by a message box with n+1. The streamed sound test. On the test window, if you dismissed the message box quickly enough, the count will be n+1 then drop back to n.

Press 9 and the following code is executed
FMODSoundPlay(FMODSoundAdd("car\beep1.wav",false,false));
The result will be the dll showing you a message box with n followed by a message box with n+2. The unstreamed sound test. On the test window, if you dismissed the message box quickly enough, the count will be n+2 then drop back to n +1… Never back to n.

Remember, the code in the dll showing the message box is this
char t[] = "123456789";
wsprintf( t, "%ld", (int)FMODGetNumInstances());
MessageBoxA(GetActiveWindow(),t,"",0);
FMODASSERT(FMOD_System_PlaySound(mainsystem, FMOD_CHANNEL_FREE, (FMOD_SOUND )(DWORD)sound, true /true*/, &channel));
wsprintf(t,"%ld", (int) FMODGetNumInstances());
MessageBoxA(GetActiveWindow(),t,"",0);

I must recant my “and the sound is $%^& playing” in my prior post, with all this going back and forth, trying to prove I’m not making this up, I had the paused flag set to false in the dll in my test folder and the flag set to true in the dll in my compile folder.

Which brings us back to the original post about the suggestion that a ghost paused channel seems to be created at the same time as the returned paused channel.

I suggest you recompile my dll with debug information (target name is GMFMODSimple.dll), recompile your dll with debug information and run the setup through bounds checker and see what it tells you.

This sort of debugging setup is beyond my monetary means. I’m not going to buy bounds checker to debug this stuff when you, as a serious sw development institution should have it or something like it on hand. Especially since the problem is inside your function.

Perhaps I did something wrong beforehand… it’s possible my code has adverse effect later in your code. That is why I asked you to review my code in my first PM. It’s possible GM is at fault and used up most of the stack beforehand too. I have only my experience to go on.

Pay close attention to the function stack… Is it possible it’s ridiculously high? How about the heap? Is the memory allocated far or near? Are we running out? Are we overrunning buffers somewhere? If it’s a stack/heap issue, how often is this issue pop up? Causing unpredictable behaviour, even running code that should not even run, near or far… I once had this code that actually ran CMOS setup from windows when I would set some text to a text box (In Boland C++ OWL TEdit object eons ago)… If it’s a stack issue/heap, you’re going to have to see if you can limited your stack use and use global memory more than local… Perhaps redefine the memory function to be far when compiled for windows… If you use OO in your dll, the effect is even worst; OO is a stack/heap hog. You have no control over when and where people are going to call your stuff or what kind of development system they are using. Since DLL inherits it’s callers settings, heap and stack, you need to be careful on your usage. Not everyone will be calling your routines from winmain LOL.

All kidding aside, Seriously, I cannot do anything more than what I have done and given you. Like I said this sort of problem needs proper tools and skills to figure out… And I have no $$ for the tools. If I had the tools and was sitting in your chair with access to the sources, it would take me 15 minutes to set everything up. 5 Minutes to run and see what bounds checker dishes out. Less time than it would take to write a rebuttal.

…Ball returned…

Cheers!

  • You must to post comments
0
0

Why don’t you go into the fmod examples and modify one of the existing ones instead of having us all download and run your seemingly overly complicated setup. the playsound example itself has channels playing stat and it shows proper number of channels playing when i press a key to play

  • You must to post comments
Showing 19 results
Your Answer

Please first to submit.