Listing 3-1. Caesar_Cipher_ThreadType::Run() New
Implementation
3-20
Getting Started with ADSP-BF537 EZ-KIT Lite
if ( volume < 0.0 )
volume = 0.0;
else if ( volume > 48.0 )
volume = 48.0;
/*
* Send a message to the Attenuator thread.
* Note that zero is maximum volume and 48.0 is mute,
* the opposite of "expected" behavior, so we
* inverse the argument here.
*/
extern VDK::ThreadID g_AttenuatorID;
float message_args[] = { 48.0 - volume };
VDK::SetMessagePayload ( msg, VOL_CHANGE,
sizeof(message_args)/sizeof(float), message_args );
VDK::PostMessage ( g_AttenuatorID, msg,
CONTROL_CHANNEL );
msg = VDK::PendMessage ( RETURN_BUFF_CHANNEL, 0 );
sprintf ( m_vOutBuf, "\xa\xdVolume is now %g of
%g.\xa\xd", volume, 48.0 );
if ( send ( m_iSocket, m_vOutBuf, strlen ( m_vOutBuf
), 0 ) <= 0 )
break;
}
}
}
else
{
break;
}
}
close ( m_iSocket );
}
www.BDTIC.com/ADI