Sha256: 94671f6504f515912f2904545b42f4a885e0e3d383741fa8fe0059600e5a7d1c

Contents?: true

Size: 1023 Bytes

Versions: 3

Compression:

Stored size: 1023 Bytes

Contents

#include "beeps/ruby/sound.h"


#include <rucy.h>
#include "beeps/exception.h"
#include "defs.h"


using namespace Rucy;


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

3 entries across 3 versions & 1 rubygems

Version Path
beeps-0.1.12 .doc/ext/beeps/sound.cpp
beeps-0.1.11 .doc/ext/beeps/sound.cpp
beeps-0.1.10 .doc/ext/beeps/sound.cpp