Commit b39bc85e authored by Max Kellermann's avatar Max Kellermann

AudioFormat: add mask support to ToString()

parent 603ce87a
...@@ -53,12 +53,23 @@ ToString(const AudioFormat af) noexcept ...@@ -53,12 +53,23 @@ ToString(const AudioFormat af) noexcept
sample rate */ sample rate */
p += sprintf(p, "dsd%u:", af.sample_rate * 8 / 44100); p += sprintf(p, "dsd%u:", af.sample_rate * 8 / 44100);
} else { } else {
p += sprintf(p, "%u:%s:", const char *sample_format = af.format != SampleFormat::UNDEFINED
af.sample_rate, ? sample_format_to_string(af.format)
sample_format_to_string(af.format)); : "*";
if (af.sample_rate > 0)
p += sprintf(p, "%u:%s:", af.sample_rate,
sample_format);
else
p += sprintf(p, "*:%s:", sample_format);
} }
p += sprintf(p, "%u", af.channels); if (af.channels > 0)
p += sprintf(p, "%u", af.channels);
else {
*p++ = '*';
*p = 0;
}
return buffer; return buffer;
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment