Method: Rubygame::Sound#initialize_copy

Defined in:
ext/rubygame/rubygame_sound.c

#clone(other) ⇒ Object #dup(other) ⇒ Object

Create a copy of the given Sound instance. Much more memory-efficient than using #load to load the sound file again.

other

An existing Sound instance. (Sound, required)

Returns

The new Sound instance. (Sound)

NOTE: #clone and #dup do slightly different things; #clone will copy the ‘frozen’ state of the object, while #dup will create a fresh, un-frozen object.



368
369
370
371
372
373
374
375
376
377
# File 'ext/rubygame/rubygame_sound.c', line 368

static VALUE rg_sound_initialize_copy( VALUE self, VALUE other )
{
	RG_Sound *soundA, *soundB;
	Data_Get_Struct(self,  RG_Sound, soundA);
	Data_Get_Struct(other, RG_Sound, soundB);

	_rg_sound_copy( soundA, soundB );

	return self;
}