コード例 #1
0
 public MidiFileSequencer(Synthesizer synth)
 {
     Synth = synth;
     _eventIndex = 0;
     _division = 0;
     PlaybackSpeed = 1;
     IsPlaying = false;
     _blockList = new bool[SynthConstants.DefaultChannelCount];
     _finished = new FastList<Action>();
     synth.AddMidiMessageProcessed(MidiEventProcessed);
 }
コード例 #2
0
        public SynthParameters(Synthesizer synth)
        {
            Synth = synth;

            Pan            = new CCValue(0);
            Volume         = new CCValue(0);
            Expression     = new CCValue(0);
            ModRange       = new CCValue(0);
            PitchBend      = new CCValue(0);
            MasterFineTune = new CCValue(0);
            Rpn            = new CCValue(0);

            CurrentPan = new PanComponent();

            ResetControllers();
        }
コード例 #3
0
        public SynthParameters(Synthesizer synth)
        {
            Synth = synth;

            Pan = new CCValue(0);
            Volume = new CCValue(0);
            Expression = new CCValue(0);
            ModRange = new CCValue(0);
            PitchBend = new CCValue(0);
            MasterFineTune = new CCValue(0);
            Rpn = new CCValue(0);

            CurrentPan = new PanComponent();

            ResetControllers();
        }
コード例 #4
0
ファイル: SynthPlayer.cs プロジェクト: eriser/alphaSynth
        public SynthPlayer()
        {
            Logger.Debug("Initializing player");

            State = SynthPlayerState.Stopped;
            OnPlayerStateChanged(new PlayerStateChangedEventArgs(State));

            Logger.Debug("Opening output");
            Output = Platform.Platform.CreateOutput();

            Logger.Debug("Creating synthesizer");
            Synth = new Synthesizer(Output.SampleRate, SynthConstants.AudioChannels, 441, 3, 100);
            Sequencer = new MidiFileSequencer(Synth);

            Sequencer.AddFinishedListener(Output.SequencerFinished);

            Output.Finished += () =>
            {
                // stop everything
                Stop();
                Logger.Debug("Finished playback");
                OnFinished();
            };
            Output.SampleRequest += () =>
            {
                // synthesize buffer
                Sequencer.FillMidiEventQueue();
                Synth.Synthesize();
                // send it to output
                Output.AddSamples(Synth.SampleBuffer);
            };
            Output.PositionChanged += pos =>
            {
                // log position
                FirePositionChanged(pos);
            };

            Output.Open();
        }