Re: [PATCH v8 3/6] coreaudio: Improve naming
On Wed, 4 Mar 2026, Christian Schoenebeck wrote:
On Wednesday, 4 March 2026 07:16:56 CET Akihiko Odaki wrote:
coreaudio had names that are not conforming to QEMU codding style.
coding
coreaudioVoiceOut also had some members that are prefixed with redundant
words like "output" or "audio".
Global names included "out" to tell they are specific to output devices,
but this rule was not completely enforced.
The frame size had three different names "frameSize", "bufferFrameSize",
and "frameCount".
Replace identifiers to fix these problems.
Signed-off-by: Akihiko Odaki
Reviewed-by: Philippe Mathieu-Daudé
---
audio/coreaudio.m | 188
+++--- 1 file changed, 95
insertions(+), 93 deletions(-)
diff --git a/audio/coreaudio.m b/audio/coreaudio.m
index bc9ab7477b68..736227eb2b7a 100644
--- a/audio/coreaudio.m
+++ b/audio/coreaudio.m
@@ -43,34 +43,34 @@
typedef struct coreaudioVoiceOut {
Leaving this lower case?
I think you can just drop it if you never refer to the type with struct
only as the CoreaudioVoiceOut typedef.
Regards,
BALATON Zoltan
Re: [PATCH v8 3/6] coreaudio: Improve naming
On Wednesday, 4 March 2026 11:42:41 CET Akihiko Odaki wrote: > On 2026/03/04 18:25, Christian Schoenebeck wrote: > > On Wednesday, 4 March 2026 07:16:56 CET Akihiko Odaki wrote: > >> coreaudio had names that are not conforming to QEMU codding style. > > > > coding > > > >> coreaudioVoiceOut also had some members that are prefixed with redundant > >> words like "output" or "audio". > >> Global names included "out" to tell they are specific to output devices, > >> but this rule was not completely enforced. > >> The frame size had three different names "frameSize", "bufferFrameSize", > >> and "frameCount". > >> > >> Replace identifiers to fix these problems. > >> > >> Signed-off-by: Akihiko Odaki > >> Reviewed-by: Philippe Mathieu-Daudé [...] > >> @@ -349,16 +351,16 @@ static OSStatus audioDeviceIOProc( > >> > >> out += write_len; > >> > >> } > >> > >> -coreaudio_buf_unlock(core, "audioDeviceIOProc"); > >> +coreaudio_voice_out_buf_unlock(core, "out_device_ioproc"); > > > > Behaviour change. Not pure refactoring. Should be split into a separate > > patch. > Two things are renamed here. > - coreaudio_buf_unlock() is renamed to coreaudio_voice_out_buf_unlock(). > - "audioDeviceIOProc" is the name of this function. This function is >renamed to "out_device_ioproc". Ah, these strings just end up being used in a log message. My bad, fine then! /Christian
Re: [PATCH v8 3/6] coreaudio: Improve naming
On 2026/03/04 18:25, Christian Schoenebeck wrote:
On Wednesday, 4 March 2026 07:16:56 CET Akihiko Odaki wrote:
coreaudio had names that are not conforming to QEMU codding style.
coding
coreaudioVoiceOut also had some members that are prefixed with redundant
words like "output" or "audio".
Global names included "out" to tell they are specific to output devices,
but this rule was not completely enforced.
The frame size had three different names "frameSize", "bufferFrameSize",
and "frameCount".
Replace identifiers to fix these problems.
Signed-off-by: Akihiko Odaki
Reviewed-by: Philippe Mathieu-Daudé
---
audio/coreaudio.m | 188
+++--- 1 file changed, 95
insertions(+), 93 deletions(-)
diff --git a/audio/coreaudio.m b/audio/coreaudio.m
index bc9ab7477b68..736227eb2b7a 100644
--- a/audio/coreaudio.m
+++ b/audio/coreaudio.m
@@ -43,34 +43,34 @@
typedef struct coreaudioVoiceOut {
Leaving this lower case?
HWVoiceOut hw;
pthread_mutex_t buf_mutex;
-AudioDeviceID outputDeviceID;
-int frameSizeSetting;
-uint32_t bufferCount;
-UInt32 audioDevicePropertyBufferFrameSize;
+AudioDeviceID device_id;
+int frame_size_setting;
+uint32_t buffer_count;
+UInt32 device_frame_size;
AudioDeviceIOProcID ioprocid;
bool enabled;
-} coreaudioVoiceOut;
+} CoreaudioVoiceOut;
-static const AudioObjectPropertyAddress voice_addr = {
+static const AudioObjectPropertyAddress voice_out_addr = {
kAudioHardwarePropertyDefaultOutputDevice,
kAudioObjectPropertyScopeGlobal,
kAudioObjectPropertyElementMain
};
-static OSStatus coreaudio_get_voice(AudioDeviceID *id)
+static OSStatus coreaudio_get_voice_out(AudioDeviceID *id)
{
UInt32 size = sizeof(*id);
return AudioObjectGetPropertyData(kAudioObjectSystemObject,
- &voice_addr,
+ &voice_out_addr,
0,
NULL,
&size,
id);
}
-static OSStatus coreaudio_get_framesizerange(AudioDeviceID id,
- AudioValueRange *framerange)
+static OSStatus coreaudio_get_out_framesizerange(AudioDeviceID id,
+ AudioValueRange
*framerange) {
UInt32 size = sizeof(*framerange);
AudioObjectPropertyAddress addr = {
@@ -87,7 +87,7 @@ static OSStatus coreaudio_get_framesizerange(AudioDeviceID
id, framerange);
}
So here it is "framerange" and not "frame_range".
-static OSStatus coreaudio_get_framesize(AudioDeviceID id, UInt32
*framesize) +static OSStatus coreaudio_get_out_framesize(AudioDeviceID id,
UInt32 *framesize) {
UInt32 size = sizeof(*framesize);
AudioObjectPropertyAddress addr = {
@@ -104,7 +104,7 @@ static OSStatus coreaudio_get_framesize(AudioDeviceID
id, UInt32 *framesize) framesize);
}
Here it is "framesize" and not "frame_size".
-static OSStatus coreaudio_set_framesize(AudioDeviceID id, UInt32
*framesize) +static OSStatus coreaudio_set_out_framesize(AudioDeviceID id,
UInt32 *framesize) {
UInt32 size = sizeof(*framesize);
AudioObjectPropertyAddress addr = {
@@ -121,8 +121,8 @@ static OSStatus coreaudio_set_framesize(AudioDeviceID
id, UInt32 *framesize) framesize);
}
-static OSStatus coreaudio_set_streamformat(AudioDeviceID id,
- AudioStreamBasicDescription *d)
+static OSStatus coreaudio_set_out_streamformat(AudioDeviceID id,
+ AudioStreamBasicDescription
*d) {
UInt32 size = sizeof(*d);
AudioObjectPropertyAddress addr = {
@@ -139,7 +139,7 @@ static OSStatus coreaudio_set_streamformat(AudioDeviceID
id, d);
}
-static OSStatus coreaudio_get_isrunning(AudioDeviceID id, UInt32 *result)
+static OSStatus coreaudio_get_out_isrunning(AudioDeviceID id, UInt32
*result) {
UInt32 size = sizeof(*result);
AudioObjectPropertyAddress addr = {
@@ -243,7 +243,8 @@ static void G_GNUC_PRINTF(3, 4)
coreaudio_logerr2(OSStatus status, #define
coreaudio_playback_logerr(status, ...) \
coreaudio_logerr2(status, "playback", __VA_ARGS__)
-static int coreaudio_buf_lock(coreaudioVoiceOut *core, const char *fn_name)
+static int coreaudio_voice_out_buf_lock(CoreaudioVoiceOut *core,
+const char *fn_name)
{
int err;
@@ -256,7 +257,8 @@ static int coreaudio_buf_lock(coreaudioVoiceOut *core,
const char *fn_name) return 0;
}
-static int coreaudio_buf_unlock(coreaudioVoiceOut *core, const char
*fn_name) +static int coreaudio_voice_out_buf_unlock(CoreaudioVoiceOut
*core, + const char *fn_name)
{
int err;
@@ -269,20 +271,20 @@ static int coreaudio_buf_unlock(coreaudioVoiceOut
*core, const char *fn_name) return 0;
}
-#
Re: [PATCH v8 3/6] coreaudio: Improve naming
On Wednesday, 4 March 2026 07:16:56 CET Akihiko Odaki wrote:
> coreaudio had names that are not conforming to QEMU codding style.
coding
> coreaudioVoiceOut also had some members that are prefixed with redundant
> words like "output" or "audio".
> Global names included "out" to tell they are specific to output devices,
> but this rule was not completely enforced.
> The frame size had three different names "frameSize", "bufferFrameSize",
> and "frameCount".
>
> Replace identifiers to fix these problems.
>
> Signed-off-by: Akihiko Odaki
> Reviewed-by: Philippe Mathieu-Daudé
> ---
> audio/coreaudio.m | 188
> +++--- 1 file changed, 95
> insertions(+), 93 deletions(-)
>
> diff --git a/audio/coreaudio.m b/audio/coreaudio.m
> index bc9ab7477b68..736227eb2b7a 100644
> --- a/audio/coreaudio.m
> +++ b/audio/coreaudio.m
> @@ -43,34 +43,34 @@
> typedef struct coreaudioVoiceOut {
Leaving this lower case?
> HWVoiceOut hw;
> pthread_mutex_t buf_mutex;
> -AudioDeviceID outputDeviceID;
> -int frameSizeSetting;
> -uint32_t bufferCount;
> -UInt32 audioDevicePropertyBufferFrameSize;
> +AudioDeviceID device_id;
> +int frame_size_setting;
> +uint32_t buffer_count;
> +UInt32 device_frame_size;
> AudioDeviceIOProcID ioprocid;
> bool enabled;
> -} coreaudioVoiceOut;
> +} CoreaudioVoiceOut;
>
> -static const AudioObjectPropertyAddress voice_addr = {
> +static const AudioObjectPropertyAddress voice_out_addr = {
> kAudioHardwarePropertyDefaultOutputDevice,
> kAudioObjectPropertyScopeGlobal,
> kAudioObjectPropertyElementMain
> };
>
> -static OSStatus coreaudio_get_voice(AudioDeviceID *id)
> +static OSStatus coreaudio_get_voice_out(AudioDeviceID *id)
> {
> UInt32 size = sizeof(*id);
>
> return AudioObjectGetPropertyData(kAudioObjectSystemObject,
> - &voice_addr,
> + &voice_out_addr,
>0,
>NULL,
>&size,
>id);
> }
>
> -static OSStatus coreaudio_get_framesizerange(AudioDeviceID id,
> - AudioValueRange *framerange)
> +static OSStatus coreaudio_get_out_framesizerange(AudioDeviceID id,
> + AudioValueRange
> *framerange) {
> UInt32 size = sizeof(*framerange);
> AudioObjectPropertyAddress addr = {
> @@ -87,7 +87,7 @@ static OSStatus coreaudio_get_framesizerange(AudioDeviceID
> id, framerange);
> }
So here it is "framerange" and not "frame_range".
> -static OSStatus coreaudio_get_framesize(AudioDeviceID id, UInt32
> *framesize) +static OSStatus coreaudio_get_out_framesize(AudioDeviceID id,
> UInt32 *framesize) {
> UInt32 size = sizeof(*framesize);
> AudioObjectPropertyAddress addr = {
> @@ -104,7 +104,7 @@ static OSStatus coreaudio_get_framesize(AudioDeviceID
> id, UInt32 *framesize) framesize);
> }
Here it is "framesize" and not "frame_size".
> -static OSStatus coreaudio_set_framesize(AudioDeviceID id, UInt32
> *framesize) +static OSStatus coreaudio_set_out_framesize(AudioDeviceID id,
> UInt32 *framesize) {
> UInt32 size = sizeof(*framesize);
> AudioObjectPropertyAddress addr = {
> @@ -121,8 +121,8 @@ static OSStatus coreaudio_set_framesize(AudioDeviceID
> id, UInt32 *framesize) framesize);
> }
>
> -static OSStatus coreaudio_set_streamformat(AudioDeviceID id,
> - AudioStreamBasicDescription *d)
> +static OSStatus coreaudio_set_out_streamformat(AudioDeviceID id,
> + AudioStreamBasicDescription
> *d) {
> UInt32 size = sizeof(*d);
> AudioObjectPropertyAddress addr = {
> @@ -139,7 +139,7 @@ static OSStatus coreaudio_set_streamformat(AudioDeviceID
> id, d);
> }
>
> -static OSStatus coreaudio_get_isrunning(AudioDeviceID id, UInt32 *result)
> +static OSStatus coreaudio_get_out_isrunning(AudioDeviceID id, UInt32
> *result) {
> UInt32 size = sizeof(*result);
> AudioObjectPropertyAddress addr = {
> @@ -243,7 +243,8 @@ static void G_GNUC_PRINTF(3, 4)
> coreaudio_logerr2(OSStatus status, #define
> coreaudio_playback_logerr(status, ...) \
> coreaudio_logerr2(status, "playback", __VA_ARGS__)
>
> -static int coreaudio_buf_lock(coreaudioVoiceOut *core, const char *fn_name)
> +static int coreaudio_voice_out_buf_lock(CoreaudioVoiceOut *core,
> +const char *fn_name)
> {
> int err;
>
> @@ -256,7 +257,8 @@ static int coreaudio_buf_lock(coreaudioVoiceOut *core,
> const char *fn_name) return 0;
> }
>
> -static int coreaudio_buf_unlock(coreaudioVoiceOut *core, const char
> *fn_name) +static int coreaudio_voice_out_buf_unlock(CoreaudioVoiceOut
> *core, + const char *fn_
Re: [PATCH v8 3/6] coreaudio: Improve naming
On Wed, Mar 4, 2026 at 7:17 AM Akihiko Odaki
wrote:
>
> coreaudio had names that are not conforming to QEMU codding style.
> coreaudioVoiceOut also had some members that are prefixed with redundant
> words like "output" or "audio".
> Global names included "out" to tell they are specific to output devices,
> but this rule was not completely enforced.
> The frame size had three different names "frameSize", "bufferFrameSize",
> and "frameCount".
>
> Replace identifiers to fix these problems.
>
> Signed-off-by: Akihiko Odaki
> Reviewed-by: Philippe Mathieu-Daudé
Reviewed-by: Marc-André Lureau
> ---
> audio/coreaudio.m | 188
> +++---
> 1 file changed, 95 insertions(+), 93 deletions(-)
>
> diff --git a/audio/coreaudio.m b/audio/coreaudio.m
> index bc9ab7477b68..736227eb2b7a 100644
> --- a/audio/coreaudio.m
> +++ b/audio/coreaudio.m
> @@ -43,34 +43,34 @@
> typedef struct coreaudioVoiceOut {
> HWVoiceOut hw;
> pthread_mutex_t buf_mutex;
> -AudioDeviceID outputDeviceID;
> -int frameSizeSetting;
> -uint32_t bufferCount;
> -UInt32 audioDevicePropertyBufferFrameSize;
> +AudioDeviceID device_id;
> +int frame_size_setting;
> +uint32_t buffer_count;
> +UInt32 device_frame_size;
> AudioDeviceIOProcID ioprocid;
> bool enabled;
> -} coreaudioVoiceOut;
> +} CoreaudioVoiceOut;
>
> -static const AudioObjectPropertyAddress voice_addr = {
> +static const AudioObjectPropertyAddress voice_out_addr = {
> kAudioHardwarePropertyDefaultOutputDevice,
> kAudioObjectPropertyScopeGlobal,
> kAudioObjectPropertyElementMain
> };
>
> -static OSStatus coreaudio_get_voice(AudioDeviceID *id)
> +static OSStatus coreaudio_get_voice_out(AudioDeviceID *id)
> {
> UInt32 size = sizeof(*id);
>
> return AudioObjectGetPropertyData(kAudioObjectSystemObject,
> - &voice_addr,
> + &voice_out_addr,
>0,
>NULL,
>&size,
>id);
> }
>
> -static OSStatus coreaudio_get_framesizerange(AudioDeviceID id,
> - AudioValueRange *framerange)
> +static OSStatus coreaudio_get_out_framesizerange(AudioDeviceID id,
> + AudioValueRange *framerange)
> {
> UInt32 size = sizeof(*framerange);
> AudioObjectPropertyAddress addr = {
> @@ -87,7 +87,7 @@ static OSStatus coreaudio_get_framesizerange(AudioDeviceID
> id,
>framerange);
> }
>
> -static OSStatus coreaudio_get_framesize(AudioDeviceID id, UInt32 *framesize)
> +static OSStatus coreaudio_get_out_framesize(AudioDeviceID id, UInt32
> *framesize)
> {
> UInt32 size = sizeof(*framesize);
> AudioObjectPropertyAddress addr = {
> @@ -104,7 +104,7 @@ static OSStatus coreaudio_get_framesize(AudioDeviceID id,
> UInt32 *framesize)
>framesize);
> }
>
> -static OSStatus coreaudio_set_framesize(AudioDeviceID id, UInt32 *framesize)
> +static OSStatus coreaudio_set_out_framesize(AudioDeviceID id, UInt32
> *framesize)
> {
> UInt32 size = sizeof(*framesize);
> AudioObjectPropertyAddress addr = {
> @@ -121,8 +121,8 @@ static OSStatus coreaudio_set_framesize(AudioDeviceID id,
> UInt32 *framesize)
>framesize);
> }
>
> -static OSStatus coreaudio_set_streamformat(AudioDeviceID id,
> - AudioStreamBasicDescription *d)
> +static OSStatus coreaudio_set_out_streamformat(AudioDeviceID id,
> + AudioStreamBasicDescription
> *d)
> {
> UInt32 size = sizeof(*d);
> AudioObjectPropertyAddress addr = {
> @@ -139,7 +139,7 @@ static OSStatus coreaudio_set_streamformat(AudioDeviceID
> id,
>d);
> }
>
> -static OSStatus coreaudio_get_isrunning(AudioDeviceID id, UInt32 *result)
> +static OSStatus coreaudio_get_out_isrunning(AudioDeviceID id, UInt32 *result)
> {
> UInt32 size = sizeof(*result);
> AudioObjectPropertyAddress addr = {
> @@ -243,7 +243,8 @@ static void G_GNUC_PRINTF(3, 4)
> coreaudio_logerr2(OSStatus status,
> #define coreaudio_playback_logerr(status, ...) \
> coreaudio_logerr2(status, "playback", __VA_ARGS__)
>
> -static int coreaudio_buf_lock(coreaudioVoiceOut *core, const char *fn_name)
> +static int coreaudio_voice_out_buf_lock(CoreaudioVoiceOut *core,
> +const char *fn_name)
> {
> int err;
>
> @@ -256,7 +257,8 @@ static int coreaudio_buf_lock(coreaudioVoiceOut *core,
> const char *fn_name)
> return 0;
> }
>
> -static int coreaudio_buf_unlock(coreaudioVoiceOut *core, const char *fn_name)
> +static int coreaudio_voice_out_buf_unlock(Coreau
