Пример #1
0
        public void RemoveFromRegistry(Voice voice)
        {
            VoiceNode node = registry[voice.VoiceParams.channel, voice.VoiceParams.note];

            if (node == null)
            {
                return;
            }
            if (node.Value == voice)
            {
                registry[voice.VoiceParams.channel, voice.VoiceParams.note] = node.Next;
                vnodes.Push(node);
                return;
            }
            else
            {
                VoiceNode node2 = node;
                node = node.Next;
                while (node != null)
                {
                    if (node.Value == voice)
                    {
                        node2.Next = node.Next;
                        vnodes.Push(node);
                        return;
                    }
                    node2 = node;
                    node  = node.Next;
                }
            }
        }
Пример #2
0
        public void AddToRegistry(Voice voice)
        {
            VoiceNode node = vnodes.Pop();

            node.Value = voice;
            node.Next  = registry[voice.VoiceParams.channel, voice.VoiceParams.note];
            registry[voice.VoiceParams.channel, voice.VoiceParams.note] = node;
        }
Пример #3
0
        public void RemoveFromRegistry(int channel, int note)
        {
            VoiceNode node = registry[channel, note];

            while (node != null)
            {
                vnodes.Push(node);
                node = node.Next;
            }
            registry[channel, note] = null;
        }
Пример #4
0
        public void ClearRegistry()
        {
            LinkedListNode <Voice> node = activeVoices.First;

            while (node != null)
            {
                VoiceNode vnode = registry[node.Value.VoiceParams.channel, node.Value.VoiceParams.note];
                while (vnode != null)
                {
                    vnodes.Push(vnode);
                    vnode = vnode.Next;
                }
                registry[node.Value.VoiceParams.channel, node.Value.VoiceParams.note] = null;
                node = node.Next;
            }
        }
Пример #5
0
 //--Public Methods
 public VoiceManager(int voiceCount)
 {
     stealingMethod = VoiceStealEnum.Quietest;
     polyphony      = voiceCount;
     //initialize voice containers
     voicePool = new Voice[voiceCount];
     VoiceNode[] nodes = new VoiceNode[voiceCount];
     for (int x = 0; x < voicePool.Length; x++)
     {
         voicePool[x] = new Voice();
         nodes[x]     = new VoiceNode();
     }
     vnodes = new Stack <VoiceNode>(nodes);
     //free voice list
     freeVoices   = new LinkedList <Voice>(voicePool);
     activeVoices = new LinkedList <Voice>();
     registry     = new VoiceNode[Synthesizer.DefaultChannelCount, Synthesizer.DefaultKeyCount];
 }
 //--Public Methods
 public VoiceManager(int voiceCount)
 {
     stealingMethod = VoiceStealEnum.Quietest;
     polyphony = voiceCount;
     //initialize voice containers
     voicePool = new Voice[voiceCount];
     VoiceNode[] nodes = new VoiceNode[voiceCount];
     for (int x = 0; x < voicePool.Length; x++)
     {
         voicePool[x] = new Voice();
         nodes[x] = new VoiceNode();
     }
     vnodes = new Stack<VoiceNode>(nodes);
     //free voice list
     freeVoices = new LinkedList<Voice>(voicePool);
     activeVoices = new LinkedList<Voice>();
     registry = new VoiceNode[Synthesizer.DefaultChannelCount, Synthesizer.DefaultKeyCount];
 }
Пример #7
0
 public VoiceNode()
 {
     Value = null;
     Next  = null;
 }