fix: Added Normalizer as filter, fixed bug with bassboost filter enabling normalizing filter not working properly

This commit is contained in:
Marius Begby committed 2023-07-24 13:21:28 +02:00
1 parent b236371abc
commit 21b15a10a0
2 files changed
+18 -8

No files matched your search

+12 -8
View File
@@ -132,14 +132,18 @@ module.exports = {
}); });
} }
let filtersToEnable = confirmation.values; let filtersEnabledByUser = [...confirmation.values];
// if bassboost is enabled, also enable normalizer to avoid distrorion
if (confirmation.values.includes('bassboost_low') || confirmation.values.includes('bassboost')) { // if bassboost is enabled and not normalizer, also enable normalizer to avoid distrorion
filtersToEnable.push('normalizer'); if (
(confirmation.values.includes('bassboost_low') || confirmation.values.includes('bassboost')) &&
!confirmation.values.includes('normalizer')
) {
confirmation.values.push('normalizer');
} }
// Enable provided filters // Enable provided filters
queue.filters.ffmpeg.toggle(filtersToEnable); queue.filters.ffmpeg.toggle(confirmation.values);
logger.debug( logger.debug(
`[Shard ${interaction.guild.shardId}] Enabled filters ${confirmation.values.join(', ')} for command ${ `[Shard ${interaction.guild.shardId}] Enabled filters ${confirmation.values.join(', ')} for command ${
@@ -157,12 +161,12 @@ module.exports = {
.setDescription( .setDescription(
`**${ `**${
embedOptions.icons.success embedOptions.icons.success
} Filters toggled**\nNow using these filters:\n${confirmation.values } Filters toggled**\nNow using these filters:\n${filtersEnabledByUser
.map( .map(
(enabled) => (enabledFilter) =>
`\`${ `\`${
ffmpegFilterOptions.availableFilters.find( ffmpegFilterOptions.availableFilters.find(
(filter) => enabled == filter.value (filter) => enabledFilter == filter.value
).label ).label
}\`` }\``
) )
+6
View File
@@ -175,6 +175,12 @@ module.exports.ffmpegFilterOptions = {
value: 'treble', value: 'treble',
description: 'Increase the high frequencies.', description: 'Increase the high frequencies.',
emoji: '🎼' emoji: '🎼'
},
{
label: 'Normalizer',
value: 'normalizer',
description: 'Normalize the audio (avoid distortion).',
emoji: '🎶'
} }
] ]
}; };