109 110 public float getAttenuation() { 111 return 0; 112 } 113 114 public int getChannels() { 115 return 1; 116 } 117 118 public String getName() { 119 return getClass().getName(); 120 } 121 122 public Patch getPatch() { 123 return new Patch(0, 0); 124 } 125 126 public ModelOscillatorStream open(float samplerate) { 127 ModelAbstractOscillator oscs; 128 try { 129 oscs = this.getClass().newInstance(); 130 } catch (InstantiationException e) { 131 throw new IllegalArgumentException(e); 132 } catch (IllegalAccessException e) { 133 throw new IllegalArgumentException(e); 134 } 135 oscs.setSampleRate(samplerate); 136 oscs.init(); 137 return oscs; 138 } 139 140 public ModelPerformer getPerformer() { 141 // Create performer for my custom oscillirator 142 ModelPerformer performer = new ModelPerformer(); 143 performer.getOscillators().add(this); 144 return performer; 145 146 } 147 148 public ModelInstrument getInstrument() { 149 // Create Instrument object around my performer 150 SimpleInstrument ins = new SimpleInstrument(); 151 ins.setName(getName()); 152 ins.add(getPerformer()); | 109 110 public float getAttenuation() { 111 return 0; 112 } 113 114 public int getChannels() { 115 return 1; 116 } 117 118 public String getName() { 119 return getClass().getName(); 120 } 121 122 public Patch getPatch() { 123 return new Patch(0, 0); 124 } 125 126 public ModelOscillatorStream open(float samplerate) { 127 ModelAbstractOscillator oscs; 128 try { 129 @SuppressWarnings("deprecation") 130 ModelAbstractOscillator tmp = this.getClass().newInstance(); 131 oscs = tmp; 132 } catch (InstantiationException | IllegalAccessException e) { 133 throw new IllegalArgumentException(e); 134 } 135 oscs.setSampleRate(samplerate); 136 oscs.init(); 137 return oscs; 138 } 139 140 public ModelPerformer getPerformer() { 141 // Create performer for my custom oscillirator 142 ModelPerformer performer = new ModelPerformer(); 143 performer.getOscillators().add(this); 144 return performer; 145 146 } 147 148 public ModelInstrument getInstrument() { 149 // Create Instrument object around my performer 150 SimpleInstrument ins = new SimpleInstrument(); 151 ins.setName(getName()); 152 ins.add(getPerformer()); |