Blob Blame History Raw
diff --git a/alsasound.cpp b/alsasound.cpp
index fc9c1ac..92d3dc3 100644
--- a/alsasound.cpp
+++ b/alsasound.cpp
@@ -37,7 +37,8 @@ AlsaSound::AlsaSound(class Machine *mach)
     SoundStream(NULL), HWParms(NULL), SWParms(NULL), AsyncHandler(NULL),
     MayRunPokey(false), AbleIRQ(false),
     FragSize(8), NumFrags(12), 
-    BufferedSamples(0), ForceStereo(false), UpdateBuffer(false), UpdateSamples(0)
+    BufferedSamples(0), ForceStereo(false), UpdateBuffer(false), Polling(false), 
+    UpdateSamples(0)
 {
   strcpy(CardName,"default"); //hw:0,0");
 }
@@ -368,6 +369,7 @@ bool AlsaSound::InitializeDsp(void)
   DifferentialAdjust = 0;
   CycleCarry         = 0;
   UpdateBuffer       = false;
+  Polling            = false;
   UpdateSamples      = 0;
   // Compute the size of a frame in bits
   FragSamples        = fragsize;
@@ -375,7 +377,10 @@ bool AlsaSound::InitializeDsp(void)
   //
   // Start the async handler now.
   if ((err = snd_async_add_pcm_handler(&AsyncHandler,SoundStream,&AlsaSound::AlsaCallBackStub,this)) < 0) {
-    ThrowAlsa(err,"AlsaSound::InitializeDsp","unable to install the async callback handler");
+    Polling = true; 
+    // Sigh, so go into the polling mode. Some ^#+$!@!!
+    // sound preventers/handlers like pulse do not support the
+    // full sound API.
   }
   //
   // Start the sound processing now.
@@ -504,6 +509,11 @@ void AlsaSound::AlsaCallBack(void)
 // sound driver.
 void AlsaSound::HBI(void)
 {
+  
+  if (EnableSound && Polling) {
+    AlsaCallBack();
+  }
+  
   if (EnableSound) {
     LONG  remaining,samples;
     ULONG cycles   = machine->CPU()->ElapsedCycles();
diff --git a/alsasound.hpp b/alsasound.hpp
index 7953244..85f3fa7 100644
--- a/alsasound.hpp
+++ b/alsasound.hpp
@@ -85,6 +85,10 @@ class AlsaSound : public Sound {
   // because either te device requires more data, or the audio
   // settings got altered.
   bool                 UpdateBuffer;
+  //
+  // This is set if we have to use polling instead of interrupts.
+  bool                 Polling;
+  //
   // The number of samples we should have generated, but for which we
   // delayed the generation to reduce the overhead.
   ULONG                UpdateSamples;
-- 
1.9.3