Class: Ramekin::SPCPlayer::CustomSPCPlayer

Inherits:
SPCPlayer
  • Object
show all
Defined in:
lib/ramekin/spc_player.rb

Constant Summary

Constants included from Util

Util::KNOWN_LENGTHS

Instance Method Summary collapse

Methods inherited from SPCPlayer

#setup!, #setup_ok?

Methods included from Util

#adsr_value, #extra_nice_length_amk, #nice_length_amk

Constructor Details

#initialize(path) ⇒ CustomSPCPlayer



102
103
104
# File 'lib/ramekin/spc_player.rb', line 102

def initialize(path)
  @path = path
end

Instance Method Details

#play(fname, offset = 0) ⇒ Object



117
118
119
120
121
122
123
# File 'lib/ramekin/spc_player.rb', line 117

def play(fname, offset=0)
  if File.basename(@path, '.exe') == 'spct'
    sys @path, 'play', fname, '--seek', offset
  else
    sys @path, fname
  end
end

#render(fname, outfile, seconds = nil) ⇒ Object



106
107
108
109
110
111
112
113
114
115
# File 'lib/ramekin/spc_player.rb', line 106

def render(fname, outfile, seconds=nil)
  unless File.basename(@path, '.exe') == 'spct'
    $stderr.puts "WAV rendering is only supported for spct."
    exit 1
  end

  args = [@path, 'render', fname, outfile]
  args.concat(['-s', seconds.to_s]) if seconds
  sys(*args)
end