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

« back to all changes in this revision

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