Sha256: a4ea9b4a78d8d6cb55d36a52e9c2f4a609e8df5122eaa97c9a186462450ecf1e

Contents?: true

Size: 1002 Bytes

Versions: 3

Compression:

Stored size: 1002 Bytes

Contents

#include "beeps/ruby/processor.h"


#include "defs.h"


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_beeps_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.32 .doc/ext/beeps/sawtooth_wave.cpp
beeps-0.1.31 .doc/ext/beeps/sawtooth_wave.cpp
beeps-0.1.30 .doc/ext/beeps/sawtooth_wave.cpp