2023-07-07 02:34:17 +01:00
|
|
|
module Voicemeeter
|
|
|
|
module Meta_Functions
|
|
|
|
# Accessor methods
|
|
|
|
def make_accessor_bool(*params)
|
|
|
|
params.each do |param|
|
2023-07-14 00:56:16 +01:00
|
|
|
define_singleton_method(param) { getter(param).to_i == 1 }
|
|
|
|
|
2023-07-07 02:34:17 +01:00
|
|
|
define_singleton_method("#{param}=") do |value|
|
2023-07-14 00:56:16 +01:00
|
|
|
setter(param, value && 1 || 0)
|
2023-07-07 02:34:17 +01:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def make_accessor_string(*params)
|
|
|
|
params.each do |param|
|
2023-07-14 00:56:16 +01:00
|
|
|
define_singleton_method(param) { getter(param, true) }
|
2023-07-07 02:34:17 +01:00
|
|
|
|
2023-07-14 00:56:16 +01:00
|
|
|
define_singleton_method("#{param}=") { |value| setter(param, value) }
|
2023-07-07 02:34:17 +01:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def make_accessor_int(*params)
|
|
|
|
params.each do |param|
|
2023-07-14 00:56:16 +01:00
|
|
|
define_singleton_method(param) { getter(param).to_i }
|
2023-07-07 02:34:17 +01:00
|
|
|
|
2023-07-14 00:56:16 +01:00
|
|
|
define_singleton_method("#{param}=") { |value| setter(param, value) }
|
2023-07-07 02:34:17 +01:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def make_accessor_float(*params)
|
|
|
|
params.each do |param|
|
2023-07-14 00:56:16 +01:00
|
|
|
define_singleton_method(param) { getter(param) }
|
2023-07-07 02:34:17 +01:00
|
|
|
|
2023-07-14 00:56:16 +01:00
|
|
|
define_singleton_method("#{param}=") { |value| setter(param, value) }
|
2023-07-07 02:34:17 +01:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
# reader methods
|
|
|
|
def make_reader_string(*params)
|
|
|
|
params.each do |param|
|
2023-07-14 00:56:16 +01:00
|
|
|
define_singleton_method(param) { getter(param, true) }
|
2023-07-07 02:34:17 +01:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def make_reader_int(*params)
|
|
|
|
params.each do |param|
|
2023-07-14 00:56:16 +01:00
|
|
|
define_singleton_method(param) { getter(param).to_i }
|
2023-07-07 02:34:17 +01:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
# writer methods
|
|
|
|
def make_writer_string(*params)
|
|
|
|
params.each do |param|
|
2023-07-14 00:56:16 +01:00
|
|
|
define_singleton_method("#{param}=") { |value| setter(param, value) }
|
2023-07-07 02:34:17 +01:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|