--- /dev/null
+#ifndef _MORSE_H
+#define _MORSE_H
+/*!
+ * Morse code library.
+ *
+ * This implements a state machine for playing back morse code messages.
+ *
+ * Author Stuart Longland <me@vk4msl.id.au>
+ * Copyright (C) 2015 FreeDV project.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License version 2.1,
+ * as published by the Free Software Foundation. This program is
+ * distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, see
+ * <http://www.gnu.org/licenses/>.
+ */
+
+#include "sfx.h"
+
+/*!
+ * Maximum length of a morse symbol, including gaps and termination.
+ * Allowing for 8 actual sub-symbols (dahs and dits), that's up to
+ * 8 gaps between plus a terminator.
+ */
+#define MORSE_SYM_LEN (17)
+
+/*!
+ * Morse code playback state machine
+ */
+struct morse_player_t {
+ /*! Symbol being transmitted */
+ struct sfx_note_t sym[MORSE_SYM_LEN];
+ /*!
+ * Pointer to the string being emitted. Playback is finished
+ * when this is NULL.
+ */
+ const char* msg;
+ /*! Sound effect player state machine */
+ struct sfx_player_t sfx_player;
+ /*! "Dit" period in milliseconds */
+ uint16_t dit_time;
+ /*! Tone frequency */
+ uint16_t freq;
+};
+
+/*!
+ * Play a morse code message.
+ * @param morse_player Morse code player state machine
+ * @param msg Message to play back (NULL == stop)
+ */
+void morse_play(struct morse_player_t* const morse_player,
+ const char* msg);
+
+/*!
+ * Retrieve the next sample to be played.
+ */
+int16_t morse_next(struct morse_player_t* const morse_player);
+
+#endif
--- /dev/null
+#ifndef _SFX_H
+#define _SFX_H
+/*!
+ * Sound effect player library.
+ *
+ * This implements a state machine for playing back various monophonic
+ * sound effects such as morse code symbols, clicks and alert tones.
+ *
+ * Author Stuart Longland <me@vk4msl.id.au>
+ * Copyright (C) 2015 FreeDV project.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License version 2.1,
+ * as published by the Free Software Foundation. This program is
+ * distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, see
+ * <http://www.gnu.org/licenses/>.
+ */
+
+#include "tone.h"
+
+/*!
+ * A sound effect "note"
+ */
+struct sfx_note_t {
+ /*! Note frequency. 0 == pause */
+ uint16_t freq;
+ /*! Note duration in msec. 0 == end of effect */
+ uint16_t duration;
+};
+
+/*!
+ * Sound effect player state machine
+ */
+struct sfx_player_t {
+ /*!
+ * Pointer to the current "note". When this is NULL,
+ * playback is complete.
+ */
+ const struct sfx_note_t* note;
+ /*! Tone generator state machine */
+ struct tone_gen_t tone_gen;
+};
+
+/*!
+ * Start playing a particular effect.
+ * @param sfx_player Effect player state machine
+ * @param effect Pointer to sound effect (NULL == stop)
+ */
+void sfx_play(struct sfx_player_t* const sfx_player,
+ const struct sfx_note_t* effect);
+
+/*!
+ * Retrieve the next sample to be played.
+ */
+int16_t sfx_next(struct sfx_player_t* const sfx_player);
+
+#endif
--- /dev/null
+/*---------------------------------------------------------------------------*\
+
+ FILE........: sine.h
+ AUTHOR......: David Rowe
+ DATE CREATED: 1/11/94
+
+ Header file for sinusoidal analysis and synthesis functions.
+
+\*---------------------------------------------------------------------------*/
+
+/*
+ Copyright (C) 2009 David Rowe
+
+ All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License version 2.1, as
+ published by the Free Software Foundation. This program is
+ distributed in the hope that it will be useful, but WITHOUT ANY
+ WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
+ License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef __SINE__
+#define __SINE__
+
+#include "defines.h"
+#include "comp.h"
+#include "kiss_fft.h"
+
+void make_analysis_window(kiss_fft_cfg fft_fwd_cfg, float w[], COMP W[]);
+float hpf(float x, float states[]);
+void dft_speech(kiss_fft_cfg fft_fwd_cfg, COMP Sw[], float Sn[], float w[]);
+void two_stage_pitch_refinement(MODEL *model, COMP Sw[]);
+void estimate_amplitudes(MODEL *model, COMP Sw[], COMP W[], int est_phase);
+float est_voicing_mbe(MODEL *model, COMP Sw[], COMP W[], COMP Sw_[],COMP Ew[],
+ float prev_Wo);
+void make_synthesis_window(float Pn[]);
+void synthesise(kiss_fft_cfg fft_inv_cfg, float Sn_[], MODEL *model, float Pn[], int shift);
+
+#define CODEC2_RAND_MAX 32767
+int codec2_rand(void);
+
+#endif
--- /dev/null
+#ifndef _SOUNDS_H
+#define _SOUNDS_H
+/*!
+ * Sound effect library.
+ *
+ * This provides some sound effects for the SM1000 UI.
+ *
+ * Author Stuart Longland <me@vk4msl.id.au>
+ * Copyright (C) 2015 FreeDV project.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License version 2.1,
+ * as published by the Free Software Foundation. This program is
+ * distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, see
+ * <http://www.gnu.org/licenses/>.
+ */
+
+#include "sfx.h"
+
+/*! Start-up tune */
+extern struct sfx_note_t sound_startup[];
+
+/*! Click sound */
+extern struct sfx_note_t sound_click[];
+
+#endif
--- /dev/null
+#ifndef _TONE_H
+#define _TONE_H
+/*!
+ * Fixed-point tone generator.
+ *
+ * The code here implements a simple fixed-point tone generator that uses
+ * integer arithmetic to generate a sinusoid at a fixed sample rate of
+ * 16kHz.
+ *
+ * To set the initial state of the state machine, you specify a frequency
+ * and duration using tone_reset. The corresponding C file embeds a
+ * sinusoid look-up table. The total number of samples is computed for
+ * the given time and used to initialise 'remain', 'time' is initialised
+ * to 0, and 'step' gives the amount to increment 'time' by each iteration.
+ *
+ * The samples are retrieved by repeatedly calling tone_next. This
+ * advances 'time' and decrements 'remain'. The tone is complete when
+ * 'remain' is zero.
+ *
+ * Author Stuart Longland <me@vk4msl.id.au>
+ * Copyright (C) 2015 FreeDV project.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License version 2.1,
+ * as published by the Free Software Foundation. This program is
+ * distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, see
+ * <http://www.gnu.org/licenses/>.
+ */
+
+#include <stdint.h>
+
+/*! Tone sampling rate in Hz. */
+#define TONE_FS 16000
+
+/*!
+ * Tone generator state. This holds the current state of the tone
+ * generator in order to decide what sample to release next.
+ */
+struct tone_gen_t {
+ /*! Current sample. (Q12) */
+ uint32_t sample;
+ /*!
+ * Time remaining in samples. (integer) Playback is finished
+ * when this reaches zero.
+ */
+ uint16_t remain;
+ /*!
+ * Subsample step (Q12). This is the number of samples (or part
+ * thereof) to advance "sample". Special case: when zero, sample
+ * is not advanced, silence is generated instead.
+ */
+ uint16_t step;
+};
+
+/*!
+ * Re-set the tone generator.
+ *
+ * @param tone_gen Tone generator to reset.
+ * @param freq Frequency in Hz, 0 = silence.
+ * @param duration Duration in milliseconds. 0 to stop.
+ */
+void tone_reset(
+ struct tone_gen_t* const tone_gen,
+ uint16_t freq, uint16_t duration);
+
+/*!
+ * Retrieve the next sample from the tone generator.
+ * @param tone_gen Tone generator to update.
+ */
+int16_t tone_next(
+ struct tone_gen_t* const tone_gen);
+
+/*!
+ * Retrieve the current time in milliseconds.
+ */
+uint32_t tone_msec(const struct tone_gen_t* const tone_gen);
+
+#endif
+++ /dev/null
-#ifndef _MORSE_H
-#define _MORSE_H
-/*!
- * Morse code library.
- *
- * This implements a state machine for playing back morse code messages.
- *
- * Author Stuart Longland <me@vk4msl.id.au>
- * Copyright (C) 2015 FreeDV project.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License version 2.1,
- * as published by the Free Software Foundation. This program is
- * distributed in the hope that it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, see
- * <http://www.gnu.org/licenses/>.
- */
-
-#include "sfx.h"
-
-/*!
- * Maximum length of a morse symbol, including gaps and termination.
- * Allowing for 8 actual sub-symbols (dahs and dits), that's up to
- * 8 gaps between plus a terminator.
- */
-#define MORSE_SYM_LEN (17)
-
-/*!
- * Morse code playback state machine
- */
-struct morse_player_t {
- /*! Symbol being transmitted */
- struct sfx_note_t sym[MORSE_SYM_LEN];
- /*!
- * Pointer to the string being emitted. Playback is finished
- * when this is NULL.
- */
- const char* msg;
- /*! Sound effect player state machine */
- struct sfx_player_t sfx_player;
- /*! "Dit" period in milliseconds */
- uint16_t dit_time;
- /*! Tone frequency */
- uint16_t freq;
-};
-
-/*!
- * Play a morse code message.
- * @param morse_player Morse code player state machine
- * @param msg Message to play back (NULL == stop)
- */
-void morse_play(struct morse_player_t* const morse_player,
- const char* msg);
-
-/*!
- * Retrieve the next sample to be played.
- */
-int16_t morse_next(struct morse_player_t* const morse_player);
-
-#endif
+++ /dev/null
-#ifndef _SFX_H
-#define _SFX_H
-/*!
- * Sound effect player library.
- *
- * This implements a state machine for playing back various monophonic
- * sound effects such as morse code symbols, clicks and alert tones.
- *
- * Author Stuart Longland <me@vk4msl.id.au>
- * Copyright (C) 2015 FreeDV project.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License version 2.1,
- * as published by the Free Software Foundation. This program is
- * distributed in the hope that it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, see
- * <http://www.gnu.org/licenses/>.
- */
-
-#include "tone.h"
-
-/*!
- * A sound effect "note"
- */
-struct sfx_note_t {
- /*! Note frequency. 0 == pause */
- uint16_t freq;
- /*! Note duration in msec. 0 == end of effect */
- uint16_t duration;
-};
-
-/*!
- * Sound effect player state machine
- */
-struct sfx_player_t {
- /*!
- * Pointer to the current "note". When this is NULL,
- * playback is complete.
- */
- const struct sfx_note_t* note;
- /*! Tone generator state machine */
- struct tone_gen_t tone_gen;
-};
-
-/*!
- * Start playing a particular effect.
- * @param sfx_player Effect player state machine
- * @param effect Pointer to sound effect (NULL == stop)
- */
-void sfx_play(struct sfx_player_t* const sfx_player,
- const struct sfx_note_t* effect);
-
-/*!
- * Retrieve the next sample to be played.
- */
-int16_t sfx_next(struct sfx_player_t* const sfx_player);
-
-#endif
+++ /dev/null
-/*---------------------------------------------------------------------------*\
-
- FILE........: sine.h
- AUTHOR......: David Rowe
- DATE CREATED: 1/11/94
-
- Header file for sinusoidal analysis and synthesis functions.
-
-\*---------------------------------------------------------------------------*/
-
-/*
- Copyright (C) 2009 David Rowe
-
- All rights reserved.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU Lesser General Public License version 2.1, as
- published by the Free Software Foundation. This program is
- distributed in the hope that it will be useful, but WITHOUT ANY
- WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
- License for more details.
-
- You should have received a copy of the GNU Lesser General Public License
- along with this program; if not, see <http://www.gnu.org/licenses/>.
-*/
-
-#ifndef __SINE__
-#define __SINE__
-
-#include "defines.h"
-#include "comp.h"
-#include "kiss_fft.h"
-
-void make_analysis_window(kiss_fft_cfg fft_fwd_cfg, float w[], COMP W[]);
-float hpf(float x, float states[]);
-void dft_speech(kiss_fft_cfg fft_fwd_cfg, COMP Sw[], float Sn[], float w[]);
-void two_stage_pitch_refinement(MODEL *model, COMP Sw[]);
-void estimate_amplitudes(MODEL *model, COMP Sw[], COMP W[], int est_phase);
-float est_voicing_mbe(MODEL *model, COMP Sw[], COMP W[], COMP Sw_[],COMP Ew[],
- float prev_Wo);
-void make_synthesis_window(float Pn[]);
-void synthesise(kiss_fft_cfg fft_inv_cfg, float Sn_[], MODEL *model, float Pn[], int shift);
-
-#define CODEC2_RAND_MAX 32767
-int codec2_rand(void);
-
-#endif
+++ /dev/null
-#ifndef _SOUNDS_H
-#define _SOUNDS_H
-/*!
- * Sound effect library.
- *
- * This provides some sound effects for the SM1000 UI.
- *
- * Author Stuart Longland <me@vk4msl.id.au>
- * Copyright (C) 2015 FreeDV project.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License version 2.1,
- * as published by the Free Software Foundation. This program is
- * distributed in the hope that it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, see
- * <http://www.gnu.org/licenses/>.
- */
-
-#include "sfx.h"
-
-/*! Start-up tune */
-extern struct sfx_note_t sound_startup[];
-
-/*! Click sound */
-extern struct sfx_note_t sound_click[];
-
-#endif
+++ /dev/null
-#ifndef _TONE_H
-#define _TONE_H
-/*!
- * Fixed-point tone generator.
- *
- * The code here implements a simple fixed-point tone generator that uses
- * integer arithmetic to generate a sinusoid at a fixed sample rate of
- * 16kHz.
- *
- * To set the initial state of the state machine, you specify a frequency
- * and duration using tone_reset. The corresponding C file embeds a
- * sinusoid look-up table. The total number of samples is computed for
- * the given time and used to initialise 'remain', 'time' is initialised
- * to 0, and 'step' gives the amount to increment 'time' by each iteration.
- *
- * The samples are retrieved by repeatedly calling tone_next. This
- * advances 'time' and decrements 'remain'. The tone is complete when
- * 'remain' is zero.
- *
- * Author Stuart Longland <me@vk4msl.id.au>
- * Copyright (C) 2015 FreeDV project.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License version 2.1,
- * as published by the Free Software Foundation. This program is
- * distributed in the hope that it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, see
- * <http://www.gnu.org/licenses/>.
- */
-
-#include <stdint.h>
-
-/*! Tone sampling rate in Hz. */
-#define TONE_FS 16000
-
-/*!
- * Tone generator state. This holds the current state of the tone
- * generator in order to decide what sample to release next.
- */
-struct tone_gen_t {
- /*! Current sample. (Q12) */
- uint32_t sample;
- /*!
- * Time remaining in samples. (integer) Playback is finished
- * when this reaches zero.
- */
- uint16_t remain;
- /*!
- * Subsample step (Q12). This is the number of samples (or part
- * thereof) to advance "sample". Special case: when zero, sample
- * is not advanced, silence is generated instead.
- */
- uint16_t step;
-};
-
-/*!
- * Re-set the tone generator.
- *
- * @param tone_gen Tone generator to reset.
- * @param freq Frequency in Hz, 0 = silence.
- * @param duration Duration in milliseconds. 0 to stop.
- */
-void tone_reset(
- struct tone_gen_t* const tone_gen,
- uint16_t freq, uint16_t duration);
-
-/*!
- * Retrieve the next sample from the tone generator.
- * @param tone_gen Tone generator to update.
- */
-int16_t tone_next(
- struct tone_gen_t* const tone_gen);
-
-/*!
- * Retrieve the current time in milliseconds.
- */
-uint32_t tone_msec(const struct tone_gen_t* const tone_gen);
-
-#endif