Skip to content

Commit

Permalink
modules for each stage of a tube amp
Browse files Browse the repository at this point in the history
  • Loading branch information
kevin-j-m committed Sep 7, 2022
1 parent 35bfae5 commit f0c4920
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 44 deletions.
45 changes: 1 addition & 44 deletions lib/blues/tube_amplifier.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,49 +2,6 @@

module Blues
class TubeAmplifier < Amplifier
def turn_on
if @warm_up.nil?
@warm_up = TubeWarmUp.new
end

super
end

def turn_off
@warm_up = nil

super
end

def warm_up_complete?
return false unless @warm_up

@warm_up.complete?
end

def volume
return @volume if warm_up_complete?
return 0 unless @warm_up

(@volume * @warm_up.volume_scale).floor
end

def pre_amp_tone
if low_volume? || mid_volume?
"💡"
elsif high_volume?
"🔥"
else
" "
end
end

def pre_amp_weight
:heavy
end

def power_amp_weight
:heavy
end
include TubePreAmp, TubePowerAmp
end
end
32 changes: 32 additions & 0 deletions lib/blues/tube_power.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# frozen_string_literal: true

module Blues
module TubePower
def turn_on
if @warm_up.nil?
@warm_up = TubeWarmUp.new
end

super
end

def turn_off
@warm_up = nil

super
end

def warm_up_complete?
return false unless @warm_up

@warm_up.complete?
end

def volume
return @volume if warm_up_complete?
return 0 unless @warm_up

(@volume * @warm_up.volume_scale).floor
end
end
end
11 changes: 11 additions & 0 deletions lib/blues/tube_power_amp.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# frozen_string_literal: true

module Blues
module TubePowerAmp
include TubePower

def power_amp_weight
:heavy
end
end
end
21 changes: 21 additions & 0 deletions lib/blues/tube_pre_amp.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# frozen_string_literal: true

module Blues
module TubePreAmp
include TubePower

def pre_amp_tone
if low_volume? || mid_volume?
"💡"
elsif high_volume?
"🔥"
else
" "
end
end

def pre_amp_weight
:heavy
end
end
end

0 comments on commit f0c4920

Please sign in to comment.