Skip to content

Commit

Permalink
Buffer - teach #to_f
Browse files Browse the repository at this point in the history
This allows buffers to be converted to synth opt values in a generic call to `.to_f`
  • Loading branch information
samaaron committed Jan 18, 2017
1 parent fe40db5 commit 5c8e2a8
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions app/server/sonicpi/lib/sonicpi/buffer.rb
Expand Up @@ -14,6 +14,7 @@ module SonicPi
class Buffer
attr_reader :id, :num_frames, :num_chans, :sample_rate, :duration
attr_accessor :path

def initialize(server, id, num_frames, num_chans, sample_rate)
@server = server
@id = id
Expand All @@ -30,6 +31,10 @@ def to_i
@id
end

def to_f
@id.to_f
end

def free
return false if @state == :killed
@mutex.synchronize do
Expand Down

0 comments on commit 5c8e2a8

Please sign in to comment.