/// <summary> /// Fills in a provided raw CSOUND_PARAMS object with csounds current parameter settings. /// This method is used internally to manage this class and is not expected to be used directly by a host program. /// </summary> /// <param name="oparms">a CSOUND_PARAMS structure to be filled in by csound</param> /// <returns>The same parameter structure that was provided but filled in with csounds current internal contents</returns> public CSOUND_PARAMS GetParams() { CSOUND_PARAMS oparms = new CSOUND_PARAMS(); Csound6.NativeMethods.csoundGetParams(csound, oparms); return(oparms); }
public void TestCsoundParameters() { String x = "Host Data String"; using (Csound6Net cs = new Csound6Net(x, CsoundInitFlag.NoFlags, null)) { object o = cs.HostData; Assert.AreEqual(x, o); Assert.AreEqual("Host Data String", cs.HostData); Csound6Parameters opts = new Csound6Parameters(cs); Assert.AreEqual(cs.IsDebugMode, opts.IsDebugMode); Assert.AreEqual(cs.MessageLevel, opts.MessageLevel); opts.IsDebugMode = true; Assert.IsTrue(opts.IsDebugMode); Assert.IsTrue(cs.IsDebugMode); opts.IsDebugMode = false; Assert.IsFalse(cs.IsDebugMode); opts.MessageLevel = MessageLevel.Amps | MessageLevel.Warnings | MessageLevel.Range; Assert.AreEqual(7, (int)opts.MessageLevel); Assert.AreEqual(7, (int)cs.MessageLevel); opts.HardwareBufferFrames = 2048; opts.SoftwareBufferFrames = 512; opts.ZeroDBOverride = 1.0; opts.Tempo = 60; opts.SampleRateOverride = 48000; opts.ControlRateOverride = 48; opts.Heartbeat = HeartbeatStyle.FileSize; opts.IsRealtimeMode = true; opts.IsSampleAccurateMode = true; opts.IsUsingAsciiGraphs = false; opts.IsUsingCsdLineCounts = false; opts.MaximumThreadCount = 4; opts.IsSyntaxCheckOnly = !opts.IsSyntaxCheckOnly; opts.IsDisplayingGraphs = false; opts.MidiKey2Parameter = 4; opts.MidiKeyAsHertz2Parameter = 5; opts.MidiKeyAsOctave2Parameter = 6; opts.MidiKeyAsPitch2Parameter = 7; opts.MidiVelocity2Parameter = 8; opts.MidiVelocityAsAmplitude2Parameter = 9; opts.OutputChannelCountOverride = 2; opts.InputChannelCountOverride = 1; opts.IsAddingDefaultDirectories = false; opts.IsUsingCscore = !opts.IsUsingCscore; opts.WillBeepWhenDone = !opts.WillBeepWhenDone; opts.IsDoneWhenMidiDone = true; opts.IsDeferingGen01Load = !opts.IsDeferingGen01Load; //Have csound copy from oparms to CSOUND_PARAMS and confirm above values got to csound CSOUND_PARAMS copy = new CSOUND_PARAMS(); opts.GetParams(copy); Assert.AreEqual(copy.hardware_buffer_frames, opts.HardwareBufferFrames); Assert.AreEqual(opts.SoftwareBufferFrames, copy.buffer_frames); Assert.AreEqual(opts.ZeroDBOverride, copy.e0dbfs_override); Assert.AreEqual(60, copy.tempo); Assert.AreEqual(48000.0, copy.sample_rate_override); Assert.AreEqual(opts.ControlRateOverride, copy.control_rate_override); Assert.AreEqual(3, copy.heartbeat); Assert.AreEqual(1, copy.realtime_mode); Assert.AreEqual(1, copy.sample_accurate); Assert.AreEqual(0, copy.ascii_graphs); Assert.AreEqual(0, copy.csd_line_counts); Assert.AreEqual(4, copy.midi_key); Assert.AreEqual(5, copy.midi_key_cps); Assert.AreEqual(6, copy.midi_key_oct); Assert.AreEqual(7, copy.midi_key_pch); Assert.AreEqual(8, copy.midi_velocity); Assert.AreEqual(9, copy.midi_velocity_amp); Assert.AreEqual(2, copy.nchnls_override); Assert.AreEqual(1, copy.nchnls_i_override); Assert.AreEqual(1, copy.no_default_paths);//double negative inverted boolean: paramater = false, no_default_paths = 1 Assert.AreEqual(4, copy.number_of_threads); Assert.AreEqual(1, copy.syntax_check_only); Assert.AreEqual(1, copy.ring_bell); Assert.AreEqual(1, copy.use_cscore); Assert.AreEqual(0, copy.displays); Assert.AreEqual(1, copy.terminate_on_midi); Assert.AreEqual(1, copy.defer_gen01_load); } }
/// <summary> /// Transfers the contents of the provided raw CSOUND_PARAMS object into csound's /// internal data structues (chiefly its OPARMS structure). /// This method is used internally to manage this class and is not expected to be used directly by a host program. /// Most values are used and reflected in CSOUND_PARAMS. /// Internally to csound, as of release 6.0.0, Heartbeat and IsComputingOpcodeWeights are ignored /// and IsUsingCsdLineCounts can only be set and never reset once set. /// </summary> /// <param name="parms">a </param> public void SetParams(CSOUND_PARAMS parms) { Csound6.NativeMethods.csoundSetParams(csound, parms); }