public static SynthErrorCodes NewConvStream( float[] ImpulseResponse, int ImpulseResponseLength, bool LatencySpecified, int Latency, int lOversampling, SynthErrorInfoRec errorInfo, out IConvolution convolveStream) { convolveStream = null; if (LatencySpecified) { if (convolveStreamExplicitLatencyAvailable.HasValue && !convolveStreamExplicitLatencyAvailable.Value) { errorInfo.ErrorEx = SynthErrorSubCodes.eSynthErrorExConvolverExplicitLatencyNotAvailable; return(SynthErrorCodes.eSynthErrorEx); } if (convolveStreamExplicitLatencyCreator == null) { Type type = null; // TODO: the ConvolveStreamExplicitLatency should be signed so that other plugins can't mask it foreach (Assembly plugin in Program.PluginAssemblies) { foreach (Type candidateType in plugin.GetTypes()) { if (candidateType.IsClass && candidateType.Name == "ConvolveStreamExplicitLatency") { type = candidateType; goto Found; } } } // if you get here - not found convolveStreamExplicitLatencyAvailable = false; errorInfo.ErrorEx = SynthErrorSubCodes.eSynthErrorExConvolverExplicitLatencyNotAvailable; return(SynthErrorCodes.eSynthErrorEx); Found: convolveStreamExplicitLatencyCreator = type.GetMethod("NewConvStream", BindingFlags.Static | BindingFlags.Public); } convolveStream = (IConvolution)convolveStreamExplicitLatencyCreator.Invoke(null, new object[] { (float[])ImpulseResponse, (int)ImpulseResponseLength, (int)Latency, (int)lOversampling }); } else { convolveStream = new ConvolveStreamSimple( ImpulseResponse, ImpulseResponseLength, Latency, lOversampling); } return(SynthErrorCodes.eSynthDone); }
/* this checks all of the objects to make sure that names are unique */ /* *Result is True if they are, or false and presents a warning dialog */ /* if they aren't unique. it returns True if test succeeded or false if */ /* it ran out of memory. */ public static SynthErrorCodes CheckNameUniqueness( Document Document, SynthErrorInfoRec ErrorInfo) { bool NotUnique; SampleCheck( Document.SampleList, Document.AlgoSampList, out NotUnique); if (NotUnique) { ErrorInfo.ErrorEx = SynthErrorSubCodes.eSynthErrorExSomeSamplesHaveSameName; return(SynthErrorCodes.eSynthErrorEx); } WaveTableCheck( Document.WaveTableList, Document.AlgoWaveTableList, out NotUnique); if (NotUnique) { ErrorInfo.ErrorEx = SynthErrorSubCodes.eSynthErrorExSomeWaveTablesHaveSameName; return(SynthErrorCodes.eSynthErrorEx); } InstrCheck( Document.InstrumentList, out NotUnique); if (NotUnique) { ErrorInfo.ErrorEx = SynthErrorSubCodes.eSynthErrorExSomeInstrumentsHaveSameName; return(SynthErrorCodes.eSynthErrorEx); } return(SynthErrorCodes.eSynthDone); }