Sha256: 5c7088d05bb2b4052ae18e7cc44d9ee265fa9b974e84ef3ce4d1fbdfecdd67d4
Contents?: true
Size: 1.69 KB
Versions: 8
Compression:
Stored size: 1.69 KB
Contents
#include "beeps/ruby/generator.h" #include "beeps/ruby/processor.h" #include "defs.h" RUCY_DEFINE_WRAPPER_VALUE_FROM_TO(Beeps::Oscillator) #define THIS to<Beeps::Oscillator*>(self) #define CHECK RUCY_CHECK_OBJ(Beeps::Oscillator, self) static VALUE alloc(VALUE klass) { return value(new Beeps::RubyProcessor<Beeps::Oscillator>, klass); } static VALUE set_type(VALUE self, VALUE type) { CHECK; THIS->set_type((Beeps::Oscillator::Type) to<uint>(type)); return type; } static VALUE get_type(VALUE self) { CHECK; return value(THIS->type()); } static VALUE set_frequency(VALUE self, VALUE frequency) { CHECK; THIS->set_frequency(to<float>(frequency)); return frequency; } static VALUE get_frequency(VALUE self) { CHECK; return value(THIS->frequency()); } static Class cOscillator; void Init_beeps_oscillator () { Module mBeeps = rb_define_module("Beeps"); cOscillator = mBeeps.define_class("Oscillator", Beeps::processor_class()); rb_define_alloc_func(cOscillator, alloc); rb_define_method(cOscillator, "type=", RUBY_METHOD_FUNC(set_type), 1); rb_define_method(cOscillator, "type", RUBY_METHOD_FUNC(get_type), 0); rb_define_method(cOscillator, "frequency=", RUBY_METHOD_FUNC(set_frequency), 1); rb_define_method(cOscillator, "frequency", RUBY_METHOD_FUNC(get_frequency), 0); cOscillator.define_const("NONE", Beeps::Oscillator::NONE); cOscillator.define_const("SINE", Beeps::Oscillator::SINE); cOscillator.define_const("TRIANGLE", Beeps::Oscillator::TRIANGLE); cOscillator.define_const("SQUARE", Beeps::Oscillator::SQUARE); cOscillator.define_const("SAWTOOTH", Beeps::Oscillator::SAWTOOTH); } namespace Beeps { Class oscillator_class () { return cOscillator; } }// Beeps
Version data entries
8 entries across 8 versions & 1 rubygems