/* call-seq: * play(sample, channel_num, repeats ) -> integer * * **NOTE:** This method is DEPRECATED and will be removed in * Rubygame 3.0. Please use the Rubygame::Sound class instead. * * Play an audio Sample on a mixing channel, repeating a certain number * of extra times. Returns the number of the channel that the sample * is being played on. * * Raises SDLError if something goes wrong. * * This method takes these arguments: * sample:: what Sample to play * channel_num:: which mixing channel to play the sample on. * Use -1 to play on the first unreserved channel. * repeats:: how many extra times to repeat the sample. * Can be -1 to repeat forever until it is stopped. */ VALUE rbgm_mixchan_play( VALUE self, VALUE samplev, VALUE chanv, VALUE loopsv ) { /* This feature will be removed in Rubygame 3.0. */ rg_deprecated("Rubygame::Mixer", "3.0"); Mix_Chunk* sample; int loops, channel, result; channel = NUM2INT(chanv); Data_Get_Struct( samplev, Mix_Chunk, sample ); loops = NUM2INT(loopsv); result = Mix_PlayChannel(channel, sample, loops); if ( result < 0 ) { rb_raise(eSDLError, "Error playing sample on channel %d: %s", channel, Mix_GetError()); } return INT2NUM( result ); }