Skip to content

Commit

Permalink
MacOS music trial
Browse files Browse the repository at this point in the history
  • Loading branch information
FLAK-ZOSO committed Aug 5, 2024
1 parent 9e2e59d commit 5cacfdd
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
Binary file modified dodas
Binary file not shown.
19 changes: 17 additions & 2 deletions dodas.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -169,10 +169,25 @@ int main(int argc, char** argv) {
int n, genre;
#ifdef __APPLE__
while (!end) {
n = rand() % tracks + 1;
genre = genresDistribution(rng);
n = (rand() % genresSize[genre]) + 1;
std::string track;
switch (genre) {
case 1:
track = "MH" + std::to_string(n);
break;
case 2:
track = "ML" + std::to_string(n);
break;
case 3:
track = "P" + std::to_string(n);
break;
default:
break;
}
try {
char buf[1024];
snprintf(buf, 1024, "afplay \"audio/B%d.mp3\"", n);
snprintf(buf, 1024, "afplay \"audio/%s.mp3\"", track);
system(buf);
} catch (std::exception& e) {
return; // If the music can't be played, the thread ends
Expand Down

0 comments on commit 5cacfdd

Please sign in to comment.