aboutsummaryrefslogtreecommitdiff
path: root/sam_player.c
diff options
context:
space:
mode:
Diffstat (limited to 'sam_player.c')
-rw-r--r--sam_player.c46
1 files changed, 46 insertions, 0 deletions
diff --git a/sam_player.c b/sam_player.c
new file mode 100644
index 0000000..43baf40
--- /dev/null
+++ b/sam_player.c
@@ -0,0 +1,46 @@
+// sam_player.c
+//
+// 20060811 Markku Alén
+//
+// rel-0-2
+
+#include "sam.h"
+#include "wave.h"
+
+static unsigned char wave_buffer[200000];
+static wave_t wave = { 1, 44100, 8, 0, 1, wave_buffer };
+
+int main(int argc, char **argv)
+{
+ int argi;
+ char *arg, c, buf[200], *p;
+ unsigned int wave_length;
+ p = buf;
+ for(argi = 1;argi < argc;argi++)
+ {
+ arg = argv[argi];
+ do
+ {
+ c = *(arg++);
+ if(c >= 'a' && c <= 'z')
+ c = (c - 'a') + 'A';
+ if(c != '\"')
+ {
+ if(p < &buf[sizeof(buf) - 1])
+ *(p++) = (c != '\0') ? c : ' ';
+ }
+ }while(c != '\0');
+ }
+ *p = '\0';
+ sam_init();
+ wave_length = sizeof(wave_buffer);
+ sam_say(buf, wave.samples_per_sec, wave_buffer, &wave_length);
+ if(wave_length > 0)
+ {
+ if(wave_length > sizeof(wave_buffer))
+ wave_length = sizeof(wave_buffer);
+ wave.frame_size = wave_length;
+ (void)wave_out(&wave);
+ }
+ return 0;
+}