[atari++] - switch to polling for Alsa sound (#1201805)

Dan Horák sharkcz at fedoraproject.org
Sun Mar 22 16:18:23 UTC 2015


commit ac09f8ea4dea1566025d018b9e28d8d0ef647898
Author: Dan Horák <dan at danny.cz>
Date:   Sun Mar 22 17:18:20 2015 +0100

    - switch to polling for Alsa sound (#1201805)

 atari++-alsa-polling.patch | 64 ++++++++++++++++++++++++++++++++++++++++++++++
 atari++.spec               | 16 ++++++++++--
 2 files changed, 78 insertions(+), 2 deletions(-)
---
diff --git a/atari++-alsa-polling.patch b/atari++-alsa-polling.patch
new file mode 100644
index 0000000..29a70e7
--- /dev/null
+++ b/atari++-alsa-polling.patch
@@ -0,0 +1,64 @@
+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
+
diff --git a/atari++.spec b/atari++.spec
index ef039f5..62f63c2 100644
--- a/atari++.spec
+++ b/atari++.spec
@@ -1,6 +1,6 @@
 Name:           atari++
 Version:        1.73
-Release:        3%{?dist}
+Release:        4%{?dist}
 Summary:        Unix based emulator of the Atari eight bit computers
 
 Group:          Applications/Emulators
@@ -11,8 +11,16 @@ Source1:        http://www.xl-project.com/download/os++doc.pdf
 Source2:        http://www.xl-project.com/download/system.atr
 # be verbose during compile
 Patch1:         %{name}-verbose.patch
+# switch to polling in Alsa sound
+# https://bugzilla.redhat.com/show_bug.cgi?id=1201805
+Patch2:         %{name}-alsa-polling.patch
 
-BuildRequires:  SDL-devel libICE-devel libSM-devel zlib-devel ncurses-devel libpng-devel
+BuildRequires:  SDL-devel
+BuildRequires:  libICE-devel
+BuildRequires:  libSM-devel
+BuildRequires:  zlib-devel
+BuildRequires:  ncurses-devel
+BuildRequires:  libpng-devel
 
 
 %description
@@ -27,6 +35,7 @@ the AtariXL operating system closely.
 %prep
 %setup -q -n %{name}
 %patch1 -p1 -b .verbose
+%patch2 -p1 -b .alsa-polling
 
 # fix encoding
 f=README.History
@@ -66,6 +75,9 @@ install -p -m 644 %{SOURCE2} $RPM_BUILD_ROOT%{_datadir}/%{name}
 
 
 %changelog
+* Sun Mar 22 2015 Dan Horák <dan[at]danny.cz> - 1.73-4
+- switch to polling for Alsa sound (#1201805)
+
 * Fri Aug 15 2014 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 1.73-3
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild
 


More information about the scm-commits mailing list