Skip to content

Commit

Permalink
remove all ref to Duby
Browse files Browse the repository at this point in the history
refactor to change all Duby to Mirah
  • Loading branch information
weirdpercent authored and thbar committed Sep 8, 2012
1 parent e81a2ec commit a28c351
Show file tree
Hide file tree
Showing 10 changed files with 79 additions and 79 deletions.
1 change: 0 additions & 1 deletion plugins/DubyFilta/README

This file was deleted.

13 changes: 0 additions & 13 deletions plugins/DubyGain/DubyGain.rb

This file was deleted.

@@ -1,16 +1,16 @@
include_class Java::DubyTools
include_class Java::MirahTools

class DubyFilta < OpazPlug
plugin "DubyFilta", "Opaz", "LoGeek"
class MirahFilta < OpazPlug
plugin "MirahFilta", "Opaz", "LoGeek"
can_do "1in1out", "plugAsChannelInsert", "plugAsSend"
unique_id "dflt"
unique_id "mflt"

param :cut_off, "Cut Off", 1.0
param :resonance, "Resonance", 0.1
param :mode, "Mode (LP or HP)", 0

def filter
@filter ||= DubyTools.new
@filter ||= MirahTools.new
end

def process(inputs, outputs, sampleFrames)
Expand Down
@@ -1,4 +1,4 @@
class DubyTools
class MirahTools
def not_below(val:float,min:float)
val < min ? min : val
end
Expand Down
1 change: 1 addition & 0 deletions plugins/MirahFilta/README
@@ -0,0 +1 @@
Work in progress of filter implemented in JRuby + Mirah
@@ -1,9 +1,9 @@
include_class Java::DubyFreeCompTools
include_class Java::MirahFreeCompTools

class DubyFreeComp < OpazPlug
plugin "DubyFreeComp", "Opaz", "LoGeek"
class MirahFreeComp < OpazPlug
plugin "MirahFreeComp", "Opaz", "LoGeek"
can_do "1in1out", "plugAsChannelInsert", "plugAsSend"
unique_id "dfcp"
unique_id "mfcp"

param :threshold, "Threshold", 0, "dB", (-60.0..6.0)
param :ratio, "Ratio", 1, "n:1", (1.0..100.0)
Expand All @@ -12,7 +12,7 @@ class DubyFreeComp < OpazPlug
param :output, "Output", 0, "dB", (0.0..30.0)

def tools
@tools ||= DubyFreeCompTools.new
@tools ||= MirahFreeCompTools.new
end

def process(inputs, outputs, sampleFrames)
Expand Down
@@ -1,38 +1,38 @@
class DubyFreeCompTools
def initialize
@final_gain = 1.0
@env = 0.0
end

def slider(threshold:float,ratio:float,attack:float,release:float,output:float,sample_rate:int)
@env_rel = Math.exp(-1/(0.25*release*sample_rate))
@thresh = Math.pow(10,threshold/20.0)
@transA = (1/ratio) - 1
@transB = Math.pow(10,output/20.0) * Math.pow(@thresh,1-(1/ratio))
@output_gain = Math.pow(10,output/20.0)
@att_coef = Math.exp(-1 / (attack/1000.0*sample_rate))
@rel_coef = Math.exp(-1 / (release/1000.0*sample_rate))
end

def sample(spl0:float)
det = Math.abs(spl0) # instead of [spl0.abs, spl1.abs].max
det += float(Math.pow(10,-29)) # cannot use 10e-30 currently

@env = det >= @env ? det : float(det+@env_rel*(@env-det))
gain = @env > @thresh ? Math.pow(@env,@transA)*@transB : @output_gain

@final_gain = float(gain < @final_gain ? gain+@att_coef*(@final_gain-gain) : gain+@rel_coef*(@final_gain-gain))
spl0 *= float(@final_gain)
#spl1 *= final_gain
#[spl0, spl1]
spl0
end

def process(inBuffer:float[], outBuffer:float[], sampleFrames:int)
i = 0
while i < sampleFrames
outBuffer[i] = sample(inBuffer[i])
i += 1
end
end
class MirahFreeCompTools
def initialize
@final_gain = 1.0
@env = 0.0
end

def slider(threshold:float,ratio:float,attack:float,release:float,output:float,sample_rate:int)
@env_rel = Math.exp(-1/(0.25*release*sample_rate))
@thresh = Math.pow(10,threshold/20.0)
@transA = (1/ratio) - 1
@transB = Math.pow(10,output/20.0) * Math.pow(@thresh,1-(1/ratio))
@output_gain = Math.pow(10,output/20.0)
@att_coef = Math.exp(-1 / (attack/1000.0*sample_rate))
@rel_coef = Math.exp(-1 / (release/1000.0*sample_rate))
end

def sample(spl0:float)
det = Math.abs(spl0) # instead of [spl0.abs, spl1.abs].max
det += float(Math.pow(10,-29)) # cannot use 10e-30 currently

@env = det >= @env ? det : float(det+@env_rel*(@env-det))
gain = @env > @thresh ? Math.pow(@env,@transA)*@transB : @output_gain

@final_gain = float(gain < @final_gain ? gain+@att_coef*(@final_gain-gain) : gain+@rel_coef*(@final_gain-gain))
spl0 *= float(@final_gain)
#spl1 *= final_gain
#[spl0, spl1]
spl0
end

def process(inBuffer:float[], outBuffer:float[], sampleFrames:int)
i = 0
while i < sampleFrames
outBuffer[i] = sample(inBuffer[i])
i += 1
end
end
end
13 changes: 13 additions & 0 deletions plugins/MirahGain/MirahGain.rb
@@ -0,0 +1,13 @@
include_class Java::MirahGainTools

class MirahGain < OpazPlug
plugin "MirahGain", "Opaz", "LoGeek"
can_do "1in1out", "plugAsChannelInsert", "plugAsSend"
unique_id "MGaN"

param :gain, "Gain", 1.0, "dB"

def process(inputs, outputs, sampleFrames)
MirahGainTools.process(inputs[0], outputs[0], sampleFrames, gain)
end
end
@@ -1,9 +1,9 @@
class DubyGainTools
def self.process(inBuffer:float[], outBuffer:float[], sampleFrames:int, gain:float)
i = 0
while i < sampleFrames
outBuffer[i] = inBuffer[i] * gain
i += 1
end
end
end
class MirahGainTools
def self.process(inBuffer:float[], outBuffer:float[], sampleFrames:int, gain:float)
i = 0
while i < sampleFrames
outBuffer[i] = inBuffer[i] * gain
i += 1
end
end
end
16 changes: 8 additions & 8 deletions plugins/DubyGain/README → plugins/MirahGain/README
@@ -1,9 +1,9 @@
Example of Mirah+JRuby plugin.

see http://www.mirah.org

Mirah must be installed first:

jgem install mirah

Example of Mirah+JRuby plugin.
see http://www.mirah.org
Mirah must be installed first:
jgem install mirah
.mirah files are compiled to .java then .class automatically.

0 comments on commit a28c351

Please sign in to comment.