aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog6
-rw-r--r--openmoocow.control2
-rw-r--r--src/accelerometers.c2
-rw-r--r--src/accelerometers.h3
-rw-r--r--src/audio.c45
-rw-r--r--src/audio.h3
-rw-r--r--src/main.c19
-rw-r--r--src/mainwindow.c13
-rw-r--r--src/mainwindow.h3
-rw-r--r--src/types.h2
10 files changed, 49 insertions, 49 deletions
diff --git a/ChangeLog b/ChangeLog
index e745c6e..46a3784 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+Version 0.3
+-----------
+ * Add support for Thinkpad HDAPS accelerometers.
+ * New (improved) cow picture.
+ * Disable the accelerometer threshold while running.
+
Version 0.2
-----------
diff --git a/openmoocow.control b/openmoocow.control
index 37cf4f2..9ccd1ad 100644
--- a/openmoocow.control
+++ b/openmoocow.control
@@ -5,6 +5,6 @@ Section: openmoko/applications
Priority: optional
Maintainer: $USER
Architecture: armv4t
-Homepage: http://www.srcf.ucam.org/~taw27/
+Homepage: http://www.bitwiz.org.uk/openmoocow
Depends: libsdl-1.2-0 (>= 1.0.0), gtk+ (>= 2.0.0), libgthread-2.0-0 (>= 2.0.0) | libglib-2.0-0 (<= 2.16.1-r4)
Source: ${SRC}
diff --git a/src/accelerometers.c b/src/accelerometers.c
index e11d4c0..582e664 100644
--- a/src/accelerometers.c
+++ b/src/accelerometers.c
@@ -3,7 +3,7 @@
*
* Accelerometer stuff
*
- * (c) 2008 Thomas White <taw27@srcf.ucam.org>
+ * (c) 2008-2009 Thomas White <taw@bitwiz.org.uk>
* (c) 2008 Joachim Breitner <mail@joachim-breitner.de>
*
* This file is part of OpenMooCow - accelerometer moobox simulator
diff --git a/src/accelerometers.h b/src/accelerometers.h
index 77bf07b..845aad5 100644
--- a/src/accelerometers.h
+++ b/src/accelerometers.h
@@ -3,7 +3,7 @@
*
* Accelerometer stuff
*
- * (c) 2008 Thomas White <taw27@srcf.ucam.org>
+ * (c) 2008-2009 Thomas White <taw@bitwiz.org.uk>
*
* This file is part of OpenMooCow - accelerometer moobox simulator
*
@@ -38,4 +38,3 @@ extern void accelerometer_update(AccelHandle *accel);
extern GThread *accelerometer_start(int *finished);
#endif /* ACCELEROMETERS_H */
-
diff --git a/src/audio.c b/src/audio.c
index cfe6939..fd54041 100644
--- a/src/audio.c
+++ b/src/audio.c
@@ -3,7 +3,7 @@
*
* Moo like a cow
*
- * (c) 2008 Thomas White <taw27@srcf.ucam.org>
+ * (c) 2008-2009 Thomas White <taw@bitwiz.org.uk>
*
* This file is part of OpenMooCow - accelerometer moobox simulator
*
@@ -49,28 +49,28 @@ static void audio_mix(void *data, Uint8 *stream8, int len) {
int j;
Sint16 *stream = (Sint16 *)stream8;
Sint16 samp;
-
+
len /= 2; /* Number of samples to write */
-
+
for ( j=0; j<len; j++ ) {
-
+
stream[j] = 0;
-
+
if ( a->moo_pos < a->moo_len ) {
samp = a->moo_buf[a->moo_pos++];
stream[j] += samp;
} else {
a->mootex = 0;
}
-
+
}
-
+
}
void audio_trigger_moo() {
AudioContext *a = audio_context;
-
+
if ( a == NULL ) {
/* Try to open the audio again */
printf("Trying to open the audio again...\n");
@@ -85,7 +85,7 @@ void audio_trigger_moo() {
printf("Moo!\n");
a->mootex = 1;
-
+
if ( a->moo_pos == a->moo_len ) {
a->moo_pos = 0;
}
@@ -94,19 +94,19 @@ void audio_trigger_moo() {
/* SDL audio initial setup */
void audio_setup() {
-
+
AudioContext *a;
SDL_AudioSpec fmt;
SDL_AudioSpec wave;
Uint8 *data;
Uint32 dlen;
SDL_AudioCVT cvt;
-
+
/* Create audio context */
a = malloc(sizeof(AudioContext));
assert(a != NULL);
a->mootex = 0;
-
+
/* 16-bit mono audio at 44.1 kHz */
fmt.freq = 44100;
fmt.format = AUDIO_S16;
@@ -115,13 +115,13 @@ void audio_setup() {
fmt.callback = audio_mix;
fmt.userdata = a;
fmt.silence = 0;
-
+
if ( SDL_OpenAudio(&fmt, NULL) < 0 ) {
fprintf(stderr, "Unable to open audio: %s\n", SDL_GetError());
free(a);
return;
}
-
+
if ( SDL_LoadWAV(DATADIR"/openmoocow/moo.wav", &wave, &data, &dlen) == NULL ) {
fprintf(stderr, "Couldn't load moo sound: %s\n", SDL_GetError());
free(a);
@@ -138,27 +138,26 @@ void audio_setup() {
cvt.len = dlen;
SDL_ConvertAudio(&cvt);
SDL_FreeWAV(data);
-
+
a->moo_len = cvt.len_cvt/2 - 2; /* Convert bytes to samples */
a->moo_pos = a->moo_len; /* Play nothing to start with */
a->moo_buf = (Sint16 *)cvt.buf;
-
+
audio_context = a;
-
+
SDL_PauseAudio(0);
-
+
}
void audio_shutdown() {
AudioContext *a = audio_context;
-
+
if ( a == NULL ) return;
-
+
SDL_CloseAudio();
-
+
/* Now this can be freed */
free(a);
-
-}
+}
diff --git a/src/audio.h b/src/audio.h
index 91781bf..88ea451 100644
--- a/src/audio.h
+++ b/src/audio.h
@@ -3,7 +3,7 @@
*
* Moo like a cow
*
- * (c) 2008 Thomas White <taw27@srcf.ucam.org>
+ * (c) 2008-2009 Thomas White <taw@bitwiz.org.uk>
*
* This file is part of OpenMooCow - accelerometer moobox simulator
*
@@ -36,4 +36,3 @@ extern void audio_trigger_moo(void);
extern void audio_shutdown(void);
#endif /* AUDIO_H */
-
diff --git a/src/main.c b/src/main.c
index cac8b7f..60ce863 100644
--- a/src/main.c
+++ b/src/main.c
@@ -3,7 +3,7 @@
*
* The Top Level Source File
*
- * (c) 2008 Thomas White <taw27@srcf.ucam.org>
+ * (c) 2008-2009 Thomas White <taw@bitwiz.org.uk>
*
* This file is part of OpenMooCow - accelerometer moobox simulator
*
@@ -44,21 +44,21 @@ int main(int argc, char *argv[]) {
int graphics = 0;
GThread *accel_thread;
int finished = 0;
-
+
g_thread_init(NULL);
-
+
if ( gtk_init_check(&argc, &argv) ) {
graphics = 1;
}
-
+
if ( SDL_Init(SDL_INIT_AUDIO) < 0 ) {
fprintf(stderr, "Couldn't initialise SDL: %s\n", SDL_GetError());
return 1;
}
-
+
/* Start the accelerometer thread */
accel_thread = accelerometer_start(&finished);
-
+
if ( graphics ) {
/* Open the window */
mw = mainwindow_open();
@@ -68,12 +68,11 @@ int main(int argc, char *argv[]) {
sleep(10);
}
}
-
+
finished = 1;
g_thread_join(accel_thread);
SDL_Quit();
-
+
return 0;
-
-}
+}
diff --git a/src/mainwindow.c b/src/mainwindow.c
index 43a8eef..e718073 100644
--- a/src/mainwindow.c
+++ b/src/mainwindow.c
@@ -3,7 +3,7 @@
*
* Main window
*
- * (c) 2008 Thomas White <taw27@srcf.ucam.org>
+ * (c) 2008-2009 Thomas White <taw@bitwiz.org.uk>
*
* This file is part of OpenMooCow - accelerometer moobox simulator
*
@@ -46,26 +46,25 @@ MainWindow *mainwindow_open(void) {
MainWindow *mw;
GtkWidget *eb;
-
+
mw = malloc(sizeof(*mw));
if ( mw == NULL ) return NULL;
-
+
mw->window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window_set_default_size(GTK_WINDOW(mw->window), 240, 320);
gtk_window_set_title(GTK_WINDOW(mw->window), "OpenMooCow");
-
+
eb = gtk_event_box_new();
mw->cow = gtk_image_new_from_file(PIXMAPDIR"/cow.png");
gtk_container_add(GTK_CONTAINER(eb), mw->cow);
gtk_container_add(GTK_CONTAINER(mw->window), eb);
gtk_widget_add_events(GTK_WIDGET(eb), GDK_BUTTON_PRESS_MASK);
gtk_misc_set_alignment(GTK_MISC(mw->cow), 0.5, 1.0);
-
+
g_signal_connect(G_OBJECT(eb), "button_press_event", G_CALLBACK(mainwindow_clicked), mw);
g_signal_connect(G_OBJECT(mw->window), "destroy", G_CALLBACK(mainwindow_closed), mw);
gtk_widget_show_all(mw->window);
-
+
return mw;
}
-
diff --git a/src/mainwindow.h b/src/mainwindow.h
index 4f994ec..ad9ab65 100644
--- a/src/mainwindow.h
+++ b/src/mainwindow.h
@@ -3,7 +3,7 @@
*
* Main window
*
- * (c) 2008 Thomas White <taw27@srcf.ucam.org>
+ * (c) 2008-2009 Thomas White <taw@bitwiz.org.uk>
*
* This file is part of OpenMooCow - accelerometer moobox simulator
*
@@ -34,4 +34,3 @@
MainWindow *mainwindow_open(void);
#endif /* MAINWINDOW_H */
-
diff --git a/src/types.h b/src/types.h
index 8dce08e..b1752f7 100644
--- a/src/types.h
+++ b/src/types.h
@@ -3,7 +3,7 @@
*
* Data types
*
- * (c) 2008 Thomas White <taw27@srcf.ucam.org>
+ * (c) 2008-2009 Thomas White <taw@bitwiz.org.uk>
* (c) 2008 Joachim Breitner <mail@joachim-breitner.de>
*
* This file is part of OpenMooCow - accelerometer moobox simulator