Sha256: 57defafdcfc6c36c5e06d598e4d41902ed049903f4e6366242dceafe4cc34684

Contents?: true

Size: 1.04 KB

Versions: 3

Compression:

Stored size: 1.04 KB

Contents

#include "beeps/ruby/processor.h"


#include <rucy.h>
#include "beeps/exception.h"
#include "defs.h"


using namespace Rucy;


RUCY_DEFINE_VALUE_FROM_TO(Beeps::SawtoothWave)

#define THIS  to<Beeps::SawtoothWave*>(self)

#define CHECK RUCY_CHECK_OBJECT(Beeps::SawtoothWave, self)


static
VALUE alloc(VALUE klass)
{
	return new_type<Beeps::SawtoothWave>(klass);
}

static
VALUE set_frequency(VALUE self, VALUE frequency)
{
	CHECK;
	THIS->set_frequency(frequency.as_f(true));
	return self;
}

static
VALUE frequency(VALUE self)
{
	CHECK;
	return to<float>(THIS->frequency());
}


static Class cSawtoothWave;

void
Init_sawtooth_wave ()
{
	Module mBeeps = rb_define_module("Beeps");

	cSawtoothWave = mBeeps.define_class("SawtoothWave", Beeps::processor_class());
	rb_define_alloc_func(cSawtoothWave, alloc);
	rb_define_method(cSawtoothWave, "frequency=", RUBY_METHOD_FUNC(set_frequency), 1);
	rb_define_method(cSawtoothWave, "frequency", RUBY_METHOD_FUNC(frequency), 0);
}


namespace Beeps
{


	Class
	sawtooth_wave_class ()
	{
		return cSawtoothWave;
	}


}// Beeps

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
beeps-0.1.12 .doc/ext/beeps/sawtooth_wave.cpp
beeps-0.1.11 .doc/ext/beeps/sawtooth_wave.cpp
beeps-0.1.10 .doc/ext/beeps/sawtooth_wave.cpp