This is float2fix.c in view mode; [Download] [Up]
#include <stdio.h> main( int argc, char *argv[] ) { short s ; float f ; if ( isatty(1) == 1 ) { fprintf( stderr, "%s\n%s\n", "float2fix usage: float2fix < binary_floats > 16-bit_fixed", "(input samples outside range -1.0 to +1.0 are clipped)" ) ; exit( -1 ) ; } while( fread( &f, sizeof(float), 1, stdin ) != 0 ) { if ( f > 1.0 ) f = 1.0 ; else if ( f < -1.0 ) f = -1.0 ; s = f*32767.0 ; fwrite( &s, sizeof(short), 1, stdout ) ; } }
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.