rpms/xroar/F-12 xroar-0.23-SDL_sound.patch, NONE, 1.1 xroar-0.23-info.patch, NONE, 1.1 .cvsignore, 1.3, 1.4 sources, 1.3, 1.4 xroar.spec, 1.3, 1.4

Andrea Musuruane musuruan at rpmfusion.org
Tue Dec 8 14:24:35 CET 2009


Author: musuruan

Update of /cvs/free/rpms/xroar/F-12
In directory se02.es.rpmfusion.net:/tmp/cvs-serv16756

Modified Files:
	.cvsignore sources xroar.spec 
Added Files:
	xroar-0.23-SDL_sound.patch xroar-0.23-info.patch 
Log Message:
* Sat Dec 05 2009 Andrea Musuruane <musuruan at gmail.com> 0.23b-1
- Upgrade to 0.23b
- Used an upstream patch to fix SDL sound
- Updated icon cache scriptlets
- Packaged more docs


xroar-0.23-SDL_sound.patch:

--- NEW FILE xroar-0.23-SDL_sound.patch ---
diff -durN xroar-0.23/sound_sdl.c xroar-snap-20091204/sound_sdl.c
--- xroar-0.23/sound_sdl.c	2009-12-02 20:12:07.000000000 +0100
+++ xroar-snap-20091204/sound_sdl.c	2009-12-04 10:29:21.000000000 +0100
@@ -16,12 +16,18 @@
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
+#include "config.h"
+
 #include <stdlib.h>
 #include <string.h>
 #include <signal.h>
 #include <SDL.h>
 #include <SDL_thread.h>
 
+#ifdef WINDOWS32
+#include <windows.h>
+#endif
+
 #include "types.h"
 #include "events.h"
 #include "logging.h"
@@ -30,31 +36,24 @@
 #include "xroar.h"
 
 static int init(void);
-static void shutdown(void);
+static void _shutdown(void);
 static void update(int value);
 
 SoundModule sound_sdl_module = {
 	{ "sdl", "SDL ring-buffer audio",
-	  init, 0, shutdown },
+	  init, 0, _shutdown },
 	update
 };
 
 typedef Uint8 Sample;  /* 8-bit mono (SDL type) */
 
-#ifdef WINDOWS32
-# define SAMPLE_RATE 22050
-#else
-# define SAMPLE_RATE 44100
-#endif
-/* The lower the FRAME_SIZE, the better.  Windows32 seems to have problems
- * with very small frame sizes though. */
-#ifdef WINDOWS32
-# define FRAME_SIZE 1024
-#else
-# define FRAME_SIZE 512
-#endif
-#define SAMPLE_CYCLES ((int)(OSCILLATOR_RATE / SAMPLE_RATE))
-#define FRAME_CYCLES (SAMPLE_CYCLES * FRAME_SIZE)
+#define REQUEST_SAMPLE_RATE 44100
+#define REQUEST_FRAME_SIZE 512
+
+static int sample_cycles;
+static int frame_size;
+static int frame_cycles;
+static uint8_t sample_eor;
 
 static SDL_AudioSpec audiospec;
 static Cycle frame_cycle_base;
@@ -62,9 +61,13 @@
 static Sample *buffer;
 static Sample *wrptr;
 static Sample lastsample;
-static SDL_mutex *halt_mutex;
-static SDL_cond *halt_cv;
-static int haltflag;
+#ifndef WINDOWS32
+ static SDL_mutex *halt_mutex;
+ static SDL_cond *halt_cv;
+ static int haltflag;
+#else
+ HANDLE hEvent;
+#endif
 
 static void flush_frame(void);
 static event_t *flush_event;
@@ -72,6 +75,7 @@
 static void callback(void *userdata, Uint8 *stream, int len);
 
 static int init(void) {
+	static SDL_AudioSpec desired;
 	LOG_DEBUG(2,"Initialising SDL audio driver\n");
 	if (!SDL_WasInit(SDL_INIT_NOPARACHUTE)) {
 		if (SDL_Init(SDL_INIT_NOPARACHUTE) < 0) {
@@ -83,22 +87,23 @@
 		LOG_ERROR("Failed to initialiase SDL audio driver\n");
 		return 1;
 	}
-	audiospec.freq = SAMPLE_RATE;
-	audiospec.format = AUDIO_U8;
-	audiospec.samples = FRAME_SIZE;
-	audiospec.channels = 1;
-	audiospec.callback = callback;
-	audiospec.userdata = NULL;
-	if (SDL_OpenAudio(&audiospec, NULL) < 0) {
+	desired.freq = REQUEST_SAMPLE_RATE;
+	desired.format = AUDIO_U8;
+	desired.samples = REQUEST_FRAME_SIZE;
+	desired.channels = 1;
+	desired.callback = callback;
+	desired.userdata = NULL;
+	if (SDL_OpenAudio(&desired, &audiospec) < 0) {
 		LOG_ERROR("Couldn't open audio: %s\n", SDL_GetError());
 		SDL_QuitSubSystem(SDL_INIT_AUDIO);
 		return 1;
 	}
 
+	sample_eor = 0;
 	/* TODO: Need to abstract this logging out */
 	LOG_DEBUG(2, "\t");
 	switch (audiospec.format) {
-		case AUDIO_U8: LOG_DEBUG(2, "8-bit unsigned, "); break;
+		case AUDIO_U8: LOG_DEBUG(2, "8-bit unsigned, "); sample_eor = 0x80; break;
 		case AUDIO_S8: LOG_DEBUG(2, "8-bit signed, "); break;
 		case AUDIO_U16LSB: LOG_DEBUG(2, "16-bit unsigned little-endian, "); break;
 		case AUDIO_S16LSB: LOG_DEBUG(2, "16-bit signed little-endian, "); break;
@@ -113,28 +118,46 @@
 	}
 	LOG_DEBUG(2, "%dHz\n", audiospec.freq);
 
-	buffer = (Sample *)malloc(FRAME_SIZE * sizeof(Sample));
+	if ((audiospec.format != AUDIO_U8 && audiospec.format != AUDIO_S8)
+	    || (audiospec.channels != 1)) {
+		LOG_ERROR("Obtained unsupported audio format.\n");
+		SDL_CloseAudio();
+		SDL_QuitSubSystem(SDL_INIT_AUDIO);
+		return 1;
+	}
+
+	sample_cycles = OSCILLATOR_RATE / audiospec.freq;
+	frame_size = audiospec.samples;
+	frame_cycles = sample_cycles * frame_size;
+
+	buffer = (Sample *)malloc(frame_size * sizeof(Sample));
+#ifndef WINDOWS32
 	halt_mutex = SDL_CreateMutex();
 	halt_cv = SDL_CreateCond();
+#else
+	hEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
+#endif
 	flush_event = event_new();
 	flush_event->dispatch = flush_frame;
 
-	memset(buffer, 0x80, FRAME_SIZE * sizeof(Sample));
+	memset(buffer, sample_eor, frame_size * sizeof(Sample));
 	SDL_PauseAudio(0);
 	wrptr = buffer;
 	frame_cycle_base = current_cycle;
 	frame_cycle = 0;
-	flush_event->at_cycle = frame_cycle_base + FRAME_CYCLES;
+	flush_event->at_cycle = frame_cycle_base + frame_cycles;
 	event_queue(&MACHINE_EVENT_LIST, flush_event);
-	lastsample = 0x80;
+	lastsample = sample_eor;
 	return 0;
 }
 
-static void shutdown(void) {
+static void _shutdown(void) {
 	LOG_DEBUG(2,"Shutting down SDL audio driver\n");
 	event_free(flush_event);
+#ifndef WINDOWS32
 	SDL_DestroyCond(halt_cv);
 	SDL_DestroyMutex(halt_mutex);
+#endif
 	SDL_CloseAudio();
 	SDL_QuitSubSystem(SDL_INIT_AUDIO);
 	free(buffer);
@@ -142,42 +165,55 @@
 
 static void update(int value) {
 	int elapsed_cycles = current_cycle - frame_cycle_base;
-	if (elapsed_cycles >= FRAME_CYCLES) {
-		elapsed_cycles = FRAME_CYCLES;
+	if (elapsed_cycles >= frame_cycles) {
+		elapsed_cycles = frame_cycles;
 	}
 	while (frame_cycle < elapsed_cycles) {
 		*(wrptr++) = lastsample;
-		frame_cycle += SAMPLE_CYCLES;
+		frame_cycle += sample_cycles;
 	}
-	lastsample = value ^ 0x80;
+	lastsample = value ^ sample_eor;
 }
 
 static void flush_frame(void) {
-	Sample *fill_to = buffer + FRAME_SIZE;
+	Sample *fill_to = buffer + frame_size;
 	while (wrptr < fill_to)
 		*(wrptr++) = lastsample;
-	frame_cycle_base += FRAME_CYCLES;
+	frame_cycle_base += frame_cycles;
 	frame_cycle = 0;
-	flush_event->at_cycle = frame_cycle_base + FRAME_CYCLES;
+	flush_event->at_cycle = frame_cycle_base + frame_cycles;
 	event_queue(&MACHINE_EVENT_LIST, flush_event);
 	wrptr = buffer;
 	if (!xroar_noratelimit) {
+#ifndef WINDOWS32
 		SDL_LockMutex(halt_mutex);
 		haltflag = 1;
 		while (haltflag)
 			SDL_CondWait(halt_cv, halt_mutex);
 		SDL_UnlockMutex(halt_mutex);
+#else
+		WaitForSingleObject(hEvent, INFINITE);
+#endif
 	}
 }
 
 static void callback(void *userdata, Uint8 *stream, int len) {
 	(void)userdata;  /* unused */
-	if (len == FRAME_SIZE) {
-		memcpy(stream, buffer, len);
-		memset(buffer, 0, len);
+	if (len == frame_size) {
+		if (haltflag == 1) {
+			/* Data is ready */
+			memcpy(stream, buffer, len * sizeof(Sample));
+		} else {
+			/* Not ready - provide a "padding" frame */
+			memset(buffer, buffer[len-1], len * sizeof(Sample));
+		}
 	}
+#ifndef WINDOWS32
 	SDL_LockMutex(halt_mutex);
 	haltflag = 0;
 	SDL_CondSignal(halt_cv);
 	SDL_UnlockMutex(halt_mutex);
+#else
+	SetEvent(hEvent);
+#endif
 }

xroar-0.23-info.patch:

--- NEW FILE xroar-0.23-info.patch ---
diff -dur xroar-0.22.orig/doc/xroar.texi xroar-0.22/doc/xroar.texi
--- xroar-0.22.orig/doc/xroar.texi	2008-12-23 11:45:08.000000000 +0100
+++ xroar-0.22/doc/xroar.texi	2008-12-24 14:41:41.000000000 +0100
@@ -9,6 +9,11 @@
 @end ifclear
 @c %**end of header
 
+ at dircategory Emulators
+ at direntry
+* xroar: (xroar).		A Dragon 32, Dragon 64 and Tandy CoCo emulator.
+ at end direntry
+
 @macro myuref {link, text}
 @uref{\link\, \text\}
 @iftex


Index: .cvsignore
===================================================================
RCS file: /cvs/free/rpms/xroar/F-12/.cvsignore,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- .cvsignore	18 Jul 2008 16:45:51 -0000	1.3
+++ .cvsignore	8 Dec 2009 13:24:35 -0000	1.4
@@ -1,2 +1,2 @@
-xroar-0.21.tar.gz
+xroar-0.23b.tar.gz
 dragon.rom


Index: sources
===================================================================
RCS file: /cvs/free/rpms/xroar/F-12/sources,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- sources	18 Jul 2008 16:45:51 -0000	1.3
+++ sources	8 Dec 2009 13:24:35 -0000	1.4
@@ -1,2 +1,2 @@
-8acb182832f747d524487c385aa85d7d  xroar-0.21.tar.gz
+0ba9e23c31b9aad6d62d2a6cac4ced2e  xroar-0.23b.tar.gz
 f8b5f52c07abb4dc9102d8420605d7e4  dragon.rom


Index: xroar.spec
===================================================================
RCS file: /cvs/free/rpms/xroar/F-12/xroar.spec,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- xroar.spec	29 Mar 2009 14:28:33 -0000	1.3
+++ xroar.spec	8 Dec 2009 13:24:35 -0000	1.4
@@ -1,12 +1,16 @@
 Name:           xroar
-Version:        0.21
-Release:        3%{?dist}
+Version:        0.23b
+Release:        1%{?dist}
 Summary:        A Dragon 32, Dragon 64 and Tandy CoCo emulator
 Group:          Applications/Emulators
 License:        GPLv2+
 URL:            http://www.6809.org.uk/dragon/xroar.shtml
 Source0:        http://www.6809.org.uk/dragon/%{name}-%{version}.tar.gz
 Source1:        http://www.6809.org.uk/dragon/dragon.rom
+# Andrea Musuruane
+Patch0:         %{name}-0.23-info.patch
+# Upstream
+Patch1:         %{name}-0.23-SDL_sound.patch
 BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 BuildRequires:  desktop-file-utils
 BuildRequires:  gtk2-devel
@@ -16,7 +20,12 @@
 BuildRequires:  libsndfile-devel
 BuildRequires:  pkgconfig
 BuildRequires:  SDL_image-devel
+BuildRequires:  ncurses-devel
+BuildRequires:  texinfo
 Requires:       hicolor-icon-theme
+Requires(post): info
+Requires(preun): info
+
 
 %description
 A Dragon 32, Dragon 64 and Tandy CoCo emulator for Unix, Linux, GP32, MacOS X
@@ -29,12 +38,23 @@
 
 
 %prep
-%setup -q
+%setup -q -n %{name}-0.23
+
+# Fix info dir entry 
+%patch0 -p1
+
+# Fix SDL sound
+%patch1 -p1
 
 
 %build
 %configure
-make %{?_smp_mflags} ROMPATH=\\\".\\\",\\\"~/.%{name}/roms\\\",\\\"%{_datadir}/%{name}/roms\\\"
+make %{?_smp_mflags}
+
+# Build docs
+make doc/xroar.info
+make doc/xroar.txt
+make doc/xroar.html
 
 # Create icon
 convert gp32/icon.bmp -transparent '#000000' %{name}.png
@@ -42,7 +62,6 @@
 # Generate desktop file
 cat >%{name}.desktop <<EOF
 [Desktop Entry]
-Encoding=UTF-8
 Name=XRoar
 GenericName=Dragon 32/64 Emulator
 Comment=Emulates the Dragon 32/64 and Tandy CoCo
@@ -55,7 +74,6 @@
 
 cat >%{name}-minifirm.desktop <<EOF
 [Desktop Entry]
-Encoding=UTF-8
 Name=XRoar [Minimal Firmware]
 GenericName=Dragon 32/64 Emulator
 Comment=Emulates the Dragon 32/64 and Tandy CoCo
@@ -69,9 +87,10 @@
 
 %install
 rm -rf %{buildroot}
-mkdir -p %{buildroot}%{_bindir}
+make install DEB_BUILD_OPTIONS=nostrip \
+             DESTDIR=%{buildroot}
+
 mkdir -p %{buildroot}%{_datadir}/{%{name}/roms,icons/hicolor/32x32/apps}
-install -pm0755 %{name} %{buildroot}%{_bindir}
 install -pm0644 %{name}.png %{buildroot}%{_datadir}/icons/hicolor/32x32/apps
 install -pm0644 %{SOURCE1} %{buildroot}%{_datadir}/%{name}/roms/dragon-minifirm.rom
 
@@ -89,16 +108,25 @@
 
 
 %post
-touch --no-create %{_datadir}/icons/hicolor
-if [ -x %{_bindir}/gtk-update-icon-cache ]; then
-   %{_bindir}/gtk-update-icon-cache --quiet %{_datadir}/icons/hicolor || :
-fi
+/sbin/install-info %{_infodir}/%{name}.info.gz %{_infodir}/dir || :
+
+touch --no-create %{_datadir}/icons/hicolor &>/dev/null || :
 
 
 %postun
-touch --no-create %{_datadir}/icons/hicolor
-if [ -x %{_bindir}/gtk-update-icon-cache ]; then
-   %{_bindir}/gtk-update-icon-cache --quiet %{_datadir}/icons/hicolor || :
+if [ $1 -eq 0 ] ; then
+    touch --no-create %{_datadir}/icons/hicolor &>/dev/null
+    gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
+fi
+
+
+%posttrans
+gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
+
+
+%preun
+if [ $1 = 0 ] ; then
+  /sbin/install-info --delete %{_infodir}/%{name}.info.gz %{_infodir}/dir || :
 fi
 
 
@@ -109,10 +137,18 @@
 %{_datadir}/icons/hicolor/32x32/apps/%{name}.png
 %{_datadir}/applications/dribble-%{name}.desktop
 %{_datadir}/applications/dribble-%{name}-minifirm.desktop
-%doc ChangeLog COPYING.GPL COPYING.LGPL-2.1 README
+%{_infodir}/%{name}.info*
+%doc ChangeLog COPYING.GPL COPYING.LGPL-2.1 README 
+%doc doc/%{name}.txt doc/%{name}.html doc/%{name}-screens.png
 
 
 %changelog
+* Sat Dec 05 2009 Andrea Musuruane <musuruan at gmail.com> 0.23b-1
+- Upgrade to 0.23b
+- Used an upstream patch to fix SDL sound
+- Updated icon cache scriptlets
+- Packaged more docs
+
 * Sun Mar 29 2009 Thorsten Leemhuis <fedora [AT] leemhuis [DOT] info> - 0.21-3
 - rebuild for new F11 features
 



More information about the rpmfusion-commits mailing list