ssize_t AudioStreamOutStub::write(const void* buffer, size_t bytes)
{
// fake timing for audio output
- usleep(bytes * 1000000 / sizeof(int16_t) / AudioSystem::popCount(channels()) / sampleRate());
+ usleep(bytes * 1000000 / sizeof(int16_t) /
+ audio_channel_count_from_out_mask(channels()) / sampleRate());
return bytes;
}
ssize_t AudioStreamInStub::read(void* buffer, ssize_t bytes)
{
// fake timing for audio input
- usleep(bytes * 1000000 / sizeof(int16_t) / AudioSystem::popCount(channels()) / sampleRate());
+ usleep(bytes * 1000000 / sizeof(int16_t) /
+ audio_channel_count_from_in_mask(channels()) / sampleRate());
memset(buffer, 0, bytes);
return bytes;
}
{
const struct legacy_audio_device *ladev = to_cladev(dev);
return ladev->hwif->getInputBufferSize(config->sample_rate, (int) config->format,
- popcount(config->channel_mask));
+ audio_channel_count_from_in_mask(config->channel_mask));
}
static int adev_open_output_stream(struct audio_hw_device *dev,
/**
* return the frame size (number of bytes per sample).
*/
- uint32_t frameSize() const { return popcount(channels())*((format()==AUDIO_FORMAT_PCM_16_BIT)?sizeof(int16_t):sizeof(int8_t)); }
+ uint32_t frameSize() const { return audio_channel_count_from_out_mask(channels())*
+ ((format()==AUDIO_FORMAT_PCM_16_BIT)?sizeof(int16_t):sizeof(int8_t)); }
/**
* return the audio hardware driver latency in milli seconds.
/**
* return the frame size (number of bytes per sample).
*/
- uint32_t frameSize() const { return AudioSystem::popCount(channels())*((format()==AudioSystem::PCM_16_BIT)?sizeof(int16_t):sizeof(int8_t)); }
+ uint32_t frameSize() const { return audio_channel_count_from_in_mask(channels())*
+ ((format()==AudioSystem::PCM_16_BIT)?sizeof(int16_t):sizeof(int8_t)); }
/** set the input gain for the audio driver. This method is for
* for future use */