/**
  * create an event containing a signal, which modifies properties of the parent
  * event during rendering. Modifier types to be chosen from SignalSoundEvent.Modifier
  */
 public SignalSoundEvent(SignalSoundEvent.Modifier modifierType , Signal sig)
     : base()
 {
     _sig = sig;
     _modif = modifierType;
     UpdateDuration(_sig.Duration);
 }
 /**
 * create an event containing a signal, which modifies a parameter property of a DSP
 * event during rendering. Modifier type must be SignalSoundEvent.Modifier.PARAM !
 */
 public SignalSoundEvent(SignalSoundEvent.Modifier modifierType, Signal sig, int paramNumber)
     : base()
 {
     _sig = sig;
     _modif = modifierType;
     _paramNumber = paramNumber;
     UpdateDuration(_sig.Duration);
 }
 public SignalSoundEvent(SignalSoundEvent ev)
     : base(ev)
 {
     _sig = ev._sig;
     _modif = ev._modif;
     _paramNumber = ev._paramNumber;
     _parentsDSP = ev._parentsDSP;
     _parentsOsc = ev._parentsOsc;
 }
Beispiel #4
0
 public SignalSoundEvent(SignalSoundEvent ev)
     : base(ev)
 {
     _sig         = ev._sig;
     _modif       = ev._modif;
     _paramNumber = ev._paramNumber;
     _parentsDSP  = ev._parentsDSP;
     _parentsOsc  = ev._parentsOsc;
 }
        public VolDimSoundEvent(Gamelet item, double timeDuration)
        {
            // specify a dimming envelope Signal and add to this as a child.
            Signal sig = new Signal(new List<double>() { 0, 1, 0.020, 0, timeDuration + 0.050, 0, timeDuration + 0.1, 1 });
            SignalSoundEvent se = new SignalSoundEvent(SignalSoundEvent.Modifier.AMPLITUDE, sig);
            this.AddEvent(0, se);

            // use eventing to add me as listener
            item.OnCollisionEvent += new GameletEventHandler(OnBallCollided);
        }
 /** oscillator with varying frequency */
 public SoundEvent Test_OscFrequency()
 {
     SoundEvent soundScript = new SoundEvent("Test_OscFrequency");
     OscSoundEvent oscEv = new OscSoundEvent(320);
     oscEv.SetOscType(OscSoundEvent.OscType.SINE);
     //oscEv.SetParameter((int)FMOD.DSP_OSCILLATOR.TYPE, 1);
     oscEv.Amplitude = 0.15;
     oscEv.UpdateDuration(6);
     SignalSoundEvent sEv = new SignalSoundEvent(SignalSoundEvent.Modifier.AMPLITUDE,
         new Signal(new List<double>() { 0, 0,  5.5,  1.0, 6.0, 0, 7.0, 0 }));
     SignalSoundEvent sEv2 = new SignalSoundEvent(SignalSoundEvent.Modifier.DSP_PARAM,
         new Signal(new List<double>() { 0, 320, 1.0, 543, 2, 109, 2.5, 737.3, 6.0, 210 }), (int)FMOD.DSP_OSCILLATOR.RATE);
     oscEv.AddEvent(0.0, sEv);
     oscEv.AddEvent(0.0, sEv2);
     soundScript.AddEvent(1.0, oscEv);
     //soundScript.AddEvent(3.0, new OscSoundEvent(oscEv));
     soundScript.UpdateDuration(10);
     return soundScript;
 }
        /** 2 overlapping oscillators - does not work */
        public SoundEvent Test_TwoOscillators()
        {
            SoundEvent soundScript = new SoundEvent("Test_TwoOscillators");
            OscSoundEvent oscEv = new OscSoundEvent(320);
            oscEv.Amplitude = 0.15;
            //oscEv.UpdateDuration(6);
            SignalSoundEvent sEv = new SignalSoundEvent(SignalSoundEvent.Modifier.AMPLITUDE,
                new Signal(new List<double>() { 0, 0, 0.5, 1.0, 6.5, 1.0, 7.0, 0 }));
            SignalSoundEvent sEv2 = new SignalSoundEvent(SignalSoundEvent.Modifier.DSP_PARAM,
                new Signal(new List<double>() { 0, 170, 7.0, 450 }), (int)FMOD.DSP_OSCILLATOR.RATE);
            oscEv.AddEvent(0.0, sEv);
            oscEv.AddEvent(0.0, sEv2);
            OscSoundEvent oscEv2 = new OscSoundEvent(oscEv);
            oscEv2.AddEvent(0.0, new SignalSoundEvent(sEv));
            oscEv2.AddEvent(0.0, new SignalSoundEvent(sEv2));
            soundScript.AddEvent(1.0, oscEv);
            soundScript.AddEvent(4.0, oscEv2);

            return soundScript;
        }
        /**
         * complex script sequence for testing
         */
        public SoundEvent Test_Script1()
        {
            SoundEvent soundScript = new SoundEvent("Test_Script1");
            SampleSoundEvent evDing = new SampleSoundEvent("ding.wav");
            SampleSoundEvent evOrgan = new SampleSoundEvent("hammond-loop.wav");

            // dsp effects
            SoundEvent evEcho = new DSPSoundEvent(FMOD.DSP_TYPE.ECHO);
            //evEmerald.AddEvent(0,echo1);
            SoundEvent evChorus = new DSPSoundEvent(FMOD.DSP_TYPE.CHORUS);
            evChorus.UpdateDuration(10.0);
            evOrgan.AddEvent(evOrgan.Duration, evChorus);
            DSPSoundEvent evLP = new DSPSoundEvent(FMOD.DSP_TYPE.LOWPASS);
            evLP.UpdateDuration(10.0);
            Signal sigLP = new Signal(new List<double>() { 0,300, 3,1500, 7,300, 20,15050 });
            SignalSoundEvent evLPsig = new SignalSoundEvent(SignalSoundEvent.Modifier.DSP_PARAM, sigLP, (int)FMOD.DSP_LOWPASS.CUTOFF);
            evLP.AddEvent(0, evLPsig);
            evOrgan.AddEvent(0, evLP);

            evOrgan.Amplitude = 0.4;
            evOrgan.Repeat = 10;

            soundScript.AddEvent(0.5, evOrgan);

            // create an event defining a signal, which modifies amplitude - linear fade in!
            Signal sig = new Signal(new List<double>() {0,0, 4,1  } );
            SignalSoundEvent evsig = new SignalSoundEvent(SignalSoundEvent.Modifier.AMPLITUDE, sig);
            evOrgan.AddEvent(0.0, evsig);

            // composite event
            SoundEvent evc = new SoundEvent();
            evc.AddEvent(0, evDing);
            evDing = new SampleSoundEvent(evDing); evDing.Amplitude = 0.8; evDing.Pan = -0.5;
            evc.AddEvent(0.33, evDing);
            evDing = new SampleSoundEvent(evDing); evDing.Amplitude = 0.6; evDing.Pan = 0.5;
            evc.AddEvent(0.66, evDing);
            evDing = new SampleSoundEvent(evDing); evDing.Amplitude = 0.4; evDing.Pan = 0.0;
            evc.AddEvent(1.0, evDing);
            evDing = new SampleSoundEvent(evDing); evDing.Amplitude = 0.3;
            evc.AddEvent(1.33, evDing);
            evDing = new SampleSoundEvent(evDing); evDing.Amplitude = 0.25;
            evc.AddEvent(1.66, evDing);

            // add it to script
            soundScript.AddEvent(2.0, evc);
            soundScript.AddEvent(2.5, evc );

            evDing = new SampleSoundEvent(evDing); evDing.Amplitude = 0.91; evDing.Pan = -0.9;
            soundScript.AddEvent(0, evDing);
            evDing = new SampleSoundEvent(evDing); evDing.Amplitude = 0.92; evDing.Pan = +1;
            soundScript.AddEvent(0.5, evDing);
            evDing = new SampleSoundEvent(evDing); evDing.Amplitude = 0.93; evDing.Pan = -1;
            soundScript.AddEvent(1.0, evDing);

            // try oscillator
            OscSoundEvent oscEv = new OscSoundEvent(320);
            oscEv.Amplitude = 0.1;
            SignalSoundEvent sEv = new SignalSoundEvent( SignalSoundEvent.Modifier.AMPLITUDE ,
                new Signal( new List<double>() { 0,0 , 0.5,1 , 2,1 , 2.5,0 , 3.0,0 } ) );
            SignalSoundEvent sEv2 = new SignalSoundEvent(SignalSoundEvent.Modifier.DSP_PARAM,
                new Signal(new List<double>() { 0, 320, 0.5, 543, 2, 129, 2.5, 192.3, 3.0, 410 }), (int) FMOD.DSP_OSCILLATOR.RATE);
            oscEv.AddEvent(0.0, sEv);
            oscEv.AddEvent(0.0, sEv2);
            soundScript.AddEvent(3.0, oscEv);
            soundScript.AddEvent(7.0, oscEv);
            soundScript.AddEvent(11.0, oscEv);
            soundScript.AddEvent(15.0, oscEv);

            return soundScript;
        }