예제 #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);
}