voiceman.h

00001 /*  voiceman.h - The VoiceManager class handles a set of voices for synths
00002     This file is part of LibKMid 0.9.5
00003     Copyright (C) 1997,98,99,2000  Antonio Larrosa Jimenez
00004     LibKMid's homepage : http://www.arrakis.es/~rlarrosa/libkmid.html
00005 
00006     This library is free software; you can redistribute it and/or
00007     modify it under the terms of the GNU Library General Public
00008     License as published by the Free Software Foundation; either
00009     version 2 of the License, or (at your option) any later version.
00010  
00011     This library is distributed in the hope that it will be useful,
00012     but WITHOUT ANY WARRANTY; without even the implied warranty of
00013     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014     Library General Public License for more details.
00015  
00016     You should have received a copy of the GNU Library General Public License
00017     along with this library; see the file COPYING.LIB.  If not, write to
00018     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00019     Boston, MA 02110-1301, USA.                                                  
00020 
00021     Send comments and bug fixes to Antonio Larrosa <larrosa@kde.org>
00022 
00023 ***************************************************************************/
00024 #ifndef _VOICEMAN_H
00025 #define _VOICEMAN_H
00026 
00035 class VoiceManager
00036 {
00037   private:
00038     class VoiceManagerPrivate;
00039     VoiceManagerPrivate *d;
00040 
00044     int nvoices;
00045 
00049     struct voice
00050     {
00051       int     id;
00052       int   channel;
00053       int   note;
00054       int   used;
00055 
00056       struct voice *prev;
00057       struct voice *next;
00058     };
00059 
00064     voice *FirstVoice; 
00065 
00069     voice *LastVoice; 
00070 
00075     voice *LastnotusedVoice; 
00076 
00080     voice **VoiceList; 
00081 
00086     voice *searcher; 
00087 
00092     voice *searcher_aid; 
00093 
00094   public:
00098     VoiceManager(int totalvoices);
00099 
00103     ~VoiceManager();
00104 
00112     int allocateVoice(int chn,int key);
00113 
00119     void deallocateVoice(int id);
00120 
00127     void initSearch(void); 
00128 
00138     int search(int chn); 
00139     //returns -1 if channel chn is not currently used
00140     // Continue searching for more voices which
00141     // use the channel chn
00142 
00149     int search(int chn,int note);
00150 
00154     int channel(int v) {return VoiceList[v]->channel;};
00155 
00159     int note(int v) {return VoiceList[v]->note;};
00160 
00164     int used(int v) {return VoiceList[v]->used;};
00165 
00169     void clearLists(void);
00170 };
00171 
00172 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys