Sha256: 9fb2fbe0da09fed042dc6b6d086a652f736fa99135c441e8c0c7b9d785c47eae

Contents?: true

Size: 909 Bytes

Versions: 3

Compression:

Stored size: 909 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
RUCY_DEF_ALLOC(alloc, klass)
{
	return new_type<Beeps::SineWave>(klass);
}
RUCY_END

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

static
RUCY_DEF0(frequency)
{
	CHECK;
	return to<float>(THIS->frequency());
}
RUCY_END


static Class cSineWave;

void
Init_beeps_sine_wave ()
{
	Module mBeeps = define_module("Beeps");

	cSineWave = mBeeps.define_class("SineWave", Beeps::processor_class());
	cSineWave.define_alloc_func(alloc);
	cSineWave.define_method("frequency=", set_frequency);
	cSineWave.define_method("frequency",      frequency);
}


namespace Beeps
{


	Class
	sine_wave_class ()
	{
		return cSineWave;
	}


}// Beeps

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
beeps-0.1.32 ext/beeps/sine_wave.cpp
beeps-0.1.31 ext/beeps/sine_wave.cpp
beeps-0.1.30 ext/beeps/sine_wave.cpp