What lines are missing?
alehbeer

Feel free to upload a working project folder. I bet I could get it working if I saw one. This is probably the best and easiest way to help if you can. please & thanks

This is directly out of the allegro5.1.5.tar.gz from http://sourceforge.net/projects/alleg/files/allegro-unstable/5.1.5/

How would this be modified to run an audio file of ANY type located in the asset directory? I am assuming the code is different for android than windows.

#SelectExpand
1#include <allegro5/allegro.h> 2#include <allegro5/allegro_image.h> 3#include <allegro5/allegro_primitives.h> 4#include <allegro5/allegro_android.h> /* al_android_set_apk_file_interface */ 5 6ALLEGRO_DEBUG_CHANNEL("main") 7 8#define MAX_TOUCH 10 9 10struct touch { 11 bool down; 12 double x, y; 13} touch[MAX_TOUCH]; 14 15/* debugging */ 16#define print_standard_path(std) \ 17 do { \ 18 ALLEGRO_PATH *path = al_get_standard_path(std); \ 19 ALLEGRO_DEBUG(#std ": %s", al_path_cstr(path, '/')); \ 20 } while (0) 21 22static void print_standard_paths(void) 23{ 24 print_standard_path(ALLEGRO_RESOURCES_PATH); 25 print_standard_path(ALLEGRO_TEMP_PATH); 26 print_standard_path(ALLEGRO_USER_DATA_PATH); 27 print_standard_path(ALLEGRO_USER_HOME_PATH); 28 print_standard_path(ALLEGRO_USER_SETTINGS_PATH); 29 print_standard_path(ALLEGRO_USER_DOCUMENTS_PATH); 30 print_standard_path(ALLEGRO_EXENAME_PATH); 31} 32 33static void set_transform(ALLEGRO_DISPLAY *dpy) 34{ 35 ALLEGRO_TRANSFORM t; 36 int w = al_get_display_width(dpy); 37 int h = al_get_display_height(dpy); 38 39 // XXX we shouldn't need this in user code 40 // glViewport(0, 0, w, h); 41 42 al_identity_transform(&t); 43 al_ortho_transform(&t, 0, w, h, 0, -1, 1); 44 al_set_projection_transform(dpy, &t); 45} 46 47static void draw_touches(void) 48{ 49 int i; 50 51 for (i = 0; i < MAX_TOUCH; i++) { 52 if (touch[i].down) { 53 al_draw_filled_rectangle( 54 touch[i].x-40, touch[i].y-40, 55 touch[i].x+40, touch[i].y+40, 56 al_map_rgb(100+i*20, 40+i*20, 40+i*20)); 57 } 58 } 59} 60 61int main(int argc, char **argv) 62{ 63 ALLEGRO_DISPLAY *dpy; 64 ALLEGRO_EVENT_QUEUE *queue; 65 ALLEGRO_EVENT event; 66 ALLEGRO_TIMER *timer; 67 ALLEGRO_BITMAP *image; 68 69 (void) argc; 70 (void) argv; 71 72 ALLEGRO_DEBUG("init allegro!"); 73 if (!al_init()) { 74 return 1; 75 } 76 77 ALLEGRO_DEBUG("init primitives"); 78 al_init_primitives_addon(); 79 80 ALLEGRO_DEBUG("init image addon"); 81 al_init_image_addon(); 82 83 ALLEGRO_DEBUG("init touch input"); 84 al_install_touch_input(); 85 86 ALLEGRO_DEBUG("init keyboard"); 87 al_install_keyboard(); 88 89 ALLEGRO_DEBUG("creating display"); 90 dpy = al_create_display(800, 480); 91 if (!dpy) { 92 ALLEGRO_ERROR("failed to create display!"); 93 return 1; 94 } 95 96 print_standard_paths(); 97 98 /* This is loaded from assets in the apk. */ 99 al_android_set_apk_file_interface(); 100 image = al_load_bitmap("alexlogo.png"); 101 if (!image) { 102 ALLEGRO_DEBUG("failed to load alexlogo.png"); 103 return 1; 104 } 105 al_set_standard_file_interface(); 106 107 al_convert_mask_to_alpha(image, al_map_rgb(255,0,255)); 108 109 queue = al_create_event_queue(); 110 al_register_event_source(queue, al_get_display_event_source(dpy)); 111 al_register_event_source(queue, al_get_touch_input_event_source()); 112 al_register_event_source(queue, al_get_keyboard_event_source()); 113 114 timer = al_create_timer(1/60.0); 115 al_register_event_source(queue, al_get_timer_event_source(timer)); 116 al_start_timer(timer); 117 118 bool draw = true; 119 bool running = true; 120 bool paused = false; 121 int count = 0; 122 123 while (running) { 124 al_wait_for_event(queue, &event); 125 126 switch (event.type) { 127 case ALLEGRO_EVENT_TOUCH_BEGIN: 128 //ALLEGRO_DEBUG("touch %i begin", event.touch.id); 129 touch[event.touch.id].down = true; 130 touch[event.touch.id].x = event.touch.x; 131 touch[event.touch.id].y = event.touch.y; 132 break; 133 134 case ALLEGRO_EVENT_TOUCH_END: 135 //ALLEGRO_DEBUG("touch %i end", event.touch.id); 136 touch[event.touch.id].down = false; 137 touch[event.touch.id].x = 0.0; 138 touch[event.touch.id].y = 0.0; 139 break; 140 141 case ALLEGRO_EVENT_TOUCH_MOVE: 142 //ALLEGRO_DEBUG("touch %i move: %fx%f", event.touch.id, event.touch.x, event.touch.y); 143 touch[event.touch.id].x = event.touch.x; 144 touch[event.touch.id].y = event.touch.y; 145 break; 146 147 case ALLEGRO_EVENT_TOUCH_CANCEL: 148 //ALLEGRO_DEBUG("touch %i canceled", event.touch.id); 149 break; 150 151 case ALLEGRO_EVENT_KEY_UP: 152 if (event.keyboard.keycode == ALLEGRO_KEY_BACK) { 153 ALLEGRO_DEBUG("back key pressed, exit!"); 154 running = false; 155 } 156 else { 157 ALLEGRO_DEBUG("%i key pressed", event.keyboard.keycode); 158 } 159 break; 160 161 case ALLEGRO_EVENT_TIMER: 162 draw = true; 163 if (count == 60) { 164 ALLEGRO_DEBUG("tick"); 165 count = 0; 166 } 167 count++; 168 break; 169 170 case ALLEGRO_EVENT_DISPLAY_CLOSE: 171 ALLEGRO_DEBUG("display close"); 172 running = false; 173 break; 174 175 case ALLEGRO_EVENT_DISPLAY_HALT_DRAWING: 176 ALLEGRO_DEBUG("halt drawing"); 177 // Stop the timer so we don't run at all while our display isn't 178 // active. 179 al_stop_timer(timer); 180 //al_set_target_backbuffer(0); 181 ALLEGRO_DEBUG("after set target"); 182 paused = true; 183 draw = false; 184 al_acknowledge_drawing_halt(dpy); 185 break; 186 187 case ALLEGRO_EVENT_DISPLAY_RESUME_DRAWING: 188 ALLEGRO_DEBUG("resume drawing"); 189 190 al_acknowledge_drawing_resume(dpy, NULL); 191 ALLEGRO_DEBUG("done waiting for surface recreated"); 192 193 al_start_timer(timer); 194 //al_set_target_backbuffer(dpy); 195 //_al_android_setup_opengl_view(dpy); 196 paused = false; 197 break; 198 199 case ALLEGRO_EVENT_DISPLAY_RESIZE: 200 ALLEGRO_DEBUG("display resize"); 201 al_acknowledge_resize(dpy); 202 ALLEGRO_DEBUG("done resize"); 203 set_transform(dpy); 204 break; 205 206 case ALLEGRO_EVENT_DISPLAY_ORIENTATION: 207 set_transform(dpy); 208 break; 209 } 210 211 if (draw && al_event_queue_is_empty(queue)) { 212 draw = false; 213 al_clear_to_color(al_map_rgb(255, 255, 255)); 214 if (image) { 215 al_draw_bitmap(image, 216 al_get_display_width(dpy)/2 - al_get_bitmap_width(image)/2, 217 al_get_display_height(dpy)/2 - al_get_bitmap_height(image)/2, 218 0); 219 } 220 draw_touches(); 221 al_flip_display(); 222 } 223 } 224 225 ALLEGRO_DEBUG("done"); 226 return 0; 227} 228 229/* vim: set sts=3 sw=3 et: */

Thanks.

Eric Johnson

Hi there.

Firstly, you need to establish the necessary includes.

#include <allegro5/allegro_audio.h>
#include <allegro5/allegro_acoded.h>

Then, you'll need to initialize them.

alehbeer

Ok, so in theory, this should work, right?:

additions at lines 4,102,149, and 277.

#SelectExpand
1#include <allegro5/allegro.h> 2#include <allegro5/allegro_image.h> 3#include <allegro5/allegro_primitives.h> 4//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 5//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 6//////////////////////////////////////////////////////////////////////// 7 8 9#include <allegro5/allegro_audio.h> 10#include <allegro5/allegro_acodec.h> 11 12 13//////////////////////////////////////////////////////////////////////// 14//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 15//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 16#include <allegro5/allegro_android.h> /* al_android_set_apk_file_interface */ 17 18ALLEGRO_DEBUG_CHANNEL("main") 19 20#define MAX_TOUCH 10 21 22struct touch { 23 bool down; 24 double x, y; 25} touch[MAX_TOUCH]; 26 27/* debugging */ 28#define print_standard_path(std) \ 29 do { \ 30 ALLEGRO_PATH *path = al_get_standard_path(std); \ 31 ALLEGRO_DEBUG(#std ": %s", al_path_cstr(path, '/')); \ 32 } while (0) 33 34static void print_standard_paths(void) 35{ 36 print_standard_path(ALLEGRO_RESOURCES_PATH); 37 print_standard_path(ALLEGRO_TEMP_PATH); 38 print_standard_path(ALLEGRO_USER_DATA_PATH); 39 print_standard_path(ALLEGRO_USER_HOME_PATH); 40 print_standard_path(ALLEGRO_USER_SETTINGS_PATH); 41 print_standard_path(ALLEGRO_USER_DOCUMENTS_PATH); 42 print_standard_path(ALLEGRO_EXENAME_PATH); 43} 44 45static void set_transform(ALLEGRO_DISPLAY *dpy) 46{ 47 ALLEGRO_TRANSFORM t; 48 int w = al_get_display_width(dpy); 49 int h = al_get_display_height(dpy); 50 51 // XXX we shouldn't need this in user code 52 // glViewport(0, 0, w, h); 53 54 al_identity_transform(&t); 55 al_ortho_transform(&t, 0, w, h, 0, -1, 1); 56 al_set_projection_transform(dpy, &t); 57} 58 59static void draw_touches(void) 60{ 61 int i; 62 63 for (i = 0; i < MAX_TOUCH; i++) { 64 if (touch[i].down) { 65 al_draw_filled_rectangle( 66 touch[i].x-40, touch[i].y-40, 67 touch[i].x+40, touch[i].y+40, 68 al_map_rgb(100+i*20, 40+i*20, 40+i*20)); 69 } 70 } 71} 72 73int main(int argc, char **argv) 74{ 75 ALLEGRO_DISPLAY *dpy; 76 ALLEGRO_EVENT_QUEUE *queue; 77 ALLEGRO_EVENT event; 78 ALLEGRO_TIMER *timer; 79 ALLEGRO_BITMAP *image; 80 81 (void) argc; 82 (void) argv; 83 84 ALLEGRO_DEBUG("init allegro!"); 85 if (!al_init()) { 86 return 1; 87 } 88 89 ALLEGRO_DEBUG("init primitives"); 90 al_init_primitives_addon(); 91 92 ALLEGRO_DEBUG("init image addon"); 93 al_init_image_addon(); 94 95 ALLEGRO_DEBUG("init touch input"); 96 al_install_touch_input(); 97 98 ALLEGRO_DEBUG("init keyboard"); 99 al_install_keyboard(); 100 101 102//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 103//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 104 105 106al_install_audio(); 107al_init_acodec_addon(); 108 109 110//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 111//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 112 113 114 ALLEGRO_DEBUG("creating display"); 115 dpy = al_create_display(800, 480); 116 if (!dpy) { 117 ALLEGRO_ERROR("failed to create display!"); 118 return 1; 119 } 120 121 print_standard_paths(); 122 123 /* This is loaded from assets in the apk. */ 124 al_android_set_apk_file_interface(); 125 image = al_load_bitmap("alexlogo.png"); 126 if (!image) { 127 ALLEGRO_DEBUG("failed to load alexlogo.png"); 128 return 1; 129 } 130 al_set_standard_file_interface(); 131 132 al_convert_mask_to_alpha(image, al_map_rgb(255,0,255)); 133 134 queue = al_create_event_queue(); 135 al_register_event_source(queue, al_get_display_event_source(dpy)); 136 al_register_event_source(queue, al_get_touch_input_event_source()); 137 al_register_event_source(queue, al_get_keyboard_event_source()); 138 139 timer = al_create_timer(1/60.0); 140 al_register_event_source(queue, al_get_timer_event_source(timer)); 141 al_start_timer(timer); 142 143 bool draw = true; 144 bool running = true; 145 bool paused = false; 146 int count = 0; 147 148 149//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 150//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 151//////////////////////////////////////////////////////////////////////// 152 153ALLEGRO_SAMPLE *sample=NULL; 154if (!al_reserve_samples(1)){ 155 fprintf(stderr, "failed to reserve samples!\n"); 156 return -1; 157} 158 159sample = al_load_sample( "footstep.wav" ); 160 161if (!sample){ 162 printf( "Audio clip sample not loaded!\n" ); 163 return -1; 164} 165 166/* Loop the sample until the display closes. */ 167al_play_sample(sample, 1.0, 0.0,1.0,ALLEGRO_PLAYMODE_LOOP,NULL); 168//////////////////////////////////////////////////////////////////////// 169//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 170//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 171 172 173 while (running) { 174 al_wait_for_event(queue, &event); 175 176 switch (event.type) { 177 case ALLEGRO_EVENT_TOUCH_BEGIN: 178 //ALLEGRO_DEBUG("touch %i begin", event.touch.id); 179 touch[event.touch.id].down = true; 180 touch[event.touch.id].x = event.touch.x; 181 touch[event.touch.id].y = event.touch.y; 182 break; 183 184 case ALLEGRO_EVENT_TOUCH_END: 185 //ALLEGRO_DEBUG("touch %i end", event.touch.id); 186 touch[event.touch.id].down = false; 187 touch[event.touch.id].x = 0.0; 188 touch[event.touch.id].y = 0.0; 189 break; 190 191 case ALLEGRO_EVENT_TOUCH_MOVE: 192 //ALLEGRO_DEBUG("touch %i move: %fx%f", event.touch.id, event.touch.x, event.touch.y); 193 touch[event.touch.id].x = event.touch.x; 194 touch[event.touch.id].y = event.touch.y; 195 break; 196 197 case ALLEGRO_EVENT_TOUCH_CANCEL: 198 //ALLEGRO_DEBUG("touch %i canceled", event.touch.id); 199 break; 200 201 case ALLEGRO_EVENT_KEY_UP: 202 if (event.keyboard.keycode == ALLEGRO_KEY_BACK) { 203 ALLEGRO_DEBUG("back key pressed, exit!"); 204 running = false; 205 } 206 else { 207 ALLEGRO_DEBUG("%i key pressed", event.keyboard.keycode); 208 } 209 break; 210 211 case ALLEGRO_EVENT_TIMER: 212 draw = true; 213 if (count == 60) { 214 ALLEGRO_DEBUG("tick"); 215 count = 0; 216 } 217 count++; 218 break; 219 220 case ALLEGRO_EVENT_DISPLAY_CLOSE: 221 ALLEGRO_DEBUG("display close"); 222 running = false; 223 break; 224 225 case ALLEGRO_EVENT_DISPLAY_HALT_DRAWING: 226 ALLEGRO_DEBUG("halt drawing"); 227 // Stop the timer so we don't run at all while our display isn't 228 // active. 229 al_stop_timer(timer); 230 //al_set_target_backbuffer(0); 231 ALLEGRO_DEBUG("after set target"); 232 paused = true; 233 draw = false; 234 al_acknowledge_drawing_halt(dpy); 235 break; 236 237 case ALLEGRO_EVENT_DISPLAY_RESUME_DRAWING: 238 ALLEGRO_DEBUG("resume drawing"); 239 240 al_acknowledge_drawing_resume(dpy, NULL); 241 ALLEGRO_DEBUG("done waiting for surface recreated"); 242 243 al_start_timer(timer); 244 //al_set_target_backbuffer(dpy); 245 //_al_android_setup_opengl_view(dpy); 246 paused = false; 247 break; 248 249 case ALLEGRO_EVENT_DISPLAY_RESIZE: 250 ALLEGRO_DEBUG("display resize"); 251 al_acknowledge_resize(dpy); 252 ALLEGRO_DEBUG("done resize"); 253 set_transform(dpy); 254 break; 255 256 case ALLEGRO_EVENT_DISPLAY_ORIENTATION: 257 set_transform(dpy); 258 break; 259 } 260 261 if (draw && al_event_queue_is_empty(queue)) { 262 draw = false; 263 al_clear_to_color(al_map_rgb(255, 255, 255)); 264 if (image) { 265 al_draw_bitmap(image, 266 al_get_display_width(dpy)/2 - al_get_bitmap_width(image)/2, 267 al_get_display_height(dpy)/2 - al_get_bitmap_height(image)/2, 268 0); 269 } 270 draw_touches(); 271 al_flip_display(); 272 } 273 } 274 275 ALLEGRO_DEBUG("done"); 276 277//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 278//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 279//////////////////////////////////////////////////////////////////////// 280 281 282al_destroy_sample(sample); 283 284 285//////////////////////////////////////////////////////////////////////// 286//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 287//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 288 289 290 return 0; 291} 292 293/* vim: set sts=3 sw=3 et: */

Eric Johnson

So far so good.

I suggest checking out Allegro 5's manual for audio routines.
Here is a good start.

alehbeer

I have attached a project folder. Change the "#sdk.dir=~/android-sdk-linux" (line 10) in the file "local.properties" to match your setup.

Ok, after 1) fixing allegro_coded.h to *codec.h
2) rebuilding allegro5.1.5
3) copying the includes and libs to every folder I can imagine it pullling from
4) adding a local.properties file with a correct "sdk.dir=/home/user/sdk" in it.
It seems to compile, and upload fine, but when run the program crashes. adb logcat gives info such as "Cannot load library: reloc_library[1290]: 102 cannot locate 'al_reserve_samples'..." then the program crashes although it seems to still be running in memory.

Feel free to upload a working project folder. I bet I could get it working if I saw one.

Update

after fixing the AllegroApp java part and mk files, and using this:

#SelectExpand
1#include <allegro5/allegro.h> 2#include <allegro5/allegro_image.h> 3#include <allegro5/allegro_primitives.h> 4//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 5//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 6//////////////////////////////////////////////////////////////////////// 7 8 9#include <allegro5/allegro_audio.h> 10#include <allegro5/allegro_acodec.h> 11 12 13//////////////////////////////////////////////////////////////////////// 14//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 15//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 16#include <allegro5/allegro_android.h> /* al_android_set_apk_file_interface */ 17 18ALLEGRO_DEBUG_CHANNEL("main") 19 20#define MAX_TOUCH 10 21 22struct touch { 23 bool down; 24 double x, y; 25} touch[MAX_TOUCH]; 26 27/* debugging */ 28#define print_standard_path(std) \ 29 do { \ 30 ALLEGRO_PATH *path = al_get_standard_path(std); \ 31 ALLEGRO_DEBUG(#std ": %s", al_path_cstr(path, '/')); \ 32 } while (0) 33 34static void print_standard_paths(void) 35{ 36 print_standard_path(ALLEGRO_RESOURCES_PATH); 37 print_standard_path(ALLEGRO_TEMP_PATH); 38 print_standard_path(ALLEGRO_USER_DATA_PATH); 39 print_standard_path(ALLEGRO_USER_HOME_PATH); 40 print_standard_path(ALLEGRO_USER_SETTINGS_PATH); 41 print_standard_path(ALLEGRO_USER_DOCUMENTS_PATH); 42 print_standard_path(ALLEGRO_EXENAME_PATH); 43} 44 45static void set_transform(ALLEGRO_DISPLAY *dpy) 46{ 47 ALLEGRO_TRANSFORM t; 48 int w = al_get_display_width(dpy); 49 int h = al_get_display_height(dpy); 50 51 // XXX we shouldn't need this in user code 52 // glViewport(0, 0, w, h); 53 54 al_identity_transform(&t); 55 al_ortho_transform(&t, 0, w, h, 0, -1, 1); 56 al_set_projection_transform(dpy, &t); 57} 58 59static void draw_touches(void) 60{ 61 int i; 62 63 for (i = 0; i < MAX_TOUCH; i++) { 64 if (touch[i].down) { 65 al_draw_filled_rectangle( 66 touch[i].x-40, touch[i].y-40, 67 touch[i].x+40, touch[i].y+40, 68 al_map_rgb(100+i*20, 40+i*20, 40+i*20)); 69 } 70 } 71} 72 73int main(int argc, char **argv) 74{ 75 ALLEGRO_DISPLAY *dpy; 76 ALLEGRO_EVENT_QUEUE *queue; 77 ALLEGRO_EVENT event; 78 ALLEGRO_TIMER *timer; 79 ALLEGRO_BITMAP *image; 80 81 (void) argc; 82 (void) argv; 83 84 ALLEGRO_DEBUG("init allegro!"); 85 if (!al_init()) { 86 return 1; 87 } 88 89 ALLEGRO_DEBUG("init primitives"); 90 al_init_primitives_addon(); 91 92 ALLEGRO_DEBUG("init image addon"); 93 al_init_image_addon(); 94 95 ALLEGRO_DEBUG("init touch input"); 96 al_install_touch_input(); 97 98 ALLEGRO_DEBUG("init keyboard"); 99 al_install_keyboard(); 100 101 102//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 103//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 104 105 106al_install_audio(); 107al_init_acodec_addon(); 108 109 110//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 111//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 112 113 114 ALLEGRO_DEBUG("creating display"); 115 dpy = al_create_display(800, 480); 116 if (!dpy) { 117 ALLEGRO_ERROR("failed to create display!"); 118 return 1; 119 } 120 121 print_standard_paths(); 122 123 /* This is loaded from assets in the apk. */ 124 al_android_set_apk_file_interface(); 125 image = al_load_bitmap("alexlogo.png"); 126 if (!image) { 127 ALLEGRO_DEBUG("failed to load alexlogo.png"); 128 return 1; 129 } 130 al_set_standard_file_interface(); 131 132 al_convert_mask_to_alpha(image, al_map_rgb(255,0,255)); 133 134 queue = al_create_event_queue(); 135 al_register_event_source(queue, al_get_display_event_source(dpy)); 136 al_register_event_source(queue, al_get_touch_input_event_source()); 137 al_register_event_source(queue, al_get_keyboard_event_source()); 138 139 timer = al_create_timer(1/60.0); 140 al_register_event_source(queue, al_get_timer_event_source(timer)); 141 al_start_timer(timer); 142 143 bool draw = true; 144 bool running = true; 145 bool paused = false; 146 int count = 0; 147 148 149//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 150//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 151//////////////////////////////////////////////////////////////////////// 152 153ALLEGRO_SAMPLE *sample=NULL; 154 155 156sample = al_load_sample( "song.wav" ); 157 158 159if (!al_reserve_samples(1)){ 160 ALLEGRO_DEBUG("failed to reserve samples!\n"); 161 //return -1; 162} 163 164if (!sample){ 165 ALLEGRO_DEBUG("Audio clip sample not loaded!\n"); 166 //return -1; 167} 168 169/* Loop the sample until the display closes. */ 170al_play_sample(sample, 1.0, 0.0,1.0,ALLEGRO_PLAYMODE_LOOP,NULL); 171//////////////////////////////////////////////////////////////////////// 172//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 173//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 174 175 176 while (running) { 177 al_wait_for_event(queue, &event); 178 179 switch (event.type) { 180 case ALLEGRO_EVENT_TOUCH_BEGIN: 181 //ALLEGRO_DEBUG("touch %i begin", event.touch.id); 182 touch[event.touch.id].down = true; 183 touch[event.touch.id].x = event.touch.x; 184 touch[event.touch.id].y = event.touch.y; 185 break; 186 187 case ALLEGRO_EVENT_TOUCH_END: 188 //ALLEGRO_DEBUG("touch %i end", event.touch.id); 189 touch[event.touch.id].down = false; 190 touch[event.touch.id].x = 0.0; 191 touch[event.touch.id].y = 0.0; 192 break; 193 194 case ALLEGRO_EVENT_TOUCH_MOVE: 195 //ALLEGRO_DEBUG("touch %i move: %fx%f", event.touch.id, event.touch.x, event.touch.y); 196 touch[event.touch.id].x = event.touch.x; 197 touch[event.touch.id].y = event.touch.y; 198 break; 199 200 case ALLEGRO_EVENT_TOUCH_CANCEL: 201 //ALLEGRO_DEBUG("touch %i canceled", event.touch.id); 202 break; 203 204 case ALLEGRO_EVENT_KEY_UP: 205 if (event.keyboard.keycode == ALLEGRO_KEY_BACK) { 206 ALLEGRO_DEBUG("back key pressed, exit!"); 207 running = false; 208 } 209 else { 210 ALLEGRO_DEBUG("%i key pressed", event.keyboard.keycode); 211 } 212 break; 213 214 case ALLEGRO_EVENT_TIMER: 215 draw = true; 216 if (count == 60) { 217 ALLEGRO_DEBUG("tick"); 218 count = 0; 219 } 220 count++; 221 break; 222 223 case ALLEGRO_EVENT_DISPLAY_CLOSE: 224 ALLEGRO_DEBUG("display close"); 225 running = false; 226 break; 227 228 case ALLEGRO_EVENT_DISPLAY_HALT_DRAWING: 229 ALLEGRO_DEBUG("halt drawing"); 230 // Stop the timer so we don't run at all while our display isn't 231 // active. 232 al_stop_timer(timer); 233 //al_set_target_backbuffer(0); 234 ALLEGRO_DEBUG("after set target"); 235 paused = true; 236 draw = false; 237 al_acknowledge_drawing_halt(dpy); 238 break; 239 240 case ALLEGRO_EVENT_DISPLAY_RESUME_DRAWING: 241 ALLEGRO_DEBUG("resume drawing"); 242 243 al_acknowledge_drawing_resume(dpy, NULL); 244 ALLEGRO_DEBUG("done waiting for surface recreated"); 245 246 al_start_timer(timer); 247 //al_set_target_backbuffer(dpy); 248 //_al_android_setup_opengl_view(dpy); 249 paused = false; 250 break; 251 252 case ALLEGRO_EVENT_DISPLAY_RESIZE: 253 ALLEGRO_DEBUG("display resize"); 254 al_acknowledge_resize(dpy); 255 ALLEGRO_DEBUG("done resize"); 256 set_transform(dpy); 257 break; 258 259 case ALLEGRO_EVENT_DISPLAY_ORIENTATION: 260 set_transform(dpy); 261 break; 262 } 263 264 if (draw && al_event_queue_is_empty(queue)) { 265 draw = false; 266 al_clear_to_color(al_map_rgb(255, 255, 255)); 267 if (image) { 268 al_draw_bitmap(image, 269 al_get_display_width(dpy)/2 - al_get_bitmap_width(image)/2, 270 al_get_display_height(dpy)/2 - al_get_bitmap_height(image)/2, 271 0); 272 } 273 draw_touches(); 274 al_flip_display(); 275 } 276 } 277 278 ALLEGRO_DEBUG("done"); 279 280//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 281//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 282//////////////////////////////////////////////////////////////////////// 283 284 285al_destroy_sample(sample); 286 287 288//////////////////////////////////////////////////////////////////////// 289//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 290//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 291 292 293 return 0; 294} 295 296/* vim: set sts=3 sw=3 et: */

With output from " $ adb logcat | grep llegro " of:

#SelectExpand
1 2I/ActivityManager( 204): Start proc org.liballeg.app for activity org.liballeg.app/.AllegroActivity: pid=20245 uid=10151 gids={1015} 3D/dalvikvm(20245): Trying to load lib /data/data/org.liballeg.app/lib/liballegro-debug.so 0x40d6b240 4D/dalvikvm(20245): Added shared lib /data/data/org.liballeg.app/lib/liballegro-debug.so 0x40d6b240 5D/dalvikvm(20245): Trying to load lib /data/data/org.liballeg.app/lib/liballegro_primitives-debug.so 0x40d6b240 6D/dalvikvm(20245): Added shared lib /data/data/org.liballeg.app/lib/liballegro_primitives-debug.so 0x40d6b240 7D/dalvikvm(20245): No JNI_OnLoad found in /data/data/org.liballeg.app/lib/liballegro_primitives-debug.so 0x40d6b240, skipping init 8D/dalvikvm(20245): Trying to load lib /data/data/org.liballeg.app/lib/liballegro_image-debug.so 0x40d6b240 9D/dalvikvm(20245): Added shared lib /data/data/org.liballeg.app/lib/liballegro_image-debug.so 0x40d6b240 10D/dalvikvm(20245): No JNI_OnLoad found in /data/data/org.liballeg.app/lib/liballegro_image-debug.so 0x40d6b240, skipping init 11D/dalvikvm(20245): Trying to load lib /data/data/org.liballeg.app/lib/liballegro_audio-debug.so 0x40d6b240 12D/dalvikvm(20245): Added shared lib /data/data/org.liballeg.app/lib/liballegro_audio-debug.so 0x40d6b240 13D/dalvikvm(20245): No JNI_OnLoad found in /data/data/org.liballeg.app/lib/liballegro_audio-debug.so 0x40d6b240, skipping init 14D/dalvikvm(20245): Trying to load lib /data/data/org.liballeg.app/lib/liballegro_acodec-debug.so 0x40d6b240 15D/dalvikvm(20245): Added shared lib /data/data/org.liballeg.app/lib/liballegro_acodec-debug.so 0x40d6b240 16D/dalvikvm(20245): No JNI_OnLoad found in /data/data/org.liballeg.app/lib/liballegro_acodec-debug.so 0x40d6b240, skipping init 17D/AllegroActivity(20245): onCreate 18D/AllegroActivity(20245): Files Dir: /data/data/org.liballeg.app/files 19D/AllegroActivity(20245): External Storage Dir: /mnt/sdcard 20D/AllegroActivity(20245): External Files Dir: /mnt/sdcard/Android/data/org.liballeg.app/files 21D/AllegroActivity(20245): external: avail = true writable = true 22D/AllegroActivity(20245): sourceDir: /data/app/org.liballeg.app-1.apk 23D/AllegroActivity(20245): publicSourceDir: /data/app/org.liballeg.app-1.apk 24D/AllegroActivity(20245): before nativeOnCreate 25I/allegro (20245): android D 20245: android_system.c:194 Java_org_liballeg_app_AllegroActivity_nativeOnCreate [ 0.00000] entered nativeOnCreate 26I/allegro (20245): android D 20245: android_system.c:202 Java_org_liballeg_app_AllegroActivity_nativeOnCreate [ 0.00000] pthread_self:0x401364c8 27I/allegro (20245): android D 20245: android_system.c:203 Java_org_liballeg_app_AllegroActivity_nativeOnCreate [ 0.00000] nativeOnCreate begin 28I/allegro (20245): android D 20245: android_system.c:207 Java_org_liballeg_app_AllegroActivity_nativeOnCreate [ 0.00000] grab activity global refs 29I/allegro (20245): android D 20245: android_system.c:220 Java_org_liballeg_app_AllegroActivity_nativeOnCreate [ 0.00000] create mutex and cond objects 30I/allegro (20245): android D 20245: android_system.c:224 Java_org_liballeg_app_AllegroActivity_nativeOnCreate [ 0.00000] get directories 31I/allegro (20245): android D 20245: android_system.c:230 Java_org_liballeg_app_AllegroActivity_nativeOnCreate [ 0.00000] lib_dir: /data/data/org.liballeg.app/lib 32I/allegro (20245): android D 20245: android_system.c:231 Java_org_liballeg_app_AllegroActivity_nativeOnCreate [ 0.00000] app_name: allegro-example 33I/allegro (20245): android D 20245: android_system.c:232 Java_org_liballeg_app_AllegroActivity_nativeOnCreate [ 0.00000] resources_dir: /data/data/org.liballeg.app/files 34I/allegro (20245): android D 20245: android_system.c:233 Java_org_liballeg_app_AllegroActivity_nativeOnCreate [ 0.00000] data_dir: /mnt/sdcard/Android/data/org.liballeg.app/files 35I/allegro (20245): android D 20245: android_system.c:234 Java_org_liballeg_app_AllegroActivity_nativeOnCreate [ 0.00000] apk_path: /data/app/org.liballeg.app-1.apk 36I/allegro (20245): android D 20245: android_system.c:236 Java_org_liballeg_app_AllegroActivity_nativeOnCreate [ 0.00000] creating ALLEGRO_SYSTEM_ANDROID struct 37I/allegro (20245): android D 20245: android_system.c:240 Java_org_liballeg_app_AllegroActivity_nativeOnCreate [ 0.00000] get system pointer 38I/allegro (20245): android D 20245: android_system.c:242 Java_org_liballeg_app_AllegroActivity_nativeOnCreate [ 0.00000] get system interface 39I/allegro (20245): android D 20245: android_system.c:245 Java_org_liballeg_app_AllegroActivity_nativeOnCreate [ 0.00000] init display vector 40I/allegro (20245): android D 20245: android_system.c:248 Java_org_liballeg_app_AllegroActivity_nativeOnCreate [ 0.00000] init time 41I/allegro (20245): android D 20245: android_system.c:251 Java_org_liballeg_app_AllegroActivity_nativeOnCreate [ 0.00015] strdup app_name 42I/allegro (20245): android D 20245: android_system.c:270 Java_org_liballeg_app_AllegroActivity_nativeOnCreate [ 0.00085] load user lib: /data/data/org.liballeg.app/lib/liballegro-example.so 43I/allegro (20245): android D 20245: android_system.c:278 Java_org_liballeg_app_AllegroActivity_nativeOnCreate [ 0.00369] grab user main 44I/allegro (20245): android D 20245: android_system.c:286 Java_org_liballeg_app_AllegroActivity_nativeOnCreate [ 0.00415] creating trampoline for app thread 45I/allegro (20245): android D 20245: android_system.c:290 Java_org_liballeg_app_AllegroActivity_nativeOnCreate [ 0.00488] waiting for app trampoline to signal running 46I/allegro (20245): android D 20258: android_system.c:145 android_app_trampoline [ 0.00558] signaling running 47I/allegro (20245): android D 20245: android_system.c:297 Java_org_liballeg_app_AllegroActivity_nativeOnCreate [ 0.00604] setup done. returning to dalvik. 48I/allegro (20245): android D 20245: android_system.c:411 Java_org_liballeg_app_AllegroActivity_nativeOnOrientationChange [ 0.00619] got orientation change! 49D/AllegroActivity(20245): onCreate end 50D/AllegroActivity(20245): onStart. 51D/AllegroActivity(20245): onResume 52I/allegro (20245): android D 20258: android_system.c:152 android_app_trampoline [ 0.00897] entering app's main function 53I/allegro (20245): main D 20258: main.c:84 main [ 0.00949] init allegro! 54I/allegro (20245): android D 20245: android_system.c:338 Java_org_liballeg_app_AllegroActivity_nativeOnResume [ 0.01437] resume activity 55I/allegro (20245): android D 20245: android_system.c:346 Java_org_liballeg_app_AllegroActivity_nativeOnResume [ 0.01489] no display, not sending SWITCH_IN event 56D/AllegroActivity(20245): onResume end 57I/allegro (20245): android D 20258: android_system.c:465 android_initialize [ 0.01965] android_initialize 58I/allegro (20245): system I 20258: system.c:272 al_install_system [ 0.02011] Allegro version: 5.1.5 (WIP) 59I/allegro (20245): main D 20258: main.c:89 main [ 0.03082] init primitives 60I/allegro (20245): main D 20258: main.c:92 main [ 0.03107] init image addon 61I/allegro (20245): main D 20258: main.c:95 main [ 0.03168] init touch input 62I/allegro (20245): main D 20258: main.c:98 main [ 0.03213] init keyboard 63I/allegro (20245): audio I 20258: audio.c:262 do_install_audio [ 0.03293] Using OpenSL driver 64I/allegro (20245): main D 20258: main.c:114 main [ 0.03360] creating display 65I/allegro (20245): display D 20258: android_display.c:472 android_create_display [ 0.03403] begin 66D/AllegroActivity(20245): postCreateSurface 67I/allegro (20245): display D 20258: android_display.c:517 android_create_display [ 0.03662] waiting for surface onChange 68D/AllegroActivity(20245): createSurface 69D/AllegroSurface(20245): PixelFormat=1 70D/AllegroSurface(20245): ctor 71D/AllegroSurface(20245): ctor end 72D/AllegroActivity(20245): createSurface end 73D/AllegroSurface(20245): surfaceCreated 74I/allegro (20245): display D 20245: android_display.c:50 Java_org_liballeg_app_AllegroSurface_nativeOnCreate [ 0.15884] nativeOnCreate 75I/allegro (20245): display D 20245: android_display.c:57 Java_org_liballeg_app_AllegroSurface_nativeOnCreate [ 0.15952] AllegroSurface_nativeOnCreate 76D/AllegroSurface(20245): Grabbing focus 77D/AllegroSurface(20245): surfaceCreated end 78D/AllegroSurface(20245): surfaceChanged (width=480 height=800) 79I/allegro (20245): display D 20245: android_display.c:119 Java_org_liballeg_app_AllegroSurface_nativeOnChange [ 0.16367] on change! 80I/allegro (20245): display D 20245: android_display.c:120 Java_org_liballeg_app_AllegroSurface_nativeOnChange [ 0.16406] sys: 0x40101011 81I/allegro (20245): display D 20245: android_display.c:292 _al_android_init_display [ 0.16455] calling egl_Init 82D/AllegroSurface(20245): egl_Init 83D/AllegroSurface(20245): egl_Init end 84I/allegro (20245): display D 20245: android_display.c:301 _al_android_init_display [ 0.16617] updating visuals 85I/allegro (20245): display D 20245: android_display.c:457 _al_android_update_visuals [ 0.16663] calling egl_setConfigAttrib(17, 0) 86I/allegro (20245): display D 20245: android_display.c:458 _al_android_update_visuals [ 0.16742] calling egl_setConfigAttrib(18, 0) 87I/allegro (20245): display D 20245: android_display.c:303 _al_android_init_display [ 0.16800] done updating visuals 88I/allegro (20245): display D 20245: android_display.c:314 _al_android_init_display [ 0.16840] calling egl_createContext 89D/AllegroSurface(20245): egl_createContext 90D/AllegroSurface(20245): egl_attribs[0] = 12338 91D/AllegroSurface(20245): egl_attribs[1] = 0 92D/AllegroSurface(20245): egl_attribs[2] = 12337 93D/AllegroSurface(20245): egl_attribs[3] = 0 94D/AllegroSurface(20245): egl_attribs[4] = 12352 95D/AllegroSurface(20245): egl_attribs[5] = 1 96D/AllegroSurface(20245): EGL context created 97D/AllegroSurface(20245): egl_createContext end 98I/allegro (20245): display D 20245: android_display.c:326 _al_android_init_display [ 0.17996] calling egl_createSurface 99D/AllegroSurface(20245): created new surface: com.google.android.gles_jni.EGLSurfaceImpl@1f552c0 100I/allegro (20245): display D 20245: android_display.c:334 _al_android_init_display [ 0.18936] initialize ogl extensions 101I/allegro (20245): opengl D 20245: extensions.c:703 _al_ogl_manage_extensions [ 0.19003] OpenGL Extensions: 102I/allegro (20245): opengl D 20245: extensions.c:200 print_extensions [ 0.19058] GL_AMD_compressed_ATC_texture 103I/allegro (20245): opengl D 20245: extensions.c:200 print_extensions [ 0.19104] GL_AMD_performance_monitor 104I/allegro (20245): opengl D 20245: extensions.c:200 print_extensions [ 0.19147] GL_APPLE_texture_2D_limited_npot 105I/allegro (20245): opengl D 20245: extensions.c:200 print_extensions [ 0.19217] GL_ARB_vertex_buffer_object 106I/allegro (20245): opengl D 20245: extensions.c:200 print_extensions [ 0.19318] GL_EXT_texture_filter_anisotropic 107I/allegro (20245): opengl D 20245: extensions.c:200 print_extensions [ 0.19367] GL_EXT_texture_format_BGRA8888 108I/allegro (20245): opengl D 20245: extensions.c:200 print_extensions [ 0.19412] GL_EXT_texture_type_2_10_10_10_REV 109I/allegro (20245): opengl D 20245: extensions.c:200 print_extensions [ 0.19458] GL_OES_blend_equation_separate 110I/allegro (20245): opengl D 20245: extensions.c:200 print_extensions [ 0.19501] GL_OES_blend_func_separate 111I/allegro (20245): opengl D 20245: extensions.c:200 print_extensions [ 0.19544] GL_OES_blend_subtract 112I/allegro (20245): opengl D 20245: extensions.c:200 print_extensions [ 0.19586] GL_OES_compressed_ETC1_RGB8_texture 113I/allegro (20245): opengl D 20245: extensions.c:200 print_extensions [ 0.19632] GL_OES_compressed_paletted_texture 114I/allegro (20245): opengl D 20245: extensions.c:200 print_extensions [ 0.19672] GL_OES_depth_texture 115I/allegro (20245): opengl D 20245: extensions.c:200 print_extensions [ 0.19717] GL_OES_depth24 116I/allegro (20245): opengl D 20245: extensions.c:200 print_extensions [ 0.19763] GL_OES_draw_texture 117I/allegro (20245): opengl D 20245: extensions.c:200 print_extensions [ 0.19827] GL_OES_EGL_image 118I/allegro (20245): opengl D 20245: extensions.c:200 print_extensions [ 0.19870] GL_OES_EGL_image_external 119I/allegro (20245): opengl D 20245: extensions.c:200 print_extensions [ 0.19934] GL_OES_framebuffer_object 120I/allegro (20245): opengl D 20245: extensions.c:200 print_extensions [ 0.19980] GL_OES_matrix_palette 121I/allegro (20245): opengl D 20245: extensions.c:200 print_extensions [ 0.20068] GL_OES_packed_depth_stencil 122I/allegro (20245): opengl D 20245: extensions.c:200 print_extensions [ 0.20136] GL_OES_point_size_array 123I/allegro (20245): opengl D 20245: extensions.c:200 print_extensions [ 0.20203] GL_OES_point_sprite 124I/allegro (20245): opengl D 20245: extensions.c:200 print_extensions [ 0.20249] GL_OES_read_format 125I/allegro (20245): opengl D 20245: extensions.c:200 print_extensions [ 0.20319] GL_OES_rgb8_rgba8 126I/allegro (20245): opengl D 20245: extensions.c:200 print_extensions [ 0.20383] GL_OES_stencil_wrap 127I/allegro (20245): opengl D 20245: extensions.c:200 print_extensions [ 0.20444] GL_OES_texture_cube_map 128I/allegro (20245): opengl D 20245: extensions.c:200 print_extensions [ 0.20490] GL_OES_texture_env_crossbar 129I/allegro (20245): opengl D 20245: extensions.c:200 print_extensions [ 0.20551] GL_OES_texture_float 130I/allegro (20245): opengl D 20245: extensions.c:200 print_extensions [ 0.20596] GL_OES_texture_half_float 131I/allegro (20245): opengl D 20245: extensions.c:200 print_extensions [ 0.20639] GL_OES_texture_half_float_linear 132I/allegro (20245): opengl D 20245: extensions.c:200 print_extensions [ 0.20703] GL_OES_texture_npot 133I/allegro (20245): opengl D 20245: extensions.c:200 print_extensions [ 0.20746] GL_OES_texture_mirrored_repeat 134I/allegro (20245): opengl D 20245: extensions.c:200 print_extensions [ 0.20807] GL_QCOM_binning_control 135I/allegro (20245): opengl D 20245: extensions.c:200 print_extensions [ 0.20853] GL_QCOM_extended_get 136I/allegro (20245): opengl D 20245: extensions.c:200 print_extensions [ 0.20895] GL_QCOM_tiled_rendering 137I/allegro (20245): opengl D 20245: extensions.c:200 print_extensions [ 0.20941] GL_AMD_compressed_3DC_texture 138I/allegro (20245): opengl I 20245: extensions.c:674 fill_in_info_struct [ 0.21002] Assumed OpenGL version: 1.1.0.0 139I/allegro (20245): opengl I 20245: extensions.c:879 _al_ogl_manage_extensions [ 0.21945] Use of non-power-of-two textures enabled. 140I/allegro (20245): opengl I 20245: extensions.c:889 _al_ogl_manage_extensions [ 0.21961] Use of FBO to draw to textures enabled. 141I/allegro (20245): opengl D 20245: ogl_display.c:551 _al_ogl_create_backbuffer [ 0.21997] Creating backbuffer 142I/allegro (20245): display I 20245: ogl_display.c:574 _al_ogl_create_backbuffer [ 0.22076] Deduced format ABGR_8888_LE for backbuffer. 143I/allegro (20245): opengl D 20245: ogl_display.c:583 _al_ogl_create_backbuffer [ 0.22116] Creating backbuffer bitmap 144I/allegro (20245): display I 20245: ogl_display.c:601 _al_ogl_create_backbuffer [ 0.22168] Created backbuffer bitmap (actual format: ABGR_8888_LE) 145D/AllegroSurface(20245): egl_clearCurrent 146D/AllegroSurface(20245): egl_clearCurrent done 147I/allegro (20245): display D 20258: android_display.c:522 android_create_display [ 0.22382] done waiting for surface onChange 148I/allegro (20245): display D 20258: android_display.c:534 android_create_display [ 0.22388] display: 0x1e82628 480x800 149D/AllegroSurface(20245): egl_clearCurrent 150D/AllegroSurface(20245): egl_clearCurrent done 151I/allegro (20245): display D 20258: android_display.c:271 _al_android_setup_opengl_view [ 0.22412] setup opengl view d->w=480 d->h=800 152I/allegro (20245): display D 20258: android_display.c:544 android_create_display [ 0.22586] end 153D/AllegroSurface(20245): egl_clearCurrent 154D/AllegroSurface(20245): egl_clearCurrent done 155I/allegro (20245): display D 20258: android_display.c:595 android_set_current_display [ 0.22620] make current 0x1e82628 156I/allegro (20245): main D 20258: main.c:36 print_standard_paths [ 0.22681] ALLEGRO_RESOURCES_PATH: /data/data/org.liballeg.app/files/ 157I/allegro (20245): main D 20258: main.c:37 print_standard_paths [ 0.22690] ALLEGRO_TEMP_PATH: /mnt/sdcard/Android/data/org.liballeg.app/files/ 158I/allegro (20245): main D 20258: main.c:38 print_standard_paths [ 0.22699] ALLEGRO_USER_DATA_PATH: /mnt/sdcard/Android/data/org.liballeg.app/files/ 159I/allegro (20245): main D 20258: main.c:39 print_standard_paths [ 0.22705] ALLEGRO_USER_HOME_PATH: /mnt/sdcard/Android/data/org.liballeg.app/files/ 160I/allegro (20245): main D 20258: main.c:40 print_standard_paths [ 0.22714] ALLEGRO_USER_SETTINGS_PATH: /mnt/sdcard/Android/data/org.liballeg.app/files/ 161I/allegro (20245): main D 20258: main.c:41 print_standard_paths [ 0.22720] ALLEGRO_USER_DOCUMENTS_PATH: /mnt/sdcard/Android/data/org.liballeg.app/files/ 162I/allegro (20245): main D 20258: main.c:42 print_standard_paths [ 0.22723] ALLEGRO_EXENAME_PATH: /data/app/org.liballeg.app-1.apk 163D/AllegroActivity(20245): decodeBitmap begin 164D/AllegroSurface(20245): surfaceChanged end 165D/AllegroActivity(20245): done waiting for decodeStream 166D/AllegroActivity(20245): decodeBitmap end 167I/allegro (20245): android D 20258: android_system.c:672 _al_android_load_image [ 0.25366] bitmap dimensions: 128, 128 168I/allegro (20245): opengl D 20258: ogl_bitmap.c:410 ogl_upload_bitmap [ 0.25699] Created new OpenGL texture 1 (128x128, format ABGR_8888_LE) 169I/allegro (20245): dtor D 20258: dtor.c:184 _al_register_destructor [ 0.25815] added dtor for object 0x1fc21d8, func 0x51e687ed 170I/allegro (20245): opengl D 20258: ogl_bitmap.c:660 ogl_lock_region_old [ 0.25864] Locking non-backbuffer WRITEONLY 171I/allegro (20245): opengl D 20258: ogl_bitmap.c:970 ogl_unlock_region_old [ 0.26157] Unlocking non-backbuffer with conversion 172I/allegro (20245): opengl D 20258: ogl_bitmap.c:674 ogl_lock_region_old [ 0.26807] Locking non-backbuffer READWRITE 173I/allegro (20245): opengl D 20258: ogl_display.c:276 setup_fbo [ 0.26834] Created FBO: 1 174I/allegro (20245): opengl D 20258: ogl_bitmap.c:999 ogl_unlock_region_old [ 0.30310] Unlocking non-backbuffer without conversion 175I/allegro (20245): dtor D 20258: dtor.c:184 _al_register_destructor [ 0.30362] added dtor for object 0x1f7c5d0, func 0x51e886a5 176I/allegro (20245): dtor D 20258: dtor.c:184 _al_register_destructor [ 0.30411] added dtor for object 0x1fc37f8, func 0x51e992d1 177I/allegro (20245): dtor D 20258: dtor.c:184 _al_register_destructor [ 0.32581] added dtor for object 0x1fadd48, func 0x4f0252f9 178I/allegro (20245): dtor D 20258: dtor.c:184 _al_register_destructor [ 0.33173] added dtor for object 0x1ff20f8, func 0x4f021525 179I/allegro (20245): dtor D 20258: dtor.c:184 _al_register_destructor [ 0.33359] added dtor for object 0x1ff21f8, func 0x4f01b509 180I/allegro (20245): audio D 20258: kcm_mixer.c:121 _al_rechannel_matrix [ 0.33417] sample matrix: 181I/allegro (20245): audio D 20258: kcm_mixer.c:127 _al_rechannel_matrix [ 0.33423] 182I/allegro (20245): audio D 20258: kcm_mixer.c:127 _al_rechannel_matrix [ 0.33429] 183I/allegro (20245): main D 20258: main.c:165 main [ 0.33432] Audio clip sample not loaded! 184I/ActivityManager( 204): Displayed org.liballeg.app/.AllegroActivity: +763ms 185I/DEBUG (20182): 52030d68 51f11b99 /data/data/org.liballeg.app/lib/liballegro-debug.so 186I/DEBUG (20182): 52030d7c 4f0289f4 /data/data/org.liballeg.app/lib/liballegro_audio-debug.so 187I/DEBUG (20182): 52030d98 4f0289f4 /data/data/org.liballeg.app/lib/liballegro_audio-debug.so 188I/DEBUG (20182): 52030da4 4f028c88 /data/data/org.liballeg.app/lib/liballegro_audio-debug.so 189I/DEBUG (20182): 52030da8 4f028c88 /data/data/org.liballeg.app/lib/liballegro_audio-debug.so 190I/DEBUG (20182): 52030dac 4f046f2c /data/data/org.liballeg.app/lib/liballegro-example.so 191I/DEBUG (20182): 52030db0 51f11b99 /data/data/org.liballeg.app/lib/liballegro-debug.so 192I/DEBUG (20182): 52030db4 4f022de7 /data/data/org.liballeg.app/lib/liballegro_audio-debug.so 193I/DEBUG (20182): 52030dbc 51e67fdd /data/data/org.liballeg.app/lib/liballegro-debug.so 194I/DEBUG (20182): 52030dd4 4f046f2c /data/data/org.liballeg.app/lib/liballegro-example.so 195I/DEBUG (20182): 52030ddc 4f03f801 /data/data/org.liballeg.app/lib/liballegro-example.so 196I/DEBUG (20182): 52030de0 4f0400d8 /data/data/org.liballeg.app/lib/liballegro-example.so 197I/DEBUG (20182): 52030de4 4f046f2c /data/data/org.liballeg.app/lib/liballegro-example.so 198I/WindowManager( 204): WIN DEATH: Window{41764550 org.liballeg.app/org.liballeg.app.AllegroActivity paused=false} 199W/WindowManager( 204): Force-removing child win Window{417d0b28 SurfaceView paused=false} from container Window{41764550 org.liballeg.app/org.liballeg.app.AllegroActivity paused=false} 200W/ActivityManager( 204): Force removing ActivityRecord{4127e1a0 org.liballeg.app/.AllegroActivity}: app died, no saved state

The sample loads as NULL (and thus fails) everytime. Everything else should work.

Please note this I am NOT making this on my clean VirtualMachine Developement Box install, as I am waiting to hear of the correct way to install allegro before using that. This is a separate attempt, and thus a separate post. I figure maybe the way I've been writing the main.c is the issue, hence the title "what line are missing".

I am using the dev machine I've used continuously, one which seems to support sound via OpenAL, and can compile SDL and Allegro apps without sound. Note the Device can run 'MonsterRPG2', 'Bobby' and 'Elemental-aMusical' all with sound.

Device :=

  • Android 4.0.3 (Kernel = 3.0....) with HTC Sense 4.0

  • HTC One V, Hardware Version 0002

  • Single Core, 512MB ram

  • HTC SDK API 4.21

  • 3.7 inch WVGA resolution display

Thread #611997. Printed from Allegro.cc