]> Shamusworld >> Repos - virtualjaguar/commitdiff
Added appropriate audio thread pausing to the GUI layer.
authorShamus Hammons <jlhamm@acm.org>
Fri, 25 Jan 2013 00:31:53 +0000 (18:31 -0600)
committerShamus Hammons <jlhamm@acm.org>
Fri, 25 Jan 2013 00:31:53 +0000 (18:31 -0600)
src/dac.cpp
src/dac.h
src/gpu.cpp
src/gui/mainwin.cpp
src/log.h

index 7cc3740a6a51d99d01261ce97c1063c93ec5d33d..6a60906a66b3f2c495896e9dbc69f0d761d18db3 100644 (file)
@@ -138,6 +138,15 @@ void DACReset(void)
 }
 
 
+//
+// Pause/unpause the SDL audio thread
+//
+void DACPauseAudioThread(bool state/*= true*/)
+{
+               SDL_PauseAudio(state);
+}
+
+
 //
 // Close down the SDL sound subsystem
 //
index d0c57202a47db98df3b1e06d3dc7efbf5c7ed21f..1cfc8b1b5c9209ab6f335005a2f40b05404217a3 100644 (file)
--- a/src/dac.h
+++ b/src/dac.h
@@ -9,6 +9,7 @@
 
 void DACInit(void);
 void DACReset(void);
+void DACPauseAudioThread(bool state = true);
 void DACDone(void);
 //int GetCalculatedFrequency(void);
 
index 02fa112a37281ca310b7925de28b3b550b3458bb..09a664d6cce2fc07ab32393f8d0af80fc485dddc 100644 (file)
@@ -780,6 +780,7 @@ WriteLog("GPU: %s setting GPU PC to %08X %s\n", whoName[who], gpu_pc, (GPU_RUNNI
                        {
                                //WriteLog("asked to perform a single step (single step is %senabled)\n",(data&0x8)?"":"not ");
                        }
+
                        gpu_control = (gpu_control & 0xF7C0) | (data & (~0xF7C0));
 
                        // if gpu wasn't running but is now running, execute a few cycles
index 04ae3baee1048a78618541cff3b0c7e260bb88e1..28d022b073f83266973dfa12a4b1e4984f76a289 100644 (file)
@@ -616,17 +616,17 @@ void MainWin::Timer(void)
                // Some machines can't handle this, so we give them the option to disable it. :-)
                if (!plzDontKillMyComputer)
                {
-               // Random hash & trash
-               // We try to simulate an untuned tank circuit here... :-)
-               for(uint32_t x=0; x<videoWidget->rasterWidth; x++)
-               {
-                       for(uint32_t y=0; y<videoWidget->rasterHeight; y++)
+                       // Random hash & trash
+                       // We try to simulate an untuned tank circuit here... :-)
+                       for(uint32_t x=0; x<videoWidget->rasterWidth; x++)
                        {
-                               videoWidget->buffer[(y * videoWidget->textureWidth) + x]
-                                       = (rand() & 0xFF) << 8 | (rand() & 0xFF) << 16 | (rand() & 0xFF) << 24;
+                               for(uint32_t y=0; y<videoWidget->rasterHeight; y++)
+                               {
+                                       videoWidget->buffer[(y * videoWidget->textureWidth) + x]
+                                               = (rand() & 0xFF) << 8 | (rand() & 0xFF) << 16 | (rand() & 0xFF) << 24;
+                               }
                        }
                }
-               }
        }
        else
        {
@@ -655,6 +655,7 @@ void MainWin::TogglePowerState(void)
                showUntunedTankCircuit = true;
                // This is just in case the ROM we were playing was in a narrow or wide field mode,
                // so the untuned tank sim doesn't look wrong. :-)
+               DACPauseAudioThread();
                TOMReset();
        }
        else
@@ -680,6 +681,7 @@ void MainWin::TogglePowerState(void)
 
                WriteLog("GUI: Resetting Jaguar...\n");
                JaguarReset();
+               DACPauseAudioThread(false);
        }
 }
 
@@ -700,6 +702,9 @@ void MainWin::ToggleRunState(void)
 
                videoWidget->updateGL();
        }
+
+       // Pause/unpause any running/non-running threads...
+       DACPauseAudioThread(!running);
 }
 
 
index 0bf9e092143aac701a0c17fd47daff31c189ee82..c406bf8154b4fb12cd5e216ba682d97e7999f8d6 100644 (file)
--- a/src/log.h
+++ b/src/log.h
@@ -1,5 +1,5 @@
 //
-// LOG.H
+// log.h: Logfile support
 //
 
 #ifndef __LOG_H__
@@ -20,4 +20,8 @@ void WriteLog(const char * text, ...);
 }
 #endif
 
+// Some useful defines... :-)
+//#define GPU_DEBUG
+//#define LOG_BLITS
+
 #endif // __LOG_H__