Rename some variables

This commit is contained in:
Stephen F. Booth 2024-12-08 18:00:51 -06:00
parent 2e7fc60ab0
commit 03b6153244
No known key found for this signature in database
GPG Key ID: 900AAC885063A183
3 changed files with 22 additions and 22 deletions

View File

@ -281,7 +281,7 @@ void SHN::File::read(AudioProperties::ReadStyle propertiesStyle)
setValid(false);
return;
}
props.internal_file_type = static_cast<int>(internalFileType);
props.internalFileType = static_cast<int>(internalFileType);
// Read number of channels
uint32_t channelCount = 0;
@ -290,7 +290,7 @@ void SHN::File::read(AudioProperties::ReadStyle propertiesStyle)
setValid(false);
return;
}
props.channel_count = static_cast<int>(channelCount);
props.channelCount = static_cast<int>(channelCount);
// Read blocksize if version > 0
if(version > 0) {
@ -409,10 +409,10 @@ void SHN::File::read(AudioProperties::ReadStyle propertiesStyle)
auto channels = chunkData.toUShort(offset, false);
offset += 2;
if(props.channel_count != channels)
if(props.channelCount != channels)
debug("SHN::File::read() -- Channel count mismatch between Shorten and 'fmt ' chunk.");
props.sample_rate = static_cast<int>(chunkData.toUInt(offset, false));
props.sampleRate = static_cast<int>(chunkData.toUInt(offset, false));
offset += 4;
// Skip average bytes per second
@ -421,7 +421,7 @@ void SHN::File::read(AudioProperties::ReadStyle propertiesStyle)
blockAlign = chunkData.toUShort(offset, false);
offset += 2;
props.bits_per_sample = static_cast<int>(chunkData.toUShort(offset, false));
props.bitsPerSample = static_cast<int>(chunkData.toUShort(offset, false));
offset += 2;
sawFormatChunk = true;
@ -442,7 +442,7 @@ void SHN::File::read(AudioProperties::ReadStyle propertiesStyle)
}
if(dataChunkSize && blockAlign)
props.sample_frames = static_cast<unsigned long>(dataChunkSize / blockAlign);
props.sampleFrames = static_cast<unsigned long>(dataChunkSize / blockAlign);
}
// AIFF
else if(chunkID == 0x464f524d /*'FORM'*/) {
@ -481,13 +481,13 @@ void SHN::File::read(AudioProperties::ReadStyle propertiesStyle)
auto channels = chunkData.toUShort(offset, true);
offset += 2;
if(props.channel_count != channels)
if(props.channelCount != channels)
debug("SHN::File::read() -- Channel count mismatch between Shorten and 'COMM' chunk.");
props.sample_frames = static_cast<unsigned long>(chunkData.toUInt(offset, true));
props.sampleFrames = static_cast<unsigned long>(chunkData.toUInt(offset, true));
offset += 4;
props.bits_per_sample = static_cast<int>(chunkData.toUShort(offset, true));
props.bitsPerSample = static_cast<int>(chunkData.toUShort(offset, true));
offset += 2;
// sample rate is IEEE 754 80-bit extended float (16-bit exponent, 1-bit integer part, 63-bit fraction)
@ -502,9 +502,9 @@ void SHN::File::read(AudioProperties::ReadStyle propertiesStyle)
auto frac = chunkData.toULongLong(offset, true);
offset += 8;
if(exp >= 0)
props.sample_rate = static_cast<int>(frac << exp);
props.sampleRate = static_cast<int>(frac << exp);
else
props.sample_rate = static_cast<int>((frac + (static_cast<uint64_t>(1) << (-exp - 1))) >> -exp);
props.sampleRate = static_cast<int>((frac + (static_cast<uint64_t>(1) << (-exp - 1))) >> -exp);
sawCommonChunk = true;

View File

@ -42,9 +42,9 @@ public:
int version { 0 };
int internalFileType { 0 };
int channelCount { 0 };
unsigned long sampleFrames { 0 };
int sampleRate { 0 };
int bitsPerSample { 0 };
unsigned long sampleFrames { 0 };
// Computed
int bitrate { 0 };
@ -57,11 +57,11 @@ SHN::Properties::Properties(const PropertyValues *values, ReadStyle style) :
{
if(values) {
d->version = values->version;
d->internalFileType = values->internal_file_type;
d->channelCount = values->channel_count;
d->sampleRate = values->sample_rate;
d->bitsPerSample = values->bits_per_sample;
d->sampleFrames = values->sample_frames;
d->internalFileType = values->internalFileType;
d->channelCount = values->channelCount;
d->sampleRate = values->sampleRate;
d->bitsPerSample = values->bitsPerSample;
d->sampleFrames = values->sampleFrames;
d->bitrate = static_cast<int>(d->sampleRate * d->bitsPerSample * d->channelCount / 1000.0 + 0.5);
if(d->sampleRate > 0)

View File

@ -33,11 +33,11 @@ namespace TagLib {
struct PropertyValues
{
int version { 0 };
int internal_file_type { 0 };
int channel_count { 0 };
int sample_rate { 0 };
int bits_per_sample { 0 };
unsigned long sample_frames { 0 };
int internalFileType { 0 };
int channelCount { 0 };
int sampleRate { 0 };
int bitsPerSample { 0 };
unsigned long sampleFrames { 0 };
};
} // namespace SHN
} // namespace TagLib