Skip to content

Commit a9a0f25

Browse files
committed
Avoid including Processing::Proxy for out
1 parent d22e7ff commit a9a0f25

File tree

2 files changed

+8
-10
lines changed

2 files changed

+8
-10
lines changed

external_library/java/minim/create_instrument.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,12 @@ def setup
2727
minim = Minim.new(self)
2828
@out = minim.getLineOut
2929
# when providing an Instrument, we always specify start time and duration
30-
out.playNote(0.0, 0.9, SineInstrument.new(97.99))
31-
out.playNote(1.0, 0.9, SineInstrument.new(123.47))
30+
out.playNote(0.0, 0.9, SineInstrument.new(out, 97.99))
31+
out.playNote(1.0, 0.9, SineInstrument.new(out, 123.47))
3232
# we can use the Frequency class to create frequencies from pitch names
33-
out.playNote(2.0, 2.9, SineInstrument.new(Frequency.ofPitch('C3').asHz))
34-
out.playNote(3.0, 1.9, SineInstrument.new(Frequency.ofPitch('E3').asHz))
35-
out.playNote(4.0, 0.9, SineInstrument.new(Frequency.ofPitch('G3').asHz))
33+
out.playNote(2.0, 2.9, SineInstrument.new(out, Frequency.ofPitch('C3').asHz))
34+
out.playNote(3.0, 1.9, SineInstrument.new(out, Frequency.ofPitch('E3').asHz))
35+
out.playNote(4.0, 0.9, SineInstrument.new(out, Frequency.ofPitch('G3').asHz))
3636
end
3737

3838
def draw

external_library/java/minim/library/sine_instrument/sine_instrument.rb

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
# frozen_string_literal: true
22

3-
java_import 'ddf.minim.Minim'
4-
53
%w[Frequency Instrument Line Oscil Waves].each do |klass|
64
java_import "ddf.minim.ugens.#{klass}"
75
end
@@ -10,14 +8,14 @@
108
# that includes Instrument interface (as a module).
119
class SineInstrument
1210
include Instrument
13-
include Processing::Proxy
1411

15-
attr_reader :wave, :amp_env
12+
attr_reader :wave, :amp_env, :out, :tone_instrument
1613

17-
def initialize(frequency)
14+
def initialize(out, frequency)
1815
# make a sine wave oscillator
1916
# the amplitude is zero because
2017
# we are going to patch a Line to it anyway
18+
@out = out
2119
@wave = Oscil.new(frequency, 0, Waves::SINE)
2220
@amp_env = Line.new
2321
amp_env.patch(wave.amplitude)

0 commit comments

Comments
 (0)