/// <summary> /// MusicPlayer クラスの新しいインスタンスを初期化します。 /// </summary> public MusicPlayer(MusicOptions options) { if (options == null) throw new ArgumentNullException("options"); this.bufferSize = options.BufferSize; this.bufferCount = options.BufferCount; this.samplingRate = options.SamplingRate; this.updateInterval = options.UpdateInterval; this.context = new AudioContext(); this.master = new Master(options.SamplingRate, 23); this.preset = new Preset(); this.layer = new Dictionary<string, SequenceLayer>(); this.source = AL.GenSource(); this.buffers = AL.GenBuffers(this.bufferCount); this.sbuf = new short[this.bufferSize]; this.fbuf = new float[this.bufferSize]; foreach (int buffer in this.buffers) this.FillBuffer(buffer); AL.SourceQueueBuffers(this.source, this.buffers.Length, this.buffers); AL.SourcePlay(this.source); this.Updater = Task.Factory.StartNew(this.Update); }
/// <summary> /// パラメータを指定して新しい SequenceLayer クラスのインスタンスを初期化します。 /// </summary> /// <param name="preset">適用されるプリセット。</param> /// <param name="master">シーケンサの送出先となるマスターオブジェクト。</param> /// <param name="targetParts">このレイヤーが通過させるハンドルのターゲットパート。</param> public SequenceLayer(Preset preset, Master master, IEnumerable<int> targetParts = null) { if (preset == null) throw new ArgumentNullException("preset"); if (master == null) throw new ArgumentNullException("master"); this.preset = preset; this.master = master; this.targetParts = (targetParts == null) ? new int[0] : targetParts.ToArray(); }
/// <summary> /// サンプリング周波数を指定して新しい MidiConnector クラスのインスタンスを初期化します。 /// </summary> /// <param name="samplingFreq">サンプリング周波数。</param> public MidiConnector(float samplingFreq) { const int Part = 15 + 8; this.presets = new List<ProgramPreset>(); this.drumset = new List<DrumPreset>(); this.presetFiles = new List<string>(); this.uxMaster = new Master(samplingFreq, Part); this.partLsb = new int[Part]; this.partMsb = new int[Part]; this.partProgram = new int[Part]; this.nowPresets = new ProgramPreset[Part]; }
public void ApplyToMaster(Master master) { if (master != null) { master.MasterVolume = this.trackBar_mastervolume.Value / 100.0f; master.Ratio = this.trackBar_compressor_ratio.Value / 100.0f; master.Threshold = this.trackBar_compressor_threshold.Value / 100.0f; } }