~ubuntu-branches/ubuntu/oneiric/tuxguitar/oneiric

« back to all changes in this revision

Viewing changes to TuxGuitar/src/org/herac/tuxguitar/song/models/TGChannel.java

  • Committer: Bazaar Package Importer
  • Author(s): Philippe Coval
  • Date: 2008-06-19 00:30:30 UTC
  • mto: (5.1.2 sid)
  • mto: This revision was merged to the branch mainline in revision 3.
  • Revision ID: james.westby@ubuntu.com-20080619003030-h719szrhsngou7c6
Tags: upstream-1.0
ImportĀ upstreamĀ versionĀ 1.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
package org.herac.tuxguitar.song.models;
 
2
 
 
3
import org.herac.tuxguitar.song.factory.TGFactory;
 
4
 
 
5
public abstract class TGChannel {
 
6
        public static final short DEFAULT_PERCUSSION_CHANNEL = 9;
 
7
        
 
8
        public static final short DEFAULT_INSTRUMENT = 25;
 
9
        public static final short DEFAULT_VOLUME = 127;
 
10
        public static final short DEFAULT_BALANCE = 64;
 
11
        public static final short DEFAULT_CHORUS = 0;
 
12
        public static final short DEFAULT_REVERB = 0;
 
13
        public static final short DEFAULT_PHASER = 0;
 
14
        public static final short DEFAULT_TREMOLO = 0;
 
15
        public static final boolean DEFAULT_SOLO = false;
 
16
        public static final boolean DEFAULT_MUTE = false;
 
17
        
 
18
        private short channel;
 
19
        private short effectChannel;
 
20
        private short instrument;
 
21
        private short volume;
 
22
        private short balance;
 
23
        private short chorus;
 
24
        private short reverb;
 
25
        private short phaser;
 
26
        private short tremolo;
 
27
        private boolean solo;
 
28
        private boolean mute;
 
29
        
 
30
        public TGChannel() {
 
31
                this.channel = 0;
 
32
                this.effectChannel = 0;
 
33
                this.instrument = DEFAULT_INSTRUMENT;
 
34
                this.volume = DEFAULT_VOLUME;
 
35
                this.balance = DEFAULT_BALANCE;
 
36
                this.chorus = DEFAULT_CHORUS;
 
37
                this.reverb = DEFAULT_REVERB;
 
38
                this.phaser = DEFAULT_PHASER;
 
39
                this.tremolo = DEFAULT_TREMOLO;
 
40
                this.solo = DEFAULT_SOLO;
 
41
                this.mute = DEFAULT_MUTE;
 
42
        }
 
43
        
 
44
        public short getBalance() {
 
45
                return this.balance;
 
46
        }
 
47
        
 
48
        public void setBalance(short balance) {
 
49
                this.balance = balance;
 
50
        }
 
51
        
 
52
        public short getChannel() {
 
53
                return this.channel;
 
54
        }
 
55
        
 
56
        public void setChannel(short channel) {
 
57
                this.channel = channel;
 
58
        }
 
59
        
 
60
        public short getEffectChannel() {
 
61
                return this.effectChannel;
 
62
        }
 
63
        
 
64
        public void setEffectChannel(short effectChannel) {
 
65
                this.effectChannel = effectChannel;
 
66
        }
 
67
        
 
68
        public short getChorus() {
 
69
                return this.chorus;
 
70
        }
 
71
        
 
72
        public void setChorus(short chorus) {
 
73
                this.chorus = chorus;
 
74
        }
 
75
        
 
76
        public short getInstrument() {
 
77
                return (!this.isPercussionChannel()?this.instrument:0);
 
78
        }
 
79
        
 
80
        public void setInstrument(short instrument) {
 
81
                this.instrument = instrument;
 
82
        }
 
83
        
 
84
        public short getPhaser() {
 
85
                return this.phaser;
 
86
        }
 
87
        
 
88
        public void setPhaser(short phaser) {
 
89
                this.phaser = phaser;
 
90
        }
 
91
        
 
92
        public short getReverb() {
 
93
                return this.reverb;
 
94
        }
 
95
        
 
96
        public void setReverb(short reverb) {
 
97
                this.reverb = reverb;
 
98
        }
 
99
        
 
100
        public short getTremolo() {
 
101
                return this.tremolo;
 
102
        }
 
103
        
 
104
        public void setTremolo(short tremolo) {
 
105
                this.tremolo = tremolo;
 
106
        }
 
107
        
 
108
        public short getVolume() {
 
109
                return this.volume;
 
110
        }
 
111
        
 
112
        public void setVolume(short volume) {
 
113
                this.volume = volume;
 
114
        }
 
115
        
 
116
        public boolean isMute() {
 
117
                return this.mute;
 
118
        }
 
119
        
 
120
        public void setMute(boolean mute) {
 
121
                this.mute = mute;
 
122
        }
 
123
        
 
124
        public boolean isSolo() {
 
125
                return this.solo;
 
126
        }
 
127
        
 
128
        public void setSolo(boolean solo) {
 
129
                this.solo = solo;
 
130
        }
 
131
        
 
132
        public boolean isPercussionChannel(){
 
133
                return TGChannel.isPercussionChannel(this.getChannel());
 
134
        }
 
135
        
 
136
        public static boolean isPercussionChannel(int channel){
 
137
                return (channel == DEFAULT_PERCUSSION_CHANNEL);
 
138
        }
 
139
        
 
140
        public static void setPercusionChannel(TGChannel channel){
 
141
                channel.setChannel(DEFAULT_PERCUSSION_CHANNEL);
 
142
                channel.setEffectChannel(DEFAULT_PERCUSSION_CHANNEL);
 
143
        }
 
144
        
 
145
        public static TGChannel newPercusionChannel(TGFactory factory){
 
146
                TGChannel channel = factory.newChannel();
 
147
                TGChannel.setPercusionChannel(channel);
 
148
                return channel;
 
149
        }
 
150
        
 
151
        public TGChannel clone(TGFactory factory){
 
152
                TGChannel channel = factory.newChannel();
 
153
                copy(channel);
 
154
                return channel; 
 
155
        }
 
156
        
 
157
        public void copy(TGChannel channel){
 
158
                channel.setChannel(getChannel());
 
159
                channel.setEffectChannel(getEffectChannel());
 
160
                channel.setInstrument(getInstrument());
 
161
                channel.setVolume(getVolume());
 
162
                channel.setBalance(getBalance());
 
163
                channel.setChorus(getChorus());
 
164
                channel.setReverb(getReverb());
 
165
                channel.setPhaser(getPhaser());
 
166
                channel.setTremolo(getTremolo());
 
167
                channel.setSolo(isSolo());
 
168
                channel.setMute(isMute());
 
169
        }
 
170
        
 
171
}