setMode() 공개 메소드

public setMode ( MODE mode ) : RESULT
mode MODE
리턴 RESULT
예제 #1
0
    // Use this for initialization
    void Start () {
        lowLevelSystem = RuntimeManager.LowlevelSystem;
        channel = new FMOD.Channel();
        lowLevelSystem.getMasterChannelGroup(out channelGroup);

        soundInfo = new FMOD.CREATESOUNDEXINFO();
        soundInfo.cbsize = Marshal.SizeOf(soundInfo);
        soundInfo.decodebuffersize = (uint)sampleRate / 10;
        soundInfo.length = (uint)(sampleRate * numberOfChannels * sizeof(short));
        soundInfo.numchannels = numberOfChannels;
        soundInfo.defaultfrequency = sampleRate;
        soundInfo.format = FMOD.SOUND_FORMAT.PCM16;

        soundInfo.pcmreadcallback = PCMReadCallback;
        soundInfo.pcmsetposcallback = PCMSetPositionCallback;

        lowLevelSystem.setStreamBufferSize(65536, FMOD.TIMEUNIT.RAWBYTES);
        lowLevelSystem.createStream("SoundGeneratorStream", FMOD.MODE.OPENUSER, ref soundInfo, out generatedSound);

        generatedSound.setMode(FMOD.MODE.OPENUSER | FMOD.MODE._3D | FMOD.MODE._3D_LINEARSQUAREROLLOFF);

        lowLevelSystem.playSound(generatedSound, channelGroup, true, out channel);
        channel.setLoopCount(-1);
        channel.setMode(FMOD.MODE.LOOP_NORMAL);
        channel.setPosition(0, FMOD.TIMEUNIT.MS);
        channel.set3DMinMaxDistance(minDistance, maxDistance);
        Update();
        channel.setPaused(false);
    }
예제 #2
0
    private IEnumerator WaitForStreamBuffer()
    {
        do
        {
            yield return(null);
        } while (state == FMOD.OPENSTATE.CONNECTING || state == FMOD.OPENSTATE.BUFFERING);

        if (state == FMOD.OPENSTATE.READY)
        {
            Debug.Log("Internet stream loaded");
            radioStream.setMode(FMOD.MODE.OPENUSER | FMOD.MODE._3D | FMOD.MODE._3D_LINEARROLLOFF);
            lowLevelSystem.playSound(radioStream, channelGroup, true, out channel);
            FMOD.ATTRIBUTES_3D attributes  = FMODUnity.RuntimeUtils.To3DAttributes(gameObject);
            FMOD.VECTOR        alt_pan_pos = Vector3.zero.ToFMODVector();
            channel.set3DMinMaxDistance(minDistance, maxDistance);
            channel.setLoopCount(-1);
            channel.setMode(FMOD.MODE.LOOP_NORMAL);
            channel.set3DAttributes(ref attributes.position, ref attributes.velocity, ref alt_pan_pos);
            channel.setPaused(false);
            channel.setVolume(volume);

            isReadyAndPlaying = true;
        }
        else if (state == FMOD.OPENSTATE.ERROR)
        {
            Debug.Log("Error while loading online , check the address or connection");
        }
    }
예제 #3
0
    // Use this for initialization
    void Start()
    {
        channel        = new FMOD.Channel();
        lowLevelSystem = FMODUnity.RuntimeManager.LowlevelSystem;
        FMODUnity.RuntimeManager.LowlevelSystem.getMasterChannelGroup(out channelGroup);

        lowLevelSystem.createSound("Assets\\Sounds\\guitar.mp3", FMOD.MODE.DEFAULT, out guitarSong);
        string songName = "";

        guitarSong.getName(out songName, 20);
        Debug.Log("Playing song: " + songName, gameObject);
        guitarSong.setMode(FMOD.MODE.OPENUSER | FMOD.MODE._3D | FMOD.MODE._3D_LINEARSQUAREROLLOFF);

        lowLevelSystem.playSound(guitarSong, channelGroup, true, out channel);
        channel.set3DMinMaxDistance(minDistance, maxDistance);
        channel.setLoopCount(-1);
        channel.setMode(FMOD.MODE.LOOP_NORMAL);
        FMOD.ATTRIBUTES_3D attributes  = FMODUnity.RuntimeUtils.To3DAttributes(gameObject);
        FMOD.VECTOR        alt_pan_pos = Vector3.zero.ToFMODVector();
        channel.set3DAttributes(ref attributes.position, ref attributes.velocity, ref alt_pan_pos);

        channel.setPaused(false);
    }