mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-04 18:41:51 +00:00
add audio.get_input_info()
This commit is contained in:
parent
001c1b430b
commit
6c558eb3d5
4 changed files with 49 additions and 4 deletions
|
|
@ -68,9 +68,17 @@ std::unique_ptr<Speaker> ALSound::newInstance(int priority, int channel) const {
|
|||
}
|
||||
|
||||
ALInputDevice::ALInputDevice(
|
||||
ALAudio* al, ALCdevice* device, uint channels, uint bitsPerSample
|
||||
ALAudio* al,
|
||||
ALCdevice* device,
|
||||
uint channels,
|
||||
uint bitsPerSample,
|
||||
uint sampleRate
|
||||
)
|
||||
: al(al), device(device), channels(channels), bitsPerSample(bitsPerSample) {
|
||||
: al(al),
|
||||
device(device),
|
||||
channels(channels),
|
||||
bitsPerSample(bitsPerSample),
|
||||
sampleRate(sampleRate) {
|
||||
}
|
||||
|
||||
ALInputDevice::~ALInputDevice() {
|
||||
|
|
@ -92,6 +100,14 @@ uint ALInputDevice::getChannels() const {
|
|||
return channels;
|
||||
}
|
||||
|
||||
uint ALInputDevice::getSampleRate() const {
|
||||
return sampleRate;
|
||||
}
|
||||
|
||||
uint ALInputDevice::getBitsPerSample() const {
|
||||
return bitsPerSample;
|
||||
}
|
||||
|
||||
size_t ALInputDevice::read(char* buffer, size_t bufferSize) {
|
||||
ALCint samplesCount = 0;
|
||||
alcGetIntegerv(device, ALC_CAPTURE_SAMPLES, sizeof(samplesCount), &samplesCount);
|
||||
|
|
@ -546,7 +562,7 @@ std::unique_ptr<InputDevice> ALAudio::openInputDevice(
|
|||
return nullptr;
|
||||
|
||||
return std::make_unique<ALInputDevice>(
|
||||
this, device, channels, bitsPerSample
|
||||
this, device, channels, bitsPerSample, sampleRate
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue