Bladeren bron

codestyle

Laserlicht 1 jaar geleden
bovenliggende
commit
e3acb92863
1 gewijzigde bestanden met toevoegingen van 6 en 5 verwijderingen
  1. 6 5
      client/CMusicHandler.cpp

+ 6 - 5
client/CMusicHandler.cpp

@@ -183,7 +183,8 @@ void CSoundHandler::ambientStopSound(const AudioPath & soundId)
 	setChannelVolume(ambientChannels[soundId], volume);
 }
 
-double CSoundHandler::getSoundDuration(const AudioPath & sound) {
+double CSoundHandler::getSoundDuration(const AudioPath & sound)
+{
 	if (!initialized || sound.empty())
 		return 0.0;
 
@@ -194,16 +195,16 @@ double CSoundHandler::getSoundDuration(const AudioPath & sound) {
 	uint8_t *audioBuf;
 	double seconds = 0.0;
 
-	if(SDL_LoadWAV_RW(SDL_RWFromMem(data.first.get(), (int)data.second), 1, &spec, &audioBuf, &audioLen) != NULL) {
+	if(SDL_LoadWAV_RW(SDL_RWFromMem(data.first.get(), (int)data.second), 1, &spec, &audioBuf, &audioLen) != nullptr)
+	{
 		SDL_FreeWAV(audioBuf);
 		uint32_t sampleSize = SDL_AUDIO_BITSIZE(spec.format) / 8;
 		uint32_t sampleCount = audioLen / sampleSize;
 		uint32_t sampleLen = 0;
-		if(spec.channels) {
+		if(spec.channels)
 			sampleLen = sampleCount / spec.channels;
-		} else {
+		else
 			sampleLen = sampleCount;
-		}
 		seconds = (double)sampleLen / (double)spec.freq;
 	}