Ejemplo n.º 1
0
////////////////////////////////////////////////////////////
/// Copy constructor
////////////////////////////////////////////////////////////
SoundBuffer::SoundBuffer(const SoundBuffer& Copy) :
AudioResource(Copy),
myBuffer     (0),
mySamples    (Copy.mySamples),
myDuration   (Copy.myDuration)
{
    // Create the buffer
    ALCheck(alGenBuffers(1, &myBuffer));

    // Update the internal buffer with the new samples
    Update(Copy.GetChannelsCount(), Copy.GetSampleRate());
}
Ejemplo n.º 2
0
SoundBuffer::SoundBuffer(const SoundBuffer& copy) :
myBuffer  (0),
mySamples (copy.mySamples),
myDuration(copy.myDuration),
mySounds  () // don't copy the attached sounds
{
    // Create the buffer
    ALCheck(alGenBuffers(1, &myBuffer));

    // Update the internal buffer with the new samples
    Update(copy.GetChannelsCount(), copy.GetSampleRate());
}
Ejemplo n.º 3
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);
}
Ejemplo n.º 4
0
static VALUE SoundBuffer_get_channels(VALUE vSelf) {
	// Get C++ object pointer from vSelf
	SoundBuffer *pSelf;
	Data_Get_Struct(vSelf, SoundBuffer, pSelf);
	return INT2FIX(pSelf->GetChannelsCount());
}