Skip to content

Commit

Permalink
Wrap libopenmpt module repeat functions.
Browse files Browse the repository at this point in the history
  • Loading branch information
hainesr committed Nov 28, 2018
1 parent f9724b5 commit e7bb032
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/ffi/openmpt/api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,10 @@ module API
attach_function :openmpt_module_set_render_param,
[:pointer, :int, :int], :int

# Repeat module calls
attach_function :openmpt_module_get_repeat_count, [:pointer], :int
attach_function :openmpt_module_set_repeat_count, [:pointer, :int], :void

# Read module calls
attach_function :openmpt_module_read_mono,
[:pointer, :int, :int, :pointer],
Expand Down
11 changes: 11 additions & 0 deletions test/openmpt_api_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,17 @@ def test_probe_file_header
assert_equal load, OPENMPT_PROBE_FILE_HEADER_RESULT_SUCCESS
end

def test_module_get_and_set_repeat_count
module_test(MOD_LAST_SUN) do |mod|
assert_equal openmpt_module_get_repeat_count(mod), 0

[-1, 2, 0].each do |count|
openmpt_module_set_repeat_count(mod, count)
assert_equal openmpt_module_get_repeat_count(mod), count
end
end
end

def test_module_get_and_set_render_params
module_test(MOD_LAST_SUN) do |mod|
value = ::FFI::MemoryPointer.new(:int, 1)
Expand Down

0 comments on commit e7bb032

Please sign in to comment.