aboutsummaryrefslogtreecommitdiffstats
path: root/alc/backends/oboe.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'alc/backends/oboe.cpp')
-rw-r--r--alc/backends/oboe.cpp24
1 files changed, 12 insertions, 12 deletions
diff --git a/alc/backends/oboe.cpp b/alc/backends/oboe.cpp
index cc44b867..b7bab19a 100644
--- a/alc/backends/oboe.cpp
+++ b/alc/backends/oboe.cpp
@@ -30,7 +30,7 @@ struct OboePlayback final : public BackendBase, public oboe::AudioStreamCallback
void onErrorAfterClose(oboe::AudioStream* /* audioStream */, oboe::Result /* error */) override;
- void open(const char *name) override;
+ void open(std::string_view name) override;
bool reset() override;
void start() override;
void stop() override;
@@ -56,13 +56,13 @@ void OboePlayback::onErrorAfterClose(oboe::AudioStream* audioStream, oboe::Resul
TRACE("Error was %s", oboe::convertToText(error));
}
-void OboePlayback::open(const char *name)
+void OboePlayback::open(std::string_view name)
{
- if(!name)
+ if(name.empty())
name = device_name;
- else if(std::strcmp(name, device_name) != 0)
- throw al::backend_exception{al::backend_error::NoDevice, "Device name \"%s\" not found",
- name};
+ else if(name != device_name)
+ throw al::backend_exception{al::backend_error::NoDevice, "Device name \"%.*s\" not found",
+ static_cast<int>(name.length()), name.data()};
/* Open a basic output stream, just to ensure it can work. */
oboe::ManagedStream stream;
@@ -220,7 +220,7 @@ struct OboeCapture final : public BackendBase, public oboe::AudioStreamCallback
oboe::DataCallbackResult onAudioReady(oboe::AudioStream *oboeStream, void *audioData,
int32_t numFrames) override;
- void open(const char *name) override;
+ void open(std::string_view name) override;
void start() override;
void stop() override;
void captureSamples(std::byte *buffer, uint samples) override;
@@ -235,13 +235,13 @@ oboe::DataCallbackResult OboeCapture::onAudioReady(oboe::AudioStream*, void *aud
}
-void OboeCapture::open(const char *name)
+void OboeCapture::open(std::string_view name)
{
- if(!name)
+ if(name.empty())
name = device_name;
- else if(std::strcmp(name, device_name) != 0)
- throw al::backend_exception{al::backend_error::NoDevice, "Device name \"%s\" not found",
- name};
+ else if(name != device_name)
+ throw al::backend_exception{al::backend_error::NoDevice, "Device name \"%.*s\" not found",
+ static_cast<int>(name.length()), name.data()};
oboe::AudioStreamBuilder builder;
builder.setDirection(oboe::Direction::Input)