aboutsummaryrefslogtreecommitdiffstats
path: root/alc
diff options
context:
space:
mode:
Diffstat (limited to 'alc')
-rw-r--r--alc/alc.cpp40
-rw-r--r--alc/alconfig.cpp12
-rw-r--r--alc/backends/pulseaudio.cpp6
3 files changed, 30 insertions, 28 deletions
diff --git a/alc/alc.cpp b/alc/alc.cpp
index 37b85255..654f3fb2 100644
--- a/alc/alc.cpp
+++ b/alc/alc.cpp
@@ -1428,7 +1428,7 @@ al::optional<DevFmtPair> DecomposeDevFormat(ALenum format)
for(const auto &item : list)
{
if(item.format == format)
- return al::make_optional(DevFmtPair{item.channels, item.type});
+ return al::make_optional<DevFmtPair>({item.channels, item.type});
}
return al::nullopt;
@@ -1438,13 +1438,13 @@ al::optional<DevFmtType> DevFmtTypeFromEnum(ALCenum type)
{
switch(type)
{
- case ALC_BYTE_SOFT: return al::make_optional(DevFmtByte);
- case ALC_UNSIGNED_BYTE_SOFT: return al::make_optional(DevFmtUByte);
- case ALC_SHORT_SOFT: return al::make_optional(DevFmtShort);
- case ALC_UNSIGNED_SHORT_SOFT: return al::make_optional(DevFmtUShort);
- case ALC_INT_SOFT: return al::make_optional(DevFmtInt);
- case ALC_UNSIGNED_INT_SOFT: return al::make_optional(DevFmtUInt);
- case ALC_FLOAT_SOFT: return al::make_optional(DevFmtFloat);
+ case ALC_BYTE_SOFT: return DevFmtByte;
+ case ALC_UNSIGNED_BYTE_SOFT: return DevFmtUByte;
+ case ALC_SHORT_SOFT: return DevFmtShort;
+ case ALC_UNSIGNED_SHORT_SOFT: return DevFmtUShort;
+ case ALC_INT_SOFT: return DevFmtInt;
+ case ALC_UNSIGNED_INT_SOFT: return DevFmtUInt;
+ case ALC_FLOAT_SOFT: return DevFmtFloat;
}
WARN("Unsupported format type: 0x%04x\n", type);
return al::nullopt;
@@ -1468,13 +1468,13 @@ al::optional<DevFmtChannels> DevFmtChannelsFromEnum(ALCenum channels)
{
switch(channels)
{
- case ALC_MONO_SOFT: return al::make_optional(DevFmtMono);
- case ALC_STEREO_SOFT: return al::make_optional(DevFmtStereo);
- case ALC_QUAD_SOFT: return al::make_optional(DevFmtQuad);
- case ALC_5POINT1_SOFT: return al::make_optional(DevFmtX51);
- case ALC_6POINT1_SOFT: return al::make_optional(DevFmtX61);
- case ALC_7POINT1_SOFT: return al::make_optional(DevFmtX71);
- case ALC_BFORMAT3D_SOFT: return al::make_optional(DevFmtAmbi3D);
+ case ALC_MONO_SOFT: return DevFmtMono;
+ case ALC_STEREO_SOFT: return DevFmtStereo;
+ case ALC_QUAD_SOFT: return DevFmtQuad;
+ case ALC_5POINT1_SOFT: return DevFmtX51;
+ case ALC_6POINT1_SOFT: return DevFmtX61;
+ case ALC_7POINT1_SOFT: return DevFmtX71;
+ case ALC_BFORMAT3D_SOFT: return DevFmtAmbi3D;
}
WARN("Unsupported format channels: 0x%04x\n", channels);
return al::nullopt;
@@ -1501,8 +1501,8 @@ al::optional<DevAmbiLayout> DevAmbiLayoutFromEnum(ALCenum layout)
{
switch(layout)
{
- case ALC_FUMA_SOFT: return al::make_optional(DevAmbiLayout::FuMa);
- case ALC_ACN_SOFT: return al::make_optional(DevAmbiLayout::ACN);
+ case ALC_FUMA_SOFT: return DevAmbiLayout::FuMa;
+ case ALC_ACN_SOFT: return DevAmbiLayout::ACN;
}
WARN("Unsupported ambisonic layout: 0x%04x\n", layout);
return al::nullopt;
@@ -1521,9 +1521,9 @@ al::optional<DevAmbiScaling> DevAmbiScalingFromEnum(ALCenum scaling)
{
switch(scaling)
{
- case ALC_FUMA_SOFT: return al::make_optional(DevAmbiScaling::FuMa);
- case ALC_SN3D_SOFT: return al::make_optional(DevAmbiScaling::SN3D);
- case ALC_N3D_SOFT: return al::make_optional(DevAmbiScaling::N3D);
+ case ALC_FUMA_SOFT: return DevAmbiScaling::FuMa;
+ case ALC_SN3D_SOFT: return DevAmbiScaling::SN3D;
+ case ALC_N3D_SOFT: return DevAmbiScaling::N3D;
}
WARN("Unsupported ambisonic scaling: 0x%04x\n", scaling);
return al::nullopt;
diff --git a/alc/alconfig.cpp b/alc/alconfig.cpp
index 7c1eec6d..14b2580d 100644
--- a/alc/alconfig.cpp
+++ b/alc/alconfig.cpp
@@ -486,36 +486,36 @@ void ReadALConfig()
al::optional<std::string> ConfigValueStr(const char *devName, const char *blockName, const char *keyName)
{
if(const char *val{GetConfigValue(devName, blockName, keyName)})
- return al::make_optional<std::string>(val);
+ return val;
return al::nullopt;
}
al::optional<int> ConfigValueInt(const char *devName, const char *blockName, const char *keyName)
{
if(const char *val{GetConfigValue(devName, blockName, keyName)})
- return al::make_optional(static_cast<int>(std::strtol(val, nullptr, 0)));
+ return static_cast<int>(std::strtol(val, nullptr, 0));
return al::nullopt;
}
al::optional<unsigned int> ConfigValueUInt(const char *devName, const char *blockName, const char *keyName)
{
if(const char *val{GetConfigValue(devName, blockName, keyName)})
- return al::make_optional(static_cast<unsigned int>(std::strtoul(val, nullptr, 0)));
+ return static_cast<unsigned int>(std::strtoul(val, nullptr, 0));
return al::nullopt;
}
al::optional<float> ConfigValueFloat(const char *devName, const char *blockName, const char *keyName)
{
if(const char *val{GetConfigValue(devName, blockName, keyName)})
- return al::make_optional(std::strtof(val, nullptr));
+ return std::strtof(val, nullptr);
return al::nullopt;
}
al::optional<bool> ConfigValueBool(const char *devName, const char *blockName, const char *keyName)
{
if(const char *val{GetConfigValue(devName, blockName, keyName)})
- return al::make_optional(al::strcasecmp(val, "on") == 0 || al::strcasecmp(val, "yes") == 0
- || al::strcasecmp(val, "true")==0 || atoi(val) != 0);
+ return al::strcasecmp(val, "on") == 0 || al::strcasecmp(val, "yes") == 0
+ || al::strcasecmp(val, "true")==0 || atoi(val) != 0;
return al::nullopt;
}
diff --git a/alc/backends/pulseaudio.cpp b/alc/backends/pulseaudio.cpp
index 5eef8f87..f79e49b0 100644
--- a/alc/backends/pulseaudio.cpp
+++ b/alc/backends/pulseaudio.cpp
@@ -836,7 +836,8 @@ void PulsePlayback::open(const char *name)
pa_stream_set_moved_callback(mStream, &PulsePlayback::streamMovedCallbackC, this);
mFrameSize = static_cast<uint>(pa_frame_size(pa_stream_get_sample_spec(mStream)));
- mDeviceName = pulse_name ? al::make_optional<std::string>(pulse_name) : al::nullopt;
+ if(pulse_name) mDeviceName.emplace(pulse_name);
+ else mDeviceName.reset();
if(!dev_name)
{
pa_operation *op{pa_context_get_sink_info_by_name(mContext,
@@ -1251,7 +1252,8 @@ void PulseCapture::open(const char *name)
pa_stream_set_moved_callback(mStream, &PulseCapture::streamMovedCallbackC, this);
pa_stream_set_state_callback(mStream, &PulseCapture::streamStateCallbackC, this);
- mDeviceName = pulse_name ? al::make_optional<std::string>(pulse_name) : al::nullopt;
+ if(pulse_name) mDeviceName.emplace(pulse_name);
+ else mDeviceName.reset();
if(mDevice->DeviceName.empty())
{
pa_operation *op{pa_context_get_source_info_by_name(mContext,