You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
756 B
Java
31 lines
756 B
Java
package com.company.audioEffekte;
|
|
|
|
public class AudioEffectPlayer {
|
|
|
|
private Audioeffekt[] effects = new Audioeffekt[10];
|
|
private int index = 0;
|
|
|
|
public void play(int indexID) {
|
|
if (indexID < index) {
|
|
effects[indexID].play();
|
|
}
|
|
}
|
|
|
|
public void addEffect(Audioeffekt effect) {
|
|
if (index < effects.length) {
|
|
effects[index] = effect;
|
|
index++;
|
|
} else {
|
|
System.out.println("Alle Plätze belegt");
|
|
}
|
|
}
|
|
|
|
public void removeEffect(int stelleRemove) {
|
|
effects[stelleRemove] = null;
|
|
for (int j = stelleRemove; stelleRemove < index; stelleRemove++) {
|
|
effects[j] = effects[j + 1];
|
|
}
|
|
index = index - 1;
|
|
}
|
|
}
|