Sha256: a0c8c5fb067ca1729e5c9f63f660158249a2d6498239b8aea108e1d758ead230

Contents?: true

Size: 944 Bytes

Versions: 15

Compression:

Stored size: 944 Bytes

Contents

#include "beeps/ruby/processor.h"


#include "defs.h"


RUCY_DEFINE_VALUE_FROM_TO(Beeps::SineWave)

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

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


static
VALUE alloc(VALUE klass)
{
	return new_type<Beeps::SineWave>(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 cSineWave;

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

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


namespace Beeps
{


	Class
	sine_wave_class ()
	{
		return cSineWave;
	}


}// Beeps

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
beeps-0.1.29 .doc/ext/beeps/sine_wave.cpp
beeps-0.1.28 .doc/ext/beeps/sine_wave.cpp
beeps-0.1.27 .doc/ext/beeps/sine_wave.cpp
beeps-0.1.26 .doc/ext/beeps/sine_wave.cpp
beeps-0.1.25 .doc/ext/beeps/sine_wave.cpp
beeps-0.1.24 .doc/ext/beeps/sine_wave.cpp
beeps-0.1.23 .doc/ext/beeps/sine_wave.cpp
beeps-0.1.22 .doc/ext/beeps/sine_wave.cpp
beeps-0.1.21 .doc/ext/beeps/sine_wave.cpp
beeps-0.1.20 .doc/ext/beeps/sine_wave.cpp
beeps-0.1.18 .doc/ext/beeps/sine_wave.cpp
beeps-0.1.16 .doc/ext/beeps/sine_wave.cpp
beeps-0.1.15 .doc/ext/beeps/sine_wave.cpp
beeps-0.1.14 .doc/ext/beeps/sine_wave.cpp
beeps-0.1.13 .doc/ext/beeps/sine_wave.cpp