Module: SDL2::Mixer::Channels
- Defined in:
- mixer.c,
mixer.c
Overview
This module plays Chunk objects in parallel.
Each virtual sound output device is called channel, and the number of channels determines the f
Defined Under Namespace
Classes: Group
Class Method Summary (collapse)
-
+ (Integer) allocate(num_channels)
Set the number of channels being mixed.
-
+ (nil) expire(channel, ticks)
Halt playing of a specified channel after ticks milliseconds.
-
+ (Integer) fade_in(channel, chunk, loops, ms, ticks = -1)
Play a Chunk on channel with fading in.
-
+ (nil) fade_out(channel, ms)
Halt playing of a specified channel with fade-out effect.
-
+ (Integer) fading(channel)
Return the fading state of a specified channel.
-
+ (nil) halt(channel)
Halt playing of a specified channel.
-
+ (nil) pause(channel)
Pause a specified channel.
-
+ (Boolean) pause?(channel)
Return true if a specified channel is paused.
-
+ (Integer) play(channel, chunk, loops, ticks = -1)
Play a Chunk on channel.
-
+ (Boolean) play?(channel)
Return true if a specified channel is playing.
-
+ (SDL2::Mixer::Chunk?) playing_chunk(channel)
Get the Chunk object most recently playing on channel.
- + (Integer) reserve(num)
-
+ (nil) resume(channel)
Resume a specified channel that already pauses.
-
+ (void) set_volume(channel, volume)
Set the volume of specified channel.
-
+ (Integer) volume(channel)
Get the volume of specified channel.
Class Method Details
+ (Integer) allocate(num_channels)
228 229 230 231 |
# File 'mixer.c', line 228
static VALUE Channels_s_allocate(VALUE self, VALUE num_channels)
{
return INT2NUM(Mix_AllocateChannels(NUM2INT(num_channels)));
}
|
+ (nil) expire(channel, ticks)
423 424 425 426 427 428 |
# File 'mixer.c', line 423
static VALUE Channels_s_expire(VALUE self, VALUE channel, VALUE ticks)
{
check_channel(channel, 1);
Mix_ExpireChannel(NUM2INT(channel), NUM2INT(ticks));
return Qnil;
}
|
+ (Integer) fade_in(channel, chunk, loops, ms, ticks = -1)
343 344 345 346 347 348 349 350 351 352 353 354 355 356 |
# File 'mixer.c', line 343
static VALUE Channels_s_fade_in(int argc, VALUE* argv, VALUE self)
{
VALUE channel, chunk, loops, ms, ticks;
int ch;
rb_scan_args(argc, argv, "41", &channel, &chunk, &loops, &ms, &ticks);
if (ticks == Qnil)
ticks = INT2FIX(-1);
check_channel(channel, 1);
ch = Mix_FadeInChannelTimed(NUM2INT(channel), Get_Mix_Chunk(chunk),
NUM2INT(loops), NUM2INT(ms), NUM2INT(ticks));
HANDLE_MIX_ERROR(ch);
protect_playing_chunk_from_gc(ch, chunk);
return INT2FIX(ch);
}
|
+ (nil) fade_out(channel, ms)
443 444 445 446 447 448 |
# File 'mixer.c', line 443
static VALUE Channels_s_fade_out(VALUE self, VALUE channel, VALUE ms)
{
check_channel(channel, 1);
Mix_FadeOutChannel(NUM2INT(channel), NUM2INT(ms));
return Qnil;
}
|
+ (Integer) fading(channel)
501 502 503 504 505 |
# File 'mixer.c', line 501
static VALUE Channels_s_fading(VALUE self, VALUE which)
{
check_channel(which, 0);
return INT2FIX(Mix_FadingChannel(NUM2INT(which)));
}
|
+ (nil) halt(channel)
404 405 406 407 408 409 |
# File 'mixer.c', line 404
static VALUE Channels_s_halt(VALUE self, VALUE channel)
{
check_channel(channel, 1);
Mix_HaltChannel(NUM2INT(channel));
return Qnil;
}
|
+ (nil) pause(channel)
368 369 370 371 372 373 |
# File 'mixer.c', line 368
static VALUE Channels_s_pause(VALUE self, VALUE channel)
{
check_channel(channel, 1);
Mix_Pause(NUM2INT(channel));
return Qnil;
}
|
+ (Boolean) pause?(channel)
476 477 478 479 480 |
# File 'mixer.c', line 476
static VALUE Channels_s_pause_p(VALUE self, VALUE channel)
{
check_channel(channel, 0);
return INT2BOOL(Mix_Paused(NUM2INT(channel)));
}
|
+ (Integer) play(channel, chunk, loops, ticks = -1)
304 305 306 307 308 309 310 311 312 313 314 315 316 317 |
# File 'mixer.c', line 304
static VALUE Channels_s_play(int argc, VALUE* argv, VALUE self)
{
VALUE channel, chunk, loops, ticks;
int ch;
rb_scan_args(argc, argv, "31", &channel, &chunk, &loops, &ticks);
if (ticks == Qnil)
ticks = INT2FIX(-1);
check_channel(channel, 1);
ch = Mix_PlayChannelTimed(NUM2INT(channel), Get_Mix_Chunk(chunk),
NUM2INT(loops), NUM2INT(ticks));
HANDLE_MIX_ERROR(ch);
protect_playing_chunk_from_gc(ch, chunk);
return INT2FIX(ch);
}
|
+ (Boolean) play?(channel)
458 459 460 461 462 |
# File 'mixer.c', line 458
static VALUE Channels_s_play_p(VALUE self, VALUE channel)
{
check_channel(channel, 0);
return INT2BOOL(Mix_Playing(NUM2INT(channel)));
}
|
+ (SDL2::Mixer::Chunk?) playing_chunk(channel)
517 518 519 520 521 |
# File 'mixer.c', line 517
static VALUE Channels_s_playing_chunk(VALUE self, VALUE channel)
{
check_channel(channel, 0);
return rb_ary_entry(playing_chunks, NUM2INT(channel));
}
|
+ (Integer) reserve(num)
238 239 240 241 |
# File 'mixer.c', line 238
static VALUE Channels_s_reserve(VALUE self, VALUE num)
{
return INT2NUM(Mix_ReserveChannels(NUM2INT(num)));
}
|
+ (nil) resume(channel)
386 387 388 389 390 391 |
# File 'mixer.c', line 386
static VALUE Channels_s_resume(VALUE self, VALUE channel)
{
check_channel(channel, 1);
Mix_Resume(NUM2INT(channel));
return Qnil;
}
|
+ (void) set_volume(channel, volume)
272 273 274 275 |
# File 'mixer.c', line 272
static VALUE Channels_s_set_volume(VALUE self, VALUE channel, VALUE volume)
{
return INT2NUM(Mix_Volume(NUM2INT(channel), NUM2INT(volume)));
}
|
+ (Integer) volume(channel)
254 255 256 257 |
# File 'mixer.c', line 254
static VALUE Channels_s_volume(VALUE self, VALUE channel)
{
return INT2NUM(Mix_Volume(NUM2INT(channel), -1));
}
|