Sha256: b17dfc6b05e4c869f7518be47543f7608396c1f7efe1106b8b73ec6f391ebf6f

Contents?: true

Size: 952 Bytes

Versions: 15

Compression:

Stored size: 952 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_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

15 entries across 15 versions & 1 rubygems

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