Hi experts

I have some more beginner questions about jack API.
Long time ago i writed lil test program - sine signal generator with OSS output and TUI level indicators.
http://martini.pudele.com/radio/demos/sin_gen-01.c
It is possible with (curses-ansi escapes) TUI vary sine parameters - Frequency and amplitude.
 
Program is so structured :
 
int  main ( int argc, char *argv[] ) 
{
  open_sound_device();
    for(;;)
    { 
        // calc sine wave here
        status = write(audio_fd,audio_buffer,BUFFA_SIZE*2);
 
    } // for;;
 
  close_sound_device();
} // main
 
Is it possible this program __as_is__ rewrite for jack output ?
Sine values do no multiple with 32767.0 
and instead of
  open_sound_device();
  write(audio_fd,audio_buffer,BUFFA_SIZE*2);
  close_sound_device();
just call jack stuff ?
 
====
 
Anyway - What is best (thread?, IPC?) program, structure, realtime-safe,
for such simple jack-TUI program ?
 
====
 
Normal 16 bit sound samples must be in range
-0x8000 ... +0xFFFF  or dec  -32768 ... +32767 signed short
but jack server works with samples normalized -1.0 ... +1.0 float
 
(1/32768) x 32767 = 0.999969482
 
Must be jack final output samples clipped in range
-1.0 ... +0.999969482  ?
If not, does jack clip anything to -1.0 and +0.999969482 ?
 

Tnx in advace @ all
Alfs Kurmis






----