Originally Posted by Sergei Steshenko
What do you think is unsafe ?
Well, "safe" probably shouldn't be taken literally. The issue is more along the lines of reliability, performance, and compatibility.
The biggest problem I already see is that by using system(), the application will pause while the notification is playing, which is obviously not great. I will have to see if I can fork the aplay process off into the background. But that is likely going to cause the sound to double or even triple up if events occur fast enough.
I also have some concerns about how well it will work on different distributions. I know some distros like Ubuntu modify ALSA and remove components like alsaconf, so can I be sure that all of the possible systems I will be running on will have an aplay binary that:
1. Accepts the exact same arguments
2. Plays back the sound effect exactly the same
On the other hand, if I actually use ALSA to play audio as intended, it is going to complicate my software considerably and add another dependency. Even the minimal playback application linked by sunnydrake is rather large compared to my program.