static VALUE SoundBuffer_to_s(VALUE vSelf) { // Get C++ object pointer from vSelf SoundBuffer *pSelf; Data_Get_Struct(vSelf, SoundBuffer, pSelf); char szBuffer[256]; sprintf(szBuffer, "Samples=%d, SampleRate=%d, Channels=%d, Duration=%f", pSelf->GetSamplesCount(), pSelf->GetSampleRate(), pSelf->GetChannelsCount(), pSelf->GetDuration()); return rb_str_new2(szBuffer); }
static VALUE SoundBuffer_get_duration(VALUE vSelf) { // Get C++ object pointer from vSelf SoundBuffer *pSelf; Data_Get_Struct(vSelf, SoundBuffer, pSelf); return rb_float_new(pSelf->GetDuration()); }