BOOLEAN read_key (REAL del, BOOLEAN dot, BOOLEAN dash) { extern BOOLEAN read_straight_key (KeyerState ks, BOOLEAN keyed); extern BOOLEAN read_iambic_key (KeyerState ks, BOOLEAN dot, BOOLEAN dash, KeyerLogic kl, REAL ticklen); if (bug) { if (dash) return read_straight_key (ks, dash); else return read_iambic_key (ks, dot, FALSE, kl, del); } if (iambic) return read_iambic_key (ks, dot, dash, kl, del); return read_straight_key (ks, dot | dash); }
BOOLEAN read_key (REAL del, BOOLEAN dot, BOOLEAN dash) { extern BOOLEAN read_straight_key (KeyerState ks, BOOLEAN keyed); extern BOOLEAN read_iambic_key (KeyerState ks, BOOLEAN dot, BOOLEAN dash, KeyerLogic kl, REAL ticklen); if (!ks) { fprintf(stderr,"%s: No ks! dash=%d dot=%d\n",__func__,dash,dot); return FALSE; } if (bug) { if (dash) return read_straight_key (ks, dash); else return read_iambic_key (ks, dot, FALSE, kl, del); } if (iambic) return read_iambic_key (ks, dot, dash, kl, del); return read_straight_key (ks, dot | dash); }
DttSP_EXP void key_thread_process (REAL del, BOOLEAN dash, BOOLEAN dot, BOOLEAN keyprog) { BOOLEAN keydown; extern BOOLEAN read_straight_key (KeyerState ks, BOOLEAN keyed); // read key; tell keyer elapsed time since last call if (!keyprog) keydown = read_key (del, dot, dash); else keydown = read_straight_key (ks, whichkey (dot, dash)); if (!playing && keydown) CWToneOn (gen), playing = TRUE; else if (playing && !keydown) CWToneOff (gen); sem_post (&clock_fired); }