Bläddra i källkod

Dont stop audio playback if invalid filename

Eric Helgeson 2 år sedan
förälder
incheckning
e8f7dc185d
1 ändrade filer med 9 tillägg och 11 borttagningar
  1. 9 11
      src/BlueSCSI_cdrom.cpp

+ 9 - 11
src/BlueSCSI_cdrom.cpp

@@ -1216,16 +1216,15 @@ bool cdromSwitchNextImage(image_config_t &img)
     int target_idx = img.scsiId & S2S_CFG_TARGET_ID_BITS;
     scsiDiskGetNextImageName(img, filename, sizeof(filename));
 
+    if (filename[0] != '\0')
+    {
 #ifdef ENABLE_AUDIO_OUTPUT
     // if in progress for this device, terminate audio playback immediately (Annex C)
     audio_stop(target_idx);
     // Reset position tracking for the new image
     audio_get_status_code(target_idx); // trash audio status code
 #endif
-
-    if (filename[0] != '\0')
-    {
-        log("Switching to next CD-ROM image for SCSI ID: ", target_idx, ": ", filename);
+        log("Switching to next CD-ROM image for ", target_idx, ": ", filename);
         img.file.close();
         bool status = scsiDiskOpenHDDImage(target_idx, filename, target_idx, 0,
                                            getBlockSize(filename, target_idx, 2048));
@@ -1245,15 +1244,14 @@ bool cdromSwitch(image_config_t &img, const char* filename)
     // Check if we have a next image to load, so that drive is closed next time the host asks.
     int target_idx = img.scsiId & S2S_CFG_TARGET_ID_BITS;
 
-#ifdef ENABLE_AUDIO_OUTPUT
-    // if in progress for this device, terminate audio playback immediately (Annex C)
-    audio_stop(target_idx);
-    // Reset position tracking for the new image
-    audio_get_status_code(target_idx); // trash audio status code
-#endif
-
     if (filename[0] != '\0')
     {
+#ifdef ENABLE_AUDIO_OUTPUT
+        // if in progress for this device, terminate audio playback immediately (Annex C)
+        audio_stop(target_idx);
+        // Reset position tracking for the new image
+        audio_get_status_code(target_idx); // trash audio status code
+#endif
         log("Switching to next CD-ROM image for ", target_idx, ": ", filename);
         img.file.close();
         bool status = scsiDiskOpenHDDImage(target_idx, filename, target_idx, 0, 2048);