Пример #1
0
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);
}
Пример #2
0
static VALUE SoundBuffer_get_samplesCount(VALUE vSelf) {
	// Get C++ object pointer from vSelf
	SoundBuffer *pSelf;
	Data_Get_Struct(vSelf, SoundBuffer, pSelf);
	return INT2FIX(pSelf->GetSamplesCount());
}
Пример #3
0
static VALUE SoundBuffer_get_samples(VALUE vSelf) {
	// Get C++ object pointer from vSelf
	SoundBuffer *pSelf;
	Data_Get_Struct(vSelf, SoundBuffer, pSelf);
	return rb_str_new((const char *)pSelf->GetSamples(), pSelf->GetSamplesCount()*2);
}