In-game audio playback shows quality loss compared to the source file. It occurs mainly in the 5-15K frequencies. I’ve tried switching resampling as well as using different formats of audio files (MP3 and WAV), but the problem persists.
std::string path = getFullPathFileName(filename.c_str());
CC_LOG_DEBUG("playMusic: start createStream");
FMOD_MODE mode = isloop ? FMOD_LOOP_NORMAL : FMOD_DEFAULT;
FMOD_RESULT result = system->createStream(path.c_str(), mode, 0, &_music);
if (result != FMOD_OK) {
_music = nullptr;
if (_music_channel != nullptr) {
_music_channel->stop();
_music_channel = nullptr;
}
CC_LOG_DEBUG("playMusic: FMOD error! createStream (%d)", result);
return;
}
CC_LOG_DEBUG("playMusic: end createStream");
result = system->playSound(_music, _musicGroup, false, &_music_channel);
if (result != FMOD_OK) {
if (_music != nullptr) {
_music->release();
_music = nullptr;
}
_music_channel = nullptr;
CC_LOG_DEBUG("playMusic: FMOD error! playSound(%d)", result);
return;
}
if (_music_channel != nullptr) {
_music_channel->setVolume(_music_volume);
CC_LOG_WARNING("playMusic: setVolume = %f", _music_volume);
_music_channel->setPriority(0);
_music_channel->addDSP(0, _music_dsp);
setMusicEffect(_music_channel);
}