public SignalSoundEvent(SignalSoundEvent ev) : base(ev) { _sig = ev._sig; _modif = ev._modif; _paramNumber = ev._paramNumber; _parentsDSP = ev._parentsDSP; _parentsOsc = ev._parentsOsc; }
public OscSoundEvent(OscSoundEvent other) : base(other) { FMOD.RESULT r = MusicEngine.AudioEngine.createDSPByType(FMOD.DSP_TYPE.OSCILLATOR, ref _dsp); if (r == FMOD.RESULT.OK) { _dsp.setParameter((int)FMOD.DSP_OSCILLATOR.RATE, (float) other._freq); // initial freq in Hz. SetOscType(other._type); } }
public OscSoundEvent(OscSoundEvent other) : base(other) { FMOD.RESULT r = MusicEngine.AudioEngine.createDSPByType(FMOD.DSP_TYPE.OSCILLATOR, ref _dsp); if (r == FMOD.RESULT.OK) { _dsp.setParameter((int)FMOD.DSP_OSCILLATOR.RATE, (float)other._freq); // initial freq in Hz. SetOscType(other._type); } }
internal override void NotifyNewParent(SoundEvent parent) { base.NotifyNewParent(parent); if (_modif == Modifier.DSP_PARAM) { if (parent is DSPSoundEvent) { _parentsDSP = (DSPSoundEvent)parent; } if (parent is OscSoundEvent) { _parentsOsc = (OscSoundEvent)parent; } } // else TODO }
/** 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; }
internal override void NotifyNewParent(SoundEvent parent) { base.NotifyNewParent(parent); if ( _modif == Modifier.DSP_PARAM ) { if (parent is DSPSoundEvent ) _parentsDSP = (DSPSoundEvent)parent; if (parent is OscSoundEvent) _parentsOsc = (OscSoundEvent)parent; } // else TODO }
/** 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; }