Return unsigned values from the FromDevFmt functions
This commit is contained in:
parent
fcd3bed0c0
commit
a250b6a986
@ -1272,7 +1272,7 @@ const ALCchar *DevFmtChannelsString(DevFmtChannels chans) noexcept
|
|||||||
return "(unknown channels)";
|
return "(unknown channels)";
|
||||||
}
|
}
|
||||||
|
|
||||||
ALsizei BytesFromDevFmt(DevFmtType type) noexcept
|
ALuint BytesFromDevFmt(DevFmtType type) noexcept
|
||||||
{
|
{
|
||||||
switch(type)
|
switch(type)
|
||||||
{
|
{
|
||||||
@ -1286,7 +1286,7 @@ ALsizei BytesFromDevFmt(DevFmtType type) noexcept
|
|||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
ALsizei ChannelsFromDevFmt(DevFmtChannels chans, ALsizei ambiorder) noexcept
|
ALuint ChannelsFromDevFmt(DevFmtChannels chans, ALsizei ambiorder) noexcept
|
||||||
{
|
{
|
||||||
switch(chans)
|
switch(chans)
|
||||||
{
|
{
|
||||||
@ -1297,7 +1297,7 @@ ALsizei ChannelsFromDevFmt(DevFmtChannels chans, ALsizei ambiorder) noexcept
|
|||||||
case DevFmtX51Rear: return 6;
|
case DevFmtX51Rear: return 6;
|
||||||
case DevFmtX61: return 7;
|
case DevFmtX61: return 7;
|
||||||
case DevFmtX71: return 8;
|
case DevFmtX71: return 8;
|
||||||
case DevFmtAmbi3D: return (ambiorder+1) * (ambiorder+1);
|
case DevFmtAmbi3D: return static_cast<ALuint>((ambiorder+1) * (ambiorder+1));
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -340,9 +340,9 @@ struct ALCdevice : public al::intrusive_ref<ALCdevice> {
|
|||||||
ALCdevice& operator=(const ALCdevice&) = delete;
|
ALCdevice& operator=(const ALCdevice&) = delete;
|
||||||
~ALCdevice();
|
~ALCdevice();
|
||||||
|
|
||||||
ALsizei bytesFromFmt() const noexcept { return BytesFromDevFmt(FmtType); }
|
ALuint bytesFromFmt() const noexcept { return BytesFromDevFmt(FmtType); }
|
||||||
ALsizei channelsFromFmt() const noexcept { return ChannelsFromDevFmt(FmtChans, mAmbiOrder); }
|
ALuint channelsFromFmt() const noexcept { return ChannelsFromDevFmt(FmtChans, mAmbiOrder); }
|
||||||
ALsizei frameSizeFromFmt() const noexcept { return bytesFromFmt() * channelsFromFmt(); }
|
ALuint frameSizeFromFmt() const noexcept { return bytesFromFmt() * channelsFromFmt(); }
|
||||||
|
|
||||||
void ProcessHrtf(const size_t SamplesToDo);
|
void ProcessHrtf(const size_t SamplesToDo);
|
||||||
void ProcessAmbiDec(const size_t SamplesToDo);
|
void ProcessAmbiDec(const size_t SamplesToDo);
|
||||||
|
@ -219,7 +219,7 @@ FORCE_ALIGN int DSoundPlayback::mixerProc()
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
ALsizei FrameSize{mDevice->frameSizeFromFmt()};
|
ALuint FrameSize{mDevice->frameSizeFromFmt()};
|
||||||
DWORD FragSize{mDevice->UpdateSize * FrameSize};
|
DWORD FragSize{mDevice->UpdateSize * FrameSize};
|
||||||
|
|
||||||
bool Playing{false};
|
bool Playing{false};
|
||||||
@ -820,7 +820,7 @@ ALCuint DSoundCapture::availableSamples()
|
|||||||
if(!mDevice->Connected.load(std::memory_order_acquire))
|
if(!mDevice->Connected.load(std::memory_order_acquire))
|
||||||
return static_cast<ALCuint>(mRing->readSpace());
|
return static_cast<ALCuint>(mRing->readSpace());
|
||||||
|
|
||||||
ALsizei FrameSize{mDevice->frameSizeFromFmt()};
|
ALuint FrameSize{mDevice->frameSizeFromFmt()};
|
||||||
DWORD BufferBytes{mBufferBytes};
|
DWORD BufferBytes{mBufferBytes};
|
||||||
DWORD LastCursor{mCursor};
|
DWORD LastCursor{mCursor};
|
||||||
|
|
||||||
|
@ -235,7 +235,7 @@ int JackPlayback::process(jack_nframes_t numframes)
|
|||||||
}
|
}
|
||||||
|
|
||||||
auto data = mRing->getReadVector();
|
auto data = mRing->getReadVector();
|
||||||
jack_nframes_t todo{minu(numframes, data.first.len)};
|
jack_nframes_t todo{minu(numframes, static_cast<ALuint>(data.first.len))};
|
||||||
std::transform(out, out+numchans, out,
|
std::transform(out, out+numchans, out,
|
||||||
[&data,numchans,todo](ALfloat *outbuf) -> ALfloat*
|
[&data,numchans,todo](ALfloat *outbuf) -> ALfloat*
|
||||||
{
|
{
|
||||||
@ -254,7 +254,7 @@ int JackPlayback::process(jack_nframes_t numframes)
|
|||||||
);
|
);
|
||||||
jack_nframes_t total{todo};
|
jack_nframes_t total{todo};
|
||||||
|
|
||||||
todo = minu(numframes-total, data.second.len);
|
todo = minu(numframes-total, static_cast<ALuint>(data.second.len));
|
||||||
if(todo > 0)
|
if(todo > 0)
|
||||||
{
|
{
|
||||||
std::transform(out, out+numchans, out,
|
std::transform(out, out+numchans, out,
|
||||||
@ -315,8 +315,8 @@ int JackPlayback::mixerProc()
|
|||||||
auto todo = static_cast<ALuint>(data.first.len + data.second.len);
|
auto todo = static_cast<ALuint>(data.first.len + data.second.len);
|
||||||
todo -= todo%mDevice->UpdateSize;
|
todo -= todo%mDevice->UpdateSize;
|
||||||
|
|
||||||
ALuint len1{minu(data.first.len, todo)};
|
ALuint len1{minu(static_cast<ALuint>(data.first.len), todo)};
|
||||||
ALuint len2{minu(data.second.len, todo-len1)};
|
ALuint len2{minu(static_cast<ALuint>(data.second.len), todo-len1)};
|
||||||
|
|
||||||
aluMixData(mDevice, data.first.buf, len1);
|
aluMixData(mDevice, data.first.buf, len1);
|
||||||
if(len2 > 0)
|
if(len2 > 0)
|
||||||
@ -382,8 +382,7 @@ ALCboolean JackPlayback::reset()
|
|||||||
/* Force 32-bit float output. */
|
/* Force 32-bit float output. */
|
||||||
mDevice->FmtType = DevFmtFloat;
|
mDevice->FmtType = DevFmtFloat;
|
||||||
|
|
||||||
ALsizei numchans{mDevice->channelsFromFmt()};
|
auto ports_end = std::begin(mPort) + mDevice->channelsFromFmt();
|
||||||
auto ports_end = std::begin(mPort) + numchans;
|
|
||||||
auto bad_port = std::find_if_not(std::begin(mPort), ports_end,
|
auto bad_port = std::find_if_not(std::begin(mPort), ports_end,
|
||||||
[this](jack_port_t *&port) -> bool
|
[this](jack_port_t *&port) -> bool
|
||||||
{
|
{
|
||||||
@ -410,7 +409,6 @@ ALCboolean JackPlayback::reset()
|
|||||||
}
|
}
|
||||||
mDevice->FmtChans = DevFmtStereo;
|
mDevice->FmtChans = DevFmtStereo;
|
||||||
}
|
}
|
||||||
numchans = std::distance(std::begin(mPort), bad_port);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
mRing = nullptr;
|
mRing = nullptr;
|
||||||
|
@ -230,10 +230,10 @@ done:
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int log2i(ALCuint x)
|
ALCuint log2i(ALCuint x)
|
||||||
{
|
{
|
||||||
int y = 0;
|
ALCuint y{0};
|
||||||
while (x > 1)
|
while(x > 1)
|
||||||
{
|
{
|
||||||
x >>= 1;
|
x >>= 1;
|
||||||
y++;
|
y++;
|
||||||
@ -276,7 +276,7 @@ int OSSPlayback::mixerProc()
|
|||||||
SetRTPriority();
|
SetRTPriority();
|
||||||
althrd_setname(MIXER_THREAD_NAME);
|
althrd_setname(MIXER_THREAD_NAME);
|
||||||
|
|
||||||
const int frame_size{mDevice->frameSizeFromFmt()};
|
const ALuint frame_size{mDevice->frameSizeFromFmt()};
|
||||||
|
|
||||||
lock();
|
lock();
|
||||||
while(!mKillNow.load(std::memory_order_acquire) &&
|
while(!mKillNow.load(std::memory_order_acquire) &&
|
||||||
@ -319,7 +319,7 @@ int OSSPlayback::mixerProc()
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
to_write -= wrote;
|
to_write -= static_cast<size_t>(wrote);
|
||||||
write_ptr += wrote;
|
write_ptr += wrote;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -361,16 +361,7 @@ ALCenum OSSPlayback::open(const ALCchar *name)
|
|||||||
|
|
||||||
ALCboolean OSSPlayback::reset()
|
ALCboolean OSSPlayback::reset()
|
||||||
{
|
{
|
||||||
int numFragmentsLogSize;
|
int ossFormat{};
|
||||||
int log2FragmentSize;
|
|
||||||
unsigned int periods;
|
|
||||||
audio_buf_info info;
|
|
||||||
ALuint frameSize;
|
|
||||||
int numChannels;
|
|
||||||
int ossFormat;
|
|
||||||
int ossSpeed;
|
|
||||||
const char *err;
|
|
||||||
|
|
||||||
switch(mDevice->FmtType)
|
switch(mDevice->FmtType)
|
||||||
{
|
{
|
||||||
case DevFmtByte:
|
case DevFmtByte:
|
||||||
@ -390,14 +381,16 @@ ALCboolean OSSPlayback::reset()
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
periods = mDevice->BufferSize / mDevice->UpdateSize;
|
ALuint periods{mDevice->BufferSize / mDevice->UpdateSize};
|
||||||
numChannels = mDevice->channelsFromFmt();
|
ALuint numChannels{mDevice->channelsFromFmt()};
|
||||||
ossSpeed = mDevice->Frequency;
|
ALuint ossSpeed{mDevice->Frequency};
|
||||||
frameSize = numChannels * mDevice->bytesFromFmt();
|
ALuint frameSize{numChannels * mDevice->bytesFromFmt()};
|
||||||
/* According to the OSS spec, 16 bytes (log2(16)) is the minimum. */
|
/* According to the OSS spec, 16 bytes (log2(16)) is the minimum. */
|
||||||
log2FragmentSize = maxi(log2i(mDevice->UpdateSize*frameSize), 4);
|
ALuint log2FragmentSize{maxu(log2i(mDevice->UpdateSize*frameSize), 4)};
|
||||||
numFragmentsLogSize = (periods << 16) | log2FragmentSize;
|
ALuint numFragmentsLogSize{(periods << 16) | log2FragmentSize};
|
||||||
|
|
||||||
|
audio_buf_info info{};
|
||||||
|
const char *err;
|
||||||
#define CHECKERR(func) if((func) < 0) { \
|
#define CHECKERR(func) if((func) < 0) { \
|
||||||
err = #func; \
|
err = #func; \
|
||||||
goto err; \
|
goto err; \
|
||||||
@ -434,8 +427,8 @@ ALCboolean OSSPlayback::reset()
|
|||||||
}
|
}
|
||||||
|
|
||||||
mDevice->Frequency = ossSpeed;
|
mDevice->Frequency = ossSpeed;
|
||||||
mDevice->UpdateSize = info.fragsize / frameSize;
|
mDevice->UpdateSize = static_cast<ALuint>(info.fragsize) / frameSize;
|
||||||
mDevice->BufferSize = info.fragments * mDevice->UpdateSize;
|
mDevice->BufferSize = static_cast<ALuint>(info.fragments) * mDevice->UpdateSize;
|
||||||
|
|
||||||
SetDefaultChannelOrder(mDevice);
|
SetDefaultChannelOrder(mDevice);
|
||||||
|
|
||||||
@ -505,7 +498,7 @@ int OSScapture::recordProc()
|
|||||||
SetRTPriority();
|
SetRTPriority();
|
||||||
althrd_setname(RECORD_THREAD_NAME);
|
althrd_setname(RECORD_THREAD_NAME);
|
||||||
|
|
||||||
const int frame_size{mDevice->frameSizeFromFmt()};
|
const ALuint frame_size{mDevice->frameSizeFromFmt()};
|
||||||
while(!mKillNow.load(std::memory_order_acquire))
|
while(!mKillNow.load(std::memory_order_acquire))
|
||||||
{
|
{
|
||||||
pollfd pollitem{};
|
pollfd pollitem{};
|
||||||
@ -592,17 +585,15 @@ ALCenum OSScapture::open(const ALCchar *name)
|
|||||||
return ALC_INVALID_VALUE;
|
return ALC_INVALID_VALUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
int periods{4};
|
ALuint periods{4};
|
||||||
int numChannels{mDevice->channelsFromFmt()};
|
ALuint numChannels{mDevice->channelsFromFmt()};
|
||||||
int frameSize{numChannels * mDevice->bytesFromFmt()};
|
ALuint frameSize{numChannels * mDevice->bytesFromFmt()};
|
||||||
int ossSpeed{static_cast<int>(mDevice->Frequency)};
|
ALuint ossSpeed{mDevice->Frequency};
|
||||||
int log2FragmentSize{log2i(mDevice->BufferSize * frameSize / periods)};
|
|
||||||
|
|
||||||
/* according to the OSS spec, 16 bytes are the minimum */
|
/* according to the OSS spec, 16 bytes are the minimum */
|
||||||
log2FragmentSize = std::max(log2FragmentSize, 4);
|
ALuint log2FragmentSize{maxu(log2i(mDevice->BufferSize * frameSize / periods), 4)};
|
||||||
int numFragmentsLogSize{(periods << 16) | log2FragmentSize};
|
ALuint numFragmentsLogSize{(periods << 16) | log2FragmentSize};
|
||||||
|
|
||||||
audio_buf_info info;
|
audio_buf_info info{};
|
||||||
const char *err;
|
const char *err;
|
||||||
#define CHECKERR(func) if((func) < 0) { \
|
#define CHECKERR(func) if((func) < 0) { \
|
||||||
err = #func; \
|
err = #func; \
|
||||||
@ -687,7 +678,7 @@ ALCenum OSScapture::captureSamples(ALCvoid *buffer, ALCuint samples)
|
|||||||
}
|
}
|
||||||
|
|
||||||
ALCuint OSScapture::availableSamples()
|
ALCuint OSScapture::availableSamples()
|
||||||
{ return mRing->readSpace(); }
|
{ return static_cast<ALCuint>(mRing->readSpace()); }
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
|
@ -114,7 +114,7 @@ int PortPlayback::writeCallback(const void*, void *outputBuffer,
|
|||||||
const PaStreamCallbackFlags)
|
const PaStreamCallbackFlags)
|
||||||
{
|
{
|
||||||
lock();
|
lock();
|
||||||
aluMixData(mDevice, outputBuffer, framesPerBuffer);
|
aluMixData(mDevice, outputBuffer, static_cast<ALuint>(framesPerBuffer));
|
||||||
unlock();
|
unlock();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -182,7 +182,7 @@ retry_open:
|
|||||||
ALCboolean PortPlayback::reset()
|
ALCboolean PortPlayback::reset()
|
||||||
{
|
{
|
||||||
const PaStreamInfo *streamInfo{Pa_GetStreamInfo(mStream)};
|
const PaStreamInfo *streamInfo{Pa_GetStreamInfo(mStream)};
|
||||||
mDevice->Frequency = streamInfo->sampleRate;
|
mDevice->Frequency = static_cast<ALuint>(streamInfo->sampleRate);
|
||||||
mDevice->UpdateSize = mUpdateSize;
|
mDevice->UpdateSize = mUpdateSize;
|
||||||
|
|
||||||
if(mParams.sampleFormat == paInt8)
|
if(mParams.sampleFormat == paInt8)
|
||||||
@ -293,7 +293,7 @@ ALCenum PortCapture::open(const ALCchar *name)
|
|||||||
|
|
||||||
ALuint samples{mDevice->BufferSize};
|
ALuint samples{mDevice->BufferSize};
|
||||||
samples = maxu(samples, 100 * mDevice->Frequency / 1000);
|
samples = maxu(samples, 100 * mDevice->Frequency / 1000);
|
||||||
ALsizei frame_size{mDevice->frameSizeFromFmt()};
|
ALuint frame_size{mDevice->frameSizeFromFmt()};
|
||||||
|
|
||||||
mRing = CreateRingBuffer(samples, frame_size, false);
|
mRing = CreateRingBuffer(samples, frame_size, false);
|
||||||
if(!mRing) return ALC_INVALID_VALUE;
|
if(!mRing) return ALC_INVALID_VALUE;
|
||||||
@ -326,7 +326,7 @@ ALCenum PortCapture::open(const ALCchar *name)
|
|||||||
ERR("%s samples not supported\n", DevFmtTypeString(mDevice->FmtType));
|
ERR("%s samples not supported\n", DevFmtTypeString(mDevice->FmtType));
|
||||||
return ALC_INVALID_VALUE;
|
return ALC_INVALID_VALUE;
|
||||||
}
|
}
|
||||||
mParams.channelCount = mDevice->channelsFromFmt();
|
mParams.channelCount = static_cast<int>(mDevice->channelsFromFmt());
|
||||||
|
|
||||||
PaError err{Pa_OpenStream(&mStream, &mParams, nullptr, mDevice->Frequency,
|
PaError err{Pa_OpenStream(&mStream, &mParams, nullptr, mDevice->Frequency,
|
||||||
paFramesPerBufferUnspecified, paNoFlag, &PortCapture::readCallbackC, this)};
|
paFramesPerBufferUnspecified, paNoFlag, &PortCapture::readCallbackC, this)};
|
||||||
@ -361,7 +361,7 @@ void PortCapture::stop()
|
|||||||
|
|
||||||
|
|
||||||
ALCuint PortCapture::availableSamples()
|
ALCuint PortCapture::availableSamples()
|
||||||
{ return mRing->readSpace(); }
|
{ return static_cast<ALCuint>(mRing->readSpace()); }
|
||||||
|
|
||||||
ALCenum PortCapture::captureSamples(ALCvoid *buffer, ALCuint samples)
|
ALCenum PortCapture::captureSamples(ALCvoid *buffer, ALCuint samples)
|
||||||
{
|
{
|
||||||
|
@ -153,7 +153,7 @@ ALCenum Sdl2Backend::open(const ALCchar *name)
|
|||||||
mDevice->UpdateSize = have.samples;
|
mDevice->UpdateSize = have.samples;
|
||||||
mDevice->BufferSize = have.samples * 2; /* SDL always (tries to) use two periods. */
|
mDevice->BufferSize = have.samples * 2; /* SDL always (tries to) use two periods. */
|
||||||
|
|
||||||
mFrameSize = static_cast<ALuint>(mDevice->frameSizeFromFmt());
|
mFrameSize = mDevice->frameSizeFromFmt();
|
||||||
mFrequency = mDevice->Frequency;
|
mFrequency = mDevice->Frequency;
|
||||||
mFmtChans = mDevice->FmtChans;
|
mFmtChans = mDevice->FmtChans;
|
||||||
mFmtType = mDevice->FmtType;
|
mFmtType = mDevice->FmtType;
|
||||||
|
@ -76,16 +76,16 @@ int SndioPlayback::mixerProc()
|
|||||||
SetRTPriority();
|
SetRTPriority();
|
||||||
althrd_setname(MIXER_THREAD_NAME);
|
althrd_setname(MIXER_THREAD_NAME);
|
||||||
|
|
||||||
const ALsizei frameSize{mDevice->frameSizeFromFmt()};
|
const ALuint frameSize{mDevice->frameSizeFromFmt()};
|
||||||
|
|
||||||
while(!mKillNow.load(std::memory_order_acquire) &&
|
while(!mKillNow.load(std::memory_order_acquire) &&
|
||||||
mDevice->Connected.load(std::memory_order_acquire))
|
mDevice->Connected.load(std::memory_order_acquire))
|
||||||
{
|
{
|
||||||
auto WritePtr = static_cast<ALubyte*>(mBuffer.data());
|
ALubyte *WritePtr{mBuffer.data()};
|
||||||
size_t len{mBuffer.size()};
|
size_t len{mBuffer.size()};
|
||||||
|
|
||||||
lock();
|
lock();
|
||||||
aluMixData(mDevice, WritePtr, len/frameSize);
|
aluMixData(mDevice, WritePtr, static_cast<ALuint>(len/frameSize));
|
||||||
unlock();
|
unlock();
|
||||||
while(len > 0 && !mKillNow.load(std::memory_order_acquire))
|
while(len > 0 && !mKillNow.load(std::memory_order_acquire))
|
||||||
{
|
{
|
||||||
@ -277,7 +277,7 @@ int SndioCapture::recordProc()
|
|||||||
SetRTPriority();
|
SetRTPriority();
|
||||||
althrd_setname(RECORD_THREAD_NAME);
|
althrd_setname(RECORD_THREAD_NAME);
|
||||||
|
|
||||||
const ALsizei frameSize{mDevice->frameSizeFromFmt()};
|
const ALuint frameSize{mDevice->frameSizeFromFmt()};
|
||||||
|
|
||||||
while(!mKillNow.load(std::memory_order_acquire) &&
|
while(!mKillNow.load(std::memory_order_acquire) &&
|
||||||
mDevice->Connected.load(std::memory_order_acquire))
|
mDevice->Connected.load(std::memory_order_acquire))
|
||||||
@ -396,8 +396,7 @@ ALCenum SndioCapture::open(const ALCchar *name)
|
|||||||
(mDevice->FmtType == DevFmtUShort && par.bits == 16 && par.sig == 0) ||
|
(mDevice->FmtType == DevFmtUShort && par.bits == 16 && par.sig == 0) ||
|
||||||
(mDevice->FmtType == DevFmtInt && par.bits == 32 && par.sig != 0) ||
|
(mDevice->FmtType == DevFmtInt && par.bits == 32 && par.sig != 0) ||
|
||||||
(mDevice->FmtType == DevFmtUInt && par.bits == 32 && par.sig == 0)) ||
|
(mDevice->FmtType == DevFmtUInt && par.bits == 32 && par.sig == 0)) ||
|
||||||
mDevice->channelsFromFmt() != static_cast<int>(par.rchan) ||
|
mDevice->channelsFromFmt() != par.rchan || mDevice->Frequency != par.rate)
|
||||||
mDevice->Frequency != par.rate)
|
|
||||||
{
|
{
|
||||||
ERR("Failed to set format %s %s %uhz, got %c%u %u-channel %uhz instead\n",
|
ERR("Failed to set format %s %s %uhz, got %c%u %u-channel %uhz instead\n",
|
||||||
DevFmtTypeString(mDevice->FmtType), DevFmtChannelsString(mDevice->FmtChans),
|
DevFmtTypeString(mDevice->FmtType), DevFmtChannelsString(mDevice->FmtChans),
|
||||||
@ -457,7 +456,7 @@ ALCenum SndioCapture::captureSamples(void *buffer, ALCuint samples)
|
|||||||
}
|
}
|
||||||
|
|
||||||
ALCuint SndioCapture::availableSamples()
|
ALCuint SndioCapture::availableSamples()
|
||||||
{ return mRing->readSpace(); }
|
{ return static_cast<ALCuint>(mRing->readSpace()); }
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
|
@ -88,7 +88,7 @@ int SolarisBackend::mixerProc()
|
|||||||
SetRTPriority();
|
SetRTPriority();
|
||||||
althrd_setname(MIXER_THREAD_NAME);
|
althrd_setname(MIXER_THREAD_NAME);
|
||||||
|
|
||||||
const int frame_size{mDevice->frameSizeFromFmt()};
|
const ALuint frame_size{mDevice->frameSizeFromFmt()};
|
||||||
|
|
||||||
lock();
|
lock();
|
||||||
while(!mKillNow.load(std::memory_order_acquire) &&
|
while(!mKillNow.load(std::memory_order_acquire) &&
|
||||||
@ -169,7 +169,7 @@ ALCboolean SolarisBackend::reset()
|
|||||||
|
|
||||||
if(mDevice->FmtChans != DevFmtMono)
|
if(mDevice->FmtChans != DevFmtMono)
|
||||||
mDevice->FmtChans = DevFmtStereo;
|
mDevice->FmtChans = DevFmtStereo;
|
||||||
ALsizei numChannels{mDevice->channelsFromFmt()};
|
ALuint numChannels{mDevice->channelsFromFmt()};
|
||||||
info.play.channels = numChannels;
|
info.play.channels = numChannels;
|
||||||
|
|
||||||
switch(mDevice->FmtType)
|
switch(mDevice->FmtType)
|
||||||
@ -194,7 +194,7 @@ ALCboolean SolarisBackend::reset()
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
ALsizei frameSize{numChannels * mDevice->bytesFromFmt()};
|
ALuint frameSize{numChannels * mDevice->bytesFromFmt()};
|
||||||
info.play.buffer_size = mDevice->BufferSize * frameSize;
|
info.play.buffer_size = mDevice->BufferSize * frameSize;
|
||||||
|
|
||||||
if(ioctl(mFd, AUDIO_SETINFO, &info) < 0)
|
if(ioctl(mFd, AUDIO_SETINFO, &info) < 0)
|
||||||
@ -203,7 +203,7 @@ ALCboolean SolarisBackend::reset()
|
|||||||
return ALC_FALSE;
|
return ALC_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(mDevice->channelsFromFmt() != (ALsizei)info.play.channels)
|
if(mDevice->channelsFromFmt() != info.play.channels)
|
||||||
{
|
{
|
||||||
ERR("Failed to set %s, got %u channels instead\n", DevFmtChannelsString(mDevice->FmtChans),
|
ERR("Failed to set %s, got %u channels instead\n", DevFmtChannelsString(mDevice->FmtChans),
|
||||||
info.play.channels);
|
info.play.channels);
|
||||||
|
@ -1565,9 +1565,8 @@ HRESULT WasapiCapture::resetProxy()
|
|||||||
|
|
||||||
if(mDevice->Frequency != OutputType.Format.nSamplesPerSec || mDevice->FmtType != srcType)
|
if(mDevice->Frequency != OutputType.Format.nSamplesPerSec || mDevice->FmtType != srcType)
|
||||||
{
|
{
|
||||||
mSampleConv = CreateSampleConverter(srcType, mDevice->FmtType,
|
mSampleConv = CreateSampleConverter(srcType, mDevice->FmtType, mDevice->channelsFromFmt(),
|
||||||
static_cast<ALuint>(mDevice->channelsFromFmt()), OutputType.Format.nSamplesPerSec,
|
OutputType.Format.nSamplesPerSec, mDevice->Frequency, BSinc24Resampler);
|
||||||
mDevice->Frequency, BSinc24Resampler);
|
|
||||||
if(!mSampleConv)
|
if(!mSampleConv)
|
||||||
{
|
{
|
||||||
ERR("Failed to create converter for %s format, dst: %s %uhz, src: %s %luhz\n",
|
ERR("Failed to create converter for %s format, dst: %s %uhz, src: %s %luhz\n",
|
||||||
|
@ -125,7 +125,7 @@ int WaveBackend::mixerProc()
|
|||||||
|
|
||||||
althrd_setname(MIXER_THREAD_NAME);
|
althrd_setname(MIXER_THREAD_NAME);
|
||||||
|
|
||||||
const auto frameSize = static_cast<ALuint>(mDevice->frameSizeFromFmt());
|
const ALuint frameSize{mDevice->frameSizeFromFmt()};
|
||||||
|
|
||||||
int64_t done{0};
|
int64_t done{0};
|
||||||
auto start = std::chrono::steady_clock::now();
|
auto start = std::chrono::steady_clock::now();
|
||||||
@ -151,7 +151,7 @@ int WaveBackend::mixerProc()
|
|||||||
|
|
||||||
if(!IS_LITTLE_ENDIAN)
|
if(!IS_LITTLE_ENDIAN)
|
||||||
{
|
{
|
||||||
const ALsizei bytesize{mDevice->bytesFromFmt()};
|
const ALuint bytesize{mDevice->bytesFromFmt()};
|
||||||
|
|
||||||
if(bytesize == 2)
|
if(bytesize == 2)
|
||||||
{
|
{
|
||||||
@ -281,8 +281,8 @@ ALCboolean WaveBackend::reset()
|
|||||||
chanmask = 0;
|
chanmask = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
bytes = static_cast<ALuint>(mDevice->bytesFromFmt());
|
bytes = mDevice->bytesFromFmt();
|
||||||
channels = static_cast<ALuint>(mDevice->channelsFromFmt());
|
channels = mDevice->channelsFromFmt();
|
||||||
|
|
||||||
rewind(mFile);
|
rewind(mFile);
|
||||||
|
|
||||||
@ -330,7 +330,7 @@ ALCboolean WaveBackend::reset()
|
|||||||
|
|
||||||
SetDefaultWFXChannelOrder(mDevice);
|
SetDefaultWFXChannelOrder(mDevice);
|
||||||
|
|
||||||
const ALuint bufsize{static_cast<ALuint>(mDevice->frameSizeFromFmt())*mDevice->UpdateSize};
|
const ALuint bufsize{mDevice->frameSizeFromFmt() * mDevice->UpdateSize};
|
||||||
mBuffer.resize(bufsize);
|
mBuffer.resize(bufsize);
|
||||||
|
|
||||||
return ALC_TRUE;
|
return ALC_TRUE;
|
||||||
|
@ -152,8 +152,8 @@ SampleConverterPtr CreateSampleConverter(DevFmtType srcType, DevFmtType dstType,
|
|||||||
SampleConverterPtr converter{new (FamCount{numchans}) SampleConverter{numchans}};
|
SampleConverterPtr converter{new (FamCount{numchans}) SampleConverter{numchans}};
|
||||||
converter->mSrcType = srcType;
|
converter->mSrcType = srcType;
|
||||||
converter->mDstType = dstType;
|
converter->mDstType = dstType;
|
||||||
converter->mSrcTypeSize = static_cast<ALuint>(BytesFromDevFmt(srcType));
|
converter->mSrcTypeSize = BytesFromDevFmt(srcType);
|
||||||
converter->mDstTypeSize = static_cast<ALuint>(BytesFromDevFmt(dstType));
|
converter->mDstTypeSize = BytesFromDevFmt(dstType);
|
||||||
|
|
||||||
converter->mSrcPrepCount = 0;
|
converter->mSrcPrepCount = 0;
|
||||||
converter->mFracOffset = 0;
|
converter->mFracOffset = 0;
|
||||||
@ -360,6 +360,5 @@ void ChannelConverter::convert(const ALvoid *src, ALfloat *dst, ALuint frames) c
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
LoadSamples(dst, src, 1u, mSrcType,
|
LoadSamples(dst, src, 1u, mSrcType, frames * ChannelsFromDevFmt(mSrcChans, 0));
|
||||||
frames*static_cast<ALuint>(ChannelsFromDevFmt(mSrcChans, 0)));
|
|
||||||
}
|
}
|
||||||
|
@ -97,9 +97,9 @@ template<>
|
|||||||
struct DevFmtTypeTraits<DevFmtFloat> { using Type = ALfloat; };
|
struct DevFmtTypeTraits<DevFmtFloat> { using Type = ALfloat; };
|
||||||
|
|
||||||
|
|
||||||
ALsizei BytesFromDevFmt(DevFmtType type) noexcept;
|
ALuint BytesFromDevFmt(DevFmtType type) noexcept;
|
||||||
ALsizei ChannelsFromDevFmt(DevFmtChannels chans, ALsizei ambiorder) noexcept;
|
ALuint ChannelsFromDevFmt(DevFmtChannels chans, ALsizei ambiorder) noexcept;
|
||||||
inline ALsizei FrameSizeFromDevFmt(DevFmtChannels chans, DevFmtType type, ALsizei ambiorder) noexcept
|
inline ALuint FrameSizeFromDevFmt(DevFmtChannels chans, DevFmtType type, ALsizei ambiorder) noexcept
|
||||||
{ return ChannelsFromDevFmt(chans, ambiorder) * BytesFromDevFmt(type); }
|
{ return ChannelsFromDevFmt(chans, ambiorder) * BytesFromDevFmt(type); }
|
||||||
|
|
||||||
enum class AmbiLayout {
|
enum class AmbiLayout {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user