Module: Audio
- Defined in:
- ext/audio.c
Class Method Summary collapse
- .load(file) ⇒ Object
- .pause(channel_id) ⇒ Object
- .play(channel_id, clip) ⇒ Object
- .resume(channel_id) ⇒ Object
- .set_pos(channel_id, angle, distance) ⇒ Object
- .set_volume(channel_id, volume) ⇒ Object
- .stop(channel_id) ⇒ Object
Class Method Details
.load(file) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'ext/audio.c', line 16
VALUE audio_load(VALUE self, VALUE file)
{
Mix_Chunk *sound = NULL;
sound = Mix_LoadWAV(StringValueCStr(file));
if(sound == NULL)
{
fprintf(stderr, "Unable to load WAV file: %s\n", Mix_GetError());
}
sounds[0] = sound;
sound_count++;
return rb_int2inum(sound_count - 1);
}
|
.pause(channel_id) ⇒ Object
43 44 45 46 47 |
# File 'ext/audio.c', line 43
VALUE audio_pause(VALUE self, VALUE channel_id)
{
Mix_Pause(NUM2INT(channel_id));
return Qnil;
}
|
.play(channel_id, clip) ⇒ Object
9 10 11 12 13 14 |
# File 'ext/audio.c', line 9
VALUE audio_play(VALUE self, VALUE channel_id, VALUE clip)
{
Mix_Chunk *sound = sounds[NUM2INT(clip)];
int channel = Mix_PlayChannel(NUM2INT(channel_id), sound, 0);
return rb_int2inum(channel);
}
|
.resume(channel_id) ⇒ Object
49 50 51 52 53 |
# File 'ext/audio.c', line 49
VALUE audio_resume(VALUE self, VALUE channel_id)
{
Mix_Resume(NUM2INT(channel_id));
return Qnil;
}
|
.set_pos(channel_id, angle, distance) ⇒ Object
31 32 33 34 35 |
# File 'ext/audio.c', line 31
VALUE audio_set_pos(VALUE self, VALUE channel_id, VALUE angle, VALUE distance)
{
Mix_SetPosition(NUM2INT(channel_id), NUM2INT(angle), NUM2INT(distance));
return Qnil;
}
|
.set_volume(channel_id, volume) ⇒ Object
55 56 57 58 59 |
# File 'ext/audio.c', line 55
VALUE audio_set_volume(VALUE self, VALUE channel_id, VALUE volume)
{
Mix_Volume(NUM2INT(channel_id), NUM2INT(volume));
return Qnil;
}
|
.stop(channel_id) ⇒ Object
37 38 39 40 41 |
# File 'ext/audio.c', line 37
VALUE audio_stop(VALUE self, VALUE channel_id)
{
Mix_HaltChannel(NUM2INT(channel_id));
return Qnil;
}
|