Class: Bloops

Inherits:
Object
  • Object
show all
Defined in:
ext/ruby/rubyext.c

Defined Under Namespace

Classes: Sound, Track

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.sound(type) ⇒ Object



99
100
101
102
103
104
105
# File 'ext/ruby/rubyext.c', line 99

VALUE
rb_bloops_sound(VALUE self, VALUE type)
{
  bloopsaphone *P = bloops_square();
  P->params.type = (unsigned char)NUM2INT(type);
  return Data_Wrap_Struct(cSound, NULL, rb_bloops_sound_free, P);
}

Instance Method Details

#clearObject



34
35
36
37
38
39
40
41
# File 'ext/ruby/rubyext.c', line 34

VALUE
rb_bloops_clear(VALUE self)
{
  bloops *B;
  Data_Get_Struct(self, bloops, B);
  bloops_clear(B);
  return self;
}

#load(fname) ⇒ Object



86
87
88
89
90
91
92
93
94
95
96
97
# File 'ext/ruby/rubyext.c', line 86

VALUE
rb_bloops_load(VALUE self, VALUE fname)
{
  bloops *B;
  bloopsaphone *P;
  Data_Get_Struct(self, bloops, B);

  StringValue(fname);
  P = bloops_sound_file(B, RSTRING_PTR(fname));
  if (P == NULL) return Qnil;
  return Data_Wrap_Struct(cSound, NULL, rb_bloops_sound_free, P);
}

#playObject



43
44
45
46
47
48
49
50
# File 'ext/ruby/rubyext.c', line 43

VALUE
rb_bloops_play(VALUE self)
{
  bloops *B;
  Data_Get_Struct(self, bloops, B);
  bloops_play(B);
  return self;
}

#sound(type) ⇒ Object



99
100
101
102
103
104
105
# File 'ext/ruby/rubyext.c', line 99

VALUE
rb_bloops_sound(VALUE self, VALUE type)
{
  bloopsaphone *P = bloops_square();
  P->params.type = (unsigned char)NUM2INT(type);
  return Data_Wrap_Struct(cSound, NULL, rb_bloops_sound_free, P);
}

#stopped?Boolean

Returns:

  • (Boolean)


52
53
54
55
56
57
58
# File 'ext/ruby/rubyext.c', line 52

VALUE
rb_bloops_is_stopped(VALUE self)
{
  bloops *B;
  Data_Get_Struct(self, bloops, B);
  return bloops_is_done(B) ? Qtrue : Qfalse;
}

#tempoObject



60
61
62
63
64
65
66
# File 'ext/ruby/rubyext.c', line 60

VALUE
rb_bloops_get_tempo(VALUE self)
{
  bloops *B;
  Data_Get_Struct(self, bloops, B);
  return INT2NUM(B->tempo);
}

#tempo=(tempo) ⇒ Object



68
69
70
71
72
73
74
75
# File 'ext/ruby/rubyext.c', line 68

VALUE
rb_bloops_set_tempo(VALUE self, VALUE tempo)
{
  bloops *B;
  Data_Get_Struct(self, bloops, B);
  bloops_tempo(B, NUM2INT(tempo));
  return tempo;
}

#tune(sound, notes) ⇒ Object



220
221
222
223
224
225
226
227
228
229
230
231
232
# File 'ext/ruby/rubyext.c', line 220

VALUE
rb_bloops_tune(VALUE self, VALUE sound, VALUE notes)
{
  bloops *B;
  bloopsaphone *phone;
  bloopsatrack *track;
  Data_Get_Struct(self, bloops, B);
  Data_Get_Struct(sound, bloopsaphone, phone);

  StringValue(notes);
  track = bloops_track(B, phone, RSTRING_PTR(notes), RSTRING_LEN(notes));
  return Data_Wrap_Struct(cTrack, NULL, rb_bloops_track_free, track);
}