Class: NoyesC::HammingWindow

Inherits:
Object
  • Object
show all
Defined in:
lib/cext/hamming_window.c

Instance Method Summary collapse

Constructor Details

#initializeObject


10
11
12
13
14
15
16
17
18
19
20
# File 'lib/cext/hamming_window.c', line 10

static VALUE t_init(VALUE self, VALUE args) {
  int len = RARRAY_LEN(args);
  int winsz = 205;
  if (len > 0) {
     winsz = NUM2INT(rb_ary_entry(args, 0));
  }
  HammingWindow *hw = hamming_window_new(winsz);
  VALUE hwv = Data_Wrap_Struct(cHammingWindow, 0, _hamming_window_free, hw);
  rb_iv_set(self, "@hw", hwv);
  return self;
}

Instance Method Details

#<<Object


22
23
24
25
26
27
28
29
30
31
32
# File 'lib/cext/hamming_window.c', line 22

static VALUE t_left_shift(VALUE self, VALUE obj) {
  Cmat *M = r2cmat(obj);
  HammingWindow *hw;
  VALUE hwv = rb_iv_get(self, "@hw");
  Data_Get_Struct(hwv, HammingWindow, hw);
  Cmat *N = hamming_window_apply(hw, M);
  VALUE result = cmat2r(N);
  cmat_free(N);
  cmat_free(M);
  return result;
}