Skip to content

Commit

Permalink
Init
Browse files Browse the repository at this point in the history
  • Loading branch information
garey committed Mar 13, 2023
1 parent 731456d commit 3725fef
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion voice_utils/voice_utils/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ void on_amxx_plugins_loaded()
ForwardExecType::Stop, ForwardParam::Cell, ForwardParam::Done);

g_onclient_sound_decompress = AmxxApi::register_forward("VU_OnDecompress",
ForwardExecType::Stop, ForwardParam::Cell, ForwardParam::Cell, ForwardParam::Cell, ForwardParam::Array, ForwardParam::Cell, ForwardParam::Done);
ForwardExecType::Stop, ForwardParam::Cell, ForwardParam::Cell, ForwardParam::Done);
}

void on_amxx_plugins_unloaded()
Expand Down
9 changes: 7 additions & 2 deletions voice_utils/voice_utils/src/natives.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,18 @@ size_t resample_buffer(void* srcBuff, size_t srcBufLen, void* dstBuff, size_t d
}
void OnSoundDecompress(size_t clientIndex, size_t receiverIndex, uint16_t sampleRate, uint8_t* samples, size_t* sample_size)
{
AmxxApi::execute_forward(g_onclient_sound_decompress, clientIndex + 1, receiverIndex, sampleRate, AmxxApi::prepare_char_array((char*)samples, *sample_size * 2), *sample_size * 2);
auto ret = AmxxApi::execute_forward(g_onclient_sound_decompress, clientIndex + 1, receiverIndex);
if (ret)
{
*sample_size = 0;
}

#define FRAME_SIZE 480
static DenoiseState* st[33] = {nullptr};
if(receiverIndex == size_t(-1))
receiverIndex = 0;

if (g_player_volume[clientIndex+1][receiverIndex])
if (g_player_volume.find(clientIndex+1) != g_player_volume.end())
{
size_t size = *sample_size;
int16_t* samples16 = (int16_t*)samples;
Expand Down

0 comments on commit 3725fef

Please sign in to comment.