]> gitweb.factorcode.org Git - factor.git/commitdiff
Morse an synth fixed
authorAlex Chapman <chapman.alex@gmail.com>
Thu, 16 Apr 2009 03:36:54 +0000 (13:36 +1000)
committerAlex Chapman <chapman.alex@gmail.com>
Thu, 16 Apr 2009 03:36:54 +0000 (13:36 +1000)
extra/morse/morse.factor
extra/synth/buffers/buffers.factor

index 2951c96077e425f740ed534b84a95877d65099d8..54abce93953808f9a3e0835987d6a5942238cf28 100644 (file)
@@ -1,8 +1,8 @@
 ! Copyright (C) 2007, 2008 Alex Chapman
 ! See http://factorcode.org/license.txt for BSD license.
-USING: accessors assocs combinators hashtables kernel lists math
+USING: accessors ascii assocs combinators hashtables kernel lists math
 namespaces make openal parser-combinators promises sequences
-strings symbols synth synth.buffers unicode.case ;
+strings synth synth.buffers unicode.case ;
 IN: morse
 
 <PRIVATE
@@ -135,7 +135,7 @@ SYMBOLS: source dot-buffer dash-buffer intra-char-gap-buffer letter-gap-buffer ;
 : intra-char-gap ( -- ) intra-char-gap-buffer queue ;
 : letter-gap ( -- ) letter-gap-buffer queue ;
 
-: beep-freq 880 ;
+: beep-freq ( -- n ) 880 ;
 
 : <morse-buffer> ( -- buffer )
     half-sample-freq <8bit-mono-buffer> ;
@@ -160,7 +160,7 @@ SYMBOLS: source dot-buffer dash-buffer intra-char-gap-buffer letter-gap-buffer ;
         init-openal 1 gen-sources first source set make-buffers
         call
         source get source-play
-    ] with-scope ;
+    ] with-scope ; inline
 
 : play-char ( ch -- )
     [ intra-char-gap ] [
@@ -176,7 +176,7 @@ PRIVATE>
 : play-as-morse* ( str unit-length -- )
     [
         [ letter-gap ] [ ch>morse play-char ] interleave
-    ] swap playing-morse ;
+    ] swap playing-morse ; inline
 
 : play-as-morse ( str -- )
-    0.05 play-as-morse* ;
+    0.05 play-as-morse* ; inline
index b0128ca52a799ce03af4c2241fd4df7722733204..671ebead63fb72b4764bf6a3cb8a209f0e39bf88 100644 (file)
@@ -1,6 +1,6 @@
 ! Copyright (C) 2008 Alex Chapman
 ! See http://factorcode.org/license.txt for BSD license.
-USING: accessors alien.c-types combinators kernel locals math math.ranges openal sequences sequences.merged ;
+USING: accessors alien.c-types combinators kernel locals math math.ranges openal sequences sequences.merged specialized-arrays.uchar specialized-arrays.short ;
 IN: synth.buffers
 
 TUPLE: buffer sample-freq 8bit? id ;
@@ -57,11 +57,11 @@ M: 8bit-stereo-buffer buffer-data
 M: 16bit-stereo-buffer buffer-data
     interleaved-stereo-data 16bit-buffer-data ;
 
-: telephone-sample-freq 8000 ;
-: half-sample-freq 22050 ;
-: cd-sample-freq 44100 ;
-: digital-sample-freq 48000 ;
-: professional-sample-freq 88200 ;
+: telephone-sample-freq ( -- n ) 8000 ;
+: half-sample-freq ( -- n ) 22050 ;
+: cd-sample-freq ( -- n ) 44100 ;
+: digital-sample-freq ( -- n ) 48000 ;
+: professional-sample-freq ( -- n ) 88200 ;
 
 : send-buffer ( buffer -- buffer )
     {