diff options
author | Chris Robinson <[email protected]> | 2018-11-15 06:23:01 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2018-11-15 06:23:01 -0800 |
commit | 7b3a2085aac8eac47f9968f331d3991167793e85 (patch) | |
tree | 5566b15f7a90fe8e0fb2b280c4f8b83c80247f4f /Alc/backends/pulseaudio.cpp | |
parent | ab9f8162b84870161948ddd27d29483206dd4e57 (diff) |
Use a regular char* for the device's name
Diffstat (limited to 'Alc/backends/pulseaudio.cpp')
-rw-r--r-- | Alc/backends/pulseaudio.cpp | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/Alc/backends/pulseaudio.cpp b/Alc/backends/pulseaudio.cpp index 77719e3c..4569b91a 100644 --- a/Alc/backends/pulseaudio.cpp +++ b/Alc/backends/pulseaudio.cpp @@ -800,7 +800,8 @@ static void PulsePlayback_sinkNameCallback(pa_context *UNUSED(context), const pa } ALCdevice *device{STATIC_CAST(ALCbackend,self)->mDevice}; - alstr_copy_cstr(&device->DeviceName, info->description); + al_free(device->DeviceName); + device->DeviceName = alstrdup(info->description); } @@ -980,7 +981,8 @@ static ALCenum PulsePlayback_open(PulsePlayback *self, const ALCchar *name) else { ALCdevice *device{STATIC_CAST(ALCbackend,self)->mDevice}; - alstr_copy_cstr(&device->DeviceName, dev_name); + al_free(device->DeviceName); + device->DeviceName = alstrdup(dev_name); } return ALC_NO_ERROR; @@ -1011,7 +1013,7 @@ static ALCboolean PulsePlayback_reset(PulsePlayback *self) PA_STREAM_INTERPOLATE_TIMING | PA_STREAM_AUTO_TIMING_UPDATE}; if(!GetConfigValueBool(nullptr, "pulse", "allow-moves", 0)) flags |= PA_STREAM_DONT_MOVE; - if(GetConfigValueBool(alstr_get_cstr(device->DeviceName), "pulse", "fix-rate", 0) || + if(GetConfigValueBool(device->DeviceName, "pulse", "fix-rate", 0) || !(device->Flags&DEVICE_FREQUENCY_REQUEST)) flags |= PA_STREAM_FIX_RATE; @@ -1418,7 +1420,8 @@ static void PulseCapture_sourceNameCallback(pa_context *UNUSED(context), const p } ALCdevice *device{STATIC_CAST(ALCbackend,self)->mDevice}; - alstr_copy_cstr(&device->DeviceName, info->description); + al_free(device->DeviceName); + device->DeviceName = alstrdup(info->description); } @@ -1490,7 +1493,8 @@ static ALCenum PulseCapture_open(PulseCapture *self, const ALCchar *name) if(iter == CaptureDevices.cend()) return ALC_INVALID_VALUE; pulse_name = iter->device_name.c_str(); - alstr_copy_cstr(&device->DeviceName, iter->name.c_str()); + al_free(device->DeviceName); + device->DeviceName = alstrdup(iter->name.c_str()); } std::tie(self->loop, self->context) = pulse_open(PulseCapture_contextStateCallback, self); @@ -1593,7 +1597,7 @@ static ALCenum PulseCapture_open(PulseCapture *self, const ALCchar *name) pa_stream_set_state_callback(self->stream, PulseCapture_streamStateCallback, self); self->device_name = pa_stream_get_device_name(self->stream); - if(alstr_empty(device->DeviceName)) + if(!device->DeviceName || device->DeviceName[0] == 0) { pa_operation *op{pa_context_get_source_info_by_name(self->context, self->device_name.c_str(), PulseCapture_sourceNameCallback, self |