Raised This Month: $51 Target: $400
 12% 

mp3 and wav format


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Sh0pke
Junior Member
Join Date: Oct 2017
Location: Republic of Serbia
Old 10-21-2022 , 21:57   mp3 and wav format
Reply With Quote #1

I have a problem that is harder to explain.

I'm using infection countdown remix plugin and I tried to make countdown sounds to work for both formats (.wav and .mp3).
Check if format is .mp3, if yes play it, if it's not, it is .wav and play it.

It seems to work except every other .wav sound is much louder then the other .wav sounds.

It goes like this:
When every .mp3 sound plays, audio volume is normal, if .wav sound plays, for example ten.wav it's much louder then the sound eleven.wav, and eleven.wav has a normal audio volume just like .mp3 has, then after that eight.wav is much louder, just like ten.wav, then again, seven.wav is OK and six.wav is very loud etc...

I have no idea why is that happening.

I highlighted everything that I have changed from the original plugin and I removed some comments to make the plugin smaller and put it here.

Any solution?

Code:
#include <amxmodx> #include <csx> #include <amxmisc> #include <zombieplague> #define PLUGIN "[ZP] Infection Countdown Remix" #define VERSION "1.3" #define AUTHOR "Dels" new countdown_timer, cvar_countdown_sound; new g_msgsync; const TASK_ID = 1603; public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR);        register_event("HLTV", "event_round_start", "a", "1=0", "2=0");     register_dictionary("zp_countdown_remix.txt");         //needed for smooth countdown display     g_msgsync = CreateHudSyncObj();         //cvars     cvar_countdown_sound = register_cvar("countdown_sound", "1"); //1 to enable, 0 to disable }   public plugin_precache() {     precache_sound("fvox/biohazard_detected.wav");     precache_sound("fvox/one.wav");     precache_sound("fvox/two.wav");     precache_sound("fvox/three.wav");     precache_sound("fvox/four.wav");     precache_sound("fvox/five.wav");     precache_sound("fvox/six.wav");     precache_sound("fvox/seven.wav");     precache_sound("fvox/eight.wav");     precache_sound("fvox/nine.wav");     precache_sound("fvox/ten.wav");
    precache_sound("fvox/beafq7.mp3");
    precache_sound("fvox/beafq12.mp3");
    precache_sound("fvox/thirteen.wav");     precache_sound("fvox/fourteen.wav");     precache_sound("fvox/fifteen.wav"); } public event_round_start() {     //bugfix     remove_task(TASK_ID);         countdown_timer = get_cvar_num("zp_delay") - 1;     set_task(4.0, "countdown", TASK_ID); } public countdown() {        new speak[16][] = {     "fvox/biohazard_detected.wav",     "fvox/one.wav",     "fvox/two.wav",     "fvox/three.wav",     "fvox/four.wav",     "fvox/five.wav",     "fvox/six.wav",     "fvox/seven.wav",     "fvox/eight.wav",     "fvox/nine.wav",     "fvox/ten.wav",
    "fvox/beafq7.mp3",
    "fvox/beafq12.mp3",
    "fvox/thirteen.wav",     "fvox/fourteen.wav",     "fvox/fifteen.wav"     }     if (countdown_timer > 1)     {         if (cvar_countdown_sound != 0)         {
            for(new i = 0; i < sizeof speak; i++)
            if (equal(speak[i][strlen(speak[i])-4], ".mp3"))
                client_cmd(0, "mp3 play ^"sound/%s^"", speak[countdown_timer-1])
            else
                client_cmd(0, "spk %s", speak[countdown_timer-1]);         }         set_hudmessage(179, 0, 0, -1.0, 0.28, 2, 0.02, 1.0, 0.01, 0.1, 10);          if (countdown_timer != 1)             ShowSyncHudMsg(0, g_msgsync, "%L", LANG_PLAYER, "COUNTDOWN_MSG", countdown_timer-1); //the new way     }     --countdown_timer;             if(countdown_timer >= 1)         set_task(1.0, "countdown", TASK_ID);     else         remove_task(TASK_ID); }

Last edited by Sh0pke; 10-22-2022 at 10:51.
Sh0pke is offline
Send a message via ICQ to Sh0pke Send a message via AIM to Sh0pke Send a message via Yahoo to Sh0pke Send a message via Skype™ to Sh0pke
Napoleon_be
Veteran Member
Join Date: Jul 2011
Location: Belgium
Old 10-21-2022 , 23:42   Re: mp3 and wav format
Reply With Quote #2

try using emit_sound.

https://forums.alliedmods.net/showthread.php?t=288004

The code could be optimized though.
__________________

Last edited by Napoleon_be; 10-21-2022 at 23:48.
Napoleon_be is offline
Send a message via Skype™ to Napoleon_be
zXCaptainXz
Member
Join Date: May 2017
Old 10-22-2022 , 01:25   Re: mp3 and wav format
Reply With Quote #3

Set mp3volume and volume cvars to 1 maybe? It could be an issue with your CS. I don't know why you're mixing both wav and mp3, just use one or the other.
zXCaptainXz is offline
Sh0pke
Junior Member
Join Date: Oct 2017
Location: Republic of Serbia
Old 10-22-2022 , 07:21   Re: mp3 and wav format
Reply With Quote #4

@Napoleon_be
I'll check it out but the original author did use that first and then he changed it to client_cmd in the next version of the plugin. I can't have both, I must use
Code:
emit_sound
or
Code:
client_cmd
yes?

@zXCaptainXz

If you're thinking about the regular audio volume options in my CS, I tried changing them and it does change but still one sound is much louder them the other.

I'm using .MP3 and .wav to try if it works but if I put all sounds to be .wav the problem still exist for .wav files with that MP3 function in the code
__________________
INFECTION
COUNTDOWN MANAGER

The best countdown plugin for every zombie mod!
DOWNLOAD
Sh0pke is offline
Send a message via ICQ to Sh0pke Send a message via AIM to Sh0pke Send a message via Yahoo to Sh0pke Send a message via Skype™ to Sh0pke
Sh0pke
Junior Member
Join Date: Oct 2017
Location: Republic of Serbia
Old 10-22-2022 , 10:48   Re: mp3 and wav format
Reply With Quote #5

I tried with emit_sound

Code:
emit_sound(0, CHAN_AUTO, countdown_sounds[g_countdown_timer-1], 1.0, ATTN_NORM, 0, PITCH_NORM);

instead of client_cmd and I tried to precache .mp3 using
Code:
engfunc(EngFunc_PrecacheGeneric, "fvox/beafq7.mp3")
or
Code:
precache_generic("fvox/beafq7.mp3")

and I get Missing RIFF/WAVE chunk error log.
Sh0pke is offline
Send a message via ICQ to Sh0pke Send a message via AIM to Sh0pke Send a message via Yahoo to Sh0pke Send a message via Skype™ to Sh0pke
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 15:27.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode