Class: Ramekin::SPCPlayer::NormalSPCPlayer

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 included from Util

#adsr_value, #extra_nice_length_amk, #nice_length_amk

Constructor Details

#initializeNormalSPCPlayer

Returns a new instance of NormalSPCPlayer.



78
79
80
# File 'lib/ramekin/spc_player.rb', line 78

def initialize
  @spct_dir = "#{HOME}/spct"
end

Instance Method Details

#play(fname, offset = 0) ⇒ Object



68
69
70
# File 'lib/ramekin/spc_player.rb', line 68

def play(fname, offset=0)
  sys "#@spct_dir/spct", 'play', fname, '--seek', offset
end

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



72
73
74
75
76
# File 'lib/ramekin/spc_player.rb', line 72

def render(fname, outfile, seconds=nil)
  args = ["#@spct_dir/spct", 'render', fname, outfile]
  args.concat(['-s', seconds.to_s]) if seconds
  sys(*args)
end

#setup!Object



86
87
88
89
90
91
92
93
94
95
96
97
98
# File 'lib/ramekin/spc_player.rb', line 86

def setup!
  return if setup_ok?

  clear_dir(@spct_dir, remake: false)

  Dir.chdir(HOME) do
    sys git, 'clone', '--recursive', 'https://codeberg.org/jneen/spct'
  end

  Dir.chdir(@spct_dir) do
    sys(make)
  end
end

#setup_ok?Boolean

Returns:

  • (Boolean)


82
83
84
# File 'lib/ramekin/spc_player.rb', line 82

def setup_ok?
  executable?("#@spct_dir/spct")
end