~ubuntu-branches/ubuntu/hoary/kdemultimedia/hoary

« back to all changes in this revision

Viewing changes to kmid/player/voiceman.h

  • Committer: Bazaar Package Importer
  • Author(s): Martin Schulze
  • Date: 2003-01-22 15:00:51 UTC
  • Revision ID: james.westby@ubuntu.com-20030122150051-uihwkdoxf15mi1tn
Tags: upstream-2.2.2
ImportĀ upstreamĀ versionĀ 2.2.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*  voiceman.h - The voiceManager class handles a set of voices for synths
 
2
    Copyright (C) 1997,98,99,2000  Antonio Larrosa Jimenez
 
3
 
 
4
    This program is free software; you can redistribute it and/or modify
 
5
    it under the terms of the GNU General Public License as published by
 
6
    the Free Software Foundation; either version 2 of the License, or
 
7
    (at your option) any later version.
 
8
 
 
9
    This program is distributed in the hope that it will be useful,
 
10
    but WITHOUT ANY WARRANTY; without even the implied warranty of
 
11
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
12
    GNU General Public License for more details.
 
13
 
 
14
    You should have received a copy of the GNU General Public License
 
15
    along with this program; if not, write to the Free Software
 
16
    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
17
 
 
18
    Send comments and bug fixes to antlarr@arrakis.es
 
19
    or to Antonio Larrosa, Rio Arnoya, 10 5B, 29006 Malaga, Spain
 
20
 
 
21
***************************************************************************/
 
22
#ifndef _VOICEMAN_H
 
23
#define _VOICEMAN_H
 
24
 
 
25
class voiceManager
 
26
{
 
27
private:
 
28
    int nvoices;
 
29
 
 
30
    struct voice
 
31
        {
 
32
        int     id;
 
33
        int     channel;
 
34
        int     note;
 
35
        int     used;
 
36
        
 
37
        struct voice *prev;
 
38
        struct voice *next;
 
39
        };
 
40
   voice *FirstVoice; // Points to the beginning of the voice list, that is, to
 
41
                        // the older voice which is ready to be used
 
42
   voice *LastVoice; // Points to the last voice, I mean, the latest used
 
43
                        // voice
 
44
 
 
45
   voice *LastnotusedVoice; // Points to the latest (list order) not used voice
 
46
                        //, that is, to where deallocated voices will be moved
 
47
 
 
48
   voice **VoiceList; // Array with pointer to the voices, arranged by id for
 
49
                        // faster search
 
50
 
 
51
   voice *searcher; // Variable used to search channels
 
52
 
 
53
   voice *searcher_aid; // An auxiliary variable for simpler searches
 
54
public:
 
55
   voiceManager(int totalvoices);
 
56
   ~voiceManager();
 
57
 
 
58
   int allocateVoice(int chn,int key);
 
59
   void deallocateVoice(int id);
 
60
 
 
61
   void initSearch(void); // call this function always before Search !!!
 
62
   int Search(int chn); //returns -1 if channel chn is not currently used
 
63
                        // Continue searching for more voices which
 
64
                        // use the channel chn
 
65
   int Search(int chn,int note); // The same but also looks for a note
 
66
 
 
67
 
 
68
   int Channel(int v) {return VoiceList[v]->channel;};
 
69
   int Note(int v) {return VoiceList[v]->note;};
 
70
   int Used(int v) {return VoiceList[v]->used;};
 
71
 
 
72
   void dispStat(void);
 
73
 
 
74
   void cleanLists(void);
 
75
};
 
76
 
 
77
#endif