Skip to content

Commit

Permalink
fixed audio not playing
Browse files Browse the repository at this point in the history
  • Loading branch information
SAANN3 committed Jan 23, 2024
1 parent c4bd171 commit bfe8940
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
9 changes: 3 additions & 6 deletions src/audioThread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,16 +106,13 @@ void AudioThread::run(const dpp::slashcommand_t& event)
std::vector<uint8_t> pcmdata = prepareAudio(name);
int pos = 0;
int chunkLength = 3686400;

dpp::discord_voice_client* vc = event.from->get_voice(event.command.guild_id)->voiceclient;
//send silence to enter loop
bot.on_voice_ready([this](const dpp::voice_ready_t& event) {
readyToSend = 1;
});
while (!readyToSend) {
while (!vc->is_ready()) {
std::this_thread::sleep_for(std::chrono::milliseconds(250));

}
dpp::discord_voice_client* vc = event.from->get_voice(event.command.guild_id)->voiceclient;

vc->send_silence(60);
int fullPlayed = 0;
while(vc->is_playing()){
Expand Down
1 change: 0 additions & 1 deletion src/audioThread.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ class AudioThread
void downloadSong(VideoData video);

std::vector<VideoData> searchResults;
int readyToSend = 0;
bool skip = 0;
bool leave = 0;
std::vector<VideoData> queue;
Expand Down

0 comments on commit bfe8940

Please sign in to comment.