0
0

a loop problem when using createSound with FMOD_CREATESTREAM or createSream.
there is no problem in version 4.03.09, after upgrade to 4.03.10, I got this
problem. I change some code in the example to show this bug(May be a bug).

[code:j0tecygc]

//////////////////////////////////////////////////////////////////////////

include "../../api/inc/fmod.hpp"

include "../../api/inc/fmod_errors.h"

include <windows.h>

include <stdio.h>

include <conio.h>

void ERRCHECK(FMOD_RESULT result)
{
if (result != FMOD_OK)
{
printf("FMOD error! (%d) %s\n", result, FMOD_ErrorString(result));
exit(-1);
}
}

int main(int argc, char *argv[])
{
FMOD::System *system;
FMOD::Sound *sound;
FMOD::Channel *channel = 0;
FMOD_RESULT result;
int key;
unsigned int version;

/*
    Create a System object and initialize.
*/
result = FMOD::System_Create(&amp;system);
ERRCHECK(result);

result = system-&gt;getVersion(&amp;version);
ERRCHECK(result);

if (version &lt; FMOD_VERSION)
{
    printf(&quot;Error!  You are using an old version of FMOD %08x.  This program requires %08x\n&quot;, version, FMOD_VERSION);
    return 0;
}

result = system-&gt;init(1, FMOD_INIT_NORMAL, 0);
ERRCHECK(result);

    FMOD_CREATESOUNDEXINFO exinfo;
    ZeroMemory(&amp;exinfo, sizeof(exinfo));

    exinfo.cbsize = sizeof(FMOD_CREATESOUNDEXINFO);
    exinfo.suggestedsoundtype = FMOD_SOUND_TYPE_MPEG;

    FMOD::ChannelGroup* cg;
    FMOD::ChannelGroup* master;

    system-&gt;getMasterChannelGroup(&amp;master);
    system-&gt;createChannelGroup(0, &amp;cg);
    master-&gt;addGroup(cg);

result = system-&gt;createStream(&quot;../media/wave.mp3&quot;, FMOD_SOFTWARE |FMOD_LOOP_OFF| FMOD_2D, &amp;exinfo, &amp;sound);
ERRCHECK(result);

printf(&quot;====================================================================\n&quot;);
printf(&quot;PlayStream Example.  Copyright (c) Firelight Technologies 2004-2005.\n&quot;);
printf(&quot;====================================================================\n&quot;);
printf(&quot;\n&quot;);
printf(&quot;Press space to pause, Esc to quit\n&quot;);
printf(&quot;\n&quot;);

/*
    Play the sound.
*/

result = system-&gt;playSound(FMOD_CHANNEL_FREE, sound, false, &amp;channel);
ERRCHECK(result);

    channel-&gt;setChannelGroup(cg);
/*
    Main loop.
*/
do
{
    if (kbhit())
    {
        key = getch();

        switch (key)
        {
            case ' ' :
            {
                bool paused;
                channel-&gt;getPaused(&amp;paused);
                channel-&gt;setPaused(!paused);
                break;
            }
        }
    }

    system-&gt;update();

    if (channel)
    {
        unsigned int ms;
        unsigned int lenms;
        bool         playing;
        bool         paused;

                    int n;
                    int m;

                    cg-&gt;getNumChannels(&amp;n);
                    system-&gt;getChannelsPlaying(&amp;m);

        channel-&gt;isPlaying(&amp;playing);
        if ((result != FMOD_OK) &amp;&amp; (result != FMOD_ERR_INVALID_HANDLE))
        {
            ERRCHECK(result);
        }

        result = channel-&gt;getPaused(&amp;paused);
        if ((result != FMOD_OK) &amp;&amp; (result != FMOD_ERR_INVALID_HANDLE))
        {
            ERRCHECK(result);
        }

        result = channel-&gt;getPosition(&amp;ms, FMOD_TIMEUNIT_MS);
        if ((result != FMOD_OK) &amp;&amp; (result != FMOD_ERR_INVALID_HANDLE))
        {
            ERRCHECK(result);
        }

        result = sound-&gt;getLength(&amp;lenms, FMOD_TIMEUNIT_MS);
        if ((result != FMOD_OK) &amp;&amp; (result != FMOD_ERR_INVALID_HANDLE))
        {
            ERRCHECK(result);
        }

        printf(&quot;Time %02d:%02d:%02d/%02d:%02d:%02d : %s %d/%d\r&quot;, ms / 1000 / 60, ms / 1000 % 60, ms / 10 % 100, lenms / 1000 / 60, lenms / 1000 % 60, lenms / 10 % 100, paused ? &quot;Paused &quot; : playing ? &quot;Playing&quot; : &quot;Stopped&quot;, n, m);
    }

    Sleep(10);

} while (key != 27);

printf(&quot;\n&quot;);

/*
    Shut down
*/
result = sound-&gt;release();
ERRCHECK(result);
result = system-&gt;close();
ERRCHECK(result);
result = system-&gt;release();
ERRCHECK(result);

return 0;

}

//////////////////////////////////////////////////////////////////////////

[/code:j0tecygc]

After the mp3 is finish, you can see, there is still a channel is playing.
and the "cg" (channel group) and the master group’s Num is 1. So, how can I
check the mp3 is finished in version 4.03.10?.

And the second question is:

There is a sound named "drumloop.wav" in the example dir.
If you createSound or createStream use this file without setting
the loop flag( eg. just set FMOD_2D | FMOD_SOFTWARE). the
sound would be in loop mode. Why the default loop mode for this
file is LOOP? but just for this file? Is there any I have missing understand
document?

Thank you.

  • You must to post comments
0
0

drumloop.wav has loop points embedded in the wav, thats why it loops by default.

For your other problem please try http://ftp.fmod.org l:upload p:upload for the v11 pre-release to see if that fixes anything, I did just fix a problem similar to what you are saying.

  • You must to post comments
0
0

Thank you. the version 4.03.11 has fixed that problem.

  • You must to post comments
0
0

ok cool, we’ll get this version out ASAP, maybe as 4.04 actually.

  • You must to post comments
0
0

oh, Wait. there is a bad news.
after upgrade to 4.03.11, our game will crash.
disabled the sound or rollback to 4.03.10 it works well.

It crashed at addrs 0x00000000 and stack 0x00000000.

BTW: Our Team just got the source of 4.03.11, and I will spent some time to merge to game src. after build a debug version I will find what is the
problem.

  • You must to post comments
0
0

that version is actually a few days old and a few fixes have been made since then. We’ll release 4.04 now and if there is an issue we’ll just upgraded 4.04 stable to rev2.

  • You must to post comments
0
0

Unfortunately version 4.04 has the same crash.

  • You must to post comments
0
0

there is a little problem when building the fmod.
vc report the can’t find the file "3dl2.h"

  • You must to post comments
0
0

ok thanks i’ve fixed the closedown crash, i’ll update the dev and stable build with this.

i’ll update the source project as well to reflect the new reverb code, but please in future do not talk about fmod source details on the public forum.

  • You must to post comments
Showing 8 results
Your Answer

Please first to submit.