summaryrefslogtreecommitdiff
path: root/uisimulator
diff options
context:
space:
mode:
authorDan Everton <dan@iocaine.org>2006-02-13 21:46:28 +0000
committerDan Everton <dan@iocaine.org>2006-02-13 21:46:28 +0000
commit3ba0060ac1fa1c39596c51d4bf259142e6d1847f (patch)
tree71428db81254a9901fbf3e8a92c71f0f57410cd2 /uisimulator
parentdd39e33663a4b617c3f88f48845681e772386a7f (diff)
downloadrockbox-3ba0060ac1fa1c39596c51d4bf259142e6d1847f.tar.gz
rockbox-3ba0060ac1fa1c39596c51d4bf259142e6d1847f.zip
Backlight support for 8-bit targets in SDL sim. Redo sound handling. Still doesn't work right, but is closer to how the actual Rockbox system does it. Move some stub functions in to Win32 and X11 sims to keep them compiling.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@8686 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'uisimulator')
-rw-r--r--uisimulator/common/stubs.c57
-rw-r--r--uisimulator/sdl/lcd-bitmap.c20
-rw-r--r--uisimulator/sdl/lcd-charcell.c16
-rw-r--r--uisimulator/sdl/lcd-remote.c12
-rw-r--r--uisimulator/sdl/sound.c216
-rw-r--r--uisimulator/sdl/uisdl.c19
-rw-r--r--uisimulator/sdl/uisdl.h11
-rw-r--r--uisimulator/win32/lcd-win32.c15
-rw-r--r--uisimulator/win32/sound.c46
-rw-r--r--uisimulator/x11/lcd-x11.c16
-rw-r--r--uisimulator/x11/sound.c45
11 files changed, 327 insertions, 146 deletions
diff --git a/uisimulator/common/stubs.c b/uisimulator/common/stubs.c
index d4862a0f85..b06c812772 100644
--- a/uisimulator/common/stubs.c
+++ b/uisimulator/common/stubs.c
@@ -32,49 +32,6 @@
32#include "ata.h" /* for volume definitions */ 32#include "ata.h" /* for volume definitions */
33 33
34extern char having_new_lcd; 34extern char having_new_lcd;
35static bool playing = false;
36
37/* Stubs for PCM audio playback. */
38bool pcm_is_playing(void)
39{
40 return playing;
41}
42
43void pcm_mute(bool state)
44{
45 (void)state;
46}
47
48void pcm_play_pause(bool state)
49{
50 (void)state;
51}
52
53bool pcm_is_paused(void)
54{
55 return false;
56}
57
58void pcm_play_stop(void)
59{
60 playing = false;
61}
62
63void pcm_init(void)
64{
65}
66
67void (*sound_get_pcm)(unsigned char** start, long* size);
68void pcm_play_data(void (*get_more)(unsigned char** start, long* size))
69{
70 sound_get_pcm = get_more;
71 playing = true;
72}
73
74long pcm_get_bytes_waiting(void)
75{
76 return 0;
77}
78 35
79#if CONFIG_CODEC != SWCODEC 36#if CONFIG_CODEC != SWCODEC
80void audio_set_buffer_margin(int seconds) 37void audio_set_buffer_margin(int seconds)
@@ -83,20 +40,6 @@ void audio_set_buffer_margin(int seconds)
83} 40}
84#endif 41#endif
85 42
86#ifdef CONFIG_BACKLIGHT
87void sim_backlight(int value)
88{
89 DEBUGF("backlight: %s\n", (value > 0) ? "on" : "off");
90}
91#endif
92
93#ifdef HAVE_REMOTE_LCD
94void sim_remote_backlight(int value)
95{
96 DEBUGF("remote backlight: %s\n", (value > 0) ? "on" : "off");
97}
98#endif
99
100int fat_startsector(void) 43int fat_startsector(void)
101{ 44{
102 return 63; 45 return 63;
diff --git a/uisimulator/sdl/lcd-bitmap.c b/uisimulator/sdl/lcd-bitmap.c
index db4a98d823..2fd7576ecc 100644
--- a/uisimulator/sdl/lcd-bitmap.c
+++ b/uisimulator/sdl/lcd-bitmap.c
@@ -17,13 +17,15 @@
17 * 17 *
18 ****************************************************************************/ 18 ****************************************************************************/
19 19
20#include "debug.h"
20#include "uisdl.h" 21#include "uisdl.h"
21#include "lcd-sdl.h" 22#include "lcd-sdl.h"
22 23
23SDL_Surface* lcd_surface; 24SDL_Surface* lcd_surface;
24 25
25#if LCD_DEPTH <= 8 26#if LCD_DEPTH <= 8
26SDL_Color lcd_color_zero = {UI_LCD_BGCOLORLIGHT, 0}; 27SDL_Color lcd_color_zero = {UI_LCD_BGCOLOR, 0};
28SDL_Color lcd_backlight_color_zero = {UI_LCD_BGCOLORLIGHT, 0};
27SDL_Color lcd_color_max = {0, 0, 0, 0}; 29SDL_Color lcd_color_max = {0, 0, 0, 0};
28#endif 30#endif
29 31
@@ -60,6 +62,22 @@ void lcd_update_rect(int x_start, int y_start, int width, int height)
60 get_lcd_pixel); 62 get_lcd_pixel);
61} 63}
62 64
65#ifdef CONFIG_BACKLIGHT
66void sim_backlight(int value)
67{
68#if LCD_DEPTH <= 8
69 if (value > 0) {
70 sdl_set_gradient(lcd_surface, &lcd_backlight_color_zero, &lcd_color_max, (1<<LCD_DEPTH));
71 } else {
72 sdl_set_gradient(lcd_surface, &lcd_color_zero, &lcd_color_max, (1<<LCD_DEPTH));
73 }
74
75 lcd_update();
76#else
77 DEBUGF("backlight: %s\n", (value > 0) ? "on" : "off");
78#endif
79}
80#endif
63 81
64/* initialise simulator lcd driver */ 82/* initialise simulator lcd driver */
65void sim_lcd_init(void) 83void sim_lcd_init(void)
diff --git a/uisimulator/sdl/lcd-charcell.c b/uisimulator/sdl/lcd-charcell.c
index 5f51e44810..2ef86d0baf 100644
--- a/uisimulator/sdl/lcd-charcell.c
+++ b/uisimulator/sdl/lcd-charcell.c
@@ -23,7 +23,8 @@
23#include "lcd-sdl.h" 23#include "lcd-sdl.h"
24 24
25SDL_Surface* lcd_surface; 25SDL_Surface* lcd_surface;
26SDL_Color lcd_color_zero = {UI_LCD_BGCOLORLIGHT, 0}; 26SDL_Color lcd_color_zero = {UI_LCD_BGCOLOR, 0};
27SDL_Color lcd_backlight_color_zero = {UI_LCD_BGCOLORLIGHT, 0};
27SDL_Color lcd_color_max = {0, 0, 0, 0}; 28SDL_Color lcd_color_max = {0, 0, 0, 0};
28 29
29/* Defined in lcd-playersim.c */ 30/* Defined in lcd-playersim.c */
@@ -104,6 +105,19 @@ void drawrectangles(int color, struct rectangle *points, int count)
104 SDL_UnlockSurface(lcd_surface); 105 SDL_UnlockSurface(lcd_surface);
105} 106}
106 107
108#ifdef CONFIG_BACKLIGHT
109void sim_backlight(int value)
110{
111 if (value > 0) {
112 sdl_set_gradient(lcd_surface, &lcd_backlight_color_zero, &lcd_color_max, (1<<LCD_DEPTH));
113 } else {
114 sdl_set_gradient(lcd_surface, &lcd_color_zero, &lcd_color_max, (1<<LCD_DEPTH));
115 }
116
117 lcd_update();
118}
119#endif
120
107/* initialise simulator lcd driver */ 121/* initialise simulator lcd driver */
108void sim_lcd_init(void) 122void sim_lcd_init(void)
109{ 123{
diff --git a/uisimulator/sdl/lcd-remote.c b/uisimulator/sdl/lcd-remote.c
index b5a07d2f20..5ce0447601 100644
--- a/uisimulator/sdl/lcd-remote.c
+++ b/uisimulator/sdl/lcd-remote.c
@@ -23,7 +23,8 @@
23 23
24SDL_Surface *remote_surface; 24SDL_Surface *remote_surface;
25 25
26SDL_Color remote_color_zero = {UI_REMOTE_BGCOLORLIGHT, 0}; 26SDL_Color remote_color_zero = {UI_REMOTE_BGCOLOR, 0};
27SDL_Color remote_backlight_color_zero = {UI_REMOTE_BGCOLORLIGHT, 0};
27SDL_Color remote_color_max = {0, 0, 0, 0}; 28SDL_Color remote_color_max = {0, 0, 0, 0};
28 29
29extern unsigned char lcd_remote_framebuffer[LCD_REMOTE_HEIGHT/8][LCD_REMOTE_WIDTH]; 30extern unsigned char lcd_remote_framebuffer[LCD_REMOTE_HEIGHT/8][LCD_REMOTE_WIDTH];
@@ -44,6 +45,15 @@ void lcd_remote_update_rect(int x_start, int y_start, int width, int height)
44 (background ? UI_REMOTE_POSY : LCD_HEIGHT), get_lcd_remote_pixel); 45 (background ? UI_REMOTE_POSY : LCD_HEIGHT), get_lcd_remote_pixel);
45} 46}
46 47
48void sim_remote_backlight(int value)
49{
50 if (value > 0) {
51 sdl_set_gradient(remote_surface, &remote_backlight_color_zero, &remote_color_max, (1<<LCD_REMOTE_DEPTH));
52 } else {
53 sdl_set_gradient(remote_surface, &remote_color_zero, &remote_color_max, (1<<LCD_REMOTE_DEPTH));
54 }
55}
56
47/* initialise simulator lcd remote driver */ 57/* initialise simulator lcd remote driver */
48void sim_lcd_remote_init(void) 58void sim_lcd_remote_init(void)
49{ 59{
diff --git a/uisimulator/sdl/sound.c b/uisimulator/sdl/sound.c
index 66df6961b2..4b8427ca90 100644
--- a/uisimulator/sdl/sound.c
+++ b/uisimulator/sdl/sound.c
@@ -21,88 +21,170 @@
21 21
22#ifdef ROCKBOX_HAS_SIMSOUND /* play sound in sim enabled */ 22#ifdef ROCKBOX_HAS_SIMSOUND /* play sound in sim enabled */
23 23
24#include <memory.h>
25#include <stdlib.h> 24#include <stdlib.h>
26#include "uisdl.h" 25#include <stdbool.h>
26#include <memory.h>
27#include "sound.h" 27#include "sound.h"
28#include "SDL.h"
29
30static bool pcm_playing;
31static bool pcm_paused;
28 32
29static int audio_len; 33static Uint8* pcm_data;
30static char *audio_pos; 34static int pcm_data_size;
31SDL_sem* sem;
32 35
33void mixaudio(void *udata, Uint8 *stream, int len) 36static void sdl_dma_start(const void *addr, size_t size)
34{ 37{
35 (void)udata; 38 pcm_playing = true;
36 39
37 /* Only play if we have data left */ 40 pcm_data = (Uint8 *) addr;
38 if ( audio_len == 0 ) 41 pcm_data_size = size;
39 return; 42
40 43 SDL_PauseAudio(0);
41 len = (len > audio_len) ? audio_len : len;
42 memcpy(stream, audio_pos, len);
43 audio_pos += len;
44 audio_len -= len;
45
46 if(audio_len == 0) {
47 if(SDL_SemPost(sem))
48 fprintf(stderr,"Couldn't post: %s",SDL_GetError());
49
50 }
51} 44}
52 45
53int sim_sound_init(void) 46static void sdl_dma_stop()
54{ 47{
55 SDL_AudioSpec fmt; 48 pcm_playing = false;
56 49
57 /* Set 16-bit stereo audio at 44Khz */ 50 SDL_PauseAudio(1);
58 fmt.freq = 44100; 51
59 fmt.format = AUDIO_S16SYS; 52 pcm_paused = false;
60 fmt.channels = 2;
61 fmt.samples = 512; /* A good value for games */
62 fmt.callback = mixaudio;
63 fmt.userdata = NULL;
64
65 sem = SDL_CreateSemaphore(0);
66
67 /* Open the audio device and start playing sound! */
68 if(SDL_OpenAudio(&fmt, NULL) < 0) {
69 fprintf(stderr, "Unable to open audio: %s\n", SDL_GetError());
70 return -1;
71 }
72
73 SDL_PauseAudio(0);
74 return 0;
75} 53}
76 54
77int sound_playback_thread(void *p) 55static void (*callback_for_more)(unsigned char**, size_t*) = NULL;
56void pcm_play_data(void (*get_more)(unsigned char** start, size_t* size),
57 unsigned char* start, size_t size)
78{ 58{
79 int sndret = sim_sound_init(); 59 callback_for_more = get_more;
80 unsigned char *buf; 60
81 long size; 61 if (!(start && size)) {
62 if (get_more)
63 get_more(&start, &size);
64 else
65 return;
66 }
67
68 if (start && size) {
69 sdl_dma_start(start, size);
70 }
71}
82 72
83 (void)p; 73size_t pcm_get_bytes_waiting(void)
74{
75 return pcm_data_size;
76}
84 77
85 while(sndret) 78void pcm_mute(bool mute)
86 SDL_Delay(100000); /* wait forever, can't play sound! */ 79{
80 (void) mute;
81}
82
83void pcm_play_stop(void)
84{
85 if (pcm_playing) {
86 sdl_dma_stop();
87 }
88}
89
90void pcm_play_pause(bool play)
91{
92 int next_size;
93 Uint8 *next_start;
94
95 if (!pcm_playing) {
96 return;
97 }
98
99 if(pcm_paused && play) {
100 if (pcm_get_bytes_waiting()) {
101 printf("unpause\n");
102
103 SDL_PauseAudio(0);
104 } else {
105 printf("unpause, no data waiting\n");
106
107 void (*get_more)(unsigned char**, size_t*) = callback_for_more;
108
109 if (get_more) {
110 get_more(&next_start, &next_size);
111 }
112
113 if (next_start && next_size) {
114 sdl_dma_start(next_start, next_size);
115 } else {
116 sdl_dma_stop();
117 printf("unpause attempted, no data\n");
118 }
119 }
120 } else if(!pcm_paused && !play) {
121 printf("pause\n");
122
123 SDL_PauseAudio(1);
124 }
125
126 pcm_paused = !play;
127}
128
129bool pcm_is_paused(void)
130{
131 return pcm_paused;
132}
133
134bool pcm_is_playing(void)
135{
136 return pcm_playing;
137}
138
139void sdl_audio_callback(void *udata, Uint8 *stream, int len)
140{
141 int datalen;
142
143 (void) udata;
144
145 if (pcm_data_size == 0) {
146 return;
147 }
148
149 datalen = (len > pcm_data_size) ? pcm_data_size : len;
150
151 memcpy(stream, pcm_data, datalen);
152
153 pcm_data_size -= datalen;
154 pcm_data += datalen;
155
156 if (pcm_data_size == 0) {
157 void (*get_more)(unsigned char**, size_t*) = callback_for_more;
158 if (get_more) {
159 get_more(&pcm_data, &pcm_data_size);
160 } else {
161 pcm_data_size = 0;
162 pcm_data = NULL;
163 }
164 }
165}
166
167int pcm_init(void)
168{
169 SDL_AudioSpec fmt;
170
171 /* Set 16-bit stereo audio at 44Khz */
172 fmt.freq = 44100;
173 fmt.format = AUDIO_S16SYS;
174 fmt.channels = 2;
175 fmt.samples = 512;
176 fmt.callback = sdl_audio_callback;
177 fmt.userdata = NULL;
178
179 /* Open the audio device and start playing sound! */
180 if(SDL_OpenAudio(&fmt, NULL) < 0) {
181 fprintf(stderr, "Unable to open audio: %s\n", SDL_GetError());
182 return -1;
183 }
87 184
88 do { 185 sdl_dma_stop();
89 while(!sound_get_pcm)
90 /* TODO: fix a fine thread-synch mechanism here */
91 SDL_Delay(100);
92 do {
93 sound_get_pcm(&buf, &size);
94 if(!size) {
95 sound_get_pcm = NULL;
96 break;
97 }
98 audio_pos = buf; // TODO: is this safe?
99 audio_len = size;
100
101 if(SDL_SemWait(sem))
102 fprintf(stderr,"Couldn't wait: %s",SDL_GetError());
103 } while(size);
104 } while(1);
105 186
187 return 0;
106} 188}
107 189
108#endif /* ROCKBOX_HAS_SIMSOUND */ 190#endif /* ROCKBOX_HAS_SIMSOUND */
diff --git a/uisimulator/sdl/uisdl.c b/uisimulator/sdl/uisdl.c
index 178090403f..1e36bfa223 100644
--- a/uisimulator/sdl/uisdl.c
+++ b/uisimulator/sdl/uisdl.c
@@ -23,7 +23,6 @@
23#include "button.h" 23#include "button.h"
24#include "thread.h" 24#include "thread.h"
25#include "kernel.h" 25#include "kernel.h"
26#include "sound.h"
27#include "uisdl.h" 26#include "uisdl.h"
28#include "lcd-sdl.h" 27#include "lcd-sdl.h"
29#ifdef HAVE_LCD_BITMAP 28#ifdef HAVE_LCD_BITMAP
@@ -50,9 +49,6 @@ bool background = false; /* Don't use backgrounds by default */
50 49
51SDL_Thread *gui_thread; 50SDL_Thread *gui_thread;
52SDL_TimerID tick_timer_id; 51SDL_TimerID tick_timer_id;
53#ifdef ROCKBOX_HAS_SIMSOUND
54SDL_Thread *sound_thread;
55#endif
56 52
57bool lcd_display_redraw = true; /* Used for player simulator */ 53bool lcd_display_redraw = true; /* Used for player simulator */
58char having_new_lcd=true; /* Used for player simulator */ 54char having_new_lcd=true; /* Used for player simulator */
@@ -68,8 +64,7 @@ Uint32 tick_timer(Uint32 interval, void *param)
68 64
69 new_tick = (SDL_GetTicks() - start_tick) * HZ / 1000; 65 new_tick = (SDL_GetTicks() - start_tick) * HZ / 1000;
70 66
71 if (new_tick != current_tick) 67 if (new_tick != current_tick) {
72 {
73 long i; 68 long i;
74 for (i = new_tick - current_tick; i > 0; i--) 69 for (i = new_tick - current_tick; i > 0; i--)
75 sim_tick_tasks(); 70 sim_tick_tasks();
@@ -171,9 +166,6 @@ bool gui_shutdown()
171 166
172 SDL_KillThread(gui_thread); 167 SDL_KillThread(gui_thread);
173 SDL_RemoveTimer(tick_timer_id); 168 SDL_RemoveTimer(tick_timer_id);
174#ifdef ROCKBOX_HAS_SIMSOUND
175 SDL_KillThread(sound_thread);
176#endif
177 169
178 for (i = 0; i < threadCount; i++) 170 for (i = 0; i < threadCount; i++)
179 { 171 {
@@ -223,7 +215,6 @@ int main(int argc, char *argv[])
223 background = false; 215 background = false;
224 } 216 }
225 217
226
227 if (!gui_startup()) 218 if (!gui_startup())
228 return -1; 219 return -1;
229 220
@@ -235,14 +226,6 @@ int main(int argc, char *argv[])
235 226
236 tick_timer_id = SDL_AddTimer(10, tick_timer, NULL); 227 tick_timer_id = SDL_AddTimer(10, tick_timer, NULL);
237 228
238#ifdef ROCKBOX_HAS_SIMSOUND
239 sound_thread = SDL_CreateThread(sound_playback_thread, NULL);
240 if (sound_thread == NULL) {
241 printf("Error creating sound thread!\n");
242 return -1;
243 }
244#endif
245
246 gui_message_loop(); 229 gui_message_loop();
247 230
248 return gui_shutdown(); 231 return gui_shutdown();
diff --git a/uisimulator/sdl/uisdl.h b/uisimulator/sdl/uisdl.h
index 989ca364d1..f4a28f9e0f 100644
--- a/uisimulator/sdl/uisdl.h
+++ b/uisimulator/sdl/uisdl.h
@@ -139,6 +139,16 @@
139#define UI_LCD_WIDTH 176 139#define UI_LCD_WIDTH 176
140#define UI_LCD_HEIGHT 132 140#define UI_LCD_HEIGHT 132
141 141
142#elif defined(IPOD_VIDEO)
143#define UI_TITLE "iPod Video"
144#define UI_WIDTH 320 // width of GUI window
145#define UI_HEIGHT 240 // height of GUI window
146/* high-colour */
147#define UI_LCD_POSX 0 // x position of lcd
148#define UI_LCD_POSY 0 // y position of lcd
149#define UI_LCD_WIDTH 320
150#define UI_LCD_HEIGHT 240
151
142#elif defined(ARCHOS_GMINI120) 152#elif defined(ARCHOS_GMINI120)
143#define UI_TITLE "Gmini 120" 153#define UI_TITLE "Gmini 120"
144#define UI_WIDTH 370 // width of GUI window 154#define UI_WIDTH 370 // width of GUI window
@@ -151,7 +161,6 @@
151#define UI_LCD_WIDTH 192 // * 1.5 161#define UI_LCD_WIDTH 192 // * 1.5
152#define UI_LCD_HEIGHT 96 // * 1.5 162#define UI_LCD_HEIGHT 96 // * 1.5
153 163
154
155#elif defined(IAUDIO_X5) 164#elif defined(IAUDIO_X5)
156#define UI_TITLE "iAudio X5" 165#define UI_TITLE "iAudio X5"
157#define UI_WIDTH 300 // width of GUI window 166#define UI_WIDTH 300 // width of GUI window
diff --git a/uisimulator/win32/lcd-win32.c b/uisimulator/win32/lcd-win32.c
index a50fbd11f6..8afd025a16 100644
--- a/uisimulator/win32/lcd-win32.c
+++ b/uisimulator/win32/lcd-win32.c
@@ -22,6 +22,7 @@
22#include "uisw32.h" 22#include "uisw32.h"
23#include "lcd.h" 23#include "lcd.h"
24#include "lcd-playersim.h" 24#include "lcd-playersim.h"
25#include "debug.h"
25 26
26#if LCD_DEPTH == 16 27#if LCD_DEPTH == 16
27unsigned short bitmap[LCD_HEIGHT][LCD_WIDTH]; /* the ui display */ 28unsigned short bitmap[LCD_HEIGHT][LCD_WIDTH]; /* the ui display */
@@ -309,3 +310,17 @@ void simlcdinit(void)
309#endif 310#endif
310} 311}
311 312
313#ifdef CONFIG_BACKLIGHT
314void sim_backlight(int value)
315{
316 DEBUGF("backlight: %s\n", (value > 0) ? "on" : "off");
317}
318#endif
319
320#ifdef HAVE_REMOTE_LCD
321void sim_remote_backlight(int value)
322{
323 DEBUGF("remote backlight: %s\n", (value > 0) ? "on" : "off");
324}
325#endif
326
diff --git a/uisimulator/win32/sound.c b/uisimulator/win32/sound.c
index 02a5a888d9..54140f59e4 100644
--- a/uisimulator/win32/sound.c
+++ b/uisimulator/win32/sound.c
@@ -33,6 +33,8 @@
33#include "thread-win32.h" 33#include "thread-win32.h"
34#include "debug.h" 34#include "debug.h"
35 35
36static bool playing = false;
37
36void pcm_play_stop(void); 38void pcm_play_stop(void);
37 39
38static void sound_play_chunk(HWAVEOUT wave_out, LPWAVEHDR header, 40static void sound_play_chunk(HWAVEOUT wave_out, LPWAVEHDR header,
@@ -152,4 +154,48 @@ void sound_playback_thread(void)
152 } 154 }
153} 155}
154 156
157
158/* Stubs for PCM audio playback. */
159bool pcm_is_playing(void)
160{
161 return playing;
162}
163
164void pcm_mute(bool state)
165{
166 (void)state;
167}
168
169void pcm_play_pause(bool state)
170{
171 (void)state;
172}
173
174bool pcm_is_paused(void)
175{
176 return false;
177}
178
179void pcm_play_stop(void)
180{
181 playing = false;
182}
183
184void pcm_init(void)
185{
186}
187
188void (*sound_get_pcm)(unsigned char** start, long* size);
189void pcm_play_data(void (*get_more)(unsigned char** start, long* size))
190{
191 sound_get_pcm = get_more;
192 playing = true;
193}
194
195long pcm_get_bytes_waiting(void)
196{
197 return 0;
198}
199
200
155#endif /* ROCKBOX_HAS_SIMSOUND */ 201#endif /* ROCKBOX_HAS_SIMSOUND */
diff --git a/uisimulator/x11/lcd-x11.c b/uisimulator/x11/lcd-x11.c
index 0a3b40e163..c85848c18b 100644
--- a/uisimulator/x11/lcd-x11.c
+++ b/uisimulator/x11/lcd-x11.c
@@ -32,6 +32,7 @@
32 32
33#include "screenhack.h" 33#include "screenhack.h"
34#include "config.h" 34#include "config.h"
35#include "debug.h"
35 36
36/* 37/*
37 * Specific implementations for X11, using the generic LCD API and data. 38 * Specific implementations for X11, using the generic LCD API and data.
@@ -244,3 +245,18 @@ void lcd_update (void)
244} 245}
245 246
246#endif 247#endif
248
249#ifdef CONFIG_BACKLIGHT
250void sim_backlight(int value)
251{
252 DEBUGF("backlight: %s\n", (value > 0) ? "on" : "off");
253}
254#endif
255
256#ifdef HAVE_REMOTE_LCD
257void sim_remote_backlight(int value)
258{
259 DEBUGF("remote backlight: %s\n", (value > 0) ? "on" : "off");
260}
261#endif
262
diff --git a/uisimulator/x11/sound.c b/uisimulator/x11/sound.c
index dd875e41f5..06d9c014ff 100644
--- a/uisimulator/x11/sound.c
+++ b/uisimulator/x11/sound.c
@@ -21,6 +21,7 @@
21 21
22#ifdef ROCKBOX_HAS_SIMSOUND /* play sound in sim enabled */ 22#ifdef ROCKBOX_HAS_SIMSOUND /* play sound in sim enabled */
23 23
24#include <stdbool.h>
24#include <stdio.h> 25#include <stdio.h>
25#include <stdlib.h> 26#include <stdlib.h>
26#include <unistd.h> 27#include <unistd.h>
@@ -31,6 +32,8 @@
31 32
32#include "sound.h" 33#include "sound.h"
33 34
35static bool playing = false;
36
34int sim_sound_init(void) 37int sim_sound_init(void)
35{ 38{
36 int fd; 39 int fd;
@@ -92,4 +95,46 @@ void sound_playback_thread(void)
92 95
93} 96}
94 97
98/* Stubs for PCM audio playback. */
99bool pcm_is_playing(void)
100{
101 return playing;
102}
103
104void pcm_mute(bool state)
105{
106 (void)state;
107}
108
109void pcm_play_pause(bool state)
110{
111 (void)state;
112}
113
114bool pcm_is_paused(void)
115{
116 return false;
117}
118
119void pcm_play_stop(void)
120{
121 playing = false;
122}
123
124void pcm_init(void)
125{
126}
127
128void (*sound_get_pcm)(unsigned char** start, long* size);
129void pcm_play_data(void (*get_more)(unsigned char** start, long* size))
130{
131 sound_get_pcm = get_more;
132 playing = true;
133}
134
135long pcm_get_bytes_waiting(void)
136{
137 return 0;
138}
139
95#endif /* ROCKBOX_HAS_SIMSOUND */ 140#endif /* ROCKBOX_HAS_SIMSOUND */