Skip to content

Commit

Permalink
SDL: use OSS audio backend
Browse files Browse the repository at this point in the history
Instead of using Genode's Audio_out specific backend follow our SDL2
port in using an already existing backend, e.g., OSS.

So far only the chocolate-doom SDL1 port was tested but the other
pkg were adapted as well.

Issue genodelabs#362.
  • Loading branch information
cnuke committed Apr 10, 2024
1 parent db17526 commit 5cfbbae
Show file tree
Hide file tree
Showing 14 changed files with 22 additions and 357 deletions.
4 changes: 2 additions & 2 deletions include/SDL/SDL_config_genode.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@
#include <stdio.h>
#include <sys/types.h>

/* Enable the Genode audio driver */
#define SDL_AUDIO_DRIVER_GENODE 1
/* Enable the OSS audio driver */
#define SDL_AUDIO_DRIVER_OSS 1

/* Enable the stub cdrom driver (src/cdrom/dummy/\*.c) */
#define SDL_CDROM_DUMMY 1
Expand Down
9 changes: 6 additions & 3 deletions lib/mk/sdl.mk
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ endif
# backends
SRC_CC = video/SDL_genode_fb_video.cc \
video/SDL_genode_fb_events.cc \
audio/SDL_genodeaudio.cc \
loadso/SDL_loadso.cc

INC_DIR += $(REP_DIR)/include/SDL \
Expand Down Expand Up @@ -65,8 +64,12 @@ SRC_C += $(addprefix events/,$(notdir $(wildcard $(SDL_DIR)/src/events/*.c)))
INC_DIR += $(SDL_DIR)/src/events

# audio subsystem
SRC_C += $(addprefix audio/,$(notdir $(wildcard $(SDL_DIR)/src/audio/*.c)))
INC_DIR += $(SDL_DIR)/src/audio
SRC_C += $(addprefix audio/,$(notdir $(wildcard $(SDL_DIR)/src/audio/*.c))) \
audio/dma/SDL_dmaaudio.c \
audio/dsp/SDL_dspaudio.c
INC_DIR += $(SDL_DIR)/src/audio \
$(SDL_DIR)/src/audio/dma \
$(SDL_DIR)/src/audio/dsp

# file I/O subsystem
SRC_C += file/SDL_rwops.c
Expand Down
2 changes: 1 addition & 1 deletion ports/sdl.hash
Original file line number Diff line number Diff line change
@@ -1 +1 @@
8543c5f3448ebea97afa84aee6691e38a78e756e
0b8312de81a4666483082057cb84f0add09fe30d
2 changes: 1 addition & 1 deletion ports/sdl.port
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ SIG(sdl) := ${URL(sdl)}.sig
KEY(sdl) := 1528635D8053A57F77D1E08630A59377A7763BE6
DIR(sdl) := src/lib/sdl

PATCHES := src/lib/sdl/SDL_video.patch src/lib/sdl/SDL_audio.patch
PATCHES := src/lib/sdl/SDL_video.patch

# wipe original 'SDL_config.h' file because it conflicts with out version
_dirs: remove_default_config
Expand Down
1 change: 1 addition & 0 deletions recipes/pkg/abuse/archives
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@ _/src/sdl_mixer
_/src/sdl_net
_/src/stdcxx
_/src/vfs
_/src/vfs_oss
_/src/libpng
_/src/zlib
4 changes: 3 additions & 1 deletion recipes/pkg/abuse/runtime
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<runtime ram="64M" caps="512" binary="abuse">

<requires>
<audio_out/>
<play/>
<file_system/>
<gui/>
<timer/>
Expand All @@ -22,6 +22,7 @@
<rom label="sdl_net.lib.so"/>
<rom label="stdcxx.lib.so"/>
<rom label="vfs.lib.so"/>
<rom label="vfs_oss.lib.so"/>
<rom label="zlib.lib.so"/>
</content>

Expand All @@ -32,6 +33,7 @@
<fs/>
<dir name="dev">
<log/> <rtc/>
<oss name="dsp" record_enabled="false"/>
</dir>
</vfs>
<arg value="abuse"/>
Expand Down
1 change: 1 addition & 0 deletions recipes/pkg/avplay/archives
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ _/src/libc
_/src/libav
_/src/sdl
_/src/vfs
_/src/vfs_oss
_/src/zlib
5 changes: 3 additions & 2 deletions recipes/pkg/avplay/runtime
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@
<requires>
<file_system label="input"/>
<gui/>
<audio_out/>
<play/>
<timer/>
</requires>

<content>
<rom label="avplay"/>
<rom label="libc.lib.so"/>
<rom label="vfs.lib.so"/>
<rom label="vfs_oss.lib.so"/>
<rom label="libm.lib.so"/>
<rom label="zlib.lib.so"/>
<rom label="sdl.lib.so"/>
Expand All @@ -26,11 +27,11 @@
<config>
<arg value="avplay"/>
<arg value="input/mediafile"/>
<sdl_audio_volume value="100"/>
<libc rtc="/dev/rtc" stdout="/dev/log" stderr="/dev/log"/>
<vfs>
<dir name="dev">
<log/> <inline name="rtc">2000-01-01 00:00</inline>
<oss name="dsp" record_enabled="false"/>
</dir>
<dir name="input"> <fs label="input"/> </dir>
</vfs>
Expand Down
1 change: 1 addition & 0 deletions recipes/pkg/tyrian/archives
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ _/src/opentyrian
_/src/sdl
_/src/sdl_net
_/src/vfs
_/src/vfs_oss
4 changes: 3 additions & 1 deletion recipes/pkg/tyrian/runtime
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<runtime ram="64M" caps="512" binary="opentyrian">

<requires>
<audio_out/>
<play/>
<file_system/>
<gui/>
<timer/>
Expand All @@ -17,6 +17,7 @@
<rom label="sdl_net.lib.so"/>
<rom label="tyrian.tar"/>
<rom label="vfs.lib.so"/>
<rom label="vfs_oss.lib.so"/>
</content>

<config>
Expand All @@ -26,6 +27,7 @@
<fs/>
<dir name="dev">
<log/> <rtc/>
<oss name="dsp" record_enabled="false"/>
</dir>
</vfs>
</config>
Expand Down
1 change: 0 additions & 1 deletion recipes/src/avplay/used_apis
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,5 @@ libc
vfs
libav
sdl
audio_out_session
framebuffer_session
input_session
22 changes: 0 additions & 22 deletions src/lib/sdl/SDL_audio.patch

This file was deleted.

Loading

0 comments on commit 5cfbbae

Please sign in to comment.