Exemplo n.º 1
0
        public override void Run()
        {
            var master = System.MasterChannelGroup;

            master.AddDSP(0, dspLowpass);
            master.AddDSP(0, dspHighpass);
            master.AddDSP(0, dspEcho);
            master.AddDSP(0, dspFlange);

            do
            {
                OnUpdate();

                System.Update();
                FmodBool Paused = true;

                if (channel != null)
                {
                    var res = Fmod.Library.Channel_GetPaused(channel, out Paused);

                    if (res != Result.Ok)
                    {
                        Paused = true;

                        if (res != Result.Err_Invalid_Handle && res != Result.Err_Channel_Stolen)
                        {
                            res.CheckResult();
                        }
                    }
                }

                char lp, hp, e, f;

                lp = dspLowpass.Bypass  ? ' ' : 'x';
                hp = dspHighpass.Bypass ? ' ' : 'x';
                e  = dspEcho.Bypass     ? ' ' : 'x';
                f  = dspFlange.Bypass   ? ' ' : 'x';

                DrawText("==================================================");
                DrawText("Effects Example");
                DrawText("");
                DrawText("==================================================");
                DrawText();
                DrawText("Press Space to toggle pause sound");
                DrawText("Press 1 to toggle dsp Lowpass effect");
                DrawText("Press 2 to toggle dsp Highpass effect");
                DrawText("Press 3 to toggle dsp echo effect");
                DrawText("Press 4 to toggle dsp flange effect");
                DrawText("Press Esc to quit");
                DrawText();
                DrawText($"{(Paused ? "Paused" : "Playing")} : lowpass[{lp}] highpass[{hp}] echo[{e}] flange[{f}]");

                Sleep(50);
            }while (!ShouldEndExample);

            master.RemoveDSP(dspLowpass);
            master.RemoveDSP(dspHighpass);
            master.RemoveDSP(dspEcho);
            master.RemoveDSP(dspFlange);
        }
Exemplo n.º 2
0
        public override void Run()
        {
            do
            {
                OnUpdate();

                System.Update();

                uint     ms = 0, lenms = 0;
                FmodBool isPlaying = false, paused = false;
                int      channelsPlaying = 0;


                if (Channel != null)
                {
                    var library = Fmod.Library;

                    var res = library.Channel_IsPlaying(Channel, out isPlaying);
                    if (res != Result.Ok && res != Result.Err_Invalid_Handle && res != Result.Err_Channel_Stolen)
                    {
                        res.CheckResult();
                    }

                    res = library.Channel_GetPaused(Channel, out paused);
                    if (res != Result.Ok && res != Result.Err_Invalid_Handle && res != Result.Err_Channel_Stolen)
                    {
                        res.CheckResult();
                    }

                    res = library.Channel_GetPosition(Channel, out ms, TimeUnit.MS);
                    if (res != Result.Ok && res != Result.Err_Invalid_Handle && res != Result.Err_Channel_Stolen)
                    {
                        res.CheckResult();
                    }

                    library.Channel_GetCurrentSound(Channel, out SoundHandle shandle);

                    if (shandle != default)
                    {
                        res = library.Sound_GetLength(shandle, out lenms, TimeUnit.MS);
                        if (res != Result.Ok && res != Result.Err_Invalid_Handle && res != Result.Err_Channel_Stolen)
                        {
                            res.CheckResult();
                        }
                    }
                }

                System.GetChannelsPlaying(out channelsPlaying, out _);

                DrawText("==================================================");
                DrawText("Load From Memory Example.");
                DrawText("Copyright (c) Firelight Technologies 2004-2019.");
                DrawText("==================================================");
                DrawText();
                DrawText("Press 1 to play a mono sound (drumloop)");
                DrawText("Press 2 to play a mono sound (jaguar)");
                DrawText("Press 3 to play a stereo sound (swish)");
                DrawText();
                DrawTime((int)ms, (int)lenms);
                DrawText($"Channels Playing: {channelsPlaying}");
            }while (!ShouldEndExample);
        }
Exemplo n.º 3
0
 public void GetMeteringEnabled(out FmodBool inputEnabled, out FmodBool outputEnabled)
 {
     library.DSP_GetMeteringEnabled(Handle, out inputEnabled, out outputEnabled).CheckResult();
 }
Exemplo n.º 4
0
 public void GetOpenState(out OpenState openstate, out uint percentbuffered, out FmodBool starving, out FmodBool diskbusy)
 {
     library.Sound_GetOpenState(Handle, out openstate, out percentbuffered, out starving, out diskbusy).CheckResult();
 }
Exemplo n.º 5
0
 public abstract void GetDelay(out ulong dspclock_start, out ulong dspclock_end, out FmodBool stopchannels);
Exemplo n.º 6
0
 public abstract void SetDelay(ulong dspclock_start, ulong dspclock_end, FmodBool stopchannels);