Sha256: 65adc6aa7612decdeab2f36bdb561259cc3e08ebb38d33e4c7c83c6191dca9f7

Contents?: true

Size: 958 Bytes

Versions: 3

Compression:

Stored size: 958 Bytes

Contents

#include "beeps/ruby/sound.h"


#include "defs.h"


RUCY_DEFINE_VALUE_FROM_TO(Beeps::Sound)

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

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


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

static
VALUE initialize(VALUE self, VALUE processor, VALUE seconds)
{
	RUCY_CHECK_OBJ(Beeps::Sound, self);

	*THIS = Beeps::Sound(to<Beeps::Processor*>(processor), to<float>(seconds));
	return self;
}

static
VALUE play(VALUE self)
{
	CHECK;

	THIS->play();
	return self;
}


static Class cSound;

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

	cSound = rb_define_class_under(mBeeps, "Sound", rb_cObject);
	rb_define_alloc_func(cSound, alloc);
	rb_define_private_method(cSound, "initialize", RUBY_METHOD_FUNC(initialize), 2);
	rb_define_method(cSound, "play", RUBY_METHOD_FUNC(play), 0);
}


namespace Beeps
{


	Class
	sound_class ()
	{
		return cSound;
	}


}// Beeps

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
beeps-0.1.32 .doc/ext/beeps/sound.cpp
beeps-0.1.31 .doc/ext/beeps/sound.cpp
beeps-0.1.30 .doc/ext/beeps/sound.cpp