David, I am getting a weird 'discipline not replaced message' when I run the script below with ast-ksh.20120831:
----------cut------------ typeset -T audio_buffer_stack_t=( # stack layout: # stack.currpos = current position # stack.data = nameref to integer array integer currpos=0 integer -a data=( [0]=0 ) function reset { (( _.currpos=0 )) return 0 } function put_byte { integer val=$1 (( _.data[_.currpos++]=val & 0xFF )) return 0 } function bytearraytobase64 { # base64 handling stuff typeset -S -r base64chars='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/' nameref out=$1 nameref bytearray='_.data' typeset buf integer len integer i i0 i1 i2 buf='' # clear (( len=_.currpos )) for (( i=0 ; i < len ; i+=3 )) ; do (( i0=bytearray[i+0] , i1=bytearray[i+1] , i2=bytearray[i+2] )) buf+="${base64chars:$(( i0 >> 2 )):1}" buf+="${base64chars:$(( ((i0 & 0x03) << 4) | ((i1 & 0xf0) >> 4) )):1}" (( (i+1) < len )) && { buf+="${base64chars:$(( ((i1 & 0x0f) << 2) | ((i2 & 0xc0) >> 6) )):1}" ; } || buf+='=' (( (i+2) < len )) && { buf+="${base64chars:$(( i2 & 0x3f )):1}" ; } || buf+='=' done out="${buf}" return 0 } # put an au(4) header on a stack variable function put_au_header { # au_magic: magic number _.put_byte $(('.')) _.put_byte $(('s')) _.put_byte $(('n')) _.put_byte $(('d')) # au_offset _.put_byte 0x00 _.put_byte 0x00 _.put_byte 0x00 _.put_byte 0x1C # au_data_size (0xFFFFFFFF = AUDIO_AU_UNKNOWN_SIZE ((unsigned)(~0))) _.put_byte 0xFF _.put_byte 0xFF _.put_byte 0xFF _.put_byte 0xFF # au_encoding _.put_byte 0x00 _.put_byte 0x00 _.put_byte 0x00 _.put_byte 1 # au_sample_rate _.put_byte 0x00 _.put_byte 0x00 _.put_byte 0x1f _.put_byte 0x40 # au_channels _.put_byte 0x00 _.put_byte 0x00 _.put_byte 0x00 _.put_byte 0x01 # dummy _.put_byte 0 _.put_byte 0 _.put_byte 0 _.put_byte 0 return 0 } ) function crash { # define PI using C99 hexfloat (more accurate and portable) float -r M_PI=0x3.243F6A8885A308D313198A2E03707344A4093822299F31D0082EFA98EC4Ep+00 float sample_rate=8000. float duration=0.10 audio_buffer_stack_t audio # stack object # build pause sample audio.reset for (( i=0 ; i < ((sample_rate*duration)/2.) ; i++ )) ; do audio.put_byte 0 done typeset -b pause_sample audio.bytearraytobase64 pause_sample } crash ----------cut------------ Olga -- , _ _ , { \/`o;====- Olga Kryzhanovska -====;o`\/ } .----'-/`-/ olga.kryzhanov...@gmail.com \-`\-'----. `'-..-| / http://twitter.com/fleyta \ |-..-'` /\/\ Solaris/BSD//C/C++ programmer /\/\ `--` `--` _______________________________________________ ast-developers mailing list ast-developers@research.att.com https://mailman.research.att.com/mailman/listinfo/ast-developers