diff options
Diffstat (limited to 'stream')
-rw-r--r-- | stream/stream_radio.c | 21 | ||||
-rw-r--r-- | stream/stream_radio.h | 1 |
2 files changed, 22 insertions, 0 deletions
diff --git a/stream/stream_radio.c b/stream/stream_radio.c index bb19aa4fd7..2db3680d0f 100644 --- a/stream/stream_radio.c +++ b/stream/stream_radio.c @@ -981,6 +981,27 @@ int radio_set_freq(struct stream_st *stream, float frequency){ } /***************************************************************** + * \brief tune current frequency by step_interval value + * \parameter step_interval increment value + * \return 1 if success,0 - otherwise + * + */ +int radio_step_freq(struct stream_st *stream, float step_interval){ + float frequency; + radio_priv_t* priv=(radio_priv_t*)stream->priv; + + if (get_frequency(priv,&frequency)!=STREAM_OK) + return 0; + + frequency+=step_interval; + if (frequency>priv->rangehigh) + frequency=priv->rangehigh; + if (frequency<priv->rangelow) + frequency=priv->rangelow; + + return radio_set_freq(stream,frequency); +} +/***************************************************************** * \brief step channel up or down * \parameter direction RADIO_CHANNEL_LOWER - go to prev channel,RADIO_CHANNEL_HIGHER - to next * \return 1 if success,0 - otherwise diff --git a/stream/stream_radio.h b/stream/stream_radio.h index 3baca729a0..2d5ffb2cc4 100644 --- a/stream/stream_radio.h +++ b/stream/stream_radio.h @@ -22,6 +22,7 @@ int radio_get_freq(struct stream_st *stream, float* freq); char* radio_get_channel_name(struct stream_st *stream); int radio_set_channel(struct stream_st *stream, char *channel); int radio_step_channel(struct stream_st *stream, int direction); +int radio_step_freq(struct stream_st *stream, float step_interval); #endif |