0
0

Hi,

I try to make work the FSB file sentencing but no results so far.
I use the c# API.

The code is the following
[code:1qyyufgf]

    public void StartUpModule()
    {
        RESULT result;
        uint version = 0;

        if (_moduleStarted)
        {
            throw new Exception("Sound module allready started!");
        }

        /*
                Create a System object and initialize.
        */
        result = Factory.System_Create(ref _system);
        Errcheck(result);

        result = _system.getVersion(ref version);
        Errcheck(result);

        if (version < VERSION.number)
        {
            throw new Exception("Error!  You are using an old version of FMOD " + version.ToString("X") +
                                ".  This program requires " + VERSION.number.ToString("X") + ".");
        }

        result = _system.init(2, INITFLAGS.NORMAL, (IntPtr) null);
        Errcheck(result);

        if (_soundBankFile != "")
        {
            if (!File.Exists(_soundBankFile))
            {
                throw  new Exception("Invalid SoundBank File!");
            }
            result = _system.createStream(_soundBankFile, MODE.LOOP_OFF | MODE._2D | MODE.SOFTWARE , ref _sound);
            Errcheck(result);
            result = _sound.getNumSubSounds(ref _numsounds);  
            Errcheck(result);
        }
        _moduleStarted = true;
    }



    public bool PlaySentence(string soundCodes)
    {
        RESULT result;
        if(! _moduleStarted)
        {
            throw new Exception("Sound module has not been started!");
        }

        if (_sound == null)
        {
            throw new Exception("SoundBank File is not defined, cannot play a sentence!");
        }
        string[] codes = soundCodes.Split(',');
        var intcodes = new int[codes.Length] ;
        int maxcodes = 0;
        foreach (var code in codes)
        {
            intcodes[maxcodes] = Convert.ToInt32(code);
            maxcodes++;
        }

        result = _sound.setSubSoundSentence(intcodes, maxcodes);
        Errcheck(result);
        result = _system.playSound(CHANNELINDEX.FREE, _sound, false, ref _channel);
        Errcheck(result);
        return true;
    }

[/code:1qyyufgf]

Every result is OK but there is no sound at all. Playing a file or the supplied example works but FSB sentencing is not.
The FSB file is bult of several WAV files PCM 1:1 format.
The getnumsubsounds gives back the correct number of subsounds in the FSB.

  • You must to post comments
0
0

So far no result at all 😥

I used the logging version of the fmodex.dll and the log file contains no error at all.

Opening the FSB file:
[code:q6a8he5m]
FMOD: SystemI::createSoundInternal : filename = e : mode 01000080
FMOD: SystemI::createSoundInternal : 19 codecs found. Scan all until one succeeds
FMOD: CodecTag::openInternal : attempting to open ID3 or ASF tags..
FMOD: Codec::release :
FMOD: Plugin::release : (0002FCD0)
FMOD: Plugin::release : done
FMOD: Codec::release : done
FMOD: CodecCDDA::openInternal : attempting to open as CDDA..
FMOD: Codec::release :
FMOD: Plugin::release : (0002FCD0)
FMOD: Plugin::release : done
FMOD: Codec::release : done
FMOD: CodecFSB::openInternal : attempting to open as FSB..
FMOD: CodecFSB::openInternal : found FSB4
FMOD: CodecFSB::openInternal : FSB contains 627 sounds
FMOD: CodecFSB::openInternal : done.
FMOD: SystemI::createSoundInternal : Format has 627 subsounds.
FMOD: SystemI::createSoundInternal : Create as FMOD_CREATESTREAM
FMOD: System::createSoundInternal : decode buffersize = 17408 : blocksize = 256 : format = 2
FMOD: SystemI::createSample : mode 01000082 length 17408 samples, lengthbytes 338720
FMOD: SystemI::createSample : subsamples = 1, channels = 2
FMOD: SystemI::createSample : subsample 0. output = 054C4B50
FMOD: SystemI::createSample : mSoftware = 054C4B50
FMOD: OutputSoftware::createSample : lengthpcm 17408, lengthbytes 338720, channels 2, format 2, mode 010000ca
FMOD: OutputSoftware::createSample : done
FMOD: SystemI::createSample : done
FMOD: System::createSoundInternal : 627 subsounds detected.
FMOD: System::createSoundInternal : Seek stream to start
FMOD: CodecFSB::setPositionInternal : subsound 0 position 0 postype 2
FMOD: CodecFSB::setPositionInternal : done
FMOD: System::createSoundInternal : flush stream buffer
FMOD: System::createSoundInternal : flush successful.
FMOD: System::createSoundInternal : switch file handle from small blocking single buffered to large nonblocking doublebuffered.
FMOD: Thread::initThread : Initializing FMOD file thread. priority 1
FMOD: Thread::initThread : – Stacksize 8192. Stack pointer 00000000 : usesemaphore = 1 : sleeptime = 0
FMOD: Thread::callback : * FMOD file thread started
FMOD: Thread::initThread : done.
FMOD: SystemI::createSoundInternal : done. OpenState now = FMOD_OPENSTATE_READY.
[/code:q6a8he5m]

the next code is not producing any error but there is no audible result too:

[code:q6a8he5m]
int[] intcodes = new int[4] {1,2,3,4} ;

        result = _sound.setSubSoundSentence(intcodes, 4);
        Errcheck(result);
        result = _system.playSound(CHANNELINDEX.FREE, _sound, true, ref _channel);
        Errcheck(result);
        result = _channel.setVolume((float) (_volume/255.0));
        Errcheck(result);
        result = _channel.setPaused(false);
        Errcheck(result);

[/code:q6a8he5m]

the resulting logfile:
[quote:q6a8he5m]

FMOD: CodecFSB::setPositionInternal : subsound 1 position 0 postype 2
FMOD: CodecFSB::setPositionInternal : done
FMOD: CodecFSB::setPositionInternal : subsound 2 position 0 postype 2
FMOD: CodecFSB::setPositionInternal : done
FMOD: CodecFSB::setPositionInternal : subsound 3 position 0 postype 2
FMOD: CodecFSB::setPositionInternal : done
FMOD: CodecFSB::setPositionInternal : subsound 4 position 0 postype 2
FMOD: CodecFSB::setPositionInternal : done

[/quote:q6a8he5m]

When I free the FSB file we can see the FMODEX seeing the correct subsounds.

[quote:q6a8he5m]
FMOD: SoundI::release : G_AALLRA01.wav (054FA1C0)
FMOD: SoundI::release : remove stream samples. (054FA1C0)
FMOD: SoundI::release : G_AALLRA01.wav (054FA338)
FMOD: SoundI::release : free this. (054FA338)
FMOD: SoundI::release : done (054FA338)
FMOD: SoundI::release : release subsounds. (054FA1C0)
FMOD: SoundI::release : G_AALLRA05.wav (05525050)
FMOD: SoundI::release : free this. (05525050)
FMOD: SoundI::release : done (05525050)
FMOD: SoundI::release : release codec. (054FA1C0)
FMOD: Codec::release :
FMOD: CodecFSB::closeInternal :
FMOD: CodecFSB::closeInternal : done

[/quote:q6a8he5m]

But is there only a silence…. The volume is on the max so that is out of the question.
Can anybody help me?

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.