コード例 #1
0
        protected static ISimplePerformance GetDefaultPerformance()
        {
            int numberOfVoices = 1;
            IMidiPerformance   midiPerformance    = new MidiPerformance(MidiLink.Instance, MidiValueStrategy.Normalized);
            ISimplePerformance defaultPerformance = new SimplePerformance(midiPerformance, Scale.EqualTemperedScale, numberOfVoices);

            return(defaultPerformance);
        }
コード例 #2
0
ファイル: MidiLink.cs プロジェクト: neilmckg/WPFSynth
        private void DelegateToListeners(Action <IMidiListener> action, MidiChannel channel)
        {
            IEnumerable <IMidiListener> listeners = GetListeners().Where(l => channel == MidiChannel.Omni || l.Channel == MidiChannel.Omni || l.Channel == channel);

            listeners.Execute(action);

            MidiPerformance localCache = _localPerformanceCache.GetOrAdd(channel, c => new MidiPerformance(this)
            {
                Channel = c
            });

            action(localCache);
            if (channel != MidiChannel.Omni)
            {
                // everything that comes in should end up in the omni cache
                MidiPerformance omniCache = _localPerformanceCache.GetOrAdd(MidiChannel.Omni, c => new MidiPerformance(this)
                {
                    Channel = c
                });
                action(omniCache);
            }
        }