Morse an synth fixed
parent
4934c49f08
commit
f491dba936
|
@ -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
|
||||
|
|
|
@ -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 )
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue