libsstvenc
Asynchronous Analogue SSTV encoder
|
Topics | |
Pulse Shaper States | |
Data Structures | |
struct | sstvenc_pulseshape |
Macros | |
#define | SSTVENC_PS_HOLD_TIME_INF SSTVENC_TS_INFINITE |
Functions | |
void | sstvenc_ps_reset_samples (struct sstvenc_pulseshape *const ps, uint32_t hold_time) |
void | sstvenc_ps_reset (struct sstvenc_pulseshape *const ps, double hold_time, uint8_t time_unit) |
void | sstvenc_ps_init (struct sstvenc_pulseshape *const ps, double amplitude, double rise_time, double hold_time, double fall_time, uint32_t sample_rate, uint8_t time_unit) |
void | sstvenc_ps_advance (struct sstvenc_pulseshape *const ps) |
void | sstvenc_ps_compute (struct sstvenc_pulseshape *const ps) |
size_t | sstvenc_psosc_fill_buffer (struct sstvenc_pulseshape *const ps, struct sstvenc_oscillator *const osc, double *buffer, size_t buffer_sz) |
The purpose of this module is to drive the amplitude of an oscillator to ensure the waveform generated contains as few artefacts as possible.
struct sstvenc_pulseshape |
Pulse shaper data structure. This should be initialised by calling sstvenc_ps_init.
Definition at line 89 of file pulseshape.h.
#define SSTVENC_PS_HOLD_TIME_INF SSTVENC_TS_INFINITE |
Hold time = infinite.
Definition at line 83 of file pulseshape.h.
Referenced by sstvenc_ps_compute().
void sstvenc_ps_advance | ( | struct sstvenc_pulseshape *const | ps | ) |
Advance the pulse shaper to the next phase, regardless of whether it is finished with the present one. A no-op at the "done" phase.
[out] | ps | The pulse shaper being advanced. |
Definition at line 56 of file pulseshape.c.
References sstvenc_pulseshape::phase, sstvenc_pulseshape::sample_idx, and SSTVENC_PS_PHASE_DONE.
Referenced by sstvenc_modulator_next_hold_sample(), sstvenc_ps_compute(), and sstvenc_sequencer_advance().
void sstvenc_ps_compute | ( | struct sstvenc_pulseshape *const | ps | ) |
Compute the next pulse shaper value and store it in the output field. A no-op if the sample rate is set to zero or the pulse shaper is done.
The output envelope amplitude can be read from sstvenc_pulseshape::output.
[out] | ps | The pulse shaper being computed. |
Definition at line 63 of file pulseshape.c.
References sstvenc_pulseshape::amplitude, sstvenc_pulseshape::fall_sz, sstvenc_pulseshape::hold_sz, sstvenc_pulseshape::output, sstvenc_pulseshape::phase, sstvenc_pulseshape::rise_sz, sstvenc_pulseshape::sample_idx, sstvenc_ps_advance(), SSTVENC_PS_HOLD_TIME_INF, SSTVENC_PS_PHASE_DONE, SSTVENC_PS_PHASE_FALL, SSTVENC_PS_PHASE_HOLD, SSTVENC_PS_PHASE_INIT, and SSTVENC_PS_PHASE_RISE.
Referenced by sstvenc_cw_handle_state_dahspace(), sstvenc_cw_handle_state_ditspace(), sstvenc_cw_handle_state_mark(), sstvenc_modulator_next_fall_sample(), sstvenc_modulator_next_hold_sample(), sstvenc_modulator_next_rise_sample(), sstvenc_psosc_fill_buffer(), and sstvenc_sequencer_compute().
void sstvenc_ps_init | ( | struct sstvenc_pulseshape *const | ps, |
double | amplitude, | ||
double | rise_time, | ||
double | hold_time, | ||
double | fall_time, | ||
uint32_t | sample_rate, | ||
uint8_t | time_unit ) |
Initialise a pulse shaper.
[out] | ps | The pulse shaper being initialised |
[in] | amplitude | The peak amplitude for the pulse shaper |
[in] | rise_time | The rise time in seconds, use 0 to disable rise. |
[in] | hold_time | The hold time in seconds, use INFINITY for an indefinite hold. |
[in] | fall_time | The fall time in seconds, use 0 to disable fall. |
[in] | sample_rate | The sample rate in Hz. |
[in] | time_unit | The time unit used to measure rise_time, hold_time and fall_time. |
Definition at line 28 of file pulseshape.c.
References sstvenc_pulseshape::amplitude, sstvenc_pulseshape::fall_sz, sstvenc_pulseshape::output, sstvenc_pulseshape::rise_sz, sstvenc_pulseshape::sample_rate, sstvenc_ps_reset(), and sstvenc_ts_unit_to_samples().
Referenced by sstvenc_cw_init(), sstvenc_modulator_init(), and sstvenc_sequencer_begin_tone().
void sstvenc_ps_reset | ( | struct sstvenc_pulseshape *const | ps, |
double | hold_time, | ||
uint8_t | time_unit ) |
Reset the pulse shape state machine with a new hold time, but otherwise identical settings.
[in,out] | ps | Pulse shaper context being reset |
[in] | hold_time | New hold time given in the time unit specified by time_unit. |
[in] | time_unit | Time unit used to measure hold_time. Must be one of the values given in Time-scale units |
Definition at line 21 of file pulseshape.c.
References sstvenc_pulseshape::sample_rate, sstvenc_ps_reset_samples(), and sstvenc_ts_unit_to_samples().
Referenced by sstvenc_cw_end_subsym(), sstvenc_cw_end_symbol(), and sstvenc_ps_init().
void sstvenc_ps_reset_samples | ( | struct sstvenc_pulseshape *const | ps, |
uint32_t | hold_time ) |
Reset the pulse shape state machine with a new hold time given in samples, but otherwise identical settings.
[in,out] | ps | Pulse shaper context being reset |
[in] | hold_time | New hold time (given as number of samples). |
Definition at line 14 of file pulseshape.c.
References sstvenc_pulseshape::hold_sz, sstvenc_pulseshape::phase, sstvenc_pulseshape::sample_idx, and SSTVENC_PS_PHASE_INIT.
Referenced by sstvenc_cw_start_mark(), and sstvenc_ps_reset().
size_t sstvenc_psosc_fill_buffer | ( | struct sstvenc_pulseshape *const | ps, |
struct sstvenc_oscillator *const | osc, | ||
double * | buffer, | ||
size_t | buffer_sz ) |
Fill the given buffer with audio samples from the oscillator shaped with the given pulse shaper. Stop if we run out of buffer space or if the pulse shaper state machine finishes. Return the number of samples generated.
[in,out] | ps | Pulse shaper state machine to pull envelope samples from. |
[in,out] | osc | Sine wave oscillator. Its amplitude will be modulated by the pulse shaper. |
[out] | buffer | Audio buffer to write samples to. |
[in] | buffer_sz | Size of the audio buffer in samples. |
Definition at line 119 of file pulseshape.c.
References sstvenc_oscillator::amplitude, sstvenc_oscillator::output, sstvenc_pulseshape::output, sstvenc_pulseshape::phase, sstvenc_osc_compute(), sstvenc_ps_compute(), and SSTVENC_PS_PHASE_DONE.