Logo Search packages:      
Sourcecode: blender version File versions  Download package

bool AUD_ReadDevice::read ( sample_t *  buffer,
int  length 
)

Reads the next bytes into the supplied buffer.

Parameters:
buffer The target buffer.
length The length in samples to be filled.
Returns:
True if the reading succeeded, false if there are no sounds played back currently, in that case the buffer is filled with silence.

Definition at line 49 of file AUD_ReadDevice.cpp.

References AUD_Specs::format, m_playing, AUD_SoftwareDevice::m_specs, and AUD_SoftwareDevice::mix().

{
      if(m_playing)
            mix(buffer, length);
      else
            if(m_specs.format == AUD_FORMAT_U8)
                  memset(buffer, 0x80, length * AUD_SAMPLE_SIZE(m_specs));
            else
                  memset(buffer, 0, length * AUD_SAMPLE_SIZE(m_specs));
      return m_playing;
}


Generated by  Doxygen 1.6.0   Back to index