1
package org.herac.tuxguitar.song.models;
3
import org.herac.tuxguitar.song.factory.TGFactory;
5
public abstract class TGChannel {
6
public static final short DEFAULT_PERCUSSION_CHANNEL = 9;
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;
18
private short channel;
19
private short effectChannel;
20
private short instrument;
22
private short balance;
26
private short tremolo;
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;
44
public short getBalance() {
48
public void setBalance(short balance) {
49
this.balance = balance;
52
public short getChannel() {
56
public void setChannel(short channel) {
57
this.channel = channel;
60
public short getEffectChannel() {
61
return this.effectChannel;
64
public void setEffectChannel(short effectChannel) {
65
this.effectChannel = effectChannel;
68
public short getChorus() {
72
public void setChorus(short chorus) {
76
public short getInstrument() {
77
return (!this.isPercussionChannel()?this.instrument:0);
80
public void setInstrument(short instrument) {
81
this.instrument = instrument;
84
public short getPhaser() {
88
public void setPhaser(short phaser) {
92
public short getReverb() {
96
public void setReverb(short reverb) {
100
public short getTremolo() {
104
public void setTremolo(short tremolo) {
105
this.tremolo = tremolo;
108
public short getVolume() {
112
public void setVolume(short volume) {
113
this.volume = volume;
116
public boolean isMute() {
120
public void setMute(boolean mute) {
124
public boolean isSolo() {
128
public void setSolo(boolean solo) {
132
public boolean isPercussionChannel(){
133
return TGChannel.isPercussionChannel(this.getChannel());
136
public static boolean isPercussionChannel(int channel){
137
return (channel == DEFAULT_PERCUSSION_CHANNEL);
140
public static void setPercusionChannel(TGChannel channel){
141
channel.setChannel(DEFAULT_PERCUSSION_CHANNEL);
142
channel.setEffectChannel(DEFAULT_PERCUSSION_CHANNEL);
145
public static TGChannel newPercusionChannel(TGFactory factory){
146
TGChannel channel = factory.newChannel();
147
TGChannel.setPercusionChannel(channel);
151
public TGChannel clone(TGFactory factory){
152
TGChannel channel = factory.newChannel();
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());