1 /* 2 * Created on 26-dic-2005 3 * 4 * TODO To change the template for this generated file go to 5 * Window - Preferences - Java - Code Style - Code Templates 6 */ 7 package org.herac.tuxguitar.song.models; 8 9 import org.herac.tuxguitar.song.factory.TGFactory; 10 import org.herac.tuxguitar.song.models.effects.TGEffectBend; 11 import org.herac.tuxguitar.song.models.effects.TGEffectGrace; 12 import org.herac.tuxguitar.song.models.effects.TGEffectHarmonic; 13 import org.herac.tuxguitar.song.models.effects.TGEffectTremoloBar; 14 import org.herac.tuxguitar.song.models.effects.TGEffectTremoloPicking; 15 import org.herac.tuxguitar.song.models.effects.TGEffectTrill; 16 17 /** 18 * @author julian 19 * 20 * TODO To change the template for this generated type comment go to 21 * Window - Preferences - Java - Code Style - Code Templates 22 */ 23 public abstract class TGNoteEffect { 24 private TGEffectBend bend; 25 private TGEffectTremoloBar tremoloBar; 26 private TGEffectHarmonic harmonic; 27 private TGEffectGrace grace; 28 private TGEffectTrill trill; 29 private TGEffectTremoloPicking tremoloPicking; 30 private boolean vibrato; 31 private boolean deadNote; 32 private boolean slide; 33 private boolean hammer; 34 private boolean ghostNote; 35 private boolean accentuatedNote; 36 private boolean heavyAccentuatedNote; 37 private boolean palmMute; 38 private boolean staccato; 39 private boolean tapping; 40 private boolean slapping; 41 private boolean popping; 42 private boolean fadeIn; 43 TGNoteEffect()44 public TGNoteEffect(){ 45 this.bend = null; 46 this.tremoloBar = null; 47 this.harmonic = null; 48 this.grace = null; 49 this.trill = null; 50 this.tremoloPicking = null; 51 this.vibrato = false; 52 this.deadNote = false; 53 this.slide = false; 54 this.hammer = false; 55 this.ghostNote = false; 56 this.accentuatedNote = false; 57 this.heavyAccentuatedNote = false; 58 this.palmMute = false; 59 this.staccato = false; 60 this.tapping = false; 61 this.slapping = false; 62 this.popping = false; 63 this.fadeIn = false; 64 } 65 isDeadNote()66 public boolean isDeadNote() { 67 return this.deadNote; 68 } 69 setDeadNote(boolean deadNote)70 public void setDeadNote(boolean deadNote) { 71 this.deadNote = deadNote; 72 //si es true, quito los efectos incompatibles 73 if(this.isDeadNote()){ 74 this.tremoloBar = null; 75 this.bend = null; 76 this.trill = null; 77 this.slide = false; 78 this.hammer = false; 79 } 80 } 81 isVibrato()82 public boolean isVibrato() { 83 return this.vibrato; 84 } setVibrato(boolean vibrato)85 public void setVibrato(boolean vibrato) { 86 this.vibrato = vibrato; 87 //si no es null quito los efectos incompatibles 88 if(this.isVibrato()){ 89 this.trill = null; 90 } 91 } 92 getBend()93 public TGEffectBend getBend() { 94 return this.bend; 95 } 96 setBend(TGEffectBend bend)97 public void setBend(TGEffectBend bend) { 98 this.bend = bend; 99 //si no es null quito los efectos incompatibles 100 if(this.isBend()){ 101 this.tremoloBar = null; 102 this.trill = null; 103 this.deadNote = false; 104 this.slide = false; 105 this.hammer = false; 106 } 107 } 108 isBend()109 public boolean isBend() { 110 return (this.bend != null && !this.bend.getPoints().isEmpty()); 111 } 112 getTremoloBar()113 public TGEffectTremoloBar getTremoloBar() { 114 return this.tremoloBar; 115 } 116 setTremoloBar(TGEffectTremoloBar tremoloBar)117 public void setTremoloBar(TGEffectTremoloBar tremoloBar) { 118 this.tremoloBar = tremoloBar; 119 //si no es null quito los efectos incompatibles 120 if(this.isTremoloBar()){ 121 this.bend = null; 122 this.trill = null; 123 this.deadNote = false; 124 this.slide = false; 125 this.hammer = false; 126 } 127 } 128 isTremoloBar()129 public boolean isTremoloBar() { 130 return (this.tremoloBar != null); 131 } 132 133 getTrill()134 public TGEffectTrill getTrill() { 135 return this.trill; 136 } 137 setTrill(TGEffectTrill trill)138 public void setTrill(TGEffectTrill trill) { 139 this.trill = trill; 140 //si es true, quito los efectos incompatibles 141 if(this.isTrill()){ 142 this.bend = null; 143 this.tremoloBar = null; 144 this.tremoloPicking = null; 145 this.slide = false; 146 this.hammer = false; 147 this.deadNote = false; 148 this.vibrato = false; 149 } 150 } 151 isTrill()152 public boolean isTrill() { 153 return (this.trill != null); 154 } 155 getTremoloPicking()156 public TGEffectTremoloPicking getTremoloPicking() { 157 return this.tremoloPicking; 158 } 159 setTremoloPicking(TGEffectTremoloPicking tremoloPicking)160 public void setTremoloPicking(TGEffectTremoloPicking tremoloPicking) { 161 this.tremoloPicking = tremoloPicking; 162 //si es true, quito los efectos incompatibles 163 if(this.isTremoloPicking()){ 164 this.trill = null; 165 this.bend = null; 166 this.tremoloBar = null; 167 this.slide = false; 168 this.hammer = false; 169 this.deadNote = false; 170 this.vibrato = false; 171 } 172 } 173 isTremoloPicking()174 public boolean isTremoloPicking() { 175 return (this.tremoloPicking != null); 176 } 177 isHammer()178 public boolean isHammer() { 179 return this.hammer; 180 } 181 setHammer(boolean hammer)182 public void setHammer(boolean hammer) { 183 this.hammer = hammer; 184 //si es true, quito los efectos incompatibles 185 if(this.isHammer()){ 186 this.trill = null; 187 this.tremoloBar = null; 188 this.bend = null; 189 this.deadNote = false; 190 this.slide = false; 191 } 192 } 193 isSlide()194 public boolean isSlide() { 195 return this.slide; 196 } 197 setSlide(boolean slide)198 public void setSlide(boolean slide) { 199 this.slide = slide; 200 //si es true, quito los efectos incompatibles 201 if(this.isSlide()){ 202 this.trill = null; 203 this.tremoloBar = null; 204 this.bend = null; 205 this.deadNote = false; 206 this.hammer = false; 207 } 208 } 209 isGhostNote()210 public boolean isGhostNote() { 211 return this.ghostNote; 212 } 213 setGhostNote(boolean ghostNote)214 public void setGhostNote(boolean ghostNote) { 215 this.ghostNote = ghostNote; 216 //si es true, quito los efectos incompatibles 217 if(this.isGhostNote()){ 218 this.accentuatedNote = false; 219 this.heavyAccentuatedNote = false; 220 } 221 } 222 isAccentuatedNote()223 public boolean isAccentuatedNote() { 224 return this.accentuatedNote; 225 } 226 setAccentuatedNote(boolean accentuatedNote)227 public void setAccentuatedNote(boolean accentuatedNote) { 228 this.accentuatedNote = accentuatedNote; 229 //si es true, quito los efectos incompatibles 230 if(this.isAccentuatedNote()){ 231 this.ghostNote = false; 232 this.heavyAccentuatedNote = false; 233 } 234 } 235 isHeavyAccentuatedNote()236 public boolean isHeavyAccentuatedNote() { 237 return this.heavyAccentuatedNote; 238 } 239 setHeavyAccentuatedNote(boolean heavyAccentuatedNote)240 public void setHeavyAccentuatedNote(boolean heavyAccentuatedNote) { 241 this.heavyAccentuatedNote = heavyAccentuatedNote; 242 //si es true, quito los efectos incompatibles 243 if(this.isHeavyAccentuatedNote()){ 244 this.ghostNote = false; 245 this.accentuatedNote = false; 246 } 247 } 248 setHarmonic(TGEffectHarmonic harmonic)249 public void setHarmonic(TGEffectHarmonic harmonic) { 250 this.harmonic = harmonic; 251 } 252 getHarmonic()253 public TGEffectHarmonic getHarmonic() { 254 return this.harmonic; 255 } 256 isHarmonic()257 public boolean isHarmonic() { 258 return (this.harmonic != null); 259 } 260 getGrace()261 public TGEffectGrace getGrace() { 262 return this.grace; 263 } 264 setGrace(TGEffectGrace grace)265 public void setGrace(TGEffectGrace grace) { 266 this.grace = grace; 267 } 268 isGrace()269 public boolean isGrace() { 270 return (this.grace != null); 271 } 272 isPalmMute()273 public boolean isPalmMute() { 274 return this.palmMute; 275 } 276 setPalmMute(boolean palmMute)277 public void setPalmMute(boolean palmMute) { 278 this.palmMute = palmMute; 279 //si es true, quito los efectos incompatibles 280 if(this.isPalmMute()){ 281 this.staccato = false; 282 } 283 } 284 isStaccato()285 public boolean isStaccato() { 286 return this.staccato; 287 } 288 setStaccato(boolean staccato)289 public void setStaccato(boolean staccato) { 290 this.staccato = staccato; 291 //si es true, quito los efectos incompatibles 292 if(this.isStaccato()){ 293 this.palmMute = false; 294 } 295 } 296 isPopping()297 public boolean isPopping() { 298 return this.popping; 299 } 300 setPopping(boolean popping)301 public void setPopping(boolean popping) { 302 this.popping = popping; 303 //si es true, quito los efectos incompatibles 304 if(this.isPopping()){ 305 this.tapping = false; 306 this.slapping = false; 307 } 308 } 309 isSlapping()310 public boolean isSlapping() { 311 return this.slapping; 312 } 313 setSlapping(boolean slapping)314 public void setSlapping(boolean slapping) { 315 this.slapping = slapping; 316 //si es true, quito los efectos incompatibles 317 if(this.isSlapping()){ 318 this.tapping = false; 319 this.popping = false; 320 } 321 } 322 isTapping()323 public boolean isTapping() { 324 return this.tapping; 325 } 326 setTapping(boolean tapping)327 public void setTapping(boolean tapping) { 328 this.tapping = tapping; 329 //si es true, quito los efectos incompatibles 330 if(this.isTapping()){ 331 this.slapping = false; 332 this.popping = false; 333 } 334 } 335 isFadeIn()336 public boolean isFadeIn() { 337 return this.fadeIn; 338 } 339 setFadeIn(boolean fadeIn)340 public void setFadeIn(boolean fadeIn) { 341 this.fadeIn = fadeIn; 342 } 343 hasAnyEffect()344 public boolean hasAnyEffect(){ 345 return (isBend() || 346 isTremoloBar() || 347 isHarmonic() || 348 isGrace() || 349 isTrill() || 350 isTremoloPicking() || 351 isVibrato() || 352 isDeadNote() || 353 isSlide() || 354 isHammer() || 355 isGhostNote() || 356 isAccentuatedNote() || 357 isHeavyAccentuatedNote() || 358 isPalmMute() || 359 isStaccato() || 360 isTapping() || 361 isSlapping() || 362 isPopping() || 363 isFadeIn()); 364 } 365 clone(TGFactory factory)366 public TGNoteEffect clone(TGFactory factory){ 367 TGNoteEffect effect = factory.newEffect(); 368 effect.setVibrato(isVibrato()); 369 effect.setDeadNote(isDeadNote()); 370 effect.setSlide(isSlide()); 371 effect.setHammer(isHammer()); 372 effect.setGhostNote(isGhostNote()); 373 effect.setAccentuatedNote(isAccentuatedNote()); 374 effect.setHeavyAccentuatedNote(isHeavyAccentuatedNote()); 375 effect.setPalmMute(isPalmMute()); 376 effect.setStaccato(isStaccato()); 377 effect.setTapping(isTapping()); 378 effect.setSlapping(isSlapping()); 379 effect.setPopping(isPopping()); 380 effect.setFadeIn(isFadeIn()); 381 effect.setBend(isBend()?(TGEffectBend)this.bend.clone(factory):null); 382 effect.setTremoloBar(isTremoloBar()?(TGEffectTremoloBar)this.tremoloBar.clone(factory):null); 383 effect.setHarmonic(isHarmonic()?(TGEffectHarmonic)this.harmonic.clone(factory):null); 384 effect.setGrace(isGrace()?(TGEffectGrace)this.grace.clone(factory):null); 385 effect.setTrill(isTrill()?(TGEffectTrill)this.trill.clone(factory):null); 386 effect.setTremoloPicking(isTremoloPicking()?(TGEffectTremoloPicking)this.tremoloPicking.clone(factory):null); 387 return effect; 388 } 389 390 } 391