summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/music/dmusic.cpp3
-rw-r--r--src/music/extmidi.cpp7
-rw-r--r--src/music/os2_m.cpp3
-rw-r--r--src/music/qtmidi.cpp21
4 files changed, 23 insertions, 11 deletions
diff --git a/src/music/dmusic.cpp b/src/music/dmusic.cpp
index 0c2291a33..7d9f3d100 100644
--- a/src/music/dmusic.cpp
+++ b/src/music/dmusic.cpp
@@ -56,8 +56,9 @@ const char *MusicDriver_DMusic::Start(const char * const *parm)
if (performance != NULL) return NULL;
if (proc.CoCreateInstance == NULL) {
- if (!LoadLibraryList((Function*)&proc, ole_files))
+ if (!LoadLibraryList((Function*)&proc, ole_files)) {
return "ole32.dll load failed";
+ }
}
/* Initialize COM */
diff --git a/src/music/extmidi.cpp b/src/music/extmidi.cpp
index c3af20140..0bcb1cdd7 100644
--- a/src/music/extmidi.cpp
+++ b/src/music/extmidi.cpp
@@ -52,8 +52,9 @@ void MusicDriver_ExtMidi::StopSong()
bool MusicDriver_ExtMidi::IsSongPlaying()
{
- if (this->pid != -1 && waitpid(this->pid, NULL, WNOHANG) == this->pid)
+ if (this->pid != -1 && waitpid(this->pid, NULL, WNOHANG) == this->pid) {
this->pid = -1;
+ }
if (this->pid == -1 && this->song[0] != '\0') this->DoPlay();
return this->pid != -1;
}
@@ -68,10 +69,8 @@ void MusicDriver_ExtMidi::DoPlay()
this->pid = fork();
switch (this->pid) {
case 0: {
- int d;
-
close(0);
- d = open("/dev/null", O_RDONLY);
+ int d = open("/dev/null", O_RDONLY);
if (d != -1 && dup2(d, 1) != -1 && dup2(d, 2) != -1) {
#if defined(MIDI_ARG)
execlp(this->command, "extmidi", MIDI_ARG, this->song, (char*)0);
diff --git a/src/music/os2_m.cpp b/src/music/os2_m.cpp
index d4ceb23e8..6abee6172 100644
--- a/src/music/os2_m.cpp
+++ b/src/music/os2_m.cpp
@@ -38,8 +38,9 @@ void MusicDriver_OS2::PlaySong(const char *filename)
{
MidiSendCommand("close all");
- if (MidiSendCommand("open %s type sequencer alias song", filename) != 0)
+ if (MidiSendCommand("open %s type sequencer alias song", filename) != 0) {
return;
+ }
MidiSendCommand("play song from 0");
}
diff --git a/src/music/qtmidi.cpp b/src/music/qtmidi.cpp
index 074963992..bb4ef91d2 100644
--- a/src/music/qtmidi.cpp
+++ b/src/music/qtmidi.cpp
@@ -121,8 +121,9 @@ static bool LoadMovieForMIDIFile(const char *path, Movie *moov)
if (ret < 4) return false;
DEBUG(driver, 3, "qtmidi: header is '%.4s'", magic);
- if (magic[0] != 'M' || magic[1] != 'T' || magic[2] != 'h' || magic[3] != 'd')
+ if (magic[0] != 'M' || magic[1] != 'T' || magic[2] != 'h' || magic[3] != 'd') {
return false;
+ }
if (noErr != FSPathMakeRef((const UInt8 *) path, &fsref, NULL)) return false;
SetMIDITypeIfNeeded(&fsref);
@@ -218,13 +219,15 @@ bool MusicDriver_QtMidi::IsSongPlaying()
case QT_STATE_STOP:
/* Do nothing. */
break;
+
case QT_STATE_PLAY:
MoviesTask(_quicktime_movie, 0);
/* Check wether movie ended. */
if (IsMovieDone(_quicktime_movie) ||
(GetMovieTime(_quicktime_movie, NULL) >=
- GetMovieDuration(_quicktime_movie)))
+ GetMovieDuration(_quicktime_movie))) {
_quicktime_state = QT_STATE_STOP;
+ }
}
return _quicktime_state == QT_STATE_PLAY;
@@ -247,8 +250,11 @@ void MusicDriver_QtMidi::Stop()
DEBUG(driver, 3, "qtmidi: stopping not needed, already idle");
/* Do nothing. */
break;
+
case QT_STATE_PLAY:
StopSong();
+ /* Fall-through */
+
case QT_STATE_STOP:
DisposeMovie(_quicktime_movie);
}
@@ -272,12 +278,14 @@ void MusicDriver_QtMidi::PlaySong(const char *filename)
case QT_STATE_PLAY:
StopSong();
DEBUG(driver, 3, "qtmidi: previous tune stopped");
- /* XXX Fall-through -- no break needed. */
+ /* Fall-through -- no break needed. */
+
case QT_STATE_STOP:
DisposeMovie(_quicktime_movie);
DEBUG(driver, 3, "qtmidi: previous tune disposed");
_quicktime_state = QT_STATE_IDLE;
- /* XXX Fall-through -- no break needed. */
+ /* Fall-through -- no break needed. */
+
case QT_STATE_IDLE:
LoadMovieForMIDIFile(filename, &_quicktime_movie);
SetMovieVolume(_quicktime_movie, VOLUME);
@@ -297,11 +305,13 @@ void MusicDriver_QtMidi::StopSong()
switch (_quicktime_state) {
case QT_STATE_IDLE:
- /* XXX Fall-through -- no break needed. */
+ /* Fall-through -- no break needed. */
+
case QT_STATE_STOP:
DEBUG(driver, 3, "qtmidi: stop requested, but already idle");
/* Do nothing. */
break;
+
case QT_STATE_PLAY:
StopMovie(_quicktime_movie);
_quicktime_state = QT_STATE_STOP;
@@ -330,6 +340,7 @@ void MusicDriver_QtMidi::SetVolume(byte vol)
case QT_STATE_IDLE:
/* Do nothing. */
break;
+
case QT_STATE_PLAY:
case QT_STATE_STOP:
SetMovieVolume(_quicktime_movie, VOLUME);