0
0

Hello,

I’m trying to stitch segments of a large wav-file into a continious stream – that is, to extend the realtimestitching example so that instead of streaming whole, separate files as subsounds, I would read from specified ranges of one wav.

It seems I can’t specify exinfo for a sound created as a stream from file. I’d like to set initialseekposition, but whatever I do, I get ERR_FILE_NOTFOUND or some other error. From the documentation it seems that the only mandatory thing to set up in the exinfo is cbsize. Is this correct?

I think the code below illustrates the problem compactly. I wonder what’s wrong with it?

[code:ka6lraf1]
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;

namespace FMOD_test
{
class Program
{
static void Main(string[] args)
{
FMOD.System system = null;
FMOD.Sound sound = null;
FMOD.Channel channel = null;
FMOD.CREATESOUNDEXINFO exinfo = new FMOD.CREATESOUNDEXINFO();
FMOD.RESULT result;
uint version = 0;

        result = FMOD.Factory.System_Create(ref system);
        ERRCHECK(result);

        result = system.getVersion(ref version);
        ERRCHECK(result);

        if (version < FMOD.VERSION.number)
        {
            Console.WriteLine(  "Error!  You are using an old version of FMOD " +
                                version.ToString("X") + 
                                ".  This program requires " + 
                                FMOD.VERSION.number.ToString("X") + ".");
            Environment.Exit(-1);
        }

        result = system.init(1, FMOD.INITFLAG.NORMAL, (IntPtr)null);
        ERRCHECK(result);

        exinfo.cbsize = Marshal.SizeOf(exinfo);

        //This doesn't work - returns "ERR_FILE_NOTFOUND"
        result = system.createStream("test.wav", FMOD.MODE.DEFAULT, ref exinfo, ref sound);
        ERRCHECK(result);

        //This works
        //result = system.createStream("test.wav", FMOD.MODE.DEFAULT, ref sound);
        //ERRCHECK(result);

        result = system.playSound(FMOD.CHANNELINDEX.FREE, sound, false, ref channel);
        ERRCHECK(result);

        Console.WriteLine("Playing...");
        Console.ReadLine();

    }
    static void ERRCHECK(FMOD.RESULT result)
    {
        if (result != FMOD.RESULT.OK)
        {
            Console.WriteLine("FMOD error! " + result + " - " + FMOD.Error.String(result));
            Console.ReadLine();
            Environment.Exit(-1);
        }
    }
}

}
[/code:ka6lraf1]

  • You must to post comments
Showing 0 results
Your Answer

Please first to submit.