|
|
|
@ -101,8 +101,10 @@ void MusicDriver_ExtMidi::StopSong()
|
|
|
|
|
|
|
|
|
|
bool MusicDriver_ExtMidi::IsSongPlaying()
|
|
|
|
|
{
|
|
|
|
|
if (this->pid != -1 && waitpid(this->pid, nullptr, WNOHANG) == this->pid) {
|
|
|
|
|
int status = 0;
|
|
|
|
|
if (this->pid != -1 && waitpid(this->pid, &status, WNOHANG) == this->pid) {
|
|
|
|
|
this->pid = -1;
|
|
|
|
|
if (WIFEXITED(status) && WEXITSTATUS(status) == 255) this->failed = true;
|
|
|
|
|
}
|
|
|
|
|
if (this->pid == -1 && this->song[0] != '\0') this->DoPlay();
|
|
|
|
|
return this->pid != -1;
|
|
|
|
@ -115,6 +117,7 @@ void MusicDriver_ExtMidi::SetVolume(byte vol)
|
|
|
|
|
|
|
|
|
|
void MusicDriver_ExtMidi::DoPlay()
|
|
|
|
|
{
|
|
|
|
|
this->failed = false;
|
|
|
|
|
this->pid = fork();
|
|
|
|
|
switch (this->pid) {
|
|
|
|
|
case 0: {
|
|
|
|
@ -123,7 +126,7 @@ void MusicDriver_ExtMidi::DoPlay()
|
|
|
|
|
if (d != -1 && dup2(d, 1) != -1 && dup2(d, 2) != -1) {
|
|
|
|
|
execvp(this->params[0], this->params);
|
|
|
|
|
}
|
|
|
|
|
_exit(1);
|
|
|
|
|
_exit(255);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
case -1:
|
|
|
|
|