Skip to content

Commit

Permalink
Merge pull request #194 from drowe67/ms-pulseaudio
Browse files Browse the repository at this point in the history
Add optional PulseAudio support for Linux users.
  • Loading branch information
tmiw authored Feb 5, 2022
2 parents 3c0d357 + 8f6822f commit ca2e467
Show file tree
Hide file tree
Showing 40 changed files with 2,825 additions and 3,320 deletions.
11 changes: 8 additions & 3 deletions .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,14 @@ jobs:
shell: bash
run: |
sudo apt-get update
sudo apt-get install libspeexdsp-dev libsamplerate0-dev sox git libwxgtk3.0-gtk3-dev portaudio19-dev libhamlib-dev libasound2-dev libao-dev libgsm1-dev libsndfile-dev
sudo apt-get install libpulse-dev libspeexdsp-dev libsamplerate0-dev sox git libwxgtk3.0-gtk3-dev portaudio19-dev libhamlib-dev libasound2-dev libao-dev libgsm1-dev libsndfile-dev
- name: Build freedv-gui
- name: Build freedv-gui using PortAudio
shell: bash
working-directory: ${{github.workspace}}
run: ./build_linux.sh
run: ./build_linux.sh portaudio

- name: Build freedv-gui using PulseAudio
shell: bash
working-directory: ${{github.workspace}}
run: ./build_linux.sh pulseaudio
42 changes: 31 additions & 11 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,11 @@ message(STATUS "Compilation date = XX${DATE_RESULT}XX")
# Set FreeDV version and generate src/version.h
#
set(FREEDV_VERSION_MAJOR 1)
set(FREEDV_VERSION_MINOR 6)
set(FREEDV_VERSION_PATCH 1)
set(FREEDV_VERSION_MINOR 7)
set(FREEDV_VERSION_PATCH 0)
set(FREEDV_VERSION_SUFFIX "")

set(FREEDV_VERSION ${FREEDV_VERSION_MAJOR}.${FREEDV_VERSION_MINOR})
if(FREEDV_VERSION_PATCH)
set(FREEDV_VERSION ${FREEDV_VERSION}.${FREEDV_VERSION_PATCH})
endif()
set(FREEDV_VERSION ${FREEDV_VERSION_MAJOR}.${FREEDV_VERSION_MINOR}.${FREEDV_VERSION_PATCH})
if(FREEDV_VERSION_SUFFIX)
set(FREEDV_VERSION_STRING "${FREEDV_VERSION} ${FREEDV_VERSION_SUFFIX}")
else()
Expand Down Expand Up @@ -122,6 +119,8 @@ set(USE_STATIC_SPEEXDSP FALSE CACHE BOOL
"Download and build static speex instead of the system library.")
set(BOOTSTRAP_WXWIDGETS FALSE CACHE BOOL
"Download and build static wxWidgets instead of the system library.")
set(USE_PULSEAUDIO FALSE CACHE BOOL
"Use PulseAudio instead of PortAudio for audio I/O.")

if(USE_STATIC_DEPS)
set(USE_STATIC_PORTAUDIO TRUE FORCE)
Expand Down Expand Up @@ -284,9 +283,9 @@ endif(CODEC2_BUILD_DIR)


#
# Find or build portaudio Library
# Find or build portaudio/PulseAudio Library
#
if(NOT USE_STATIC_PORTAUDIO)
if(NOT USE_STATIC_PORTAUDIO AND NOT USE_PULSEAUDIO)
message(STATUS "Looking for portaudio...")
find_package(portaudio-2.0 REQUIRED)
if(PORTAUDIO_FOUND)
Expand All @@ -309,10 +308,26 @@ On Windows it's easiest to use the cmake option: USE_STATIC_PORTAUDIO"
if(NOT ${PORTAUDIO_VERSION} EQUAL 19 AND NOT MINGW)
message(WARNING "Portaudio versions other than 19 are known to have issues. You have been warned!")
endif()
else(NOT USE_STATIC_PORTAUDIO)
elseif(USE_PULSEAUDIO)
message(STATUS "Finding PulseAudio...")
find_package(PulseAudio REQUIRED)
if(PULSEAUDIO_FOUND)
message(STATUS " PulseAudio library: ${PULSEAUDIO_LIBRARY}")
message(STATUS " PulseAudio headers: ${PULSEAUDIO_INCLUDE_DIR}")
list(APPEND FREEDV_LINK_LIBS ${PULSEAUDIO_LIBRARY})
include_directories(${PULSEAUDIO_INCLUDE_DIR})
add_definitions(-DAUDIO_ENGINE_PULSEAUDIO_ENABLE)
else()
message(FATAL_ERROR "PulseAudio library not found.
On Linux systems try installing:
pulseaudio-libs-devel (RPM based systems)
libpulse-dev (DEB based systems)
")
endif()
else()
message(STATUS "Will attempt static build of portaudio.")
include(cmake/Buildportaudio-2.0.cmake)
endif(NOT USE_STATIC_PORTAUDIO)
endif()

#
# Hamlib library
Expand Down Expand Up @@ -563,7 +578,12 @@ elseif(UNIX AND NOT APPLE)
# Linux packaging
SET(CPACK_GENERATOR "DEB")
SET(CPACK_DEBIAN_PACKAGE_MAINTAINER "Mooneer Salem <mooneer@gmail.com>") #required
SET(CPACK_DEBIAN_PACKAGE_DEPENDS "codec2 (>= 0.9.2), libspeexdsp1 (>= 1.2~rc1.2-1+b2), libsamplerate0 (>= 0.1.9-2), libwxgtk3.0-gtk3-0v5 (>= 3.0.4+dfsg-3), libportaudio2 (>= 19.6.0-1build1), libhamlib2 (>= 3.3-10build1), libasound2 (>= 1.1.8-1), libao4 (>= 1.2.2+20180113-1), libgsm1 (>= 1.0.18-2), libsndfile1 (>= 1.0.28-6)")
if(USE_PULSEAUDIO)
SET(CPACK_DEBIAN_PACKAGE_DEPENDS "codec2 (>= 1.0.0), libspeexdsp1 (>= 1.2~rc1.2-1+b2), libsamplerate0 (>= 0.1.9-2), libwxgtk3.0-gtk3-0v5 (>= 3.0.4+dfsg-3), libpulse0 (>= 14.2-2), libhamlib2 (>= 3.3-10build1), libasound2 (>= 1.1.8-1), libao4 (>= 1.2.2+20180113-1), libgsm1 (>= 1.0.18-2), libsndfile1 (>= 1.0.28-6)")
else(USE_PULSEAUDIO)
SET(CPACK_DEBIAN_PACKAGE_DEPENDS "codec2 (>= 1.0.0), libspeexdsp1 (>= 1.2~rc1.2-1+b2), libsamplerate0 (>= 0.1.9-2), libwxgtk3.0-gtk3-0v5 (>= 3.0.4+dfsg-3), libportaudio2 (>= 19.6.0-1build1), libhamlib2 (>= 3.3-10build1), libasound2 (>= 1.1.8-1), libao4 (>= 1.2.2+20180113-1), libgsm1 (>= 1.0.18-2), libsndfile1 (>= 1.0.28-6)")
endif(USE_PULSEAUDIO)

SET(CPACK_DEBIAN_FILE_NAME DEB-DEFAULT)
include(CPack)

Expand Down
41 changes: 37 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ This document describes how to build the FreeDV GUI program for various operatin
* [FreeDV GUI User Manual](USER_MANUAL.md)
* [Building for Windows using Docker](docker/README_docker.md)

## Building on Ubuntu Linux (16-20)
## Building on Ubuntu Linux (16-20) with PortAudio
```
$ sudo apt install libspeexdsp-dev libsamplerate0-dev sox git \
libwxgtk3.0-gtk3-dev portaudio19-dev libhamlib-dev libasound2-dev libao-dev \
libgsm1-dev libsndfile-dev cmake module-assistant build-essential
$ git clone https://github.com/drowe67/freedv-gui.git
$ cd freedv-gui
$ ./build_linux.sh
$ ./build_linux.sh portaudio
```
(For Ubuntu 20.04 the wxWidgets package is named `libwxgtk3.0-gtk3-dev`.)

Expand All @@ -26,21 +26,54 @@ This document describes how to build the FreeDV GUI program for various operatin

Note this builds all libraries locally, nothing is installed on your machine. ```make install``` is not required.

## Building on Fedora Linux
## Building on Fedora Linux with PortAudio
```
$ sudo dnf groupinstall "Development Tools"
$ sudo dnf install cmake wxGTK3-devel portaudio-devel libsamplerate-devel \
libsndfile-devel speexdsp-devel hamlib-devel alsa-lib-devel libao-devel \
gsm-devel
$ git clone https://github.com/drowe67/freedv-gui.git
$ cd freedv-gui
$ ./build_linux.sh
$ ./build_linux.sh portaudio
```
Then run with:
```
$ ./build_linux/src/freedv
```

## Building on Ubuntu Linux (16-20) with PulseAudio
```
$ sudo apt install libspeexdsp-dev libsamplerate0-dev sox git \
libwxgtk3.0-gtk3-dev libhamlib-dev libasound2-dev libao-dev \
libgsm1-dev libsndfile-dev cmake module-assistant build-essential libpulse-dev
$ git clone https://github.com/drowe67/freedv-gui.git
$ cd freedv-gui
$ ./build_linux.sh pulseaudio
```
(For Ubuntu 20.04 the wxWidgets package is named `libwxgtk3.0-gtk3-dev`.)

Then run with:
```
$ ./build_linux/src/freedv
```

Note this builds all libraries locally, nothing is installed on your machine. ```make install``` is not required.

## Building on Fedora Linux with PulseAudio
```
$ sudo dnf groupinstall "Development Tools"
$ sudo dnf install cmake wxGTK3-devel libsamplerate-devel \
libsndfile-devel speexdsp-devel hamlib-devel alsa-lib-devel libao-devel \
gsm-devel pulseaudio-libs-devel
$ git clone https://github.com/drowe67/freedv-gui.git
$ cd freedv-gui
$ ./build_linux.sh pulseaudio
```
Then run with:
```
$ ./build_linux/src/freedv
```

## Installing on Linux

You need to install the codec2 and lpcnetfreedv shared libraries, and freedv-gui:
Expand Down
54 changes: 44 additions & 10 deletions USER_MANUAL.html
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,41 @@ <h1 id="glossary"><span class="header-section-number">15</span> Glossary</h1>
</tbody>
</table>
<h1 id="release-notes"><span class="header-section-number">16</span> Release Notes</h1>
<h2 id="v1.6.1-september-2021"><span class="header-section-number">16.1</span> V1.6.1 September 2021</h2>
<h2 id="v1.7.0-february-2022"><span class="header-section-number">16.1</span> V1.7.0 February 2022</h2>
<ol type="1">
<li>Bugfixes:
<ul>
<li>Resolves issue with waterfall appearing garbled on some systems. (PR #205)</li>
<li>Resolves issue with Restore Defaults restoring previous settings on exit. (PR #207)</li>
<li>Resolves issue with some sound valid sound devices causing PortAudio errors during startup checks. (PR #192)</li>
</ul></li>
<li>Enhancements:
<ul>
<li>Removes requirement to restart FreeDV after using Restore Defaults. (PR #207)</li>
<li>Hides frequency display on main window unless PSK Reporter reporting is turned on. (PR #207)</li>
<li>Scales per-mode squelch settings when in multi-RX mode to reduce unwanted noise. (PR #186)</li>
<li>Single-thread mode is now the default when multi-RX is turned on. (PR #175)</li>
<li>Makes multi-RX mode the default. (PR #175)</li>
<li>Mic In/Speaker Out volume controls added to Filter window. (PR #208)</li>
<li>Cleans up UI for filters and makes the dialog non-modal. (PR #208)</li>
<li>Adds optional support for PulseAudio on Linux systems. (PR #194)</li>
</ul></li>
<li>Documentation:
<ul>
<li>Adds section on creating Windows shortcuts to handle multiple configurations. (PR #204)</li>
<li>Resolves issue with PDF image placement. (PR #203)</li>
</ul></li>
<li>Build System:
<ul>
<li>Uses more portable way of referring to Bash in build scripts. (PR #200)</li>
<li>User manual now installed along with executable. (PR #187)</li>
<li>macOS app bundle generated by CMake instead of manually. (PR #184)</li>
<li>Fail as soon as a step in the build script fails. (PR #183)</li>
<li>Have Windows uninstaller clean up Registry. (PR #182)</li>
<li>Windows installer now installs sample .wav files. (PR #182)</li>
</ul></li>
</ol>
<h2 id="v1.6.1-september-2021"><span class="header-section-number">16.2</span> V1.6.1 September 2021</h2>
<ol type="1">
<li>Bugfixes:
<ul>
Expand All @@ -571,7 +605,7 @@ <h2 id="v1.6.1-september-2021"><span class="header-section-number">16.1</span> V
</ul></li>
</ol>
<p><em>Note: The PSK Reporter feature beginning in this release is incompatible with versions older than 1.6.1 due to a change in how callsigns are encoded.</em></p>
<h2 id="v1.6.0-august-2021"><span class="header-section-number">16.2</span> V1.6.0 August 2021</h2>
<h2 id="v1.6.0-august-2021"><span class="header-section-number">16.3</span> V1.6.0 August 2021</h2>
<ol type="1">
<li>Bugfixes:
<ul>
Expand Down Expand Up @@ -606,51 +640,51 @@ <h2 id="v1.6.0-august-2021"><span class="header-section-number">16.2</span> V1.6
<li>Created “make dist” target for easy tarball generation. (PR #152)</li>
</ul></li>
</ol>
<h2 id="v1.5.3-april-2021"><span class="header-section-number">16.3</span> V1.5.3 April 2021</h2>
<h2 id="v1.5.3-april-2021"><span class="header-section-number">16.4</span> V1.5.3 April 2021</h2>
<ol type="1">
<li>Simultaneous decode of 2020, 1600 and 700C/D/E (without needing to push Stop first, change the mode and push Start again).</li>
<li>Dynamic switching of the current Tx mode between the aforementioned modes, again without needing to restart the session.</li>
<li>A Tx level slider on the right hand side of the main screen to fine-tune transmit output (to more easily avoid clipping ALC and conflicting with other soundcard ham radio applications).</li>
</ol>
<h2 id="v1.5.2-january-2021"><span class="header-section-number">16.4</span> V1.5.2 January 2021</h2>
<h2 id="v1.5.2-january-2021"><span class="header-section-number">16.5</span> V1.5.2 January 2021</h2>
<ol type="1">
<li>Updates storage for sound card configuration to use device names instead of IDs.</li>
<li>Detects changes to computer sound card configuration and notifies user when devices go away.</li>
</ol>
<h2 id="v1.5.1-january-2021"><span class="header-section-number">16.5</span> V1.5.1 January 2021</h2>
<h2 id="v1.5.1-january-2021"><span class="header-section-number">16.6</span> V1.5.1 January 2021</h2>
<ol type="1">
<li>Experimental support for reporting to <a href="https://pskreporter.info">PSK Reporter</a> added.</li>
<li>Bug fixes with audio configuration to allow mono devices to be used along with stereo ones.</li>
<li>Tweaks to user interface and record/playback functionality to improve usability.</li>
<li>Bug fixes and tweaks to improve voice keyer support.</li>
</ol>
<h2 id="v1.5.0-december-2020"><span class="header-section-number">16.6</span> V1.5.0 December 2020</h2>
<h2 id="v1.5.0-december-2020"><span class="header-section-number">16.7</span> V1.5.0 December 2020</h2>
<ol type="1">
<li>FreeDV 700E, better performance than 700D on fast fading channels</li>
<li>FreeDV 700D/700E clipper to increase average transmit power by 6dB</li>
</ol>
<h2 id="v1.4.3-august-2020"><span class="header-section-number">16.7</span> V1.4.3 August 2020</h2>
<h2 id="v1.4.3-august-2020"><span class="header-section-number">16.8</span> V1.4.3 August 2020</h2>
<ol type="1">
<li>Maintenance Release (no major new features)</li>
<li>Changes to support wxWidgets 3.1 (but Windows versions built against wxWidgets 3.0)</li>
<li>Under the hood - OFDM modem has been refactored, shouldn’t affect freedv-gui operation</li>
</ol>
<h2 id="v1.4.2-july-2020"><span class="header-section-number">16.8</span> V1.4.2 July 2020</h2>
<h2 id="v1.4.2-july-2020"><span class="header-section-number">16.9</span> V1.4.2 July 2020</h2>
<ol type="1">
<li>Maintenance Release (no major new features)</li>
<li>Improved squelch/audio pass through on 700D/2020/2400B</li>
<li>Under the hood - Codec2 library has been refactored, shouldn’t affect freedv-gui operation</li>
<li>Removed Project Horus support (now being maintained outside of Codec2/FreeDV)</li>
</ol>
<h2 id="v1.4-june-october-2019"><span class="header-section-number">16.9</span> V1.4 June-October 2019</h2>
<h2 id="v1.4-june-october-2019"><span class="header-section-number">16.10</span> V1.4 June-October 2019</h2>
<ol type="1">
<li>FreeDV 2020, Project Horus Binary Modes.</li>
<li><a href="http://www.rowetel.com/?p=6824">Improved OFDM Modem Acquisition</a>, this will improve sync time on FreeDV 700D and 2020 on HF fading channels, and can also handle +/- 60 Hz frequency offsets when tuning.</li>
<li>Fixed FreeDV 700C frequency offset bug fix, was losing sync at certain frequency offsets.</li>
<li>Wide bandwidth phase estimation and DPSK for OFDM modes (700D/2020) for fast fading/QO-100 channels (Tools-Options)</li>
<li>Better speech quality on FreeDV 700C/700D with Auto equaliser (Tools-Filter)</li>
</ol>
<h2 id="v1.3-may-2018"><span class="header-section-number">16.10</span> V1.3 May 2018</h2>
<h2 id="v1.3-may-2018"><span class="header-section-number">16.11</span> V1.3 May 2018</h2>
<ul>
<li>FreeDV 700D</li>
</ul>
Expand Down
26 changes: 26 additions & 0 deletions USER_MANUAL.md
Original file line number Diff line number Diff line change
Expand Up @@ -760,6 +760,32 @@ LDPC | Low Density Parity Check Codes - a family of powerful FEC codes

# Release Notes

## V1.7.0 February 2022

1. Bugfixes:
* Resolves issue with waterfall appearing garbled on some systems. (PR #205)
* Resolves issue with Restore Defaults restoring previous settings on exit. (PR #207)
* Resolves issue with some sound valid sound devices causing PortAudio errors during startup checks. (PR #192)
2. Enhancements:
* Removes requirement to restart FreeDV after using Restore Defaults. (PR #207)
* Hides frequency display on main window unless PSK Reporter reporting is turned on. (PR #207)
* Scales per-mode squelch settings when in multi-RX mode to reduce unwanted noise. (PR #186)
* Single-thread mode is now the default when multi-RX is turned on. (PR #175)
* Makes multi-RX mode the default. (PR #175)
* Mic In/Speaker Out volume controls added to Filter window. (PR #208)
* Cleans up UI for filters and makes the dialog non-modal. (PR #208)
* Adds optional support for PulseAudio on Linux systems. (PR #194)
3. Documentation:
* Adds section on creating Windows shortcuts to handle multiple configurations. (PR #204)
* Resolves issue with PDF image placement. (PR #203)
4. Build System:
* Uses more portable way of referring to Bash in build scripts. (PR #200)
* User manual now installed along with executable. (PR #187)
* macOS app bundle generated by CMake instead of manually. (PR #184)
* Fail as soon as a step in the build script fails. (PR #183)
* Have Windows uninstaller clean up Registry. (PR #182)
* Windows installer now installs sample .wav files. (PR #182)

## V1.6.1 September 2021

1. Bugfixes:
Expand Down
Binary file modified USER_MANUAL.pdf
Binary file not shown.
14 changes: 12 additions & 2 deletions build_linux.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
#!/usr/bin/env bash
# build_ubuntu.sh
# build_linux.sh
#
# Build script for Ubuntu and Fedora Linux, git pulls codec2 and
# lpcnet repos so they are available for parallel development.

# Echo what you are doing, and fail if any of the steps fail:
set -x -e

# Allow building of either PulseAudio or PortAudio variants
FREEDV_VARIANT=${1:-portaudio}
if [[ "$FREEDV_VARIANT" != "portaudio" && "$FREEDV_VARIANT" != "pulseaudio" ]]; then
echo "Usage: build_linux.sh [portaudio|pulseaudio]"
exit -1
fi

export FREEDVGUIDIR=${PWD}
export CODEC2DIR=$FREEDVGUIDIR/codec2
export LPCNETDIR=$FREEDVGUIDIR/LPCNet
Expand Down Expand Up @@ -46,5 +53,8 @@ export LD_LIBRARY_PATH=$LPCNETDIR/build_linux/src
# Finally, build freedv-gui
cd $FREEDVGUIDIR && git pull
mkdir -p build_linux && cd build_linux && rm -Rf *
cmake -DCMAKE_BUILD_TYPE=Debug -DCODEC2_BUILD_DIR=$CODEC2DIR/build_linux -DLPCNET_BUILD_DIR=$LPCNETDIR/build_linux ..
if [[ "$FREEDV_VARIANT" == "pulseaudio" ]]; then
PULSEAUDIO_PARAM="-DUSE_PULSEAUDIO=1"
fi
cmake $PULSEAUDIO_PARAM -DCMAKE_BUILD_TYPE=Debug -DCODEC2_BUILD_DIR=$CODEC2DIR/build_linux -DLPCNET_BUILD_DIR=$LPCNETDIR/build_linux ..
make VERBOSE=1
2 changes: 1 addition & 1 deletion build_osx.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ cd $FREEDVGUIDIR
if [ ! -d codec2 ]; then
git clone https://github.com/drowe67/codec2.git
fi
cd codec2 && git checkout ms-reliable-text && git pull
cd codec2 && git checkout master && git pull
mkdir -p build_osx && cd build_osx && rm -Rf * && cmake -DBUILD_OSX_UNIVERSAL=1 .. && make -j4

# OK, build and test LPCNet
Expand Down
2 changes: 1 addition & 1 deletion docker/fdv_win_fedora/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ FROM fedora:${FED_REL}
# tar: bzip2
# arm-none-eabi-gdb: ncurses-compat-libs

RUN dnf -y install --setopt=install_weak_deps=False @development-tools cmake git speexdsp-devel libsamplerate-devel octave octave-signal gnuplot sox python3-numpy automake libtool libusb1-devel wget bc glibc.i686 which bzip2 ncurses-compat-libs && useradd -m build
RUN dnf -y install --setopt=install_weak_deps=False @development-tools cmake git speexdsp-devel libsamplerate-devel octave octave-signal gnuplot sox python3-numpy automake libtool libusb1-devel wget bc glibc.i686 which bzip2 ncurses-compat-libs gcc gcc-c++ && useradd -m build

# specific for windows mingw build
RUN dnf install -y dnf-plugins-core
Expand Down
Loading

0 comments on commit ca2e467

Please sign in to comment.