bool drain_ssb(bool final);
void receive();
void start_receive();
- void start_transmit_digital();
- void start_transmit_ssb();
- void stop_receive();
void transmit_digital();
void transmit_ssb();
public:
// Always start in receive mode. If the T/R switches are pressed,
// we'll catch up.
i->keying_output->key(0);
- start_receive();
i->receiver->start();
i->loudspeaker->start();
if ( !add_poll_device(i->receiver) )
result = IODevice::poll(poll_fds, poll_fd_count, 1000);
else if ( state != UnKey ) {
struct timespec request;
+ struct timespec remainder;
request.tv_sec = 0;
- request.tv_nsec = AudioFrameDuration * 100000;
- nanosleep(&request, 0);
+ request.tv_nsec = AudioFrameDuration * 100000000;
+ nanosleep(&request, &remainder);
}
if ( result < 0 )
case Receive:
if ( ptt_digital || ptt_ssb ) {
i->receiver->stop();
+ i->loudspeaker->drain();
i->loudspeaker->stop();
- stop_receive();
// Stop polling the receiver devices.
poll_fd_count = poll_fd_base;
i->keying_output->key(1);
- if ( ptt_digital ) {
+ // We could really start the microphone before we finish keying the
+ // transmitter, but at this writing ALSA snd_pcm_wait() doesn't
+ // really wait until the end of playback, and thus we hear the echo
+ // of the receiver if we start the microphone too early.
+ i->microphone->start();
+
+ if ( ptt_digital )
state = TransmitDigital;
- start_transmit_digital();
- }
- else {
+ else
state = TransmitSSB;
- start_transmit_ssb();
- }
- i->microphone->start();
i->transmitter->start();
// Start polling the transmitter devices.
if ( !add_poll_device(i->microphone) )
add_poll_device(i->transmitter);
- if ( ptt_digital ) {
+ if ( ptt_digital )
state = TransmitDigital;
- start_transmit_digital();
- }
- else {
+ else
state = TransmitSSB;
- start_transmit_ssb();
- }
}
else {
i->transmitter->stop();
// Stop polling the transmitter devices.
poll_fd_count = poll_fd_base;
- i->keying_output->key(0);
-
// Flush all of the FIFO data.
reset();
+ i->keying_output->key(0);
+
state = Receive;
- start_receive();
i->receiver->start();
i->loudspeaker->start();
}
}
- void
- Run::start_receive()
- {
- }
-
- void
- Run::start_transmit_digital()
- {
- }
-
- void
- Run::start_transmit_ssb()
- {
- }
-
- void
- Run::stop_receive()
- {
- }
-
void
Run::transmit_digital()
{