| ... | ... |
@@ -73,9 +73,7 @@ void Player::Stop(bool bKillSound) |
| 73 | 73 |
{
|
| 74 | 74 |
std::uint8_t trackId = this->trackIds[i]; |
| 75 | 75 |
this->tracks[trackId].ClearState(); |
| 76 |
- for (int j = 0; j < 16; ++j) |
|
| 77 |
- {
|
|
| 78 |
- Channel &chn = this->channels[j]; |
|
| 76 |
+ for (auto &chn : this->channels) |
|
| 79 | 77 |
if (chn.state != ChannelState::None && chn.trackId == trackId) |
| 80 | 78 |
{
|
| 81 | 79 |
if (bKillSound) |
| ... | ... |
@@ -83,7 +81,6 @@ void Player::Stop(bool bKillSound) |
| 83 | 81 |
else |
| 84 | 82 |
chn.Release(); |
| 85 | 83 |
} |
| 86 |
- } |
|
| 87 | 84 |
} |
| 88 | 85 |
this->FreeTracks(); |
| 89 | 86 |
} |
| ... | ... |
@@ -159,10 +156,10 @@ void Player::Run() |
| 159 | 156 |
|
| 160 | 157 |
void Player::UpdateTracks() |
| 161 | 158 |
{
|
| 162 |
- for (int i = 0; i < 16; ++i) |
|
| 163 |
- this->channels[i].UpdateTrack(); |
|
| 164 |
- for (int i = 0; i < FSS_MAXTRACKS; ++i) |
|
| 165 |
- this->tracks[i].updateFlags.reset(); |
|
| 159 |
+ for (auto &chn : this->channels) |
|
| 160 |
+ chn.UpdateTrack(); |
|
| 161 |
+ for (auto &trk : this->tracks) |
|
| 162 |
+ trk.updateFlags.reset(); |
|
| 166 | 163 |
} |
| 167 | 164 |
|
| 168 | 165 |
// Original FSS Function: Snd_Timer |
| ... | ... |
@@ -170,8 +167,8 @@ void Player::Timer() |
| 170 | 167 |
{
|
| 171 | 168 |
this->UpdateTracks(); |
| 172 | 169 |
|
| 173 |
- for (int i = 0; i < 16; ++i) |
|
| 174 |
- this->channels[i].Update(); |
|
| 170 |
+ for (auto &chn : this->channels) |
|
| 171 |
+ chn.Update(); |
|
| 175 | 172 |
|
| 176 | 173 |
this->Run(); |
| 177 | 174 |
} |
| ... | ... |
@@ -262,12 +262,9 @@ int Track::NoteOnTie(std::uint8_t key, int vel) |
| 262 | 262 |
// Original FSS Function: Track_ReleaseAllNotes |
| 263 | 263 |
void Track::ReleaseAllNotes() |
| 264 | 264 |
{
|
| 265 |
- for (int i = 0; i < 16; ++i) |
|
| 266 |
- {
|
|
| 267 |
- Channel &chn = this->ply->channels[i]; |
|
| 265 |
+ for (auto &chn : this->ply->channels) |
|
| 268 | 266 |
if (chn.state > ChannelState::None && chn.trackId == this->trackId && chn.state != ChannelState::Release) |
| 269 | 267 |
chn.Release(); |
| 270 |
- } |
|
| 271 | 268 |
} |
| 272 | 269 |
|
| 273 | 270 |
enum class SSEQCommand |
| ... | ... |
@@ -51,8 +51,8 @@ struct PseudoFile |
| 51 | 51 |
|
| 52 | 52 |
template<typename T> typename std::enable_if_t<std::is_integral_v<T>> ReadLE(std::vector<T> &arr) |
| 53 | 53 |
{
|
| 54 |
- for (std::size_t i = 0, len = arr.size(); i < len; ++i) |
|
| 55 |
- arr[i] = this->ReadLE<T>(); |
|
| 54 |
+ for (auto &item : arr) |
|
| 55 |
+ item = this->ReadLE<T>(); |
|
| 56 | 56 |
} |
| 57 | 57 |
|
| 58 | 58 |
void ReadLE(std::vector<std::uint8_t> &arr) |
| ... | ... |
@@ -26,8 +26,8 @@ auto TagList::GetKeys() const -> const TagsList & |
| 26 | 26 |
auto TagList::GetTags() const -> TagsList |
| 27 | 27 |
{
|
| 28 | 28 |
TagsList allTags; |
| 29 |
- for (auto curr = this->tagsOrder.begin(), end = this->tagsOrder.end(); curr != end; ++curr) |
|
| 30 |
- allTags.push_back(*curr + "=" + this->tags.find(*curr)->second); |
|
| 29 |
+ for (auto &curr : this->tagsOrder) |
|
| 30 |
+ allTags.push_back(curr + "=" + this->tags.find(curr)->second); |
|
| 31 | 31 |
return allTags; |
| 32 | 32 |
} |
| 33 | 33 |
|
| ... | ... |
@@ -166,9 +166,8 @@ void XSFFile::ReadXSF(std::ifstream &xSF, std::uint32_t programSizeOffset, std:: |
| 166 | 166 |
xSF.read(&rawtags[0], lengthOfTags); |
| 167 | 167 |
std::string name, value; |
| 168 | 168 |
bool onName = true; |
| 169 |
- for (unsigned x = 0; x < lengthOfTags; ++x) |
|
| 169 |
+ for (auto curr : rawtags) |
|
| 170 | 170 |
{
|
| 171 |
- char curr = rawtags[x]; |
|
| 172 | 171 |
if (curr == 0x0A) |
| 173 | 172 |
{
|
| 174 | 173 |
if (!name.empty() && !value.empty()) |
| ... | ... |
@@ -449,7 +448,7 @@ void XSFFile::SaveFile() const |
| 449 | 448 |
if (!allTags.empty()) |
| 450 | 449 |
{
|
| 451 | 450 |
xSF.write("[TAG]", 5);
|
| 452 |
- std::for_each(allTags.begin(), allTags.end(), [&](const std::string &tag) |
|
| 451 |
+ for (const auto &tag : allTags) |
|
| 453 | 452 |
{
|
| 454 | 453 |
xSF.write(tag.c_str(), tag.length()); |
| 455 | 454 |
xSF.write("\n", 1);
|