diff options
872 files changed, 25548 insertions, 2360 deletions
diff --git a/.gitignore b/.gitignore index 5fa883862..233e153a5 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +/build # # NOTE! Don't add files that are generated in specific # subdirectories here. Add them in the ".gitignore" file diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 000000000..2536a9731 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,205 @@ +# Copyright 2010-2011 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio 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 General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. + +######################################################################## +IF(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR}) + MESSAGE(FATAL_ERROR "Prevented in-tree built. This is bad practice.") +ENDIF(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR}) + +######################################################################## +# Project setup +######################################################################## +CMAKE_MINIMUM_REQUIRED(VERSION 2.6) +PROJECT(gnuradio CXX C) +ENABLE_TESTING() + +#select the release build type by default to get optimization flags +IF(NOT CMAKE_BUILD_TYPE) + SET(CMAKE_BUILD_TYPE "Release") + MESSAGE(STATUS "Build type not specified: defaulting to release.") +ENDIF(NOT CMAKE_BUILD_TYPE) +SET(CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE} CACHE STRING "") + +LIST(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/Modules) + +INCLUDE(GrVersion) #setup version info + +######################################################################## +# Compiler specific setup +######################################################################## +IF(CMAKE_COMPILER_IS_GNUCXX AND NOT WIN32) + #http://gcc.gnu.org/wiki/Visibility + ADD_DEFINITIONS(-fvisibility=hidden) +ENDIF() + +IF(CMAKE_COMPILER_IS_GNUCXX) + ADD_DEFINITIONS(-Wsign-compare) +ENDIF(CMAKE_COMPILER_IS_GNUCXX) + +IF(MSVC) + INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/cmake/msvc) #missing headers + ADD_DEFINITIONS(-D_WIN32_WINNT=0x0501) #minimum version required is windows xp + ADD_DEFINITIONS(-DNOMINMAX) #disables stupidity and enables std::min and std::max + ADD_DEFINITIONS( #stop all kinds of compatibility warnings + -D_SCL_SECURE_NO_WARNINGS + -D_CRT_SECURE_NO_WARNINGS + -D_CRT_SECURE_NO_DEPRECATE + -D_CRT_NONSTDC_NO_DEPRECATE + ) + ADD_DEFINITIONS(-DHAVE_CONFIG_H) + ADD_DEFINITIONS(/MP) #build with multiple processors +ENDIF(MSVC) + +######################################################################## +# Install directories +######################################################################## +INCLUDE(GrPlatform) #define LIB_SUFFIX +SET(GR_RUNTIME_DIR bin) +SET(GR_LIBRARY_DIR lib${LIB_SUFFIX}) +SET(GR_INCLUDE_DIR include) +SET(GR_DATA_DIR share) +SET(GR_PKG_DATA_DIR ${GR_DATA_DIR}/${CMAKE_PROJECT_NAME}) +SET(GR_DOC_DIR ${GR_DATA_DIR}/doc) +SET(GR_PKG_DOC_DIR ${GR_DOC_DIR}/${CMAKE_PROJECT_NAME}-${LIBVER}) +SET(GR_CONF_DIR etc) +SET(GR_PKG_CONF_DIR ${GR_CONF_DIR}/${CMAKE_PROJECT_NAME}) +SET(GR_LIBEXEC_DIR libexec) +SET(GR_PKG_LIBEXEC_DIR ${GR_LIBEXEC_DIR}/${CMAKE_PROJECT_NAME}) +SET(GRC_BLOCKS_DIR ${GR_PKG_DATA_DIR}/grc/blocks) + +######################################################################## +# Variables replaced when configuring the package config files +######################################################################## +FILE(TO_NATIVE_PATH "${CMAKE_INSTALL_PREFIX}" prefix) +FILE(TO_NATIVE_PATH "\${prefix}" exec_prefix) +FILE(TO_NATIVE_PATH "\${exec_prefix}/${GR_LIBRARY_DIR}" libdir) +FILE(TO_NATIVE_PATH "\${prefix}/${GR_INCLUDE_DIR}" includedir) + +######################################################################## +# Create uninstall target +######################################################################## +CONFIGURE_FILE( + ${CMAKE_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in + ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake +@ONLY) + +ADD_CUSTOM_TARGET(uninstall + ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake +) + +######################################################################## +# Enable python component +######################################################################## +FIND_PACKAGE(PythonLibs) +FIND_PACKAGE(SWIG) +INCLUDE(GrComponent) +GR_REGISTER_COMPONENT("python-support" ENABLE_PYTHON + PYTHONLIBS_FOUND + SWIG_FOUND +) + +FIND_PACKAGE(CppUnit) +GR_REGISTER_COMPONENT("testing-support" ENABLE_TESTING + CPPUNIT_FOUND +) + +######################################################################## +# Add optional dlls specified in DLL_PATHS +######################################################################## +FOREACH(path ${DLL_PATHS}) + FILE(GLOB _dlls "${path}/*.dll") + LIST(APPEND ALL_DLL_FILES ${_dlls}) +ENDFOREACH(path) +IF(DEFINED ALL_DLL_FILES) + INCLUDE(GrPackage) + CPACK_COMPONENT("extra_dlls" + DISPLAY_NAME "Extra DLLs" + DESCRIPTION "Extra DLLs for runtime dependency requirements" + ) + MESSAGE(STATUS "") + MESSAGE(STATUS "Including the following dlls into the install:") + FOREACH(_dll ${ALL_DLL_FILES}) + MESSAGE(STATUS " ${_dll}") + ENDFOREACH(_dll) + INSTALL(FILES ${ALL_DLL_FILES} DESTINATION ${GR_RUNTIME_DIR} COMPONENT "extra_dlls") +ENDIF() + +######################################################################## +# Setup volk as a subproject +######################################################################## +INCLUDE(GrComponent) +GR_REGISTER_COMPONENT("volk" ENABLE_VOLK) + +SET(VOLK_INCLUDE_DIRS + ${CMAKE_CURRENT_SOURCE_DIR}/volk/include + ${CMAKE_CURRENT_BINARY_DIR}/volk/include +) + +IF(ENABLE_VOLK) + +INCLUDE(GrPackage) +CPACK_SET(CPACK_COMPONENT_GROUP_VOLK_DESCRIPTION "Vector optimized library of kernels") + +CPACK_COMPONENT("volk_runtime" + GROUP "Volk" + DISPLAY_NAME "Runtime" + DESCRIPTION "Dynamic link libraries" +) + +CPACK_COMPONENT("volk_devel" + GROUP "Volk" + DISPLAY_NAME "Development" + DESCRIPTION "C++ headers, package config, import libraries" +) + + +ADD_SUBDIRECTORY(volk) +ENDIF(ENABLE_VOLK) + +######################################################################## +# Add subdirectories +######################################################################## +ADD_SUBDIRECTORY(gruel) +ADD_SUBDIRECTORY(gnuradio-core) +ADD_SUBDIRECTORY(grc) +ADD_SUBDIRECTORY(docs) + +ADD_SUBDIRECTORY(gr-atsc) +ADD_SUBDIRECTORY(gr-audio) +ADD_SUBDIRECTORY(gr-comedi) +ADD_SUBDIRECTORY(gr-digital) +ADD_SUBDIRECTORY(gr-noaa) +ADD_SUBDIRECTORY(gr-pager) +ADD_SUBDIRECTORY(gr-qtgui) +ADD_SUBDIRECTORY(gr-trellis) +ADD_SUBDIRECTORY(gr-uhd) +ADD_SUBDIRECTORY(gr-video-sdl) +ADD_SUBDIRECTORY(gr-vocoder) +ADD_SUBDIRECTORY(gr-wxgui) + +#finalize cpack after subdirs processed +INCLUDE(GrPackage) +CPACK_FINALIZE() + +######################################################################## +# Print summary +######################################################################## +GR_PRINT_COMPONENT_SUMMARY() +MESSAGE(STATUS "Using install prefix: ${CMAKE_INSTALL_PREFIX}") +MESSAGE(STATUS "Building for version: ${VERSION}") diff --git a/cmake/Modules/CMakeParseArgumentsCopy.cmake b/cmake/Modules/CMakeParseArgumentsCopy.cmake new file mode 100644 index 000000000..7ce4c49ae --- /dev/null +++ b/cmake/Modules/CMakeParseArgumentsCopy.cmake @@ -0,0 +1,138 @@ +# CMAKE_PARSE_ARGUMENTS(<prefix> <options> <one_value_keywords> <multi_value_keywords> args...) +# +# CMAKE_PARSE_ARGUMENTS() is intended to be used in macros or functions for +# parsing the arguments given to that macro or function. +# It processes the arguments and defines a set of variables which hold the +# values of the respective options. +# +# The <options> argument contains all options for the respective macro, +# i.e. keywords which can be used when calling the macro without any value +# following, like e.g. the OPTIONAL keyword of the install() command. +# +# The <one_value_keywords> argument contains all keywords for this macro +# which are followed by one value, like e.g. DESTINATION keyword of the +# install() command. +# +# The <multi_value_keywords> argument contains all keywords for this macro +# which can be followed by more than one value, like e.g. the TARGETS or +# FILES keywords of the install() command. +# +# When done, CMAKE_PARSE_ARGUMENTS() will have defined for each of the +# keywords listed in <options>, <one_value_keywords> and +# <multi_value_keywords> a variable composed of the given <prefix> +# followed by "_" and the name of the respective keyword. +# These variables will then hold the respective value from the argument list. +# For the <options> keywords this will be TRUE or FALSE. +# +# All remaining arguments are collected in a variable +# <prefix>_UNPARSED_ARGUMENTS, this can be checked afterwards to see whether +# your macro was called with unrecognized parameters. +# +# As an example here a my_install() macro, which takes similar arguments as the +# real install() command: +# +# function(MY_INSTALL) +# set(options OPTIONAL FAST) +# set(oneValueArgs DESTINATION RENAME) +# set(multiValueArgs TARGETS CONFIGURATIONS) +# cmake_parse_arguments(MY_INSTALL "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} ) +# ... +# +# Assume my_install() has been called like this: +# my_install(TARGETS foo bar DESTINATION bin OPTIONAL blub) +# +# After the cmake_parse_arguments() call the macro will have set the following +# variables: +# MY_INSTALL_OPTIONAL = TRUE +# MY_INSTALL_FAST = FALSE (this option was not used when calling my_install() +# MY_INSTALL_DESTINATION = "bin" +# MY_INSTALL_RENAME = "" (was not used) +# MY_INSTALL_TARGETS = "foo;bar" +# MY_INSTALL_CONFIGURATIONS = "" (was not used) +# MY_INSTALL_UNPARSED_ARGUMENTS = "blub" (no value expected after "OPTIONAL" +# +# You can the continue and process these variables. +# +# Keywords terminate lists of values, e.g. if directly after a one_value_keyword +# another recognized keyword follows, this is interpreted as the beginning of +# the new option. +# E.g. my_install(TARGETS foo DESTINATION OPTIONAL) would result in +# MY_INSTALL_DESTINATION set to "OPTIONAL", but MY_INSTALL_DESTINATION would +# be empty and MY_INSTALL_OPTIONAL would be set to TRUE therefor. + +#============================================================================= +# Copyright 2010 Alexander Neundorf <neundorf@kde.org> +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) + + +if(__CMAKE_PARSE_ARGUMENTS_INCLUDED) + return() +endif() +set(__CMAKE_PARSE_ARGUMENTS_INCLUDED TRUE) + + +function(CMAKE_PARSE_ARGUMENTS prefix _optionNames _singleArgNames _multiArgNames) + # first set all result variables to empty/FALSE + foreach(arg_name ${_singleArgNames} ${_multiArgNames}) + set(${prefix}_${arg_name}) + endforeach(arg_name) + + foreach(option ${_optionNames}) + set(${prefix}_${option} FALSE) + endforeach(option) + + set(${prefix}_UNPARSED_ARGUMENTS) + + set(insideValues FALSE) + set(currentArgName) + + # now iterate over all arguments and fill the result variables + foreach(currentArg ${ARGN}) + list(FIND _optionNames "${currentArg}" optionIndex) # ... then this marks the end of the arguments belonging to this keyword + list(FIND _singleArgNames "${currentArg}" singleArgIndex) # ... then this marks the end of the arguments belonging to this keyword + list(FIND _multiArgNames "${currentArg}" multiArgIndex) # ... then this marks the end of the arguments belonging to this keyword + + if(${optionIndex} EQUAL -1 AND ${singleArgIndex} EQUAL -1 AND ${multiArgIndex} EQUAL -1) + if(insideValues) + if("${insideValues}" STREQUAL "SINGLE") + set(${prefix}_${currentArgName} ${currentArg}) + set(insideValues FALSE) + elseif("${insideValues}" STREQUAL "MULTI") + list(APPEND ${prefix}_${currentArgName} ${currentArg}) + endif() + else(insideValues) + list(APPEND ${prefix}_UNPARSED_ARGUMENTS ${currentArg}) + endif(insideValues) + else() + if(NOT ${optionIndex} EQUAL -1) + set(${prefix}_${currentArg} TRUE) + set(insideValues FALSE) + elseif(NOT ${singleArgIndex} EQUAL -1) + set(currentArgName ${currentArg}) + set(${prefix}_${currentArgName}) + set(insideValues "SINGLE") + elseif(NOT ${multiArgIndex} EQUAL -1) + set(currentArgName ${currentArg}) + set(${prefix}_${currentArgName}) + set(insideValues "MULTI") + endif() + endif() + + endforeach(currentArg) + + # propagate the result variables to the caller: + foreach(arg_name ${_singleArgNames} ${_multiArgNames} ${_optionNames}) + set(${prefix}_${arg_name} ${${prefix}_${arg_name}} PARENT_SCOPE) + endforeach(arg_name) + set(${prefix}_UNPARSED_ARGUMENTS ${${prefix}_UNPARSED_ARGUMENTS} PARENT_SCOPE) + +endfunction(CMAKE_PARSE_ARGUMENTS _options _singleArgs _multiArgs) diff --git a/cmake/Modules/FindALSA.cmake b/cmake/Modules/FindALSA.cmake new file mode 100644 index 000000000..e3e6624ff --- /dev/null +++ b/cmake/Modules/FindALSA.cmake @@ -0,0 +1,36 @@ +# - Try to find ALSA +# Once done, this will define +# +# ALSA_FOUND - system has ALSA (GL and GLU) +# ALSA_INCLUDE_DIRS - the ALSA include directories +# ALSA_LIBRARIES - link these to use ALSA +# ALSA_GL_LIBRARY - only GL +# ALSA_GLU_LIBRARY - only GLU +# +# See documentation on how to write CMake scripts at +# http://www.cmake.org/Wiki/CMake:How_To_Find_Libraries + +include(LibFindMacros) + +libfind_pkg_check_modules(ALSA_PKGCONF alsa) + +find_path(ALSA_INCLUDE_DIR + NAMES alsa/version.h + PATHS ${ALSA_PKGCONF_INCLUDE_DIRS} +) + +find_library(ALSA_LIBRARY + NAMES asound + PATHS ${ALSA_PKGCONF_LIBRARY_DIRS} +) + +# Extract the version number +IF(ALSA_INCLUDE_DIR) +file(READ "${ALSA_INCLUDE_DIR}/alsa/version.h" _ALSA_VERSION_H_CONTENTS) +string(REGEX REPLACE ".*#define SND_LIB_VERSION_STR[ \t]*\"([^\n]*)\".*" "\\1" ALSA_VERSION "${_ALSA_VERSION_H_CONTENTS}") +ENDIF(ALSA_INCLUDE_DIR) + +set(ALSA_PROCESS_INCLUDES ALSA_INCLUDE_DIR) +set(ALSA_PROCESS_LIBS ALSA_LIBRARY) +libfind_process(ALSA) + diff --git a/cmake/Modules/FindCppUnit.cmake b/cmake/Modules/FindCppUnit.cmake new file mode 100644 index 000000000..f986f35c6 --- /dev/null +++ b/cmake/Modules/FindCppUnit.cmake @@ -0,0 +1,34 @@ +# http://www.cmake.org/pipermail/cmake/2006-October/011446.html +# +# Find the CppUnit includes and library +# +# This module defines +# CPPUNIT_INCLUDE_DIRS, where to find tiff.h, etc. +# CPPUNIT_LIBRARIES, the libraries to link against to use CppUnit. +# CPPUNIT_FOUND, If false, do not try to use CppUnit. + +INCLUDE(FindPkgConfig) +PKG_CHECK_MODULES(CPPUNIT "cppunit") +LIST(APPEND CPPUNIT_LIBRARIES ${CMAKE_DL_LIBS}) +IF(NOT CPPUNIT_FOUND) + +FIND_PATH(CPPUNIT_INCLUDE_DIRS cppunit/TestCase.h + /usr/local/include + /usr/include +) + +FIND_LIBRARY(CPPUNIT_LIBRARIES cppunit + ${CPPUNIT_INCLUDE_DIRS}/../lib + /usr/local/lib + /usr/lib) + +IF(CPPUNIT_INCLUDE_DIRS) + IF(CPPUNIT_LIBRARIES) + SET(CPPUNIT_FOUND "YES") + SET(CPPUNIT_LIBRARIES ${CPPUNIT_LIBRARIES} ${CMAKE_DL_LIBS}) + ENDIF(CPPUNIT_LIBRARIES) +ENDIF(CPPUNIT_INCLUDE_DIRS) + +INCLUDE(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(CPPUNIT DEFAULT_MSG CPPUNIT_LIBRARIES CPPUNIT_INCLUDE_DIRS) +ENDIF(NOT CPPUNIT_FOUND) diff --git a/cmake/Modules/FindFFTW3f.cmake b/cmake/Modules/FindFFTW3f.cmake new file mode 100644 index 000000000..d84bb37a8 --- /dev/null +++ b/cmake/Modules/FindFFTW3f.cmake @@ -0,0 +1,32 @@ +# http://tim.klingt.org/code/projects/supernova/repository/revisions/d336dd6f400e381bcfd720e96139656de0c53b6a/entry/cmake_modules/FindFFTW3f.cmake +# Find single-precision (float) version of FFTW3 + +INCLUDE(FindPkgConfig) +PKG_CHECK_MODULES(FFTW3F "fftw3f >= 3.0") +IF(NOT FFTW3F_FOUND) + +FIND_PATH( + FFTW3F_INCLUDE_DIRS + NAMES fftw3.h + HINTS $ENV{FFTW3_DIR}/include + PATHS /usr/local/include + /usr/include +) + +FIND_LIBRARY( + FFTW3F_LIBRARIES + NAMES fftw3f libfftw3f + HINTS $ENV{FFTW3_DIR}/lib + PATHS /usr/local/lib + /usr/lib +) + +SET(FFTW3F_FOUND "NO") + +IF( FFTW3F_INCLUDE_DIRS AND FFTW3F_LIBRARIES ) + SET(FFTW3F_FOUND "YES") +ENDIF() + +INCLUDE(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(FFTW3F DEFAULT_MSG FFTW3F_LIBRARIES FFTW3F_INCLUDE_DIRS) +ENDIF(NOT FFTW3F_FOUND) diff --git a/cmake/Modules/FindGSL.cmake b/cmake/Modules/FindGSL.cmake new file mode 100644 index 000000000..48fd0077f --- /dev/null +++ b/cmake/Modules/FindGSL.cmake @@ -0,0 +1,143 @@ +# Try to find gnu scientific library GSL +# See +# http://www.gnu.org/software/gsl/ and +# http://gnuwin32.sourceforge.net/packages/gsl.htm +# +# Based on a script of Felix Woelk and Jan Woetzel +# (www.mip.informatik.uni-kiel.de) +# +# It defines the following variables: +# GSL_FOUND - system has GSL lib +# GSL_INCLUDE_DIRS - where to find headers +# GSL_LIBRARIES - full path to the libraries +# GSL_LIBRARY_DIRS, the directory where the PLplot library is found. + +# CMAKE_GSL_CXX_FLAGS = Unix compiler flags for GSL, essentially "`gsl-config --cxxflags`" +# GSL_LINK_DIRECTORIES = link directories, useful for rpath on Unix +# GSL_EXE_LINKER_FLAGS = rpath on Unix + +INCLUDE(FindPkgConfig) +PKG_CHECK_MODULES(GSL "gsl >= 1.10") +IF(NOT GSL_FOUND) + +set( GSL_FOUND OFF ) +set( GSL_CBLAS_FOUND OFF ) + +# Windows, but not for Cygwin and MSys where gsl-config is available +if( WIN32 AND NOT CYGWIN AND NOT MSYS ) + # look for headers + find_path( GSL_INCLUDE_DIR + NAMES gsl/gsl_cdf.h gsl/gsl_randist.h + ) + if( GSL_INCLUDE_DIR ) + # look for gsl library + find_library( GSL_LIBRARY + NAMES gsl + ) + if( GSL_LIBRARY ) + set( GSL_INCLUDE_DIRS ${GSL_INCLUDE_DIR} ) + get_filename_component( GSL_LIBRARY_DIRS ${GSL_LIBRARY} PATH ) + set( GSL_FOUND ON ) + endif( GSL_LIBRARY ) + + # look for gsl cblas library + find_library( GSL_CBLAS_LIBRARY + NAMES gslcblas + ) + if( GSL_CBLAS_LIBRARY ) + set( GSL_CBLAS_FOUND ON ) + endif( GSL_CBLAS_LIBRARY ) + + set( GSL_LIBRARIES ${GSL_LIBRARY} ${GSL_CBLAS_LIBRARY} ) + endif( GSL_INCLUDE_DIR ) + + #mark_as_advanced( + # GSL_INCLUDE_DIR + # GSL_LIBRARY + # GSL_CBLAS_LIBRARY + #) +else( WIN32 AND NOT CYGWIN AND NOT MSYS ) + if( UNIX OR MSYS ) + find_program( GSL_CONFIG_EXECUTABLE gsl-config + /usr/bin/ + /usr/local/bin + ) + + if( GSL_CONFIG_EXECUTABLE ) + set( GSL_FOUND ON ) + + # run the gsl-config program to get cxxflags + execute_process( + COMMAND sh "${GSL_CONFIG_EXECUTABLE}" --cflags + OUTPUT_VARIABLE GSL_CFLAGS + RESULT_VARIABLE RET + ERROR_QUIET + ) + if( RET EQUAL 0 ) + string( STRIP "${GSL_CFLAGS}" GSL_CFLAGS ) + separate_arguments( GSL_CFLAGS ) + + # parse definitions from cflags; drop -D* from CFLAGS + string( REGEX MATCHALL "-D[^;]+" + GSL_DEFINITIONS "${GSL_CFLAGS}" ) + string( REGEX REPLACE "-D[^;]+;" "" + GSL_CFLAGS "${GSL_CFLAGS}" ) + + # parse include dirs from cflags; drop -I prefix + string( REGEX MATCHALL "-I[^;]+" + GSL_INCLUDE_DIRS "${GSL_CFLAGS}" ) + string( REPLACE "-I" "" + GSL_INCLUDE_DIRS "${GSL_INCLUDE_DIRS}") + string( REGEX REPLACE "-I[^;]+;" "" + GSL_CFLAGS "${GSL_CFLAGS}") + + message("GSL_DEFINITIONS=${GSL_DEFINITIONS}") + message("GSL_INCLUDE_DIRS=${GSL_INCLUDE_DIRS}") + message("GSL_CFLAGS=${GSL_CFLAGS}") + else( RET EQUAL 0 ) + set( GSL_FOUND FALSE ) + endif( RET EQUAL 0 ) + + # run the gsl-config program to get the libs + execute_process( + COMMAND sh "${GSL_CONFIG_EXECUTABLE}" --libs + OUTPUT_VARIABLE GSL_LIBRARIES + RESULT_VARIABLE RET + ERROR_QUIET + ) + if( RET EQUAL 0 ) + string(STRIP "${GSL_LIBRARIES}" GSL_LIBRARIES ) + separate_arguments( GSL_LIBRARIES ) + + # extract linkdirs (-L) for rpath (i.e., LINK_DIRECTORIES) + string( REGEX MATCHALL "-L[^;]+" + GSL_LIBRARY_DIRS "${GSL_LIBRARIES}" ) + string( REPLACE "-L" "" + GSL_LIBRARY_DIRS "${GSL_LIBRARY_DIRS}" ) + else( RET EQUAL 0 ) + set( GSL_FOUND FALSE ) + endif( RET EQUAL 0 ) + + MARK_AS_ADVANCED( + GSL_CFLAGS + ) + message( STATUS "Using GSL from ${GSL_PREFIX}" ) + else( GSL_CONFIG_EXECUTABLE ) + message( STATUS "FindGSL: gsl-config not found.") + endif( GSL_CONFIG_EXECUTABLE ) + endif( UNIX OR MSYS ) +endif( WIN32 AND NOT CYGWIN AND NOT MSYS ) + +if( GSL_FOUND ) + if( NOT GSL_FIND_QUIETLY ) + message( STATUS "FindGSL: Found both GSL headers and library" ) + endif( NOT GSL_FIND_QUIETLY ) +else( GSL_FOUND ) + if( GSL_FIND_REQUIRED ) + message( FATAL_ERROR "FindGSL: Could not find GSL headers or library" ) + endif( GSL_FIND_REQUIRED ) +endif( GSL_FOUND ) + +INCLUDE(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(GSL DEFAULT_MSG GSL_LIBRARIES GSL_INCLUDE_DIRS) +ENDIF(NOT GSL_FOUND) diff --git a/cmake/Modules/FindGit.cmake b/cmake/Modules/FindGit.cmake new file mode 100644 index 000000000..2d8214287 --- /dev/null +++ b/cmake/Modules/FindGit.cmake @@ -0,0 +1,46 @@ +# The module defines the following variables: +# GIT_EXECUTABLE - path to git command line client +# GIT_FOUND - true if the command line client was found +# Example usage: +# find_package(Git) +# if(GIT_FOUND) +# message("git found: ${GIT_EXECUTABLE}") +# endif() + +#============================================================================= +# Copyright 2010 Kitware, Inc. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distributed this file outside of CMake, substitute the full +# License text for the above reference.) + +# Look for 'git' or 'eg' (easy git) +# +set(git_names git eg) + +# Prefer .cmd variants on Windows unless running in a Makefile +# in the MSYS shell. +# +if(WIN32) + if(NOT CMAKE_GENERATOR MATCHES "MSYS") + set(git_names git.cmd git eg.cmd eg) + endif() +endif() + +find_program(GIT_EXECUTABLE + NAMES ${git_names} + DOC "git command line client" + ) +mark_as_advanced(GIT_EXECUTABLE) + +# Handle the QUIETLY and REQUIRED arguments and set GIT_FOUND to TRUE if +# all listed variables are TRUE + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(Git DEFAULT_MSG GIT_EXECUTABLE) diff --git a/cmake/Modules/FindJack.cmake b/cmake/Modules/FindJack.cmake new file mode 100644 index 000000000..44417deb3 --- /dev/null +++ b/cmake/Modules/FindJack.cmake @@ -0,0 +1,87 @@ +# - Try to find jack-2.6 +# Once done this will define +# +# JACK_FOUND - system has jack +# JACK_INCLUDE_DIRS - the jack include directory +# JACK_LIBRARIES - Link these to use jack +# JACK_DEFINITIONS - Compiler switches required for using jack +# +# Copyright (c) 2008 Andreas Schneider <mail@cynapses.org> +# Modified for other libraries by Lasse Kärkkäinen <tronic> +# +# Redistribution and use is allowed according to the terms of the New +# BSD license. +# For details see the accompanying COPYING-CMAKE-SCRIPTS file. +# + +if (JACK_LIBRARIES AND JACK_INCLUDE_DIRS) + # in cache already + set(JACK_FOUND TRUE) +else (JACK_LIBRARIES AND JACK_INCLUDE_DIRS) + # use pkg-config to get the directories and then use these values + # in the FIND_PATH() and FIND_LIBRARY() calls + if (${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 4) + include(UsePkgConfig) + pkgconfig(jack _JACK_INCLUDEDIR _JACK_LIBDIR _JACK_LDFLAGS _JACK_CFLAGS) + else (${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 4) + find_package(PkgConfig) + if (PKG_CONFIG_FOUND) + pkg_check_modules(_JACK jack) + endif (PKG_CONFIG_FOUND) + endif (${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 4) + find_path(JACK_INCLUDE_DIR + NAMES + jack/jack.h + PATHS + ${_JACK_INCLUDEDIR} + /usr/include + /usr/local/include + /opt/local/include + /sw/include + ) + + find_library(JACK_LIBRARY + NAMES + jack + PATHS + ${_JACK_LIBDIR} + /usr/lib + /usr/local/lib + /opt/local/lib + /sw/lib + ) + + if (JACK_LIBRARY) + set(JACK_FOUND TRUE) + endif (JACK_LIBRARY) + + set(JACK_INCLUDE_DIRS + ${JACK_INCLUDE_DIR} + ) + + if (JACK_FOUND) + set(JACK_LIBRARIES + ${JACK_LIBRARIES} + ${JACK_LIBRARY} + ) + endif (JACK_FOUND) + + if (JACK_INCLUDE_DIRS AND JACK_LIBRARIES) + set(JACK_FOUND TRUE) + endif (JACK_INCLUDE_DIRS AND JACK_LIBRARIES) + + if (JACK_FOUND) + if (NOT JACK_FIND_QUIETLY) + message(STATUS "Found jack: ${JACK_LIBRARY}") + endif (NOT JACK_FIND_QUIETLY) + else (JACK_FOUND) + if (JACK_FIND_REQUIRED) + message(FATAL_ERROR "Could not find JACK") + endif (JACK_FIND_REQUIRED) + endif (JACK_FOUND) + + # show the JACK_INCLUDE_DIRS and JACK_LIBRARIES variables only in the advanced view + mark_as_advanced(JACK_INCLUDE_DIRS JACK_LIBRARIES) + +endif (JACK_LIBRARIES AND JACK_INCLUDE_DIRS) + diff --git a/cmake/Modules/FindOSS.cmake b/cmake/Modules/FindOSS.cmake new file mode 100644 index 000000000..105b3ec9c --- /dev/null +++ b/cmake/Modules/FindOSS.cmake @@ -0,0 +1,46 @@ +# - Find Oss +# Find Oss headers and libraries. +# +# OSS_INCLUDE_DIR - where to find soundcard.h, etc. +# OSS_FOUND - True if Oss found. + + +FIND_PATH(LINUX_OSS_INCLUDE_DIR "linux/soundcard.h" + "/usr/include" "/usr/local/include" +) + +FIND_PATH(SYS_OSS_INCLUDE_DIR "sys/soundcard.h" + "/usr/include" "/usr/local/include" +) + +FIND_PATH(MACHINE_OSS_INCLUDE_DIR "machine/soundcard.h" + "/usr/include" "/usr/local/include" +) + +SET(OSS_FOUND FALSE) + +IF(LINUX_OSS_INCLUDE_DIR) + SET(OSS_FOUND TRUE) + SET(OSS_INCLUDE_DIR ${LINUX_OSS_INCLUDE_DIR}) + SET(HAVE_LINUX_SOUNDCARD_H 1) +ENDIF() + +IF(SYS_OSS_INCLUDE_DIR) + SET(OSS_FOUND TRUE) + SET(OSS_INCLUDE_DIR ${SYS_OSS_INCLUDE_DIR}) + SET(HAVE_SYS_SOUNDCARD_H 1) +ENDIF() + +IF(MACHINE_OSS_INCLUDE_DIR) + SET(OSS_FOUND TRUE) + SET(OSS_INCLUDE_DIR ${MACHINE_OSS_INCLUDE_DIR}) + SET(HAVE_MACHINE_SOUNDCARD_H 1) +ENDIF() + +MARK_AS_ADVANCED ( + OSS_FOUND + OSS_INCLUDE_DIR + LINUX_OSS_INCLUDE_DIR + SYS_OSS_INCLUDE_DIR + MACHINE_OSS_INCLUDE_DIR +) diff --git a/cmake/Modules/FindPortaudio.cmake b/cmake/Modules/FindPortaudio.cmake new file mode 100644 index 000000000..158e20ee5 --- /dev/null +++ b/cmake/Modules/FindPortaudio.cmake @@ -0,0 +1,107 @@ +# - Try to find Portaudio +# Once done this will define +# +# PORTAUDIO_FOUND - system has Portaudio +# PORTAUDIO_INCLUDE_DIRS - the Portaudio include directory +# PORTAUDIO_LIBRARIES - Link these to use Portaudio +# PORTAUDIO_DEFINITIONS - Compiler switches required for using Portaudio +# PORTAUDIO_VERSION - Portaudio version +# +# Copyright (c) 2006 Andreas Schneider <mail@cynapses.org> +# +# Redistribution and use is allowed according to the terms of the New BSD license. +# For details see the accompanying COPYING-CMAKE-SCRIPTS file. +# + + +if (PORTAUDIO_LIBRARIES AND PORTAUDIO_INCLUDE_DIRS) + # in cache already + set(PORTAUDIO_FOUND TRUE) +else (PORTAUDIO_LIBRARIES AND PORTAUDIO_INCLUDE_DIRS) + if (NOT WIN32) + include(FindPkgConfig) + pkg_check_modules(PORTAUDIO2 portaudio-2.0) + endif (NOT WIN32) + + if (PORTAUDIO2_FOUND) + set(PORTAUDIO_INCLUDE_DIRS + ${PORTAUDIO2_INCLUDE_DIRS} + ) + if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin") + set(PORTAUDIO_LIBRARIES "${PORTAUDIO2_LIBRARY_DIRS}/lib${PORTAUDIO2_LIBRARIES}.dylib") + else (${CMAKE_SYSTEM_NAME} MATCHES "Darwin") + set(PORTAUDIO_LIBRARIES + ${PORTAUDIO2_LIBRARIES} + ) + endif (${CMAKE_SYSTEM_NAME} MATCHES "Darwin") + set(PORTAUDIO_VERSION + 19 + ) + set(PORTAUDIO_FOUND TRUE) + else (PORTAUDIO2_FOUND) + find_path(PORTAUDIO_INCLUDE_DIR + NAMES + portaudio.h + PATHS + /usr/include + /usr/local/include + /opt/local/include + /sw/include + ) + + find_library(PORTAUDIO_LIBRARY + NAMES + portaudio + PATHS + /usr/lib + /usr/local/lib + /opt/local/lib + /sw/lib + ) + + find_path(PORTAUDIO_LIBRARY_DIR + NAMES + portaudio + PATHS + /usr/lib + /usr/local/lib + /opt/local/lib + /sw/lib + ) + + set(PORTAUDIO_INCLUDE_DIRS + ${PORTAUDIO_INCLUDE_DIR} + ) + set(PORTAUDIO_LIBRARIES + ${PORTAUDIO_LIBRARY} + ) + + set(PORTAUDIO_LIBRARY_DIRS + ${PORTAUDIO_LIBRARY_DIR} + ) + + set(PORTAUDIO_VERSION + 18 + ) + + if (PORTAUDIO_INCLUDE_DIRS AND PORTAUDIO_LIBRARIES) + set(PORTAUDIO_FOUND TRUE) + endif (PORTAUDIO_INCLUDE_DIRS AND PORTAUDIO_LIBRARIES) + + if (PORTAUDIO_FOUND) + if (NOT Portaudio_FIND_QUIETLY) + message(STATUS "Found Portaudio: ${PORTAUDIO_LIBRARIES}") + endif (NOT Portaudio_FIND_QUIETLY) + else (PORTAUDIO_FOUND) + if (Portaudio_FIND_REQUIRED) + message(FATAL_ERROR "Could not find Portaudio") + endif (Portaudio_FIND_REQUIRED) + endif (PORTAUDIO_FOUND) + endif (PORTAUDIO2_FOUND) + + + # show the PORTAUDIO_INCLUDE_DIRS and PORTAUDIO_LIBRARIES variables only in the advanced view + mark_as_advanced(PORTAUDIO_INCLUDE_DIRS PORTAUDIO_LIBRARIES) + +endif (PORTAUDIO_LIBRARIES AND PORTAUDIO_INCLUDE_DIRS) + diff --git a/cmake/Modules/FindQwt.cmake b/cmake/Modules/FindQwt.cmake new file mode 100644 index 000000000..698edc8b9 --- /dev/null +++ b/cmake/Modules/FindQwt.cmake @@ -0,0 +1,13 @@ +# - try to find Qwt libraries and include files +# QWT_INCLUDE_DIR where to find qwt_plot.h, etc. +# QWT_LIBRARIES libraries to link against +# QWT_FOUND If false, do not try to use Qwt + +find_path ( QWT_INCLUDE_DIRS qwt_plot.h /usr/include/qwt-qt4 /usr/include/qwt ) + +find_library ( QWT_LIBRARIES NAMES qwt-qt4 qwt) + +# handle the QUIETLY and REQUIRED arguments and set QWT_FOUND to TRUE if +# all listed variables are TRUE +include ( FindPackageHandleStandardArgs ) +find_package_handle_standard_args( Qwt DEFAULT_MSG QWT_LIBRARIES QWT_INCLUDE_DIRS ) diff --git a/cmake/Modules/FindUHD.cmake b/cmake/Modules/FindUHD.cmake new file mode 100644 index 000000000..7e9f70aa9 --- /dev/null +++ b/cmake/Modules/FindUHD.cmake @@ -0,0 +1,24 @@ +INCLUDE(FindPkgConfig) +PKG_CHECK_MODULES(UHD uhd) +IF(NOT UHD_FOUND) + +FIND_PATH( + UHD_INCLUDE_DIRS + NAMES uhd/config.hpp + HINTS $ENV{UHD_DIR}/include + PATHS /usr/local/include + /usr/include +) + +FIND_LIBRARY( + UHD_LIBRARIES + NAMES uhd + HINTS $ENV{UHD_DIR}/lib + PATHS /usr/local/lib + /usr/lib +) + +INCLUDE(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(UHD DEFAULT_MSG UHD_LIBRARIES UHD_INCLUDE_DIRS) + +ENDIF(NOT UHD_FOUND) diff --git a/cmake/Modules/GrBoost.cmake b/cmake/Modules/GrBoost.cmake new file mode 100644 index 000000000..4e515152d --- /dev/null +++ b/cmake/Modules/GrBoost.cmake @@ -0,0 +1,62 @@ +# Copyright 2010-2011 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio 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 General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. + +IF(DEFINED __INCLUDED_GR_BOOST_CMAKE) + RETURN() +ENDIF() +SET(__INCLUDED_GR_BOOST_CMAKE TRUE) + +######################################################################## +# Setup Boost and handle some system specific things +######################################################################## + +SET(BOOST_REQUIRED_COMPONENTS + date_time + program_options + filesystem + system + thread +) + +IF(UNIX AND EXISTS "/usr/lib64") + LIST(APPEND BOOST_LIBRARYDIR "/usr/lib64") #fedora 64-bit fix +ENDIF(UNIX AND EXISTS "/usr/lib64") + +IF(MSVC) + IF (NOT DEFINED BOOST_ALL_DYN_LINK) + SET(BOOST_ALL_DYN_LINK TRUE) + ENDIF() + SET(BOOST_ALL_DYN_LINK "${BOOST_ALL_DYN_LINK}" CACHE BOOL "boost enable dynamic linking") + IF(BOOST_ALL_DYN_LINK) + ADD_DEFINITIONS(-DBOOST_ALL_DYN_LINK) #setup boost auto-linking in msvc + ELSE(BOOST_ALL_DYN_LINK) + UNSET(BOOST_REQUIRED_COMPONENTS) #empty components list for static link + ENDIF(BOOST_ALL_DYN_LINK) +ENDIF(MSVC) + +SET(Boost_ADDITIONAL_VERSIONS + "1.35.0" "1.35" "1.36.0" "1.36" "1.37.0" "1.37" "1.38.0" "1.38" "1.39.0" "1.39" + "1.40.0" "1.40" "1.41.0" "1.41" "1.42.0" "1.42" "1.43.0" "1.43" "1.44.0" "1.44" + "1.45.0" "1.45" "1.46.0" "1.46" "1.47.0" "1.47" "1.48.0" "1.48" "1.49.0" "1.49" + "1.50.0" "1.50" "1.51.0" "1.51" "1.52.0" "1.52" "1.53.0" "1.53" "1.54.0" "1.54" + "1.55.0" "1.55" "1.56.0" "1.56" "1.57.0" "1.57" "1.58.0" "1.58" "1.59.0" "1.59" + "1.60.0" "1.60" "1.61.0" "1.61" "1.62.0" "1.62" "1.63.0" "1.63" "1.64.0" "1.64" + "1.65.0" "1.65" "1.66.0" "1.66" "1.67.0" "1.67" "1.68.0" "1.68" "1.69.0" "1.69" +) +FIND_PACKAGE(Boost "1.35" COMPONENTS ${BOOST_REQUIRED_COMPONENTS}) diff --git a/cmake/Modules/GrComponent.cmake b/cmake/Modules/GrComponent.cmake new file mode 100644 index 000000000..8a94e219a --- /dev/null +++ b/cmake/Modules/GrComponent.cmake @@ -0,0 +1,82 @@ +# Copyright 2010-2011 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio 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 General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. + +IF(DEFINED __INCLUDED_GR_COMPONENT_CMAKE) + RETURN() +ENDIF() +SET(__INCLUDED_GR_COMPONENT_CMAKE TRUE) + +SET(_gr_enabled_components "" CACHE INTERNAL "" FORCE) +SET(_gr_disabled_components "" CACHE INTERNAL "" FORCE) + +######################################################################## +# Register a component into the system +# - name: canonical component name +# - var: variable for enabled status +# - argn: list of dependencies +######################################################################## +FUNCTION(GR_REGISTER_COMPONENT name var) + INCLUDE(CMakeDependentOption) + MESSAGE(STATUS "") + MESSAGE(STATUS "Configuring ${name} support...") + FOREACH(dep ${ARGN}) + MESSAGE(STATUS " Dependency ${dep} = ${${dep}}") + ENDFOREACH(dep) + + #setup the dependent option for this component + CMAKE_DEPENDENT_OPTION(${var} "enable ${name} support" ON "${ARGN}" OFF) + SET(${var}_ "${${var}}" CACHE INTERNAL "" FORCE) + + #append the component into one of the lists + IF(${var}) + MESSAGE(STATUS " Enabling ${name} support.") + LIST(APPEND _gr_enabled_components ${name}) + ELSE(${var}) + MESSAGE(STATUS " Disabling ${name} support.") + LIST(APPEND _gr_disabled_components ${name}) + ENDIF(${var}) + MESSAGE(STATUS " Override with -D${var}=ON/OFF") + + #make components lists into global variables + SET(_gr_enabled_components ${_gr_enabled_components} CACHE INTERNAL "" FORCE) + SET(_gr_disabled_components ${_gr_disabled_components} CACHE INTERNAL "" FORCE) +ENDFUNCTION(GR_REGISTER_COMPONENT) + +######################################################################## +# Print the registered component summary +######################################################################## +FUNCTION(GR_PRINT_COMPONENT_SUMMARY) + MESSAGE(STATUS "") + MESSAGE(STATUS "######################################################") + MESSAGE(STATUS "# Gnuradio enabled components ") + MESSAGE(STATUS "######################################################") + FOREACH(comp ${_gr_enabled_components}) + MESSAGE(STATUS " * ${comp}") + ENDFOREACH(comp) + + MESSAGE(STATUS "") + MESSAGE(STATUS "######################################################") + MESSAGE(STATUS "# Gnuradio disabled components ") + MESSAGE(STATUS "######################################################") + FOREACH(comp ${_gr_disabled_components}) + MESSAGE(STATUS " * ${comp}") + ENDFOREACH(comp) + + MESSAGE(STATUS "") +ENDFUNCTION(GR_PRINT_COMPONENT_SUMMARY) diff --git a/cmake/Modules/GrMiscUtils.cmake b/cmake/Modules/GrMiscUtils.cmake new file mode 100644 index 000000000..c36c509b5 --- /dev/null +++ b/cmake/Modules/GrMiscUtils.cmake @@ -0,0 +1,86 @@ +# Copyright 2010-2011 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio 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 General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. + +IF(DEFINED __INCLUDED_GR_MISC_UTILS_CMAKE) + RETURN() +ENDIF() +SET(__INCLUDED_GR_MISC_UTILS_CMAKE TRUE) + +######################################################################## +# Set global variable macro. +# Used for subdirectories to export settings. +# Example: include and library paths. +######################################################################## +FUNCTION(GR_SET_GLOBAL var) + SET(${var} ${ARGN} CACHE INTERNAL "" FORCE) +ENDFUNCTION(GR_SET_GLOBAL) + +######################################################################## +# Set the pre-processor definition if the condition is true. +# - def the pre-processor definition to set and condition name +######################################################################## +FUNCTION(GR_ADD_COND_DEF def) + IF(${def}) + ADD_DEFINITIONS(-D${def}) + ENDIF(${def}) +ENDFUNCTION(GR_ADD_COND_DEF) + +######################################################################## +# Check for a header and conditionally set a compile define. +# - hdr the relative path to the header file +# - def the pre-processor definition to set +######################################################################## +FUNCTION(GR_CHECK_HDR_N_DEF hdr def) + INCLUDE(CheckIncludeFileCXX) + CHECK_INCLUDE_FILE_CXX(${hdr} ${def}) + GR_ADD_COND_DEF(${def}) +ENDFUNCTION(GR_CHECK_HDR_N_DEF) + +######################################################################## +# Include subdirectory macro. +# Sets the CMake directory variables, +# includes the subdirectory CMakeLists.txt, +# resets the CMake directory variables. +# +# This macro includes subdirectories rather than adding them +# so that the subdirectory can affect variables in the level above. +# This provides a work-around for the lack of convenience libraries. +# This way a subdirectory can append to the list of library sources. +######################################################################## +MACRO(GR_INCLUDE_SUBDIRECTORY subdir) + #insert the current directories on the front of the list + LIST(INSERT _cmake_source_dirs 0 ${CMAKE_CURRENT_SOURCE_DIR}) + LIST(INSERT _cmake_binary_dirs 0 ${CMAKE_CURRENT_BINARY_DIR}) + + #set the current directories to the names of the subdirs + SET(CMAKE_CURRENT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/${subdir}) + SET(CMAKE_CURRENT_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/${subdir}) + + #include the subdirectory CMakeLists to run it + FILE(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) + INCLUDE(${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt) + + #reset the value of the current directories + LIST(GET _cmake_source_dirs 0 CMAKE_CURRENT_SOURCE_DIR) + LIST(GET _cmake_binary_dirs 0 CMAKE_CURRENT_BINARY_DIR) + + #pop the subdir names of the front of the list + LIST(REMOVE_AT _cmake_source_dirs 0) + LIST(REMOVE_AT _cmake_binary_dirs 0) +ENDMACRO(GR_INCLUDE_SUBDIRECTORY) diff --git a/cmake/Modules/GrPackage.cmake b/cmake/Modules/GrPackage.cmake new file mode 100644 index 000000000..2fc9fc08a --- /dev/null +++ b/cmake/Modules/GrPackage.cmake @@ -0,0 +1,134 @@ +# Copyright 2011 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio 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 General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. + +IF(DEFINED __INCLUDED_GR_PACKAGE_CMAKE) + RETURN() +ENDIF() +SET(__INCLUDED_GR_PACKAGE_CMAKE TRUE) + +INCLUDE(GrVersion) #sets version information +INCLUDE(GrPlatform) #sets platform information + +#set the cpack generator based on the platform type +IF(CPACK_GENERATOR) + #already set by user +ELSEIF(APPLE) + SET(CPACK_GENERATOR PackageMaker) +ELSEIF(WIN32) + SET(CPACK_GENERATOR NSIS) +ELSEIF(DEBIAN) + SET(CPACK_GENERATOR DEB) +ELSEIF(REDHAT) + SET(CPACK_GENERATOR RPM) +ELSE() + SET(CPACK_GENERATOR TGZ) +ENDIF() + +######################################################################## +# CPACK_SET - set a global variable and record the variable name +######################################################################## +FUNCTION(CPACK_SET var) + SET(${var} ${ARGN} CACHE INTERNAL "") + LIST(APPEND _cpack_vars ${var}) + LIST(REMOVE_DUPLICATES _cpack_vars) + SET(_cpack_vars ${_cpack_vars} CACHE INTERNAL "") +ENDFUNCTION(CPACK_SET) + +######################################################################## +# CPACK_FINALIZE - include cpack and the unset all the cpack variables +######################################################################## +FUNCTION(CPACK_FINALIZE) + INCLUDE(CPack) #finalize the cpack settings configured throughout the build system + FOREACH(var ${_cpack_vars}) + UNSET(${var} CACHE) + ENDFOREACH(var) + UNSET(_cpack_vars CACHE) +ENDFUNCTION(CPACK_FINALIZE) + +######################################################################## +# CPACK_COMPONENT - convenience function to create a cpack component +# +# Usage: CPACK_COMPONENT( +# name +# [GROUP group] +# [DISPLAY_NAME display_name] +# [DESCRIPTION description] +# [DEPENDS depends] +# ) +######################################################################## +FUNCTION(CPACK_COMPONENT name) + INCLUDE(CMakeParseArgumentsCopy) + SET(_options GROUP DISPLAY_NAME DESCRIPTION DEPENDS) + CMAKE_PARSE_ARGUMENTS(CPACK_COMPONENT "" "${_options}" "" ${ARGN}) + + STRING(TOUPPER "${name}" name_upper) + FOREACH(_option ${_options}) + IF(CPACK_COMPONENT_${_option}) + CPACK_SET(CPACK_COMPONENT_${name_upper}_${_option} "${CPACK_COMPONENT_${_option}}") + ENDIF() + ENDFOREACH(_option) + + CPACK_SET(CPACK_COMPONENTS_ALL "${CPACK_COMPONENTS_ALL};${name}") + +ENDFUNCTION(CPACK_COMPONENT) + +######################################################################## +# Setup CPack +######################################################################## +SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "GNU Radio") +SET(CPACK_PACKAGE_VENDOR "Free Software Foundation, Inc.") +SET(CPACK_PACKAGE_CONTACT "Discuss-gnuradio@gnu.org") +SET(CPACK_PACKAGE_VERSION ${VERSION}) +SET(CPACK_RESOURCE_FILE_LICENSE ${CMAKE_SOURCE_DIR}/README) +SET(CPACK_RESOURCE_FILE_README ${CMAKE_SOURCE_DIR}/README) +SET(CPACK_RESOURCE_FILE_WELCOME ${CMAKE_SOURCE_DIR}/README) +IF(${CPACK_GENERATOR} STREQUAL NSIS) + SET(CPACK_PACKAGE_INSTALL_DIRECTORY "${CMAKE_PROJECT_NAME}") +ENDIF() + +######################################################################## +# DEB package specific +######################################################################## +SET(CPACK_DEBIAN_PACKAGE_DEPENDS + "libboost-all-dev" + "libfftw3-3" + "python" + "python-numpy" + "libqt4-core" + "libqwt5-qt4" + "libqwtplot3d-qt4-0" + "python-qt4" + "python-gtk2" + "python-lxml" + "python-Cheetah" +) +STRING(REPLACE ";" ", " CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_DEPENDS}") +SET(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA ${CMAKE_SOURCE_DIR}/debian/postinst ${CMAKE_SOURCE_DIR}/debian/prerm) + +######################################################################## +# RPM package specific +######################################################################## +SET(CPACK_RPM_PACKAGE_REQUIRES "boost-devel") #TODO other packages + +######################################################################## +# NSIS package specific +######################################################################## +SET(CPACK_NSIS_MODIFY_PATH ON) + +SET(HLKM_ENV "\\\"SYSTEM\\\\CurrentControlSet\\\\Control\\\\Session Manager\\\\Environment\\\"") diff --git a/cmake/Modules/GrPlatform.cmake b/cmake/Modules/GrPlatform.cmake new file mode 100644 index 000000000..85f318618 --- /dev/null +++ b/cmake/Modules/GrPlatform.cmake @@ -0,0 +1,46 @@ +# Copyright 2011 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio 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 General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. + +IF(DEFINED __INCLUDED_GR_PLATFORM_CMAKE) + RETURN() +ENDIF() +SET(__INCLUDED_GR_PLATFORM_CMAKE TRUE) + +######################################################################## +# Setup additional defines for OS types +######################################################################## +IF(CMAKE_SYSTEM_NAME STREQUAL "Linux") + SET(LINUX TRUE) +ENDIF() + +IF(LINUX AND EXISTS "/etc/debian_version") + SET(DEBIAN TRUE) +ENDIF() + +IF(LINUX AND EXISTS "/etc/redhat-release") + SET(REDHAT TRUE) +ENDIF() + +######################################################################## +# when the library suffix should be 64 (applies to redhat linux family) +######################################################################## +IF(NOT DEFINED LIB_SUFFIX AND REDHAT AND CMAKE_SYSTEM_PROCESSOR MATCHES "64$") + SET(LIB_SUFFIX 64) +ENDIF() +SET(LIB_SUFFIX ${LIB_SUFFIX} CACHE STRING "lib directory suffix") diff --git a/cmake/Modules/GrPython.cmake b/cmake/Modules/GrPython.cmake new file mode 100644 index 000000000..f54dbc9ba --- /dev/null +++ b/cmake/Modules/GrPython.cmake @@ -0,0 +1,177 @@ +# Copyright 2010-2011 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio 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 General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. + +IF(DEFINED __INCLUDED_GR_PYTHON_CMAKE) + RETURN() +ENDIF() +SET(__INCLUDED_GR_PYTHON_CMAKE TRUE) + +######################################################################## +# Setup the python interpreter: +# This allows the user to specify a specific interpreter, +# or finds the interpreter via the built-in cmake module. +######################################################################## +#this allows the user to override PYTHON_EXECUTABLE +IF(PYTHON_EXECUTABLE) + + SET(PYTHONINTERP_FOUND TRUE) + +#otherwise if not set, try to automatically find it +ELSE(PYTHON_EXECUTABLE) + + #use the built-in find script + FIND_PACKAGE(PythonInterp) + + #and if that fails use the find program routine + IF(NOT PYTHONINTERP_FOUND) + FIND_PROGRAM(PYTHON_EXECUTABLE NAMES python python2.7 python2.6 python2.5) + IF(PYTHON_EXECUTABLE) + SET(PYTHONINTERP_FOUND TRUE) + ENDIF(PYTHON_EXECUTABLE) + ENDIF(NOT PYTHONINTERP_FOUND) + +ENDIF(PYTHON_EXECUTABLE) + +#make the path to the executable appear in the cmake gui +SET(PYTHON_EXECUTABLE ${PYTHON_EXECUTABLE} CACHE FILEPATH "python interpreter") + +######################################################################## +# Check for the existence of a python module: +# - desc a string description of the check +# - mod the name of the module to import +# - cmd an additional command to run +# - have the result variable to set +######################################################################## +MACRO(GR_PYTHON_CHECK_MODULE desc mod cmd have) + MESSAGE(STATUS "") + MESSAGE(STATUS "Python checking for ${desc}") + EXECUTE_PROCESS( + COMMAND ${PYTHON_EXECUTABLE} -c " +######################################### +try: import ${mod} +except: exit(-1) +try: assert ${cmd} +except: exit(-1) +#########################################" + RESULT_VARIABLE ${have} + ) + IF(${have} EQUAL 0) + MESSAGE(STATUS "Python checking for ${desc} - found") + SET(${have} TRUE) + ELSE(${have} EQUAL 0) + MESSAGE(STATUS "Python checking for ${desc} - not found") + SET(${have} FALSE) + ENDIF(${have} EQUAL 0) +ENDMACRO(GR_PYTHON_CHECK_MODULE) + +######################################################################## +# Sets the python installation directory GR_PYTHON_DIR +######################################################################## +EXECUTE_PROCESS(COMMAND ${PYTHON_EXECUTABLE} -c " +from distutils import sysconfig +print sysconfig.get_python_lib(plat_specific=True, prefix='') +" OUTPUT_VARIABLE GR_PYTHON_DIR OUTPUT_STRIP_TRAILING_WHITESPACE +) +FILE(TO_CMAKE_PATH ${GR_PYTHON_DIR} GR_PYTHON_DIR) + +######################################################################## +# Create an always-built target with a unique name +# Usage: GR_UNIQUE_TARGET(<description> <dependencies list>) +######################################################################## +FUNCTION(GR_UNIQUE_TARGET desc) + FILE(RELATIVE_PATH reldir ${CMAKE_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}) + EXECUTE_PROCESS(COMMAND ${PYTHON_EXECUTABLE} -c "import re, hashlib +unique = hashlib.md5('${reldir}${ARGN}').hexdigest()[:5] +print(re.sub('\\W', '_', '${desc} ${reldir} ' + unique))" + OUTPUT_VARIABLE _target OUTPUT_STRIP_TRAILING_WHITESPACE) + ADD_CUSTOM_TARGET(${_target} ALL DEPENDS ${ARGN}) +ENDFUNCTION(GR_UNIQUE_TARGET) + +######################################################################## +# Install python sources (also builds and installs byte-compiled python) +######################################################################## +FUNCTION(GR_PYTHON_INSTALL) + INCLUDE(CMakeParseArgumentsCopy) + CMAKE_PARSE_ARGUMENTS(GR_PYTHON_INSTALL "" "DESTINATION;COMPONENT" "FILES;PROGRAMS" ${ARGN}) + + #################################################################### + IF(GR_PYTHON_INSTALL_FILES) + #################################################################### + INSTALL(${ARGN}) #installs regular python files + + FOREACH(pyfile ${GR_PYTHON_INSTALL_FILES}) + GET_FILENAME_COMPONENT(pyfile_name ${pyfile} NAME) + GET_FILENAME_COMPONENT(pyfile ${pyfile} ABSOLUTE) + STRING(REPLACE "${CMAKE_SOURCE_DIR}" "${CMAKE_BINARY_DIR}" pycfile "${pyfile}c") + LIST(APPEND python_install_gen_targets ${pycfile}) + + GET_FILENAME_COMPONENT(pycfile_path ${pycfile} PATH) + FILE(MAKE_DIRECTORY ${pycfile_path}) + + #create a command to generate the byte-compiled pyc file + ADD_CUSTOM_COMMAND( + OUTPUT ${pycfile} DEPENDS ${pyfile} + COMMAND ${PYTHON_EXECUTABLE} -c + \"import py_compile\; py_compile.compile(file='${pyfile}', cfile='${pycfile}', doraise=True)\" + COMMENT "Byte-compiling ${pyfile_name}" + ) + INSTALL(FILES ${pycfile} + DESTINATION ${GR_PYTHON_INSTALL_DESTINATION} + COMPONENT ${GR_PYTHON_INSTALL_COMPONENT} + ) + ENDFOREACH(pyfile) + + #################################################################### + ELSEIF(GR_PYTHON_INSTALL_PROGRAMS) + #################################################################### + FILE(TO_NATIVE_PATH ${PYTHON_EXECUTABLE} pyexe_native) + + FOREACH(pyfile ${GR_PYTHON_INSTALL_PROGRAMS}) + GET_FILENAME_COMPONENT(pyfile_name ${pyfile} NAME) + GET_FILENAME_COMPONENT(pyfile ${pyfile} ABSOLUTE) + STRING(REPLACE "${CMAKE_SOURCE_DIR}" "${CMAKE_BINARY_DIR}" pyexefile "${pyfile}.exe") + LIST(APPEND python_install_gen_targets ${pyexefile}) + + GET_FILENAME_COMPONENT(pyexefile_path ${pyexefile} PATH) + FILE(MAKE_DIRECTORY ${pyexefile_path}) + + ADD_CUSTOM_COMMAND( + OUTPUT ${pyexefile} DEPENDS ${pyfile} + COMMAND ${PYTHON_EXECUTABLE} -c + \"open('${pyexefile}', 'w').write('\#!${pyexe_native}\\n'+open('${pyfile}').read())\" + COMMENT "Shebangin ${pyfile_name}" + ) + + #on windows, python files need an extension to execute + GET_FILENAME_COMPONENT(pyfile_ext ${pyfile} EXT) + IF(WIN32 AND NOT pyfile_ext) + SET(pyfile_name "${pyfile_name}.py") + ENDIF() + + INSTALL(PROGRAMS ${pyexefile} RENAME ${pyfile_name} + DESTINATION ${GR_PYTHON_INSTALL_DESTINATION} + COMPONENT ${GR_PYTHON_INSTALL_COMPONENT} + ) + ENDFOREACH(pyfile) + + ENDIF() + + GR_UNIQUE_TARGET("pygen" ${python_install_gen_targets}) + +ENDFUNCTION(GR_PYTHON_INSTALL) diff --git a/cmake/Modules/GrSwig.cmake b/cmake/Modules/GrSwig.cmake new file mode 100644 index 000000000..9fca29a4f --- /dev/null +++ b/cmake/Modules/GrSwig.cmake @@ -0,0 +1,90 @@ +# Copyright 2010-2011 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio 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 General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. + +IF(DEFINED __INCLUDED_GR_SWIG_CMAKE) + RETURN() +ENDIF() +SET(__INCLUDED_GR_SWIG_CMAKE TRUE) + +######################################################################## +# Build a swig target for the common gnuradio use case. Usage: +# GR_SWIG_MAKE(target ifile ifile ifile...) +# +# Set the following variables before calling: +# - GR_SWIG_FLAGS +# - GR_SWIG_INCLUDE_DIRS +# - GR_SWIG_LIBRARIES +# - GR_SWIG_SOURCE_DEPS +# - GR_SWIG_TARGET_DEPS +######################################################################## +MACRO(GR_SWIG_MAKE name) + SET(ifiles ${ARGN}) + + INCLUDE_DIRECTORIES(${GR_SWIG_INCLUDE_DIRS}) + SET(SWIG_MODULE_${name}_EXTRA_DEPS ${GR_SWIG_SOURCE_DEPS}) + + FIND_PACKAGE(PythonLibs) + INCLUDE_DIRECTORIES(${PYTHON_INCLUDE_DIRS}) + + #setup the swig flags with flags and include directories + SET(CMAKE_SWIG_FLAGS -fvirtual -modern -keyword -w511 -module ${name} ${GR_SWIG_FLAGS}) + FOREACH(dir ${GR_SWIG_INCLUDE_DIRS}) + LIST(APPEND CMAKE_SWIG_FLAGS "-I${dir}") + ENDFOREACH(dir) + + #set the C++ property on the swig .i file so it builds + SET_SOURCE_FILES_PROPERTIES(${ifiles} PROPERTIES CPLUSPLUS ON) + + #setup the actual swig library target to be built + INCLUDE(UseSWIG) + SWIG_ADD_MODULE(${name} python ${ifiles}) + SWIG_LINK_LIBRARIES(${name} ${PYTHON_LIBRARIES} ${GR_SWIG_LIBRARIES}) + IF(GR_SWIG_TARGET_DEPS) + ADD_DEPENDENCIES(${SWIG_MODULE_${name}_REAL_NAME} ${GR_SWIG_TARGET_DEPS}) + ENDIF(GR_SWIG_TARGET_DEPS) + +ENDMACRO(GR_SWIG_MAKE) + +######################################################################## +# Install swig targets generated by GR_SWIG_MAKE. Usage: +# GR_SWIG_INSTALL( +# TARGETS target target target... +# [DESTINATION destination] +# [COMPONENT component] +# ) +######################################################################## +MACRO(GR_SWIG_INSTALL) + + INCLUDE(CMakeParseArgumentsCopy) + CMAKE_PARSE_ARGUMENTS(GR_SWIG_INSTALL "" "DESTINATION;COMPONENT" "TARGETS" ${ARGN}) + + FOREACH(name ${GR_SWIG_INSTALL_TARGETS}) + INSTALL(TARGETS ${SWIG_MODULE_${name}_REAL_NAME} + DESTINATION ${GR_SWIG_INSTALL_DESTINATION} + COMPONENT ${GR_SWIG_INSTALL_COMPONENT} + ) + + INCLUDE(GrPython) + GR_PYTHON_INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${name}.py + DESTINATION ${GR_SWIG_INSTALL_DESTINATION} + COMPONENT ${GR_SWIG_INSTALL_COMPONENT} + ) + ENDFOREACH(name) + +ENDMACRO(GR_SWIG_INSTALL) diff --git a/cmake/Modules/GrTest.cmake b/cmake/Modules/GrTest.cmake new file mode 100644 index 000000000..e9e2a0c2e --- /dev/null +++ b/cmake/Modules/GrTest.cmake @@ -0,0 +1,133 @@ +# Copyright 2010-2011 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio 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 General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. + +IF(DEFINED __INCLUDED_GR_TEST_CMAKE) + RETURN() +ENDIF() +SET(__INCLUDED_GR_TEST_CMAKE TRUE) + +######################################################################## +# Add a unit test and setup the environment for a unit test. +# Takes the same arguments as the ADD_TEST function. +# +# Before calling set the following variables: +# GR_TEST_TARGET_DEPS - built targets for the library path +# GR_TEST_LIBRARY_DIRS - directories for the library path +# GR_TEST_PYTHON_DIRS - directories for the python path +######################################################################## +FUNCTION(GR_ADD_TEST test_name) + + IF(WIN32) + #Ensure that the build exe also appears in the PATH. + LIST(APPEND GR_TEST_TARGET_DEPS ${ARGN}) + + #In the land of windows, all libraries must be in the PATH. + #Since the dependent libraries are not yet installed, + #we must manually set them in the PATH to run tests. + #The following appends the path of a target dependency. + FOREACH(target ${GR_TEST_TARGET_DEPS}) + GET_TARGET_PROPERTY(location ${target} LOCATION) + IF(location) + GET_FILENAME_COMPONENT(path ${location} PATH) + STRING(REGEX REPLACE "\\$\\(.*\\)" ${CMAKE_BUILD_TYPE} path ${path}) + LIST(APPEND GR_TEST_LIBRARY_DIRS ${path}) + ENDIF(location) + ENDFOREACH(target) + + #SWIG generates the python library files into a subdirectory. + #Therefore, we must append this subdirectory into PYTHONPATH. + #Only do this for the python directories matching the following: + FOREACH(pydir ${GR_TEST_PYTHON_DIRS}) + GET_FILENAME_COMPONENT(name ${pydir} NAME) + IF(name MATCHES "^(swig|lib|src)$") + LIST(APPEND GR_TEST_PYTHON_DIRS ${pydir}/${CMAKE_BUILD_TYPE}) + ENDIF() + ENDFOREACH(pydir) + ENDIF(WIN32) + + FILE(TO_NATIVE_PATH ${CMAKE_CURRENT_SOURCE_DIR} srcdir) + FILE(TO_NATIVE_PATH "${GR_TEST_LIBRARY_DIRS}" libpath) #ok to use on dir list? + FILE(TO_NATIVE_PATH "${GR_TEST_PYTHON_DIRS}" pypath) #ok to use on dir list? + + SET(environs "GR_DONT_LOAD_PREFS=1" "srcdir=${srcdir}") + + #http://www.cmake.org/pipermail/cmake/2009-May/029464.html + #Replaced this add test + set environs code with the shell script generation. + #Its nicer to be able to manually run the shell script to diagnose problems. + #ADD_TEST(${ARGV}) + #SET_TESTS_PROPERTIES(${test_name} PROPERTIES ENVIRONMENT "${environs}") + + IF(UNIX) + SET(binpath "${CMAKE_CURRENT_BINARY_DIR}:$PATH") + #set both LD and DYLD paths to cover multiple UNIX OS library paths + LIST(APPEND libpath "$LD_LIBRARY_PATH" "$DYLD_LIBRARY_PATH") + LIST(APPEND pypath "$PYTHONPATH") + + #replace list separator with the path separator + STRING(REPLACE ";" ":" libpath "${libpath}") + STRING(REPLACE ";" ":" pypath "${pypath}") + LIST(APPEND environs "PATH=${binpath}" "LD_LIBRARY_PATH=${libpath}" "DYLD_LIBRARY_PATH=${libpath}" "PYTHONPATH=${pypath}") + + #generate a bat file that sets the environment and runs the test + FIND_PROGRAM(SHELL sh) + SET(sh_file ${CMAKE_CURRENT_BINARY_DIR}/${test_name}_test.sh) + FILE(WRITE ${sh_file} "#!${SHELL}\n") + #each line sets an environment variable + FOREACH(environ ${environs}) + FILE(APPEND ${sh_file} "export ${environ}\n") + ENDFOREACH(environ) + #load the command to run with its arguments + FOREACH(arg ${ARGN}) + FILE(APPEND ${sh_file} "${arg} ") + ENDFOREACH(arg) + FILE(APPEND ${sh_file} "\n") + + #make the shell file executable + EXECUTE_PROCESS(COMMAND chmod +x ${sh_file}) + + ADD_TEST(${test_name} ${SHELL} ${sh_file}) + + ENDIF(UNIX) + + IF(WIN32) + LIST(APPEND libpath ${DLL_PATHS} "%PATH%") + LIST(APPEND pypath "%PYTHONPATH%") + + #replace list separator with the path separator (escaped) + STRING(REPLACE ";" "\\;" libpath "${libpath}") + STRING(REPLACE ";" "\\;" pypath "${pypath}") + LIST(APPEND environs "PATH=${libpath}" "PYTHONPATH=${pypath}") + + #generate a bat file that sets the environment and runs the test + SET(bat_file ${CMAKE_CURRENT_BINARY_DIR}/${test_name}_test.bat) + FILE(WRITE ${bat_file} "@echo off\n") + #each line sets an environment variable + FOREACH(environ ${environs}) + FILE(APPEND ${bat_file} "SET ${environ}\n") + ENDFOREACH(environ) + #load the command to run with its arguments + FOREACH(arg ${ARGN}) + FILE(APPEND ${bat_file} "${arg} ") + ENDFOREACH(arg) + FILE(APPEND ${bat_file} "\n") + + ADD_TEST(${test_name} ${bat_file}) + ENDIF(WIN32) + +ENDFUNCTION(GR_ADD_TEST) diff --git a/cmake/Modules/GrVersion.cmake b/cmake/Modules/GrVersion.cmake new file mode 100644 index 000000000..ab2959c0d --- /dev/null +++ b/cmake/Modules/GrVersion.cmake @@ -0,0 +1,73 @@ +# Copyright 2011 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio 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 General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. + +IF(DEFINED __INCLUDED_GR_VERSION_CMAKE) + RETURN() +ENDIF() +SET(__INCLUDED_GR_VERSION_CMAKE TRUE) + +######################################################################## +# Setup version variables. +# Parse the output of git describe +# sets VERSION and LIBVER +######################################################################## + +UNSET(VERSION) +UNSET(LIBVER) + +######################################################################## +# Extract the version string from git describe. +######################################################################## +FIND_PACKAGE(Git) +IF(GIT_FOUND) + MESSAGE(STATUS "Extracting version information from git...") + EXECUTE_PROCESS(COMMAND ${GIT_EXECUTABLE} describe + OUTPUT_VARIABLE VERSION OUTPUT_STRIP_TRAILING_WHITESPACE + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} + ) + IF(NOT VERSION) + MESSAGE(WARNING "Tried to extract $VERSION from git describe but failed... using default") + ENDIF() +ENDIF(GIT_FOUND) + +######################################################################## +# Extract the library version from the version string. +######################################################################## +IF(VERSION) + INCLUDE(GrPython) + EXECUTE_PROCESS(COMMAND ${PYTHON_EXECUTABLE} -c "import re; print re.match('^v(\\d+\\.\\d+\\.\\d+)', '${VERSION}').groups()[0]" + OUTPUT_VARIABLE LIBVER OUTPUT_STRIP_TRAILING_WHITESPACE + ) + IF(NOT LIBVER) + MESSAGE(WARNING "Tried to extract $LIBVER from $VERSION but failed... using default") + ENDIF() +ENDIF() + +######################################################################## +# Ensure that the version strings are set no matter what. +######################################################################## +IF(NOT VERSION) + SET(VERSION "v3.x.x-unknown") +ENDIF() + +IF(NOT LIBVER) + SET(LIBVER "3.x.x") +ENDIF() + +MESSAGE(STATUS "VERSION: ${VERSION}, LIBVER: ${LIBVER}") diff --git a/cmake/Modules/LibFindMacros.cmake b/cmake/Modules/LibFindMacros.cmake new file mode 100644 index 000000000..69975c51b --- /dev/null +++ b/cmake/Modules/LibFindMacros.cmake @@ -0,0 +1,99 @@ +# Works the same as find_package, but forwards the "REQUIRED" and "QUIET" arguments +# used for the current package. For this to work, the first parameter must be the +# prefix of the current package, then the prefix of the new package etc, which are +# passed to find_package. +macro (libfind_package PREFIX) + set (LIBFIND_PACKAGE_ARGS ${ARGN}) + if (${PREFIX}_FIND_QUIETLY) + set (LIBFIND_PACKAGE_ARGS ${LIBFIND_PACKAGE_ARGS} QUIET) + endif (${PREFIX}_FIND_QUIETLY) + if (${PREFIX}_FIND_REQUIRED) + set (LIBFIND_PACKAGE_ARGS ${LIBFIND_PACKAGE_ARGS} REQUIRED) + endif (${PREFIX}_FIND_REQUIRED) + find_package(${LIBFIND_PACKAGE_ARGS}) +endmacro (libfind_package) + +# CMake developers made the UsePkgConfig system deprecated in the same release (2.6) +# where they added pkg_check_modules. Consequently I need to support both in my scripts +# to avoid those deprecated warnings. Here's a helper that does just that. +# Works identically to pkg_check_modules, except that no checks are needed prior to use. +macro (libfind_pkg_check_modules PREFIX PKGNAME) + if (${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 4) + include(UsePkgConfig) + pkgconfig(${PKGNAME} ${PREFIX}_INCLUDE_DIRS ${PREFIX}_LIBRARY_DIRS ${PREFIX}_LDFLAGS ${PREFIX}_CFLAGS) + else (${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 4) + find_package(PkgConfig) + if (PKG_CONFIG_FOUND) + pkg_check_modules(${PREFIX} ${PKGNAME}) + endif (PKG_CONFIG_FOUND) + endif (${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 4) +endmacro (libfind_pkg_check_modules) + +# Do the final processing once the paths have been detected. +# If include dirs are needed, ${PREFIX}_PROCESS_INCLUDES should be set to contain +# all the variables, each of which contain one include directory. +# Ditto for ${PREFIX}_PROCESS_LIBS and library files. +# Will set ${PREFIX}_FOUND, ${PREFIX}_INCLUDE_DIRS and ${PREFIX}_LIBRARIES. +# Also handles errors in case library detection was required, etc. +macro (libfind_process PREFIX) + # Skip processing if already processed during this run + if (NOT ${PREFIX}_FOUND) + # Start with the assumption that the library was found + set (${PREFIX}_FOUND TRUE) + + # Process all includes and set _FOUND to false if any are missing + foreach (i ${${PREFIX}_PROCESS_INCLUDES}) + if (${i}) + set (${PREFIX}_INCLUDE_DIRS ${${PREFIX}_INCLUDE_DIRS} ${${i}}) + mark_as_advanced(${i}) + else (${i}) + set (${PREFIX}_FOUND FALSE) + endif (${i}) + endforeach (i) + + # Process all libraries and set _FOUND to false if any are missing + foreach (i ${${PREFIX}_PROCESS_LIBS}) + if (${i}) + set (${PREFIX}_LIBRARIES ${${PREFIX}_LIBRARIES} ${${i}}) + mark_as_advanced(${i}) + else (${i}) + set (${PREFIX}_FOUND FALSE) + endif (${i}) + endforeach (i) + + # Print message and/or exit on fatal error + if (${PREFIX}_FOUND) + if (NOT ${PREFIX}_FIND_QUIETLY) + message (STATUS "Found ${PREFIX} ${${PREFIX}_VERSION}") + endif (NOT ${PREFIX}_FIND_QUIETLY) + else (${PREFIX}_FOUND) + if (${PREFIX}_FIND_REQUIRED) + foreach (i ${${PREFIX}_PROCESS_INCLUDES} ${${PREFIX}_PROCESS_LIBS}) + message("${i}=${${i}}") + endforeach (i) + message (FATAL_ERROR "Required library ${PREFIX} NOT FOUND.\nInstall the library (dev version) and try again. If the library is already installed, use ccmake to set the missing variables manually.") + endif (${PREFIX}_FIND_REQUIRED) + endif (${PREFIX}_FOUND) + endif (NOT ${PREFIX}_FOUND) +endmacro (libfind_process) + +macro(libfind_library PREFIX basename) + set(TMP "") + if(MSVC80) + set(TMP -vc80) + endif(MSVC80) + if(MSVC90) + set(TMP -vc90) + endif(MSVC90) + set(${PREFIX}_LIBNAMES ${basename}${TMP}) + if(${ARGC} GREATER 2) + set(${PREFIX}_LIBNAMES ${basename}${TMP}-${ARGV2}) + string(REGEX REPLACE "\\." "_" TMP ${${PREFIX}_LIBNAMES}) + set(${PREFIX}_LIBNAMES ${${PREFIX}_LIBNAMES} ${TMP}) + endif(${ARGC} GREATER 2) + find_library(${PREFIX}_LIBRARY + NAMES ${${PREFIX}_LIBNAMES} + PATHS ${${PREFIX}_PKGCONF_LIBRARY_DIRS} + ) +endmacro(libfind_library) + diff --git a/cmake/cmake_uninstall.cmake.in b/cmake/cmake_uninstall.cmake.in new file mode 100644 index 000000000..6031a6ca9 --- /dev/null +++ b/cmake/cmake_uninstall.cmake.in @@ -0,0 +1,23 @@ +# http://www.vtk.org/Wiki/CMake_FAQ#Can_I_do_.22make_uninstall.22_with_CMake.3F + +IF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") + MESSAGE(FATAL_ERROR "Cannot find install manifest: \"@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt\"") +ENDIF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") + +FILE(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files) +STRING(REGEX REPLACE "\n" ";" files "${files}") +FOREACH(file ${files}) + MESSAGE(STATUS "Uninstalling \"$ENV{DESTDIR}${file}\"") + IF(EXISTS "$ENV{DESTDIR}${file}") + EXEC_PROGRAM( + "@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\"" + OUTPUT_VARIABLE rm_out + RETURN_VALUE rm_retval + ) + IF(NOT "${rm_retval}" STREQUAL 0) + MESSAGE(FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"") + ENDIF(NOT "${rm_retval}" STREQUAL 0) + ELSE(EXISTS "$ENV{DESTDIR}${file}") + MESSAGE(STATUS "File \"$ENV{DESTDIR}${file}\" does not exist.") + ENDIF(EXISTS "$ENV{DESTDIR}${file}") +ENDFOREACH(file) diff --git a/cmake/msvc/config.h b/cmake/msvc/config.h new file mode 100644 index 000000000..71e94c832 --- /dev/null +++ b/cmake/msvc/config.h @@ -0,0 +1,55 @@ +#ifndef _MSC_VER // [ +#error "Use this header only with Microsoft Visual C++ compilers!" +#endif // _MSC_VER ] + +#ifndef _MSC_CONFIG_H_ // [ +#define _MSC_CONFIG_H_ + +//////////////////////////////////////////////////////////////////////// +// enable inline functions for C code +//////////////////////////////////////////////////////////////////////// +#ifndef __cplusplus +# define inline __inline +#endif + +//////////////////////////////////////////////////////////////////////// +// signed size_t +//////////////////////////////////////////////////////////////////////// +#include <stddef.h> +typedef ptrdiff_t ssize_t; + +//////////////////////////////////////////////////////////////////////// +// rint functions +//////////////////////////////////////////////////////////////////////// +static inline long lrint(double x){return (long)(x > 0.0 ? x + 0.5 : x - 0.5);} +static inline long lrintf(float x){return (long)(x > 0.0f ? x + 0.5f : x - 0.5f);} +static inline double rint(double x){return (double)lrint(x);} +static inline float rintf(float x){return (float)lrintf(x);} + +//////////////////////////////////////////////////////////////////////// +// math constants +//////////////////////////////////////////////////////////////////////// +#define INFINITY HUGE_VAL + +# define M_E 2.7182818284590452354 /* e */ +# define M_LOG2E 1.4426950408889634074 /* log_2 e */ +# define M_LOG10E 0.43429448190325182765 /* log_10 e */ +# define M_LN2 0.69314718055994530942 /* log_e 2 */ +# define M_LN10 2.30258509299404568402 /* log_e 10 */ +# define M_PI 3.14159265358979323846 /* pi */ +# define M_PI_2 1.57079632679489661923 /* pi/2 */ +# define M_PI_4 0.78539816339744830962 /* pi/4 */ +# define M_1_PI 0.31830988618379067154 /* 1/pi */ +# define M_2_PI 0.63661977236758134308 /* 2/pi */ +# define M_2_SQRTPI 1.12837916709551257390 /* 2/sqrt(pi) */ +# define M_SQRT2 1.41421356237309504880 /* sqrt(2) */ +# define M_SQRT1_2 0.70710678118654752440 /* 1/sqrt(2) */ + +//////////////////////////////////////////////////////////////////////// +// random and srandom +//////////////////////////////////////////////////////////////////////// +#include <stdlib.h> +static inline long int random (void) { return rand(); } +static inline void srandom (unsigned int seed) { srand(seed); } + +#endif // _MSC_CONFIG_H_ ] diff --git a/cmake/msvc/inttypes.h b/cmake/msvc/inttypes.h new file mode 100644 index 000000000..1c2baa82e --- /dev/null +++ b/cmake/msvc/inttypes.h @@ -0,0 +1,301 @@ +// ISO C9x compliant inttypes.h for Microsoft Visual Studio +// Based on ISO/IEC 9899:TC2 Committee draft (May 6, 2005) WG14/N1124 +// +// Copyright (c) 2006 Alexander Chemeris +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// 1. Redistributions of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. The name of the author may be used to endorse or promote products +// derived from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED +// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +// EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +// OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _MSC_VER // [ +#error "Use this header only with Microsoft Visual C++ compilers!" +#endif // _MSC_VER ] + +#ifndef _MSC_INTTYPES_H_ // [ +#define _MSC_INTTYPES_H_ + +#if _MSC_VER > 1000 +#pragma once +#endif + +#include <stdint.h> + +// 7.8 Format conversion of integer types + +typedef struct { + intmax_t quot; + intmax_t rem; +} imaxdiv_t; + +// 7.8.1 Macros for format specifiers + +// The fprintf macros for signed integers are: +#define PRId8 "d" +#define PRIi8 "i" +#define PRIdLEAST8 "d" +#define PRIiLEAST8 "i" +#define PRIdFAST8 "d" +#define PRIiFAST8 "i" + +#define PRId16 "hd" +#define PRIi16 "hi" +#define PRIdLEAST16 "hd" +#define PRIiLEAST16 "hi" +#define PRIdFAST16 "hd" +#define PRIiFAST16 "hi" + +#define PRId32 "I32d" +#define PRIi32 "I32i" +#define PRIdLEAST32 "I32d" +#define PRIiLEAST32 "I32i" +#define PRIdFAST32 "I32d" +#define PRIiFAST32 "I32i" + +#define PRId64 "I64d" +#define PRIi64 "I64i" +#define PRIdLEAST64 "I64d" +#define PRIiLEAST64 "I64i" +#define PRIdFAST64 "I64d" +#define PRIiFAST64 "I64i" + +#define PRIdMAX "I64d" +#define PRIiMAX "I64i" + +#define PRIdPTR "Id" +#define PRIiPTR "Ii" + +// The fprintf macros for unsigned integers are: +#define PRIo8 "o" +#define PRIu8 "u" +#define PRIx8 "x" +#define PRIX8 "X" +#define PRIoLEAST8 "o" +#define PRIuLEAST8 "u" +#define PRIxLEAST8 "x" +#define PRIXLEAST8 "X" +#define PRIoFAST8 "o" +#define PRIuFAST8 "u" +#define PRIxFAST8 "x" +#define PRIXFAST8 "X" + +#define PRIo16 "ho" +#define PRIu16 "hu" +#define PRIx16 "hx" +#define PRIX16 "hX" +#define PRIoLEAST16 "ho" +#define PRIuLEAST16 "hu" +#define PRIxLEAST16 "hx" +#define PRIXLEAST16 "hX" +#define PRIoFAST16 "ho" +#define PRIuFAST16 "hu" +#define PRIxFAST16 "hx" +#define PRIXFAST16 "hX" + +#define PRIo32 "I32o" +#define PRIu32 "I32u" +#define PRIx32 "I32x" +#define PRIX32 "I32X" +#define PRIoLEAST32 "I32o" +#define PRIuLEAST32 "I32u" +#define PRIxLEAST32 "I32x" +#define PRIXLEAST32 "I32X" +#define PRIoFAST32 "I32o" +#define PRIuFAST32 "I32u" +#define PRIxFAST32 "I32x" +#define PRIXFAST32 "I32X" + +#define PRIo64 "I64o" +#define PRIu64 "I64u" +#define PRIx64 "I64x" +#define PRIX64 "I64X" +#define PRIoLEAST64 "I64o" +#define PRIuLEAST64 "I64u" +#define PRIxLEAST64 "I64x" +#define PRIXLEAST64 "I64X" +#define PRIoFAST64 "I64o" +#define PRIuFAST64 "I64u" +#define PRIxFAST64 "I64x" +#define PRIXFAST64 "I64X" + +#define PRIoMAX "I64o" +#define PRIuMAX "I64u" +#define PRIxMAX "I64x" +#define PRIXMAX "I64X" + +#define PRIoPTR "Io" +#define PRIuPTR "Iu" +#define PRIxPTR "Ix" +#define PRIXPTR "IX" + +// The fscanf macros for signed integers are: +#define SCNd8 "d" +#define SCNi8 "i" +#define SCNdLEAST8 "d" +#define SCNiLEAST8 "i" +#define SCNdFAST8 "d" +#define SCNiFAST8 "i" + +#define SCNd16 "hd" +#define SCNi16 "hi" +#define SCNdLEAST16 "hd" +#define SCNiLEAST16 "hi" +#define SCNdFAST16 "hd" +#define SCNiFAST16 "hi" + +#define SCNd32 "ld" +#define SCNi32 "li" +#define SCNdLEAST32 "ld" +#define SCNiLEAST32 "li" +#define SCNdFAST32 "ld" +#define SCNiFAST32 "li" + +#define SCNd64 "I64d" +#define SCNi64 "I64i" +#define SCNdLEAST64 "I64d" +#define SCNiLEAST64 "I64i" +#define SCNdFAST64 "I64d" +#define SCNiFAST64 "I64i" + +#define SCNdMAX "I64d" +#define SCNiMAX "I64i" + +#ifdef _WIN64 // [ +# define SCNdPTR "I64d" +# define SCNiPTR "I64i" +#else // _WIN64 ][ +# define SCNdPTR "ld" +# define SCNiPTR "li" +#endif // _WIN64 ] + +// The fscanf macros for unsigned integers are: +#define SCNo8 "o" +#define SCNu8 "u" +#define SCNx8 "x" +#define SCNX8 "X" +#define SCNoLEAST8 "o" +#define SCNuLEAST8 "u" +#define SCNxLEAST8 "x" +#define SCNXLEAST8 "X" +#define SCNoFAST8 "o" +#define SCNuFAST8 "u" +#define SCNxFAST8 "x" +#define SCNXFAST8 "X" + +#define SCNo16 "ho" +#define SCNu16 "hu" +#define SCNx16 "hx" +#define SCNX16 "hX" +#define SCNoLEAST16 "ho" +#define SCNuLEAST16 "hu" +#define SCNxLEAST16 "hx" +#define SCNXLEAST16 "hX" +#define SCNoFAST16 "ho" +#define SCNuFAST16 "hu" +#define SCNxFAST16 "hx" +#define SCNXFAST16 "hX" + +#define SCNo32 "lo" +#define SCNu32 "lu" +#define SCNx32 "lx" +#define SCNX32 "lX" +#define SCNoLEAST32 "lo" +#define SCNuLEAST32 "lu" +#define SCNxLEAST32 "lx" +#define SCNXLEAST32 "lX" +#define SCNoFAST32 "lo" +#define SCNuFAST32 "lu" +#define SCNxFAST32 "lx" +#define SCNXFAST32 "lX" + +#define SCNo64 "I64o" +#define SCNu64 "I64u" +#define SCNx64 "I64x" +#define SCNX64 "I64X" +#define SCNoLEAST64 "I64o" +#define SCNuLEAST64 "I64u" +#define SCNxLEAST64 "I64x" +#define SCNXLEAST64 "I64X" +#define SCNoFAST64 "I64o" +#define SCNuFAST64 "I64u" +#define SCNxFAST64 "I64x" +#define SCNXFAST64 "I64X" + +#define SCNoMAX "I64o" +#define SCNuMAX "I64u" +#define SCNxMAX "I64x" +#define SCNXMAX "I64X" + +#ifdef _WIN64 // [ +# define SCNoPTR "I64o" +# define SCNuPTR "I64u" +# define SCNxPTR "I64x" +# define SCNXPTR "I64X" +#else // _WIN64 ][ +# define SCNoPTR "lo" +# define SCNuPTR "lu" +# define SCNxPTR "lx" +# define SCNXPTR "lX" +#endif // _WIN64 ] + +// 7.8.2 Functions for greatest-width integer types + +// 7.8.2.1 The imaxabs function +#define imaxabs _abs64 + +// 7.8.2.2 The imaxdiv function + +// This is modified version of div() function from Microsoft's div.c found +// in %MSVC.NET%\crt\src\div.c +#ifdef STATIC_IMAXDIV // [ +static +#else // STATIC_IMAXDIV ][ +_inline +#endif // STATIC_IMAXDIV ] +imaxdiv_t __cdecl imaxdiv(intmax_t numer, intmax_t denom) +{ + imaxdiv_t result; + + result.quot = numer / denom; + result.rem = numer % denom; + + if (numer < 0 && result.rem > 0) { + // did division wrong; must fix up + ++result.quot; + result.rem -= denom; + } + + return result; +} + +// 7.8.2.3 The strtoimax and strtoumax functions +#define strtoimax _strtoi64 +#define strtoumax _strtoui64 + +// 7.8.2.4 The wcstoimax and wcstoumax functions +#define wcstoimax _wcstoi64 +#define wcstoumax _wcstoui64 + + +#endif // _MSC_INTTYPES_H_ ] diff --git a/cmake/msvc/stdint.h b/cmake/msvc/stdint.h new file mode 100644 index 000000000..ab6d37e11 --- /dev/null +++ b/cmake/msvc/stdint.h @@ -0,0 +1,251 @@ +// ISO C9x compliant stdint.h for Microsoft Visual Studio +// Based on ISO/IEC 9899:TC2 Committee draft (May 6, 2005) WG14/N1124 +// +// Copyright (c) 2006-2008 Alexander Chemeris +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// 1. Redistributions of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. The name of the author may be used to endorse or promote products +// derived from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED +// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +// EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +// OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _MSC_VER // [ +#error "Use this header only with Microsoft Visual C++ compilers!" +#endif // _MSC_VER ] + +#ifndef _MSC_STDINT_H_ // [ +#define _MSC_STDINT_H_ + +#if _MSC_VER > 1000 +#pragma once +#endif + +#include <limits.h> + +// For Visual Studio 6 in C++ mode and for many Visual Studio versions when +// compiling for ARM we should wrap <wchar.h> include with 'extern "C++" {}' +// or compiler give many errors like this: +// error C2733: second C linkage of overloaded function 'wmemchr' not allowed +#ifdef __cplusplus +extern "C" { +#endif +# include <wchar.h> +#ifdef __cplusplus +} +#endif + +// Define _W64 macros to mark types changing their size, like intptr_t. +#ifndef _W64 +# if !defined(__midl) && (defined(_X86_) || defined(_M_IX86)) && _MSC_VER >= 1300 +# define _W64 __w64 +# else +# define _W64 +# endif +#endif + + +// 7.18.1 Integer types + +// 7.18.1.1 Exact-width integer types + +// Visual Studio 6 and Embedded Visual C++ 4 doesn't +// realize that, e.g. char has the same size as __int8 +// so we give up on __intX for them. +#if (_MSC_VER < 1300) + typedef signed char int8_t; + typedef signed short int16_t; + typedef signed int int32_t; + typedef unsigned char uint8_t; + typedef unsigned short uint16_t; + typedef unsigned int uint32_t; +#else + typedef signed __int8 int8_t; + typedef signed __int16 int16_t; + typedef signed __int32 int32_t; + typedef unsigned __int8 uint8_t; + typedef unsigned __int16 uint16_t; + typedef unsigned __int32 uint32_t; +#endif +typedef signed __int64 int64_t; +typedef unsigned __int64 uint64_t; + + +// 7.18.1.2 Minimum-width integer types +typedef int8_t int_least8_t; +typedef int16_t int_least16_t; +typedef int32_t int_least32_t; +typedef int64_t int_least64_t; +typedef uint8_t uint_least8_t; +typedef uint16_t uint_least16_t; +typedef uint32_t uint_least32_t; +typedef uint64_t uint_least64_t; + +// 7.18.1.3 Fastest minimum-width integer types +typedef int8_t int_fast8_t; +typedef int16_t int_fast16_t; +typedef int32_t int_fast32_t; +typedef int64_t int_fast64_t; +typedef uint8_t uint_fast8_t; +typedef uint16_t uint_fast16_t; +typedef uint32_t uint_fast32_t; +typedef uint64_t uint_fast64_t; + +// 7.18.1.4 Integer types capable of holding object pointers +#ifdef _WIN64 // [ + typedef signed __int64 intptr_t; + typedef unsigned __int64 uintptr_t; +#else // _WIN64 ][ + typedef _W64 signed int intptr_t; + typedef _W64 unsigned int uintptr_t; +#endif // _WIN64 ] + +// 7.18.1.5 Greatest-width integer types +typedef int64_t intmax_t; +typedef uint64_t uintmax_t; + + +// 7.18.2 Limits of specified-width integer types + +#if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS) // [ See footnote 220 at page 257 and footnote 221 at page 259 + +// 7.18.2.1 Limits of exact-width integer types +#define INT8_MIN ((int8_t)_I8_MIN) +#define INT8_MAX _I8_MAX +#define INT16_MIN ((int16_t)_I16_MIN) +#define INT16_MAX _I16_MAX +#define INT32_MIN ((int32_t)_I32_MIN) +#define INT32_MAX _I32_MAX +#define INT64_MIN ((int64_t)_I64_MIN) +#define INT64_MAX _I64_MAX +#define UINT8_MAX _UI8_MAX +#define UINT16_MAX _UI16_MAX +#define UINT32_MAX _UI32_MAX +#define UINT64_MAX _UI64_MAX + +// 7.18.2.2 Limits of minimum-width integer types +#define INT_LEAST8_MIN INT8_MIN +#define INT_LEAST8_MAX INT8_MAX +#define INT_LEAST16_MIN INT16_MIN +#define INT_LEAST16_MAX INT16_MAX +#define INT_LEAST32_MIN INT32_MIN +#define INT_LEAST32_MAX INT32_MAX +#define INT_LEAST64_MIN INT64_MIN +#define INT_LEAST64_MAX INT64_MAX +#define UINT_LEAST8_MAX UINT8_MAX +#define UINT_LEAST16_MAX UINT16_MAX +#define UINT_LEAST32_MAX UINT32_MAX +#define UINT_LEAST64_MAX UINT64_MAX + +// 7.18.2.3 Limits of fastest minimum-width integer types +#define INT_FAST8_MIN INT8_MIN +#define INT_FAST8_MAX INT8_MAX +#define INT_FAST16_MIN INT16_MIN +#define INT_FAST16_MAX INT16_MAX +#define INT_FAST32_MIN INT32_MIN +#define INT_FAST32_MAX INT32_MAX +#define INT_FAST64_MIN INT64_MIN +#define INT_FAST64_MAX INT64_MAX +#define UINT_FAST8_MAX UINT8_MAX +#define UINT_FAST16_MAX UINT16_MAX +#define UINT_FAST32_MAX UINT32_MAX +#define UINT_FAST64_MAX UINT64_MAX + +// 7.18.2.4 Limits of integer types capable of holding object pointers +#ifdef _WIN64 // [ +# define INTPTR_MIN INT64_MIN +# define INTPTR_MAX INT64_MAX +# define UINTPTR_MAX UINT64_MAX +#else // _WIN64 ][ +# define INTPTR_MIN INT32_MIN +# define INTPTR_MAX INT32_MAX +# define UINTPTR_MAX UINT32_MAX +#endif // _WIN64 ] + +// 7.18.2.5 Limits of greatest-width integer types +#define INTMAX_MIN INT64_MIN +#define INTMAX_MAX INT64_MAX +#define UINTMAX_MAX UINT64_MAX + +// 7.18.3 Limits of other integer types + +#ifdef _WIN64 // [ +# define PTRDIFF_MIN _I64_MIN +# define PTRDIFF_MAX _I64_MAX +#else // _WIN64 ][ +# define PTRDIFF_MIN _I32_MIN +# define PTRDIFF_MAX _I32_MAX +#endif // _WIN64 ] + +#define SIG_ATOMIC_MIN INT_MIN +#define SIG_ATOMIC_MAX INT_MAX + +#ifndef SIZE_MAX // [ +# ifdef _WIN64 // [ +# define SIZE_MAX _UI64_MAX +# else // _WIN64 ][ +# define SIZE_MAX _UI32_MAX +# endif // _WIN64 ] +#endif // SIZE_MAX ] + +// WCHAR_MIN and WCHAR_MAX are also defined in <wchar.h> +#ifndef WCHAR_MIN // [ +# define WCHAR_MIN 0 +#endif // WCHAR_MIN ] +#ifndef WCHAR_MAX // [ +# define WCHAR_MAX _UI16_MAX +#endif // WCHAR_MAX ] + +#define WINT_MIN 0 +#define WINT_MAX _UI16_MAX + +#endif // __STDC_LIMIT_MACROS ] + + +// 7.18.4 Limits of other integer types + +#if !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS) // [ See footnote 224 at page 260 + +// 7.18.4.1 Macros for minimum-width integer constants + +#define INT8_C(val) val##i8 +#define INT16_C(val) val##i16 +#define INT32_C(val) val##i32 +#define INT64_C(val) val##i64 + +#define UINT8_C(val) val##ui8 +#define UINT16_C(val) val##ui16 +#define UINT32_C(val) val##ui32 +#define UINT64_C(val) val##ui64 + +// 7.18.4.2 Macros for greatest-width integer constants +#ifndef INTMAX_C +#define INTMAX_C INT64_C +#endif +#ifndef UINTMAX_C +#define UINTMAX_C UINT64_C +#endif + +#endif // __STDC_CONSTANT_MACROS ] + + +#endif // _MSC_STDINT_H_ ] diff --git a/cmake/msvc/sys/time.h b/cmake/msvc/sys/time.h new file mode 100644 index 000000000..998b5d7bb --- /dev/null +++ b/cmake/msvc/sys/time.h @@ -0,0 +1,69 @@ +#ifndef _MSC_VER // [ +#error "Use this header only with Microsoft Visual C++ compilers!" +#endif // _MSC_VER ] + +#ifndef _MSC_SYS_TIME_H_ +#define _MSC_SYS_TIME_H_ + +//http://social.msdn.microsoft.com/Forums/en/vcgeneral/thread/430449b3-f6dd-4e18-84de-eebd26a8d668 +#include < time.h > +#include <windows.h> //I've ommited this line. +#if defined(_MSC_VER) || defined(_MSC_EXTENSIONS) + #define DELTA_EPOCH_IN_MICROSECS 11644473600000000Ui64 +#else + #define DELTA_EPOCH_IN_MICROSECS 11644473600000000ULL +#endif + +struct timespec { + +time_t tv_sec; /* Seconds since 00:00:00 GMT, */ + +/* 1 January 1970 */ + +long tv_nsec; /* Additional nanoseconds since */ + +/* tv_sec */ + +}; + +struct timezone +{ + int tz_minuteswest; /* minutes W of Greenwich */ + int tz_dsttime; /* type of dst correction */ +}; + +static inline int gettimeofday(struct timeval *tv, struct timezone *tz) +{ + FILETIME ft; + unsigned __int64 tmpres = 0; + static int tzflag; + + if (NULL != tv) + { + GetSystemTimeAsFileTime(&ft); + + tmpres |= ft.dwHighDateTime; + tmpres <<= 32; + tmpres |= ft.dwLowDateTime; + + /*converting file time to unix epoch*/ + tmpres -= DELTA_EPOCH_IN_MICROSECS; + tv->tv_sec = (long)(tmpres / 1000000UL); + tv->tv_usec = (long)(tmpres % 1000000UL); + } + + if (NULL != tz) + { + if (!tzflag) + { + _tzset(); + tzflag++; + } + tz->tz_minuteswest = _timezone / 60; + tz->tz_dsttime = _daylight; + } + + return 0; +} + +#endif //_MSC_SYS_TIME_H_ diff --git a/cmake/msvc/unistd.h b/cmake/msvc/unistd.h new file mode 100644 index 000000000..de412e42a --- /dev/null +++ b/cmake/msvc/unistd.h @@ -0,0 +1,10 @@ +#ifndef _MSC_VER // [ +#error "Use this header only with Microsoft Visual C++ compilers!" +#endif // _MSC_VER ] + +#ifndef _MSC_UNISTD_H_ // [ +#define _MSC_UNISTD_H_ + +#include <process.h> + +#endif // _MSC_UNISTD_H_ ] diff --git a/config/Makefile.am b/config/Makefile.am index 473f88488..3eaa5e748 100644 --- a/config/Makefile.am +++ b/config/Makefile.am @@ -54,12 +54,12 @@ m4macros = \ grc_gr_audio.m4 \ grc_gr_comedi.m4 \ grc_gr_gcell.m4 \ - grc_gr_gsm_fr_vocoder.m4 \ grc_gr_noaa.m4 \ grc_gr_radio_astronomy.m4 \ grc_gr_trellis.m4 \ grc_gr_usrp.m4 \ grc_gr_video_sdl.m4 \ + grc_gr_vocoder.m4 \ grc_gr_wxgui.m4 \ grc_gruel.m4 \ gr_check_createfilemapping.m4 \ diff --git a/config/grc_gnuradio_core.m4 b/config/grc_gnuradio_core.m4 index c67696c7d..a35629e2e 100644 --- a/config/grc_gnuradio_core.m4 +++ b/config/grc_gnuradio_core.m4 @@ -86,7 +86,6 @@ AC_DEFUN([GRC_GNURADIO_CORE],[ gnuradio-core/src/guile/gr-run-waveform-script \ gnuradio-core/src/lib/Makefile \ gnuradio-core/src/lib/filter/Makefile \ - gnuradio-core/src/lib/g72x/Makefile \ gnuradio-core/src/lib/general/Makefile \ gnuradio-core/src/lib/general/gr_constants.cc \ gnuradio-core/src/lib/gengen/Makefile \ @@ -106,7 +105,6 @@ AC_DEFUN([GRC_GNURADIO_CORE],[ gnuradio-core/src/python/gnuradio/gr/run_tests \ gnuradio-core/src/python/gnuradio/gru/Makefile \ gnuradio-core/src/python/gnuradio/gruimpl/Makefile \ - gnuradio-core/src/python/gnuradio/vocoder/Makefile \ gnuradio-core/src/tests/Makefile \ gnuradio-core/src/utils/Makefile \ ]) diff --git a/config/grc_gnuradio_examples.m4 b/config/grc_gnuradio_examples.m4 index 6dff01943..780c072c7 100644 --- a/config/grc_gnuradio_examples.m4 +++ b/config/grc_gnuradio_examples.m4 @@ -32,7 +32,6 @@ AC_DEFUN([GRC_GNURADIO_EXAMPLES],[ gnuradio-examples/python/apps/hf_radio/Makefile \ gnuradio-examples/python/apps/Makefile \ gnuradio-examples/python/digital/Makefile \ - gnuradio-examples/python/digital_voice/Makefile \ gnuradio-examples/python/digital-bert/Makefile \ gnuradio-examples/python/mp-sched/Makefile \ gnuradio-examples/python/multi-antenna/Makefile \ diff --git a/config/grc_gr_comedi.m4 b/config/grc_gr_comedi.m4 index 5e3089417..7e54b0f5a 100644 --- a/config/grc_gr_comedi.m4 +++ b/config/grc_gr_comedi.m4 @@ -29,7 +29,7 @@ AC_DEFUN([GRC_GR_COMEDI],[ dnl no : otherwise if test $passed = yes; then dnl Don't do gr-comedi if the 'comedi' library is unavailable. - PKG_CHECK_MODULES(COMEDI, comedilib < 0.8,[], + PKG_CHECK_MODULES(COMEDI, comedilib >= 0.8,[], [passed=no;AC_MSG_RESULT([gr-comedi requires comedilib, not found.])]) fi diff --git a/config/grc_gr_cvsd_vocoder.m4 b/config/grc_gr_cvsd_vocoder.m4 deleted file mode 100644 index ddf6f9b2f..000000000 --- a/config/grc_gr_cvsd_vocoder.m4 +++ /dev/null @@ -1,39 +0,0 @@ -dnl Copyright 2001,2002,2003,2004,2005,2006,2008 Free Software Foundation, Inc. -dnl -dnl This file is part of GNU Radio -dnl -dnl GNU Radio is free software; you can redistribute it and/or modify -dnl it under the terms of the GNU General Public License as published by -dnl the Free Software Foundation; either version 3, or (at your option) -dnl any later version. -dnl -dnl GNU Radio is distributed in the hope that it will be useful, -dnl but WITHOUT ANY WARRANTY; without even the implied warranty of -dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -dnl GNU General Public License for more details. -dnl -dnl You should have received a copy of the GNU General Public License -dnl along with GNU Radio; see the file COPYING. If not, write to -dnl the Free Software Foundation, Inc., 51 Franklin Street, -dnl Boston, MA 02110-1301, USA. - -AC_DEFUN([GRC_GR_CVSD_VOCODER],[ - GRC_ENABLE(gr-cvsd-vocoder) - - dnl Don't do gr-cvsd-vocoder if gnuradio-core skipped - GRC_CHECK_DEPENDENCY(gr-cvsd-vocoder, gnuradio-core) - - AC_CONFIG_FILES([\ - gr-cvsd-vocoder/Makefile \ - gr-cvsd-vocoder/gnuradio-cvsd-vocoder.pc \ - gr-cvsd-vocoder/src/Makefile \ - gr-cvsd-vocoder/src/lib/Makefile \ - gr-cvsd-vocoder/src/python/Makefile \ - gr-cvsd-vocoder/src/python/run_tests \ - ]) - - GRC_BUILD_CONDITIONAL(gr-cvsd-vocoder,[ - dnl run_tests is created from run_tests.in. Make it executable. - AC_CONFIG_COMMANDS([run_tests_cvsd], [chmod +x gr-cvsd-vocoder/src/python/run_tests]) - ]) -]) diff --git a/config/grc_gr_gsm_fr_vocoder.m4 b/config/grc_gr_gsm_fr_vocoder.m4 deleted file mode 100644 index a93d4edb7..000000000 --- a/config/grc_gr_gsm_fr_vocoder.m4 +++ /dev/null @@ -1,40 +0,0 @@ -dnl Copyright 2001,2002,2003,2004,2005,2006,2008 Free Software Foundation, Inc. -dnl -dnl This file is part of GNU Radio -dnl -dnl GNU Radio is free software; you can redistribute it and/or modify -dnl it under the terms of the GNU General Public License as published by -dnl the Free Software Foundation; either version 3, or (at your option) -dnl any later version. -dnl -dnl GNU Radio is distributed in the hope that it will be useful, -dnl but WITHOUT ANY WARRANTY; without even the implied warranty of -dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -dnl GNU General Public License for more details. -dnl -dnl You should have received a copy of the GNU General Public License -dnl along with GNU Radio; see the file COPYING. If not, write to -dnl the Free Software Foundation, Inc., 51 Franklin Street, -dnl Boston, MA 02110-1301, USA. - -AC_DEFUN([GRC_GR_GSM_FR_VOCODER],[ - GRC_ENABLE(gr-gsm-fr-vocoder) - - dnl Don't do gr-gsm-fr-vocoder if gnuradio-core skipped - GRC_CHECK_DEPENDENCY(gr-gsm-fr-vocoder, gnuradio-core) - - AC_CONFIG_FILES([\ - gr-gsm-fr-vocoder/Makefile \ - gr-gsm-fr-vocoder/gnuradio-gsm-fr-vocoder.pc \ - gr-gsm-fr-vocoder/src/Makefile \ - gr-gsm-fr-vocoder/src/lib/Makefile \ - gr-gsm-fr-vocoder/src/lib/gsm/Makefile \ - gr-gsm-fr-vocoder/src/python/Makefile \ - gr-gsm-fr-vocoder/src/python/run_tests \ - ]) - - GRC_BUILD_CONDITIONAL(gr-gsm-fr-vocoder,[ - dnl run_tests is created from run_tests.in. Make it executable. - AC_CONFIG_COMMANDS([run_tests_gsm], [chmod +x gr-gsm-fr-vocoder/src/python/run_tests]) - ]) -]) diff --git a/config/grc_gr_vocoder.m4 b/config/grc_gr_vocoder.m4 new file mode 100644 index 000000000..df75656fe --- /dev/null +++ b/config/grc_gr_vocoder.m4 @@ -0,0 +1,49 @@ +dnl Copyright 2011 Free Software Foundation, Inc. +dnl +dnl This file is part of GNU Radio +dnl +dnl GNU Radio is free software; you can redistribute it and/or modify +dnl it under the terms of the GNU General Public License as published by +dnl the Free Software Foundation; either version 3, or (at your option) +dnl any later version. +dnl +dnl GNU Radio is distributed in the hope that it will be useful, +dnl but WITHOUT ANY WARRANTY; without even the implied warranty of +dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +dnl GNU General Public License for more details. +dnl +dnl You should have received a copy of the GNU General Public License +dnl along with GNU Radio; see the file COPYING. If not, write to +dnl the Free Software Foundation, Inc., 51 Franklin Street, +dnl Boston, MA 02110-1301, USA. + +AC_DEFUN([GRC_GR_VOCODER],[ + GRC_ENABLE(gr-vocoder) + + dnl Don't do gr-vocoder if gnuradio-core skipped + GRC_CHECK_DEPENDENCY(gr-fr-vocoder, gnuradio-core) + + AC_CONFIG_FILES([\ + gr-vocoder/Makefile \ + gr-vocoder/gnuradio-vocoder.pc \ + gr-vocoder/apps/Makefile \ + gr-vocoder/doc/Makefile \ + gr-vocoder/examples/Makefile \ + gr-vocoder/grc/Makefile \ + gr-vocoder/include/Makefile \ + gr-vocoder/lib/Makefile \ + gr-vocoder/lib/codec2/Makefile \ + gr-vocoder/lib/g7xx/Makefile \ + gr-vocoder/lib/gsm/Makefile \ + gr-vocoder/python/Makefile \ + gr-vocoder/python/run_tests \ + gr-vocoder/swig/Makefile \ + gr-vocoder/swig/run_guile_tests \ + ]) + + GRC_BUILD_CONDITIONAL(gr-vocoder,[ + dnl run_tests is created from run_tests.in. Make it executable. + AC_CONFIG_COMMANDS([run_tests_vocoder], [chmod +x gr-vocoder/python/run_tests]) + AC_CONFIG_COMMANDS([run_tests_vocoder_guile], [chmod +x gr-vocoder/swig/run_guile_tests]) + ]) +]) diff --git a/configure.ac b/configure.ac index 1ac5960c5..28fac41d4 100644 --- a/configure.ac +++ b/configure.ac @@ -360,10 +360,9 @@ GRC_GR_USRP dnl this must come after GRC_USRP GRC_GR_USRP2 GRC_GR_GCELL dnl this must come after GRC_GCELL and GRC_GNURADIO_CORE GRC_GR_AUDIO +GRC_GR_VOCODER GRC_GR_ATSC GRC_GR_COMEDI -GRC_GR_CVSD_VOCODER -GRC_GR_GSM_FR_VOCODER GRC_GR_NOAA GRC_GR_PAGER GRC_GR_RADIO_ASTRONOMY diff --git a/debian/postinst b/debian/postinst new file mode 100755 index 000000000..66a0f75c1 --- /dev/null +++ b/debian/postinst @@ -0,0 +1,2 @@ +#!/bin/bash +/usr/libexec/gnuradio/grc_setup_freedesktop install diff --git a/debian/prerm b/debian/prerm new file mode 100755 index 000000000..edc1e1e48 --- /dev/null +++ b/debian/prerm @@ -0,0 +1,2 @@ +#!/bin/bash +/usr/libexec/gnuradio/grc_setup_freedesktop uninstall diff --git a/docs/CMakeLists.txt b/docs/CMakeLists.txt new file mode 100644 index 000000000..097e1fc67 --- /dev/null +++ b/docs/CMakeLists.txt @@ -0,0 +1,50 @@ +# Copyright 2011 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio 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 General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. + +######################################################################## +# Setup dependencies +######################################################################## +FIND_PACKAGE(Doxygen) + +######################################################################## +# Register component +######################################################################## +INCLUDE(GrComponent) +GR_REGISTER_COMPONENT("doxygen" ENABLE_DOXYGEN DOXYGEN_FOUND) + +######################################################################## +# Begin conditional configuration +######################################################################## +IF(ENABLE_DOXYGEN) + +######################################################################## +# Setup CPack components +######################################################################## +INCLUDE(GrPackage) +CPACK_COMPONENT("docs" + DISPLAY_NAME "Documentation" + DESCRIPTION "Doxygen generated documentation" +) + +######################################################################## +# Add subdirectories +######################################################################## +ADD_SUBDIRECTORY(doxygen) + +ENDIF(ENABLE_DOXYGEN) diff --git a/docs/doxygen/CMakeLists.txt b/docs/doxygen/CMakeLists.txt new file mode 100644 index 000000000..941479f63 --- /dev/null +++ b/docs/doxygen/CMakeLists.txt @@ -0,0 +1,51 @@ +# Copyright 2011 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio 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 General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. + +######################################################################## +# Create the doxygen configuration file +######################################################################## +FILE(TO_NATIVE_PATH ${CMAKE_SOURCE_DIR} top_srcdir) +FILE(TO_NATIVE_PATH ${CMAKE_SOURCE_DIR} abs_top_srcdir) +FILE(TO_NATIVE_PATH ${CMAKE_BINARY_DIR} abs_top_builddir) + +SET(HAVE_DOT ${DOXYGEN_DOT_FOUND}) +SET(enable_html_docs YES) +SET(enable_latex_docs NO) +SET(enable_xml_docs YES) + +CONFIGURE_FILE( + ${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in + ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile +@ONLY) + +SET(BUILT_DIRS ${CMAKE_CURRENT_BINARY_DIR}/xml ${CMAKE_CURRENT_BINARY_DIR}/html) + +######################################################################## +# Make and install doxygen docs +######################################################################## +ADD_CUSTOM_COMMAND( + OUTPUT ${BUILT_DIRS} + COMMAND ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + COMMENT "Generating documentation with doxygen" +) + +ADD_CUSTOM_TARGET(doxygen_target ALL DEPENDS ${BUILT_DIRS}) + +INSTALL(DIRECTORY ${BUILT_DIRS} DESTINATION ${GR_PKG_DOC_DIR} COMPONENT "docs") diff --git a/gnuradio-core/CMakeLists.txt b/gnuradio-core/CMakeLists.txt new file mode 100644 index 000000000..b72bf70d6 --- /dev/null +++ b/gnuradio-core/CMakeLists.txt @@ -0,0 +1,144 @@ +# Copyright 2010-2011 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio 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 General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. + +######################################################################## +# Setup dependencies +######################################################################## +INCLUDE(GrBoost) + +FIND_PACKAGE(GSL) + +FIND_PACKAGE(FFTW3f) + +INCLUDE(GrPython) #used for code generation + +GET_FILENAME_COMPONENT(GR_CORE_PYTHONPATH + ${CMAKE_CURRENT_SOURCE_DIR}/src/python ABSOLUTE +) +GR_SET_GLOBAL(GR_CORE_PYTHONPATH ${GR_CORE_PYTHONPATH}) + +######################################################################## +# Register component +######################################################################## +INCLUDE(GrComponent) +GR_REGISTER_COMPONENT("gnuradio-core" ENABLE_GR_CORE + ENABLE_GRUEL_ + Boost_FOUND + GSL_FOUND + FFTW3F_FOUND + PYTHONINTERP_FOUND +) + +INCLUDE(GrMiscUtils) +GR_SET_GLOBAL(GNURADIO_CORE_INCLUDE_DIRS + ${GRUEL_INCLUDE_DIRS} #headers depend on gruel + ${CMAKE_CURRENT_SOURCE_DIR}/src/lib/runtime + ${CMAKE_CURRENT_SOURCE_DIR}/src/lib/general + ${CMAKE_CURRENT_BINARY_DIR}/src/lib/general + ${CMAKE_CURRENT_SOURCE_DIR}/src/lib/gengen + ${CMAKE_CURRENT_BINARY_DIR}/src/lib/gengen + ${CMAKE_CURRENT_SOURCE_DIR}/src/lib/filter + ${CMAKE_CURRENT_BINARY_DIR}/src/lib/filter + ${CMAKE_CURRENT_SOURCE_DIR}/src/lib/missing + ${CMAKE_CURRENT_SOURCE_DIR}/src/lib/reed-solomon + ${CMAKE_CURRENT_SOURCE_DIR}/src/lib/viterbi + ${CMAKE_CURRENT_SOURCE_DIR}/src/lib/io + ${CMAKE_CURRENT_SOURCE_DIR}/src/lib/g72x + ${CMAKE_CURRENT_SOURCE_DIR}/src/lib/swig + ${CMAKE_CURRENT_BINARY_DIR}/src/lib/swig + ${CMAKE_CURRENT_SOURCE_DIR}/src/lib/hier +) + +GR_SET_GLOBAL(GNURADIO_CORE_SWIG_INCLUDE_DIRS + ${CMAKE_CURRENT_SOURCE_DIR}/src/lib/swig + ${GNURADIO_CORE_INCLUDE_DIRS} +) + +######################################################################## +# Begin conditional configuration +######################################################################## +IF(ENABLE_GR_CORE) + +######################################################################## +# Setup CPack components +######################################################################## +INCLUDE(GrPackage) +CPACK_SET(CPACK_COMPONENT_GROUP_CORE_DESCRIPTION "GNU Radio Core Library") + +CPACK_COMPONENT("core_runtime" + GROUP "Core" + DISPLAY_NAME "Runtime" + DESCRIPTION "Runtime" + DEPENDS "gruel_runtime" +) + +CPACK_COMPONENT("core_devel" + GROUP "Core" + DISPLAY_NAME "Development" + DESCRIPTION "C++ headers, package config, import libraries" + DEPENDS "gruel_devel" +) + +CPACK_COMPONENT("core_python" + GROUP "Core" + DISPLAY_NAME "Python" + DESCRIPTION "Python modules for runtime; GRC xml files" + DEPENDS "gruel_python;core_runtime" +) + +CPACK_COMPONENT("core_swig" + GROUP "Core" + DISPLAY_NAME "SWIG" + DESCRIPTION "SWIG development .i files" + DEPENDS "gruel_swig;core_python;core_devel" +) + +INSTALL( + FILES gnuradio-core.conf + DESTINATION ${GR_PKG_CONF_DIR} + COMPONENT "core_runtime" +) + +######################################################################## +# Add subdirectories +######################################################################## +ADD_SUBDIRECTORY(src/lib) +IF(ENABLE_TESTING) + ADD_SUBDIRECTORY(src/tests) +ENDIF(ENABLE_TESTING) +IF(ENABLE_PYTHON) + ADD_SUBDIRECTORY(src/lib/swig) + ADD_SUBDIRECTORY(src/python/gnuradio) +ENDIF(ENABLE_PYTHON) + +######################################################################## +# Create Pkg Config File +######################################################################## +CONFIGURE_FILE( + ${CMAKE_CURRENT_SOURCE_DIR}/gnuradio-core.pc.in + ${CMAKE_CURRENT_BINARY_DIR}/gnuradio-core.pc +@ONLY) + +INSTALL( + FILES ${CMAKE_CURRENT_BINARY_DIR}/gnuradio-core.pc + DESTINATION ${GR_LIBRARY_DIR}/pkgconfig + COMPONENT "core_devel" +) + +ENDIF(ENABLE_GR_CORE) diff --git a/gnuradio-core/src/lib/CMakeLists.txt b/gnuradio-core/src/lib/CMakeLists.txt new file mode 100644 index 000000000..10752ecd8 --- /dev/null +++ b/gnuradio-core/src/lib/CMakeLists.txt @@ -0,0 +1,101 @@ +# Copyright 2010-2011 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio 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 General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. + +######################################################################## +# Setup compatibility checks and defines +######################################################################## +INCLUDE(${CMAKE_CURRENT_SOURCE_DIR}/ConfigChecks.cmake) + +######################################################################## +# Include subdirs rather to populate to the sources lists. +######################################################################## +GR_INCLUDE_SUBDIRECTORY(missing) +GR_INCLUDE_SUBDIRECTORY(runtime) +GR_INCLUDE_SUBDIRECTORY(filter) +GR_INCLUDE_SUBDIRECTORY(viterbi) +GR_INCLUDE_SUBDIRECTORY(general) +GR_INCLUDE_SUBDIRECTORY(gengen) +GR_INCLUDE_SUBDIRECTORY(reed-solomon) +GR_INCLUDE_SUBDIRECTORY(io) +GR_INCLUDE_SUBDIRECTORY(hier) + +LIST(APPEND gnuradio_core_sources bug_work_around_6.cc) +LIST(APPEND test_gnuradio_core_sources bug_work_around_6.cc) + +######################################################################## +# Setup the include and linker paths +######################################################################## +INCLUDE_DIRECTORIES(${GNURADIO_CORE_INCLUDE_DIRS}) + +INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIRS}) +LINK_DIRECTORIES(${Boost_LIBRARY_DIRS}) + +ADD_DEFINITIONS(-DGSL_DLL) #needed for gsl windows port but safe to always define +INCLUDE_DIRECTORIES(${GSL_INCLUDE_DIRS}) +LINK_DIRECTORIES(${GSL_LIBRARY_DIRS}) + +INCLUDE_DIRECTORIES(${FFTW3F_INCLUDE_DIRS}) +LINK_DIRECTORIES(${FFTW3F_LIBRARY_DIRS}) + +######################################################################## +# Setup library +######################################################################## +LIST(APPEND gnuradio_core_libs + gruel + ${Boost_LIBRARIES} + ${GSL_LIBRARIES} + ${FFTW3F_LIBRARIES} +) + +ADD_LIBRARY(gnuradio-core SHARED ${gnuradio_core_sources}) +TARGET_LINK_LIBRARIES(gnuradio-core ${gnuradio_core_libs}) +SET_TARGET_PROPERTIES(gnuradio-core PROPERTIES DEFINE_SYMBOL "gnuradio_core_EXPORTS") +SET_TARGET_PROPERTIES(gnuradio-core PROPERTIES SOVERSION ${LIBVER}) +#avoid fftw and gsl link in dependent libraries: +SET_TARGET_PROPERTIES(gnuradio-core PROPERTIES LINK_INTERFACE_LIBRARIES "gruel") + +INSTALL(TARGETS gnuradio-core + LIBRARY DESTINATION ${GR_LIBRARY_DIR} COMPONENT "core_runtime" # .so/.dylib file + ARCHIVE DESTINATION ${GR_LIBRARY_DIR} COMPONENT "core_devel" # .lib file + RUNTIME DESTINATION ${GR_RUNTIME_DIR} COMPONENT "core_runtime" # .dll file +) + +######################################################################## +# Setup executables +######################################################################## +ADD_EXECUTABLE(gnuradio-config-info gnuradio-config-info.cc) +TARGET_LINK_LIBRARIES(gnuradio-config-info gnuradio-core ${Boost_LIBRARIES}) +INSTALL( + TARGETS gnuradio-config-info + DESTINATION ${GR_RUNTIME_DIR} + COMPONENT "core_runtime" +) + +######################################################################## +# Setup tests +######################################################################## +IF(ENABLE_TESTING) + +INCLUDE_DIRECTORIES(${CPPUNIT_INCLUDE_DIRS}) +LINK_DIRECTORIES(${CPPUNIT_LIBRARY_DIRS}) + +ADD_LIBRARY(test-gnuradio-core SHARED ${test_gnuradio_core_sources}) +TARGET_LINK_LIBRARIES(test-gnuradio-core gnuradio-core ${CPPUNIT_LIBRARIES} ${Boost_LIBRARIES}) + +ENDIF(ENABLE_TESTING) diff --git a/gnuradio-core/src/lib/ConfigChecks.cmake b/gnuradio-core/src/lib/ConfigChecks.cmake new file mode 100644 index 000000000..30a1011e4 --- /dev/null +++ b/gnuradio-core/src/lib/ConfigChecks.cmake @@ -0,0 +1,212 @@ +# Copyright 2010-2011 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio 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 General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. + +######################################################################## +INCLUDE(GrMiscUtils) +INCLUDE(CheckCXXSourceCompiles) + +IF(MSVC) #add this directory for our provided headers +LIST(APPEND CMAKE_REQUIRED_INCLUDES ${CMAKE_SOURCE_DIR}/msvc) +ENDIF(MSVC) + +GR_CHECK_HDR_N_DEF(netdb.h HAVE_NETDB_H) +GR_CHECK_HDR_N_DEF(sys/time.h HAVE_SYS_TIME_H) +GR_CHECK_HDR_N_DEF(sys/types.h HAVE_SYS_TYPES_H) +GR_CHECK_HDR_N_DEF(sys/select.h HAVE_SYS_SELECT_H) +GR_CHECK_HDR_N_DEF(sys/socket.h HAVE_SYS_SOCKET_H) +GR_CHECK_HDR_N_DEF(io.h HAVE_IO_H) +GR_CHECK_HDR_N_DEF(sys/mman.h HAVE_SYS_MMAN_H) +GR_CHECK_HDR_N_DEF(sys/ipc.h HAVE_SYS_IPC_H) +GR_CHECK_HDR_N_DEF(sys/shm.h HAVE_SYS_SHM_H) +GR_CHECK_HDR_N_DEF(signal.h HAVE_SIGNAL_H) +GR_CHECK_HDR_N_DEF(netinet/in.h HAVE_NETINET_IN_H) +GR_CHECK_HDR_N_DEF(arpa/inet.h HAVE_ARPA_INET_H) +GR_CHECK_HDR_N_DEF(byteswap.h HAVE_BYTESWAP_H) +GR_CHECK_HDR_N_DEF(linux/ppdev.h HAVE_LINUX_PPDEV_H) +GR_CHECK_HDR_N_DEF(dev/ppbus/ppi.h HAVE_DEV_PPBUS_PPI_H) +GR_CHECK_HDR_N_DEF(unistd.h HAVE_UNISTD_H) +GR_CHECK_HDR_N_DEF(malloc.h HAVE_MALLOC_H) + + +######################################################################## +CHECK_CXX_SOURCE_COMPILES(" + #include <stdio.h> + int main(){snprintf(0, 0, 0); return 0;} + " HAVE_SNPRINTF +) +GR_ADD_COND_DEF(HAVE_SNPRINTF) + +######################################################################## +CHECK_CXX_SOURCE_COMPILES(" + #include <signal.h> + int main(){sigaction(0, 0, 0); return 0;} + " HAVE_SIGACTION +) +GR_ADD_COND_DEF(HAVE_SIGACTION) + +######################################################################## +CHECK_CXX_SOURCE_COMPILES(" + #include <sys/select.h> + int main(){select(0, 0, 0, 0, 0); return 0;} + " HAVE_SELECT +) +GR_ADD_COND_DEF(HAVE_SELECT) + + +######################################################################## +CHECK_CXX_SOURCE_COMPILES(" + #include <unistd.h> + int main(){sysconf(0); return 0;} + " HAVE_SYSCONF +) +GR_ADD_COND_DEF(HAVE_SYSCONF) + +CHECK_CXX_SOURCE_COMPILES(" + #include <unistd.h> + int main(){getpagesize(); return 0;} + " HAVE_GETPAGESIZE +) +GR_ADD_COND_DEF(HAVE_GETPAGESIZE) + + +######################################################################## +CHECK_CXX_SOURCE_COMPILES(" + #include <Winbase.h> + int main(){Sleep(0); return 0;} + " HAVE_SSLEEP +) +GR_ADD_COND_DEF(HAVE_SSLEEP) + +CHECK_CXX_SOURCE_COMPILES(" + #include <time.h> + int main(){nanosleep(0, 0); return 0;} + " HAVE_NANOSLEEP +) +GR_ADD_COND_DEF(HAVE_NANOSLEEP) + +CHECK_CXX_SOURCE_COMPILES(" + #include <sys/time.h> + int main(){gettimeofday(0, 0); return 0;} + " HAVE_GETTIMEOFDAY +) +GR_ADD_COND_DEF(HAVE_GETTIMEOFDAY) + +######################################################################## +CHECK_CXX_SOURCE_COMPILES(" + #include <stdlib.h> + int main(){posix_memalign(0, 0, 0); return 0;} + " HAVE_POSIX_MEMALIGN +) +GR_ADD_COND_DEF(HAVE_POSIX_MEMALIGN) + +CHECK_CXX_SOURCE_COMPILES(" + #include <malloc.h> + int main(){valloc(0); return 0;} + " HAVE_VALLOC +) +GR_ADD_COND_DEF(HAVE_VALLOC) + +ADD_DEFINITIONS(-DALIGNED_MALLOC=0) + +######################################################################## +SET(CMAKE_REQUIRED_LIBRARIES -lpthread) +CHECK_CXX_SOURCE_COMPILES(" + #include <signal.h> + int main(){pthread_sigmask(0, 0, 0); return 0;} + " HAVE_PTHREAD_SIGMASK +) +GR_ADD_COND_DEF(HAVE_PTHREAD_SIGMASK) +SET(CMAKE_REQUIRED_LIBRARIES) + +######################################################################## +CHECK_CXX_SOURCE_COMPILES(" + #include <windows.h> + int main(){ + HANDLE handle; + int size; + LPCTSTR lpName; + handle = CreateFileMapping( + INVALID_HANDLE_VALUE, // use paging file + NULL, // default security + PAGE_READWRITE, // read/write access + 0, // max. object size + size, // buffer size + lpName); // name of mapping object + return 0; + } " HAVE_CREATEFILEMAPPING +) +GR_ADD_COND_DEF(HAVE_CREATEFILEMAPPING) + +######################################################################## +CHECK_INCLUDE_FILE_CXX(windows.h HAVE_WINDOWS_H) +IF(HAVE_WINDOWS_H) + ADD_DEFINITIONS(-DHAVE_WINDOWS_H -DUSING_WINSOCK) + MESSAGE(STATUS "Adding windows libs to gnuradio core libs...") + LIST(APPEND gnuradio_core_libs WS2_32.lib WSock32.lib) +ENDIF(HAVE_WINDOWS_H) + +######################################################################## +SET(CMAKE_REQUIRED_LIBRARIES -lrt) +CHECK_CXX_SOURCE_COMPILES(" + #include <sys/types.h> + #include <sys/mman.h> + int main(){shm_open(0, 0, 0); return 0;} + " HAVE_SHM_OPEN +) +GR_ADD_COND_DEF(HAVE_SHM_OPEN) +SET(CMAKE_REQUIRED_LIBRARIES) + +######################################################################## +CHECK_CXX_SOURCE_COMPILES(" + #define _GNU_SOURCE + #include <math.h> + int main(){double x, sin, cos; sincos(x, &sin, &cos); return 0;} + " HAVE_SINCOS +) +GR_ADD_COND_DEF(HAVE_SINCOS) + +CHECK_CXX_SOURCE_COMPILES(" + #define _GNU_SOURCE + #include <math.h> + int main(){float x, sin, cos; sincosf(x, &sin, &cos); return 0;} + " HAVE_SINCOSF +) +GR_ADD_COND_DEF(HAVE_SINCOSF) + +CHECK_CXX_SOURCE_COMPILES(" + #include <math.h> + int main(){sinf(0); return 0;} + " HAVE_SINF +) +GR_ADD_COND_DEF(HAVE_SINF) + +CHECK_CXX_SOURCE_COMPILES(" + #include <math.h> + int main(){cosf(0); return 0;} + " HAVE_COSF +) +GR_ADD_COND_DEF(HAVE_COSF) + +######################################################################## +CHECK_CXX_SOURCE_COMPILES(" + #include <sys/mman.h> + int main(){mmap(0, 0, 0, 0, 0, 0); return 0;} + " HAVE_MMAP +) +GR_ADD_COND_DEF(HAVE_MMAP) diff --git a/gnuradio-core/src/lib/Makefile.am b/gnuradio-core/src/lib/Makefile.am index 4db2ff167..979ac7f91 100644 --- a/gnuradio-core/src/lib/Makefile.am +++ b/gnuradio-core/src/lib/Makefile.am @@ -24,7 +24,7 @@ include $(top_srcdir)/Makefile.common ## Process this file with automake to produce Makefile.in # We've got to build . before swig -SUBDIRS = missing runtime filter viterbi general gengen g72x reed-solomon io hier . swig +SUBDIRS = missing runtime filter viterbi general gengen reed-solomon io hier . swig AM_CPPFLAGS = $(STD_DEFINES_AND_INCLUDES) $(CPPUNIT_INCLUDES) $(WITH_INCLUDES) @@ -43,7 +43,6 @@ libgnuradio_core_qa_la_LDFLAGS = $(NO_UNDEFINED) -version-info 0:0:0 \ libgnuradio_core_la_LIBADD = \ filter/libfilter.la \ - g72x/libccitt.la \ viterbi/libviterbi.la \ general/libgeneral.la \ gengen/libgengen.la \ diff --git a/gnuradio-core/src/lib/filter/CMakeLists.txt b/gnuradio-core/src/lib/filter/CMakeLists.txt new file mode 100644 index 000000000..2c060de80 --- /dev/null +++ b/gnuradio-core/src/lib/filter/CMakeLists.txt @@ -0,0 +1,343 @@ +# Copyright 2010-2011 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio 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 General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. + +######################################################################## +# This file included, use CMake directory variables +######################################################################## + +#set the C language property on the assembly files so the compiler will pick them up +FILE(GLOB gr_core_filter_asms ${CMAKE_CURRENT_SOURCE_DIR}/*.S) +FOREACH(gr_core_filter_asm ${gr_core_filter_asms}) + SET_PROPERTY(SOURCE ${gr_core_filter_asm} PROPERTY LANGUAGE C) +ENDFOREACH(gr_core_filter_asm) + +#uname -p says i386, but we know better when its x86 apple +IF(APPLE AND "${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "i386") + SET(CMAKE_SYSTEM_PROCESSOR "x86_64") +ENDIF() + +######################################################################## +# Generate the makefile.gen, then extract its sources: +# This is a round-about way to extract the sources, +# but it requires minimum changed to the python utils. +# +# The recommended way to do this: +# - Make a generation macro that registers the sources command. +# - List the generation macro with each templated source file. +# - Create a python script (very generic) to perform generation. +# - This way the targets would depend only on their sources. +######################################################################## +EXECUTE_PROCESS( + COMMAND ${PYTHON_EXECUTABLE} -c " +import os, sys +sys.path.append('${GR_CORE_PYTHONPATH}') +sys.path.append('${CMAKE_CURRENT_SOURCE_DIR}') +os.environ['srcdir'] = '${CMAKE_CURRENT_SOURCE_DIR}' +os.environ['gendir'] = '${CMAKE_CURRENT_BINARY_DIR}' +os.environ['do_makefile'] = '1' +os.environ['do_sources'] = '0' +from generate_all import generate_all +generate_all() + " WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} +) + +MACRO(FILTER_GEN_EXTRACT outvar ext) + EXECUTE_PROCESS(COMMAND ${PYTHON_EXECUTABLE} -c "import os; print ';'.join( + map(lambda x: os.path.join('${CMAKE_CURRENT_BINARY_DIR}', x.replace('\\\\', '').strip()), + filter(lambda f: '${ext}' in f, open('${CMAKE_CURRENT_BINARY_DIR}/Makefile.gen').readlines() + )))" OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_VARIABLE ${outvar}) + FILE(TO_CMAKE_PATH "${${outvar}}" ${outvar}) +ENDMACRO(FILTER_GEN_EXTRACT) + +FILTER_GEN_EXTRACT(generated_filter_sources ".cc") +FILTER_GEN_EXTRACT(generated_filter_includes ".h") +FILTER_GEN_EXTRACT(generated_filter_swigs ".i") + +#TODO simplify this list with a triple-threat for loop +SET(generated_filter_deps + ${CMAKE_CURRENT_SOURCE_DIR}/generate_all.py + ${CMAKE_CURRENT_SOURCE_DIR}/generate_gr_fir_XXX.py + ${CMAKE_CURRENT_SOURCE_DIR}/generate_gr_fir_filter_XXX.py + ${CMAKE_CURRENT_SOURCE_DIR}/generate_gr_interp_fir_filter_XXX.py + ${CMAKE_CURRENT_SOURCE_DIR}/generate_gr_rational_resampler_base_XXX.py + ${CMAKE_CURRENT_SOURCE_DIR}/generate_gr_fir_sysconfig.py + ${CMAKE_CURRENT_SOURCE_DIR}/generate_gr_fir_sysconfig_generic.py + ${CMAKE_CURRENT_SOURCE_DIR}/generate_gr_fir_util.py + ${CMAKE_CURRENT_SOURCE_DIR}/generate_gr_freq_xlating_fir_filter_XXX.py + ${CMAKE_CURRENT_SOURCE_DIR}/generate_gri_fir_filter_with_buffer_XXX.py + ${CMAKE_CURRENT_SOURCE_DIR}/generate_utils.py + ${CMAKE_CURRENT_SOURCE_DIR}/gr_fir_XXX.cc.t + ${CMAKE_CURRENT_SOURCE_DIR}/gr_fir_XXX.h.t + ${CMAKE_CURRENT_SOURCE_DIR}/gr_fir_XXX_generic.cc.t + ${CMAKE_CURRENT_SOURCE_DIR}/gr_fir_XXX_generic.h.t + ${CMAKE_CURRENT_SOURCE_DIR}/gr_fir_filter_XXX.cc.t + ${CMAKE_CURRENT_SOURCE_DIR}/gr_fir_filter_XXX.h.t + ${CMAKE_CURRENT_SOURCE_DIR}/gr_fir_filter_XXX.i.t + ${CMAKE_CURRENT_SOURCE_DIR}/gr_interp_fir_filter_XXX.cc.t + ${CMAKE_CURRENT_SOURCE_DIR}/gr_interp_fir_filter_XXX.h.t + ${CMAKE_CURRENT_SOURCE_DIR}/gr_interp_fir_filter_XXX.i.t + ${CMAKE_CURRENT_SOURCE_DIR}/gr_rational_resampler_base_XXX.cc.t + ${CMAKE_CURRENT_SOURCE_DIR}/gr_rational_resampler_base_XXX.h.t + ${CMAKE_CURRENT_SOURCE_DIR}/gr_rational_resampler_base_XXX.i.t + ${CMAKE_CURRENT_SOURCE_DIR}/gr_freq_xlating_fir_filter_XXX.cc.t + ${CMAKE_CURRENT_SOURCE_DIR}/gr_freq_xlating_fir_filter_XXX.h.t + ${CMAKE_CURRENT_SOURCE_DIR}/gr_freq_xlating_fir_filter_XXX.i.t + ${CMAKE_CURRENT_SOURCE_DIR}/gri_fir_filter_with_buffer_XXX.cc.t + ${CMAKE_CURRENT_SOURCE_DIR}/gri_fir_filter_with_buffer_XXX.h.t +) + +ADD_CUSTOM_COMMAND( + OUTPUT + ${generated_filter_sources} + ${generated_filter_includes} + ${generated_filter_swigs} + DEPENDS ${generated_filter_deps} + COMMAND ${PYTHON_EXECUTABLE} -B -c + \"import os, sys\;sys.path.append('${GR_CORE_PYTHONPATH}')\;sys.path.append('${CMAKE_CURRENT_SOURCE_DIR}')\;os.environ['srcdir'] = '${CMAKE_CURRENT_SOURCE_DIR}'\;from generate_all import generate_all\;generate_all()\" + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + COMMENT "generating filter files" +) + +ADD_CUSTOM_TARGET(filter_generated DEPENDS + ${generated_filter_sources} + ${generated_filter_includes} + ${generated_filter_swigs} +) + +######################################################################## +# Add target specific files +# May VOLK put a rest to all the insanity below. +######################################################################## +IF(MSVC) + LIST(APPEND gnuradio_core_sources + ${CMAKE_CURRENT_SOURCE_DIR}/sysconfig_generic.cc + ) + LIST(APPEND test_gnuradio_core_sources + ${CMAKE_CURRENT_SOURCE_DIR}/qa_dotprod_generic.cc + ) +ELSE(MSVC) +IF(CMAKE_SYSTEM_PROCESSOR MATCHES "^(i.86|x86|x86_64)$") + LIST(APPEND gnuradio_core_sources + ${CMAKE_CURRENT_SOURCE_DIR}/sysconfig_x86.cc + ${CMAKE_CURRENT_SOURCE_DIR}/gr_fir_sysconfig_x86.cc + ${CMAKE_CURRENT_SOURCE_DIR}/gr_cpu_x86.cc + ${CMAKE_CURRENT_SOURCE_DIR}/gr_fir_ccc_simd.cc + ${CMAKE_CURRENT_SOURCE_DIR}/gr_fir_ccc_x86.cc + ${CMAKE_CURRENT_SOURCE_DIR}/gr_fir_fff_simd.cc + ${CMAKE_CURRENT_SOURCE_DIR}/gr_fir_fff_x86.cc + ${CMAKE_CURRENT_SOURCE_DIR}/gr_fir_fsf_simd.cc + ${CMAKE_CURRENT_SOURCE_DIR}/gr_fir_fsf_x86.cc + ${CMAKE_CURRENT_SOURCE_DIR}/gr_fir_scc_simd.cc + ${CMAKE_CURRENT_SOURCE_DIR}/gr_fir_scc_x86.cc + ${CMAKE_CURRENT_SOURCE_DIR}/gr_fir_fcc_simd.cc + ${CMAKE_CURRENT_SOURCE_DIR}/gr_fir_fcc_x86.cc + ${CMAKE_CURRENT_SOURCE_DIR}/gr_fir_ccf_simd.cc + ${CMAKE_CURRENT_SOURCE_DIR}/gr_fir_ccf_x86.cc + ${CMAKE_CURRENT_SOURCE_DIR}/sse_debug.c + ) + LIST(APPEND test_gnuradio_core_sources + ${CMAKE_CURRENT_SOURCE_DIR}/qa_dotprod_x86.cc + ${CMAKE_CURRENT_SOURCE_DIR}/qa_float_dotprod_x86.cc + ${CMAKE_CURRENT_SOURCE_DIR}/qa_complex_dotprod_x86.cc + ${CMAKE_CURRENT_SOURCE_DIR}/qa_ccomplex_dotprod_x86.cc + ) +ENDIF(CMAKE_SYSTEM_PROCESSOR MATCHES "^(i.86|x86|x86_64)$") + +IF(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64") + LIST(APPEND gnuradio_core_sources + ${CMAKE_CURRENT_SOURCE_DIR}/float_dotprod_sse64.S + ${CMAKE_CURRENT_SOURCE_DIR}/float_dotprod_3dnow64.S + ${CMAKE_CURRENT_SOURCE_DIR}/complex_dotprod_3dnowext64.S + ${CMAKE_CURRENT_SOURCE_DIR}/complex_dotprod_3dnow64.S + ${CMAKE_CURRENT_SOURCE_DIR}/complex_dotprod_sse64.S + ${CMAKE_CURRENT_SOURCE_DIR}/ccomplex_dotprod_3dnowext64.S + ${CMAKE_CURRENT_SOURCE_DIR}/ccomplex_dotprod_3dnow64.S + ${CMAKE_CURRENT_SOURCE_DIR}/ccomplex_dotprod_sse64.S + ${CMAKE_CURRENT_SOURCE_DIR}/fcomplex_dotprod_3dnow64.S + ${CMAKE_CURRENT_SOURCE_DIR}/fcomplex_dotprod_sse64.S + ${CMAKE_CURRENT_SOURCE_DIR}/short_dotprod_mmx64.S + ) +ELSEIF(CMAKE_SYSTEM_PROCESSOR MATCHES "^(i.86|x86)$") + LIST(APPEND gnuradio_core_sources + ${CMAKE_CURRENT_SOURCE_DIR}/float_dotprod_sse.S + ${CMAKE_CURRENT_SOURCE_DIR}/float_dotprod_3dnow.S + ${CMAKE_CURRENT_SOURCE_DIR}/complex_dotprod_3dnowext.S + ${CMAKE_CURRENT_SOURCE_DIR}/complex_dotprod_3dnow.S + ${CMAKE_CURRENT_SOURCE_DIR}/complex_dotprod_sse.S + ${CMAKE_CURRENT_SOURCE_DIR}/ccomplex_dotprod_3dnowext.S + ${CMAKE_CURRENT_SOURCE_DIR}/ccomplex_dotprod_3dnow.S + ${CMAKE_CURRENT_SOURCE_DIR}/ccomplex_dotprod_sse.S + ${CMAKE_CURRENT_SOURCE_DIR}/fcomplex_dotprod_3dnow.S + ${CMAKE_CURRENT_SOURCE_DIR}/fcomplex_dotprod_sse.S + ${CMAKE_CURRENT_SOURCE_DIR}/short_dotprod_mmx.S + ) +ELSEIF(CMAKE_SYSTEM_PROCESSOR MATCHES "^(powerpc|ppc)") + LIST(APPEND gnuradio_core_sources + ${CMAKE_CURRENT_SOURCE_DIR}/sysconfig_powerpc.cc + ${CMAKE_CURRENT_SOURCE_DIR}/gr_fir_sysconfig_powerpc.cc + ${CMAKE_CURRENT_SOURCE_DIR}/gr_cpu_powerpc.cc + ${CMAKE_CURRENT_SOURCE_DIR}/gr_fir_fff_altivec.cc + ${CMAKE_CURRENT_SOURCE_DIR}/gr_altivec.c + ${CMAKE_CURRENT_SOURCE_DIR}/dotprod_fff_altivec.c + ) + LIST(APPEND test_gnuradio_core_sources + ${CMAKE_CURRENT_SOURCE_DIR}/qa_dotprod_powerpc.cc + ) +ELSEIF(CMAKE_SYSTEM_PROCESSOR MATCHES "^arm") + LIST(APPEND gnuradio_core_sources + ${CMAKE_CURRENT_SOURCE_DIR}/sysconfig_armv7_a.cc + ${CMAKE_CURRENT_SOURCE_DIR}/gr_fir_sysconfig_armv7_a.cc + ${CMAKE_CURRENT_SOURCE_DIR}/gr_cpu_armv7_a.cc + ${CMAKE_CURRENT_SOURCE_DIR}/gr_fir_fff_armv7_a.cc + ${CMAKE_CURRENT_SOURCE_DIR}/dotprod_fff_armv7_a.c + ${CMAKE_CURRENT_SOURCE_DIR}/dotprod_ccf_armv7_a.c + ${CMAKE_CURRENT_SOURCE_DIR}/gr_fir_ccf_armv7_a.cc + ) + LIST(APPEND test_gnuradio_core_sources + ${CMAKE_CURRENT_SOURCE_DIR}/qa_dotprod_armv7_a.cc + ) +ELSE(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64") + LIST(APPEND gnuradio_core_sources + ${CMAKE_CURRENT_SOURCE_DIR}/sysconfig_generic.cc + ) + LIST(APPEND test_gnuradio_core_sources + ${CMAKE_CURRENT_SOURCE_DIR}/qa_dotprod_generic.cc + ) +ENDIF(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64") +ENDIF(MSVC) + +######################################################################## +# Append gnuradio-core library sources +######################################################################## +LIST(APPEND gnuradio_core_sources + ${generated_filter_sources} + ${CMAKE_CURRENT_SOURCE_DIR}/gri_fft_filter_fff_generic.cc + ${CMAKE_CURRENT_SOURCE_DIR}/gri_fft_filter_ccc_generic.cc + ${CMAKE_CURRENT_SOURCE_DIR}/gr_sincos.c + ${CMAKE_CURRENT_SOURCE_DIR}/gri_goertzel.cc + ${CMAKE_CURRENT_SOURCE_DIR}/gri_mmse_fir_interpolator.cc + ${CMAKE_CURRENT_SOURCE_DIR}/gri_mmse_fir_interpolator_cc.cc + ${CMAKE_CURRENT_SOURCE_DIR}/complex_dotprod_generic.cc + ${CMAKE_CURRENT_SOURCE_DIR}/ccomplex_dotprod_generic.cc + ${CMAKE_CURRENT_SOURCE_DIR}/float_dotprod_generic.c + ${CMAKE_CURRENT_SOURCE_DIR}/short_dotprod_generic.c +) + +######################################################################## +# Append gnuradio-core test sources +######################################################################## +LIST(APPEND test_gnuradio_core_sources + ${CMAKE_CURRENT_SOURCE_DIR}/qa_filter.cc + ${CMAKE_CURRENT_SOURCE_DIR}/qa_gr_fir_ccf.cc + ${CMAKE_CURRENT_SOURCE_DIR}/qa_gr_fir_fcc.cc + ${CMAKE_CURRENT_SOURCE_DIR}/qa_gr_fir_fff.cc + ${CMAKE_CURRENT_SOURCE_DIR}/qa_gr_fir_ccc.cc + ${CMAKE_CURRENT_SOURCE_DIR}/qa_gr_fir_scc.cc + ${CMAKE_CURRENT_SOURCE_DIR}/qa_gr_rotator.cc + ${CMAKE_CURRENT_SOURCE_DIR}/qa_gri_mmse_fir_interpolator.cc + ${CMAKE_CURRENT_SOURCE_DIR}/qa_gri_mmse_fir_interpolator_cc.cc + ${CMAKE_CURRENT_SOURCE_DIR}/qa_gri_fir_filter_with_buffer_ccf.cc + ${CMAKE_CURRENT_SOURCE_DIR}/qa_gri_fir_filter_with_buffer_ccc.cc + ${CMAKE_CURRENT_SOURCE_DIR}/qa_gri_fir_filter_with_buffer_fcc.cc + ${CMAKE_CURRENT_SOURCE_DIR}/qa_gri_fir_filter_with_buffer_fff.cc + ${CMAKE_CURRENT_SOURCE_DIR}/qa_gri_fir_filter_with_buffer_fsf.cc + ${CMAKE_CURRENT_SOURCE_DIR}/qa_gri_fir_filter_with_buffer_scc.cc +) + +######################################################################## +# Install runtime headers +######################################################################## +INSTALL(FILES + ${generated_filter_includes} + ${CMAKE_CURRENT_SOURCE_DIR}/complex_dotprod_generic.h + ${CMAKE_CURRENT_SOURCE_DIR}/complex_dotprod_x86.h + ${CMAKE_CURRENT_SOURCE_DIR}/fcomplex_dotprod_x86.h + ${CMAKE_CURRENT_SOURCE_DIR}/ccomplex_dotprod_generic.h + ${CMAKE_CURRENT_SOURCE_DIR}/ccomplex_dotprod_x86.h + ${CMAKE_CURRENT_SOURCE_DIR}/float_dotprod_generic.h + ${CMAKE_CURRENT_SOURCE_DIR}/float_dotprod_x86.h + ${CMAKE_CURRENT_SOURCE_DIR}/gr_altivec.h + ${CMAKE_CURRENT_SOURCE_DIR}/gr_cpu.h + ${CMAKE_CURRENT_SOURCE_DIR}/gri_fft_filter_fff_generic.h + ${CMAKE_CURRENT_SOURCE_DIR}/gri_fft_filter_ccc_generic.h + ${CMAKE_CURRENT_SOURCE_DIR}/gr_fir_sysconfig_x86.h + ${CMAKE_CURRENT_SOURCE_DIR}/gr_fir_sysconfig_powerpc.h + ${CMAKE_CURRENT_SOURCE_DIR}/gr_rotator.h + ${CMAKE_CURRENT_SOURCE_DIR}/gr_sincos.h + ${CMAKE_CURRENT_SOURCE_DIR}/gr_single_pole_iir.h + ${CMAKE_CURRENT_SOURCE_DIR}/gr_vec_types.h + ${CMAKE_CURRENT_SOURCE_DIR}/gri_goertzel.h + ${CMAKE_CURRENT_SOURCE_DIR}/gri_iir.h + ${CMAKE_CURRENT_SOURCE_DIR}/gri_mmse_fir_interpolator.h + ${CMAKE_CURRENT_SOURCE_DIR}/gri_mmse_fir_interpolator_cc.h + ${CMAKE_CURRENT_SOURCE_DIR}/qa_filter.h + ${CMAKE_CURRENT_SOURCE_DIR}/short_dotprod_generic.h + ${CMAKE_CURRENT_SOURCE_DIR}/short_dotprod_x86.h + ${CMAKE_CURRENT_SOURCE_DIR}/sse_debug.h + DESTINATION ${GR_INCLUDE_DIR}/gnuradio + COMPONENT "core_devel" +) + +######################################################################## +# Install swig headers +######################################################################## +IF(ENABLE_PYTHON) +INSTALL(FILES + ${generated_filter_swigs} + ${CMAKE_CURRENT_SOURCE_DIR}/filter.i + ${CMAKE_CURRENT_BINARY_DIR}/filter_generated.i + DESTINATION ${GR_INCLUDE_DIR}/gnuradio/swig + COMPONENT "core_swig" +) +ENDIF(ENABLE_PYTHON) + +######################################################################## +# Handle triple-threat files that have cc, h, and i +######################################################################## +SET(gr_core_filter_triple_threats + gr_adaptive_fir_ccc + gr_adaptive_fir_ccf + gr_dc_blocker_cc + gr_dc_blocker_ff + gr_fft_filter_ccc + gr_fft_filter_fff + gr_filter_delay_fc + gr_fractional_interpolator_ff + gr_fractional_interpolator_cc + gr_goertzel_fc + gr_hilbert_fc + gr_iir_filter_ffd + gr_single_pole_iir_filter_ff + gr_single_pole_iir_filter_cc + gr_pfb_channelizer_ccf + gr_pfb_synthesis_filterbank_ccf + gr_pfb_decimator_ccf + gr_pfb_interpolator_ccf + gr_pfb_arb_resampler_ccf + gr_pfb_clock_sync_ccf + gr_pfb_clock_sync_fff +) + +FOREACH(file_tt ${gr_core_filter_triple_threats}) + LIST(APPEND gnuradio_core_sources ${CMAKE_CURRENT_SOURCE_DIR}/${file_tt}.cc) + INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${file_tt}.h DESTINATION ${GR_INCLUDE_DIR}/gnuradio COMPONENT "core_devel") + IF(ENABLE_PYTHON) + INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${file_tt}.i DESTINATION ${GR_INCLUDE_DIR}/gnuradio/swig COMPONENT "core_swig") + ENDIF(ENABLE_PYTHON) +ENDFOREACH(file_tt ${gr_core_filter_triple_threats}) diff --git a/gnuradio-core/src/lib/filter/ccomplex_dotprod_generic.h b/gnuradio-core/src/lib/filter/ccomplex_dotprod_generic.h index 4637dc706..c03743776 100644 --- a/gnuradio-core/src/lib/filter/ccomplex_dotprod_generic.h +++ b/gnuradio-core/src/lib/filter/ccomplex_dotprod_generic.h @@ -23,7 +23,9 @@ #ifndef _CCOMPLEX_DOTPROD_GENERIC_H_ #define _CCOMPLEX_DOTPROD_GENERIC_H_ -void +#include <gr_core_api.h> + +GR_CORE_API void ccomplex_dotprod_generic (const float *input, const float *taps, unsigned n_2_ccomplex_blocks, float *result); diff --git a/gnuradio-core/src/lib/filter/complex_dotprod_generic.h b/gnuradio-core/src/lib/filter/complex_dotprod_generic.h index 75d18e7f1..aed82179e 100644 --- a/gnuradio-core/src/lib/filter/complex_dotprod_generic.h +++ b/gnuradio-core/src/lib/filter/complex_dotprod_generic.h @@ -23,7 +23,9 @@ #ifndef _COMPLEX_DOTPROD_GENERIC_H_ #define _COMPLEX_DOTPROD_GENERIC_H_ -void +#include <gr_core_api.h> + +GR_CORE_API void complex_dotprod_generic (const short *input, const float *taps, unsigned n_2_complex_blocks, float *result); diff --git a/gnuradio-core/src/lib/filter/dotprod_fff_altivec.h b/gnuradio-core/src/lib/filter/dotprod_fff_altivec.h index d9ee52cf0..af9210382 100644 --- a/gnuradio-core/src/lib/filter/dotprod_fff_altivec.h +++ b/gnuradio-core/src/lib/filter/dotprod_fff_altivec.h @@ -21,6 +21,7 @@ #ifndef INCLUDED_DOTPROD_FFF_ALTIVEC_H #define INCLUDED_DOTPROD_FFF_ALTIVEC_H +#include <gr_core_api.h> #include <stddef.h> #ifdef __cplusplus diff --git a/gnuradio-core/src/lib/filter/dotprod_fff_armv7_a.h b/gnuradio-core/src/lib/filter/dotprod_fff_armv7_a.h index e72621a0d..667ee5fb6 100644 --- a/gnuradio-core/src/lib/filter/dotprod_fff_armv7_a.h +++ b/gnuradio-core/src/lib/filter/dotprod_fff_armv7_a.h @@ -21,6 +21,7 @@ #ifndef INCLUDED_DOTPROD_FFF_ARMV7_A_H #define INCLUDED_DOTPROD_FFF_ARMV7_A_H +#include <gr_core_api.h> #include <stddef.h> #ifdef __cplusplus diff --git a/gnuradio-core/src/lib/filter/generate_gr_fir_util.py b/gnuradio-core/src/lib/filter/generate_gr_fir_util.py index 4f5f5ce06..06001695e 100755 --- a/gnuradio-core/src/lib/filter/generate_gr_fir_util.py +++ b/gnuradio-core/src/lib/filter/generate_gr_fir_util.py @@ -25,7 +25,7 @@ from generate_utils import * def make_info_struct (out, sig): out.write ( ''' -struct gr_fir_%s_info { +struct GR_CORE_API gr_fir_%s_info { const char *name; // implementation name, e.g., "generic", "SSE", "3DNow!" gr_fir_%s *(*create)(const std::vector<%s> &taps); }; @@ -74,6 +74,7 @@ def make_gr_fir_util_h (): * 'i' (short) */ +#include <gr_core_api.h> #include <gr_types.h> ''') @@ -87,7 +88,7 @@ def make_gr_fir_util_h (): make_info_struct (out, sig) out.write (''' -struct gr_fir_util { +struct GR_CORE_API gr_fir_util { // create a fast version of gr_fir_XXX. diff --git a/gnuradio-core/src/lib/filter/gr_adaptive_fir_ccc.cc b/gnuradio-core/src/lib/filter/gr_adaptive_fir_ccc.cc index 884caf29c..3fed74641 100644 --- a/gnuradio-core/src/lib/filter/gr_adaptive_fir_ccc.cc +++ b/gnuradio-core/src/lib/filter/gr_adaptive_fir_ccc.cc @@ -33,7 +33,7 @@ gr_adaptive_fir_ccc::gr_adaptive_fir_ccc(const char *name, int decimation, gr_make_io_signature (1, 1, sizeof(gr_complex)), gr_make_io_signature (1, 1, sizeof(gr_complex)), decimation), - d_taps(taps), d_updated(false) + d_updated(false), d_taps(taps) { set_history(d_taps.size()); } diff --git a/gnuradio-core/src/lib/filter/gr_adaptive_fir_ccc.h b/gnuradio-core/src/lib/filter/gr_adaptive_fir_ccc.h index 8678255b7..aa5422a07 100644 --- a/gnuradio-core/src/lib/filter/gr_adaptive_fir_ccc.h +++ b/gnuradio-core/src/lib/filter/gr_adaptive_fir_ccc.h @@ -23,13 +23,14 @@ #ifndef INCLUDED_GR_ADAPTIVE_FIR_CCC_H #define INCLUDED_GR_ADAPTIVE_FIR_CCC_H +#include <gr_core_api.h> #include <gr_sync_decimator.h> /*! * \brief Adaptive FIR filter with gr_complex input, gr_complex output and float taps * \ingroup filter_blk */ -class gr_adaptive_fir_ccc : public gr_sync_decimator +class GR_CORE_API gr_adaptive_fir_ccc : public gr_sync_decimator { private: std::vector<gr_complex> d_new_taps; diff --git a/gnuradio-core/src/lib/filter/gr_adaptive_fir_ccf.h b/gnuradio-core/src/lib/filter/gr_adaptive_fir_ccf.h index f860f4faa..87854201c 100644 --- a/gnuradio-core/src/lib/filter/gr_adaptive_fir_ccf.h +++ b/gnuradio-core/src/lib/filter/gr_adaptive_fir_ccf.h @@ -23,13 +23,14 @@ #ifndef INCLUDED_GR_ADAPTIVE_FIR_CCF_H #define INCLUDED_GR_ADAPTIVE_FIR_CCF_H +#include <gr_core_api.h> #include <gr_sync_decimator.h> /*! * \brief Adaptive FIR filter with gr_complex input, gr_complex output and float taps * \ingroup filter_blk */ -class gr_adaptive_fir_ccf : public gr_sync_decimator +class GR_CORE_API gr_adaptive_fir_ccf : public gr_sync_decimator { private: std::vector<float> d_new_taps; diff --git a/gnuradio-core/src/lib/filter/gr_altivec.h b/gnuradio-core/src/lib/filter/gr_altivec.h index c0d7cfb34..eb941ce42 100644 --- a/gnuradio-core/src/lib/filter/gr_altivec.h +++ b/gnuradio-core/src/lib/filter/gr_altivec.h @@ -29,6 +29,7 @@ * (included below) */ +#include <gr_core_api.h> #include <altivec.h> #undef bool // repair namespace pollution #undef vector // repair namespace pollution @@ -55,8 +56,8 @@ union v_float_u { float f[FLOATS_PER_VEC]; }; -void gr_print_vector_float(FILE *fp, vec_float4 v); -void gr_pvf(FILE *fp, const char *label, vec_float4 v); +GR_CORE_API void gr_print_vector_float(FILE *fp, vec_float4 v); +GR_CORE_API void gr_pvf(FILE *fp, const char *label, vec_float4 v); static inline float horizontal_add_f(vec_float4 v) diff --git a/gnuradio-core/src/lib/filter/gr_cma_equalizer_cc.h b/gnuradio-core/src/lib/filter/gr_cma_equalizer_cc.h new file mode 100644 index 000000000..73916a315 --- /dev/null +++ b/gnuradio-core/src/lib/filter/gr_cma_equalizer_cc.h @@ -0,0 +1,63 @@ +/* -*- c++ -*- */ +/* + * Copyright 2006 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio 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 General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifndef INCLUDED_GR_CMA_EQUALIZER_CC_H +#define INCLUDED_GR_CMA_EQUALIZER_CC_H + +#include <gr_core_api.h> +#include <gr_adaptive_fir_ccf.h> + +class gr_cma_equalizer_cc; +typedef boost::shared_ptr<gr_cma_equalizer_cc> gr_cma_equalizer_cc_sptr; + +GR_CORE_API gr_cma_equalizer_cc_sptr +gr_make_cma_equalizer_cc(int num_taps, float modulus, float mu); + +/*! + * \brief Implements constant modulus adaptive filter on complex stream + * \ingroup eq_blk + */ +class GR_CORE_API gr_cma_equalizer_cc : public gr_adaptive_fir_ccf +{ +private: + float d_modulus; + float d_mu; + + friend GR_CORE_API gr_cma_equalizer_cc_sptr gr_make_cma_equalizer_cc(int num_taps, float modulus, float mu); + gr_cma_equalizer_cc(int num_taps, float modulus, float mu); + +protected: + + virtual float error(const gr_complex &out) + { + return (d_modulus - norm(out)); + } + + virtual void update_tap(float &tap, const gr_complex &in) + { + tap += d_mu*d_error*abs(in); + } + +public: +}; + +#endif diff --git a/gnuradio-core/src/lib/filter/gr_cpu.h b/gnuradio-core/src/lib/filter/gr_cpu.h index 01d719020..149404082 100644 --- a/gnuradio-core/src/lib/filter/gr_cpu.h +++ b/gnuradio-core/src/lib/filter/gr_cpu.h @@ -23,7 +23,9 @@ #ifndef _GR_CPU_H_ #define _GR_CPU_H_ -struct gr_cpu { +#include <gr_core_api.h> + +struct GR_CORE_API gr_cpu { static bool has_mmx (); static bool has_sse (); static bool has_sse2 (); @@ -37,4 +39,4 @@ struct gr_cpu { static bool has_armv7_a (); }; -#endif /* _GR_CPU_H_ */ +#endif /* _GR_CPU_H_ */
\ No newline at end of file diff --git a/gnuradio-core/src/lib/filter/gr_dc_blocker_cc.h b/gnuradio-core/src/lib/filter/gr_dc_blocker_cc.h index de9ccc0ea..3a9d364d4 100644 --- a/gnuradio-core/src/lib/filter/gr_dc_blocker_cc.h +++ b/gnuradio-core/src/lib/filter/gr_dc_blocker_cc.h @@ -24,12 +24,13 @@ #ifndef INCLUDED_GR_DC_BLOCKER_CC_H #define INCLUDED_GR_DC_BLOCKER_CC_H +#include <gr_core_api.h> #include <gr_sync_block.h> #include <deque> class gr_dc_blocker_cc; typedef boost::shared_ptr<gr_dc_blocker_cc> gr_dc_blocker_cc_sptr; -gr_dc_blocker_cc_sptr gr_make_dc_blocker_cc (int D=32, bool long_form=true); +GR_CORE_API gr_dc_blocker_cc_sptr gr_make_dc_blocker_cc (int D=32, bool long_form=true); /*! * \class gr_dc_blocker_cc @@ -57,7 +58,7 @@ gr_dc_blocker_cc_sptr gr_make_dc_blocker_cc (int D=32, bool long_form=true); * <B><EM>R. Yates, "DC Blocker Algorithms," IEEE Signal Processing Magazine, * Mar. 2008, pp 132-134.</EM></B> */ -class moving_averager_c +class GR_CORE_API moving_averager_c { public: moving_averager_c(int D); @@ -72,16 +73,15 @@ private: std::deque<gr_complex> d_delay_line; }; -class gr_dc_blocker_cc : public gr_sync_block +class GR_CORE_API gr_dc_blocker_cc : public gr_sync_block { private: /*! * Build the DC blocker. * \param D (int) the length of the delay line * \param long_form (bool) whether to use long (true, default) or short form - * \param channel (unsigned integer) Selects the channel to return [default=0]. */ - friend gr_dc_blocker_cc_sptr gr_make_dc_blocker_cc (int D, bool long_form); + GR_CORE_API friend gr_dc_blocker_cc_sptr gr_make_dc_blocker_cc (int D, bool long_form); int d_length; bool d_long_form; diff --git a/gnuradio-core/src/lib/filter/gr_dc_blocker_ff.h b/gnuradio-core/src/lib/filter/gr_dc_blocker_ff.h index b632d81da..6045b69de 100644 --- a/gnuradio-core/src/lib/filter/gr_dc_blocker_ff.h +++ b/gnuradio-core/src/lib/filter/gr_dc_blocker_ff.h @@ -24,12 +24,13 @@ #ifndef INCLUDED_GR_DC_BLOCKER_FF_H #define INCLUDED_GR_DC_BLOCKER_FF_H +#include <gr_core_api.h> #include <gr_sync_block.h> #include <deque> class gr_dc_blocker_ff; typedef boost::shared_ptr<gr_dc_blocker_ff> gr_dc_blocker_ff_sptr; -gr_dc_blocker_ff_sptr gr_make_dc_blocker_ff (int D=32, bool long_form=true); +GR_CORE_API gr_dc_blocker_ff_sptr gr_make_dc_blocker_ff (int D=32, bool long_form=true); /*! * \class gr_dc_blocker_ff @@ -57,7 +58,7 @@ gr_dc_blocker_ff_sptr gr_make_dc_blocker_ff (int D=32, bool long_form=true); * <B><EM>R. Yates, "DC Blocker Algorithms," IEEE Signal Processing Magazine, * Mar. 2008, pp 132-134.</EM></B> */ -class moving_averager_f +class GR_CORE_API moving_averager_f { public: moving_averager_f(int D); @@ -72,16 +73,15 @@ private: std::deque<float> d_delay_line; }; -class gr_dc_blocker_ff : public gr_sync_block +class GR_CORE_API gr_dc_blocker_ff : public gr_sync_block { private: /*! * Build the DC blocker. * \param D (int) the length of the delay line * \param long_form (bool) whether to use long (true, default) or short form - * \param channel (unsigned integer) Selects the channel to return [default=0]. */ - friend gr_dc_blocker_ff_sptr gr_make_dc_blocker_ff (int D, bool long_form); + GR_CORE_API friend gr_dc_blocker_ff_sptr gr_make_dc_blocker_ff (int D, bool long_form); int d_length; bool d_long_form; diff --git a/gnuradio-core/src/lib/filter/gr_fft_filter_ccc.h b/gnuradio-core/src/lib/filter/gr_fft_filter_ccc.h index 68b19e775..721a44a83 100644 --- a/gnuradio-core/src/lib/filter/gr_fft_filter_ccc.h +++ b/gnuradio-core/src/lib/filter/gr_fft_filter_ccc.h @@ -22,11 +22,12 @@ #ifndef INCLUDED_GR_FFT_FILTER_CCC_H #define INCLUDED_GR_FFT_FILTER_CCC_H +#include <gr_core_api.h> #include <gr_sync_decimator.h> class gr_fft_filter_ccc; typedef boost::shared_ptr<gr_fft_filter_ccc> gr_fft_filter_ccc_sptr; -gr_fft_filter_ccc_sptr gr_make_fft_filter_ccc (int decimation, const std::vector<gr_complex> &taps); +GR_CORE_API gr_fft_filter_ccc_sptr gr_make_fft_filter_ccc (int decimation, const std::vector<gr_complex> &taps); //class gri_fft_filter_ccc_sse; class gri_fft_filter_ccc_generic; @@ -35,10 +36,10 @@ class gri_fft_filter_ccc_generic; * \brief Fast FFT filter with gr_complex input, gr_complex output and gr_complex taps * \ingroup filter_blk */ -class gr_fft_filter_ccc : public gr_sync_decimator +class GR_CORE_API gr_fft_filter_ccc : public gr_sync_decimator { private: - friend gr_fft_filter_ccc_sptr gr_make_fft_filter_ccc (int decimation, const std::vector<gr_complex> &taps); + friend GR_CORE_API gr_fft_filter_ccc_sptr gr_make_fft_filter_ccc (int decimation, const std::vector<gr_complex> &taps); int d_nsamples; bool d_updated; diff --git a/gnuradio-core/src/lib/filter/gr_fft_filter_fff.h b/gnuradio-core/src/lib/filter/gr_fft_filter_fff.h index 6eaa21500..b0dc74883 100644 --- a/gnuradio-core/src/lib/filter/gr_fft_filter_fff.h +++ b/gnuradio-core/src/lib/filter/gr_fft_filter_fff.h @@ -22,11 +22,12 @@ #ifndef INCLUDED_GR_FFT_FILTER_FFF_H #define INCLUDED_GR_FFT_FILTER_FFF_H +#include <gr_core_api.h> #include <gr_sync_decimator.h> class gr_fft_filter_fff; typedef boost::shared_ptr<gr_fft_filter_fff> gr_fft_filter_fff_sptr; -gr_fft_filter_fff_sptr gr_make_fft_filter_fff (int decimation, const std::vector<float> &taps); +GR_CORE_API gr_fft_filter_fff_sptr gr_make_fft_filter_fff (int decimation, const std::vector<float> &taps); class gri_fft_filter_fff_generic; //class gri_fft_filter_fff_sse; @@ -35,10 +36,10 @@ class gri_fft_filter_fff_generic; * \brief Fast FFT filter with float input, float output and float taps * \ingroup filter_blk */ -class gr_fft_filter_fff : public gr_sync_decimator +class GR_CORE_API gr_fft_filter_fff : public gr_sync_decimator { private: - friend gr_fft_filter_fff_sptr gr_make_fft_filter_fff (int decimation, const std::vector<float> &taps); + friend GR_CORE_API gr_fft_filter_fff_sptr gr_make_fft_filter_fff (int decimation, const std::vector<float> &taps); int d_nsamples; bool d_updated; diff --git a/gnuradio-core/src/lib/filter/gr_filter_delay_fc.h b/gnuradio-core/src/lib/filter/gr_filter_delay_fc.h index 946edf2c7..e09e4f0df 100644 --- a/gnuradio-core/src/lib/filter/gr_filter_delay_fc.h +++ b/gnuradio-core/src/lib/filter/gr_filter_delay_fc.h @@ -23,6 +23,7 @@ #ifndef INCLUDED_GR_FILTER_DELAY_FC_H #define INCLUDED_GR_FILTER_DELAY_FC_H +#include <gr_core_api.h> #include <gr_sync_block.h> #include <gr_io_signature.h> #include <gr_types.h> @@ -31,7 +32,7 @@ class gr_filter_delay_fc; typedef boost::shared_ptr<gr_filter_delay_fc> gr_filter_delay_fc_sptr; // public constructor -gr_filter_delay_fc_sptr gr_make_filter_delay_fc (const std::vector<float> &taps); +GR_CORE_API gr_filter_delay_fc_sptr gr_make_filter_delay_fc (const std::vector<float> &taps); class gr_fir_fff; @@ -50,7 +51,7 @@ class gr_fir_fff; * before initializing this block. * */ -class gr_filter_delay_fc : public gr_sync_block +class GR_CORE_API gr_filter_delay_fc : public gr_sync_block { public: ~gr_filter_delay_fc (); @@ -66,7 +67,7 @@ class gr_filter_delay_fc : public gr_sync_block unsigned int d_delay; gr_fir_fff *d_fir; - friend gr_filter_delay_fc_sptr gr_make_filter_delay_fc (const std::vector<float> &taps); + friend GR_CORE_API gr_filter_delay_fc_sptr gr_make_filter_delay_fc (const std::vector<float> &taps); }; #endif /* INCLUDED_GR_FILTER_DELAY_FC_H */ diff --git a/gnuradio-core/src/lib/filter/gr_fir_XXX.h.t b/gnuradio-core/src/lib/filter/gr_fir_XXX.h.t index eeee716ec..f6019ea40 100644 --- a/gnuradio-core/src/lib/filter/gr_fir_XXX.h.t +++ b/gnuradio-core/src/lib/filter/gr_fir_XXX.h.t @@ -29,6 +29,7 @@ #ifndef @GUARD_NAME@ #define @GUARD_NAME@ +#include <gr_core_api.h> #include <vector> @VRCOMPLEX_INCLUDE@ #include <gr_reverse.h> @@ -44,7 +45,7 @@ * I,O,T are elements of the set 's' (short), 'f' (float), 'c' (gr_complex), 'i' (int) */ -class @FIR_TYPE@ { +class GR_CORE_API @FIR_TYPE@ { protected: std::vector<@TAP_TYPE@> d_taps; // reversed taps diff --git a/gnuradio-core/src/lib/filter/gr_fir_XXX_generic.h.t b/gnuradio-core/src/lib/filter/gr_fir_XXX_generic.h.t index fc0f4f8b2..b3594b7ad 100644 --- a/gnuradio-core/src/lib/filter/gr_fir_XXX_generic.h.t +++ b/gnuradio-core/src/lib/filter/gr_fir_XXX_generic.h.t @@ -22,6 +22,7 @@ #ifndef @GUARD_NAME@ #define @GUARD_NAME@ +#include <gr_core_api.h> #include <@FIR_TYPE@.h> /*! @@ -32,7 +33,7 @@ * I,O,T are elements of the set 's' (short), 'f' (float), 'c' (gr_complex), 'i' (int) */ -class @FIR_TYPE@_generic : public @FIR_TYPE@ { +class GR_CORE_API @FIR_TYPE@_generic : public @FIR_TYPE@ { public: diff --git a/gnuradio-core/src/lib/filter/gr_fir_ccc_simd.h b/gnuradio-core/src/lib/filter/gr_fir_ccc_simd.h index 14ff1e6b1..af61ce274 100644 --- a/gnuradio-core/src/lib/filter/gr_fir_ccc_simd.h +++ b/gnuradio-core/src/lib/filter/gr_fir_ccc_simd.h @@ -22,6 +22,7 @@ #ifndef INCLUDED_GR_FIR_CCC_SIMD_H #define INCLUDED_GR_FIR_CCC_SIMD_H +#include <gr_core_api.h> #include <gr_fir_ccc_generic.h> /*! @@ -32,7 +33,7 @@ * subclasses. */ -class gr_fir_ccc_simd : public gr_fir_ccc_generic +class GR_CORE_API gr_fir_ccc_simd : public gr_fir_ccc_generic { protected: typedef void (*ccomplex_dotprod_t)(const float *input, diff --git a/gnuradio-core/src/lib/filter/gr_fir_ccc_x86.h b/gnuradio-core/src/lib/filter/gr_fir_ccc_x86.h index 06d6b616c..262cc80e3 100644 --- a/gnuradio-core/src/lib/filter/gr_fir_ccc_x86.h +++ b/gnuradio-core/src/lib/filter/gr_fir_ccc_x86.h @@ -23,19 +23,20 @@ #ifndef INCLUDED_GR_FIR_CCC_X86_H #define INCLUDED_GR_FIR_CCC_X86_H +#include <gr_core_api.h> #include <gr_fir_ccc_simd.h> /*! * \brief 3DNow! version of gr_fir_ccc */ -class gr_fir_ccc_3dnow : public gr_fir_ccc_simd +class GR_CORE_API gr_fir_ccc_3dnow : public gr_fir_ccc_simd { public: gr_fir_ccc_3dnow (); gr_fir_ccc_3dnow (const std::vector<gr_complex> &taps); }; -class gr_fir_ccc_3dnowext : public gr_fir_ccc_simd +class GR_CORE_API gr_fir_ccc_3dnowext : public gr_fir_ccc_simd { public: gr_fir_ccc_3dnowext (); @@ -45,7 +46,7 @@ public: /*! * \brief SSE version of gr_fir_ccc */ -class gr_fir_ccc_sse : public gr_fir_ccc_simd +class GR_CORE_API gr_fir_ccc_sse : public gr_fir_ccc_simd { public: gr_fir_ccc_sse (); diff --git a/gnuradio-core/src/lib/filter/gr_fir_ccf_simd.h b/gnuradio-core/src/lib/filter/gr_fir_ccf_simd.h index ebc6a1bc0..31d70288e 100644 --- a/gnuradio-core/src/lib/filter/gr_fir_ccf_simd.h +++ b/gnuradio-core/src/lib/filter/gr_fir_ccf_simd.h @@ -22,6 +22,7 @@ #ifndef INCLUDED_GR_FIR_CCF_SIMD_H #define INCLUDED_GR_FIR_CCF_SIMD_H +#include <gr_core_api.h> #include <gr_fir_ccf_generic.h> @@ -33,7 +34,7 @@ * subclasses. */ -class gr_fir_ccf_simd : public gr_fir_ccf_generic +class GR_CORE_API gr_fir_ccf_simd : public gr_fir_ccf_generic { protected: typedef void (*fcomplex_dotprod_t)(const float *taps, diff --git a/gnuradio-core/src/lib/filter/gr_fir_ccf_x86.h b/gnuradio-core/src/lib/filter/gr_fir_ccf_x86.h index 7f936546f..38d82060c 100644 --- a/gnuradio-core/src/lib/filter/gr_fir_ccf_x86.h +++ b/gnuradio-core/src/lib/filter/gr_fir_ccf_x86.h @@ -23,13 +23,14 @@ #ifndef INCLUDED_GR_FIR_CCF_X86_H #define INCLUDED_GR_FIR_CCF_X86_H +#include <gr_core_api.h> #include <gr_fir_ccf_simd.h> /*! * \brief 3DNow! version of gr_fir_ccf * \ingroup filter_primitive */ -class gr_fir_ccf_3dnow : public gr_fir_ccf_simd +class GR_CORE_API gr_fir_ccf_3dnow : public gr_fir_ccf_simd { public: gr_fir_ccf_3dnow (); @@ -40,7 +41,7 @@ public: * \brief SSE version of gr_fir_ccf * \ingroup filter_primitive */ -class gr_fir_ccf_sse : public gr_fir_ccf_simd +class GR_CORE_API gr_fir_ccf_sse : public gr_fir_ccf_simd { public: gr_fir_ccf_sse (); diff --git a/gnuradio-core/src/lib/filter/gr_fir_fcc_simd.h b/gnuradio-core/src/lib/filter/gr_fir_fcc_simd.h index e2ed8bcae..7be3776e3 100644 --- a/gnuradio-core/src/lib/filter/gr_fir_fcc_simd.h +++ b/gnuradio-core/src/lib/filter/gr_fir_fcc_simd.h @@ -22,6 +22,7 @@ #ifndef INCLUDED_GR_FIR_FCC_SIMD_H #define INCLUDED_GR_FIR_FCC_SIMD_H +#include <gr_core_api.h> #include <gr_fir_fcc_generic.h> @@ -33,7 +34,7 @@ * subclasses. */ -class gr_fir_fcc_simd : public gr_fir_fcc_generic +class GR_CORE_API gr_fir_fcc_simd : public gr_fir_fcc_generic { protected: typedef void (*fcomplex_dotprod_t)(const float *input, diff --git a/gnuradio-core/src/lib/filter/gr_fir_fcc_x86.h b/gnuradio-core/src/lib/filter/gr_fir_fcc_x86.h index 49386c35d..98ace66de 100644 --- a/gnuradio-core/src/lib/filter/gr_fir_fcc_x86.h +++ b/gnuradio-core/src/lib/filter/gr_fir_fcc_x86.h @@ -23,13 +23,14 @@ #ifndef INCLUDED_GR_FIR_FCC_X86_H #define INCLUDED_GR_FIR_FCC_X86_H +#include <gr_core_api.h> #include <gr_fir_fcc_simd.h> /*! * \brief 3DNow! version of gr_fir_fcc * \ingroup filter_primitive */ -class gr_fir_fcc_3dnow : public gr_fir_fcc_simd +class GR_CORE_API gr_fir_fcc_3dnow : public gr_fir_fcc_simd { public: gr_fir_fcc_3dnow (); @@ -40,7 +41,7 @@ public: * \brief SSE version of gr_fir_fcc * \ingroup filter_blk */ -class gr_fir_fcc_sse : public gr_fir_fcc_simd +class GR_CORE_API gr_fir_fcc_sse : public gr_fir_fcc_simd { public: gr_fir_fcc_sse (); diff --git a/gnuradio-core/src/lib/filter/gr_fir_fff_altivec.h b/gnuradio-core/src/lib/filter/gr_fir_fff_altivec.h index 1694f5524..29bb3a899 100644 --- a/gnuradio-core/src/lib/filter/gr_fir_fff_altivec.h +++ b/gnuradio-core/src/lib/filter/gr_fir_fff_altivec.h @@ -21,12 +21,13 @@ #ifndef INCLUDED_GR_FIR_FFF_ALTIVEC_H #define INCLUDED_GR_FIR_FFF_ALTIVEC_H +#include <gr_core_api.h> #include <gr_fir_fff_generic.h> /*! * \brief altivec version of gr_fir_fff */ -class gr_fir_fff_altivec : public gr_fir_fff_generic +class GR_CORE_API gr_fir_fff_altivec : public gr_fir_fff_generic { protected: diff --git a/gnuradio-core/src/lib/filter/gr_fir_fff_armv7_a.h b/gnuradio-core/src/lib/filter/gr_fir_fff_armv7_a.h index d6097cf50..5c80c930f 100644 --- a/gnuradio-core/src/lib/filter/gr_fir_fff_armv7_a.h +++ b/gnuradio-core/src/lib/filter/gr_fir_fff_armv7_a.h @@ -21,12 +21,13 @@ #ifndef INCLUDED_GR_FIR_FFF_ARMV7_A_H #define INCLUDED_GR_FIR_FFF_ARMV7_A_H +#include <gr_core_api.h> #include <gr_fir_fff_generic.h> /*! * \brief armv7_a using NEON coprocessor version of gr_fir_fff */ -class gr_fir_fff_armv7_a : public gr_fir_fff_generic +class GR_CORE_API gr_fir_fff_armv7_a : public gr_fir_fff_generic { protected: diff --git a/gnuradio-core/src/lib/filter/gr_fir_fff_simd.h b/gnuradio-core/src/lib/filter/gr_fir_fff_simd.h index 82d3e3b99..781e4e7b9 100644 --- a/gnuradio-core/src/lib/filter/gr_fir_fff_simd.h +++ b/gnuradio-core/src/lib/filter/gr_fir_fff_simd.h @@ -22,6 +22,7 @@ #ifndef INCLUDED_GR_FIR_FFF_SIMD_H #define INCLUDED_GR_FIR_FFF_SIMD_H +#include <gr_core_api.h> #include <gr_fir_fff_generic.h> /*! @@ -32,7 +33,7 @@ * subclasses. */ -class gr_fir_fff_simd : public gr_fir_fff_generic +class GR_CORE_API gr_fir_fff_simd : public gr_fir_fff_generic { protected: typedef float (*float_dotprod_t)(const float *input, diff --git a/gnuradio-core/src/lib/filter/gr_fir_fff_x86.h b/gnuradio-core/src/lib/filter/gr_fir_fff_x86.h index c288035ba..4e2f33181 100644 --- a/gnuradio-core/src/lib/filter/gr_fir_fff_x86.h +++ b/gnuradio-core/src/lib/filter/gr_fir_fff_x86.h @@ -23,12 +23,13 @@ #ifndef INCLUDED_GR_FIR_FFF_X86_H #define INCLUDED_GR_FIR_FFF_X86_H +#include <gr_core_api.h> #include <gr_fir_fff_simd.h> /*! * \brief 3DNow! version of gr_fir_fff */ -class gr_fir_fff_3dnow : public gr_fir_fff_simd +class GR_CORE_API gr_fir_fff_3dnow : public gr_fir_fff_simd { public: gr_fir_fff_3dnow (); @@ -38,7 +39,7 @@ public: /*! * \brief SSE version of gr_fir_fff */ -class gr_fir_fff_sse : public gr_fir_fff_simd +class GR_CORE_API gr_fir_fff_sse : public gr_fir_fff_simd { public: gr_fir_fff_sse (); diff --git a/gnuradio-core/src/lib/filter/gr_fir_filter_XXX.h.t b/gnuradio-core/src/lib/filter/gr_fir_filter_XXX.h.t index f2e56c901..db0625504 100644 --- a/gnuradio-core/src/lib/filter/gr_fir_filter_XXX.h.t +++ b/gnuradio-core/src/lib/filter/gr_fir_filter_XXX.h.t @@ -28,11 +28,12 @@ #ifndef @GUARD_NAME@ #define @GUARD_NAME@ +#include <gr_core_api.h> #include <gr_sync_decimator.h> class @NAME@; typedef boost::shared_ptr<@NAME@> @SPTR_NAME@; -@SPTR_NAME@ gr_make_@BASE_NAME@ (int decimation, const std::vector<@TAP_TYPE@> &taps); +GR_CORE_API @SPTR_NAME@ gr_make_@BASE_NAME@ (int decimation, const std::vector<@TAP_TYPE@> &taps); class @FIR_TYPE@; @@ -40,10 +41,10 @@ class @FIR_TYPE@; * \brief FIR filter with @I_TYPE@ input, @O_TYPE@ output and @TAP_TYPE@ taps * \ingroup filter_blk */ -class @NAME@ : public gr_sync_decimator +class GR_CORE_API @NAME@ : public gr_sync_decimator { private: - friend @SPTR_NAME@ gr_make_@BASE_NAME@ (int decimation, const std::vector<@TAP_TYPE@> &taps); + friend GR_CORE_API @SPTR_NAME@ gr_make_@BASE_NAME@ (int decimation, const std::vector<@TAP_TYPE@> &taps); @FIR_TYPE@ *d_fir; std::vector<@TAP_TYPE@> d_new_taps; diff --git a/gnuradio-core/src/lib/filter/gr_fir_fsf_simd.h b/gnuradio-core/src/lib/filter/gr_fir_fsf_simd.h index ad689407d..6fcb6bd35 100644 --- a/gnuradio-core/src/lib/filter/gr_fir_fsf_simd.h +++ b/gnuradio-core/src/lib/filter/gr_fir_fsf_simd.h @@ -22,6 +22,7 @@ #ifndef _GR_FIR_FSF_SIMD_H_ #define _GR_FIR_FSF_SIMD_H_ +#include <gr_core_api.h> #include <gr_fir_fsf_generic.h> /*! @@ -32,7 +33,7 @@ * subclasses. */ -class gr_fir_fsf_simd : public gr_fir_fsf_generic +class GR_CORE_API gr_fir_fsf_simd : public gr_fir_fsf_generic { protected: typedef float (*float_dotprod_t)(const float *input, diff --git a/gnuradio-core/src/lib/filter/gr_fir_fsf_x86.h b/gnuradio-core/src/lib/filter/gr_fir_fsf_x86.h index 78fdf73c0..0e11059b3 100644 --- a/gnuradio-core/src/lib/filter/gr_fir_fsf_x86.h +++ b/gnuradio-core/src/lib/filter/gr_fir_fsf_x86.h @@ -23,13 +23,14 @@ #ifndef INCLUDED_GR_FIR_FSF_X86_H #define INCLUDED_GR_FIR_FSF_X86_H +#include <gr_core_api.h> #include <gr_fir_fsf_simd.h> /*! * \brief 3DNow! version of gr_fir_fsf * \ingroup filter_primitive */ -class gr_fir_fsf_3dnow : public gr_fir_fsf_simd +class GR_CORE_API gr_fir_fsf_3dnow : public gr_fir_fsf_simd { public: gr_fir_fsf_3dnow (); @@ -40,7 +41,7 @@ public: * \brief SSE version of gr_fir_fsf * \ingroup filter_primitive */ -class gr_fir_fsf_sse : public gr_fir_fsf_simd +class GR_CORE_API gr_fir_fsf_sse : public gr_fir_fsf_simd { public: gr_fir_fsf_sse (); diff --git a/gnuradio-core/src/lib/filter/gr_fir_scc_simd.h b/gnuradio-core/src/lib/filter/gr_fir_scc_simd.h index 2af45c8f4..9dced1578 100644 --- a/gnuradio-core/src/lib/filter/gr_fir_scc_simd.h +++ b/gnuradio-core/src/lib/filter/gr_fir_scc_simd.h @@ -22,6 +22,7 @@ #ifndef INCLUDED_GR_FIR_SCC_SIMD_H #define INCLUDED_GR_FIR_SCC_SIMD_H +#include <gr_core_api.h> #include <gr_fir_scc_generic.h> @@ -32,7 +33,7 @@ * This base class handles alignment issues common to SSE and 3DNOW * subclasses. */ -class gr_fir_scc_simd : public gr_fir_scc_generic +class GR_CORE_API gr_fir_scc_simd : public gr_fir_scc_generic { protected: typedef void (*complex_dotprod_t)(const short *input, diff --git a/gnuradio-core/src/lib/filter/gr_fir_scc_x86.h b/gnuradio-core/src/lib/filter/gr_fir_scc_x86.h index 0cb5e3f7c..484bdc5a0 100644 --- a/gnuradio-core/src/lib/filter/gr_fir_scc_x86.h +++ b/gnuradio-core/src/lib/filter/gr_fir_scc_x86.h @@ -23,12 +23,13 @@ #ifndef INCLUDED_GR_FIR_SCC_X86_H #define INCLUDED_GR_FIR_SCC_X86_H +#include <gr_core_api.h> #include <gr_fir_scc_simd.h> /*! * \brief 3DNow! version of gr_fir_scc */ -class gr_fir_scc_3dnow : public gr_fir_scc_simd +class GR_CORE_API gr_fir_scc_3dnow : public gr_fir_scc_simd { public: gr_fir_scc_3dnow (); @@ -38,7 +39,7 @@ public: /*! * \brief 3DNow! Ext version of gr_fir_scc */ -class gr_fir_scc_3dnowext : public gr_fir_scc_simd +class GR_CORE_API gr_fir_scc_3dnowext : public gr_fir_scc_simd { public: gr_fir_scc_3dnowext (); @@ -48,7 +49,7 @@ public: /*! * \brief SSE version of gr_fir_scc */ -class gr_fir_scc_sse : public gr_fir_scc_simd +class GR_CORE_API gr_fir_scc_sse : public gr_fir_scc_simd { public: gr_fir_scc_sse (); diff --git a/gnuradio-core/src/lib/filter/gr_fir_sysconfig_armv7_a.h b/gnuradio-core/src/lib/filter/gr_fir_sysconfig_armv7_a.h index c77b81026..69ee46019 100644 --- a/gnuradio-core/src/lib/filter/gr_fir_sysconfig_armv7_a.h +++ b/gnuradio-core/src/lib/filter/gr_fir_sysconfig_armv7_a.h @@ -22,9 +22,10 @@ #ifndef INCLUDED_GR_FIR_SYSCONFIG_ARMV7_A_H #define INCLUDED_GR_FIR_SYSCONFIG_ARMV7_A_H +#include <gr_core_api.h> #include <gr_fir_sysconfig_generic.h> -class gr_fir_sysconfig_armv7_a : public gr_fir_sysconfig_generic { +class GR_CORE_API gr_fir_sysconfig_armv7_a : public gr_fir_sysconfig_generic { public: virtual gr_fir_ccf *create_gr_fir_ccf (const std::vector<float> &taps); virtual gr_fir_fcc *create_gr_fir_fcc (const std::vector<gr_complex> &taps); diff --git a/gnuradio-core/src/lib/filter/gr_fir_sysconfig_powerpc.h b/gnuradio-core/src/lib/filter/gr_fir_sysconfig_powerpc.h index 9c31cdf1b..d6be7653f 100644 --- a/gnuradio-core/src/lib/filter/gr_fir_sysconfig_powerpc.h +++ b/gnuradio-core/src/lib/filter/gr_fir_sysconfig_powerpc.h @@ -22,9 +22,10 @@ #ifndef INCLUDED_GR_FIR_SYSCONFIG_POWERPC_H #define INCLUDED_GR_FIR_SYSCONFIG_POWERPC_H +#include <gr_core_api.h> #include <gr_fir_sysconfig_generic.h> -class gr_fir_sysconfig_powerpc : public gr_fir_sysconfig_generic { +class GR_CORE_API gr_fir_sysconfig_powerpc : public gr_fir_sysconfig_generic { public: virtual gr_fir_ccf *create_gr_fir_ccf (const std::vector<float> &taps); virtual gr_fir_fcc *create_gr_fir_fcc (const std::vector<gr_complex> &taps); diff --git a/gnuradio-core/src/lib/filter/gr_fir_sysconfig_x86.h b/gnuradio-core/src/lib/filter/gr_fir_sysconfig_x86.h index a4d0f92b0..49899d895 100644 --- a/gnuradio-core/src/lib/filter/gr_fir_sysconfig_x86.h +++ b/gnuradio-core/src/lib/filter/gr_fir_sysconfig_x86.h @@ -22,9 +22,10 @@ #ifndef INCLUDED_GR_FIR_SYSCONFIG_X86_H #define INCLUDED_GR_FIR_SYSCONFIG_X86_H +#include <gr_core_api.h> #include <gr_fir_sysconfig_generic.h> -class gr_fir_sysconfig_x86 : public gr_fir_sysconfig_generic { +class GR_CORE_API gr_fir_sysconfig_x86 : public gr_fir_sysconfig_generic { public: virtual gr_fir_ccf *create_gr_fir_ccf (const std::vector<float> &taps); virtual gr_fir_fcc *create_gr_fir_fcc (const std::vector<gr_complex> &taps); diff --git a/gnuradio-core/src/lib/filter/gr_fractional_interpolator_cc.h b/gnuradio-core/src/lib/filter/gr_fractional_interpolator_cc.h index c8378c43e..29c67895a 100644 --- a/gnuradio-core/src/lib/filter/gr_fractional_interpolator_cc.h +++ b/gnuradio-core/src/lib/filter/gr_fractional_interpolator_cc.h @@ -23,6 +23,7 @@ #ifndef INCLUDED_GR_FRACTIONAL_INTERPOLATOR_CC_H #define INCLUDED_GR_FRACTIONAL_INTERPOLATOR_CC_H +#include <gr_core_api.h> #include <gr_block.h> class gri_mmse_fir_interpolator_cc; @@ -31,13 +32,13 @@ class gr_fractional_interpolator_cc; typedef boost::shared_ptr<gr_fractional_interpolator_cc> gr_fractional_interpolator_cc_sptr; // public constructor -gr_fractional_interpolator_cc_sptr gr_make_fractional_interpolator_cc (float phase_shift, float interp_ratio); +GR_CORE_API gr_fractional_interpolator_cc_sptr gr_make_fractional_interpolator_cc (float phase_shift, float interp_ratio); /*! * \brief Interpolating mmse filter with gr_complex input, gr_complex output * \ingroup filter_blk */ -class gr_fractional_interpolator_cc : public gr_block +class GR_CORE_API gr_fractional_interpolator_cc : public gr_block { public: ~gr_fractional_interpolator_cc (); @@ -60,7 +61,7 @@ private: float d_mu_inc; gri_mmse_fir_interpolator_cc *d_interp; - friend gr_fractional_interpolator_cc_sptr + friend GR_CORE_API gr_fractional_interpolator_cc_sptr gr_make_fractional_interpolator_cc (float phase_shift, float interp_ratio); }; diff --git a/gnuradio-core/src/lib/filter/gr_fractional_interpolator_ff.h b/gnuradio-core/src/lib/filter/gr_fractional_interpolator_ff.h index f50129289..7e000a6d1 100644 --- a/gnuradio-core/src/lib/filter/gr_fractional_interpolator_ff.h +++ b/gnuradio-core/src/lib/filter/gr_fractional_interpolator_ff.h @@ -23,6 +23,7 @@ #ifndef INCLUDED_GR_FRACTIONAL_INTERPOLATOR_FF_H #define INCLUDED_GR_FRACTIONAL_INTERPOLATOR_FF_H +#include <gr_core_api.h> #include <gr_block.h> class gri_mmse_fir_interpolator; @@ -31,13 +32,13 @@ class gr_fractional_interpolator_ff; typedef boost::shared_ptr<gr_fractional_interpolator_ff> gr_fractional_interpolator_ff_sptr; // public constructor -gr_fractional_interpolator_ff_sptr gr_make_fractional_interpolator_ff (float phase_shift, float interp_ratio); +GR_CORE_API gr_fractional_interpolator_ff_sptr gr_make_fractional_interpolator_ff (float phase_shift, float interp_ratio); /*! * \brief Interpolating mmse filter with float input, float output * \ingroup filter_blk */ -class gr_fractional_interpolator_ff : public gr_block +class GR_CORE_API gr_fractional_interpolator_ff : public gr_block { public: ~gr_fractional_interpolator_ff (); @@ -60,7 +61,7 @@ private: float d_mu_inc; gri_mmse_fir_interpolator *d_interp; - friend gr_fractional_interpolator_ff_sptr + friend GR_CORE_API gr_fractional_interpolator_ff_sptr gr_make_fractional_interpolator_ff (float phase_shift, float interp_ratio); }; diff --git a/gnuradio-core/src/lib/filter/gr_freq_xlating_fir_filter_XXX.h.t b/gnuradio-core/src/lib/filter/gr_freq_xlating_fir_filter_XXX.h.t index 1205e8a08..bb05c138b 100644 --- a/gnuradio-core/src/lib/filter/gr_freq_xlating_fir_filter_XXX.h.t +++ b/gnuradio-core/src/lib/filter/gr_freq_xlating_fir_filter_XXX.h.t @@ -29,6 +29,7 @@ #ifndef @GUARD_NAME@ #define @GUARD_NAME@ +#include <gr_core_api.h> #include <gr_sync_decimator.h> #include <gr_rotator.h> @@ -40,7 +41,7 @@ typedef boost::shared_ptr<@NAME@> @SPTR_NAME@; * translation that shifts center_freq down to zero Hz. The frequency * translation logically comes before the filtering operation. */ -@SPTR_NAME@ +GR_CORE_API @SPTR_NAME@ gr_make_@BASE_NAME@ (int decimation, const std::vector<@TAP_TYPE@> &taps, double center_freq, double sampling_freq); @@ -60,7 +61,7 @@ class @FIR_TYPE@; * Uses a single input array to produce a single output array. * Additional inputs and/or outputs are ignored. */ -class @NAME@ : public gr_sync_decimator +class GR_CORE_API @NAME@ : public gr_sync_decimator { public: virtual ~@NAME@ (); @@ -73,7 +74,7 @@ class @NAME@ : public gr_sync_decimator gr_vector_void_star &output_items); private: - friend @SPTR_NAME@ + friend GR_CORE_API @SPTR_NAME@ gr_make_@BASE_NAME@ (int decimation, const std::vector<@TAP_TYPE@> &taps, double center_freq, double sampling_freq); diff --git a/gnuradio-core/src/lib/filter/gr_goertzel_fc.h b/gnuradio-core/src/lib/filter/gr_goertzel_fc.h index c60b63d88..6b5d8527c 100644 --- a/gnuradio-core/src/lib/filter/gr_goertzel_fc.h +++ b/gnuradio-core/src/lib/filter/gr_goertzel_fc.h @@ -23,6 +23,7 @@ #ifndef INCLUDED_GR_GOERTZEL_FC_H #define INCLUDED_GR_GOERTZEL_FC_H +#include <gr_core_api.h> #include <gri_goertzel.h> #include <gr_sync_decimator.h> @@ -30,16 +31,16 @@ class gr_goertzel_fc; typedef boost::shared_ptr<gr_goertzel_fc> gr_goertzel_fc_sptr; // public constructor -gr_goertzel_fc_sptr gr_make_goertzel_fc(int rate, int len, float freq); +GR_CORE_API gr_goertzel_fc_sptr gr_make_goertzel_fc(int rate, int len, float freq); /*! * \brief Goertzel single-bin DFT calculation. * \ingroup dft_blk */ -class gr_goertzel_fc : public gr_sync_decimator +class GR_CORE_API gr_goertzel_fc : public gr_sync_decimator { private: - friend gr_goertzel_fc_sptr gr_make_goertzel_fc (int rate, int len, float freq); + friend GR_CORE_API gr_goertzel_fc_sptr gr_make_goertzel_fc (int rate, int len, float freq); gr_goertzel_fc(int rate, int len, float freq); gri_goertzel d_goertzel; diff --git a/gnuradio-core/src/lib/filter/gr_hilbert_fc.h b/gnuradio-core/src/lib/filter/gr_hilbert_fc.h index adcac7793..ba73324ee 100644 --- a/gnuradio-core/src/lib/filter/gr_hilbert_fc.h +++ b/gnuradio-core/src/lib/filter/gr_hilbert_fc.h @@ -23,6 +23,7 @@ #ifndef INCLUDED_GR_HILBERT_FC_H #define INCLUDED_GR_HILBERT_FC_H +#include <gr_core_api.h> #include <gr_sync_block.h> #include <gr_io_signature.h> #include <gr_types.h> @@ -31,7 +32,7 @@ class gr_hilbert_fc; typedef boost::shared_ptr<gr_hilbert_fc> gr_hilbert_fc_sptr; // public constructor -gr_hilbert_fc_sptr gr_make_hilbert_fc (unsigned int ntaps); +GR_CORE_API gr_hilbert_fc_sptr gr_make_hilbert_fc (unsigned int ntaps); class gr_fir_fff; @@ -44,7 +45,7 @@ class gr_fir_fff; * imaginary output is hilbert filtered (90 degree phase shift) * version of input. */ -class gr_hilbert_fc : public gr_sync_block +class GR_CORE_API gr_hilbert_fc : public gr_sync_block { public: ~gr_hilbert_fc (); @@ -60,7 +61,7 @@ class gr_hilbert_fc : public gr_sync_block unsigned int d_ntaps; gr_fir_fff *d_hilb; - friend gr_hilbert_fc_sptr gr_make_hilbert_fc (unsigned int ntaps); + friend GR_CORE_API gr_hilbert_fc_sptr gr_make_hilbert_fc (unsigned int ntaps); }; diff --git a/gnuradio-core/src/lib/filter/gr_iir_filter_ffd.h b/gnuradio-core/src/lib/filter/gr_iir_filter_ffd.h index 0382646f1..386d056e5 100644 --- a/gnuradio-core/src/lib/filter/gr_iir_filter_ffd.h +++ b/gnuradio-core/src/lib/filter/gr_iir_filter_ffd.h @@ -23,13 +23,14 @@ #ifndef INCLUDED_GR_IIR_FILTER_FFD_H #define INCLUDED_GR_IIR_FILTER_FFD_H +#include <gr_core_api.h> #include <gr_sync_block.h> #include <gri_iir.h> #include <stdexcept> class gr_iir_filter_ffd; typedef boost::shared_ptr<gr_iir_filter_ffd> gr_iir_filter_ffd_sptr; -gr_iir_filter_ffd_sptr +GR_CORE_API gr_iir_filter_ffd_sptr gr_make_iir_filter_ffd (const std::vector<double> &fftaps, const std::vector<double> &fbtaps) throw (std::invalid_argument); @@ -56,10 +57,10 @@ gr_make_iir_filter_ffd (const std::vector<double> &fftaps, * Note that some texts define the system function with a + in the denominator. * If you're using that convention, you'll need to negate the feedback taps. */ -class gr_iir_filter_ffd : public gr_sync_block +class GR_CORE_API gr_iir_filter_ffd : public gr_sync_block { private: - friend gr_iir_filter_ffd_sptr + friend GR_CORE_API gr_iir_filter_ffd_sptr gr_make_iir_filter_ffd (const std::vector<double> &fftaps, const std::vector<double> &fbtaps) throw (std::invalid_argument); diff --git a/gnuradio-core/src/lib/filter/gr_interp_fir_filter_XXX.h.t b/gnuradio-core/src/lib/filter/gr_interp_fir_filter_XXX.h.t index 790e0b908..4a3590fc7 100644 --- a/gnuradio-core/src/lib/filter/gr_interp_fir_filter_XXX.h.t +++ b/gnuradio-core/src/lib/filter/gr_interp_fir_filter_XXX.h.t @@ -28,11 +28,12 @@ #ifndef @GUARD_NAME@ #define @GUARD_NAME@ +#include <gr_core_api.h> #include <gr_sync_interpolator.h> class @NAME@; typedef boost::shared_ptr<@NAME@> @SPTR_NAME@; -@SPTR_NAME@ gr_make_@BASE_NAME@ (unsigned interpolation, const std::vector<@TAP_TYPE@> &taps); +GR_CORE_API @SPTR_NAME@ gr_make_@BASE_NAME@ (unsigned interpolation, const std::vector<@TAP_TYPE@> &taps); class @FIR_TYPE@; @@ -40,10 +41,10 @@ class @FIR_TYPE@; * \brief Interpolating FIR filter with @I_TYPE@ input, @O_TYPE@ output and @TAP_TYPE@ taps * \ingroup filter_blk */ -class @NAME@ : public gr_sync_interpolator +class GR_CORE_API @NAME@ : public gr_sync_interpolator { private: - friend @SPTR_NAME@ gr_make_@BASE_NAME@ (unsigned interpolation, const std::vector<@TAP_TYPE@> &taps); + friend GR_CORE_API @SPTR_NAME@ gr_make_@BASE_NAME@ (unsigned interpolation, const std::vector<@TAP_TYPE@> &taps); std::vector<@TAP_TYPE@> d_new_taps; bool d_updated; diff --git a/gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_ccf.h b/gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_ccf.h index 2c36c95f9..5d2ad0941 100644 --- a/gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_ccf.h +++ b/gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_ccf.h @@ -24,11 +24,12 @@ #ifndef INCLUDED_GR_PFB_ARB_RESAMPLER_CCF_H #define INCLUDED_GR_PFB_ARB_RESAMPLER_CCF_H +#include <gr_core_api.h> #include <gr_block.h> class gr_pfb_arb_resampler_ccf; typedef boost::shared_ptr<gr_pfb_arb_resampler_ccf> gr_pfb_arb_resampler_ccf_sptr; -gr_pfb_arb_resampler_ccf_sptr gr_make_pfb_arb_resampler_ccf (float rate, +GR_CORE_API gr_pfb_arb_resampler_ccf_sptr gr_make_pfb_arb_resampler_ccf (float rate, const std::vector<float> &taps, unsigned int filter_size=32); @@ -95,7 +96,7 @@ class gr_fir_ccf; * Systems", Upper Saddle River, NJ: Prentice Hall, Inc. 2004.</EM></B> */ -class gr_pfb_arb_resampler_ccf : public gr_block +class GR_CORE_API gr_pfb_arb_resampler_ccf : public gr_block { private: /*! @@ -107,7 +108,7 @@ class gr_pfb_arb_resampler_ccf : public gr_block related to quantization noise introduced during the resampling. Defaults to 32 filters. */ - friend gr_pfb_arb_resampler_ccf_sptr gr_make_pfb_arb_resampler_ccf (float rate, + friend GR_CORE_API gr_pfb_arb_resampler_ccf_sptr gr_make_pfb_arb_resampler_ccf (float rate, const std::vector<float> &taps, unsigned int filter_size); diff --git a/gnuradio-core/src/lib/filter/gr_pfb_channelizer_ccf.h b/gnuradio-core/src/lib/filter/gr_pfb_channelizer_ccf.h index 751673bc7..56cb5ef40 100644 --- a/gnuradio-core/src/lib/filter/gr_pfb_channelizer_ccf.h +++ b/gnuradio-core/src/lib/filter/gr_pfb_channelizer_ccf.h @@ -24,11 +24,12 @@ #ifndef INCLUDED_GR_PFB_CHANNELIZER_CCF_H #define INCLUDED_GR_PFB_CHANNELIZER_CCF_H +#include <gr_core_api.h> #include <gr_block.h> class gr_pfb_channelizer_ccf; typedef boost::shared_ptr<gr_pfb_channelizer_ccf> gr_pfb_channelizer_ccf_sptr; -gr_pfb_channelizer_ccf_sptr gr_make_pfb_channelizer_ccf (unsigned int numchans, +GR_CORE_API gr_pfb_channelizer_ccf_sptr gr_make_pfb_channelizer_ccf (unsigned int numchans, const std::vector<float> &taps, float oversample_rate=1); @@ -110,7 +111,7 @@ class gri_fft_complex; * */ -class gr_pfb_channelizer_ccf : public gr_block +class GR_CORE_API gr_pfb_channelizer_ccf : public gr_block { private: /*! @@ -130,7 +131,7 @@ class gr_pfb_channelizer_ccf : public gr_block * sample rate of a 6/1 oversample ratio is 6000 Hz, or * 6 times the normal 1000 Hz. */ - friend gr_pfb_channelizer_ccf_sptr gr_make_pfb_channelizer_ccf (unsigned int numchans, + friend GR_CORE_API gr_pfb_channelizer_ccf_sptr gr_make_pfb_channelizer_ccf (unsigned int numchans, const std::vector<float> &taps, float oversample_rate); diff --git a/gnuradio-core/src/lib/filter/gr_pfb_clock_sync_ccf.h b/gnuradio-core/src/lib/filter/gr_pfb_clock_sync_ccf.h index 4718171a7..2eae11807 100644 --- a/gnuradio-core/src/lib/filter/gr_pfb_clock_sync_ccf.h +++ b/gnuradio-core/src/lib/filter/gr_pfb_clock_sync_ccf.h @@ -24,11 +24,12 @@ #ifndef INCLUDED_GR_PFB_CLOCK_SYNC_CCF_H #define INCLUDED_GR_PFB_CLOCK_SYNC_CCF_H +#include <gr_core_api.h> #include <gr_block.h> class gr_pfb_clock_sync_ccf; typedef boost::shared_ptr<gr_pfb_clock_sync_ccf> gr_pfb_clock_sync_ccf_sptr; -gr_pfb_clock_sync_ccf_sptr gr_make_pfb_clock_sync_ccf (double sps, float loop_bw, +GR_CORE_API gr_pfb_clock_sync_ccf_sptr gr_make_pfb_clock_sync_ccf (double sps, float loop_bw, const std::vector<float> &taps, unsigned int filter_size=32, float init_phase=0, @@ -111,7 +112,7 @@ class gr_fir_ccf; * */ -class gr_pfb_clock_sync_ccf : public gr_block +class GR_CORE_API gr_pfb_clock_sync_ccf : public gr_block { private: /*! @@ -125,7 +126,7 @@ class gr_pfb_clock_sync_ccf : public gr_block * \param max_rate_deviation (float) Distance from 0 d_rate can get (default = 1.5). * */ - friend gr_pfb_clock_sync_ccf_sptr gr_make_pfb_clock_sync_ccf (double sps, float loop_bw, + friend GR_CORE_API gr_pfb_clock_sync_ccf_sptr gr_make_pfb_clock_sync_ccf (double sps, float loop_bw, const std::vector<float> &taps, unsigned int filter_size, float init_phase, diff --git a/gnuradio-core/src/lib/filter/gr_pfb_clock_sync_fff.h b/gnuradio-core/src/lib/filter/gr_pfb_clock_sync_fff.h index fa1279a7c..d5984fe2d 100644 --- a/gnuradio-core/src/lib/filter/gr_pfb_clock_sync_fff.h +++ b/gnuradio-core/src/lib/filter/gr_pfb_clock_sync_fff.h @@ -24,11 +24,12 @@ #ifndef INCLUDED_GR_PFB_CLOCK_SYNC_FFF_H #define INCLUDED_GR_PFB_CLOCK_SYNC_FFF_H +#include <gr_core_api.h> #include <gr_block.h> class gr_pfb_clock_sync_fff; typedef boost::shared_ptr<gr_pfb_clock_sync_fff> gr_pfb_clock_sync_fff_sptr; -gr_pfb_clock_sync_fff_sptr gr_make_pfb_clock_sync_fff (double sps, float gain, +GR_CORE_API gr_pfb_clock_sync_fff_sptr gr_make_pfb_clock_sync_fff (double sps, float gain, const std::vector<float> &taps, unsigned int filter_size=32, float init_phase=0, @@ -110,7 +111,7 @@ class gr_fir_fff; * */ -class gr_pfb_clock_sync_fff : public gr_block +class GR_CORE_API gr_pfb_clock_sync_fff : public gr_block { private: /*! @@ -124,7 +125,7 @@ class gr_pfb_clock_sync_fff : public gr_block * \param max_rate_deviation (float) Distance from 0 d_rate can get (default = 1.5). * */ - friend gr_pfb_clock_sync_fff_sptr gr_make_pfb_clock_sync_fff (double sps, float gain, + friend GR_CORE_API gr_pfb_clock_sync_fff_sptr gr_make_pfb_clock_sync_fff (double sps, float gain, const std::vector<float> &taps, unsigned int filter_size, float init_phase, diff --git a/gnuradio-core/src/lib/filter/gr_pfb_decimator_ccf.h b/gnuradio-core/src/lib/filter/gr_pfb_decimator_ccf.h index 200adee3d..d091fe4bd 100644 --- a/gnuradio-core/src/lib/filter/gr_pfb_decimator_ccf.h +++ b/gnuradio-core/src/lib/filter/gr_pfb_decimator_ccf.h @@ -24,11 +24,12 @@ #ifndef INCLUDED_GR_PFB_DECIMATOR_CCF_H #define INCLUDED_GR_PFB_DECIMATOR_CCF_H +#include <gr_core_api.h> #include <gr_sync_block.h> class gr_pfb_decimator_ccf; typedef boost::shared_ptr<gr_pfb_decimator_ccf> gr_pfb_decimator_ccf_sptr; -gr_pfb_decimator_ccf_sptr gr_make_pfb_decimator_ccf (unsigned int decim, +GR_CORE_API gr_pfb_decimator_ccf_sptr gr_make_pfb_decimator_ccf (unsigned int decim, const std::vector<float> &taps, unsigned int channel=0); @@ -92,7 +93,7 @@ class gri_fft_complex; * Systems," Upper Saddle River, NJ: Prentice Hall, Inc. 2004.</EM></B> */ -class gr_pfb_decimator_ccf : public gr_sync_block +class GR_CORE_API gr_pfb_decimator_ccf : public gr_sync_block { private: /*! @@ -101,7 +102,7 @@ class gr_pfb_decimator_ccf : public gr_sync_block * \param taps (vector/list of floats) The prototype filter to populate the filterbank. * \param channel (unsigned integer) Selects the channel to return [default=0]. */ - friend gr_pfb_decimator_ccf_sptr gr_make_pfb_decimator_ccf (unsigned int decim, + friend GR_CORE_API gr_pfb_decimator_ccf_sptr gr_make_pfb_decimator_ccf (unsigned int decim, const std::vector<float> &taps, unsigned int channel); diff --git a/gnuradio-core/src/lib/filter/gr_pfb_interpolator_ccf.h b/gnuradio-core/src/lib/filter/gr_pfb_interpolator_ccf.h index d2efc591a..5e3ba6815 100644 --- a/gnuradio-core/src/lib/filter/gr_pfb_interpolator_ccf.h +++ b/gnuradio-core/src/lib/filter/gr_pfb_interpolator_ccf.h @@ -24,11 +24,12 @@ #ifndef INCLUDED_GR_PFB_INTERPOLATOR_CCF_H #define INCLUDED_GR_PFB_INTERPOLATOR_CCF_H +#include <gr_core_api.h> #include <gr_sync_interpolator.h> class gr_pfb_interpolator_ccf; typedef boost::shared_ptr<gr_pfb_interpolator_ccf> gr_pfb_interpolator_ccf_sptr; -gr_pfb_interpolator_ccf_sptr gr_make_pfb_interpolator_ccf (unsigned int interp, +GR_CORE_API gr_pfb_interpolator_ccf_sptr gr_make_pfb_interpolator_ccf (unsigned int interp, const std::vector<float> &taps); class gr_fir_ccf; @@ -79,7 +80,7 @@ class gr_fir_ccf; * Inc. 2004.</EM></B> */ -class gr_pfb_interpolator_ccf : public gr_sync_interpolator +class GR_CORE_API gr_pfb_interpolator_ccf : public gr_sync_interpolator { private: /*! @@ -88,7 +89,7 @@ class gr_pfb_interpolator_ccf : public gr_sync_interpolator * \param taps (vector/list of floats) The prototype filter to populate the filterbank. The taps * should be generated at the interpolated sampling rate. */ - friend gr_pfb_interpolator_ccf_sptr gr_make_pfb_interpolator_ccf (unsigned int interp, + friend GR_CORE_API gr_pfb_interpolator_ccf_sptr gr_make_pfb_interpolator_ccf (unsigned int interp, const std::vector<float> &taps); std::vector<gr_fir_ccf*> d_filters; diff --git a/gnuradio-core/src/lib/filter/gr_pfb_synthesis_filterbank_ccf.h b/gnuradio-core/src/lib/filter/gr_pfb_synthesis_filterbank_ccf.h index f5b1cbb94..0f3b7478c 100644 --- a/gnuradio-core/src/lib/filter/gr_pfb_synthesis_filterbank_ccf.h +++ b/gnuradio-core/src/lib/filter/gr_pfb_synthesis_filterbank_ccf.h @@ -24,12 +24,13 @@ #ifndef INCLUDED_GR_PFB_SYNTHESIS_FILTERBANK_CCF_H #define INCLUDED_GR_PFB_SYNTHESIS_FILTERBANK_CCF_H +#include <gr_core_api.h> #include <gr_sync_interpolator.h> #include <gri_fir_filter_with_buffer_ccf.h> class gr_pfb_synthesis_filterbank_ccf; typedef boost::shared_ptr<gr_pfb_synthesis_filterbank_ccf> gr_pfb_synthesis_filterbank_ccf_sptr; -gr_pfb_synthesis_filterbank_ccf_sptr gr_make_pfb_synthesis_filterbank_ccf +GR_CORE_API gr_pfb_synthesis_filterbank_ccf_sptr gr_make_pfb_synthesis_filterbank_ccf (unsigned int numchans, const std::vector<float> &taps); class gri_fft_complex; @@ -44,7 +45,7 @@ class gri_fft_complex; * \ingroup filter_blk */ -class gr_pfb_synthesis_filterbank_ccf : public gr_sync_interpolator +class GR_CORE_API gr_pfb_synthesis_filterbank_ccf : public gr_sync_interpolator { private: /*! @@ -54,7 +55,7 @@ class gr_pfb_synthesis_filterbank_ccf : public gr_sync_interpolator * \param taps (vector/list of floats) The prototype filter to populate the filterbank. */ - friend gr_pfb_synthesis_filterbank_ccf_sptr gr_make_pfb_synthesis_filterbank_ccf + friend GR_CORE_API gr_pfb_synthesis_filterbank_ccf_sptr gr_make_pfb_synthesis_filterbank_ccf (unsigned int numchans, const std::vector<float> &taps); bool d_updated; diff --git a/gnuradio-core/src/lib/filter/gr_rational_resampler_base_XXX.h.t b/gnuradio-core/src/lib/filter/gr_rational_resampler_base_XXX.h.t index 983b350fa..8f50acc72 100644 --- a/gnuradio-core/src/lib/filter/gr_rational_resampler_base_XXX.h.t +++ b/gnuradio-core/src/lib/filter/gr_rational_resampler_base_XXX.h.t @@ -29,11 +29,12 @@ #ifndef @GUARD_NAME@ #define @GUARD_NAME@ +#include <gr_core_api.h> #include <gr_block.h> class @NAME@; typedef boost::shared_ptr<@NAME@> @SPTR_NAME@; -@SPTR_NAME@ +GR_CORE_API @SPTR_NAME@ gr_make_@BASE_NAME@ (unsigned interpolation, unsigned decimation, const std::vector<@TAP_TYPE@> &taps); @@ -44,7 +45,7 @@ class @FIR_TYPE@; * \brief Rational Resampling Polyphase FIR filter with @I_TYPE@ input, @O_TYPE@ output and @TAP_TYPE@ taps * \ingroup filter_blk */ -class @NAME@ : public gr_block +class GR_CORE_API @NAME@ : public gr_block { private: unsigned d_history; @@ -54,7 +55,7 @@ class @NAME@ : public gr_block bool d_updated; std::vector<@FIR_TYPE@ *> d_firs; - friend @SPTR_NAME@ + friend GR_CORE_API @SPTR_NAME@ gr_make_@BASE_NAME@ (unsigned interpolation, unsigned decimation, const std::vector<@TAP_TYPE@> &taps); diff --git a/gnuradio-core/src/lib/filter/gr_rotator.h b/gnuradio-core/src/lib/filter/gr_rotator.h index cb8f21a40..23c7a2830 100644 --- a/gnuradio-core/src/lib/filter/gr_rotator.h +++ b/gnuradio-core/src/lib/filter/gr_rotator.h @@ -23,9 +23,10 @@ #ifndef _GR_ROTATOR_H_ #define _GR_ROTATOR_H_ +#include <gr_core_api.h> #include <gr_complex.h> -class gr_rotator { +class GR_CORE_API gr_rotator { gr_complex d_phase; gr_complex d_phase_incr; unsigned int d_counter; diff --git a/gnuradio-core/src/lib/filter/gr_sincos.h b/gnuradio-core/src/lib/filter/gr_sincos.h index a8e267951..3d5c99083 100644 --- a/gnuradio-core/src/lib/filter/gr_sincos.h +++ b/gnuradio-core/src/lib/filter/gr_sincos.h @@ -23,14 +23,16 @@ #ifndef INCLUDED_GR_SINCOS_H #define INCLUDED_GR_SINCOS_H +#include <gr_core_api.h> + #ifdef __cplusplus extern "C" { #endif // compute sine and cosine at the same time -void gr_sincos (double x, double *sin, double *cos); -void gr_sincosf (float x, float *sin, float *cos); +GR_CORE_API void gr_sincos (double x, double *sin, double *cos); +GR_CORE_API void gr_sincosf (float x, float *sin, float *cos); #ifdef __cplusplus }; diff --git a/gnuradio-core/src/lib/filter/gr_single_pole_iir.h b/gnuradio-core/src/lib/filter/gr_single_pole_iir.h index 8781065d4..fb52e29e9 100644 --- a/gnuradio-core/src/lib/filter/gr_single_pole_iir.h +++ b/gnuradio-core/src/lib/filter/gr_single_pole_iir.h @@ -22,6 +22,7 @@ #ifndef _GR_SINGLE_POLE_IIR_H_ #define _GR_SINGLE_POLE_IIR_H_ +#include <gr_core_api.h> #include <stdexcept> #include <gr_complex.h> /*! diff --git a/gnuradio-core/src/lib/filter/gr_single_pole_iir_filter_cc.h b/gnuradio-core/src/lib/filter/gr_single_pole_iir_filter_cc.h index 1f1073424..3ce468db2 100644 --- a/gnuradio-core/src/lib/filter/gr_single_pole_iir_filter_cc.h +++ b/gnuradio-core/src/lib/filter/gr_single_pole_iir_filter_cc.h @@ -23,6 +23,7 @@ #ifndef INCLUDED_GR_SINGLE_POLE_IIR_FILTER_CC_H #define INCLUDED_GR_SINGLE_POLE_IIR_FILTER_CC_H +#include <gr_core_api.h> #include <gr_sync_block.h> #include <gr_single_pole_iir.h> #include <gr_complex.h> @@ -31,7 +32,7 @@ class gr_single_pole_iir_filter_cc; typedef boost::shared_ptr<gr_single_pole_iir_filter_cc> gr_single_pole_iir_filter_cc_sptr; -gr_single_pole_iir_filter_cc_sptr +GR_CORE_API gr_single_pole_iir_filter_cc_sptr gr_make_single_pole_iir_filter_cc (double alpha, unsigned int vlen=1); /*! @@ -53,10 +54,10 @@ gr_make_single_pole_iir_filter_cc (double alpha, unsigned int vlen=1); * Note that some texts define the system function with a + in the denominator. * If you're using that convention, you'll need to negate the feedback tap. */ -class gr_single_pole_iir_filter_cc : public gr_sync_block +class GR_CORE_API gr_single_pole_iir_filter_cc : public gr_sync_block { private: - friend gr_single_pole_iir_filter_cc_sptr + friend GR_CORE_API gr_single_pole_iir_filter_cc_sptr gr_make_single_pole_iir_filter_cc (double alpha, unsigned int vlen); unsigned int d_vlen; diff --git a/gnuradio-core/src/lib/filter/gr_single_pole_iir_filter_ff.h b/gnuradio-core/src/lib/filter/gr_single_pole_iir_filter_ff.h index f676e94bc..d376587df 100644 --- a/gnuradio-core/src/lib/filter/gr_single_pole_iir_filter_ff.h +++ b/gnuradio-core/src/lib/filter/gr_single_pole_iir_filter_ff.h @@ -23,6 +23,7 @@ #ifndef INCLUDED_GR_SINGLE_POLE_IIR_FILTER_FF_H #define INCLUDED_GR_SINGLE_POLE_IIR_FILTER_FF_H +#include <gr_core_api.h> #include <gr_sync_block.h> #include <gr_single_pole_iir.h> #include <stdexcept> @@ -30,7 +31,7 @@ class gr_single_pole_iir_filter_ff; typedef boost::shared_ptr<gr_single_pole_iir_filter_ff> gr_single_pole_iir_filter_ff_sptr; -gr_single_pole_iir_filter_ff_sptr +GR_CORE_API gr_single_pole_iir_filter_ff_sptr gr_make_single_pole_iir_filter_ff (double alpha, unsigned int vlen=1); /*! @@ -52,10 +53,10 @@ gr_make_single_pole_iir_filter_ff (double alpha, unsigned int vlen=1); * Note that some texts define the system function with a + in the denominator. * If you're using that convention, you'll need to negate the feedback tap. */ -class gr_single_pole_iir_filter_ff : public gr_sync_block +class GR_CORE_API gr_single_pole_iir_filter_ff : public gr_sync_block { private: - friend gr_single_pole_iir_filter_ff_sptr + friend GR_CORE_API gr_single_pole_iir_filter_ff_sptr gr_make_single_pole_iir_filter_ff (double alpha, unsigned int vlen); unsigned int d_vlen; diff --git a/gnuradio-core/src/lib/filter/gri_fft_filter_ccc_generic.h b/gnuradio-core/src/lib/filter/gri_fft_filter_ccc_generic.h index 3cd9105c7..4db7ba50f 100644 --- a/gnuradio-core/src/lib/filter/gri_fft_filter_ccc_generic.h +++ b/gnuradio-core/src/lib/filter/gri_fft_filter_ccc_generic.h @@ -23,6 +23,7 @@ #ifndef INCLUDED_GRI_FFT_FILTER_CCC_GENERIC_H #define INCLUDED_GRI_FFT_FILTER_CCC_GENERIC_H +#include <gr_core_api.h> #include <gr_complex.h> #include <vector> @@ -32,7 +33,7 @@ class gri_fft_complex; * \brief Fast FFT filter with gr_complex input, gr_complex output and gr_complex taps * \ingroup filter_blk */ -class gri_fft_filter_ccc_generic +class GR_CORE_API gri_fft_filter_ccc_generic { private: int d_ntaps; diff --git a/gnuradio-core/src/lib/filter/gri_fft_filter_ccc_sse.h b/gnuradio-core/src/lib/filter/gri_fft_filter_ccc_sse.h index d1c54f01f..6c96152c0 100644 --- a/gnuradio-core/src/lib/filter/gri_fft_filter_ccc_sse.h +++ b/gnuradio-core/src/lib/filter/gri_fft_filter_ccc_sse.h @@ -23,6 +23,7 @@ #ifndef INCLUDED_GRI_FFT_FILTER_CCC_SSE_H #define INCLUDED_GRI_FFT_FILTER_CCC_SSE_H +#include <gr_core_api.h> #include <gr_complex.h> #include <vector> @@ -32,7 +33,7 @@ class gri_fft_complex; * \brief Fast FFT filter with gr_complex input, gr_complex output and gr_complex taps * \ingroup filter_blk */ -class gri_fft_filter_ccc_sse +class GR_CORE_API gri_fft_filter_ccc_sse { private: int d_ntaps; diff --git a/gnuradio-core/src/lib/filter/gri_fft_filter_fff_generic.h b/gnuradio-core/src/lib/filter/gri_fft_filter_fff_generic.h index 6c31632d5..86658043a 100644 --- a/gnuradio-core/src/lib/filter/gri_fft_filter_fff_generic.h +++ b/gnuradio-core/src/lib/filter/gri_fft_filter_fff_generic.h @@ -23,13 +23,14 @@ #ifndef INCLUDED_GRI_FFT_FILTER_FFF_GENERIC_H #define INCLUDED_GRI_FFT_FILTER_FFF_GENERIC_H +#include <gr_core_api.h> #include <gr_complex.h> #include <vector> class gri_fft_real_fwd; class gri_fft_real_rev; -class gri_fft_filter_fff_generic +class GR_CORE_API gri_fft_filter_fff_generic { private: int d_ntaps; diff --git a/gnuradio-core/src/lib/filter/gri_fft_filter_fff_sse.h b/gnuradio-core/src/lib/filter/gri_fft_filter_fff_sse.h index 8258bb824..bd87358e2 100644 --- a/gnuradio-core/src/lib/filter/gri_fft_filter_fff_sse.h +++ b/gnuradio-core/src/lib/filter/gri_fft_filter_fff_sse.h @@ -23,13 +23,14 @@ #ifndef INCLUDED_GRI_FFT_FILTER_FFF_SSE_H #define INCLUDED_GRI_FFT_FILTER_FFF_SSE_H +#include <gr_core_api.h> #include <gr_complex.h> #include <vector> class gri_fft_real_fwd; class gri_fft_real_rev; -class gri_fft_filter_fff_sse +class GR_CORE_API gri_fft_filter_fff_sse { private: int d_ntaps; diff --git a/gnuradio-core/src/lib/filter/gri_fir_filter_with_buffer_XXX.h.t b/gnuradio-core/src/lib/filter/gri_fir_filter_with_buffer_XXX.h.t index 23d64b65d..f209a8849 100644 --- a/gnuradio-core/src/lib/filter/gri_fir_filter_with_buffer_XXX.h.t +++ b/gnuradio-core/src/lib/filter/gri_fir_filter_with_buffer_XXX.h.t @@ -29,6 +29,7 @@ #ifndef @GUARD_NAME@ #define @GUARD_NAME@ +#include <gr_core_api.h> #include <vector> #include <gr_types.h> #include <gr_reverse.h> @@ -42,7 +43,7 @@ * */ -class @NAME@ { +class GR_CORE_API @NAME@ { protected: std::vector<@TAP_TYPE@> d_taps; // reversed taps diff --git a/gnuradio-core/src/lib/filter/gri_goertzel.cc b/gnuradio-core/src/lib/filter/gri_goertzel.cc index 85e66c069..73b8366ab 100644 --- a/gnuradio-core/src/lib/filter/gri_goertzel.cc +++ b/gnuradio-core/src/lib/filter/gri_goertzel.cc @@ -20,6 +20,9 @@ * Boston, MA 02110-1301, USA. */ +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif #include <cmath> #include <gri_goertzel.h> diff --git a/gnuradio-core/src/lib/filter/gri_goertzel.h b/gnuradio-core/src/lib/filter/gri_goertzel.h index e062f000e..6fb64b942 100644 --- a/gnuradio-core/src/lib/filter/gri_goertzel.h +++ b/gnuradio-core/src/lib/filter/gri_goertzel.h @@ -23,13 +23,14 @@ #ifndef INCLUDED_GRI_GOERTZEL_H #define INCLUDED_GRI_GOERTZEL_H +#include <gr_core_api.h> #include <gr_types.h> /*! * \brief Implements Goertzel single-bin DFT calculation * \ingroup misc */ -class gri_goertzel +class GR_CORE_API gri_goertzel { public: gri_goertzel() {} diff --git a/gnuradio-core/src/lib/filter/gri_iir.h b/gnuradio-core/src/lib/filter/gri_iir.h index 5bc67df53..ddd8f9b81 100644 --- a/gnuradio-core/src/lib/filter/gri_iir.h +++ b/gnuradio-core/src/lib/filter/gri_iir.h @@ -23,6 +23,7 @@ #ifndef INCLUDED_GRI_IIR_H #define INCLUDED_GRI_IIR_H +#include <gr_core_api.h> #include <vector> #include <stdexcept> diff --git a/gnuradio-core/src/lib/filter/gri_mmse_fir_interpolator.h b/gnuradio-core/src/lib/filter/gri_mmse_fir_interpolator.h index 616520ad6..b2832b3f6 100644 --- a/gnuradio-core/src/lib/filter/gri_mmse_fir_interpolator.h +++ b/gnuradio-core/src/lib/filter/gri_mmse_fir_interpolator.h @@ -22,6 +22,7 @@ #ifndef _GRI_MMSE_FIR_INTERPOLATOR_H_ #define _GRI_MMSE_FIR_INTERPOLATOR_H_ +#include <gr_core_api.h> #include <vector> class gr_fir_fff; @@ -39,7 +40,7 @@ class gr_fir_fff; * method to 32nd's of a sample. */ -class gri_mmse_fir_interpolator { +class GR_CORE_API gri_mmse_fir_interpolator { public: gri_mmse_fir_interpolator (); ~gri_mmse_fir_interpolator (); diff --git a/gnuradio-core/src/lib/filter/gri_mmse_fir_interpolator_cc.h b/gnuradio-core/src/lib/filter/gri_mmse_fir_interpolator_cc.h index daf8b19b8..2feef114b 100644 --- a/gnuradio-core/src/lib/filter/gri_mmse_fir_interpolator_cc.h +++ b/gnuradio-core/src/lib/filter/gri_mmse_fir_interpolator_cc.h @@ -22,6 +22,7 @@ #ifndef _GRI_MMSE_FIR_INTERPOLATOR_CC_H_ #define _GRI_MMSE_FIR_INTERPOLATOR_CC_H_ +#include <gr_core_api.h> #include <gr_complex.h> #include <vector> @@ -40,7 +41,7 @@ class gr_fir_ccf; * method to 32nd's of a sample. */ -class gri_mmse_fir_interpolator_cc { +class GR_CORE_API gri_mmse_fir_interpolator_cc { public: gri_mmse_fir_interpolator_cc (); ~gri_mmse_fir_interpolator_cc (); diff --git a/gnuradio-core/src/lib/filter/qa_filter.h b/gnuradio-core/src/lib/filter/qa_filter.h index a51a88238..a10782068 100644 --- a/gnuradio-core/src/lib/filter/qa_filter.h +++ b/gnuradio-core/src/lib/filter/qa_filter.h @@ -23,11 +23,12 @@ #ifndef _QA_FILTER_H_ #define _QA_FILTER_H_ +#include <gruel/attributes.h> #include <cppunit/TestSuite.h> //! collect all the tests for the gr directory -class qa_filter { +class __GR_ATTR_EXPORT qa_filter { public: //! return suite of tests for all of gr directory static CppUnit::TestSuite *suite (); diff --git a/gnuradio-core/src/lib/filter/qa_gri_mmse_fir_interpolator.cc b/gnuradio-core/src/lib/filter/qa_gri_mmse_fir_interpolator.cc index 63654a280..d158ff00d 100644 --- a/gnuradio-core/src/lib/filter/qa_gri_mmse_fir_interpolator.cc +++ b/gnuradio-core/src/lib/filter/qa_gri_mmse_fir_interpolator.cc @@ -20,6 +20,10 @@ * Boston, MA 02110-1301, USA. */ +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + #include <cppunit/TestAssert.h> #include <qa_gri_mmse_fir_interpolator.h> #include <gri_mmse_fir_interpolator.h> diff --git a/gnuradio-core/src/lib/general/CMakeLists.txt b/gnuradio-core/src/lib/general/CMakeLists.txt new file mode 100644 index 000000000..cb3f0da4b --- /dev/null +++ b/gnuradio-core/src/lib/general/CMakeLists.txt @@ -0,0 +1,300 @@ +# Copyright 2010-2011 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio 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 General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. + +######################################################################## +# This file included, use CMake directory variables +######################################################################## + +######################################################################## +# Handle the generated sine table +######################################################################## +ADD_CUSTOM_COMMAND( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/sine_table.h + DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/gen_sine_table.py + COMMAND ${PYTHON_EXECUTABLE} + ${CMAKE_CURRENT_SOURCE_DIR}/gen_sine_table.py > + ${CMAKE_CURRENT_BINARY_DIR}/sine_table.h +) + +INCLUDE(AddFileDependencies) +ADD_FILE_DEPENDENCIES(${CMAKE_CURRENT_SOURCE_DIR}/gr_fxpt.cc + ${CMAKE_CURRENT_BINARY_DIR}/sine_table.h +) + +######################################################################## +# Handle the generated constants +######################################################################## +EXECUTE_PROCESS(COMMAND ${PYTHON_EXECUTABLE} -c + "import time;print time.strftime('%a, %d %b %Y %H:%M:%S', time.gmtime())" + OUTPUT_VARIABLE BUILD_DATE OUTPUT_STRIP_TRAILING_WHITESPACE +) +MESSAGE(STATUS "Loading build date ${BUILD_DATE} into gr_constants...") + +MESSAGE(STATUS "Loading version ${VERSION} into gr_constants...") + +FILE(TO_NATIVE_PATH "${CMAKE_INSTALL_PREFIX}/${GR_CONF_DIR}" SYSCONFDIR) +FILE(TO_NATIVE_PATH "${CMAKE_INSTALL_PREFIX}/${GR_PKG_CONF_DIR}" GR_PREFSDIR) + +#double escape for windows backslash path separators +STRING(REPLACE "\\" "\\\\" prefix ${prefix}) +STRING(REPLACE "\\" "\\\\" SYSCONFDIR ${SYSCONFDIR}) +STRING(REPLACE "\\" "\\\\" GR_PREFSDIR ${GR_PREFSDIR}) + +CONFIGURE_FILE( + ${CMAKE_CURRENT_SOURCE_DIR}/gr_constants.cc.in + ${CMAKE_CURRENT_BINARY_DIR}/gr_constants.cc +@ONLY) + +LIST(APPEND gnuradio_core_sources ${CMAKE_CURRENT_BINARY_DIR}/gr_constants.cc) + +######################################################################## +# Append gnuradio-core library sources +######################################################################## +LIST(APPEND gnuradio_core_sources + ${CMAKE_CURRENT_SOURCE_DIR}/gr_circular_file.cc + ${CMAKE_CURRENT_SOURCE_DIR}/gr_count_bits.cc + ${CMAKE_CURRENT_SOURCE_DIR}/gr_fast_atan2f.cc + ${CMAKE_CURRENT_SOURCE_DIR}/gr_fft_vcc_fftw.cc + ${CMAKE_CURRENT_SOURCE_DIR}/gr_fxpt.cc + ${CMAKE_CURRENT_SOURCE_DIR}/gr_misc.cc + ${CMAKE_CURRENT_SOURCE_DIR}/gr_random.cc + ${CMAKE_CURRENT_SOURCE_DIR}/gr_reverse.cc + ${CMAKE_CURRENT_SOURCE_DIR}/gri_add_const_ss_generic.cc + ${CMAKE_CURRENT_SOURCE_DIR}/gri_char_to_float.cc + ${CMAKE_CURRENT_SOURCE_DIR}/gri_control_loop.cc + ${CMAKE_CURRENT_SOURCE_DIR}/gri_debugger_hook.cc + ${CMAKE_CURRENT_SOURCE_DIR}/gri_fft.cc + ${CMAKE_CURRENT_SOURCE_DIR}/gri_float_to_char.cc + ${CMAKE_CURRENT_SOURCE_DIR}/gri_float_to_short.cc + ${CMAKE_CURRENT_SOURCE_DIR}/gri_float_to_uchar.cc + ${CMAKE_CURRENT_SOURCE_DIR}/gri_glfsr.cc + ${CMAKE_CURRENT_SOURCE_DIR}/gri_interleaved_short_to_complex.cc + ${CMAKE_CURRENT_SOURCE_DIR}/gri_short_to_float.cc + ${CMAKE_CURRENT_SOURCE_DIR}/gri_uchar_to_float.cc + ${CMAKE_CURRENT_SOURCE_DIR}/malloc16.c +) + +######################################################################## +# Append gnuradio-core test sources +######################################################################## +LIST(APPEND test_gnuradio_core_sources + ${CMAKE_CURRENT_SOURCE_DIR}/qa_general.cc + ${CMAKE_CURRENT_SOURCE_DIR}/qa_gr_circular_file.cc + ${CMAKE_CURRENT_SOURCE_DIR}/qa_gr_cpm.cc + ${CMAKE_CURRENT_SOURCE_DIR}/qa_gr_firdes.cc + ${CMAKE_CURRENT_SOURCE_DIR}/qa_gr_fxpt.cc + ${CMAKE_CURRENT_SOURCE_DIR}/qa_gr_fxpt_nco.cc + ${CMAKE_CURRENT_SOURCE_DIR}/qa_gr_fxpt_vco.cc + ${CMAKE_CURRENT_SOURCE_DIR}/qa_gr_math.cc + ${CMAKE_CURRENT_SOURCE_DIR}/qa_gri_lfsr.cc +) + +######################################################################## +# Install runtime headers +######################################################################## +INSTALL(FILES + ${CMAKE_CURRENT_SOURCE_DIR}/gr_core_api.h + ${CMAKE_CURRENT_SOURCE_DIR}/gr_circular_file.h + ${CMAKE_CURRENT_SOURCE_DIR}/gr_constants.h + ${CMAKE_CURRENT_SOURCE_DIR}/gr_count_bits.h + ${CMAKE_CURRENT_SOURCE_DIR}/gr_expj.h + ${CMAKE_CURRENT_SOURCE_DIR}/gr_fft_vcc_fftw.h + ${CMAKE_CURRENT_SOURCE_DIR}/gr_fxpt.h + ${CMAKE_CURRENT_SOURCE_DIR}/gr_fxpt_nco.h + ${CMAKE_CURRENT_SOURCE_DIR}/gr_fxpt_vco.h + ${CMAKE_CURRENT_SOURCE_DIR}/gr_log2_const.h + ${CMAKE_CURRENT_SOURCE_DIR}/gr_math.h + ${CMAKE_CURRENT_SOURCE_DIR}/gr_misc.h + ${CMAKE_CURRENT_SOURCE_DIR}/gr_nco.h + ${CMAKE_CURRENT_SOURCE_DIR}/gr_random.h + ${CMAKE_CURRENT_SOURCE_DIR}/gr_reverse.h + ${CMAKE_CURRENT_SOURCE_DIR}/gr_simple_framer_sync.h + ${CMAKE_CURRENT_SOURCE_DIR}/gr_test_types.h + ${CMAKE_CURRENT_SOURCE_DIR}/gr_vco.h + ${CMAKE_CURRENT_SOURCE_DIR}/gri_add_const_ss.h + ${CMAKE_CURRENT_SOURCE_DIR}/gri_agc_cc.h + ${CMAKE_CURRENT_SOURCE_DIR}/gri_agc_ff.h + ${CMAKE_CURRENT_SOURCE_DIR}/gri_agc2_cc.h + ${CMAKE_CURRENT_SOURCE_DIR}/gri_agc2_ff.h + ${CMAKE_CURRENT_SOURCE_DIR}/gri_char_to_float.h + ${CMAKE_CURRENT_SOURCE_DIR}/gri_control_loop.h + ${CMAKE_CURRENT_SOURCE_DIR}/gri_debugger_hook.h + ${CMAKE_CURRENT_SOURCE_DIR}/gri_fft.h + ${CMAKE_CURRENT_SOURCE_DIR}/gri_float_to_char.h + ${CMAKE_CURRENT_SOURCE_DIR}/gri_float_to_short.h + ${CMAKE_CURRENT_SOURCE_DIR}/gri_float_to_uchar.h + ${CMAKE_CURRENT_SOURCE_DIR}/gri_lfsr.h + ${CMAKE_CURRENT_SOURCE_DIR}/gri_glfsr.h + ${CMAKE_CURRENT_SOURCE_DIR}/gri_interleaved_short_to_complex.h + ${CMAKE_CURRENT_SOURCE_DIR}/gri_lfsr_15_1_0.h + ${CMAKE_CURRENT_SOURCE_DIR}/gri_lfsr_32k.h + ${CMAKE_CURRENT_SOURCE_DIR}/gri_short_to_float.h + ${CMAKE_CURRENT_SOURCE_DIR}/gri_uchar_to_float.h + ${CMAKE_CURRENT_SOURCE_DIR}/malloc16.h + ${CMAKE_CURRENT_SOURCE_DIR}/random.h + DESTINATION ${GR_INCLUDE_DIR}/gnuradio + COMPONENT "core_devel" +) + +######################################################################## +# Install swig headers +######################################################################## +IF(ENABLE_PYTHON) +INSTALL(FILES + ${CMAKE_CURRENT_SOURCE_DIR}/general.i + ${CMAKE_CURRENT_SOURCE_DIR}/gr_constants.i + ${CMAKE_CURRENT_SOURCE_DIR}/gri_agc_cc.i + ${CMAKE_CURRENT_SOURCE_DIR}/gri_agc_ff.i + ${CMAKE_CURRENT_SOURCE_DIR}/gri_agc2_cc.i + ${CMAKE_CURRENT_SOURCE_DIR}/gri_agc2_ff.i + ${CMAKE_CURRENT_SOURCE_DIR}/gri_control_loop.i + DESTINATION ${GR_INCLUDE_DIR}/gnuradio/swig + COMPONENT "core_swig" +) +ENDIF(ENABLE_PYTHON) + +######################################################################## +# Handle triple-threat files that have cc, h, and i +######################################################################## +SET(gr_core_general_triple_threats + complex_vec_test + gr_additive_scrambler_bb + gr_agc_cc + gr_agc_ff + gr_agc2_cc + gr_agc2_ff + gr_align_on_samplenumbers_ss + gr_bin_statistics_f + gr_bytes_to_syms + gr_char_to_float + gr_check_counting_s + gr_check_lfsr_32k_s + gr_complex_to_interleaved_short + gr_complex_to_xxx + gr_conjugate_cc + gr_copy + gr_cpfsk_bc + gr_cpm + gr_ctcss_squelch_ff + gr_decode_ccsds_27_fb + gr_diff_decoder_bb + gr_diff_encoder_bb + gr_diff_phasor_cc + gr_dpll_bb + gr_deinterleave + gr_delay + gr_encode_ccsds_27_bb + gr_fake_channel_coder_pp + gr_feedforward_agc_cc + gr_feval + gr_fft_vcc + gr_fft_vfc + gr_firdes + gr_float_to_char + gr_float_to_complex + gr_float_to_short + gr_float_to_uchar + gr_fmdet_cf + gr_frequency_modulator_fc + gr_framer_sink_1 + gr_glfsr_source_b + gr_glfsr_source_f + gr_head + gr_int_to_float + gr_interleave + gr_interleaved_short_to_complex + gr_iqcomp_cc + gr_keep_one_in_n + gr_kludge_copy + gr_lfsr_32k_source_s + gr_map_bb + gr_nlog10_ff + gr_nop + gr_null_sink + gr_null_source + gr_ofdm_frame_acquisition + gr_ofdm_cyclic_prefixer + gr_ofdm_demapper_vcb + gr_ofdm_mapper_bcv + gr_ofdm_frame_sink + #gr_ofdm_frame_sink2 #cannot build yet... + gr_ofdm_insert_preamble + gr_ofdm_sampler + gr_pa_2x2_phase_combiner + gr_packet_sink + gr_peak_detector2_fb + gr_phase_modulator_fc + gr_pll_carriertracking_cc + gr_pll_freqdet_cf + gr_pll_refout_cc + gr_pn_correlator_cc + gr_prefs + gr_probe_avg_mag_sqrd_c + gr_probe_avg_mag_sqrd_cf + gr_probe_avg_mag_sqrd_f + gr_probe_signal_f + gr_pwr_squelch_cc + gr_pwr_squelch_ff + gr_quadrature_demod_cf + gr_rail_ff + gr_regenerate_bb + gr_remez + gr_rms_cf + gr_rms_ff + gr_repeat + gr_short_to_float + gr_simple_correlator + gr_simple_framer + gr_simple_squelch_cc + gr_skiphead + gr_squash_ff + gr_squelch_base_cc + gr_squelch_base_ff + gr_stream_mux + gr_stream_to_streams + gr_stream_to_vector + gr_streams_to_stream + gr_streams_to_vector + gr_stretch_ff + gr_test + gr_threshold_ff + gr_throttle + gr_uchar_to_float + gr_vco_f + gr_vector_to_stream + gr_vector_to_streams + gr_unpack_k_bits_bb + gr_wavelet_ff + gr_wvps_ff + gr_descrambler_bb + gr_scrambler_bb + gr_probe_mpsk_snr_c + gr_probe_density_b + gr_annotator_alltoall + gr_annotator_1to1 + gr_burst_tagger +) + +FOREACH(file_tt ${gr_core_general_triple_threats}) + LIST(APPEND gnuradio_core_sources ${CMAKE_CURRENT_SOURCE_DIR}/${file_tt}.cc) + INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${file_tt}.h DESTINATION ${GR_INCLUDE_DIR}/gnuradio COMPONENT "core_devel") + IF(ENABLE_PYTHON) + INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${file_tt}.i DESTINATION ${GR_INCLUDE_DIR}/gnuradio/swig COMPONENT "core_swig") + ENDIF(ENABLE_PYTHON) +ENDFOREACH(file_tt ${gr_core_general_triple_threats}) diff --git a/gnuradio-core/src/lib/general/complex_vec_test.h b/gnuradio-core/src/lib/general/complex_vec_test.h index d13dedf63..be4de41fb 100644 --- a/gnuradio-core/src/lib/general/complex_vec_test.h +++ b/gnuradio-core/src/lib/general/complex_vec_test.h @@ -1,27 +1,28 @@ +#include <gr_core_api.h> #include <vector> #include <complex> -std::vector<std::complex<float> > +GR_CORE_API std::vector<std::complex<float> > complex_vec_test0(); -std::vector<std::complex<float> > +GR_CORE_API std::vector<std::complex<float> > complex_vec_test1(const std::vector<std::complex<float> > &input); -std::complex<float> +GR_CORE_API std::complex<float> complex_scalar_test0(); -std::complex<float> +GR_CORE_API std::complex<float> complex_scalar_test1(std::complex<float> input); -std::vector<int> +GR_CORE_API std::vector<int> int_vec_test0(); -std::vector<int> +GR_CORE_API std::vector<int> int_vec_test1(const std::vector<int> &input); -std::vector<float> +GR_CORE_API std::vector<float> float_vec_test0(); -std::vector<float> +GR_CORE_API std::vector<float> float_vec_test1(const std::vector<float> &input); diff --git a/gnuradio-core/src/lib/general/gr_additive_scrambler_bb.h b/gnuradio-core/src/lib/general/gr_additive_scrambler_bb.h index 6c9493050..4c7c8f87e 100644 --- a/gnuradio-core/src/lib/general/gr_additive_scrambler_bb.h +++ b/gnuradio-core/src/lib/general/gr_additive_scrambler_bb.h @@ -22,13 +22,14 @@ #ifndef INCLUDED_GR_ADDITIVE_SCRAMBLER_BB_H #define INCLUDED_GR_ADDITIVE_SCRAMBLER_BB_H +#include <gr_core_api.h> #include <gr_sync_block.h> #include "gri_lfsr.h" class gr_additive_scrambler_bb; typedef boost::shared_ptr<gr_additive_scrambler_bb> gr_additive_scrambler_bb_sptr; -gr_additive_scrambler_bb_sptr gr_make_additive_scrambler_bb(int mask, int seed, int len, int count=0); +GR_CORE_API gr_additive_scrambler_bb_sptr gr_make_additive_scrambler_bb(int mask, int seed, int len, int count=0); /*! * Scramble an input stream using an LFSR. This block works on the LSB only @@ -48,9 +49,9 @@ gr_additive_scrambler_bb_sptr gr_make_additive_scrambler_bb(int mask, int seed, * \ingroup coding_blk */ -class gr_additive_scrambler_bb : public gr_sync_block +class GR_CORE_API gr_additive_scrambler_bb : public gr_sync_block { - friend gr_additive_scrambler_bb_sptr gr_make_additive_scrambler_bb(int mask, int seed, int len, int count); + friend GR_CORE_API gr_additive_scrambler_bb_sptr gr_make_additive_scrambler_bb(int mask, int seed, int len, int count); gri_lfsr d_lfsr; int d_count; diff --git a/gnuradio-core/src/lib/general/gr_agc2_cc.h b/gnuradio-core/src/lib/general/gr_agc2_cc.h index 0eb20afb9..6127c3aa7 100644 --- a/gnuradio-core/src/lib/general/gr_agc2_cc.h +++ b/gnuradio-core/src/lib/general/gr_agc2_cc.h @@ -23,13 +23,14 @@ #ifndef INCLUDED_GR_AGC2_CC_H #define INCLUDED_GR_AGC2_CC_H +#include <gr_core_api.h> #include <gr_sync_block.h> #include <gri_agc2_cc.h> class gr_agc2_cc; typedef boost::shared_ptr<gr_agc2_cc> gr_agc2_cc_sptr; -gr_agc2_cc_sptr +GR_CORE_API gr_agc2_cc_sptr gr_make_agc2_cc (float attack_rate = 1e-1, float decay_rate = 1e-2, float reference = 1.0, float gain = 1.0, float max_gain = 0.0); /*! @@ -39,9 +40,9 @@ gr_make_agc2_cc (float attack_rate = 1e-1, float decay_rate = 1e-2, float refere * For Power the absolute value of the complex number is used. */ -class gr_agc2_cc : public gr_sync_block, public gri_agc2_cc +class GR_CORE_API gr_agc2_cc : public gr_sync_block, public gri_agc2_cc { - friend gr_agc2_cc_sptr gr_make_agc2_cc (float attack_rate, float decay_rate, float reference, + friend GR_CORE_API gr_agc2_cc_sptr gr_make_agc2_cc (float attack_rate, float decay_rate, float reference, float gain, float max_gain); gr_agc2_cc (float attack_rate, float decay_rate, float reference, float gain, float max_gain); diff --git a/gnuradio-core/src/lib/general/gr_agc2_ff.h b/gnuradio-core/src/lib/general/gr_agc2_ff.h index ef470765f..269d940d4 100644 --- a/gnuradio-core/src/lib/general/gr_agc2_ff.h +++ b/gnuradio-core/src/lib/general/gr_agc2_ff.h @@ -23,12 +23,13 @@ #ifndef INCLUDED_GR_AGC2_FF_H #define INCLUDED_GR_AGC2_FF_H +#include <gr_core_api.h> #include <gr_sync_block.h> #include <gri_agc2_ff.h> class gr_agc2_ff; typedef boost::shared_ptr<gr_agc2_ff> gr_agc2_ff_sptr; -gr_agc2_ff_sptr +GR_CORE_API gr_agc2_ff_sptr gr_make_agc2_ff (float attack_rate = 1e-1, float decay_rate = 1e-2, float reference = 1.0, float gain = 1.0, float max_gain = 0.0); /*! @@ -38,9 +39,9 @@ gr_make_agc2_ff (float attack_rate = 1e-1, float decay_rate = 1e-2, float refere * Power is approximated by absolute value */ -class gr_agc2_ff : public gr_sync_block, public gri_agc2_ff +class GR_CORE_API gr_agc2_ff : public gr_sync_block, public gri_agc2_ff { - friend gr_agc2_ff_sptr gr_make_agc2_ff (float attack_rate, float decay_rate, + friend GR_CORE_API gr_agc2_ff_sptr gr_make_agc2_ff (float attack_rate, float decay_rate, float reference, float gain, float max_gain); gr_agc2_ff (float attack_rate, float decay_rate, float reference, float gain, float max_gain); diff --git a/gnuradio-core/src/lib/general/gr_agc_cc.h b/gnuradio-core/src/lib/general/gr_agc_cc.h index 43a5de6c7..f348fff91 100644 --- a/gnuradio-core/src/lib/general/gr_agc_cc.h +++ b/gnuradio-core/src/lib/general/gr_agc_cc.h @@ -23,12 +23,13 @@ #ifndef INCLUDED_GR_AGC_CC_H #define INCLUDED_GR_AGC_CC_H +#include <gr_core_api.h> #include <gr_sync_block.h> #include <gri_agc_cc.h> class gr_agc_cc; typedef boost::shared_ptr<gr_agc_cc> gr_agc_cc_sptr; -gr_agc_cc_sptr +GR_CORE_API gr_agc_cc_sptr gr_make_agc_cc (float rate = 1e-4, float reference = 1.0, float gain = 1.0, float max_gain = 0.0); /*! @@ -38,9 +39,9 @@ gr_make_agc_cc (float rate = 1e-4, float reference = 1.0, * For Power the absolute value of the complex number is used. */ -class gr_agc_cc : public gr_sync_block, public gri_agc_cc +class GR_CORE_API gr_agc_cc : public gr_sync_block, public gri_agc_cc { - friend gr_agc_cc_sptr gr_make_agc_cc (float rate, float reference, + friend GR_CORE_API gr_agc_cc_sptr gr_make_agc_cc (float rate, float reference, float gain, float max_gain); gr_agc_cc (float rate, float reference, float gain, float max_gain); diff --git a/gnuradio-core/src/lib/general/gr_agc_ff.h b/gnuradio-core/src/lib/general/gr_agc_ff.h index 7cb167fca..94db9eef5 100644 --- a/gnuradio-core/src/lib/general/gr_agc_ff.h +++ b/gnuradio-core/src/lib/general/gr_agc_ff.h @@ -23,12 +23,13 @@ #ifndef INCLUDED_GR_AGC_FF_H #define INCLUDED_GR_AGC_FF_H +#include <gr_core_api.h> #include <gr_sync_block.h> #include <gri_agc_ff.h> class gr_agc_ff; typedef boost::shared_ptr<gr_agc_ff> gr_agc_ff_sptr; -gr_agc_ff_sptr +GR_CORE_API gr_agc_ff_sptr gr_make_agc_ff (float rate = 1e-4, float reference = 1.0, float gain = 1.0, float max_gain = 0.0); @@ -39,9 +40,9 @@ gr_make_agc_ff (float rate = 1e-4, float reference = 1.0, * Power is approximated by absolute value */ -class gr_agc_ff : public gr_sync_block, public gri_agc_ff +class GR_CORE_API gr_agc_ff : public gr_sync_block, public gri_agc_ff { - friend gr_agc_ff_sptr gr_make_agc_ff (float rate, float reference, + friend GR_CORE_API gr_agc_ff_sptr gr_make_agc_ff (float rate, float reference, float gain, float max_gain); gr_agc_ff (float rate, float reference, float gain, float max_gain); diff --git a/gnuradio-core/src/lib/general/gr_align_on_samplenumbers_ss.h b/gnuradio-core/src/lib/general/gr_align_on_samplenumbers_ss.h index 5038e168b..61f70ee96 100644 --- a/gnuradio-core/src/lib/general/gr_align_on_samplenumbers_ss.h +++ b/gnuradio-core/src/lib/general/gr_align_on_samplenumbers_ss.h @@ -23,6 +23,7 @@ #ifndef INCLUDED_GR_ALIGN_ON_SAMPLE_NUMBERS_SS_H #define INCLUDED_GR_ALIGN_ON_SAMPLE_NUMBERS_SS_H +#include <gr_core_api.h> #include <gr_block.h> /*! @@ -45,19 +46,19 @@ class gr_align_on_samplenumbers_ss; typedef boost::shared_ptr<gr_align_on_samplenumbers_ss> gr_align_on_samplenumbers_ss_sptr; -gr_align_on_samplenumbers_ss_sptr gr_make_align_on_samplenumbers_ss (int nchan=2, int align_interval=128); +GR_CORE_API gr_align_on_samplenumbers_ss_sptr gr_make_align_on_samplenumbers_ss (int nchan=2, int align_interval=128); -class gr_align_on_samplenumbers_ss : public gr_block +class GR_CORE_API gr_align_on_samplenumbers_ss : public gr_block { int d_align_interval; int d_sample_counter; int d_nchan; bool d_in_presync; unsigned int d_ninputs; - class align_state { + class GR_CORE_API align_state { public: unsigned int ucounter_end; unsigned int ucounter_begin; @@ -72,7 +73,7 @@ class gr_align_on_samplenumbers_ss : public gr_block }; std::vector<align_state> d_state; - friend gr_align_on_samplenumbers_ss_sptr gr_make_align_on_samplenumbers_ss (int nchan,int align_interval); + friend GR_CORE_API gr_align_on_samplenumbers_ss_sptr gr_make_align_on_samplenumbers_ss (int nchan,int align_interval); gr_align_on_samplenumbers_ss (int nchan,int align_interval); public: diff --git a/gnuradio-core/src/lib/general/gr_annotator_1to1.h b/gnuradio-core/src/lib/general/gr_annotator_1to1.h index 4abc5b051..d866407fe 100644 --- a/gnuradio-core/src/lib/general/gr_annotator_1to1.h +++ b/gnuradio-core/src/lib/general/gr_annotator_1to1.h @@ -23,13 +23,14 @@ #ifndef INCLUDED_GR_ANNOTATOR_1TO1_H #define INCLUDED_GR_ANNOTATOR_1TO1_H +#include <gr_core_api.h> #include <gr_sync_block.h> class gr_annotator_1to1; typedef boost::shared_ptr<gr_annotator_1to1> gr_annotator_1to1_sptr; // public constructor -gr_annotator_1to1_sptr +GR_CORE_API gr_annotator_1to1_sptr gr_make_annotator_1to1 (int when, size_t sizeof_stream_item); /*! @@ -45,7 +46,7 @@ gr_make_annotator_1to1 (int when, size_t sizeof_stream_item); * * This block is only meant for testing and showing how to use the tags. */ -class gr_annotator_1to1 : public gr_sync_block +class GR_CORE_API gr_annotator_1to1 : public gr_sync_block { public: ~gr_annotator_1to1 (); @@ -67,7 +68,7 @@ protected: uint64_t d_tag_counter; std::vector<pmt::pmt_t> d_stored_tags; - friend gr_annotator_1to1_sptr + friend GR_CORE_API gr_annotator_1to1_sptr gr_make_annotator_1to1 (int when, size_t sizeof_stream_item); }; diff --git a/gnuradio-core/src/lib/general/gr_annotator_alltoall.h b/gnuradio-core/src/lib/general/gr_annotator_alltoall.h index e1e51ebf3..259b2e54c 100644 --- a/gnuradio-core/src/lib/general/gr_annotator_alltoall.h +++ b/gnuradio-core/src/lib/general/gr_annotator_alltoall.h @@ -23,13 +23,14 @@ #ifndef INCLUDED_GR_ANNOTATOR_ALLTOALL_H #define INCLUDED_GR_ANNOTATOR_ALLTOALL_H +#include <gr_core_api.h> #include <gr_sync_block.h> class gr_annotator_alltoall; typedef boost::shared_ptr<gr_annotator_alltoall> gr_annotator_alltoall_sptr; // public constructor -gr_annotator_alltoall_sptr +GR_CORE_API gr_annotator_alltoall_sptr gr_make_annotator_alltoall (int when, size_t sizeof_stream_item); /*! @@ -45,7 +46,7 @@ gr_make_annotator_alltoall (int when, size_t sizeof_stream_item); * * This block is only meant for testing and showing how to use the tags. */ -class gr_annotator_alltoall : public gr_sync_block +class GR_CORE_API gr_annotator_alltoall : public gr_sync_block { public: ~gr_annotator_alltoall (); @@ -68,7 +69,7 @@ protected: uint64_t d_tag_counter; std::vector<pmt::pmt_t> d_stored_tags; - friend gr_annotator_alltoall_sptr + friend GR_CORE_API gr_annotator_alltoall_sptr gr_make_annotator_alltoall (int when, size_t sizeof_stream_item); }; diff --git a/gnuradio-core/src/lib/general/gr_bin_statistics_f.h b/gnuradio-core/src/lib/general/gr_bin_statistics_f.h index d8c4c2fae..f7eea7d5f 100644 --- a/gnuradio-core/src/lib/general/gr_bin_statistics_f.h +++ b/gnuradio-core/src/lib/general/gr_bin_statistics_f.h @@ -24,6 +24,7 @@ #define INCLUDED_GR_BIN_STATISTICS_F_H +#include <gr_core_api.h> #include <gr_sync_block.h> #include <gr_feval.h> #include <gr_message.h> @@ -33,7 +34,7 @@ class gr_bin_statistics_f; typedef boost::shared_ptr<gr_bin_statistics_f> gr_bin_statistics_f_sptr; -gr_bin_statistics_f_sptr +GR_CORE_API gr_bin_statistics_f_sptr gr_make_bin_statistics_f(unsigned int vlen, // vector length gr_msg_queue_sptr msgq, gr_feval_dd *tune, // callback @@ -44,9 +45,9 @@ gr_make_bin_statistics_f(unsigned int vlen, // vector length * \brief control scanning and record frequency domain statistics * \ingroup sink_blk */ -class gr_bin_statistics_f : public gr_sync_block +class GR_CORE_API gr_bin_statistics_f : public gr_sync_block { - friend gr_bin_statistics_f_sptr + friend GR_CORE_API gr_bin_statistics_f_sptr gr_make_bin_statistics_f(unsigned int vlen, // vector length gr_msg_queue_sptr msgq, gr_feval_dd *tune, // callback diff --git a/gnuradio-core/src/lib/general/gr_burst_tagger.h b/gnuradio-core/src/lib/general/gr_burst_tagger.h index 8f814bea0..7547ba9cc 100644 --- a/gnuradio-core/src/lib/general/gr_burst_tagger.h +++ b/gnuradio-core/src/lib/general/gr_burst_tagger.h @@ -23,26 +23,27 @@ #ifndef INCLUDED_GR_BURST_TAGGER_H #define INCLUDED_GR_BURST_TAGGER_H +#include <gr_core_api.h> #include <gr_sync_block.h> class gr_burst_tagger; typedef boost::shared_ptr<gr_burst_tagger> gr_burst_tagger_sptr; -gr_burst_tagger_sptr gr_make_burst_tagger(size_t itemsize); +GR_CORE_API gr_burst_tagger_sptr gr_make_burst_tagger(size_t itemsize); /*! * \brief output[i] = input[i] * \ingroup misc_blk * */ -class gr_burst_tagger : public gr_sync_block +class GR_CORE_API gr_burst_tagger : public gr_sync_block { size_t d_itemsize; bool d_state; pmt::pmt_t d_key; pmt::pmt_t d_id; - friend gr_burst_tagger_sptr gr_make_burst_tagger(size_t itemsize); + friend GR_CORE_API gr_burst_tagger_sptr gr_make_burst_tagger(size_t itemsize); gr_burst_tagger(size_t itemsize); public: diff --git a/gnuradio-core/src/lib/general/gr_bytes_to_syms.h b/gnuradio-core/src/lib/general/gr_bytes_to_syms.h index 1531de02a..33b98d4fd 100644 --- a/gnuradio-core/src/lib/general/gr_bytes_to_syms.h +++ b/gnuradio-core/src/lib/general/gr_bytes_to_syms.h @@ -22,12 +22,13 @@ #ifndef INCLUDED_GR_BYTES_TO_SYMS_H #define INCLUDED_GR_BYTES_TO_SYMS_H +#include <gr_core_api.h> #include <gr_sync_interpolator.h> class gr_bytes_to_syms; typedef boost::shared_ptr<gr_bytes_to_syms> gr_bytes_to_syms_sptr; -gr_bytes_to_syms_sptr gr_make_bytes_to_syms (); +GR_CORE_API gr_bytes_to_syms_sptr gr_make_bytes_to_syms (); /*! * \brief Convert stream of bytes to stream of +/- 1 symbols @@ -45,9 +46,9 @@ gr_bytes_to_syms_sptr gr_make_bytes_to_syms (); * \sa gr_packed_to_unpacked_bb, gr_unpacked_to_packed_bb, * \sa gr_chunks_to_symbols_bf, gr_chunks_to_symbols_bc. */ -class gr_bytes_to_syms : public gr_sync_interpolator +class GR_CORE_API gr_bytes_to_syms : public gr_sync_interpolator { - friend gr_bytes_to_syms_sptr gr_make_bytes_to_syms (); + friend GR_CORE_API gr_bytes_to_syms_sptr gr_make_bytes_to_syms (); gr_bytes_to_syms (); diff --git a/gnuradio-core/src/lib/general/gr_char_to_float.h b/gnuradio-core/src/lib/general/gr_char_to_float.h index 482e479d6..b20d2066f 100644 --- a/gnuradio-core/src/lib/general/gr_char_to_float.h +++ b/gnuradio-core/src/lib/general/gr_char_to_float.h @@ -23,12 +23,13 @@ #ifndef INCLUDED_GR_CHAR_TO_FLOAT_H #define INCLUDED_GR_CHAR_TO_FLOAT_H +#include <gr_core_api.h> #include <gr_sync_block.h> class gr_char_to_float; typedef boost::shared_ptr<gr_char_to_float> gr_char_to_float_sptr; -gr_char_to_float_sptr +GR_CORE_API gr_char_to_float_sptr gr_make_char_to_float (); /*! @@ -36,9 +37,9 @@ gr_make_char_to_float (); * \ingroup converter_blk */ -class gr_char_to_float : public gr_sync_block +class GR_CORE_API gr_char_to_float : public gr_sync_block { - friend gr_char_to_float_sptr gr_make_char_to_float (); + friend GR_CORE_API gr_char_to_float_sptr gr_make_char_to_float (); gr_char_to_float (); public: diff --git a/gnuradio-core/src/lib/general/gr_check_counting_s.h b/gnuradio-core/src/lib/general/gr_check_counting_s.h index da35ab8e2..cd4dcb24e 100644 --- a/gnuradio-core/src/lib/general/gr_check_counting_s.h +++ b/gnuradio-core/src/lib/general/gr_check_counting_s.h @@ -22,12 +22,13 @@ #ifndef INCLUDED_GR_CHECK_COUNTING_S_H #define INCLUDED_GR_CHECK_COUNTING_S_H +#include <gr_core_api.h> #include <gr_sync_block.h> class gr_check_counting_s; typedef boost::shared_ptr<gr_check_counting_s> gr_check_counting_s_sptr; -gr_check_counting_s_sptr gr_make_check_counting_s (bool do_32bit=false); +GR_CORE_API gr_check_counting_s_sptr gr_make_check_counting_s (bool do_32bit=false); /*! * \brief sink that checks if its input stream consists of a counting sequence. @@ -36,9 +37,9 @@ gr_check_counting_s_sptr gr_make_check_counting_s (bool do_32bit=false); * * This sink is typically used to test the USRP "Counting Mode" or "Counting mode 32 bit". */ -class gr_check_counting_s : public gr_sync_block +class GR_CORE_API gr_check_counting_s : public gr_sync_block { - friend gr_check_counting_s_sptr gr_make_check_counting_s (bool do_32bit); + friend GR_CORE_API gr_check_counting_s_sptr gr_make_check_counting_s (bool do_32bit); enum state { SEARCHING, // searching for synchronization diff --git a/gnuradio-core/src/lib/general/gr_check_lfsr_32k_s.h b/gnuradio-core/src/lib/general/gr_check_lfsr_32k_s.h index e2bff46d2..939675db8 100644 --- a/gnuradio-core/src/lib/general/gr_check_lfsr_32k_s.h +++ b/gnuradio-core/src/lib/general/gr_check_lfsr_32k_s.h @@ -22,6 +22,7 @@ #ifndef INCLUDED_GR_CHECK_LFSR_32K_S_H #define INCLUDED_GR_CHECK_LFSR_32K_S_H +#include <gr_core_api.h> #include <gr_sync_block.h> #include <gri_lfsr_32k.h> @@ -29,7 +30,7 @@ class gr_check_lfsr_32k_s; typedef boost::shared_ptr<gr_check_lfsr_32k_s> gr_check_lfsr_32k_s_sptr; -gr_check_lfsr_32k_s_sptr gr_make_check_lfsr_32k_s (); +GR_CORE_API gr_check_lfsr_32k_s_sptr gr_make_check_lfsr_32k_s (); /*! * \brief sink that checks if its input stream consists of a lfsr_32k sequence. @@ -38,9 +39,9 @@ gr_check_lfsr_32k_s_sptr gr_make_check_lfsr_32k_s (); * This sink is typically used along with gr_lfsr_32k_source_s to test * the USRP using its digital loopback mode. */ -class gr_check_lfsr_32k_s : public gr_sync_block +class GR_CORE_API gr_check_lfsr_32k_s : public gr_sync_block { - friend gr_check_lfsr_32k_s_sptr gr_make_check_lfsr_32k_s (); + friend GR_CORE_API gr_check_lfsr_32k_s_sptr gr_make_check_lfsr_32k_s (); enum state { SEARCHING, // searching for synchronization diff --git a/gnuradio-core/src/lib/general/gr_circular_file.cc b/gnuradio-core/src/lib/general/gr_circular_file.cc index c9222597a..4d88b9d99 100644 --- a/gnuradio-core/src/lib/general/gr_circular_file.cc +++ b/gnuradio-core/src/lib/general/gr_circular_file.cc @@ -42,6 +42,10 @@ #include <stdio.h> #include <string.h> +#ifdef HAVE_IO_H +#include <io.h> +#endif + static const int HEADER_SIZE = 4096; static const int HEADER_MAGIC = 0xEB021026; diff --git a/gnuradio-core/src/lib/general/gr_circular_file.h b/gnuradio-core/src/lib/general/gr_circular_file.h index 70f4b4b11..3d3f33a8d 100644 --- a/gnuradio-core/src/lib/general/gr_circular_file.h +++ b/gnuradio-core/src/lib/general/gr_circular_file.h @@ -23,6 +23,8 @@ #ifndef _GR_CIRCULAR_FILE_H_ #define _GR_CIRCULAR_FILE_H_ +#include <gr_core_api.h> + /* * writes input data into a circular buffer on disk. * @@ -35,7 +37,7 @@ * current start of data * */ -class gr_circular_file { +class GR_CORE_API gr_circular_file { int d_fd; int *d_header; unsigned char *d_buffer; @@ -55,4 +57,4 @@ public: void reset_read_pointer (); }; -#endif /* _GR_CIRCULAR_FILE_H_ */ +#endif /* _GR_CIRCULAR_FILE_H_ */
\ No newline at end of file diff --git a/gnuradio-core/src/lib/general/gr_complex_to_interleaved_short.h b/gnuradio-core/src/lib/general/gr_complex_to_interleaved_short.h index 0a91eddd6..a3e2d38ad 100644 --- a/gnuradio-core/src/lib/general/gr_complex_to_interleaved_short.h +++ b/gnuradio-core/src/lib/general/gr_complex_to_interleaved_short.h @@ -23,13 +23,14 @@ #ifndef INCLUDED_GR_COMPLEX_TO_INTERLEAVED_SHORT_H #define INCLUDED_GR_COMPLEX_TO_INTERLEAVED_SHORT_H +#include <gr_core_api.h> #include <gr_sync_interpolator.h> class gr_complex_to_interleaved_short; typedef boost::shared_ptr<gr_complex_to_interleaved_short> gr_complex_to_interleaved_short_sptr; -gr_complex_to_interleaved_short_sptr +GR_CORE_API gr_complex_to_interleaved_short_sptr gr_make_complex_to_interleaved_short (); /*! @@ -37,9 +38,9 @@ gr_make_complex_to_interleaved_short (); * \ingroup converter_blk */ -class gr_complex_to_interleaved_short : public gr_sync_interpolator +class GR_CORE_API gr_complex_to_interleaved_short : public gr_sync_interpolator { - friend gr_complex_to_interleaved_short_sptr gr_make_complex_to_interleaved_short (); + friend GR_CORE_API gr_complex_to_interleaved_short_sptr gr_make_complex_to_interleaved_short (); gr_complex_to_interleaved_short (); public: diff --git a/gnuradio-core/src/lib/general/gr_complex_to_xxx.h b/gnuradio-core/src/lib/general/gr_complex_to_xxx.h index 1851c67d9..166403259 100644 --- a/gnuradio-core/src/lib/general/gr_complex_to_xxx.h +++ b/gnuradio-core/src/lib/general/gr_complex_to_xxx.h @@ -23,6 +23,7 @@ #ifndef INCLUDED_GR_COMPLEX_TO_XXX_H #define INCLUDED_GR_COMPLEX_TO_XXX_H +#include <gr_core_api.h> #include <gr_sync_block.h> #include <gr_complex.h> @@ -40,21 +41,21 @@ typedef boost::shared_ptr<gr_complex_to_mag> gr_complex_to_mag_sptr; typedef boost::shared_ptr<gr_complex_to_mag_squared> gr_complex_to_mag_squared_sptr; typedef boost::shared_ptr<gr_complex_to_arg> gr_complex_to_arg_sptr; -gr_complex_to_float_sptr gr_make_complex_to_float (unsigned int vlen=1); -gr_complex_to_real_sptr gr_make_complex_to_real (unsigned int vlen=1); -gr_complex_to_imag_sptr gr_make_complex_to_imag (unsigned int vlen=1); -gr_complex_to_mag_sptr gr_make_complex_to_mag (unsigned int vlen=1); -gr_complex_to_mag_squared_sptr gr_make_complex_to_mag_squared (unsigned int vlen=1); -gr_complex_to_arg_sptr gr_make_complex_to_arg (unsigned int vlen=1); +GR_CORE_API gr_complex_to_float_sptr gr_make_complex_to_float (unsigned int vlen=1); +GR_CORE_API gr_complex_to_real_sptr gr_make_complex_to_real (unsigned int vlen=1); +GR_CORE_API gr_complex_to_imag_sptr gr_make_complex_to_imag (unsigned int vlen=1); +GR_CORE_API gr_complex_to_mag_sptr gr_make_complex_to_mag (unsigned int vlen=1); +GR_CORE_API gr_complex_to_mag_squared_sptr gr_make_complex_to_mag_squared (unsigned int vlen=1); +GR_CORE_API gr_complex_to_arg_sptr gr_make_complex_to_arg (unsigned int vlen=1); /*! * \brief convert a stream of gr_complex to 1 or 2 streams of float * \ingroup converter_blk * \param vlen vector len (default 1) */ -class gr_complex_to_float : public gr_sync_block +class GR_CORE_API gr_complex_to_float : public gr_sync_block { - friend gr_complex_to_float_sptr gr_make_complex_to_float (unsigned int vlen); + friend GR_CORE_API gr_complex_to_float_sptr gr_make_complex_to_float (unsigned int vlen); gr_complex_to_float (unsigned int vlen); unsigned int d_vlen; @@ -70,9 +71,9 @@ class gr_complex_to_float : public gr_sync_block * \ingroup converter_blk * \param vlen vector len (default 1) */ -class gr_complex_to_real : public gr_sync_block +class GR_CORE_API gr_complex_to_real : public gr_sync_block { - friend gr_complex_to_real_sptr gr_make_complex_to_real (unsigned int vlen); + friend GR_CORE_API gr_complex_to_real_sptr gr_make_complex_to_real (unsigned int vlen); gr_complex_to_real (unsigned int vlen); unsigned int d_vlen; @@ -88,9 +89,9 @@ class gr_complex_to_real : public gr_sync_block * \ingroup converter_blk * \param vlen vector len (default 1) */ -class gr_complex_to_imag : public gr_sync_block +class GR_CORE_API gr_complex_to_imag : public gr_sync_block { - friend gr_complex_to_imag_sptr gr_make_complex_to_imag (unsigned int vlen); + friend GR_CORE_API gr_complex_to_imag_sptr gr_make_complex_to_imag (unsigned int vlen); gr_complex_to_imag (unsigned int vlen); unsigned int d_vlen; @@ -106,9 +107,9 @@ class gr_complex_to_imag : public gr_sync_block * \ingroup converter_blk * \param vlen vector len (default 1) */ -class gr_complex_to_mag : public gr_sync_block +class GR_CORE_API gr_complex_to_mag : public gr_sync_block { - friend gr_complex_to_mag_sptr gr_make_complex_to_mag (unsigned int vlen); + friend GR_CORE_API gr_complex_to_mag_sptr gr_make_complex_to_mag (unsigned int vlen); gr_complex_to_mag (unsigned int vlen); unsigned int d_vlen; @@ -124,9 +125,9 @@ class gr_complex_to_mag : public gr_sync_block * \ingroup converter_blk * \param vlen vector len (default 1) */ -class gr_complex_to_mag_squared : public gr_sync_block +class GR_CORE_API gr_complex_to_mag_squared : public gr_sync_block { - friend gr_complex_to_mag_squared_sptr gr_make_complex_to_mag_squared (unsigned int vlen); + friend GR_CORE_API gr_complex_to_mag_squared_sptr gr_make_complex_to_mag_squared (unsigned int vlen); gr_complex_to_mag_squared (unsigned int vlen); unsigned int d_vlen; @@ -142,9 +143,9 @@ class gr_complex_to_mag_squared : public gr_sync_block * \ingroup converter_blk * \param vlen vector len (default 1) */ -class gr_complex_to_arg : public gr_sync_block +class GR_CORE_API gr_complex_to_arg : public gr_sync_block { - friend gr_complex_to_arg_sptr gr_make_complex_to_arg (unsigned int vlen); + friend GR_CORE_API gr_complex_to_arg_sptr gr_make_complex_to_arg (unsigned int vlen); gr_complex_to_arg (unsigned int vlen); unsigned int d_vlen; diff --git a/gnuradio-core/src/lib/general/gr_conjugate_cc.h b/gnuradio-core/src/lib/general/gr_conjugate_cc.h index 783019adb..16e76e153 100644 --- a/gnuradio-core/src/lib/general/gr_conjugate_cc.h +++ b/gnuradio-core/src/lib/general/gr_conjugate_cc.h @@ -25,20 +25,21 @@ #ifndef INCLUDED_GR_CONJUGATE_CC_H #define INCLUDED_GR_CONJUGATE_CC_H +#include <gr_core_api.h> #include <gr_sync_block.h> class gr_conjugate_cc; typedef boost::shared_ptr<gr_conjugate_cc> gr_conjugate_cc_sptr; -gr_conjugate_cc_sptr gr_make_conjugate_cc (); +GR_CORE_API gr_conjugate_cc_sptr gr_make_conjugate_cc (); /*! * \brief output = complex conjugate of input * \ingroup math_blk */ -class gr_conjugate_cc : public gr_sync_block +class GR_CORE_API gr_conjugate_cc : public gr_sync_block { - friend gr_conjugate_cc_sptr gr_make_conjugate_cc (); + friend GR_CORE_API gr_conjugate_cc_sptr gr_make_conjugate_cc (); gr_conjugate_cc (); diff --git a/gnuradio-core/src/lib/general/gr_constants.h b/gnuradio-core/src/lib/general/gr_constants.h index 449d41c17..3d21fe1d6 100644 --- a/gnuradio-core/src/lib/general/gr_constants.h +++ b/gnuradio-core/src/lib/general/gr_constants.h @@ -22,31 +22,32 @@ #ifndef INCLUDED_GR_CONSTANTS_H #define INCLUDED_GR_CONSTANTS_H +#include <gr_core_api.h> #include <string> /*! * \brief return ./configure --prefix argument. Typically /usr/local */ -const std::string gr_prefix(); +GR_CORE_API const std::string gr_prefix(); /*! * \brief return ./configure --sysconfdir argument. Typically $prefix/etc or /etc */ -const std::string gr_sysconfdir(); +GR_CORE_API const std::string gr_sysconfdir(); /*! * \brief return preferences file directory. Typically $sysconfdir/etc/conf.d */ -const std::string gr_prefsdir(); +GR_CORE_API const std::string gr_prefsdir(); /*! * \brief return date/time of build, as set when 'bootstrap' is run */ -const std::string gr_build_date(); +GR_CORE_API const std::string gr_build_date(); /*! * \brief return version string defined in configure.ac */ -const std::string gr_version(); +GR_CORE_API const std::string gr_version(); #endif /* INCLUDED_GR_CONSTANTS_H */ diff --git a/gnuradio-core/src/lib/general/gr_constellation_decoder_cb.h b/gnuradio-core/src/lib/general/gr_constellation_decoder_cb.h new file mode 100644 index 000000000..d1d29847c --- /dev/null +++ b/gnuradio-core/src/lib/general/gr_constellation_decoder_cb.h @@ -0,0 +1,66 @@ +/* -*- c++ -*- */ +/* + * Copyright 2006 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio 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 General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifndef INCLUDED_GR_CONSTELLATION_DECODER_CB_H +#define INCLUDED_GR_CONSTELLATION_DECODER_CB_H + +#include <gr_core_api.h> +#include <gr_sync_block.h> +#include <vector> + +class gr_constellation_decoder_cb; +typedef boost::shared_ptr<gr_constellation_decoder_cb> gr_constellation_decoder_cb_sptr; + +GR_CORE_API gr_constellation_decoder_cb_sptr + gr_make_constellation_decoder_cb (const std::vector<gr_complex> &sym_position, + const std::vector<unsigned char> &sym_value_out); + +/*! + * \brief Constellation Decoder + * \ingroup coding_blk + * + */ +class GR_CORE_API gr_constellation_decoder_cb : public gr_sync_block +{ + + private: + std::vector<gr_complex> d_sym_position; + std::vector<unsigned char> d_sym_value_out; + + friend GR_CORE_API gr_constellation_decoder_cb_sptr + gr_make_constellation_decoder_cb (const std::vector<gr_complex> &sym_position, const std::vector<unsigned char> &sym_value_out); + + gr_constellation_decoder_cb (const std::vector<gr_complex> &sym_position, + const std::vector<unsigned char> &sym_value_out); //constructor + + public: + bool set_constellation(const std::vector<gr_complex> &sym_position, + const std::vector<unsigned char> &sym_value_out); + + ~gr_constellation_decoder_cb(); //destructor + + int work (int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items); +}; + +#endif diff --git a/gnuradio-core/src/lib/general/gr_copy.h b/gnuradio-core/src/lib/general/gr_copy.h index d99aef8b7..7fb13bf68 100644 --- a/gnuradio-core/src/lib/general/gr_copy.h +++ b/gnuradio-core/src/lib/general/gr_copy.h @@ -23,12 +23,13 @@ #ifndef INCLUDED_GR_COPY_H #define INCLUDED_GR_COPY_H +#include <gr_core_api.h> #include <gr_block.h> class gr_copy; typedef boost::shared_ptr<gr_copy> gr_copy_sptr; -gr_copy_sptr gr_make_copy(size_t itemsize); +GR_CORE_API gr_copy_sptr gr_make_copy(size_t itemsize); /*! * \brief output[i] = input[i] @@ -38,12 +39,12 @@ gr_copy_sptr gr_make_copy(size_t itemsize); * When disabled, this block drops its input on the floor. * */ -class gr_copy : public gr_block +class GR_CORE_API gr_copy : public gr_block { size_t d_itemsize; bool d_enabled; - friend gr_copy_sptr gr_make_copy(size_t itemsize); + friend GR_CORE_API gr_copy_sptr gr_make_copy(size_t itemsize); gr_copy(size_t itemsize); public: diff --git a/gnuradio-core/src/lib/general/gr_core_api.h b/gnuradio-core/src/lib/general/gr_core_api.h new file mode 100644 index 000000000..74c802857 --- /dev/null +++ b/gnuradio-core/src/lib/general/gr_core_api.h @@ -0,0 +1,33 @@ +/* + * Copyright 2010-2011 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio 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 General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifndef INCLUDED_GR_CORE_API_H +#define INCLUDED_GR_CORE_API_H + +#include <gruel/attributes.h> + +#ifdef gnuradio_core_EXPORTS +# define GR_CORE_API __GR_ATTR_EXPORT +#else +# define GR_CORE_API __GR_ATTR_IMPORT +#endif + +#endif /* INCLUDED_GR_CORE_API_H */ diff --git a/gnuradio-core/src/lib/general/gr_costas_loop_cc.h b/gnuradio-core/src/lib/general/gr_costas_loop_cc.h new file mode 100644 index 000000000..13b33d96c --- /dev/null +++ b/gnuradio-core/src/lib/general/gr_costas_loop_cc.h @@ -0,0 +1,146 @@ +/* -*- c++ -*- */ +/* + * Copyright 2006 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio 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 General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + + +#ifndef INCLUDED_GR_COSTAS_LOOP_CC_H +#define INCLUDED_GR_COSTAS_LOOP_CC_H + +#include <gr_core_api.h> +#include <gr_sync_block.h> +#include <stdexcept> +#include <fstream> + + +/*! \brief A Costas loop carrier recovery module. + * \ingroup sync_blk + * + * The Costas loop locks to the center frequency of a signal and + * downconverts it to baseband. The second (order=2) order loop is + * used for BPSK where the real part of the output signal is the + * baseband BPSK signal and the imaginary part is the error + * signal. When order=4, it can be used for quadrature modulations + * where both I and Q (real and imaginary) are outputted. + * + * More details can be found online: + * + * J. Feigin, "Practical Costas loop design: Designing a simple and inexpensive + * BPSK Costas loop carrier recovery circuit," RF signal processing, pp. 20-36, + * 2002. + * + * http://rfdesign.com/images/archive/0102Feigin20.pdf + * + * \param alpha the loop gain used for phase adjustment + * \param beta the loop gain for frequency adjustments + * \param max_freq the maximum frequency deviation (radians/sample) the loop can handle + * \param min_freq the minimum frequency deviation (radians/sample) the loop can handle + * \param order the loop order, either 2 or 4 + */ +class gr_costas_loop_cc; +typedef boost::shared_ptr<gr_costas_loop_cc> gr_costas_loop_cc_sptr; + + +GR_CORE_API gr_costas_loop_cc_sptr +gr_make_costas_loop_cc (float alpha, float beta, + float max_freq, float min_freq, + int order + ) throw (std::invalid_argument); + + +/*! + * \brief Carrier tracking PLL for QPSK + * \ingroup sync_blk + * input: complex; output: complex + * <br>The Costas loop can have two output streams: + * stream 1 is the baseband I and Q; + * stream 2 is the normalized frequency of the loop + * + * \p order must be 2 or 4. + */ +class GR_CORE_API gr_costas_loop_cc : public gr_sync_block +{ + friend GR_CORE_API gr_costas_loop_cc_sptr gr_make_costas_loop_cc (float alpha, float beta, + float max_freq, float min_freq, + int order + ) throw (std::invalid_argument); + + float d_alpha, d_beta, d_max_freq, d_min_freq, d_phase, d_freq; + int d_order; + + gr_costas_loop_cc (float alpha, float beta, + float max_freq, float min_freq, + int order + ) throw (std::invalid_argument); + + /*! \brief the phase detector circuit for 8th-order PSK loops + * \param sample complex sample + * \return the phase error + */ + float phase_detector_8(gr_complex sample) const; // for 8PSK + + /*! \brief the phase detector circuit for fourth-order loops + * \param sample complex sample + * \return the phase error + */ + float phase_detector_4(gr_complex sample) const; // for QPSK + + /*! \brief the phase detector circuit for second-order loops + * \param sample a complex sample + * \return the phase error + */ + float phase_detector_2(gr_complex sample) const; // for BPSK + + + float (gr_costas_loop_cc::*d_phase_detector)(gr_complex sample) const; + +public: + + /*! \brief set the first order gain + * \param alpha + */ + void set_alpha(float alpha); + + /*! \brief get the first order gain + * + */ + float alpha() const { return d_alpha; } + + /*! \brief set the second order gain + * \param beta + */ + void set_beta(float beta); + + /*! \brief get the second order gain + * + */ + float beta() const { return d_beta; } + + int work (int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items); + + /*! \brief returns the current NCO frequency in radians/sample + * + */ + float freq() const { return d_freq; } +}; + +#endif diff --git a/gnuradio-core/src/lib/general/gr_count_bits.h b/gnuradio-core/src/lib/general/gr_count_bits.h index a8b52d3ac..f0cec2a11 100644 --- a/gnuradio-core/src/lib/general/gr_count_bits.h +++ b/gnuradio-core/src/lib/general/gr_count_bits.h @@ -23,9 +23,11 @@ #ifndef _GR_COUNT_BITS_H_ #define _GR_COUNT_BITS_H_ -unsigned int gr_count_bits8(unsigned int x); // return number of set bits in the low 8 bits of x -unsigned int gr_count_bits16(unsigned int x); // return number of set bits in the low 16 bits of x -unsigned int gr_count_bits32(unsigned int x); // return number of set bits in the low 32 bits of x -unsigned int gr_count_bits64(unsigned long long int x); +#include <gr_core_api.h> + +GR_CORE_API unsigned int gr_count_bits8(unsigned int x); // return number of set bits in the low 8 bits of x +GR_CORE_API unsigned int gr_count_bits16(unsigned int x); // return number of set bits in the low 16 bits of x +GR_CORE_API unsigned int gr_count_bits32(unsigned int x); // return number of set bits in the low 32 bits of x +GR_CORE_API unsigned int gr_count_bits64(unsigned long long int x); #endif /* _GR_COUNT_BITS_H_ */ diff --git a/gnuradio-core/src/lib/general/gr_cpfsk_bc.h b/gnuradio-core/src/lib/general/gr_cpfsk_bc.h index 29bcfed65..4afba4fb4 100644 --- a/gnuradio-core/src/lib/general/gr_cpfsk_bc.h +++ b/gnuradio-core/src/lib/general/gr_cpfsk_bc.h @@ -20,13 +20,14 @@ #ifndef INCLUDED_GR_CPFSK_BC_H #define INCLUDED_GR_CPFSK_BC_H +#include <gr_core_api.h> #include <gr_sync_interpolator.h> class gr_cpfsk_bc; typedef boost::shared_ptr<gr_cpfsk_bc> gr_cpfsk_bc_sptr; -gr_cpfsk_bc_sptr gr_make_cpfsk_bc(float k, float ampl, int samples_per_sym); +GR_CORE_API gr_cpfsk_bc_sptr gr_make_cpfsk_bc(float k, float ampl, int samples_per_sym); /*! * \brief Perform continuous phase 2-level frequency shift keying modulation @@ -38,10 +39,10 @@ gr_cpfsk_bc_sptr gr_make_cpfsk_bc(float k, float ampl, int samples_per_sym); * \param samples_per_sym number of output samples per input bit */ -class gr_cpfsk_bc : public gr_sync_interpolator +class GR_CORE_API gr_cpfsk_bc : public gr_sync_interpolator { private: - friend gr_cpfsk_bc_sptr gr_make_cpfsk_bc(float k, float ampl, int samples_per_sym); + friend GR_CORE_API gr_cpfsk_bc_sptr gr_make_cpfsk_bc(float k, float ampl, int samples_per_sym); gr_cpfsk_bc(float k, float ampl, int samples_per_sym); diff --git a/gnuradio-core/src/lib/general/gr_cpm.h b/gnuradio-core/src/lib/general/gr_cpm.h index cae6fe313..ef2ff8414 100644 --- a/gnuradio-core/src/lib/general/gr_cpm.h +++ b/gnuradio-core/src/lib/general/gr_cpm.h @@ -22,9 +22,10 @@ #ifndef INCLUDED_GR_CPM_H #define INCLUDED_GR_CPM_H +#include <gr_core_api.h> #include <vector> -class gr_cpm +class GR_CORE_API gr_cpm { public: enum cpm_type { diff --git a/gnuradio-core/src/lib/general/gr_ctcss_squelch_ff.h b/gnuradio-core/src/lib/general/gr_ctcss_squelch_ff.h index 49df785ff..664c40846 100644 --- a/gnuradio-core/src/lib/general/gr_ctcss_squelch_ff.h +++ b/gnuradio-core/src/lib/general/gr_ctcss_squelch_ff.h @@ -23,20 +23,21 @@ #ifndef INCLUDED_GR_CTCSS_SQUELCH_FF_H #define INCLUDED_GR_CTCSS_SQUELCH_FF_H +#include <gr_core_api.h> #include <gr_squelch_base_ff.h> #include <gri_goertzel.h> class gr_ctcss_squelch_ff; typedef boost::shared_ptr<gr_ctcss_squelch_ff> gr_ctcss_squelch_ff_sptr; -gr_ctcss_squelch_ff_sptr +GR_CORE_API gr_ctcss_squelch_ff_sptr gr_make_ctcss_squelch_ff(int rate, float freq, float level=0.01, int len=0, int ramp=0, bool gate=false); /*! * \brief gate or zero output if ctcss tone not present * \ingroup level_blk */ -class gr_ctcss_squelch_ff : public gr_squelch_base_ff +class GR_CORE_API gr_ctcss_squelch_ff : public gr_squelch_base_ff { private: float d_freq; @@ -48,7 +49,7 @@ private: gri_goertzel d_goertzel_c; gri_goertzel d_goertzel_r; - friend gr_ctcss_squelch_ff_sptr gr_make_ctcss_squelch_ff(int rate, float freq, float level, int len, int ramp, bool gate); + friend GR_CORE_API gr_ctcss_squelch_ff_sptr gr_make_ctcss_squelch_ff(int rate, float freq, float level, int len, int ramp, bool gate); gr_ctcss_squelch_ff(int rate, float freq, float level, int len, int ramp, bool gate); int find_tone(float freq); diff --git a/gnuradio-core/src/lib/general/gr_decode_ccsds_27_fb.h b/gnuradio-core/src/lib/general/gr_decode_ccsds_27_fb.h index 50a6c9d89..3db250101 100644 --- a/gnuradio-core/src/lib/general/gr_decode_ccsds_27_fb.h +++ b/gnuradio-core/src/lib/general/gr_decode_ccsds_27_fb.h @@ -20,17 +20,18 @@ #ifndef INCLUDED_GR_DECODE_CCSDS_27_FB_H #define INCLUDED_GR_DECODE_CCSDS_27_FB_H +#include <gr_core_api.h> #include <gr_sync_decimator.h> extern "C" { -#include "../viterbi/viterbi.h" +#include <viterbi.h> } class gr_decode_ccsds_27_fb; typedef boost::shared_ptr<gr_decode_ccsds_27_fb> gr_decode_ccsds_27_fb_sptr; -gr_decode_ccsds_27_fb_sptr gr_make_decode_ccsds_27_fb(); +GR_CORE_API gr_decode_ccsds_27_fb_sptr gr_make_decode_ccsds_27_fb(); /*! \brief A rate 1/2, k=7 convolutional decoder for the CCSDS standard * \ingroup ecc @@ -51,10 +52,10 @@ gr_decode_ccsds_27_fb_sptr gr_make_decode_ccsds_27_fb(); * from the corresponding inputs. */ -class gr_decode_ccsds_27_fb : public gr_sync_decimator +class GR_CORE_API gr_decode_ccsds_27_fb : public gr_sync_decimator { private: - friend gr_decode_ccsds_27_fb_sptr gr_make_decode_ccsds_27_fb(); + friend GR_CORE_API gr_decode_ccsds_27_fb_sptr gr_make_decode_ccsds_27_fb(); gr_decode_ccsds_27_fb(); diff --git a/gnuradio-core/src/lib/general/gr_deinterleave.h b/gnuradio-core/src/lib/general/gr_deinterleave.h index 59c310bdc..3dd913911 100644 --- a/gnuradio-core/src/lib/general/gr_deinterleave.h +++ b/gnuradio-core/src/lib/general/gr_deinterleave.h @@ -23,20 +23,21 @@ #ifndef INCLUDED_GR_DEINTERLEAVE_H #define INCLUDED_GR_DEINTERLEAVE_H +#include <gr_core_api.h> #include <gr_sync_decimator.h> class gr_deinterleave; typedef boost::shared_ptr<gr_deinterleave> gr_deinterleave_sptr; -gr_deinterleave_sptr gr_make_deinterleave (size_t itemsize); +GR_CORE_API gr_deinterleave_sptr gr_make_deinterleave (size_t itemsize); /*! * \brief deinterleave a single input into N outputs * \ingroup slicedice_blk */ -class gr_deinterleave : public gr_sync_decimator +class GR_CORE_API gr_deinterleave : public gr_sync_decimator { - friend gr_deinterleave_sptr gr_make_deinterleave (size_t itemsize); + friend GR_CORE_API gr_deinterleave_sptr gr_make_deinterleave (size_t itemsize); size_t d_itemsize; diff --git a/gnuradio-core/src/lib/general/gr_delay.h b/gnuradio-core/src/lib/general/gr_delay.h index d7e8252a2..14de9af1f 100644 --- a/gnuradio-core/src/lib/general/gr_delay.h +++ b/gnuradio-core/src/lib/general/gr_delay.h @@ -23,20 +23,21 @@ #ifndef INCLUDED_GR_DELAY_H #define INCLUDED_GR_DELAY_H +#include <gr_core_api.h> #include <gr_sync_block.h> class gr_delay; typedef boost::shared_ptr<gr_delay> gr_delay_sptr; -gr_delay_sptr gr_make_delay (size_t itemsize, int delay); +GR_CORE_API gr_delay_sptr gr_make_delay (size_t itemsize, int delay); /*! * \brief delay the input by a certain number of samples * \ingroup misc_blk */ -class gr_delay : public gr_sync_block +class GR_CORE_API gr_delay : public gr_sync_block { - friend gr_delay_sptr gr_make_delay (size_t itemsize, int delay); + friend GR_CORE_API gr_delay_sptr gr_make_delay (size_t itemsize, int delay); gr_delay (size_t itemsize, int delay); diff --git a/gnuradio-core/src/lib/general/gr_descrambler_bb.h b/gnuradio-core/src/lib/general/gr_descrambler_bb.h index 19787690c..d7a49b5f1 100644 --- a/gnuradio-core/src/lib/general/gr_descrambler_bb.h +++ b/gnuradio-core/src/lib/general/gr_descrambler_bb.h @@ -22,13 +22,14 @@ #ifndef INCLUDED_GR_DESCRAMBLER_BB_H #define INCLUDED_GR_DESCRAMBLER_BB_H +#include <gr_core_api.h> #include <gr_sync_block.h> #include "gri_lfsr.h" class gr_descrambler_bb; typedef boost::shared_ptr<gr_descrambler_bb> gr_descrambler_bb_sptr; -gr_descrambler_bb_sptr gr_make_descrambler_bb(int mask, int seed, int len); +GR_CORE_API gr_descrambler_bb_sptr gr_make_descrambler_bb(int mask, int seed, int len); /*! * Descramble an input stream using an LFSR. This block works on the LSB only @@ -42,9 +43,9 @@ gr_descrambler_bb_sptr gr_make_descrambler_bb(int mask, int seed, int len); * \ingroup coding_blk */ -class gr_descrambler_bb : public gr_sync_block +class GR_CORE_API gr_descrambler_bb : public gr_sync_block { - friend gr_descrambler_bb_sptr gr_make_descrambler_bb(int mask, int seed, int len); + friend GR_CORE_API gr_descrambler_bb_sptr gr_make_descrambler_bb(int mask, int seed, int len); gri_lfsr d_lfsr; diff --git a/gnuradio-core/src/lib/general/gr_diff_decoder_bb.h b/gnuradio-core/src/lib/general/gr_diff_decoder_bb.h index 6fd08ec4b..0337c3dbd 100644 --- a/gnuradio-core/src/lib/general/gr_diff_decoder_bb.h +++ b/gnuradio-core/src/lib/general/gr_diff_decoder_bb.h @@ -23,12 +23,13 @@ #ifndef INCLUDED_GR_DIFF_DECODER_BB_H #define INCLUDED_GR_DIFF_DECODER_BB_H +#include <gr_core_api.h> #include <gr_sync_block.h> class gr_diff_decoder_bb; typedef boost::shared_ptr<gr_diff_decoder_bb> gr_diff_decoder_bb_sptr; -gr_diff_decoder_bb_sptr gr_make_diff_decoder_bb (unsigned int modulus); +GR_CORE_API gr_diff_decoder_bb_sptr gr_make_diff_decoder_bb (unsigned int modulus); /*! * \brief y[0] = (x[0] - x[-1]) % M @@ -36,9 +37,9 @@ gr_diff_decoder_bb_sptr gr_make_diff_decoder_bb (unsigned int modulus); * * Differential decoder */ -class gr_diff_decoder_bb : public gr_sync_block +class GR_CORE_API gr_diff_decoder_bb : public gr_sync_block { - friend gr_diff_decoder_bb_sptr gr_make_diff_decoder_bb (unsigned int modulus); + friend GR_CORE_API gr_diff_decoder_bb_sptr gr_make_diff_decoder_bb (unsigned int modulus); gr_diff_decoder_bb(unsigned int modulus); unsigned int d_modulus; diff --git a/gnuradio-core/src/lib/general/gr_diff_encoder_bb.h b/gnuradio-core/src/lib/general/gr_diff_encoder_bb.h index 50aff73cf..c99e226da 100644 --- a/gnuradio-core/src/lib/general/gr_diff_encoder_bb.h +++ b/gnuradio-core/src/lib/general/gr_diff_encoder_bb.h @@ -23,12 +23,13 @@ #ifndef INCLUDED_GR_DIFF_ENCODER_BB_H #define INCLUDED_GR_DIFF_ENCODER_BB_H +#include <gr_core_api.h> #include <gr_sync_block.h> class gr_diff_encoder_bb; typedef boost::shared_ptr<gr_diff_encoder_bb> gr_diff_encoder_bb_sptr; -gr_diff_encoder_bb_sptr gr_make_diff_encoder_bb (unsigned int modulus); +GR_CORE_API gr_diff_encoder_bb_sptr gr_make_diff_encoder_bb (unsigned int modulus); /*! * \brief y[0] = (x[0] + y[-1]) % M @@ -36,9 +37,9 @@ gr_diff_encoder_bb_sptr gr_make_diff_encoder_bb (unsigned int modulus); * * Differential encoder */ -class gr_diff_encoder_bb : public gr_sync_block +class GR_CORE_API gr_diff_encoder_bb : public gr_sync_block { - friend gr_diff_encoder_bb_sptr gr_make_diff_encoder_bb (unsigned int modulus); + friend GR_CORE_API gr_diff_encoder_bb_sptr gr_make_diff_encoder_bb (unsigned int modulus); gr_diff_encoder_bb(unsigned int modulus); unsigned int d_last_out; diff --git a/gnuradio-core/src/lib/general/gr_diff_phasor_cc.h b/gnuradio-core/src/lib/general/gr_diff_phasor_cc.h index 1070ba183..8af2699a7 100644 --- a/gnuradio-core/src/lib/general/gr_diff_phasor_cc.h +++ b/gnuradio-core/src/lib/general/gr_diff_phasor_cc.h @@ -23,6 +23,7 @@ #ifndef INCLUDED_GR_DIFF_PHASOR_CC_H #define INCLUDED_GR_DIFF_PHASOR_CC_H +#include <gr_core_api.h> #include <gr_sync_block.h> /*! @@ -32,12 +33,12 @@ class gr_diff_phasor_cc; typedef boost::shared_ptr<gr_diff_phasor_cc> gr_diff_phasor_cc_sptr; -gr_diff_phasor_cc_sptr gr_make_diff_phasor_cc (); +GR_CORE_API gr_diff_phasor_cc_sptr gr_make_diff_phasor_cc (); -class gr_diff_phasor_cc : public gr_sync_block +class GR_CORE_API gr_diff_phasor_cc : public gr_sync_block { - friend gr_diff_phasor_cc_sptr gr_make_diff_phasor_cc (); + friend GR_CORE_API gr_diff_phasor_cc_sptr gr_make_diff_phasor_cc (); gr_diff_phasor_cc (); //constructor diff --git a/gnuradio-core/src/lib/general/gr_dpll_bb.h b/gnuradio-core/src/lib/general/gr_dpll_bb.h index e6b5fc0fa..8e748dddb 100644 --- a/gnuradio-core/src/lib/general/gr_dpll_bb.h +++ b/gnuradio-core/src/lib/general/gr_dpll_bb.h @@ -23,12 +23,13 @@ #ifndef INCLUDED_GR_DPLL_BB_H #define INCLUDED_GR_DPLL_BB_H +#include <gr_core_api.h> #include <gr_sync_block.h> class gr_dpll_bb; typedef boost::shared_ptr<gr_dpll_bb> gr_dpll_bb_sptr; -gr_dpll_bb_sptr gr_make_dpll_bb (float period, float gain); +GR_CORE_API gr_dpll_bb_sptr gr_make_dpll_bb (float period, float gain); /*! * \brief Detect the peak of a signal @@ -37,9 +38,9 @@ gr_dpll_bb_sptr gr_make_dpll_bb (float period, float gain); * If a peak is detected, this block outputs a 1, * or it outputs 0's. */ -class gr_dpll_bb : public gr_sync_block +class GR_CORE_API gr_dpll_bb : public gr_sync_block { - friend gr_dpll_bb_sptr gr_make_dpll_bb (float period, float gain); + friend GR_CORE_API gr_dpll_bb_sptr gr_make_dpll_bb (float period, float gain); gr_dpll_bb (float period, float gain); diff --git a/gnuradio-core/src/lib/general/gr_encode_ccsds_27_bb.h b/gnuradio-core/src/lib/general/gr_encode_ccsds_27_bb.h index 86832ee05..e24ae9151 100644 --- a/gnuradio-core/src/lib/general/gr_encode_ccsds_27_bb.h +++ b/gnuradio-core/src/lib/general/gr_encode_ccsds_27_bb.h @@ -20,13 +20,14 @@ #ifndef INCLUDED_GR_ENCODE_CCSDS_27_BB_H #define INCLUDED_GR_ENCODE_CCSDS_27_BB_H +#include <gr_core_api.h> #include <gr_sync_interpolator.h> class gr_encode_ccsds_27_bb; typedef boost::shared_ptr<gr_encode_ccsds_27_bb> gr_encode_ccsds_27_bb_sptr; -gr_encode_ccsds_27_bb_sptr gr_make_encode_ccsds_27_bb(); +GR_CORE_API gr_encode_ccsds_27_bb_sptr gr_make_encode_ccsds_27_bb(); /*! \brief A rate 1/2, k=7 convolutional encoder for the CCSDS standard * \ingroup ecc @@ -44,10 +45,10 @@ gr_encode_ccsds_27_bb_sptr gr_make_encode_ccsds_27_bb(); * There is no provision to "flush" the encoder. */ -class gr_encode_ccsds_27_bb : public gr_sync_interpolator +class GR_CORE_API gr_encode_ccsds_27_bb : public gr_sync_interpolator { private: - friend gr_encode_ccsds_27_bb_sptr gr_make_encode_ccsds_27_bb(); + friend GR_CORE_API gr_encode_ccsds_27_bb_sptr gr_make_encode_ccsds_27_bb(); gr_encode_ccsds_27_bb(); unsigned char d_encstate; diff --git a/gnuradio-core/src/lib/general/gr_expj.h b/gnuradio-core/src/lib/general/gr_expj.h index 7adf3a0c6..6f1d56eb3 100644 --- a/gnuradio-core/src/lib/general/gr_expj.h +++ b/gnuradio-core/src/lib/general/gr_expj.h @@ -22,6 +22,7 @@ #ifndef INCLUDED_GR_EXPJ_H #define INCLUDED_GR_EXPJ_H +#include <gr_core_api.h> #include <gr_sincos.h> #include <gr_types.h> diff --git a/gnuradio-core/src/lib/general/gr_fake_channel_coder_pp.h b/gnuradio-core/src/lib/general/gr_fake_channel_coder_pp.h index 480fb8e78..2560c6105 100644 --- a/gnuradio-core/src/lib/general/gr_fake_channel_coder_pp.h +++ b/gnuradio-core/src/lib/general/gr_fake_channel_coder_pp.h @@ -23,12 +23,13 @@ #ifndef INCLUDED_GR_FAKE_CHANNEL_CODER_PP_H #define INCLUDED_GR_FAKE_CHANNEL_CODER_PP_H +#include <gr_core_api.h> #include <gr_sync_block.h> class gr_fake_channel_encoder_pp; typedef boost::shared_ptr<gr_fake_channel_encoder_pp> gr_fake_channel_encoder_pp_sptr; -gr_fake_channel_encoder_pp_sptr +GR_CORE_API gr_fake_channel_encoder_pp_sptr gr_make_fake_channel_encoder_pp(int input_vlen, int output_vlen); /*! @@ -37,14 +38,14 @@ gr_make_fake_channel_encoder_pp(int input_vlen, int output_vlen); * * input: stream of byte vectors; output: stream of byte vectors */ -class gr_fake_channel_encoder_pp : public gr_sync_block +class GR_CORE_API gr_fake_channel_encoder_pp : public gr_sync_block { int d_input_vlen; int d_output_vlen; gr_fake_channel_encoder_pp(int input_vlen, int output_vlen); - friend gr_fake_channel_encoder_pp_sptr + friend GR_CORE_API gr_fake_channel_encoder_pp_sptr gr_make_fake_channel_encoder_pp(int input_vlen, int output_vlen); public: @@ -60,7 +61,7 @@ public: class gr_fake_channel_decoder_pp; typedef boost::shared_ptr<gr_fake_channel_decoder_pp> gr_fake_channel_decoder_pp_sptr; -gr_fake_channel_decoder_pp_sptr +GR_CORE_API gr_fake_channel_decoder_pp_sptr gr_make_fake_channel_decoder_pp(int input_vlen, int output_vlen); /*! @@ -69,14 +70,14 @@ gr_make_fake_channel_decoder_pp(int input_vlen, int output_vlen); * * input: stream of byte vectors; output: stream of byte vectors */ -class gr_fake_channel_decoder_pp : public gr_sync_block +class GR_CORE_API gr_fake_channel_decoder_pp : public gr_sync_block { int d_input_vlen; int d_output_vlen; gr_fake_channel_decoder_pp(int input_vlen, int output_vlen); - friend gr_fake_channel_decoder_pp_sptr + friend GR_CORE_API gr_fake_channel_decoder_pp_sptr gr_make_fake_channel_decoder_pp(int input_vlen, int output_vlen); public: diff --git a/gnuradio-core/src/lib/general/gr_feedforward_agc_cc.h b/gnuradio-core/src/lib/general/gr_feedforward_agc_cc.h index 8c600d3d1..a97dbd958 100644 --- a/gnuradio-core/src/lib/general/gr_feedforward_agc_cc.h +++ b/gnuradio-core/src/lib/general/gr_feedforward_agc_cc.h @@ -23,21 +23,22 @@ #ifndef INCLUDED_GR_FEEDFORWARD_AGC_CC_H #define INCLUDED_GR_FEEDFORWARD_AGC_CC_H +#include <gr_core_api.h> #include <gr_sync_block.h> class gr_feedforward_agc_cc; typedef boost::shared_ptr<gr_feedforward_agc_cc> gr_feedforward_agc_cc_sptr; -gr_feedforward_agc_cc_sptr +GR_CORE_API gr_feedforward_agc_cc_sptr gr_make_feedforward_agc_cc(int nsamples, float reference = 1.0); /*! * \brief Non-causal AGC which computes required gain based on max absolute value over nsamples * \ingroup level_blk */ -class gr_feedforward_agc_cc : public gr_sync_block +class GR_CORE_API gr_feedforward_agc_cc : public gr_sync_block { - friend gr_feedforward_agc_cc_sptr + friend GR_CORE_API gr_feedforward_agc_cc_sptr gr_make_feedforward_agc_cc(int nsamples, float reference); int d_nsamples; diff --git a/gnuradio-core/src/lib/general/gr_feval.h b/gnuradio-core/src/lib/general/gr_feval.h index cc4209af0..a0e448ebf 100644 --- a/gnuradio-core/src/lib/general/gr_feval.h +++ b/gnuradio-core/src/lib/general/gr_feval.h @@ -22,6 +22,7 @@ #ifndef INCLUDED_GR_FEVAL_H #define INCLUDED_GR_FEVAL_H +#include <gr_core_api.h> #include <gr_complex.h> /*! @@ -37,7 +38,7 @@ * Use calleval to invoke eval (this kludge is required to allow a * python specific "shim" to be inserted. */ -class gr_feval_dd +class GR_CORE_API gr_feval_dd { protected: /*! @@ -65,7 +66,7 @@ public: * Use calleval to invoke eval (this kludge is required to allow a * python specific "shim" to be inserted. */ -class gr_feval_cc +class GR_CORE_API gr_feval_cc { protected: /*! @@ -93,7 +94,7 @@ public: * Use calleval to invoke eval (this kludge is required to allow a * python specific "shim" to be inserted. */ -class gr_feval_ll +class GR_CORE_API gr_feval_ll { protected: /*! @@ -121,7 +122,7 @@ public: * Use calleval to invoke eval (this kludge is required to allow a * python specific "shim" to be inserted. */ -class gr_feval +class GR_CORE_API gr_feval { protected: /*! @@ -139,9 +140,9 @@ public: /*! * \brief trivial examples / test cases showing C++ calling Python code */ -double gr_feval_dd_example(gr_feval_dd *f, double x); -gr_complex gr_feval_cc_example(gr_feval_cc *f, gr_complex x); -long gr_feval_ll_example(gr_feval_ll *f, long x); -void gr_feval_example(gr_feval *f); +GR_CORE_API double gr_feval_dd_example(gr_feval_dd *f, double x); +GR_CORE_API gr_complex gr_feval_cc_example(gr_feval_cc *f, gr_complex x); +GR_CORE_API long gr_feval_ll_example(gr_feval_ll *f, long x); +GR_CORE_API void gr_feval_example(gr_feval *f); #endif /* INCLUDED_GR_FEVAL_H */ diff --git a/gnuradio-core/src/lib/general/gr_fft_vcc.h b/gnuradio-core/src/lib/general/gr_fft_vcc.h index 2ab9241ec..a7c8e1162 100644 --- a/gnuradio-core/src/lib/general/gr_fft_vcc.h +++ b/gnuradio-core/src/lib/general/gr_fft_vcc.h @@ -23,12 +23,13 @@ #ifndef INCLUDED_GR_FFT_VCC_H #define INCLUDED_GR_FFT_VCC_H +#include <gr_core_api.h> #include <gr_sync_block.h> class gr_fft_vcc; typedef boost::shared_ptr<gr_fft_vcc> gr_fft_vcc_sptr; -gr_fft_vcc_sptr +GR_CORE_API gr_fft_vcc_sptr gr_make_fft_vcc (int fft_size, bool forward, const std::vector<float> &window, bool shift=false); /*! @@ -37,10 +38,10 @@ gr_make_fft_vcc (int fft_size, bool forward, const std::vector<float> &window, b * * Abstract base class */ -class gr_fft_vcc : public gr_sync_block +class GR_CORE_API gr_fft_vcc : public gr_sync_block { protected: - friend gr_fft_vcc_sptr + friend GR_CORE_API gr_fft_vcc_sptr gr_make_fft_vcc (int fft_size, bool forward, const std::vector<float> &window, bool shift); unsigned int d_fft_size; diff --git a/gnuradio-core/src/lib/general/gr_fft_vcc_fftw.h b/gnuradio-core/src/lib/general/gr_fft_vcc_fftw.h index c026162ee..8535d133c 100644 --- a/gnuradio-core/src/lib/general/gr_fft_vcc_fftw.h +++ b/gnuradio-core/src/lib/general/gr_fft_vcc_fftw.h @@ -23,11 +23,12 @@ #ifndef INCLUDED_GR_FFT_VCC_FFTW_H #define INCLUDED_GR_FFT_VCC_FFTW_H +#include <gr_core_api.h> #include <gr_fft_vcc.h> class gri_fft_complex; -gr_fft_vcc_sptr +GR_CORE_API gr_fft_vcc_sptr gr_make_fft_vcc_fftw (int fft_size, bool forward, const std::vector<float> &window, bool shift=false); /*! @@ -36,9 +37,9 @@ gr_make_fft_vcc_fftw (int fft_size, bool forward, const std::vector<float> &wind * * Concrete class that uses FFTW. */ -class gr_fft_vcc_fftw : public gr_fft_vcc +class GR_CORE_API gr_fft_vcc_fftw : public gr_fft_vcc { - friend gr_fft_vcc_sptr + friend GR_CORE_API gr_fft_vcc_sptr gr_make_fft_vcc_fftw (int fft_size, bool forward, const std::vector<float> &window, bool shift); gri_fft_complex *d_fft; diff --git a/gnuradio-core/src/lib/general/gr_fft_vfc.h b/gnuradio-core/src/lib/general/gr_fft_vfc.h index 074574477..6cf6b9037 100644 --- a/gnuradio-core/src/lib/general/gr_fft_vfc.h +++ b/gnuradio-core/src/lib/general/gr_fft_vfc.h @@ -23,6 +23,7 @@ #ifndef INCLUDED_GR_FFT_VFC_H #define INCLUDED_GR_FFT_VFC_H +#include <gr_core_api.h> #include <gr_sync_block.h> class gri_fft_complex; @@ -30,7 +31,7 @@ class gri_fft_complex; class gr_fft_vfc; typedef boost::shared_ptr<gr_fft_vfc> gr_fft_vfc_sptr; -gr_fft_vfc_sptr +GR_CORE_API gr_fft_vfc_sptr gr_make_fft_vfc (int fft_size, bool forward, const std::vector<float> &window); /*! @@ -38,9 +39,9 @@ gr_make_fft_vfc (int fft_size, bool forward, const std::vector<float> &window); * \ingroup dft_blk */ -class gr_fft_vfc : public gr_sync_block +class GR_CORE_API gr_fft_vfc : public gr_sync_block { - friend gr_fft_vfc_sptr + friend GR_CORE_API gr_fft_vfc_sptr gr_make_fft_vfc (int fft_size, bool forward, const std::vector<float> &window); unsigned int d_fft_size; diff --git a/gnuradio-core/src/lib/general/gr_firdes.cc b/gnuradio-core/src/lib/general/gr_firdes.cc index 5d192d67e..13110d57d 100644 --- a/gnuradio-core/src/lib/general/gr_firdes.cc +++ b/gnuradio-core/src/lib/general/gr_firdes.cc @@ -20,6 +20,10 @@ * Boston, MA 02110-1301, USA. */ +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + #include <gr_firdes.h> #include <stdexcept> diff --git a/gnuradio-core/src/lib/general/gr_firdes.h b/gnuradio-core/src/lib/general/gr_firdes.h index de775bd07..83fa7e119 100644 --- a/gnuradio-core/src/lib/general/gr_firdes.h +++ b/gnuradio-core/src/lib/general/gr_firdes.h @@ -23,6 +23,7 @@ #ifndef _GR_FIRDES_H_ #define _GR_FIRDES_H_ +#include <gr_core_api.h> #include <vector> #include <cmath> #include <gr_complex.h> @@ -32,7 +33,7 @@ * \ingroup filter_design */ -class gr_firdes { +class GR_CORE_API gr_firdes { public: enum win_type { diff --git a/gnuradio-core/src/lib/general/gr_float_to_char.h b/gnuradio-core/src/lib/general/gr_float_to_char.h index e65072bf0..434e2e9d0 100644 --- a/gnuradio-core/src/lib/general/gr_float_to_char.h +++ b/gnuradio-core/src/lib/general/gr_float_to_char.h @@ -23,12 +23,13 @@ #ifndef INCLUDED_GR_FLOAT_TO_CHAR_H #define INCLUDED_GR_FLOAT_TO_CHAR_H +#include <gr_core_api.h> #include <gr_sync_block.h> class gr_float_to_char; typedef boost::shared_ptr<gr_float_to_char> gr_float_to_char_sptr; -gr_float_to_char_sptr +GR_CORE_API gr_float_to_char_sptr gr_make_float_to_char (); /*! @@ -36,9 +37,9 @@ gr_make_float_to_char (); * \ingroup converter_blk */ -class gr_float_to_char : public gr_sync_block +class GR_CORE_API gr_float_to_char : public gr_sync_block { - friend gr_float_to_char_sptr gr_make_float_to_char (); + friend GR_CORE_API gr_float_to_char_sptr gr_make_float_to_char (); gr_float_to_char (); public: diff --git a/gnuradio-core/src/lib/general/gr_float_to_complex.h b/gnuradio-core/src/lib/general/gr_float_to_complex.h index f6cc24852..596b595f3 100644 --- a/gnuradio-core/src/lib/general/gr_float_to_complex.h +++ b/gnuradio-core/src/lib/general/gr_float_to_complex.h @@ -23,13 +23,14 @@ #ifndef INCLUDED_GR_FLOAT_TO_COMPLEX_H #define INCLUDED_GR_FLOAT_TO_COMPLEX_H +#include <gr_core_api.h> #include <gr_sync_block.h> #include <gr_complex.h> class gr_float_to_complex; typedef boost::shared_ptr<gr_float_to_complex> gr_float_to_complex_sptr; -gr_float_to_complex_sptr +GR_CORE_API gr_float_to_complex_sptr gr_make_float_to_complex (size_t vlen = 1); /*! @@ -37,9 +38,9 @@ gr_make_float_to_complex (size_t vlen = 1); * \ingroup converter_blk */ -class gr_float_to_complex : public gr_sync_block +class GR_CORE_API gr_float_to_complex : public gr_sync_block { - friend gr_float_to_complex_sptr gr_make_float_to_complex (size_t vlen); + friend GR_CORE_API gr_float_to_complex_sptr gr_make_float_to_complex (size_t vlen); gr_float_to_complex (size_t vlen); size_t d_vlen; diff --git a/gnuradio-core/src/lib/general/gr_float_to_short.h b/gnuradio-core/src/lib/general/gr_float_to_short.h index e85343929..010d61141 100644 --- a/gnuradio-core/src/lib/general/gr_float_to_short.h +++ b/gnuradio-core/src/lib/general/gr_float_to_short.h @@ -23,12 +23,13 @@ #ifndef INCLUDED_GR_FLOAT_TO_SHORT_H #define INCLUDED_GR_FLOAT_TO_SHORT_H +#include <gr_core_api.h> #include <gr_sync_block.h> class gr_float_to_short; typedef boost::shared_ptr<gr_float_to_short> gr_float_to_short_sptr; -gr_float_to_short_sptr +GR_CORE_API gr_float_to_short_sptr gr_make_float_to_short (); /*! @@ -36,9 +37,9 @@ gr_make_float_to_short (); * \ingroup converter_blk */ -class gr_float_to_short : public gr_sync_block +class GR_CORE_API gr_float_to_short : public gr_sync_block { - friend gr_float_to_short_sptr gr_make_float_to_short (); + friend GR_CORE_API gr_float_to_short_sptr gr_make_float_to_short (); gr_float_to_short (); public: diff --git a/gnuradio-core/src/lib/general/gr_float_to_uchar.h b/gnuradio-core/src/lib/general/gr_float_to_uchar.h index 3bca9c555..fca8eb07b 100644 --- a/gnuradio-core/src/lib/general/gr_float_to_uchar.h +++ b/gnuradio-core/src/lib/general/gr_float_to_uchar.h @@ -23,12 +23,13 @@ #ifndef INCLUDED_GR_FLOAT_TO_UCHAR_H #define INCLUDED_GR_FLOAT_TO_UCHAR_H +#include <gr_core_api.h> #include <gr_sync_block.h> class gr_float_to_uchar; typedef boost::shared_ptr<gr_float_to_uchar> gr_float_to_uchar_sptr; -gr_float_to_uchar_sptr +GR_CORE_API gr_float_to_uchar_sptr gr_make_float_to_uchar (); /*! @@ -36,9 +37,9 @@ gr_make_float_to_uchar (); * \ingroup converter_blk */ -class gr_float_to_uchar : public gr_sync_block +class GR_CORE_API gr_float_to_uchar : public gr_sync_block { - friend gr_float_to_uchar_sptr gr_make_float_to_uchar (); + friend GR_CORE_API gr_float_to_uchar_sptr gr_make_float_to_uchar (); gr_float_to_uchar (); public: diff --git a/gnuradio-core/src/lib/general/gr_fmdet_cf.h b/gnuradio-core/src/lib/general/gr_fmdet_cf.h index 792646bef..7bf3baa3f 100644 --- a/gnuradio-core/src/lib/general/gr_fmdet_cf.h +++ b/gnuradio-core/src/lib/general/gr_fmdet_cf.h @@ -23,12 +23,13 @@ #ifndef INCLUDED_GR_FMDET_CF_H #define INCLUDED_GR_FMDET_CF_H +#include <gr_core_api.h> #include <gr_sync_block.h> class gr_fmdet_cf; typedef boost::shared_ptr<gr_fmdet_cf> gr_fmdet_cf_sptr; -gr_fmdet_cf_sptr gr_make_fmdet_cf (float samplerate, float freq_low, float freq_high, float scl); +GR_CORE_API gr_fmdet_cf_sptr gr_make_fmdet_cf (float samplerate, float freq_low, float freq_high, float scl); class gr_fir_ccf; @@ -43,9 +44,9 @@ class gr_fir_ccf; * normalization by the magnitude of the sample */ -class gr_fmdet_cf : public gr_sync_block +class GR_CORE_API gr_fmdet_cf : public gr_sync_block { - friend gr_fmdet_cf_sptr gr_make_fmdet_cf (float samplerate, float freq_low, + friend GR_CORE_API gr_fmdet_cf_sptr gr_make_fmdet_cf (float samplerate, float freq_low, float freq_high, float scl); gr_complex d_S1,d_S2,d_S3,d_S4; diff --git a/gnuradio-core/src/lib/general/gr_framer_sink_1.h b/gnuradio-core/src/lib/general/gr_framer_sink_1.h index 3f2e8aa88..95ad6ced7 100644 --- a/gnuradio-core/src/lib/general/gr_framer_sink_1.h +++ b/gnuradio-core/src/lib/general/gr_framer_sink_1.h @@ -23,13 +23,14 @@ #ifndef INCLUDED_GR_FRAMER_SINK_1_H #define INCLUDED_GR_FRAMER_SINK_1_H +#include <gr_core_api.h> #include <gr_sync_block.h> #include <gr_msg_queue.h> class gr_framer_sink_1; typedef boost::shared_ptr<gr_framer_sink_1> gr_framer_sink_1_sptr; -gr_framer_sink_1_sptr +GR_CORE_API gr_framer_sink_1_sptr gr_make_framer_sink_1 (gr_msg_queue_sptr target_queue); /*! @@ -50,9 +51,9 @@ gr_make_framer_sink_1 (gr_msg_queue_sptr target_queue); * the first bit of the packet. That is, this bit is the first * one after the access code. */ -class gr_framer_sink_1 : public gr_sync_block +class GR_CORE_API gr_framer_sink_1 : public gr_sync_block { - friend gr_framer_sink_1_sptr + friend GR_CORE_API gr_framer_sink_1_sptr gr_make_framer_sink_1 (gr_msg_queue_sptr target_queue); private: diff --git a/gnuradio-core/src/lib/general/gr_frequency_modulator_fc.h b/gnuradio-core/src/lib/general/gr_frequency_modulator_fc.h index 385f447b7..932e7da36 100644 --- a/gnuradio-core/src/lib/general/gr_frequency_modulator_fc.h +++ b/gnuradio-core/src/lib/general/gr_frequency_modulator_fc.h @@ -23,12 +23,13 @@ #ifndef INCLUDED_GR_FREQUENCY_MODULATOR_FC_H #define INCLUDED_GR_FREQUENCY_MODULATOR_FC_H +#include <gr_core_api.h> #include <gr_sync_block.h> class gr_frequency_modulator_fc; typedef boost::shared_ptr<gr_frequency_modulator_fc> gr_frequency_modulator_fc_sptr; -gr_frequency_modulator_fc_sptr gr_make_frequency_modulator_fc (double sensitivity); +GR_CORE_API gr_frequency_modulator_fc_sptr gr_make_frequency_modulator_fc (double sensitivity); /*! * \brief Frequency modulator block @@ -36,12 +37,12 @@ gr_frequency_modulator_fc_sptr gr_make_frequency_modulator_fc (double sensitivit * * float input; complex baseband output */ -class gr_frequency_modulator_fc : public gr_sync_block +class GR_CORE_API gr_frequency_modulator_fc : public gr_sync_block { double d_sensitivity; double d_phase; - friend gr_frequency_modulator_fc_sptr + friend GR_CORE_API gr_frequency_modulator_fc_sptr gr_make_frequency_modulator_fc (double sensitivity); gr_frequency_modulator_fc (double sensitivity); diff --git a/gnuradio-core/src/lib/general/gr_fxpt.h b/gnuradio-core/src/lib/general/gr_fxpt.h index c98d31b27..5cf736dfb 100644 --- a/gnuradio-core/src/lib/general/gr_fxpt.h +++ b/gnuradio-core/src/lib/general/gr_fxpt.h @@ -22,10 +22,11 @@ #ifndef INCLUDED_GR_FXPT_H #define INCLUDED_GR_FXPT_H +#include <gr_core_api.h> #include <gr_types.h> /*! - * \brief fixed point sine and cosine and friends. + * \brief fixed point sine and cosine and friend GR_CORE_APIs. * \ingroup misc * * fixed pt radians @@ -35,7 +36,7 @@ * 2**31-1 pi - epsilon * */ -class gr_fxpt +class GR_CORE_API gr_fxpt { static const int WORDBITS = 32; static const int NBITS = 10; diff --git a/gnuradio-core/src/lib/general/gr_fxpt_nco.h b/gnuradio-core/src/lib/general/gr_fxpt_nco.h index ca0d54f02..5597efb4f 100644 --- a/gnuradio-core/src/lib/general/gr_fxpt_nco.h +++ b/gnuradio-core/src/lib/general/gr_fxpt_nco.h @@ -22,6 +22,7 @@ #ifndef INCLUDED_GR_FXPT_NCO_H #define INCLUDED_GR_FXPT_NCO_H +#include <gr_core_api.h> #include <gr_fxpt.h> #include <gr_complex.h> @@ -29,7 +30,7 @@ * \brief Numerically Controlled Oscillator (NCO) * \ingroup misc */ -class gr_fxpt_nco { +class GR_CORE_API gr_fxpt_nco { gr_uint32 d_phase; gr_int32 d_phase_inc; diff --git a/gnuradio-core/src/lib/general/gr_fxpt_vco.h b/gnuradio-core/src/lib/general/gr_fxpt_vco.h index 1ff968b79..a77a31311 100644 --- a/gnuradio-core/src/lib/general/gr_fxpt_vco.h +++ b/gnuradio-core/src/lib/general/gr_fxpt_vco.h @@ -22,6 +22,7 @@ #ifndef INCLUDED_GR_FXPT_VCO_H #define INCLUDED_GR_FXPT_VCO_H +#include <gr_core_api.h> #include <gr_fxpt.h> #include <gr_complex.h> @@ -29,7 +30,7 @@ * \brief Voltage Controlled Oscillator (VCO) * \ingroup misc */ -class gr_fxpt_vco { +class GR_CORE_API gr_fxpt_vco { gr_int32 d_phase; public: diff --git a/gnuradio-core/src/lib/general/gr_glfsr_source_b.h b/gnuradio-core/src/lib/general/gr_glfsr_source_b.h index cff8df11b..bd66912ed 100644 --- a/gnuradio-core/src/lib/general/gr_glfsr_source_b.h +++ b/gnuradio-core/src/lib/general/gr_glfsr_source_b.h @@ -23,6 +23,7 @@ #ifndef INCLUDED_GR_GLFSR_SOURCE_B_H #define INCLUDED_GR_GLFSR_SOURCE_B_H +#include <gr_core_api.h> #include <gr_sync_block.h> class gri_glfsr; @@ -30,16 +31,16 @@ class gri_glfsr; class gr_glfsr_source_b; typedef boost::shared_ptr<gr_glfsr_source_b> gr_glfsr_source_b_sptr; -gr_glfsr_source_b_sptr gr_make_glfsr_source_b(int degree, bool repeat=true, int mask=0, int seed=1); +GR_CORE_API gr_glfsr_source_b_sptr gr_make_glfsr_source_b(int degree, bool repeat=true, int mask=0, int seed=1); /*! * \brief Galois LFSR pseudo-random source * \ingroup source_blk */ -class gr_glfsr_source_b : public gr_sync_block +class GR_CORE_API gr_glfsr_source_b : public gr_sync_block { private: - friend gr_glfsr_source_b_sptr + friend GR_CORE_API gr_glfsr_source_b_sptr gr_make_glfsr_source_b(int degree, bool repeat, int mask, int seed); gri_glfsr *d_glfsr; diff --git a/gnuradio-core/src/lib/general/gr_glfsr_source_f.h b/gnuradio-core/src/lib/general/gr_glfsr_source_f.h index 007970806..2dd09c5ac 100644 --- a/gnuradio-core/src/lib/general/gr_glfsr_source_f.h +++ b/gnuradio-core/src/lib/general/gr_glfsr_source_f.h @@ -23,6 +23,7 @@ #ifndef INCLUDED_GR_GLFSR_SOURCE_F_H #define INCLUDED_GR_GLFSR_SOURCE_F_H +#include <gr_core_api.h> #include <gr_sync_block.h> class gri_glfsr; @@ -30,16 +31,16 @@ class gri_glfsr; class gr_glfsr_source_f; typedef boost::shared_ptr<gr_glfsr_source_f> gr_glfsr_source_f_sptr; -gr_glfsr_source_f_sptr gr_make_glfsr_source_f(int degree, bool repeat=true, int mask=0, int seed=1); +GR_CORE_API gr_glfsr_source_f_sptr gr_make_glfsr_source_f(int degree, bool repeat=true, int mask=0, int seed=1); /*! * \brief Galois LFSR pseudo-random source generating float outputs -1.0 - 1.0 * \ingroup source_blk */ -class gr_glfsr_source_f : public gr_sync_block +class GR_CORE_API gr_glfsr_source_f : public gr_sync_block { private: - friend gr_glfsr_source_f_sptr + friend GR_CORE_API gr_glfsr_source_f_sptr gr_make_glfsr_source_f(int degree, bool repeat, int mask, int seed); gri_glfsr *d_glfsr; diff --git a/gnuradio-core/src/lib/general/gr_head.h b/gnuradio-core/src/lib/general/gr_head.h index f7eee1064..f66d43308 100644 --- a/gnuradio-core/src/lib/general/gr_head.h +++ b/gnuradio-core/src/lib/general/gr_head.h @@ -23,6 +23,7 @@ #ifndef INCLUDED_GR_HEAD_H #define INCLUDED_GR_HEAD_H +#include <gr_core_api.h> #include <gr_sync_block.h> #include <stddef.h> // size_t @@ -36,9 +37,9 @@ typedef boost::shared_ptr<gr_head> gr_head_sptr; * Useful for building test cases */ -class gr_head : public gr_sync_block +class GR_CORE_API gr_head : public gr_sync_block { - friend gr_head_sptr gr_make_head (size_t sizeof_stream_item, unsigned long long nitems); + friend GR_CORE_API gr_head_sptr gr_make_head (size_t sizeof_stream_item, unsigned long long nitems); gr_head (size_t sizeof_stream_item, unsigned long long nitems); unsigned long long d_nitems; @@ -52,7 +53,7 @@ class gr_head : public gr_sync_block void reset() { d_ncopied_items = 0; } }; -gr_head_sptr +GR_CORE_API gr_head_sptr gr_make_head (size_t sizeof_stream_item, unsigned long long nitems); diff --git a/gnuradio-core/src/lib/general/gr_int_to_float.h b/gnuradio-core/src/lib/general/gr_int_to_float.h index cf1223be5..dac7be9c4 100644 --- a/gnuradio-core/src/lib/general/gr_int_to_float.h +++ b/gnuradio-core/src/lib/general/gr_int_to_float.h @@ -23,12 +23,13 @@ #ifndef INCLUDED_GR_INT_TO_FLOAT_H #define INCLUDED_GR_INT_TO_FLOAT_H +#include <gr_core_api.h> #include <gr_sync_block.h> class gr_int_to_float; typedef boost::shared_ptr<gr_int_to_float> gr_int_to_float_sptr; -gr_int_to_float_sptr +GR_CORE_API gr_int_to_float_sptr gr_make_int_to_float (); /*! @@ -36,9 +37,9 @@ gr_make_int_to_float (); * \ingroup converter_blk */ -class gr_int_to_float : public gr_sync_block +class GR_CORE_API gr_int_to_float : public gr_sync_block { - friend gr_int_to_float_sptr gr_make_int_to_float (); + friend GR_CORE_API gr_int_to_float_sptr gr_make_int_to_float (); gr_int_to_float (); public: diff --git a/gnuradio-core/src/lib/general/gr_interleave.h b/gnuradio-core/src/lib/general/gr_interleave.h index faffdd757..ef7bce07a 100644 --- a/gnuradio-core/src/lib/general/gr_interleave.h +++ b/gnuradio-core/src/lib/general/gr_interleave.h @@ -23,20 +23,21 @@ #ifndef INCLUDED_GR_INTERLEAVE_H #define INCLUDED_GR_INTERLEAVE_H +#include <gr_core_api.h> #include <gr_sync_interpolator.h> class gr_interleave; typedef boost::shared_ptr<gr_interleave> gr_interleave_sptr; -gr_interleave_sptr gr_make_interleave (size_t itemsize); +GR_CORE_API gr_interleave_sptr gr_make_interleave (size_t itemsize); /*! * \brief interleave N inputs to a single output * \ingroup slicedice_blk */ -class gr_interleave : public gr_sync_interpolator +class GR_CORE_API gr_interleave : public gr_sync_interpolator { - friend gr_interleave_sptr gr_make_interleave (size_t itemsize); + friend GR_CORE_API gr_interleave_sptr gr_make_interleave (size_t itemsize); size_t d_itemsize; diff --git a/gnuradio-core/src/lib/general/gr_interleaved_short_to_complex.h b/gnuradio-core/src/lib/general/gr_interleaved_short_to_complex.h index c79a9370f..40f1636bd 100644 --- a/gnuradio-core/src/lib/general/gr_interleaved_short_to_complex.h +++ b/gnuradio-core/src/lib/general/gr_interleaved_short_to_complex.h @@ -23,13 +23,14 @@ #ifndef INCLUDED_GR_INTERLEAVED_SHORT_TO_COMPLEX_H #define INCLUDED_GR_INTERLEAVED_SHORT_TO_COMPLEX_H +#include <gr_core_api.h> #include <gr_sync_decimator.h> class gr_interleaved_short_to_complex; typedef boost::shared_ptr<gr_interleaved_short_to_complex> gr_interleaved_short_to_complex_sptr; -gr_interleaved_short_to_complex_sptr +GR_CORE_API gr_interleaved_short_to_complex_sptr gr_make_interleaved_short_to_complex (); /*! @@ -37,9 +38,9 @@ gr_make_interleaved_short_to_complex (); * \ingroup converter_blk */ -class gr_interleaved_short_to_complex : public gr_sync_decimator +class GR_CORE_API gr_interleaved_short_to_complex : public gr_sync_decimator { - friend gr_interleaved_short_to_complex_sptr gr_make_interleaved_short_to_complex (); + friend GR_CORE_API gr_interleaved_short_to_complex_sptr gr_make_interleaved_short_to_complex (); gr_interleaved_short_to_complex (); public: diff --git a/gnuradio-core/src/lib/general/gr_iqcomp_cc.h b/gnuradio-core/src/lib/general/gr_iqcomp_cc.h index f4c6cf8ea..c01e2a6ba 100644 --- a/gnuradio-core/src/lib/general/gr_iqcomp_cc.h +++ b/gnuradio-core/src/lib/general/gr_iqcomp_cc.h @@ -24,20 +24,21 @@ #ifndef INCLUDED_GR_IQCOMP_CC_H #define INCLUDED_GR_IQCOMP_CC_H +#include <gr_core_api.h> #include <gr_sync_block.h> class gr_iqcomp_cc; typedef boost::shared_ptr<gr_iqcomp_cc> gr_iqcomp_cc_sptr; -gr_iqcomp_cc_sptr gr_make_iqcomp_cc (float mu); +GR_CORE_API gr_iqcomp_cc_sptr gr_make_iqcomp_cc (float mu); /*! * \brief * \ingroup misc_blk */ -class gr_iqcomp_cc : public gr_sync_block +class GR_CORE_API gr_iqcomp_cc : public gr_sync_block { - friend gr_iqcomp_cc_sptr gr_make_iqcomp_cc (float mu); + friend GR_CORE_API gr_iqcomp_cc_sptr gr_make_iqcomp_cc (float mu); float d_mu, d_wi, d_wq; gr_iqcomp_cc (float mu); diff --git a/gnuradio-core/src/lib/general/gr_keep_one_in_n.h b/gnuradio-core/src/lib/general/gr_keep_one_in_n.h index 337827446..f12a7a0f1 100644 --- a/gnuradio-core/src/lib/general/gr_keep_one_in_n.h +++ b/gnuradio-core/src/lib/general/gr_keep_one_in_n.h @@ -23,12 +23,13 @@ #ifndef INCLUDED_GR_KEEP_ONE_IN_N_H #define INCLUDED_GR_KEEP_ONE_IN_N_H +#include <gr_core_api.h> #include <gr_sync_decimator.h> class gr_keep_one_in_n; typedef boost::shared_ptr<gr_keep_one_in_n> gr_keep_one_in_n_sptr; -gr_keep_one_in_n_sptr +GR_CORE_API gr_keep_one_in_n_sptr gr_make_keep_one_in_n (size_t item_size, int n); @@ -36,9 +37,9 @@ gr_make_keep_one_in_n (size_t item_size, int n); * \brief decimate a stream, keeping one item out of every n. * \ingroup slicedice_blk */ -class gr_keep_one_in_n : public gr_block +class GR_CORE_API gr_keep_one_in_n : public gr_block { - friend gr_keep_one_in_n_sptr + friend GR_CORE_API gr_keep_one_in_n_sptr gr_make_keep_one_in_n (size_t item_size, int n); int d_n; diff --git a/gnuradio-core/src/lib/general/gr_kludge_copy.h b/gnuradio-core/src/lib/general/gr_kludge_copy.h index 90fd047df..5c1e461a8 100644 --- a/gnuradio-core/src/lib/general/gr_kludge_copy.h +++ b/gnuradio-core/src/lib/general/gr_kludge_copy.h @@ -23,12 +23,13 @@ #ifndef INCLUDED_GR_KLUDGE_COPY_H #define INCLUDED_GR_KLUDGE_COPY_H +#include <gr_core_api.h> #include <gr_sync_block.h> class gr_kludge_copy; typedef boost::shared_ptr<gr_kludge_copy> gr_kludge_copy_sptr; -gr_kludge_copy_sptr gr_make_kludge_copy(size_t itemsize); +GR_CORE_API gr_kludge_copy_sptr gr_make_kludge_copy(size_t itemsize); /*! * \brief output[i] = input[i] @@ -36,11 +37,11 @@ gr_kludge_copy_sptr gr_make_kludge_copy(size_t itemsize); * * This is a short term kludge to work around a problem with the hierarchical block impl. */ -class gr_kludge_copy : public gr_sync_block +class GR_CORE_API gr_kludge_copy : public gr_sync_block { size_t d_itemsize; - friend gr_kludge_copy_sptr gr_make_kludge_copy(size_t itemsize); + friend GR_CORE_API gr_kludge_copy_sptr gr_make_kludge_copy(size_t itemsize); gr_kludge_copy(size_t itemsize); public: diff --git a/gnuradio-core/src/lib/general/gr_lfsr_32k_source_s.h b/gnuradio-core/src/lib/general/gr_lfsr_32k_source_s.h index f8497e4cb..aa7ad7b1f 100644 --- a/gnuradio-core/src/lib/general/gr_lfsr_32k_source_s.h +++ b/gnuradio-core/src/lib/general/gr_lfsr_32k_source_s.h @@ -23,13 +23,14 @@ #ifndef INCLUDED_GR_LFSR_32K_SOURCE_S_H #define INCLUDED_GR_LFSR_32K_SOURCE_S_H +#include <gr_core_api.h> #include <gr_sync_block.h> #include <gri_lfsr_32k.h> class gr_lfsr_32k_source_s; typedef boost::shared_ptr<gr_lfsr_32k_source_s> gr_lfsr_32k_source_s_sptr; -gr_lfsr_32k_source_s_sptr gr_make_lfsr_32k_source_s (); +GR_CORE_API gr_lfsr_32k_source_s_sptr gr_make_lfsr_32k_source_s (); /*! * \brief LFSR pseudo-random source with period of 2^15 bits (2^11 shorts) @@ -38,9 +39,9 @@ gr_lfsr_32k_source_s_sptr gr_make_lfsr_32k_source_s (); * This source is typically used along with gr_check_lfsr_32k_s to test * the USRP using its digital loopback mode. */ -class gr_lfsr_32k_source_s : public gr_sync_block +class GR_CORE_API gr_lfsr_32k_source_s : public gr_sync_block { - friend gr_lfsr_32k_source_s_sptr gr_make_lfsr_32k_source_s (); + friend GR_CORE_API gr_lfsr_32k_source_s_sptr gr_make_lfsr_32k_source_s (); static const int BUFSIZE = 2048 - 1; // ensure pattern isn't packet aligned diff --git a/gnuradio-core/src/lib/general/gr_lms_dfe_cc.h b/gnuradio-core/src/lib/general/gr_lms_dfe_cc.h new file mode 100644 index 000000000..335b1883c --- /dev/null +++ b/gnuradio-core/src/lib/general/gr_lms_dfe_cc.h @@ -0,0 +1,65 @@ +/* -*- c++ -*- */ +/* + * Copyright 2005 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio 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 General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifndef INCLUDED_GR_LMS_DFE_CC_H +#define INCLUDED_GR_LMS_DFE_CC_H + +#include <gr_core_api.h> +#include <gr_sync_block.h> + +class gr_lms_dfe_cc; +typedef boost::shared_ptr<gr_lms_dfe_cc> gr_lms_dfe_cc_sptr; + +GR_CORE_API gr_lms_dfe_cc_sptr gr_make_lms_dfe_cc (float lambda_ff, float lambda_fb, + unsigned int num_fftaps, unsigned int num_fbtaps); + +/*! + * \brief Least-Mean-Square Decision Feedback Equalizer (complex in/out) + * \ingroup eq_blk + */ +class GR_CORE_API gr_lms_dfe_cc : public gr_sync_block +{ + friend GR_CORE_API gr_lms_dfe_cc_sptr gr_make_lms_dfe_cc (float lambda_ff, float lambda_fb, + unsigned int num_fftaps, unsigned int num_fbtaps); + + float d_lambda_ff; + float d_lambda_fb; + std::vector<gr_complex> d_ff_delayline; + std::vector<gr_complex> d_fb_delayline; + std::vector<gr_complex> d_ff_taps; + std::vector<gr_complex> d_fb_taps; + unsigned int d_ff_index; + unsigned int d_fb_index; + + gr_lms_dfe_cc (float lambda_ff, float lambda_fb, + unsigned int num_fftaps, unsigned int num_fbtaps); + gr_complex slicer_0deg(gr_complex baud); + gr_complex slicer_45deg(gr_complex baud); + + public: + + int work (int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items); +}; + +#endif diff --git a/gnuradio-core/src/lib/general/gr_lms_dfe_ff.h b/gnuradio-core/src/lib/general/gr_lms_dfe_ff.h new file mode 100644 index 000000000..ed2aa9844 --- /dev/null +++ b/gnuradio-core/src/lib/general/gr_lms_dfe_ff.h @@ -0,0 +1,63 @@ +/* -*- c++ -*- */ +/* + * Copyright 2005 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio 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 General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifndef INCLUDED_GR_LMS_DFE_FF_H +#define INCLUDED_GR_LMS_DFE_FF_H + +#include <gr_core_api.h> +#include <gr_sync_block.h> + +class gr_lms_dfe_ff; +typedef boost::shared_ptr<gr_lms_dfe_ff> gr_lms_dfe_ff_sptr; + +GR_CORE_API gr_lms_dfe_ff_sptr gr_make_lms_dfe_ff (float lambda_ff, float lambda_fb, + unsigned int num_fftaps, unsigned int num_fbtaps); + +/*! + * \brief Least-Mean-Square Decision Feedback Equalizer (float in/out) + * \ingroup eq_blk + */ +class GR_CORE_API gr_lms_dfe_ff : public gr_sync_block +{ + friend GR_CORE_API gr_lms_dfe_ff_sptr gr_make_lms_dfe_ff (float lambda_ff, float lambda_fb, + unsigned int num_fftaps, unsigned int num_fbtaps); + + float d_lambda_ff; + float d_lambda_fb; + std::vector<float> d_ff_delayline; + std::vector<float> d_fb_delayline; + std::vector<float> d_ff_taps; + std::vector<float> d_fb_taps; + unsigned int d_ff_index; + unsigned int d_fb_index; + + gr_lms_dfe_ff (float lambda_ff, float lambda_fb, + unsigned int num_fftaps, unsigned int num_fbtaps); + + public: + + int work (int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items); +}; + +#endif diff --git a/gnuradio-core/src/lib/general/gr_log2_const.h b/gnuradio-core/src/lib/general/gr_log2_const.h index 4ea420920..8e4a0860b 100644 --- a/gnuradio-core/src/lib/general/gr_log2_const.h +++ b/gnuradio-core/src/lib/general/gr_log2_const.h @@ -27,6 +27,7 @@ #ifndef INCLUDED_GR_LOG2_CONST_H #define INCLUDED_GR_LOG2_CONST_H +#include <gr_core_api.h> #include <assert.h> template<unsigned int k> static inline int gr_log2_const() { assert(0); return 0; } diff --git a/gnuradio-core/src/lib/general/gr_map_bb.h b/gnuradio-core/src/lib/general/gr_map_bb.h index 4986ab181..0820c6a16 100644 --- a/gnuradio-core/src/lib/general/gr_map_bb.h +++ b/gnuradio-core/src/lib/general/gr_map_bb.h @@ -22,21 +22,22 @@ #ifndef INCLUDED_GR_MAP_BB_H #define INCLUDED_GR_MAP_BB_H +#include <gr_core_api.h> #include <gr_sync_block.h> class gr_map_bb; typedef boost::shared_ptr<gr_map_bb> gr_map_bb_sptr; -gr_map_bb_sptr gr_make_map_bb(const std::vector<int> &map); +GR_CORE_API gr_map_bb_sptr gr_make_map_bb(const std::vector<int> &map); /*! * \brief output[i] = map[input[i]] * \ingroup coding_blk */ -class gr_map_bb : public gr_sync_block +class GR_CORE_API gr_map_bb : public gr_sync_block { - friend gr_map_bb_sptr gr_make_map_bb(const std::vector<int> &map); + friend GR_CORE_API gr_map_bb_sptr gr_make_map_bb(const std::vector<int> &map); unsigned char d_map[0x100]; diff --git a/gnuradio-core/src/lib/general/gr_math.h b/gnuradio-core/src/lib/general/gr_math.h index f5935c1da..9c61942cd 100644 --- a/gnuradio-core/src/lib/general/gr_math.h +++ b/gnuradio-core/src/lib/general/gr_math.h @@ -27,6 +27,7 @@ #ifndef _GR_MATH_H_ #define _GR_MATH_H_ +#include <gr_core_api.h> #include <gr_complex.h> static inline bool @@ -51,7 +52,7 @@ gr_is_power_of_2(long x) * to zero. This routine calculates the arc tangent with an average * error of +/- 0.045 degrees. */ -float gr_fast_atan2f(float y, float x); +GR_CORE_API float gr_fast_atan2f(float y, float x); static inline float gr_fast_atan2f(gr_complex z) { diff --git a/gnuradio-core/src/lib/general/gr_misc.h b/gnuradio-core/src/lib/general/gr_misc.h index 55cc7eda6..78f7e18ac 100644 --- a/gnuradio-core/src/lib/general/gr_misc.h +++ b/gnuradio-core/src/lib/general/gr_misc.h @@ -23,16 +23,17 @@ #ifndef INCLUDED_GR_MISC_H #define INCLUDED_GR_MISC_H +#include <gr_core_api.h> #include <gr_types.h> unsigned int gr_rounduppow2(unsigned int n); // FIXME should be template -void gr_zero_vector(std::vector<float> &v); -void gr_zero_vector(std::vector<double> &v); -void gr_zero_vector(std::vector<int> &v); -void gr_zero_vector(std::vector<gr_complex> &v); +GR_CORE_API void gr_zero_vector(std::vector<float> &v); +GR_CORE_API void gr_zero_vector(std::vector<double> &v); +GR_CORE_API void gr_zero_vector(std::vector<int> &v); +GR_CORE_API void gr_zero_vector(std::vector<gr_complex> &v); #endif /* INCLUDED_GR_MISC_H */ diff --git a/gnuradio-core/src/lib/general/gr_nlog10_ff.h b/gnuradio-core/src/lib/general/gr_nlog10_ff.h index 1cb50f3ca..cea56f87e 100644 --- a/gnuradio-core/src/lib/general/gr_nlog10_ff.h +++ b/gnuradio-core/src/lib/general/gr_nlog10_ff.h @@ -22,20 +22,21 @@ #ifndef INCLUDED_GR_NLOG10_FF_H #define INCLUDED_GR_NLOG10_FF_H +#include <gr_core_api.h> #include <gr_sync_block.h> class gr_nlog10_ff; typedef boost::shared_ptr<gr_nlog10_ff> gr_nlog10_ff_sptr; -gr_nlog10_ff_sptr gr_make_nlog10_ff (float n=1.0, unsigned vlen=1, float k=0); +GR_CORE_API gr_nlog10_ff_sptr gr_make_nlog10_ff (float n=1.0, unsigned vlen=1, float k=0); /*! * \brief output = n*log10(input) + k * \ingroup math_blk */ -class gr_nlog10_ff : public gr_sync_block +class GR_CORE_API gr_nlog10_ff : public gr_sync_block { - friend gr_nlog10_ff_sptr gr_make_nlog10_ff (float n, unsigned vlen, float k); + friend GR_CORE_API gr_nlog10_ff_sptr gr_make_nlog10_ff (float n, unsigned vlen, float k); unsigned int d_vlen; float d_n; diff --git a/gnuradio-core/src/lib/general/gr_nop.h b/gnuradio-core/src/lib/general/gr_nop.h index 354c2f9fc..b8398befc 100644 --- a/gnuradio-core/src/lib/general/gr_nop.h +++ b/gnuradio-core/src/lib/general/gr_nop.h @@ -23,22 +23,23 @@ #ifndef INCLUDED_GR_NOP_H #define INCLUDED_GR_NOP_H +#include <gr_core_api.h> #include <gr_block.h> #include <stddef.h> // size_t class gr_nop; typedef boost::shared_ptr<gr_nop> gr_nop_sptr; -gr_nop_sptr +GR_CORE_API gr_nop_sptr gr_make_nop (size_t sizeof_stream_item); /*! * \brief Does nothing. Used for testing only. * \ingroup misc_blk */ -class gr_nop : public gr_block +class GR_CORE_API gr_nop : public gr_block { - friend gr_nop_sptr gr_make_nop (size_t sizeof_stream_item); + friend GR_CORE_API gr_nop_sptr gr_make_nop (size_t sizeof_stream_item); gr_nop (size_t sizeof_stream_item); protected: diff --git a/gnuradio-core/src/lib/general/gr_null_sink.h b/gnuradio-core/src/lib/general/gr_null_sink.h index 6d00382a5..c6c4f36fb 100644 --- a/gnuradio-core/src/lib/general/gr_null_sink.h +++ b/gnuradio-core/src/lib/general/gr_null_sink.h @@ -23,23 +23,23 @@ #ifndef INCLUDED_GR_NULL_SINK_H #define INCLUDED_GR_NULL_SINK_H +#include <gr_core_api.h> #include <gr_sync_block.h> #include <stddef.h> // size_t class gr_null_sink; typedef boost::shared_ptr<gr_null_sink> gr_null_sink_sptr; -gr_null_sink_sptr +GR_CORE_API gr_null_sink_sptr gr_make_null_sink (size_t sizeof_stream_item); - /*! * \brief Bit bucket * \ingroup sink_blk */ -class gr_null_sink : public gr_sync_block +class GR_CORE_API gr_null_sink : public gr_sync_block { - friend gr_null_sink_sptr gr_make_null_sink (size_t sizeof_stream_item); + friend GR_CORE_API gr_null_sink_sptr gr_make_null_sink (size_t sizeof_stream_item); gr_null_sink (size_t sizeof_stream_item); public: diff --git a/gnuradio-core/src/lib/general/gr_null_source.h b/gnuradio-core/src/lib/general/gr_null_source.h index b1a46a195..33687fbaa 100644 --- a/gnuradio-core/src/lib/general/gr_null_source.h +++ b/gnuradio-core/src/lib/general/gr_null_source.h @@ -23,21 +23,22 @@ #ifndef INCLUDED_GR_NULL_SOURCE_H #define INCLUDED_GR_NULL_SOURCE_H +#include <gr_core_api.h> #include <gr_sync_block.h> class gr_null_source; typedef boost::shared_ptr<gr_null_source> gr_null_source_sptr; -gr_null_source_sptr +GR_CORE_API gr_null_source_sptr gr_make_null_source (size_t sizeof_stream_item); /*! * \brief A source of zeros. * \ingroup source_blk */ -class gr_null_source : public gr_sync_block +class GR_CORE_API gr_null_source : public gr_sync_block { - friend gr_null_source_sptr gr_make_null_source (size_t sizeof_stream_item); + friend GR_CORE_API gr_null_source_sptr gr_make_null_source (size_t sizeof_stream_item); gr_null_source (size_t sizeof_stream_item); diff --git a/gnuradio-core/src/lib/general/gr_ofdm_bpsk_demapper.h b/gnuradio-core/src/lib/general/gr_ofdm_bpsk_demapper.h index 12ae6a8f6..6d532d50f 100644 --- a/gnuradio-core/src/lib/general/gr_ofdm_bpsk_demapper.h +++ b/gnuradio-core/src/lib/general/gr_ofdm_bpsk_demapper.h @@ -24,13 +24,14 @@ #define INCLUDED_GR_OFDM_BPSK_DEMAPPER_H +#include <gr_core_api.h> #include <gr_block.h> #include <vector> class gr_ofdm_bpsk_demapper; typedef boost::shared_ptr<gr_ofdm_bpsk_demapper> gr_ofdm_bpsk_demapper_sptr; -gr_ofdm_bpsk_demapper_sptr +GR_CORE_API gr_ofdm_bpsk_demapper_sptr gr_make_ofdm_bpsk_demapper (unsigned int occupied_carriers); @@ -39,9 +40,9 @@ gr_make_ofdm_bpsk_demapper (unsigned int occupied_carriers); * and demodulate to a stream of bits. Simple BPSK version. * \ingroup ofdm_blk */ -class gr_ofdm_bpsk_demapper : public gr_block +class GR_CORE_API gr_ofdm_bpsk_demapper : public gr_block { - friend gr_ofdm_bpsk_demapper_sptr + friend GR_CORE_API gr_ofdm_bpsk_demapper_sptr gr_make_ofdm_bpsk_demapper (unsigned int occupied_carriers); protected: diff --git a/gnuradio-core/src/lib/general/gr_ofdm_cyclic_prefixer.h b/gnuradio-core/src/lib/general/gr_ofdm_cyclic_prefixer.h index eab91cd11..1ed68aa58 100644 --- a/gnuradio-core/src/lib/general/gr_ofdm_cyclic_prefixer.h +++ b/gnuradio-core/src/lib/general/gr_ofdm_cyclic_prefixer.h @@ -23,13 +23,14 @@ #ifndef INCLUDED_GR_OFDM_CYCLIC_PREFIXER_H #define INCLUDED_GR_OFDM_CYCLIC_PREFIXER_H +#include <gr_core_api.h> #include <gr_sync_interpolator.h> #include <stdio.h> class gr_ofdm_cyclic_prefixer; typedef boost::shared_ptr<gr_ofdm_cyclic_prefixer> gr_ofdm_cyclic_prefixer_sptr; -gr_ofdm_cyclic_prefixer_sptr +GR_CORE_API gr_ofdm_cyclic_prefixer_sptr gr_make_ofdm_cyclic_prefixer (size_t input_size, size_t output_size); @@ -38,9 +39,9 @@ gr_make_ofdm_cyclic_prefixer (size_t input_size, size_t output_size); * symbol(vector) and converts vector to a stream output_size long. * \ingroup ofdm_blk */ -class gr_ofdm_cyclic_prefixer : public gr_sync_interpolator +class GR_CORE_API gr_ofdm_cyclic_prefixer : public gr_sync_interpolator { - friend gr_ofdm_cyclic_prefixer_sptr + friend GR_CORE_API gr_ofdm_cyclic_prefixer_sptr gr_make_ofdm_cyclic_prefixer (size_t input_size, size_t output_size); protected: diff --git a/gnuradio-core/src/lib/general/gr_ofdm_demapper_vcb.h b/gnuradio-core/src/lib/general/gr_ofdm_demapper_vcb.h index 979e1996b..d12e007df 100644 --- a/gnuradio-core/src/lib/general/gr_ofdm_demapper_vcb.h +++ b/gnuradio-core/src/lib/general/gr_ofdm_demapper_vcb.h @@ -23,12 +23,13 @@ #ifndef INCLUDED_GR_OFDM_DEMAPPER_VCB_H #define INCLUDED_GR_OFDM_DEMAPPER_VCB_H +#include <gr_core_api.h> #include <gr_sync_decimator.h> class gr_ofdm_demapper_vcb; typedef boost::shared_ptr<gr_ofdm_demapper_vcb> gr_ofdm_demapper_vcb_sptr; -gr_ofdm_demapper_vcb_sptr +GR_CORE_API gr_ofdm_demapper_vcb_sptr gr_make_ofdm_demapper_vcb (unsigned int bits_per_symbol, unsigned int vlen); @@ -39,9 +40,9 @@ gr_make_ofdm_demapper_vcb (unsigned int bits_per_symbol, unsigned int vlen); * \ingroup demodulation_blk * \ingroup ofdm_blk */ -class gr_ofdm_demapper_vcb : public gr_sync_decimator +class GR_CORE_API gr_ofdm_demapper_vcb : public gr_sync_decimator { - friend gr_ofdm_demapper_vcb_sptr + friend GR_CORE_API gr_ofdm_demapper_vcb_sptr gr_make_ofdm_demapper_vcb (unsigned int bits_per_symbol, unsigned int vlen); protected: diff --git a/gnuradio-core/src/lib/general/gr_ofdm_frame_acquisition.h b/gnuradio-core/src/lib/general/gr_ofdm_frame_acquisition.h index 5db8dbb7f..63c1af086 100644 --- a/gnuradio-core/src/lib/general/gr_ofdm_frame_acquisition.h +++ b/gnuradio-core/src/lib/general/gr_ofdm_frame_acquisition.h @@ -24,13 +24,14 @@ #define INCLUDED_GR_OFDM_FRAME_ACQUISITION_H +#include <gr_core_api.h> #include <gr_block.h> #include <vector> class gr_ofdm_frame_acquisition; typedef boost::shared_ptr<gr_ofdm_frame_acquisition> gr_ofdm_frame_acquisition_sptr; -gr_ofdm_frame_acquisition_sptr +GR_CORE_API gr_ofdm_frame_acquisition_sptr gr_make_ofdm_frame_acquisition (unsigned int occupied_carriers, unsigned int fft_length, unsigned int cplen, const std::vector<gr_complex> &known_symbol, @@ -54,7 +55,7 @@ gr_make_ofdm_frame_acquisition (unsigned int occupied_carriers, unsigned int fft * distortion caused by the channel. */ -class gr_ofdm_frame_acquisition : public gr_block +class GR_CORE_API gr_ofdm_frame_acquisition : public gr_block { /*! * \brief Build an OFDM correlator and equalizer. @@ -65,7 +66,7 @@ class gr_ofdm_frame_acquisition : public gr_block * start of a frame (usually a BPSK PN sequence) * \param max_fft_shift_len Set's the maximum distance you can look between bins for correlation */ - friend gr_ofdm_frame_acquisition_sptr + friend GR_CORE_API gr_ofdm_frame_acquisition_sptr gr_make_ofdm_frame_acquisition (unsigned int occupied_carriers, unsigned int fft_length, unsigned int cplen, const std::vector<gr_complex> &known_symbol, diff --git a/gnuradio-core/src/lib/general/gr_ofdm_frame_sink.h b/gnuradio-core/src/lib/general/gr_ofdm_frame_sink.h index c419b8673..d3c1d761d 100644 --- a/gnuradio-core/src/lib/general/gr_ofdm_frame_sink.h +++ b/gnuradio-core/src/lib/general/gr_ofdm_frame_sink.h @@ -23,13 +23,14 @@ #ifndef INCLUDED_GR_OFDM_FRAME_SINK_H #define INCLUDED_GR_OFDM_FRAME_SINK_H +#include <gr_core_api.h> #include <gr_sync_block.h> #include <gr_msg_queue.h> class gr_ofdm_frame_sink; typedef boost::shared_ptr<gr_ofdm_frame_sink> gr_ofdm_frame_sink_sptr; -gr_ofdm_frame_sink_sptr +GR_CORE_API gr_ofdm_frame_sink_sptr gr_make_ofdm_frame_sink (const std::vector<gr_complex> &sym_position, const std::vector<unsigned char> &sym_value_out, gr_msg_queue_sptr target_queue, unsigned int occupied_tones, @@ -45,9 +46,9 @@ gr_make_ofdm_frame_sink (const std::vector<gr_complex> &sym_position, * we want to be able to pass in a reference to an object to do the demapping and slicing * for a given modulation type. */ -class gr_ofdm_frame_sink : public gr_sync_block +class GR_CORE_API gr_ofdm_frame_sink : public gr_sync_block { - friend gr_ofdm_frame_sink_sptr + friend GR_CORE_API gr_ofdm_frame_sink_sptr gr_make_ofdm_frame_sink (const std::vector<gr_complex> &sym_position, const std::vector<unsigned char> &sym_value_out, gr_msg_queue_sptr target_queue, unsigned int occupied_tones, diff --git a/gnuradio-core/src/lib/general/gr_ofdm_frame_sink2.h b/gnuradio-core/src/lib/general/gr_ofdm_frame_sink2.h index de8c6a37e..9595303b1 100644 --- a/gnuradio-core/src/lib/general/gr_ofdm_frame_sink2.h +++ b/gnuradio-core/src/lib/general/gr_ofdm_frame_sink2.h @@ -23,6 +23,7 @@ #ifndef INCLUDED_GR_OFDM_FRAME_SINK2_H #define INCLUDED_GR_OFDM_FRAME_SINK2_H +#include <gr_core_api.h> #include <gr_sync_block.h> #include <gr_msg_queue.h> #include <gr_constellation.h> @@ -30,7 +31,7 @@ class gr_ofdm_frame_sink2; typedef boost::shared_ptr<gr_ofdm_frame_sink2> gr_ofdm_frame_sink2_sptr; -gr_ofdm_frame_sink2_sptr +GR_CORE_API gr_ofdm_frame_sink2_sptr gr_make_ofdm_frame_sink2 (gr_constellation_sptr constell, gr_msg_queue_sptr target_queue, unsigned int occupied_tones, float phase_gain=0.25, float freq_gain=0.25*0.25/4.0); @@ -45,9 +46,9 @@ gr_make_ofdm_frame_sink2 (gr_constellation_sptr constell, * we want to be able to pass in a reference to an object to do the demapping and slicing * for a given modulation type. */ -class gr_ofdm_frame_sink2 : public gr_sync_block +class GR_CORE_API gr_ofdm_frame_sink2 : public gr_sync_block { - friend gr_ofdm_frame_sink2_sptr + friend GR_CORE_API gr_ofdm_frame_sink2_sptr gr_make_ofdm_frame_sink2 (gr_constellation_sptr constell, gr_msg_queue_sptr target_queue, unsigned int occupied_tones, float phase_gain, float freq_gain); diff --git a/gnuradio-core/src/lib/general/gr_ofdm_insert_preamble.h b/gnuradio-core/src/lib/general/gr_ofdm_insert_preamble.h index 57c1af013..10025dd14 100644 --- a/gnuradio-core/src/lib/general/gr_ofdm_insert_preamble.h +++ b/gnuradio-core/src/lib/general/gr_ofdm_insert_preamble.h @@ -22,13 +22,14 @@ #ifndef INCLUDED_GR_OFDM_INSERT_PREAMBLE_H #define INCLUDED_GR_OFDM_INSERT_PREAMBLE_H +#include <gr_core_api.h> #include <gr_block.h> #include <vector> class gr_ofdm_insert_preamble; typedef boost::shared_ptr<gr_ofdm_insert_preamble> gr_ofdm_insert_preamble_sptr; -gr_ofdm_insert_preamble_sptr +GR_CORE_API gr_ofdm_insert_preamble_sptr gr_make_ofdm_insert_preamble(int fft_length, const std::vector<std::vector<gr_complex> > &preamble); @@ -62,9 +63,9 @@ gr_make_ofdm_insert_preamble(int fft_length, * \param preamble vector of symbols that represent the pre-modulated preamble. */ -class gr_ofdm_insert_preamble : public gr_block +class GR_CORE_API gr_ofdm_insert_preamble : public gr_block { - friend gr_ofdm_insert_preamble_sptr + friend GR_CORE_API gr_ofdm_insert_preamble_sptr gr_make_ofdm_insert_preamble(int fft_length, const std::vector<std::vector<gr_complex> > &preamble); diff --git a/gnuradio-core/src/lib/general/gr_ofdm_mapper_bcv.h b/gnuradio-core/src/lib/general/gr_ofdm_mapper_bcv.h index 5a21b90af..f33ca4253 100644 --- a/gnuradio-core/src/lib/general/gr_ofdm_mapper_bcv.h +++ b/gnuradio-core/src/lib/general/gr_ofdm_mapper_bcv.h @@ -23,6 +23,7 @@ #ifndef INCLUDED_GR_OFDM_MAPPER_BCV_H #define INCLUDED_GR_OFDM_MAPPER_BCV_H +#include <gr_core_api.h> #include <gr_sync_block.h> #include <gr_message.h> #include <gr_msg_queue.h> @@ -30,7 +31,7 @@ class gr_ofdm_mapper_bcv; typedef boost::shared_ptr<gr_ofdm_mapper_bcv> gr_ofdm_mapper_bcv_sptr; -gr_ofdm_mapper_bcv_sptr +GR_CORE_API gr_ofdm_mapper_bcv_sptr gr_make_ofdm_mapper_bcv (const std::vector<gr_complex> &constellation, unsigned msgq_limit, unsigned occupied_carriers, unsigned int fft_length); @@ -42,9 +43,9 @@ gr_make_ofdm_mapper_bcv (const std::vector<gr_complex> &constellation, unsigned * \ingroup ofdm_blk */ -class gr_ofdm_mapper_bcv : public gr_sync_block +class GR_CORE_API gr_ofdm_mapper_bcv : public gr_sync_block { - friend gr_ofdm_mapper_bcv_sptr + friend GR_CORE_API gr_ofdm_mapper_bcv_sptr gr_make_ofdm_mapper_bcv (const std::vector<gr_complex> &constellation, unsigned msgq_limit, unsigned occupied_carriers, unsigned int fft_length); protected: diff --git a/gnuradio-core/src/lib/general/gr_ofdm_sampler.h b/gnuradio-core/src/lib/general/gr_ofdm_sampler.h index d059636ed..6e9dddada 100644 --- a/gnuradio-core/src/lib/general/gr_ofdm_sampler.h +++ b/gnuradio-core/src/lib/general/gr_ofdm_sampler.h @@ -23,12 +23,13 @@ #ifndef INCLUDED_GR_OFDM_SAMPLER_H #define INCLUDED_GR_OFDM_SAMPLER_H +#include <gr_core_api.h> #include <gr_sync_block.h> class gr_ofdm_sampler; typedef boost::shared_ptr<gr_ofdm_sampler> gr_ofdm_sampler_sptr; -gr_ofdm_sampler_sptr gr_make_ofdm_sampler (unsigned int fft_length, +GR_CORE_API gr_ofdm_sampler_sptr gr_make_ofdm_sampler (unsigned int fft_length, unsigned int symbol_length, unsigned int timeout=1000); @@ -36,9 +37,9 @@ gr_ofdm_sampler_sptr gr_make_ofdm_sampler (unsigned int fft_length, * \brief does the rest of the OFDM stuff * \ingroup ofdm_blk */ -class gr_ofdm_sampler : public gr_block +class GR_CORE_API gr_ofdm_sampler : public gr_block { - friend gr_ofdm_sampler_sptr gr_make_ofdm_sampler (unsigned int fft_length, + friend GR_CORE_API gr_ofdm_sampler_sptr gr_make_ofdm_sampler (unsigned int fft_length, unsigned int symbol_length, unsigned int timeout); diff --git a/gnuradio-core/src/lib/general/gr_pa_2x2_phase_combiner.h b/gnuradio-core/src/lib/general/gr_pa_2x2_phase_combiner.h index ec163911a..abb23e002 100644 --- a/gnuradio-core/src/lib/general/gr_pa_2x2_phase_combiner.h +++ b/gnuradio-core/src/lib/general/gr_pa_2x2_phase_combiner.h @@ -22,12 +22,13 @@ #ifndef INCLUDED_GR_PA_2X2_PHASE_COMBINER_H #define INCLUDED_GR_PA_2X2_PHASE_COMBINER_H +#include <gr_core_api.h> #include <gr_sync_block.h> class gr_pa_2x2_phase_combiner; typedef boost::shared_ptr<gr_pa_2x2_phase_combiner> gr_pa_2x2_phase_combiner_sptr; -gr_pa_2x2_phase_combiner_sptr gr_make_pa_2x2_phase_combiner (); +GR_CORE_API gr_pa_2x2_phase_combiner_sptr gr_make_pa_2x2_phase_combiner (); /*! * \brief pa_2x2 phase combiner @@ -40,7 +41,7 @@ gr_pa_2x2_phase_combiner_sptr gr_make_pa_2x2_phase_combiner (); * * dx and dy are lambda/2. */ -class gr_pa_2x2_phase_combiner : public gr_sync_block +class GR_CORE_API gr_pa_2x2_phase_combiner : public gr_sync_block { static const int NM = 4; @@ -48,7 +49,7 @@ class gr_pa_2x2_phase_combiner : public gr_sync_block gr_complex d_phase[NM]; gr_pa_2x2_phase_combiner (); - friend gr_pa_2x2_phase_combiner_sptr gr_make_pa_2x2_phase_combiner(); + friend GR_CORE_API gr_pa_2x2_phase_combiner_sptr gr_make_pa_2x2_phase_combiner(); public: float theta() const { return d_theta; } diff --git a/gnuradio-core/src/lib/general/gr_packet_sink.h b/gnuradio-core/src/lib/general/gr_packet_sink.h index 73c5d6c52..89a95f3e3 100644 --- a/gnuradio-core/src/lib/general/gr_packet_sink.h +++ b/gnuradio-core/src/lib/general/gr_packet_sink.h @@ -23,13 +23,14 @@ #ifndef INCLUDED_GR_PACKET_SINK_H #define INCLUDED_GR_PACKET_SINK_H +#include <gr_core_api.h> #include <gr_sync_block.h> #include <gr_msg_queue.h> class gr_packet_sink; typedef boost::shared_ptr<gr_packet_sink> gr_packet_sink_sptr; -gr_packet_sink_sptr +GR_CORE_API gr_packet_sink_sptr gr_make_packet_sink (const std::vector<unsigned char>& sync_vector, gr_msg_queue_sptr target_queue, int threshold = -1 // -1 -> use default @@ -38,9 +39,9 @@ gr_make_packet_sink (const std::vector<unsigned char>& sync_vector, * \brief process received bits looking for packet sync, header, and process bits into packet * \ingroup sink_blk */ -class gr_packet_sink : public gr_sync_block +class GR_CORE_API gr_packet_sink : public gr_sync_block { - friend gr_packet_sink_sptr + friend GR_CORE_API gr_packet_sink_sptr gr_make_packet_sink (const std::vector<unsigned char>& sync_vector, gr_msg_queue_sptr target_queue, int threshold); diff --git a/gnuradio-core/src/lib/general/gr_peak_detector2_fb.h b/gnuradio-core/src/lib/general/gr_peak_detector2_fb.h index 58a006246..5bb97fc5d 100644 --- a/gnuradio-core/src/lib/general/gr_peak_detector2_fb.h +++ b/gnuradio-core/src/lib/general/gr_peak_detector2_fb.h @@ -23,12 +23,13 @@ #ifndef INCLUDED_gr_peak_detector2_FB_H #define INCLUDED_gr_peak_detector2_FB_H +#include <gr_core_api.h> #include <gr_sync_block.h> class gr_peak_detector2_fb; typedef boost::shared_ptr<gr_peak_detector2_fb> gr_peak_detector2_fb_sptr; -gr_peak_detector2_fb_sptr gr_make_peak_detector2_fb (float threshold_factor_rise = 7, +GR_CORE_API gr_peak_detector2_fb_sptr gr_make_peak_detector2_fb (float threshold_factor_rise = 7, int look_ahead = 1000, float alpha = 0.001); @@ -49,9 +50,9 @@ gr_peak_detector2_fb_sptr gr_make_peak_detector2_fb (float threshold_factor_rise * \param alpha The gain value of a single-pole moving average filter */ -class gr_peak_detector2_fb : public gr_sync_block +class GR_CORE_API gr_peak_detector2_fb : public gr_sync_block { - friend gr_peak_detector2_fb_sptr + friend GR_CORE_API gr_peak_detector2_fb_sptr gr_make_peak_detector2_fb (float threshold_factor_rise, int look_ahead, float alpha); gr_peak_detector2_fb (float threshold_factor_rise, int look_ahead, float alpha); diff --git a/gnuradio-core/src/lib/general/gr_phase_modulator_fc.h b/gnuradio-core/src/lib/general/gr_phase_modulator_fc.h index 50157534b..dd6e300a8 100644 --- a/gnuradio-core/src/lib/general/gr_phase_modulator_fc.h +++ b/gnuradio-core/src/lib/general/gr_phase_modulator_fc.h @@ -23,24 +23,25 @@ #ifndef INCLUDED_GR_PHASE_MODULATOR_FC_H #define INCLUDED_GR_PHASE_MODULATOR_FC_H +#include <gr_core_api.h> #include <gr_sync_block.h> class gr_phase_modulator_fc; typedef boost::shared_ptr<gr_phase_modulator_fc> gr_phase_modulator_fc_sptr; -gr_phase_modulator_fc_sptr gr_make_phase_modulator_fc (double sensitivity); +GR_CORE_API gr_phase_modulator_fc_sptr gr_make_phase_modulator_fc (double sensitivity); /*! * \brief Phase modulator block * \ingroup modulation_blk * output=complex(cos(in*sensitivity),sin(in*sensitivity)) */ -class gr_phase_modulator_fc : public gr_sync_block +class GR_CORE_API gr_phase_modulator_fc : public gr_sync_block { double d_sensitivity; double d_phase; - friend gr_phase_modulator_fc_sptr + friend GR_CORE_API gr_phase_modulator_fc_sptr gr_make_phase_modulator_fc (double sensitivity); gr_phase_modulator_fc (double sensitivity); diff --git a/gnuradio-core/src/lib/general/gr_pll_carriertracking_cc.h b/gnuradio-core/src/lib/general/gr_pll_carriertracking_cc.h index bcdf543a4..db74bb101 100644 --- a/gnuradio-core/src/lib/general/gr_pll_carriertracking_cc.h +++ b/gnuradio-core/src/lib/general/gr_pll_carriertracking_cc.h @@ -23,13 +23,14 @@ #ifndef INCLUDED_GR_PLL_CARRIERTRACKING_CC_H #define INCLUDED_GR_PLL_CARRIERTRACKING_CC_H +#include <gr_core_api.h> #include <gr_sync_block.h> #include <gri_control_loop.h> class gr_pll_carriertracking_cc; typedef boost::shared_ptr<gr_pll_carriertracking_cc> gr_pll_carriertracking_cc_sptr; -gr_pll_carriertracking_cc_sptr gr_make_pll_carriertracking_cc (float loop_bw, +GR_CORE_API gr_pll_carriertracking_cc_sptr gr_make_pll_carriertracking_cc (float loop_bw, float max_freq, float min_freq); /*! @@ -48,9 +49,9 @@ gr_pll_carriertracking_cc_sptr gr_make_pll_carriertracking_cc (float loop_bw, * \sa gr_pll_freqdet_cf, gr_pll_carriertracking_cc */ -class gr_pll_carriertracking_cc : public gr_sync_block, public gri_control_loop +class GR_CORE_API gr_pll_carriertracking_cc : public gr_sync_block, public gri_control_loop { - friend gr_pll_carriertracking_cc_sptr gr_make_pll_carriertracking_cc (float loop_bw, + friend GR_CORE_API gr_pll_carriertracking_cc_sptr gr_make_pll_carriertracking_cc (float loop_bw, float max_freq, float min_freq); diff --git a/gnuradio-core/src/lib/general/gr_pll_freqdet_cf.h b/gnuradio-core/src/lib/general/gr_pll_freqdet_cf.h index 0da9fc5c7..336f3fd31 100644 --- a/gnuradio-core/src/lib/general/gr_pll_freqdet_cf.h +++ b/gnuradio-core/src/lib/general/gr_pll_freqdet_cf.h @@ -23,13 +23,14 @@ #ifndef INCLUDED_GR_PLL_FREQDET_CF_H #define INCLUDED_GR_PLL_FREQDET_CF_H +#include <gr_core_api.h> #include <gr_sync_block.h> #include <gri_control_loop.h> class gr_pll_freqdet_cf; typedef boost::shared_ptr<gr_pll_freqdet_cf> gr_pll_freqdet_cf_sptr; -gr_pll_freqdet_cf_sptr gr_make_pll_freqdet_cf (float loop_bw, +GR_CORE_API gr_pll_freqdet_cf_sptr gr_make_pll_freqdet_cf (float loop_bw, float max_freq, float min_freq); /*! @@ -47,9 +48,9 @@ gr_pll_freqdet_cf_sptr gr_make_pll_freqdet_cf (float loop_bw, * \sa gr_pll_refout_cc, gr_pll_carriertracking_cc */ -class gr_pll_freqdet_cf : public gr_sync_block, public gri_control_loop +class GR_CORE_API gr_pll_freqdet_cf : public gr_sync_block, public gri_control_loop { - friend gr_pll_freqdet_cf_sptr gr_make_pll_freqdet_cf (float loop_bw, + friend GR_CORE_API gr_pll_freqdet_cf_sptr gr_make_pll_freqdet_cf (float loop_bw, float max_freq, float min_freq); diff --git a/gnuradio-core/src/lib/general/gr_pll_refout_cc.h b/gnuradio-core/src/lib/general/gr_pll_refout_cc.h index d3e45882b..dcbeb1efa 100644 --- a/gnuradio-core/src/lib/general/gr_pll_refout_cc.h +++ b/gnuradio-core/src/lib/general/gr_pll_refout_cc.h @@ -23,13 +23,14 @@ #ifndef INCLUDED_GR_PLL_REFOUT_CC_H #define INCLUDED_GR_PLL_REFOUT_CC_H +#include <gr_core_api.h> #include <gr_sync_block.h> #include <gri_control_loop.h> class gr_pll_refout_cc; typedef boost::shared_ptr<gr_pll_refout_cc> gr_pll_refout_cc_sptr; -gr_pll_refout_cc_sptr gr_make_pll_refout_cc (float loop_bw, +GR_CORE_API gr_pll_refout_cc_sptr gr_make_pll_refout_cc (float loop_bw, float max_freq, float min_freq); /*! * \brief Implements a PLL which locks to the input frequency and outputs a carrier @@ -46,9 +47,9 @@ gr_pll_refout_cc_sptr gr_make_pll_refout_cc (float loop_bw, * around pi/200 -- 2pi/100. * \sa gr_pll_freqdet_cf, gr_pll_carriertracking_cc */ -class gr_pll_refout_cc : public gr_sync_block, public gri_control_loop +class GR_CORE_API gr_pll_refout_cc : public gr_sync_block, public gri_control_loop { - friend gr_pll_refout_cc_sptr gr_make_pll_refout_cc (float loop_bw, + friend GR_CORE_API gr_pll_refout_cc_sptr gr_make_pll_refout_cc (float loop_bw, float max_freq, float min_freq); gr_pll_refout_cc (float loop_bw, float max_freq, float min_freq); diff --git a/gnuradio-core/src/lib/general/gr_pn_correlator_cc.h b/gnuradio-core/src/lib/general/gr_pn_correlator_cc.h index 73bb7aa8c..75e2d1c7b 100644 --- a/gnuradio-core/src/lib/general/gr_pn_correlator_cc.h +++ b/gnuradio-core/src/lib/general/gr_pn_correlator_cc.h @@ -23,13 +23,14 @@ #ifndef INCLUDED_GR_PN_CORRELATOR_CC_H #define INCLUDED_GR_PN_CORRELATOR_CC_H +#include <gr_core_api.h> #include <gr_sync_decimator.h> #include <gri_glfsr.h> class gr_pn_correlator_cc; typedef boost::shared_ptr<gr_pn_correlator_cc> gr_pn_correlator_cc_sptr; -gr_pn_correlator_cc_sptr +GR_CORE_API gr_pn_correlator_cc_sptr gr_make_pn_correlator_cc(int degree, int mask=0, int seed=1); /*! * \brief PN code sequential search correlator @@ -39,9 +40,9 @@ gr_make_pn_correlator_cc(int degree, int mask=0, int seed=1); * reference PN code, one sample per PN code period */ -class gr_pn_correlator_cc : public gr_sync_decimator +class GR_CORE_API gr_pn_correlator_cc : public gr_sync_decimator { - friend gr_pn_correlator_cc_sptr gr_make_pn_correlator_cc(int degree, int mask, int seed); + friend GR_CORE_API gr_pn_correlator_cc_sptr gr_make_pn_correlator_cc(int degree, int mask, int seed); int d_len; float d_pn; diff --git a/gnuradio-core/src/lib/general/gr_prefs.h b/gnuradio-core/src/lib/general/gr_prefs.h index 4396d727c..8ceb5b465 100644 --- a/gnuradio-core/src/lib/general/gr_prefs.h +++ b/gnuradio-core/src/lib/general/gr_prefs.h @@ -22,6 +22,7 @@ #ifndef INCLUDED_GR_PREFS_H #define INCLUDED_GR_PREFS_H +#include <gr_core_api.h> #include <string> /*! @@ -32,7 +33,7 @@ * via the magic of SWIG directors. */ -class gr_prefs +class GR_CORE_API gr_prefs { public: static gr_prefs *singleton(); diff --git a/gnuradio-core/src/lib/general/gr_probe_avg_mag_sqrd_c.h b/gnuradio-core/src/lib/general/gr_probe_avg_mag_sqrd_c.h index ee8872010..e857686a8 100644 --- a/gnuradio-core/src/lib/general/gr_probe_avg_mag_sqrd_c.h +++ b/gnuradio-core/src/lib/general/gr_probe_avg_mag_sqrd_c.h @@ -22,13 +22,14 @@ #ifndef INCLUDED_GR_PROBE_AVG_MAG_SQRD_C_H #define INCLUDED_GR_PROBE_AVG_MAG_SQRD_C_H +#include <gr_core_api.h> #include <gr_sync_block.h> #include <gr_single_pole_iir.h> class gr_probe_avg_mag_sqrd_c; typedef boost::shared_ptr<gr_probe_avg_mag_sqrd_c> gr_probe_avg_mag_sqrd_c_sptr; -gr_probe_avg_mag_sqrd_c_sptr +GR_CORE_API gr_probe_avg_mag_sqrd_c_sptr gr_make_probe_avg_mag_sqrd_c (double threshold_db, double alpha = 0.0001); /*! @@ -41,14 +42,14 @@ gr_make_probe_avg_mag_sqrd_c (double threshold_db, double alpha = 0.0001); * The level and indication as to whether the level exceeds threshold * can be retrieved with the level and unmuted accessors. */ -class gr_probe_avg_mag_sqrd_c : public gr_sync_block +class GR_CORE_API gr_probe_avg_mag_sqrd_c : public gr_sync_block { double d_threshold; gr_single_pole_iir<double,double,double> d_iir; bool d_unmuted; double d_level; - friend gr_probe_avg_mag_sqrd_c_sptr + friend GR_CORE_API gr_probe_avg_mag_sqrd_c_sptr gr_make_probe_avg_mag_sqrd_c (double threshold_db, double alpha); gr_probe_avg_mag_sqrd_c (double threshold_db, double alpha); diff --git a/gnuradio-core/src/lib/general/gr_probe_avg_mag_sqrd_cf.h b/gnuradio-core/src/lib/general/gr_probe_avg_mag_sqrd_cf.h index 6c536ca5b..a85afcf3b 100644 --- a/gnuradio-core/src/lib/general/gr_probe_avg_mag_sqrd_cf.h +++ b/gnuradio-core/src/lib/general/gr_probe_avg_mag_sqrd_cf.h @@ -22,13 +22,14 @@ #ifndef INCLUDED_GR_PROBE_AVG_MAG_SQRD_CF_H #define INCLUDED_GR_PROBE_AVG_MAG_SQRD_CF_H +#include <gr_core_api.h> #include <gr_sync_block.h> #include <gr_single_pole_iir.h> class gr_probe_avg_mag_sqrd_cf; typedef boost::shared_ptr<gr_probe_avg_mag_sqrd_cf> gr_probe_avg_mag_sqrd_cf_sptr; -gr_probe_avg_mag_sqrd_cf_sptr +GR_CORE_API gr_probe_avg_mag_sqrd_cf_sptr gr_make_probe_avg_mag_sqrd_cf (double threshold_db, double alpha = 0.0001); /*! @@ -43,14 +44,14 @@ gr_make_probe_avg_mag_sqrd_cf (double threshold_db, double alpha = 0.0001); * can be retrieved with the level and unmuted accessors. * */ -class gr_probe_avg_mag_sqrd_cf : public gr_sync_block +class GR_CORE_API gr_probe_avg_mag_sqrd_cf : public gr_sync_block { double d_threshold; gr_single_pole_iir<double,double,double> d_iir; bool d_unmuted; double d_level; - friend gr_probe_avg_mag_sqrd_cf_sptr + friend GR_CORE_API gr_probe_avg_mag_sqrd_cf_sptr gr_make_probe_avg_mag_sqrd_cf (double threshold_db, double alpha); gr_probe_avg_mag_sqrd_cf (double threshold_db, double alpha); diff --git a/gnuradio-core/src/lib/general/gr_probe_avg_mag_sqrd_f.h b/gnuradio-core/src/lib/general/gr_probe_avg_mag_sqrd_f.h index b31e54f6b..4181ccf46 100644 --- a/gnuradio-core/src/lib/general/gr_probe_avg_mag_sqrd_f.h +++ b/gnuradio-core/src/lib/general/gr_probe_avg_mag_sqrd_f.h @@ -22,13 +22,14 @@ #ifndef INCLUDED_GR_PROBE_AVG_MAG_SQRD_F_H #define INCLUDED_GR_PROBE_AVG_MAG_SQRD_F_H +#include <gr_core_api.h> #include <gr_sync_block.h> #include <gr_single_pole_iir.h> class gr_probe_avg_mag_sqrd_f; typedef boost::shared_ptr<gr_probe_avg_mag_sqrd_f> gr_probe_avg_mag_sqrd_f_sptr; -gr_probe_avg_mag_sqrd_f_sptr +GR_CORE_API gr_probe_avg_mag_sqrd_f_sptr gr_make_probe_avg_mag_sqrd_f (double threshold_db, double alpha = 0.0001); /*! @@ -41,14 +42,14 @@ gr_make_probe_avg_mag_sqrd_f (double threshold_db, double alpha = 0.0001); * The level and indication as to whether the level exceeds threshold * can be retrieved with the level and unmuted accessors. */ -class gr_probe_avg_mag_sqrd_f : public gr_sync_block +class GR_CORE_API gr_probe_avg_mag_sqrd_f : public gr_sync_block { double d_threshold; gr_single_pole_iir<double,double,double> d_iir; bool d_unmuted; double d_level; - friend gr_probe_avg_mag_sqrd_f_sptr + friend GR_CORE_API gr_probe_avg_mag_sqrd_f_sptr gr_make_probe_avg_mag_sqrd_f (double threshold_db, double alpha); gr_probe_avg_mag_sqrd_f (double threshold_db, double alpha); diff --git a/gnuradio-core/src/lib/general/gr_probe_density_b.h b/gnuradio-core/src/lib/general/gr_probe_density_b.h index 92b98d193..0af30c665 100644 --- a/gnuradio-core/src/lib/general/gr_probe_density_b.h +++ b/gnuradio-core/src/lib/general/gr_probe_density_b.h @@ -20,13 +20,14 @@ #ifndef INCLUDED_GR_PROBE_DENSITY_B_H #define INCLUDED_GR_PROBE_DENSITY_B_H +#include <gr_core_api.h> #include <gr_sync_block.h> class gr_probe_density_b; typedef boost::shared_ptr<gr_probe_density_b> gr_probe_density_b_sptr; -gr_probe_density_b_sptr gr_make_probe_density_b(double alpha); +GR_CORE_API gr_probe_density_b_sptr gr_make_probe_density_b(double alpha); /*! * This block maintains a running average of the input stream and @@ -40,10 +41,10 @@ gr_probe_density_b_sptr gr_make_probe_density_b(double alpha); * */ -class gr_probe_density_b : public gr_sync_block +class GR_CORE_API gr_probe_density_b : public gr_sync_block { private: - friend gr_probe_density_b_sptr gr_make_probe_density_b(double alpha); + friend GR_CORE_API gr_probe_density_b_sptr gr_make_probe_density_b(double alpha); double d_alpha; double d_beta; diff --git a/gnuradio-core/src/lib/general/gr_probe_mpsk_snr_c.h b/gnuradio-core/src/lib/general/gr_probe_mpsk_snr_c.h index 279a4a5b8..870e46701 100644 --- a/gnuradio-core/src/lib/general/gr_probe_mpsk_snr_c.h +++ b/gnuradio-core/src/lib/general/gr_probe_mpsk_snr_c.h @@ -22,12 +22,13 @@ #ifndef INCLUDED_GR_PROBE_MPSK_SNR_C_H #define INCLUDED_GR_PROBE_MPSK_SNR_C_H +#include <gr_core_api.h> #include <gr_sync_block.h> class gr_probe_mpsk_snr_c; typedef boost::shared_ptr<gr_probe_mpsk_snr_c> gr_probe_mpsk_snr_c_sptr; -gr_probe_mpsk_snr_c_sptr +GR_CORE_API gr_probe_mpsk_snr_c_sptr gr_make_probe_mpsk_snr_c(double alpha = 0.0001); /*! @@ -46,7 +47,7 @@ gr_make_probe_mpsk_snr_c(double alpha = 0.0001); * This SNR estimator is inaccurate below about 7dB SNR. * */ -class gr_probe_mpsk_snr_c : public gr_sync_block +class GR_CORE_API gr_probe_mpsk_snr_c : public gr_sync_block { double d_alpha; double d_beta; @@ -54,7 +55,7 @@ class gr_probe_mpsk_snr_c : public gr_sync_block double d_noise_variance; // Factory function returning shared pointer of this class - friend gr_probe_mpsk_snr_c_sptr + friend GR_CORE_API gr_probe_mpsk_snr_c_sptr gr_make_probe_mpsk_snr_c(double alpha); // Private constructor diff --git a/gnuradio-core/src/lib/general/gr_probe_signal_f.h b/gnuradio-core/src/lib/general/gr_probe_signal_f.h index 9605bb685..b99c76976 100644 --- a/gnuradio-core/src/lib/general/gr_probe_signal_f.h +++ b/gnuradio-core/src/lib/general/gr_probe_signal_f.h @@ -22,23 +22,24 @@ #ifndef INCLUDED_GR_PROBE_SIGNAL_F_H #define INCLUDED_GR_PROBE_SIGNAL_F_H +#include <gr_core_api.h> #include <gr_sync_block.h> class gr_probe_signal_f; typedef boost::shared_ptr<gr_probe_signal_f> gr_probe_signal_f_sptr; -gr_probe_signal_f_sptr +GR_CORE_API gr_probe_signal_f_sptr gr_make_probe_signal_f (); /*! * \brief Sink that allows a sample to be grabbed from Python. * \ingroup sink_blk */ -class gr_probe_signal_f : public gr_sync_block +class GR_CORE_API gr_probe_signal_f : public gr_sync_block { float d_level; - friend gr_probe_signal_f_sptr + friend GR_CORE_API gr_probe_signal_f_sptr gr_make_probe_signal_f(); gr_probe_signal_f(); diff --git a/gnuradio-core/src/lib/general/gr_pwr_squelch_cc.h b/gnuradio-core/src/lib/general/gr_pwr_squelch_cc.h index 9c519f383..2a008d92d 100644 --- a/gnuradio-core/src/lib/general/gr_pwr_squelch_cc.h +++ b/gnuradio-core/src/lib/general/gr_pwr_squelch_cc.h @@ -23,6 +23,7 @@ #ifndef INCLUDED_GR_PWR_SQUELCH_CC_H #define INCLUDED_GR_PWR_SQUELCH_CC_H +#include <gr_core_api.h> #include <cmath> #include <gr_squelch_base_cc.h> #include <gr_single_pole_iir.h> @@ -30,21 +31,21 @@ class gr_pwr_squelch_cc; typedef boost::shared_ptr<gr_pwr_squelch_cc> gr_pwr_squelch_cc_sptr; -gr_pwr_squelch_cc_sptr +GR_CORE_API gr_pwr_squelch_cc_sptr gr_make_pwr_squelch_cc(double db, double alpha = 0.0001, int ramp=0, bool gate=false); /*! * \brief gate or zero output when input power below threshold * \ingroup level_blk */ -class gr_pwr_squelch_cc : public gr_squelch_base_cc +class GR_CORE_API gr_pwr_squelch_cc : public gr_squelch_base_cc { private: double d_threshold; double d_pwr; gr_single_pole_iir<double,double,double> d_iir; - friend gr_pwr_squelch_cc_sptr gr_make_pwr_squelch_cc(double db, double alpha, int ramp, bool gate); + friend GR_CORE_API gr_pwr_squelch_cc_sptr gr_make_pwr_squelch_cc(double db, double alpha, int ramp, bool gate); gr_pwr_squelch_cc(double db, double alpha, int ramp, bool gate); protected: diff --git a/gnuradio-core/src/lib/general/gr_pwr_squelch_ff.h b/gnuradio-core/src/lib/general/gr_pwr_squelch_ff.h index 6952dbce2..27a7306b3 100644 --- a/gnuradio-core/src/lib/general/gr_pwr_squelch_ff.h +++ b/gnuradio-core/src/lib/general/gr_pwr_squelch_ff.h @@ -23,6 +23,7 @@ #ifndef INCLUDED_GR_PWR_SQUELCH_FF_H #define INCLUDED_GR_PWR_SQUELCH_FF_H +#include <gr_core_api.h> #include <cmath> #include <gr_squelch_base_ff.h> #include <gr_single_pole_iir.h> @@ -30,21 +31,21 @@ class gr_pwr_squelch_ff; typedef boost::shared_ptr<gr_pwr_squelch_ff> gr_pwr_squelch_ff_sptr; -gr_pwr_squelch_ff_sptr +GR_CORE_API gr_pwr_squelch_ff_sptr gr_make_pwr_squelch_ff(double db, double alpha = 0.0001, int ramp=0, bool gate=false); /*! * \brief gate or zero output when input power below threshold * \ingroup level_blk */ -class gr_pwr_squelch_ff : public gr_squelch_base_ff +class GR_CORE_API gr_pwr_squelch_ff : public gr_squelch_base_ff { private: double d_threshold; double d_pwr; gr_single_pole_iir<double,double,double> d_iir; - friend gr_pwr_squelch_ff_sptr gr_make_pwr_squelch_ff(double db, double alpha, int ramp, bool gate); + friend GR_CORE_API gr_pwr_squelch_ff_sptr gr_make_pwr_squelch_ff(double db, double alpha, int ramp, bool gate); gr_pwr_squelch_ff(double db, double alpha, int ramp, bool gate); protected: diff --git a/gnuradio-core/src/lib/general/gr_quadrature_demod_cf.h b/gnuradio-core/src/lib/general/gr_quadrature_demod_cf.h index df6de93d5..755f2839a 100644 --- a/gnuradio-core/src/lib/general/gr_quadrature_demod_cf.h +++ b/gnuradio-core/src/lib/general/gr_quadrature_demod_cf.h @@ -23,11 +23,12 @@ #ifndef INCLUDED_GR_QUADRATURE_DEMOD_CF_H #define INCLUDED_GR_QUADRATURE_DEMOD_CF_H +#include <gr_core_api.h> #include <gr_sync_block.h> class gr_quadrature_demod_cf; typedef boost::shared_ptr<gr_quadrature_demod_cf> gr_quadrature_demod_cf_sptr; -gr_quadrature_demod_cf_sptr gr_make_quadrature_demod_cf (float gain); +GR_CORE_API gr_quadrature_demod_cf_sptr gr_make_quadrature_demod_cf (float gain); /*! * \brief quadrature demodulator: complex in, float out @@ -36,9 +37,9 @@ gr_quadrature_demod_cf_sptr gr_make_quadrature_demod_cf (float gain); * This can be used to demod FM, FSK, GMSK, etc. * The input is complex baseband. */ -class gr_quadrature_demod_cf : public gr_sync_block +class GR_CORE_API gr_quadrature_demod_cf : public gr_sync_block { - friend gr_quadrature_demod_cf_sptr gr_make_quadrature_demod_cf (float gain); + friend GR_CORE_API gr_quadrature_demod_cf_sptr gr_make_quadrature_demod_cf (float gain); gr_quadrature_demod_cf (float gain); float d_gain; diff --git a/gnuradio-core/src/lib/general/gr_rail_ff.h b/gnuradio-core/src/lib/general/gr_rail_ff.h index d9e19a964..225bdf36e 100644 --- a/gnuradio-core/src/lib/general/gr_rail_ff.h +++ b/gnuradio-core/src/lib/general/gr_rail_ff.h @@ -23,6 +23,7 @@ #ifndef INCLUDED_GR_RAIL_FF_H_ # define INCLUDED_GR_RAIL_FF_H_ +#include <gr_core_api.h> #include <gr_sync_block.h> /*! @@ -33,11 +34,11 @@ class gr_rail_ff; typedef boost::shared_ptr<gr_rail_ff> gr_rail_ff_sptr; -gr_rail_ff_sptr gr_make_rail_ff(float lo, float hi); +GR_CORE_API gr_rail_ff_sptr gr_make_rail_ff(float lo, float hi); -class gr_rail_ff : public gr_sync_block +class GR_CORE_API gr_rail_ff : public gr_sync_block { - friend gr_rail_ff_sptr gr_make_rail_ff (float lo, float hi); + friend GR_CORE_API gr_rail_ff_sptr gr_make_rail_ff (float lo, float hi); float d_lo, d_hi; // the constant gr_rail_ff(float lo, float hi); diff --git a/gnuradio-core/src/lib/general/gr_random.cc b/gnuradio-core/src/lib/general/gr_random.cc index 67f760006..52140acc2 100644 --- a/gnuradio-core/src/lib/general/gr_random.cc +++ b/gnuradio-core/src/lib/general/gr_random.cc @@ -35,6 +35,9 @@ * */ +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif #include <math.h> #include <gr_random.h> diff --git a/gnuradio-core/src/lib/general/gr_random.h b/gnuradio-core/src/lib/general/gr_random.h index e5002fd33..13dbbfb04 100644 --- a/gnuradio-core/src/lib/general/gr_random.h +++ b/gnuradio-core/src/lib/general/gr_random.h @@ -23,13 +23,14 @@ #ifndef INCLUDED_GR_RANDOM_H #define INCLUDED_GR_RANDOM_H +#include <gr_core_api.h> #include <gr_complex.h> /*! * \brief pseudo random number generator * \ingroup math_blk */ -class gr_random { +class GR_CORE_API gr_random { protected: static const int NTAB = 32; long d_seed; diff --git a/gnuradio-core/src/lib/general/gr_regenerate_bb.h b/gnuradio-core/src/lib/general/gr_regenerate_bb.h index db511b228..67cfedac7 100644 --- a/gnuradio-core/src/lib/general/gr_regenerate_bb.h +++ b/gnuradio-core/src/lib/general/gr_regenerate_bb.h @@ -23,12 +23,13 @@ #ifndef INCLUDED_GR_REGENERATE_BB_H #define INCLUDED_GR_REGENERATE_BB_H +#include <gr_core_api.h> #include <gr_sync_block.h> class gr_regenerate_bb; typedef boost::shared_ptr<gr_regenerate_bb> gr_regenerate_bb_sptr; -gr_regenerate_bb_sptr gr_make_regenerate_bb (int period, unsigned int max_regen=500); +GR_CORE_API gr_regenerate_bb_sptr gr_make_regenerate_bb (int period, unsigned int max_regen=500); /*! * \brief Detect the peak of a signal and repeat every period samples @@ -40,7 +41,7 @@ gr_regenerate_bb_sptr gr_make_regenerate_bb (int period, unsigned int max_regen= * * Note that if max_regen=(-1)/ULONG_MAX then the regeneration will run forever. */ -class gr_regenerate_bb : public gr_sync_block +class GR_CORE_API gr_regenerate_bb : public gr_sync_block { /*! * \brief Make a regenerate block @@ -48,7 +49,7 @@ class gr_regenerate_bb : public gr_sync_block * \param max_regen The maximum number of regenerations to perform; if set to * ULONG_MAX, it will regenerate continuously. */ - friend gr_regenerate_bb_sptr gr_make_regenerate_bb (int period, unsigned int max_regen); + friend GR_CORE_API gr_regenerate_bb_sptr gr_make_regenerate_bb (int period, unsigned int max_regen); gr_regenerate_bb (int period, unsigned int max_regen); diff --git a/gnuradio-core/src/lib/general/gr_remez.h b/gnuradio-core/src/lib/general/gr_remez.h index 85e1516a5..f7b8a72a3 100644 --- a/gnuradio-core/src/lib/general/gr_remez.h +++ b/gnuradio-core/src/lib/general/gr_remez.h @@ -23,6 +23,7 @@ #ifndef INCLUDED_GR_REMEZ_H #define INCLUDED_GR_REMEZ_H +#include <gr_core_api.h> #include <gr_types.h> #include <string> #include <stdexcept> @@ -51,7 +52,7 @@ * \throws std::runtime_error if args are invalid or calculation fails to converge. */ -std::vector<double> +GR_CORE_API std::vector<double> gr_remez (int order, const std::vector<double> &bands, const std::vector<double> &l, diff --git a/gnuradio-core/src/lib/general/gr_repeat.h b/gnuradio-core/src/lib/general/gr_repeat.h index f323fc375..b90f2f51d 100644 --- a/gnuradio-core/src/lib/general/gr_repeat.h +++ b/gnuradio-core/src/lib/general/gr_repeat.h @@ -22,23 +22,24 @@ #ifndef INCLUDED_GR_REPEAT_H #define INCLUDED_GR_REPEAT_H +#include <gr_core_api.h> #include <gr_sync_interpolator.h> class gr_repeat; typedef boost::shared_ptr<gr_repeat> gr_repeat_sptr; -gr_repeat_sptr gr_make_repeat(size_t itemsize, int interp); +GR_CORE_API gr_repeat_sptr gr_make_repeat(size_t itemsize, int interp); /*! * \brief Repeat a sample 'interp' times in output stream * \ingroup misc_blk */ -class gr_repeat : public gr_sync_interpolator +class GR_CORE_API gr_repeat : public gr_sync_interpolator { private: - friend gr_repeat_sptr gr_make_repeat(size_t itemsize, int interp); + friend GR_CORE_API gr_repeat_sptr gr_make_repeat(size_t itemsize, int interp); gr_repeat(size_t itemsize, int interp); diff --git a/gnuradio-core/src/lib/general/gr_reverse.h b/gnuradio-core/src/lib/general/gr_reverse.h index d79d34e91..43d84fda7 100644 --- a/gnuradio-core/src/lib/general/gr_reverse.h +++ b/gnuradio-core/src/lib/general/gr_reverse.h @@ -22,6 +22,7 @@ #ifndef INCLUDED_GR_REVERSE_H #define INCLUDED_GR_REVERSE_H +#include <gr_core_api.h> #include <vector> #include <gr_complex.h> diff --git a/gnuradio-core/src/lib/general/gr_rms_cf.h b/gnuradio-core/src/lib/general/gr_rms_cf.h index 86c4bdbac..f1bd9802c 100644 --- a/gnuradio-core/src/lib/general/gr_rms_cf.h +++ b/gnuradio-core/src/lib/general/gr_rms_cf.h @@ -22,25 +22,26 @@ #ifndef INCLUDED_GR_RMS_CF_H #define INCLUDED_GR_RMS_CF_H +#include <gr_core_api.h> #include <gr_sync_block.h> #include <gr_single_pole_iir.h> class gr_rms_cf; typedef boost::shared_ptr<gr_rms_cf> gr_rms_cf_sptr; -gr_rms_cf_sptr +GR_CORE_API gr_rms_cf_sptr gr_make_rms_cf (double alpha = 0.0001); /*! * \brief RMS average power * \ingroup math_blk */ -class gr_rms_cf : public gr_sync_block +class GR_CORE_API gr_rms_cf : public gr_sync_block { gr_single_pole_iir<double,double,double> d_iir; bool d_unmuted; - friend gr_rms_cf_sptr + friend GR_CORE_API gr_rms_cf_sptr gr_make_rms_cf (double alpha); gr_rms_cf (double alpha); diff --git a/gnuradio-core/src/lib/general/gr_rms_ff.h b/gnuradio-core/src/lib/general/gr_rms_ff.h index ed1635eb1..0bbd53b70 100644 --- a/gnuradio-core/src/lib/general/gr_rms_ff.h +++ b/gnuradio-core/src/lib/general/gr_rms_ff.h @@ -22,25 +22,26 @@ #ifndef INCLUDED_GR_RMS_FF_H #define INCLUDED_GR_RMS_FF_H +#include <gr_core_api.h> #include <gr_sync_block.h> #include <gr_single_pole_iir.h> class gr_rms_ff; typedef boost::shared_ptr<gr_rms_ff> gr_rms_ff_sptr; -gr_rms_ff_sptr +GR_CORE_API gr_rms_ff_sptr gr_make_rms_ff (double alpha = 0.0001); /*! * \brief RMS average power * \ingroup math_blk */ -class gr_rms_ff : public gr_sync_block +class GR_CORE_API gr_rms_ff : public gr_sync_block { gr_single_pole_iir<double,double,double> d_iir; bool d_unmuted; - friend gr_rms_ff_sptr + friend GR_CORE_API gr_rms_ff_sptr gr_make_rms_ff (double alpha); gr_rms_ff (double alpha); diff --git a/gnuradio-core/src/lib/general/gr_scrambler_bb.h b/gnuradio-core/src/lib/general/gr_scrambler_bb.h index 7efe8b598..79905933d 100644 --- a/gnuradio-core/src/lib/general/gr_scrambler_bb.h +++ b/gnuradio-core/src/lib/general/gr_scrambler_bb.h @@ -22,13 +22,14 @@ #ifndef INCLUDED_GR_SCRAMBLER_BB_H #define INCLUDED_GR_SCRAMBLER_BB_H +#include <gr_core_api.h> #include <gr_sync_block.h> #include "gri_lfsr.h" class gr_scrambler_bb; typedef boost::shared_ptr<gr_scrambler_bb> gr_scrambler_bb_sptr; -gr_scrambler_bb_sptr gr_make_scrambler_bb(int mask, int seed, int len); +GR_CORE_API gr_scrambler_bb_sptr gr_make_scrambler_bb(int mask, int seed, int len); /*! * Scramble an input stream using an LFSR. This block works on the LSB only @@ -42,9 +43,9 @@ gr_scrambler_bb_sptr gr_make_scrambler_bb(int mask, int seed, int len); * \ingroup coding_blk */ -class gr_scrambler_bb : public gr_sync_block +class GR_CORE_API gr_scrambler_bb : public gr_sync_block { - friend gr_scrambler_bb_sptr gr_make_scrambler_bb(int mask, int seed, int len); + friend GR_CORE_API gr_scrambler_bb_sptr gr_make_scrambler_bb(int mask, int seed, int len); gri_lfsr d_lfsr; diff --git a/gnuradio-core/src/lib/general/gr_short_to_float.h b/gnuradio-core/src/lib/general/gr_short_to_float.h index ccb19d9f2..b40c966ea 100644 --- a/gnuradio-core/src/lib/general/gr_short_to_float.h +++ b/gnuradio-core/src/lib/general/gr_short_to_float.h @@ -23,12 +23,13 @@ #ifndef INCLUDED_GR_SHORT_TO_FLOAT_H #define INCLUDED_GR_SHORT_TO_FLOAT_H +#include <gr_core_api.h> #include <gr_sync_block.h> class gr_short_to_float; typedef boost::shared_ptr<gr_short_to_float> gr_short_to_float_sptr; -gr_short_to_float_sptr +GR_CORE_API gr_short_to_float_sptr gr_make_short_to_float (); /*! @@ -36,9 +37,9 @@ gr_make_short_to_float (); * \ingroup converter_blk */ -class gr_short_to_float : public gr_sync_block +class GR_CORE_API gr_short_to_float : public gr_sync_block { - friend gr_short_to_float_sptr gr_make_short_to_float (); + friend GR_CORE_API gr_short_to_float_sptr gr_make_short_to_float (); gr_short_to_float (); public: diff --git a/gnuradio-core/src/lib/general/gr_simple_correlator.cc b/gnuradio-core/src/lib/general/gr_simple_correlator.cc index 01c007122..bdfa73ef3 100644 --- a/gnuradio-core/src/lib/general/gr_simple_correlator.cc +++ b/gnuradio-core/src/lib/general/gr_simple_correlator.cc @@ -50,6 +50,7 @@ gr_simple_correlator::gr_simple_correlator (int payload_bytesize) d_state (ST_LOOKING), d_osi (0), d_bblen ((payload_bytesize + GRSF_PAYLOAD_OVERHEAD) * GRSF_BITS_PER_BYTE), d_bitbuf (new unsigned char [d_bblen]), + d_pktbuf (new unsigned char [d_bblen/GRSF_BITS_PER_BYTE]), d_bbi (0) { d_avbi = 0; @@ -71,6 +72,7 @@ gr_simple_correlator::~gr_simple_correlator () fclose(d_debug_fp); #endif delete [] d_bitbuf; + delete [] d_pktbuf; } @@ -184,10 +186,9 @@ gr_simple_correlator::general_work (int noutput_items, d_bbi++; if (d_bbi >= d_bblen){ // printf ("got whole packet\n"); - unsigned char pktbuf[d_bblen/GRSF_BITS_PER_BYTE]; - packit (pktbuf, d_bitbuf, d_bbi); - printf ("seqno %3d\n", pktbuf[0]); - memcpy (out, &pktbuf[GRSF_PAYLOAD_OVERHEAD], d_payload_bytesize); + packit (d_pktbuf, d_bitbuf, d_bbi); + printf ("seqno %3d\n", d_pktbuf[0]); + memcpy (out, &d_pktbuf[GRSF_PAYLOAD_OVERHEAD], d_payload_bytesize); enter_looking (); consume_each (n + 1); return d_payload_bytesize; diff --git a/gnuradio-core/src/lib/general/gr_simple_correlator.h b/gnuradio-core/src/lib/general/gr_simple_correlator.h index b21d38a04..4c5f060cd 100644 --- a/gnuradio-core/src/lib/general/gr_simple_correlator.h +++ b/gnuradio-core/src/lib/general/gr_simple_correlator.h @@ -23,6 +23,7 @@ #ifndef INCLUDED_GR_SIMPLE_CORRELATOR_H #define INCLUDED_GR_SIMPLE_CORRELATOR_H +#include <gr_core_api.h> #include <gr_block.h> #include <assert.h> @@ -31,13 +32,13 @@ class gr_simple_correlator; typedef boost::shared_ptr<gr_simple_correlator> gr_simple_correlator_sptr; -gr_simple_correlator_sptr gr_make_simple_correlator (int payload_bytesize); +GR_CORE_API gr_simple_correlator_sptr gr_make_simple_correlator (int payload_bytesize); /*! * \brief inverse of gr_simple_framer (more or less) * \ingroup sync_blk */ -class gr_simple_correlator : public gr_block +class GR_CORE_API gr_simple_correlator : public gr_block { static const int OVERSAMPLE = 8; enum state_t { ST_LOOKING, ST_UNDER_THRESHOLD, ST_LOCKED }; @@ -50,6 +51,7 @@ class gr_simple_correlator : public gr_block unsigned long long int d_shift_reg[OVERSAMPLE]; int d_bblen; // length of bitbuf unsigned char *d_bitbuf; // demodulated bits + unsigned char *d_pktbuf; // temp packet buf int d_bbi; // bitbuf index static const int AVG_PERIOD = 512; // must be power of 2 (for freq offset correction) @@ -62,7 +64,7 @@ class gr_simple_correlator : public gr_block FILE *d_debug_fp; // binary log file #endif - friend gr_simple_correlator_sptr gr_make_simple_correlator (int payload_bytesize); + friend GR_CORE_API gr_simple_correlator_sptr gr_make_simple_correlator (int payload_bytesize); gr_simple_correlator (int payload_bytesize); diff --git a/gnuradio-core/src/lib/general/gr_simple_framer.h b/gnuradio-core/src/lib/general/gr_simple_framer.h index d930da33b..15f392e4a 100644 --- a/gnuradio-core/src/lib/general/gr_simple_framer.h +++ b/gnuradio-core/src/lib/general/gr_simple_framer.h @@ -23,25 +23,26 @@ #ifndef INCLUDED_GR_SIMPLE_FRAMER_H #define INCLUDED_GR_SIMPLE_FRAMER_H +#include <gr_core_api.h> #include <gr_block.h> class gr_simple_framer; typedef boost::shared_ptr<gr_simple_framer> gr_simple_framer_sptr; -gr_simple_framer_sptr gr_make_simple_framer (int payload_bytesize); +GR_CORE_API gr_simple_framer_sptr gr_make_simple_framer (int payload_bytesize); /*! * \brief add sync field, seq number and command field to payload * \ingroup sync_blk */ -class gr_simple_framer : public gr_block +class GR_CORE_API gr_simple_framer : public gr_block { int d_seqno; int d_payload_bytesize; int d_input_block_size; // bytes int d_output_block_size; // bytes - friend gr_simple_framer_sptr gr_make_simple_framer (int payload_bytesize); + friend GR_CORE_API gr_simple_framer_sptr gr_make_simple_framer (int payload_bytesize); gr_simple_framer (int payload_bytesize); public: diff --git a/gnuradio-core/src/lib/general/gr_simple_squelch_cc.h b/gnuradio-core/src/lib/general/gr_simple_squelch_cc.h index 30744f6fb..590b86de8 100644 --- a/gnuradio-core/src/lib/general/gr_simple_squelch_cc.h +++ b/gnuradio-core/src/lib/general/gr_simple_squelch_cc.h @@ -22,26 +22,27 @@ #ifndef INCLUDED_GR_SIMPLE_SQUELCH_CC_H #define INCLUDED_GR_SIMPLE_SQUELCH_CC_H +#include <gr_core_api.h> #include <gr_sync_block.h> #include <gr_single_pole_iir.h> class gr_simple_squelch_cc; typedef boost::shared_ptr<gr_simple_squelch_cc> gr_simple_squelch_cc_sptr; -gr_simple_squelch_cc_sptr +GR_CORE_API gr_simple_squelch_cc_sptr gr_make_simple_squelch_cc (double threshold_db, double alpha = 0.0001); /*! * \brief simple squelch block based on average signal power and threshold in dB. * \ingroup level_blk */ -class gr_simple_squelch_cc : public gr_sync_block +class GR_CORE_API gr_simple_squelch_cc : public gr_sync_block { double d_threshold; gr_single_pole_iir<double,double,double> d_iir; bool d_unmuted; - friend gr_simple_squelch_cc_sptr + friend GR_CORE_API gr_simple_squelch_cc_sptr gr_make_simple_squelch_cc (double threshold_db, double alpha); gr_simple_squelch_cc (double threshold_db, double alpha); diff --git a/gnuradio-core/src/lib/general/gr_skiphead.h b/gnuradio-core/src/lib/general/gr_skiphead.h index 933c126e3..2beaaeab0 100644 --- a/gnuradio-core/src/lib/general/gr_skiphead.h +++ b/gnuradio-core/src/lib/general/gr_skiphead.h @@ -23,12 +23,16 @@ #ifndef INCLUDED_GR_SKIPHEAD_H #define INCLUDED_GR_SKIPHEAD_H +#include <gr_core_api.h> #include <gr_sync_block.h> #include <stddef.h> // size_t class gr_skiphead; typedef boost::shared_ptr<gr_skiphead> gr_skiphead_sptr; +GR_CORE_API gr_skiphead_sptr +gr_make_skiphead (size_t itemsize, uint64_t nitems_to_skip); + /*! * \brief skips the first N items, from then on copies items to the output @@ -37,9 +41,9 @@ typedef boost::shared_ptr<gr_skiphead> gr_skiphead_sptr; * Useful for building test cases and sources which have metadata or junk at the start */ -class gr_skiphead : public gr_block +class GR_CORE_API gr_skiphead : public gr_block { - friend gr_skiphead_sptr gr_make_skiphead (size_t itemsize, uint64_t nitems_to_skip); + friend GR_CORE_API gr_skiphead_sptr gr_make_skiphead (size_t itemsize, uint64_t nitems_to_skip); gr_skiphead (size_t itemsize, uint64_t nitems_to_skip); uint64_t d_nitems_to_skip; @@ -53,8 +57,4 @@ class gr_skiphead : public gr_block gr_vector_void_star &output_items); }; -gr_skiphead_sptr -gr_make_skiphead (size_t itemsize, uint64_t nitems_to_skip); - - #endif /* INCLUDED_GR_SKIPHEAD_H */ diff --git a/gnuradio-core/src/lib/general/gr_squash_ff.h b/gnuradio-core/src/lib/general/gr_squash_ff.h index ee3426cae..f7fea1648 100644 --- a/gnuradio-core/src/lib/general/gr_squash_ff.h +++ b/gnuradio-core/src/lib/general/gr_squash_ff.h @@ -23,6 +23,7 @@ #ifndef INCLUDED_GR_SQUASH_FF_H_ # define INCLUDED_GR_SQUASH_FF_H_ +#include <gr_core_api.h> #include <gr_sync_block.h> #include <gsl/gsl_errno.h> #include <gsl/gsl_interp.h> @@ -36,12 +37,12 @@ class gr_squash_ff; typedef boost::shared_ptr<gr_squash_ff> gr_squash_ff_sptr; -gr_squash_ff_sptr gr_make_squash_ff(const std::vector<float> &igrid, +GR_CORE_API gr_squash_ff_sptr gr_make_squash_ff(const std::vector<float> &igrid, const std::vector<float> &ogrid); -class gr_squash_ff : public gr_sync_block +class GR_CORE_API gr_squash_ff : public gr_sync_block { - friend gr_squash_ff_sptr gr_make_squash_ff(const std::vector<float> &igrid, + friend GR_CORE_API gr_squash_ff_sptr gr_make_squash_ff(const std::vector<float> &igrid, const std::vector<float> &ogrid); size_t d_inum; diff --git a/gnuradio-core/src/lib/general/gr_squelch_base_cc.h b/gnuradio-core/src/lib/general/gr_squelch_base_cc.h index 51e2e14e5..7c15e0121 100644 --- a/gnuradio-core/src/lib/general/gr_squelch_base_cc.h +++ b/gnuradio-core/src/lib/general/gr_squelch_base_cc.h @@ -23,9 +23,10 @@ #ifndef INCLUDED_GR_SQUELCH_BASE_CC_H #define INCLUDED_GR_SQUELCH_BASE_CC_H +#include <gr_core_api.h> #include <gr_block.h> -class gr_squelch_base_cc : public gr_block +class GR_CORE_API gr_squelch_base_cc : public gr_block { private: int d_ramp; diff --git a/gnuradio-core/src/lib/general/gr_squelch_base_ff.h b/gnuradio-core/src/lib/general/gr_squelch_base_ff.h index 2ca108c75..92a064e63 100644 --- a/gnuradio-core/src/lib/general/gr_squelch_base_ff.h +++ b/gnuradio-core/src/lib/general/gr_squelch_base_ff.h @@ -23,9 +23,10 @@ #ifndef INCLUDED_GR_SQUELCH_BASE_FF_H #define INCLUDED_GR_SQUELCH_BASE_FF_H +#include <gr_core_api.h> #include <gr_block.h> -class gr_squelch_base_ff : public gr_block +class GR_CORE_API gr_squelch_base_ff : public gr_block { private: int d_ramp; diff --git a/gnuradio-core/src/lib/general/gr_stream_mux.h b/gnuradio-core/src/lib/general/gr_stream_mux.h index 29829339e..68415ab1d 100644 --- a/gnuradio-core/src/lib/general/gr_stream_mux.h +++ b/gnuradio-core/src/lib/general/gr_stream_mux.h @@ -24,6 +24,7 @@ #define INCLUDED_GR_STREAM_MUX_H +#include <gr_core_api.h> #include <gr_block.h> #include <vector> @@ -45,7 +46,7 @@ typedef boost::shared_ptr<gr_stream_mux> gr_stream_mux_sptr; -gr_stream_mux_sptr +GR_CORE_API gr_stream_mux_sptr gr_make_stream_mux (size_t itemsize, const std::vector<int> &lengths); @@ -60,9 +61,9 @@ gr_make_stream_mux (size_t itemsize, const std::vector<int> &lengths); * [N0, N1, N2, ..., Nm, N0, N1, ...] */ -class gr_stream_mux : public gr_block +class GR_CORE_API gr_stream_mux : public gr_block { - friend gr_stream_mux_sptr + friend GR_CORE_API gr_stream_mux_sptr gr_make_stream_mux (size_t itemsize, const std::vector<int> &lengths); protected: diff --git a/gnuradio-core/src/lib/general/gr_stream_to_streams.h b/gnuradio-core/src/lib/general/gr_stream_to_streams.h index 2fdd39e4a..905d3c556 100644 --- a/gnuradio-core/src/lib/general/gr_stream_to_streams.h +++ b/gnuradio-core/src/lib/general/gr_stream_to_streams.h @@ -22,12 +22,13 @@ #ifndef INCLUDED_GR_STREAM_TO_STREAMS_H #define INCLUDED_GR_STREAM_TO_STREAMS_H +#include <gr_core_api.h> #include <gr_sync_decimator.h> class gr_stream_to_streams; typedef boost::shared_ptr<gr_stream_to_streams> gr_stream_to_streams_sptr; -gr_stream_to_streams_sptr +GR_CORE_API gr_stream_to_streams_sptr gr_make_stream_to_streams (size_t item_size, size_t nstreams); @@ -38,9 +39,9 @@ gr_make_stream_to_streams (size_t item_size, size_t nstreams); * Converts a stream of N items into N streams of 1 item. * Repeat ad infinitum. */ -class gr_stream_to_streams : public gr_sync_decimator +class GR_CORE_API gr_stream_to_streams : public gr_sync_decimator { - friend gr_stream_to_streams_sptr + friend GR_CORE_API gr_stream_to_streams_sptr gr_make_stream_to_streams (size_t item_size, size_t nstreams); protected: diff --git a/gnuradio-core/src/lib/general/gr_stream_to_vector.h b/gnuradio-core/src/lib/general/gr_stream_to_vector.h index 2cb03f6a8..77272b96b 100644 --- a/gnuradio-core/src/lib/general/gr_stream_to_vector.h +++ b/gnuradio-core/src/lib/general/gr_stream_to_vector.h @@ -23,12 +23,13 @@ #ifndef INCLUDED_GR_STREAM_TO_VECTOR_H #define INCLUDED_GR_STREAM_TO_VECTOR_H +#include <gr_core_api.h> #include <gr_sync_decimator.h> class gr_stream_to_vector; typedef boost::shared_ptr<gr_stream_to_vector> gr_stream_to_vector_sptr; -gr_stream_to_vector_sptr +GR_CORE_API gr_stream_to_vector_sptr gr_make_stream_to_vector (size_t item_size, size_t nitems_per_block); @@ -36,9 +37,9 @@ gr_make_stream_to_vector (size_t item_size, size_t nitems_per_block); * \brief convert a stream of items into a stream of blocks containing nitems_per_block * \ingroup slicedice_blk */ -class gr_stream_to_vector : public gr_sync_decimator +class GR_CORE_API gr_stream_to_vector : public gr_sync_decimator { - friend gr_stream_to_vector_sptr + friend GR_CORE_API gr_stream_to_vector_sptr gr_make_stream_to_vector (size_t item_size, size_t nitems_per_block); protected: diff --git a/gnuradio-core/src/lib/general/gr_streams_to_stream.h b/gnuradio-core/src/lib/general/gr_streams_to_stream.h index 044af6cd2..8207fed42 100644 --- a/gnuradio-core/src/lib/general/gr_streams_to_stream.h +++ b/gnuradio-core/src/lib/general/gr_streams_to_stream.h @@ -22,12 +22,13 @@ #ifndef INCLUDED_GR_STREAMS_TO_STREAM_H #define INCLUDED_GR_STREAMS_TO_STREAM_H +#include <gr_core_api.h> #include <gr_sync_interpolator.h> class gr_streams_to_stream; typedef boost::shared_ptr<gr_streams_to_stream> gr_streams_to_stream_sptr; -gr_streams_to_stream_sptr +GR_CORE_API gr_streams_to_stream_sptr gr_make_streams_to_stream (size_t item_size, size_t nstreams); @@ -38,9 +39,9 @@ gr_make_streams_to_stream (size_t item_size, size_t nstreams); * Convert N streams of 1 item into 1 stream of N items. * Repeat ad infinitum. */ -class gr_streams_to_stream : public gr_sync_interpolator +class GR_CORE_API gr_streams_to_stream : public gr_sync_interpolator { - friend gr_streams_to_stream_sptr + friend GR_CORE_API gr_streams_to_stream_sptr gr_make_streams_to_stream (size_t item_size, size_t nstreams); protected: diff --git a/gnuradio-core/src/lib/general/gr_streams_to_vector.h b/gnuradio-core/src/lib/general/gr_streams_to_vector.h index 1b2e3ebf7..6a05ac90a 100644 --- a/gnuradio-core/src/lib/general/gr_streams_to_vector.h +++ b/gnuradio-core/src/lib/general/gr_streams_to_vector.h @@ -23,12 +23,13 @@ #ifndef INCLUDED_GR_STREAMS_TO_VECTOR_H #define INCLUDED_GR_STREAMS_TO_VECTOR_H +#include <gr_core_api.h> #include <gr_sync_interpolator.h> class gr_streams_to_vector; typedef boost::shared_ptr<gr_streams_to_vector> gr_streams_to_vector_sptr; -gr_streams_to_vector_sptr +GR_CORE_API gr_streams_to_vector_sptr gr_make_streams_to_vector (size_t item_size, size_t nstreams); @@ -36,9 +37,9 @@ gr_make_streams_to_vector (size_t item_size, size_t nstreams); * \brief convert N streams of items to 1 stream of vector length N * \ingroup slicedice_blk */ -class gr_streams_to_vector : public gr_sync_block +class GR_CORE_API gr_streams_to_vector : public gr_sync_block { - friend gr_streams_to_vector_sptr + friend GR_CORE_API gr_streams_to_vector_sptr gr_make_streams_to_vector (size_t item_size, size_t nstreams); protected: diff --git a/gnuradio-core/src/lib/general/gr_stretch_ff.h b/gnuradio-core/src/lib/general/gr_stretch_ff.h index e75e1969f..578634dd8 100644 --- a/gnuradio-core/src/lib/general/gr_stretch_ff.h +++ b/gnuradio-core/src/lib/general/gr_stretch_ff.h @@ -23,6 +23,7 @@ #ifndef INCLUDED_GR_STRETCH_FF_H_ # define INCLUDED_GR_STRETCH_FF_H_ +#include <gr_core_api.h> #include <gr_sync_block.h> /*! @@ -36,11 +37,11 @@ class gr_stretch_ff; typedef boost::shared_ptr<gr_stretch_ff> gr_stretch_ff_sptr; -gr_stretch_ff_sptr gr_make_stretch_ff(float lo, size_t vlen); +GR_CORE_API gr_stretch_ff_sptr gr_make_stretch_ff(float lo, size_t vlen); -class gr_stretch_ff : public gr_sync_block +class GR_CORE_API gr_stretch_ff : public gr_sync_block { - friend gr_stretch_ff_sptr gr_make_stretch_ff(float lo, size_t vlen); + friend GR_CORE_API gr_stretch_ff_sptr gr_make_stretch_ff(float lo, size_t vlen); float d_lo; // the constant size_t d_vlen; diff --git a/gnuradio-core/src/lib/general/gr_test.h b/gnuradio-core/src/lib/general/gr_test.h index 5438ac701..78e39d518 100644 --- a/gnuradio-core/src/lib/general/gr_test.h +++ b/gnuradio-core/src/lib/general/gr_test.h @@ -23,6 +23,7 @@ #ifndef INCLUDED_GR_TEST_H #define INCLUDED_GR_TEST_H +#include <gr_core_api.h> #include <gr_block.h> #include <string> #include "gr_test_types.h" @@ -31,7 +32,7 @@ class gr_test; typedef boost::shared_ptr<gr_test> gr_test_sptr; // public constructor -gr_test_sptr gr_make_test (const std::string &name=std::string("gr_test"), +GR_CORE_API gr_test_sptr gr_make_test (const std::string &name=std::string("gr_test"), int min_inputs=1, int max_inputs=1, unsigned int sizeof_input_item=1, int min_outputs=1, int max_outputs=1, unsigned int sizeof_output_item=1, unsigned int history=1,unsigned int output_multiple=1,double relative_rate=1.0, @@ -50,7 +51,7 @@ gr_test_sptr gr_make_test (const std::string &name=std::string("gr_test"), * The runtime system should detect this and create large enough buffers * all through the signal chain. */ -class gr_test : public gr_block { +class GR_CORE_API gr_test : public gr_block { public: @@ -183,7 +184,7 @@ int general_work (int noutput_items, - friend gr_test_sptr gr_make_test (const std::string &name,int min_inputs, int max_inputs, unsigned int sizeof_input_item, + friend GR_CORE_API gr_test_sptr gr_make_test (const std::string &name,int min_inputs, int max_inputs, unsigned int sizeof_input_item, int min_outputs, int max_outputs, unsigned int sizeof_output_item, unsigned int history,unsigned int output_multiple,double relative_rate, bool fixed_rate,gr_consume_type_t cons_type, gr_produce_type_t prod_type); diff --git a/gnuradio-core/src/lib/general/gr_threshold_ff.h b/gnuradio-core/src/lib/general/gr_threshold_ff.h index 65b677a77..3bf3058cd 100644 --- a/gnuradio-core/src/lib/general/gr_threshold_ff.h +++ b/gnuradio-core/src/lib/general/gr_threshold_ff.h @@ -23,20 +23,21 @@ #ifndef INCLUDED_GR_THRESHOLD_FF_H #define INCLUDED_GR_THRESHOLD_FF_H +#include <gr_core_api.h> #include <gr_sync_block.h> class gr_threshold_ff; typedef boost::shared_ptr<gr_threshold_ff> gr_threshold_ff_sptr; -gr_threshold_ff_sptr gr_make_threshold_ff (float lo, float hi, float initial_state=0); +GR_CORE_API gr_threshold_ff_sptr gr_make_threshold_ff (float lo, float hi, float initial_state=0); /*! * \brief Please fix my documentation * \ingroup misc_blk */ -class gr_threshold_ff : public gr_sync_block +class GR_CORE_API gr_threshold_ff : public gr_sync_block { - friend gr_threshold_ff_sptr gr_make_threshold_ff (float lo, float hi, float initial_state); + friend GR_CORE_API gr_threshold_ff_sptr gr_make_threshold_ff (float lo, float hi, float initial_state); float d_lo,d_hi; // the constant float d_last_state; diff --git a/gnuradio-core/src/lib/general/gr_throttle.h b/gnuradio-core/src/lib/general/gr_throttle.h index a82821f77..0b6ada995 100644 --- a/gnuradio-core/src/lib/general/gr_throttle.h +++ b/gnuradio-core/src/lib/general/gr_throttle.h @@ -22,6 +22,7 @@ #ifndef INCLUDED_GR_THROTTLE_H #define INCLUDED_GR_THROTTLE_H +#include <gr_core_api.h> #include <gr_sync_block.h> /*! @@ -35,7 +36,7 @@ * controlling the rate of samples. That should be controlled by a * source or sink tied to sample clock. E.g., a USRP or audio card. */ -class gr_throttle : virtual public gr_sync_block +class GR_CORE_API gr_throttle : virtual public gr_sync_block { public: typedef boost::shared_ptr<gr_throttle> sptr; @@ -44,6 +45,6 @@ public: virtual void set_sample_rate(double rate) = 0; }; -gr_throttle::sptr gr_make_throttle(size_t itemsize, double samples_per_sec); +GR_CORE_API gr_throttle::sptr gr_make_throttle(size_t itemsize, double samples_per_sec); #endif /* INCLUDED_GR_THROTTLE_H */ diff --git a/gnuradio-core/src/lib/general/gr_uchar_to_float.h b/gnuradio-core/src/lib/general/gr_uchar_to_float.h index 3b83c893f..8e8836c2c 100644 --- a/gnuradio-core/src/lib/general/gr_uchar_to_float.h +++ b/gnuradio-core/src/lib/general/gr_uchar_to_float.h @@ -23,12 +23,13 @@ #ifndef INCLUDED_GR_UCHAR_TO_FLOAT_H #define INCLUDED_GR_UCHAR_TO_FLOAT_H +#include <gr_core_api.h> #include <gr_sync_block.h> class gr_uchar_to_float; typedef boost::shared_ptr<gr_uchar_to_float> gr_uchar_to_float_sptr; -gr_uchar_to_float_sptr +GR_CORE_API gr_uchar_to_float_sptr gr_make_uchar_to_float (); /*! @@ -36,9 +37,9 @@ gr_make_uchar_to_float (); * \ingroup converter_blk */ -class gr_uchar_to_float : public gr_sync_block +class GR_CORE_API gr_uchar_to_float : public gr_sync_block { - friend gr_uchar_to_float_sptr gr_make_uchar_to_float (); + friend GR_CORE_API gr_uchar_to_float_sptr gr_make_uchar_to_float (); gr_uchar_to_float (); public: diff --git a/gnuradio-core/src/lib/general/gr_unpack_k_bits_bb.h b/gnuradio-core/src/lib/general/gr_unpack_k_bits_bb.h index e2be2c59c..056c69dc1 100644 --- a/gnuradio-core/src/lib/general/gr_unpack_k_bits_bb.h +++ b/gnuradio-core/src/lib/general/gr_unpack_k_bits_bb.h @@ -23,11 +23,12 @@ #ifndef INCLUDED_GR_UNPACK_K_BITS_BB_H #define INCLUDED_GR_UNPACK_K_BITS_BB_H +#include <gr_core_api.h> #include <gr_sync_interpolator.h> class gr_unpack_k_bits_bb; typedef boost::shared_ptr<gr_unpack_k_bits_bb> gr_unpack_k_bits_bb_sptr; -gr_unpack_k_bits_bb_sptr gr_make_unpack_k_bits_bb (unsigned k); +GR_CORE_API gr_unpack_k_bits_bb_sptr gr_make_unpack_k_bits_bb (unsigned k); class gr_unpack_k_bits_bb; @@ -35,10 +36,10 @@ class gr_unpack_k_bits_bb; * \brief Converts a byte with k relevent bits to k output bytes with 1 bit in the LSB. * \ingroup converter_blk */ -class gr_unpack_k_bits_bb : public gr_sync_interpolator +class GR_CORE_API gr_unpack_k_bits_bb : public gr_sync_interpolator { private: - friend gr_unpack_k_bits_bb_sptr gr_make_unpack_k_bits_bb (unsigned k); + friend GR_CORE_API gr_unpack_k_bits_bb_sptr gr_make_unpack_k_bits_bb (unsigned k); gr_unpack_k_bits_bb (unsigned k); diff --git a/gnuradio-core/src/lib/general/gr_vco_f.h b/gnuradio-core/src/lib/general/gr_vco_f.h index 2bdf60899..b7524d581 100644 --- a/gnuradio-core/src/lib/general/gr_vco_f.h +++ b/gnuradio-core/src/lib/general/gr_vco_f.h @@ -22,6 +22,7 @@ #ifndef INCLUDED_GR_VCO_F_H #define INCLUDED_GR_VCO_F_H +#include <gr_core_api.h> #include <gr_sync_block.h> #include <gr_fxpt_vco.h> @@ -37,7 +38,7 @@ class gr_vco_f; typedef boost::shared_ptr<gr_vco_f> gr_vco_f_sptr; -gr_vco_f_sptr gr_make_vco_f(double sampling_rate, double sensitivity, double amplitude); +GR_CORE_API gr_vco_f_sptr gr_make_vco_f(double sampling_rate, double sensitivity, double amplitude); /*! * \brief VCO - Voltage controlled oscillator @@ -45,9 +46,9 @@ gr_vco_f_sptr gr_make_vco_f(double sampling_rate, double sensitivity, double amp * * input: float stream of control voltages; output: float oscillator output */ -class gr_vco_f : public gr_sync_block +class GR_CORE_API gr_vco_f : public gr_sync_block { - friend gr_vco_f_sptr gr_make_vco_f(double sampling_rate, double sensitivity, double amplitude); + friend GR_CORE_API gr_vco_f_sptr gr_make_vco_f(double sampling_rate, double sensitivity, double amplitude); /*! * \brief VCO - Voltage controlled oscillator diff --git a/gnuradio-core/src/lib/general/gr_vector_to_stream.h b/gnuradio-core/src/lib/general/gr_vector_to_stream.h index de6cc2a8b..d2fa8c7ab 100644 --- a/gnuradio-core/src/lib/general/gr_vector_to_stream.h +++ b/gnuradio-core/src/lib/general/gr_vector_to_stream.h @@ -23,12 +23,13 @@ #ifndef INCLUDED_GR_VECTOR_TO_STREAM_H #define INCLUDED_GR_VECTOR_TO_STREAM_H +#include <gr_core_api.h> #include <gr_sync_interpolator.h> class gr_vector_to_stream; typedef boost::shared_ptr<gr_vector_to_stream> gr_vector_to_stream_sptr; -gr_vector_to_stream_sptr +GR_CORE_API gr_vector_to_stream_sptr gr_make_vector_to_stream (size_t item_size, size_t nitems_per_block); @@ -36,9 +37,9 @@ gr_make_vector_to_stream (size_t item_size, size_t nitems_per_block); * \brief convert a stream of blocks of nitems_per_block items into a stream of items * \ingroup slicedice_blk */ -class gr_vector_to_stream : public gr_sync_interpolator +class GR_CORE_API gr_vector_to_stream : public gr_sync_interpolator { - friend gr_vector_to_stream_sptr + friend GR_CORE_API gr_vector_to_stream_sptr gr_make_vector_to_stream (size_t item_size, size_t nitems_per_block); protected: diff --git a/gnuradio-core/src/lib/general/gr_vector_to_streams.h b/gnuradio-core/src/lib/general/gr_vector_to_streams.h index d5ba7acf9..04ac941a1 100644 --- a/gnuradio-core/src/lib/general/gr_vector_to_streams.h +++ b/gnuradio-core/src/lib/general/gr_vector_to_streams.h @@ -23,12 +23,13 @@ #ifndef INCLUDED_GR_VECTOR_TO_STREAMS_H #define INCLUDED_GR_VECTOR_TO_STREAMS_H +#include <gr_core_api.h> #include <gr_sync_interpolator.h> class gr_vector_to_streams; typedef boost::shared_ptr<gr_vector_to_streams> gr_vector_to_streams_sptr; -gr_vector_to_streams_sptr +GR_CORE_API gr_vector_to_streams_sptr gr_make_vector_to_streams (size_t item_size, size_t nstreams); @@ -36,9 +37,9 @@ gr_make_vector_to_streams (size_t item_size, size_t nstreams); * \brief Convert 1 stream of vectors of length N to N streams of items * \ingroup slicedice_blk */ -class gr_vector_to_streams : public gr_sync_block +class GR_CORE_API gr_vector_to_streams : public gr_sync_block { - friend gr_vector_to_streams_sptr + friend GR_CORE_API gr_vector_to_streams_sptr gr_make_vector_to_streams (size_t item_size, size_t nstreams); protected: diff --git a/gnuradio-core/src/lib/general/gr_wavelet_ff.h b/gnuradio-core/src/lib/general/gr_wavelet_ff.h index dcfb595e5..107a50fe2 100644 --- a/gnuradio-core/src/lib/general/gr_wavelet_ff.h +++ b/gnuradio-core/src/lib/general/gr_wavelet_ff.h @@ -22,6 +22,7 @@ #ifndef INCLUDED_GR_WAVELET_FF_H #define INCLUDED_GR_WAVELET_FF_H +#include <gr_core_api.h> #include <iostream> #include <gr_sync_block.h> @@ -31,7 +32,7 @@ class gr_wavelet_ff; typedef boost::shared_ptr<gr_wavelet_ff> gr_wavelet_ff_sptr; -gr_wavelet_ff_sptr +GR_CORE_API gr_wavelet_ff_sptr gr_make_wavelet_ff(int size = 1024, int order = 20, bool forward = true); @@ -41,7 +42,7 @@ gr_make_wavelet_ff(int size = 1024, * \ingroup wavelet_blk */ -class gr_wavelet_ff : public gr_sync_block +class GR_CORE_API gr_wavelet_ff : public gr_sync_block { int d_size; int d_order; @@ -50,7 +51,7 @@ class gr_wavelet_ff : public gr_sync_block gsl_wavelet_workspace *d_workspace; double *d_temp; - friend gr_wavelet_ff_sptr + friend GR_CORE_API gr_wavelet_ff_sptr gr_make_wavelet_ff(int size, int order, bool forward); diff --git a/gnuradio-core/src/lib/general/gr_wvps_ff.h b/gnuradio-core/src/lib/general/gr_wvps_ff.h index af122d0fc..7c8f26066 100644 --- a/gnuradio-core/src/lib/general/gr_wvps_ff.h +++ b/gnuradio-core/src/lib/general/gr_wvps_ff.h @@ -23,12 +23,13 @@ #ifndef INCLUDED_GR_WVPS_FF_H #define INCLUDED_GR_WVPS_FF_H +#include <gr_core_api.h> #include <gr_sync_decimator.h> class gr_wvps_ff; typedef boost::shared_ptr<gr_wvps_ff> gr_wvps_ff_sptr; -gr_wvps_ff_sptr +GR_CORE_API gr_wvps_ff_sptr gr_make_wvps_ff(int ilen); @@ -36,9 +37,9 @@ gr_make_wvps_ff(int ilen); * \brief computes the Wavelet Power Spectrum from a set of wavelet coefficients * \ingroup wavelet_blk */ -class gr_wvps_ff : public gr_sync_block +class GR_CORE_API gr_wvps_ff : public gr_sync_block { - friend gr_wvps_ff_sptr + friend GR_CORE_API gr_wvps_ff_sptr gr_make_wvps_ff(int ilen); int d_ilen; diff --git a/gnuradio-core/src/lib/general/gri_agc2_cc.h b/gnuradio-core/src/lib/general/gri_agc2_cc.h index 441d1e459..b0a027aad 100644 --- a/gnuradio-core/src/lib/general/gri_agc2_cc.h +++ b/gnuradio-core/src/lib/general/gri_agc2_cc.h @@ -23,6 +23,7 @@ #ifndef _GRI_AGC2_CC_H_ #define _GRI_AGC2_CC_H_ +#include <gr_core_api.h> #include <math.h> /*! @@ -30,7 +31,7 @@ * * For Power the absolute value of the complex number is used. */ -class gri_agc2_cc { +class GR_CORE_API gri_agc2_cc { public: gri_agc2_cc (float attack_rate = 1e-1, float decay_rate = 1e-2, float reference = 1.0, diff --git a/gnuradio-core/src/lib/general/gri_agc2_ff.h b/gnuradio-core/src/lib/general/gri_agc2_ff.h index a06dab78c..ee70c2537 100644 --- a/gnuradio-core/src/lib/general/gri_agc2_ff.h +++ b/gnuradio-core/src/lib/general/gri_agc2_ff.h @@ -23,6 +23,7 @@ #ifndef _GRI_AGC2_FF_H_ #define _GRI_AGC2_FF_H_ +#include <gr_core_api.h> #include <math.h> /*! @@ -31,7 +32,7 @@ * Power is approximated by absolute value */ -class gri_agc2_ff { +class GR_CORE_API gri_agc2_ff { public: gri_agc2_ff (float attack_rate = 1e-1, float decay_rate = 1e-2, float reference = 1.0, diff --git a/gnuradio-core/src/lib/general/gri_agc_cc.h b/gnuradio-core/src/lib/general/gri_agc_cc.h index bc31d9a3d..74dfdf1dc 100644 --- a/gnuradio-core/src/lib/general/gri_agc_cc.h +++ b/gnuradio-core/src/lib/general/gri_agc_cc.h @@ -23,6 +23,7 @@ #ifndef INCLUDED_GRI_AGC_CC_H #define INCLUDED_GRI_AGC_CC_H +#include <gr_core_api.h> #include <math.h> /*! @@ -31,7 +32,7 @@ * For Power the absolute value of the complex number is used. */ -class gri_agc_cc { +class GR_CORE_API gri_agc_cc { public: gri_agc_cc (float rate = 1e-4, float reference = 1.0, diff --git a/gnuradio-core/src/lib/general/gri_agc_ff.h b/gnuradio-core/src/lib/general/gri_agc_ff.h index de609a8d4..753bbe275 100644 --- a/gnuradio-core/src/lib/general/gri_agc_ff.h +++ b/gnuradio-core/src/lib/general/gri_agc_ff.h @@ -23,6 +23,7 @@ #ifndef INCLUDED_GRI_AGC_FF_H #define INCLUDED_GRI_AGC_FF_H +#include <gr_core_api.h> #include <math.h> /*! @@ -30,7 +31,7 @@ * * Power is approximated by absolute value */ -class gri_agc_ff { +class GR_CORE_API gri_agc_ff { public: gri_agc_ff (float rate = 1e-4, float reference = 1.0, diff --git a/gnuradio-core/src/lib/general/gri_char_to_float.h b/gnuradio-core/src/lib/general/gri_char_to_float.h index f4703bef7..890d482b5 100644 --- a/gnuradio-core/src/lib/general/gri_char_to_float.h +++ b/gnuradio-core/src/lib/general/gri_char_to_float.h @@ -23,10 +23,12 @@ #ifndef INCLUDED_GRI_CHAR_TO_FLOAT_H #define INCLUDED_GRI_CHAR_TO_FLOAT_H +#include <gr_core_api.h> + /* * convert array of chars to floats */ -void gri_char_to_float (const char *in, float *out, int nsamples); +GR_CORE_API void gri_char_to_float (const char *in, float *out, int nsamples); -#endif /* INCLUDED_GRI_CHAR_TO_FLOAT_H */ +#endif /* INCLUDED_GRI_CHAR_TO_FLOAT_H */
\ No newline at end of file diff --git a/gnuradio-core/src/lib/general/gri_control_loop.cc b/gnuradio-core/src/lib/general/gri_control_loop.cc index affdeefc9..4c64bb922 100644 --- a/gnuradio-core/src/lib/general/gri_control_loop.cc +++ b/gnuradio-core/src/lib/general/gri_control_loop.cc @@ -20,6 +20,10 @@ * Boston, MA 02110-1301, USA. */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include <gri_control_loop.h> #include <gr_math.h> #include <stdexcept> diff --git a/gnuradio-core/src/lib/general/gri_control_loop.h b/gnuradio-core/src/lib/general/gri_control_loop.h index a85625bbd..3aeac58f7 100644 --- a/gnuradio-core/src/lib/general/gri_control_loop.h +++ b/gnuradio-core/src/lib/general/gri_control_loop.h @@ -23,7 +23,9 @@ #ifndef GRI_CONTROL_LOOP #define GRI_CONTROL_LOOP -class gri_control_loop +#include <gr_core_api.h> + +class GR_CORE_API gri_control_loop { protected: float d_phase, d_freq; diff --git a/gnuradio-core/src/lib/general/gri_debugger_hook.h b/gnuradio-core/src/lib/general/gri_debugger_hook.h index 60c90685e..cf227af8f 100644 --- a/gnuradio-core/src/lib/general/gri_debugger_hook.h +++ b/gnuradio-core/src/lib/general/gri_debugger_hook.h @@ -23,6 +23,8 @@ #ifndef INCLUDED_GRI_DEBUGGER_HOOK_H #define INCLUDED_GRI_DEBUGGER_HOOK_H -void gri_debugger_hook (); +#include <gr_core_api.h> -#endif /* INCLUDED_GRI_DEBUGGER_HOOK_H */ +GR_CORE_API void gri_debugger_hook (); + +#endif /* INCLUDED_GRI_DEBUGGER_HOOK_H */
\ No newline at end of file diff --git a/gnuradio-core/src/lib/general/gri_fft.cc b/gnuradio-core/src/lib/general/gri_fft.cc index f20b15ca0..0df1af25d 100644 --- a/gnuradio-core/src/lib/general/gri_fft.cc +++ b/gnuradio-core/src/lib/general/gri_fft.cc @@ -23,6 +23,19 @@ #include <gri_fft.h> #include <gr_sys_paths.h> #include <fftw3.h> + +#ifdef _MSC_VER //http://www.fftw.org/install/windows.html#DLLwisdom +static void my_fftw_write_char(char c, void *f) { fputc(c, (FILE *) f); } +#define fftw_export_wisdom_to_file(f) fftw_export_wisdom(my_fftw_write_char, (void*) (f)) +#define fftwf_export_wisdom_to_file(f) fftwf_export_wisdom(my_fftw_write_char, (void*) (f)) +#define fftwl_export_wisdom_to_file(f) fftwl_export_wisdom(my_fftw_write_char, (void*) (f)) + +static int my_fftw_read_char(void *f) { return fgetc((FILE *) f); } +#define fftw_import_wisdom_from_file(f) fftw_import_wisdom(my_fftw_read_char, (void*) (f)) +#define fftwf_import_wisdom_from_file(f) fftwf_import_wisdom(my_fftw_read_char, (void*) (f)) +#define fftwl_import_wisdom_from_file(f) fftwl_import_wisdom(my_fftw_read_char, (void*) (f)) +#endif //_MSC_VER + #include <gr_complex.h> #include <stdlib.h> #include <string.h> diff --git a/gnuradio-core/src/lib/general/gri_fft.h b/gnuradio-core/src/lib/general/gri_fft.h index 9ffcc5a50..91a82fb55 100644 --- a/gnuradio-core/src/lib/general/gri_fft.h +++ b/gnuradio-core/src/lib/general/gri_fft.h @@ -26,6 +26,7 @@ * Wrappers for FFTW single precision 1d dft */ +#include <gr_core_api.h> #include <gr_complex.h> #include <boost/thread.hpp> @@ -33,7 +34,7 @@ * \brief Export reference to planner mutex for those apps that * want to use FFTW w/o using the gri_fftw* classes. */ -class gri_fft_planner { +class GR_CORE_API gri_fft_planner { public: typedef boost::mutex::scoped_lock scoped_lock; /*! @@ -46,7 +47,7 @@ public: * \brief FFT: complex in, complex out * \ingroup misc */ -class gri_fft_complex { +class GR_CORE_API gri_fft_complex { int d_fft_size; gr_complex *d_inbuf; gr_complex *d_outbuf; @@ -77,7 +78,7 @@ public: * \brief FFT: real in, complex out * \ingroup misc */ -class gri_fft_real_fwd { +class GR_CORE_API gri_fft_real_fwd { int d_fft_size; float *d_inbuf; gr_complex *d_outbuf; @@ -108,7 +109,7 @@ public: * \brief FFT: complex in, float out * \ingroup misc */ -class gri_fft_real_rev { +class GR_CORE_API gri_fft_real_rev { int d_fft_size; gr_complex *d_inbuf; float *d_outbuf; diff --git a/gnuradio-core/src/lib/general/gri_float_to_char.cc b/gnuradio-core/src/lib/general/gri_float_to_char.cc index a17b01f55..28f15a3b3 100644 --- a/gnuradio-core/src/lib/general/gri_float_to_char.cc +++ b/gnuradio-core/src/lib/general/gri_float_to_char.cc @@ -20,6 +20,10 @@ * Boston, MA 02110-1301, USA. */ +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + #define _ISOC9X_SOURCE #include <gri_float_to_char.h> #include <math.h> diff --git a/gnuradio-core/src/lib/general/gri_float_to_char.h b/gnuradio-core/src/lib/general/gri_float_to_char.h index 95cc8ea8d..184592a69 100644 --- a/gnuradio-core/src/lib/general/gri_float_to_char.h +++ b/gnuradio-core/src/lib/general/gri_float_to_char.h @@ -23,10 +23,11 @@ #ifndef INCLUDED_GRI_FLOAT_TO_CHAR_H #define INCLUDED_GRI_FLOAT_TO_CHAR_H +#include <gr_core_api.h> + /*! * convert array of floats to chars with rounding and saturation. */ -void gri_float_to_char (const float *in, char *out, int nsamples); +GR_CORE_API void gri_float_to_char (const float *in, char *out, int nsamples); #endif /* INCLUDED_GRI_FLOAT_TO_CHAR_H */ - diff --git a/gnuradio-core/src/lib/general/gri_float_to_short.cc b/gnuradio-core/src/lib/general/gri_float_to_short.cc index 13afc51d9..93a2784f5 100644 --- a/gnuradio-core/src/lib/general/gri_float_to_short.cc +++ b/gnuradio-core/src/lib/general/gri_float_to_short.cc @@ -20,6 +20,10 @@ * Boston, MA 02110-1301, USA. */ +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + #define _ISOC9X_SOURCE #include <gri_float_to_short.h> #include <math.h> diff --git a/gnuradio-core/src/lib/general/gri_float_to_short.h b/gnuradio-core/src/lib/general/gri_float_to_short.h index e36e25de6..6d814b2b3 100644 --- a/gnuradio-core/src/lib/general/gri_float_to_short.h +++ b/gnuradio-core/src/lib/general/gri_float_to_short.h @@ -23,10 +23,11 @@ #ifndef INCLUDED_GRI_FLOAT_TO_SHORT_H #define INCLUDED_GRI_FLOAT_TO_SHORT_H +#include <gr_core_api.h> + /*! * convert array of floats to shorts with rounding and saturation. */ -void gri_float_to_short (const float *in, short *out, int nsamples); +GR_CORE_API void gri_float_to_short (const float *in, short *out, int nsamples); #endif /* INCLUDED_GRI_FLOAT_TO_SHORT_H */ - diff --git a/gnuradio-core/src/lib/general/gri_float_to_uchar.cc b/gnuradio-core/src/lib/general/gri_float_to_uchar.cc index 394cbc100..a022c95d8 100644 --- a/gnuradio-core/src/lib/general/gri_float_to_uchar.cc +++ b/gnuradio-core/src/lib/general/gri_float_to_uchar.cc @@ -20,6 +20,10 @@ * Boston, MA 02110-1301, USA. */ +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + #define _ISOC9X_SOURCE #include <gri_float_to_uchar.h> #include <math.h> diff --git a/gnuradio-core/src/lib/general/gri_float_to_uchar.h b/gnuradio-core/src/lib/general/gri_float_to_uchar.h index e413e725f..ff549333e 100644 --- a/gnuradio-core/src/lib/general/gri_float_to_uchar.h +++ b/gnuradio-core/src/lib/general/gri_float_to_uchar.h @@ -23,10 +23,11 @@ #ifndef INCLUDED_GRI_FLOAT_TO_UCHAR_H #define INCLUDED_GRI_FLOAT_TO_UCHAR_H +#include <gr_core_api.h> + /*! * convert array of floats to unsigned chars with rounding and saturation. */ -void gri_float_to_uchar (const float *in, unsigned char *out, int nsamples); +GR_CORE_API void gri_float_to_uchar (const float *in, unsigned char *out, int nsamples); #endif /* INCLUDED_GRI_FLOAT_TO_UCHAR_H */ - diff --git a/gnuradio-core/src/lib/general/gri_glfsr.h b/gnuradio-core/src/lib/general/gri_glfsr.h index 7dd5f8660..e6d28cf45 100644 --- a/gnuradio-core/src/lib/general/gri_glfsr.h +++ b/gnuradio-core/src/lib/general/gri_glfsr.h @@ -23,6 +23,8 @@ #ifndef INCLUDED_GRI_GLFSR_H #define INCLUDED_GRI_GLFSR_H +#include <gr_core_api.h> + /*! * \brief Galois Linear Feedback Shift Register using specified polynomial mask * \ingroup misc @@ -30,7 +32,7 @@ * Generates a maximal length pseudo-random sequence of length 2^degree-1 */ -class gri_glfsr +class GR_CORE_API gri_glfsr { private: int d_shift_register; @@ -52,4 +54,4 @@ class gri_glfsr int mask() const { return d_mask; } }; -#endif /* INCLUDED_GRI_GLFSR_H */ +#endif /* INCLUDED_GRI_GLFSR_H */
\ No newline at end of file diff --git a/gnuradio-core/src/lib/general/gri_interleaved_short_to_complex.h b/gnuradio-core/src/lib/general/gri_interleaved_short_to_complex.h index 09d915f7a..107e2f778 100644 --- a/gnuradio-core/src/lib/general/gri_interleaved_short_to_complex.h +++ b/gnuradio-core/src/lib/general/gri_interleaved_short_to_complex.h @@ -23,6 +23,7 @@ #ifndef INCLUDED_GRI_INTERLEAVED_SHORT_TO_COMPLEX_H #define INCLUDED_GRI_INTERLEAVED_SHORT_TO_COMPLEX_H +#include <gr_core_api.h> #include <gr_complex.h> /* @@ -30,7 +31,7 @@ * the shorts contains real, imaginary, real, imaginary... * nsamples is the number of shorts; it must be even. */ -void gri_interleaved_short_to_complex (const short *in, gr_complex *out, int nsamples); +GR_CORE_API void gri_interleaved_short_to_complex (const short *in, gr_complex *out, int nsamples); #endif /* INCLUDED_GRI_INTERLEAVED_SHORT_TO_COMPLEX_H */ diff --git a/gnuradio-core/src/lib/general/gri_lfsr.h b/gnuradio-core/src/lib/general/gri_lfsr.h index f691e36ec..dc9358572 100644 --- a/gnuradio-core/src/lib/general/gri_lfsr.h +++ b/gnuradio-core/src/lib/general/gri_lfsr.h @@ -23,6 +23,7 @@ #ifndef INCLUDED_GRI_LFSR_H #define INCLUDED_GRI_LFSR_H +#include <gr_core_api.h> #include <stdexcept> #include <stdint.h> @@ -81,7 +82,7 @@ * */ -class gri_lfsr +class GR_CORE_API gri_lfsr { private: uint32_t d_shift_register; diff --git a/gnuradio-core/src/lib/general/gri_lfsr_15_1_0.h b/gnuradio-core/src/lib/general/gri_lfsr_15_1_0.h index 798f2faad..7405ffbaa 100644 --- a/gnuradio-core/src/lib/general/gri_lfsr_15_1_0.h +++ b/gnuradio-core/src/lib/general/gri_lfsr_15_1_0.h @@ -23,6 +23,8 @@ #ifndef INCLUDED_GRI_LFSR_15_1_0_H #define INCLUDED_GRI_LFSR_15_1_0_H +#include <gr_core_api.h> + /*! * \brief Linear Feedback Shift Register using primitive polynomial x^15 + x + 1 * \ingroup misc @@ -30,7 +32,7 @@ * Generates a maximal length pseudo-random sequence of length 2^15 - 1 bits. */ -class gri_lfsr_15_1_0 { +class GR_CORE_API gri_lfsr_15_1_0 { unsigned long d_sr; // shift register public: @@ -55,4 +57,4 @@ class gri_lfsr_15_1_0 { } }; -#endif /* INCLUDED_GRI_LFSR_15_1_0_H */ +#endif /* INCLUDED_GRI_LFSR_15_1_0_H */
\ No newline at end of file diff --git a/gnuradio-core/src/lib/general/gri_lfsr_32k.h b/gnuradio-core/src/lib/general/gri_lfsr_32k.h index 33e7ae3a1..5c0396b50 100644 --- a/gnuradio-core/src/lib/general/gri_lfsr_32k.h +++ b/gnuradio-core/src/lib/general/gri_lfsr_32k.h @@ -23,6 +23,7 @@ #ifndef INCLUDED_GRI_LFSR_32k_H #define INCLUDED_GRI_LFSR_32k_H +#include <gr_core_api.h> #include <gri_lfsr_15_1_0.h> /*! @@ -33,7 +34,7 @@ * of the sequence. */ -class gri_lfsr_32k { +class GR_CORE_API gri_lfsr_32k { gri_lfsr_15_1_0 d_lfsr; unsigned int d_count; diff --git a/gnuradio-core/src/lib/general/gri_short_to_float.h b/gnuradio-core/src/lib/general/gri_short_to_float.h index ce4193062..51767efab 100644 --- a/gnuradio-core/src/lib/general/gri_short_to_float.h +++ b/gnuradio-core/src/lib/general/gri_short_to_float.h @@ -23,10 +23,12 @@ #ifndef INCLUDED_GRI_SHORT_TO_FLOAT_H #define INCLUDED_GRI_SHORT_TO_FLOAT_H +#include <gr_core_api.h> + /* * convert array of shorts to floats */ -void gri_short_to_float (const short *in, float *out, int nsamples); +GR_CORE_API void gri_short_to_float (const short *in, float *out, int nsamples); -#endif /* INCLUDED_GRI_SHORT_TO_FLOAT_H */ +#endif /* INCLUDED_GRI_SHORT_TO_FLOAT_H */
\ No newline at end of file diff --git a/gnuradio-core/src/lib/general/gri_uchar_to_float.h b/gnuradio-core/src/lib/general/gri_uchar_to_float.h index 7a9f11ba6..9f342989d 100644 --- a/gnuradio-core/src/lib/general/gri_uchar_to_float.h +++ b/gnuradio-core/src/lib/general/gri_uchar_to_float.h @@ -23,10 +23,12 @@ #ifndef INCLUDED_GRI_UCHAR_TO_FLOAT_H #define INCLUDED_GRI_UCHAR_TO_FLOAT_H +#include <gr_core_api.h> + /* * convert array of unsigned chars to floats */ -void gri_uchar_to_float (const unsigned char *in, float *out, int nsamples); +GR_CORE_API void gri_uchar_to_float (const unsigned char *in, float *out, int nsamples); -#endif /* INCLUDED_GRI_UCHAR_TO_FLOAT_H */ +#endif /* INCLUDED_GRI_UCHAR_TO_FLOAT_H */
\ No newline at end of file diff --git a/gnuradio-core/src/lib/general/malloc16.c b/gnuradio-core/src/lib/general/malloc16.c index 331751499..2cc6135e7 100644 --- a/gnuradio-core/src/lib/general/malloc16.c +++ b/gnuradio-core/src/lib/general/malloc16.c @@ -7,7 +7,6 @@ #include "malloc16.h" #include <string.h> -#include <strings.h> void *malloc16Align(int size){ void *p; diff --git a/gnuradio-core/src/lib/general/malloc16.h b/gnuradio-core/src/lib/general/malloc16.h index fc97f267d..6b1a3fb08 100644 --- a/gnuradio-core/src/lib/general/malloc16.h +++ b/gnuradio-core/src/lib/general/malloc16.h @@ -20,15 +20,17 @@ * Boston, MA 02110-1301, USA. */ +#include <gr_core_api.h> + #ifdef __cplusplus extern "C" { #endif #include <stdlib.h> -void *malloc16Align(int size); -void *calloc16Align(size_t nmemb,size_t size); -void free16Align(void *p); +GR_CORE_API void *malloc16Align(int size); +GR_CORE_API void *calloc16Align(size_t nmemb,size_t size); +GR_CORE_API void free16Align(void *p); #ifdef __cplusplus } diff --git a/gnuradio-core/src/lib/general/qa_general.h b/gnuradio-core/src/lib/general/qa_general.h index 577c9d7fb..7da188266 100644 --- a/gnuradio-core/src/lib/general/qa_general.h +++ b/gnuradio-core/src/lib/general/qa_general.h @@ -23,11 +23,12 @@ #ifndef _QA_GENERAL_H_ #define _QA_GENERAL_H_ +#include <gruel/attributes.h> #include <cppunit/TestSuite.h> //! collect all the tests for the gr directory -class qa_general { +class __GR_ATTR_EXPORT qa_general { public: //! return suite of tests for all of gr directory static CppUnit::TestSuite *suite (); diff --git a/gnuradio-core/src/lib/general/qa_gri_lfsr.cc b/gnuradio-core/src/lib/general/qa_gri_lfsr.cc index 9f8b62dcf..9625071d8 100644 --- a/gnuradio-core/src/lib/general/qa_gri_lfsr.cc +++ b/gnuradio-core/src/lib/general/qa_gri_lfsr.cc @@ -24,6 +24,7 @@ #include <cppunit/TestAssert.h> #include <stdio.h> #include <string.h> +#include <vector> void qa_gri_lfsr::test_lfsr () @@ -90,12 +91,12 @@ qa_gri_lfsr::test_scrambler() 1, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, }; int len = sizeof(src); - unsigned char actual[len]; + std::vector<unsigned char> actual(len); for (int i = 0; i < len; i++) actual[i] = scrambler.next_bit_scramble(src[i]); - CPPUNIT_ASSERT(memcmp(expected, actual, len) == 0); + CPPUNIT_ASSERT(memcmp(expected, &actual[0], len) == 0); } void @@ -132,10 +133,10 @@ qa_gri_lfsr::test_descrambler() 0, 0, 0, 0, 0, 0, 0, 0, 0 }; int len = sizeof(src); - unsigned char actual[len]; + std::vector<unsigned char> actual(len); for (int i = 0; i < len; i++) actual[i] = descrambler.next_bit_descramble(src[i]); - CPPUNIT_ASSERT(memcmp(expected, actual, len) == 0); + CPPUNIT_ASSERT(memcmp(expected, &actual[0], len) == 0); } diff --git a/gnuradio-core/src/lib/gengen/CMakeLists.txt b/gnuradio-core/src/lib/gengen/CMakeLists.txt new file mode 100644 index 000000000..a06a61e6d --- /dev/null +++ b/gnuradio-core/src/lib/gengen/CMakeLists.txt @@ -0,0 +1,191 @@ +# Copyright 2010-2011 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio 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 General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. + +######################################################################## +# This file included, use CMake directory variables +######################################################################## + +######################################################################## +# Generate the makefile.gen, then extract its sources: +# This is a round-about way to extract the sources, +# but it requires minimum changed to the python utils. +# +# The recommended way to do this: +# - Make a generation macro that registers the sources command. +# - List the generation macro with each templated source file. +# - Create a python script (very generic) to perform generation. +# - This way the targets would depend only on their sources. +######################################################################## +EXECUTE_PROCESS( + COMMAND ${PYTHON_EXECUTABLE} -c " +import os, sys +sys.path.append('${GR_CORE_PYTHONPATH}') +sys.path.append('${CMAKE_CURRENT_SOURCE_DIR}') +os.environ['srcdir'] = '${CMAKE_CURRENT_SOURCE_DIR}' +os.environ['gendir'] = '${CMAKE_CURRENT_BINARY_DIR}' +os.environ['do_makefile'] = '1' +os.environ['do_sources'] = '0' +from generate_all import generate_all +generate_all() + " WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} +) + +MACRO(GEGEN_GEN_EXTRACT outvar ext) + EXECUTE_PROCESS(COMMAND ${PYTHON_EXECUTABLE} -c "import os; print ';'.join( + map(lambda x: os.path.join('${CMAKE_CURRENT_BINARY_DIR}', x.replace('\\\\', '').strip()), + filter(lambda f: '${ext}' in f, open('${CMAKE_CURRENT_BINARY_DIR}/Makefile.gen').readlines() + )))" OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_VARIABLE ${outvar}) + FILE(TO_CMAKE_PATH "${${outvar}}" ${outvar}) +ENDMACRO(GEGEN_GEN_EXTRACT) + +GEGEN_GEN_EXTRACT(generated_gengen_sources ".cc") +GEGEN_GEN_EXTRACT(generated_gengen_includes ".h") +GEGEN_GEN_EXTRACT(generated_gengen_swigs ".i") + +#TODO simplify this list with a triple-threat for loop +SET(generated_gengen_deps + ${CMAKE_CURRENT_SOURCE_DIR}/generate_all.py + ${CMAKE_CURRENT_SOURCE_DIR}/generate_common.py + ${CMAKE_CURRENT_SOURCE_DIR}/gr_add_XX.cc.t + ${CMAKE_CURRENT_SOURCE_DIR}/gr_add_XX.h.t + ${CMAKE_CURRENT_SOURCE_DIR}/gr_add_XX.i.t + ${CMAKE_CURRENT_SOURCE_DIR}/gr_add_const_XX.cc.t + ${CMAKE_CURRENT_SOURCE_DIR}/gr_add_const_XX.h.t + ${CMAKE_CURRENT_SOURCE_DIR}/gr_add_const_XX.i.t + ${CMAKE_CURRENT_SOURCE_DIR}/gr_add_const_vXX.cc.t + ${CMAKE_CURRENT_SOURCE_DIR}/gr_add_const_vXX.h.t + ${CMAKE_CURRENT_SOURCE_DIR}/gr_add_const_vXX.i.t + ${CMAKE_CURRENT_SOURCE_DIR}/gr_argmax_XX.cc.t + ${CMAKE_CURRENT_SOURCE_DIR}/gr_argmax_XX.h.t + ${CMAKE_CURRENT_SOURCE_DIR}/gr_argmax_XX.i.t + ${CMAKE_CURRENT_SOURCE_DIR}/gr_chunks_to_symbols_XX.cc.t + ${CMAKE_CURRENT_SOURCE_DIR}/gr_chunks_to_symbols_XX.h.t + ${CMAKE_CURRENT_SOURCE_DIR}/gr_chunks_to_symbols_XX.i.t + ${CMAKE_CURRENT_SOURCE_DIR}/gr_divide_XX.cc.t + ${CMAKE_CURRENT_SOURCE_DIR}/gr_divide_XX.h.t + ${CMAKE_CURRENT_SOURCE_DIR}/gr_divide_XX.i.t + ${CMAKE_CURRENT_SOURCE_DIR}/gr_integrate_XX.cc.t + ${CMAKE_CURRENT_SOURCE_DIR}/gr_integrate_XX.h.t + ${CMAKE_CURRENT_SOURCE_DIR}/gr_integrate_XX.i.t + ${CMAKE_CURRENT_SOURCE_DIR}/gr_max_XX.cc.t + ${CMAKE_CURRENT_SOURCE_DIR}/gr_max_XX.h.t + ${CMAKE_CURRENT_SOURCE_DIR}/gr_max_XX.i.t + ${CMAKE_CURRENT_SOURCE_DIR}/gr_multiply_XX.cc.t + ${CMAKE_CURRENT_SOURCE_DIR}/gr_multiply_XX.h.t + ${CMAKE_CURRENT_SOURCE_DIR}/gr_multiply_XX.i.t + ${CMAKE_CURRENT_SOURCE_DIR}/gr_multiply_const_XX.cc.t + ${CMAKE_CURRENT_SOURCE_DIR}/gr_multiply_const_XX.h.t + ${CMAKE_CURRENT_SOURCE_DIR}/gr_multiply_const_XX.i.t + ${CMAKE_CURRENT_SOURCE_DIR}/gr_multiply_const_vXX.cc.t + ${CMAKE_CURRENT_SOURCE_DIR}/gr_multiply_const_vXX.h.t + ${CMAKE_CURRENT_SOURCE_DIR}/gr_multiply_const_vXX.i.t + ${CMAKE_CURRENT_SOURCE_DIR}/gr_mute_XX.cc.t + ${CMAKE_CURRENT_SOURCE_DIR}/gr_mute_XX.h.t + ${CMAKE_CURRENT_SOURCE_DIR}/gr_mute_XX.i.t + ${CMAKE_CURRENT_SOURCE_DIR}/gr_noise_source_X.cc.t + ${CMAKE_CURRENT_SOURCE_DIR}/gr_noise_source_X.h.t + ${CMAKE_CURRENT_SOURCE_DIR}/gr_noise_source_X.i.t + ${CMAKE_CURRENT_SOURCE_DIR}/gr_packed_to_unpacked_XX.cc.t + ${CMAKE_CURRENT_SOURCE_DIR}/gr_packed_to_unpacked_XX.h.t + ${CMAKE_CURRENT_SOURCE_DIR}/gr_packed_to_unpacked_XX.i.t + ${CMAKE_CURRENT_SOURCE_DIR}/gr_peak_detector_XX.cc.t + ${CMAKE_CURRENT_SOURCE_DIR}/gr_peak_detector_XX.h.t + ${CMAKE_CURRENT_SOURCE_DIR}/gr_peak_detector_XX.i.t + ${CMAKE_CURRENT_SOURCE_DIR}/gr_sample_and_hold_XX.cc.t + ${CMAKE_CURRENT_SOURCE_DIR}/gr_sample_and_hold_XX.h.t + ${CMAKE_CURRENT_SOURCE_DIR}/gr_sample_and_hold_XX.i.t + ${CMAKE_CURRENT_SOURCE_DIR}/gr_sig_source_X.cc.t + ${CMAKE_CURRENT_SOURCE_DIR}/gr_sig_source_X.h.t + ${CMAKE_CURRENT_SOURCE_DIR}/gr_sig_source_X.i.t + ${CMAKE_CURRENT_SOURCE_DIR}/gr_sub_XX.cc.t + ${CMAKE_CURRENT_SOURCE_DIR}/gr_sub_XX.h.t + ${CMAKE_CURRENT_SOURCE_DIR}/gr_sub_XX.i.t + ${CMAKE_CURRENT_SOURCE_DIR}/gr_unpacked_to_packed_XX.cc.t + ${CMAKE_CURRENT_SOURCE_DIR}/gr_unpacked_to_packed_XX.h.t + ${CMAKE_CURRENT_SOURCE_DIR}/gr_unpacked_to_packed_XX.i.t + ${CMAKE_CURRENT_SOURCE_DIR}/gr_vector_source_X.cc.t + ${CMAKE_CURRENT_SOURCE_DIR}/gr_vector_source_X.h.t + ${CMAKE_CURRENT_SOURCE_DIR}/gr_vector_source_X.i.t + ${CMAKE_CURRENT_SOURCE_DIR}/gr_vector_sink_X.cc.t + ${CMAKE_CURRENT_SOURCE_DIR}/gr_vector_sink_X.h.t + ${CMAKE_CURRENT_SOURCE_DIR}/gr_vector_sink_X.i.t + ${CMAKE_CURRENT_SOURCE_DIR}/gr_xor_XX.cc.t + ${CMAKE_CURRENT_SOURCE_DIR}/gr_xor_XX.h.t + ${CMAKE_CURRENT_SOURCE_DIR}/gr_xor_XX.i.t + ${CMAKE_CURRENT_SOURCE_DIR}/gr_and_XX.cc.t + ${CMAKE_CURRENT_SOURCE_DIR}/gr_and_XX.h.t + ${CMAKE_CURRENT_SOURCE_DIR}/gr_and_XX.i.t + ${CMAKE_CURRENT_SOURCE_DIR}/gr_and_const_XX.cc.t + ${CMAKE_CURRENT_SOURCE_DIR}/gr_and_const_XX.h.t + ${CMAKE_CURRENT_SOURCE_DIR}/gr_and_const_XX.i.t + ${CMAKE_CURRENT_SOURCE_DIR}/gr_or_XX.cc.t + ${CMAKE_CURRENT_SOURCE_DIR}/gr_or_XX.h.t + ${CMAKE_CURRENT_SOURCE_DIR}/gr_or_XX.i.t + ${CMAKE_CURRENT_SOURCE_DIR}/gr_not_XX.cc.t + ${CMAKE_CURRENT_SOURCE_DIR}/gr_not_XX.h.t + ${CMAKE_CURRENT_SOURCE_DIR}/gr_not_XX.i.t + ${CMAKE_CURRENT_SOURCE_DIR}/gr_moving_average_XX.cc.t + ${CMAKE_CURRENT_SOURCE_DIR}/gr_moving_average_XX.h.t + ${CMAKE_CURRENT_SOURCE_DIR}/gr_moving_average_XX.i.t +) + +ADD_CUSTOM_COMMAND( + OUTPUT + ${generated_gengen_sources} + ${generated_gengen_includes} + ${generated_gengen_swigs} + DEPENDS ${generated_gengen_deps} + COMMAND ${PYTHON_EXECUTABLE} -B -c + \"import os, sys\;sys.path.append('${GR_CORE_PYTHONPATH}')\;sys.path.append('${CMAKE_CURRENT_SOURCE_DIR}')\;os.environ['srcdir'] = '${CMAKE_CURRENT_SOURCE_DIR}'\;from generate_all import generate_all\;generate_all()\" + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + COMMENT "generating gengen files" +) + +ADD_CUSTOM_TARGET(gengen_generated DEPENDS + ${generated_gengen_sources} + ${generated_gengen_includes} + ${generated_gengen_swigs} +) + +######################################################################## +# Handle the generated sources + a few non-generated ones +######################################################################## +LIST(APPEND gnuradio_core_sources + ${generated_gengen_sources} +) + +INSTALL(FILES + ${generated_gengen_includes} + ${CMAKE_CURRENT_SOURCE_DIR}/gr_endianness.h + ${CMAKE_CURRENT_SOURCE_DIR}/gr_noise_type.h + ${CMAKE_CURRENT_SOURCE_DIR}/gr_sig_source_waveform.h + DESTINATION ${GR_INCLUDE_DIR}/gnuradio + COMPONENT "core_devel" +) + +IF(ENABLE_PYTHON) + INSTALL(FILES + ${generated_gengen_swigs} + ${CMAKE_CURRENT_SOURCE_DIR}/gr_endianness.i + ${CMAKE_CURRENT_SOURCE_DIR}/gengen.i + ${CMAKE_CURRENT_BINARY_DIR}/gengen_generated.i + DESTINATION ${GR_INCLUDE_DIR}/gnuradio/swig + COMPONENT "core_swig" + ) +ENDIF(ENABLE_PYTHON) diff --git a/gnuradio-core/src/lib/gengen/gr_add_XX.h.t b/gnuradio-core/src/lib/gengen/gr_add_XX.h.t index 91dd9196a..f0e857abf 100644 --- a/gnuradio-core/src/lib/gengen/gr_add_XX.h.t +++ b/gnuradio-core/src/lib/gengen/gr_add_XX.h.t @@ -25,12 +25,13 @@ #ifndef @GUARD_NAME@ #define @GUARD_NAME@ +#include <gr_core_api.h> #include <gr_sync_block.h> class @NAME@; typedef boost::shared_ptr<@NAME@> @SPTR_NAME@; -@SPTR_NAME@ gr_make_@BASE_NAME@ (size_t vlen = 1); +GR_CORE_API @SPTR_NAME@ gr_make_@BASE_NAME@ (size_t vlen = 1); /*! * \brief output = sum (input_0, input_1, ...) @@ -38,9 +39,9 @@ typedef boost::shared_ptr<@NAME@> @SPTR_NAME@; * * Add across all input streams. */ -class @NAME@ : public gr_sync_block +class GR_CORE_API @NAME@ : public gr_sync_block { - friend @SPTR_NAME@ gr_make_@BASE_NAME@ (size_t vlen); + friend GR_CORE_API @SPTR_NAME@ gr_make_@BASE_NAME@ (size_t vlen); @NAME@ (size_t vlen); diff --git a/gnuradio-core/src/lib/gengen/gr_add_const_XX.h.t b/gnuradio-core/src/lib/gengen/gr_add_const_XX.h.t index 8e9884104..5b46d0f89 100644 --- a/gnuradio-core/src/lib/gengen/gr_add_const_XX.h.t +++ b/gnuradio-core/src/lib/gengen/gr_add_const_XX.h.t @@ -25,20 +25,21 @@ #ifndef @GUARD_NAME@ #define @GUARD_NAME@ +#include <gr_core_api.h> #include <gr_sync_block.h> class @NAME@; typedef boost::shared_ptr<@NAME@> @SPTR_NAME@; -@SPTR_NAME@ gr_make_@BASE_NAME@ (@O_TYPE@ k); +GR_CORE_API @SPTR_NAME@ gr_make_@BASE_NAME@ (@O_TYPE@ k); /*! * \brief output = input + constant * \ingroup math_blk */ -class @NAME@ : public gr_sync_block +class GR_CORE_API @NAME@ : public gr_sync_block { - friend @SPTR_NAME@ gr_make_@BASE_NAME@ (@O_TYPE@ k); + friend GR_CORE_API @SPTR_NAME@ gr_make_@BASE_NAME@ (@O_TYPE@ k); @O_TYPE@ d_k; // the constant @NAME@ (@O_TYPE@ k); diff --git a/gnuradio-core/src/lib/gengen/gr_add_const_vXX.h.t b/gnuradio-core/src/lib/gengen/gr_add_const_vXX.h.t index 574fc686c..9d986e960 100755..100644 --- a/gnuradio-core/src/lib/gengen/gr_add_const_vXX.h.t +++ b/gnuradio-core/src/lib/gengen/gr_add_const_vXX.h.t @@ -25,20 +25,21 @@ #ifndef @GUARD_NAME@ #define @GUARD_NAME@ +#include <gr_core_api.h> #include <gr_sync_block.h> class @NAME@; typedef boost::shared_ptr<@NAME@> @SPTR_NAME@; -@SPTR_NAME@ gr_make_@BASE_NAME@ (const std::vector<@I_TYPE@> &k); +GR_CORE_API @SPTR_NAME@ gr_make_@BASE_NAME@ (const std::vector<@I_TYPE@> &k); /*! * \brief output vector = input vector + constant vector * \ingroup math_blk */ -class @NAME@ : public gr_sync_block +class GR_CORE_API @NAME@ : public gr_sync_block { - friend @SPTR_NAME@ gr_make_@BASE_NAME@ (const std::vector<@I_TYPE@> &k); + friend GR_CORE_API @SPTR_NAME@ gr_make_@BASE_NAME@ (const std::vector<@I_TYPE@> &k); std::vector<@I_TYPE@> d_k; // the constant @NAME@ (const std::vector<@I_TYPE@> &k); diff --git a/gnuradio-core/src/lib/gengen/gr_and_XX.h.t b/gnuradio-core/src/lib/gengen/gr_and_XX.h.t index 6152942dd..dbb225907 100644 --- a/gnuradio-core/src/lib/gengen/gr_and_XX.h.t +++ b/gnuradio-core/src/lib/gengen/gr_and_XX.h.t @@ -25,12 +25,13 @@ #ifndef @GUARD_NAME@ #define @GUARD_NAME@ +#include <gr_core_api.h> #include <gr_sync_block.h> class @NAME@; typedef boost::shared_ptr<@NAME@> @SPTR_NAME@; -@SPTR_NAME@ gr_make_@BASE_NAME@ (); +GR_CORE_API @SPTR_NAME@ gr_make_@BASE_NAME@ (); /*! * \brief output = input_0 & input_1 & , ... & input_N) @@ -38,9 +39,9 @@ typedef boost::shared_ptr<@NAME@> @SPTR_NAME@; * * bitwise boolean and across all input streams. */ -class @NAME@ : public gr_sync_block +class GR_CORE_API @NAME@ : public gr_sync_block { - friend @SPTR_NAME@ gr_make_@BASE_NAME@ (); + friend GR_CORE_API @SPTR_NAME@ gr_make_@BASE_NAME@ (); @NAME@ (); diff --git a/gnuradio-core/src/lib/gengen/gr_and_const_XX.h.t b/gnuradio-core/src/lib/gengen/gr_and_const_XX.h.t index 3119611f1..ceffc3066 100644 --- a/gnuradio-core/src/lib/gengen/gr_and_const_XX.h.t +++ b/gnuradio-core/src/lib/gengen/gr_and_const_XX.h.t @@ -25,12 +25,13 @@ #ifndef @GUARD_NAME@ #define @GUARD_NAME@ +#include <gr_core_api.h> #include <gr_sync_block.h> class @NAME@; typedef boost::shared_ptr<@NAME@> @SPTR_NAME@; -@SPTR_NAME@ gr_make_@BASE_NAME@ (@O_TYPE@ k); +GR_CORE_API @SPTR_NAME@ gr_make_@BASE_NAME@ (@O_TYPE@ k); /*! * \brief output_N = input_N & value @@ -38,9 +39,9 @@ typedef boost::shared_ptr<@NAME@> @SPTR_NAME@; * * bitwise boolean and of const to the data stream. */ -class @NAME@ : public gr_sync_block +class GR_CORE_API @NAME@ : public gr_sync_block { - friend @SPTR_NAME@ gr_make_@BASE_NAME@ (@O_TYPE@ k); + friend GR_CORE_API @SPTR_NAME@ gr_make_@BASE_NAME@ (@O_TYPE@ k); @O_TYPE@ d_k; // the constant @NAME@ (@O_TYPE@ k); diff --git a/gnuradio-core/src/lib/gengen/gr_argmax_XX.h.t b/gnuradio-core/src/lib/gengen/gr_argmax_XX.h.t index 2aba94d71..437fa5735 100644 --- a/gnuradio-core/src/lib/gengen/gr_argmax_XX.h.t +++ b/gnuradio-core/src/lib/gengen/gr_argmax_XX.h.t @@ -25,17 +25,18 @@ #ifndef @GUARD_NAME@ #define @GUARD_NAME@ +#include <gr_core_api.h> #include <gr_sync_block.h> class @NAME@; typedef boost::shared_ptr<@NAME@> @SPTR_NAME@; -@SPTR_NAME@ gr_make_@BASE_NAME@ (size_t vlen); +GR_CORE_API @SPTR_NAME@ gr_make_@BASE_NAME@ (size_t vlen); -class @NAME@ : public gr_sync_block +class GR_CORE_API @NAME@ : public gr_sync_block { - friend @SPTR_NAME@ gr_make_@BASE_NAME@ (size_t vlen); + friend GR_CORE_API @SPTR_NAME@ gr_make_@BASE_NAME@ (size_t vlen); @NAME@ (size_t vlen); size_t d_vlen; diff --git a/gnuradio-core/src/lib/gengen/gr_chunks_to_symbols_XX.h.t b/gnuradio-core/src/lib/gengen/gr_chunks_to_symbols_XX.h.t index a5313d07d..c1393df3f 100644 --- a/gnuradio-core/src/lib/gengen/gr_chunks_to_symbols_XX.h.t +++ b/gnuradio-core/src/lib/gengen/gr_chunks_to_symbols_XX.h.t @@ -25,12 +25,13 @@ #ifndef @GUARD_NAME@ #define @GUARD_NAME@ +#include <gr_core_api.h> #include <gr_sync_interpolator.h> class @NAME@; typedef boost::shared_ptr<@NAME@> @SPTR_NAME@; -@SPTR_NAME@ gr_make_@BASE_NAME@ (const std::vector<@O_TYPE@> &symbol_table, const int D = 1); +GR_CORE_API @SPTR_NAME@ gr_make_@BASE_NAME@ (const std::vector<@O_TYPE@> &symbol_table, const int D = 1); /*! * \brief Map a stream of symbol indexes (unpacked bytes or shorts) to stream of float or complex onstellation points.in \p D dimensions (\p D = 1 by default) @@ -51,9 +52,9 @@ typedef boost::shared_ptr<@NAME@> @SPTR_NAME@; * \sa gr_chunks_to_symbols_sf, gr_chunks_to_symbols_sc. */ -class @NAME@ : public gr_sync_interpolator +class GR_CORE_API @NAME@ : public gr_sync_interpolator { - friend @SPTR_NAME@ gr_make_@BASE_NAME@ (const std::vector<@O_TYPE@> &symbol_table, const int D); + friend GR_CORE_API @SPTR_NAME@ gr_make_@BASE_NAME@ (const std::vector<@O_TYPE@> &symbol_table, const int D); int d_D; std::vector<@O_TYPE@> d_symbol_table; diff --git a/gnuradio-core/src/lib/gengen/gr_divide_XX.h.t b/gnuradio-core/src/lib/gengen/gr_divide_XX.h.t index a59497c8c..ebe5ff5e5 100644 --- a/gnuradio-core/src/lib/gengen/gr_divide_XX.h.t +++ b/gnuradio-core/src/lib/gengen/gr_divide_XX.h.t @@ -25,12 +25,13 @@ #ifndef @GUARD_NAME@ #define @GUARD_NAME@ +#include <gr_core_api.h> #include <gr_sync_block.h> class @NAME@; typedef boost::shared_ptr<@NAME@> @SPTR_NAME@; -@SPTR_NAME@ gr_make_@BASE_NAME@ (size_t vlen = 1); +GR_CORE_API @SPTR_NAME@ gr_make_@BASE_NAME@ (size_t vlen = 1); /*! * \brief output = input_0 / input_1 / input_x ...) @@ -38,9 +39,9 @@ typedef boost::shared_ptr<@NAME@> @SPTR_NAME@; * * Divide across all input streams. */ -class @NAME@ : public gr_sync_block +class GR_CORE_API @NAME@ : public gr_sync_block { - friend @SPTR_NAME@ gr_make_@BASE_NAME@ (size_t vlen); + friend GR_CORE_API @SPTR_NAME@ gr_make_@BASE_NAME@ (size_t vlen); @NAME@ (size_t vlen); diff --git a/gnuradio-core/src/lib/gengen/gr_integrate_XX.h.t b/gnuradio-core/src/lib/gengen/gr_integrate_XX.h.t index 01061ff21..c1d81000f 100644 --- a/gnuradio-core/src/lib/gengen/gr_integrate_XX.h.t +++ b/gnuradio-core/src/lib/gengen/gr_integrate_XX.h.t @@ -25,13 +25,14 @@ #ifndef @GUARD_NAME@ #define @GUARD_NAME@ +#include <gr_core_api.h> #include <gr_sync_decimator.h> class @NAME@; typedef boost::shared_ptr<@NAME@> @SPTR_NAME@; -@SPTR_NAME@ gr_make_@BASE_NAME@ (int decim); +GR_CORE_API @SPTR_NAME@ gr_make_@BASE_NAME@ (int decim); /*! * \brief output = sum(input[0]...input[n]) @@ -39,10 +40,10 @@ typedef boost::shared_ptr<@NAME@> @SPTR_NAME@; * * Integrate successive samples in input stream and decimate */ -class @NAME@ : public gr_sync_decimator +class GR_CORE_API @NAME@ : public gr_sync_decimator { private: - friend @SPTR_NAME@ gr_make_@BASE_NAME@(int decim); + friend GR_CORE_API @SPTR_NAME@ gr_make_@BASE_NAME@(int decim); @NAME@ (int decim); diff --git a/gnuradio-core/src/lib/gengen/gr_max_XX.h.t b/gnuradio-core/src/lib/gengen/gr_max_XX.h.t index 2aba94d71..437fa5735 100644 --- a/gnuradio-core/src/lib/gengen/gr_max_XX.h.t +++ b/gnuradio-core/src/lib/gengen/gr_max_XX.h.t @@ -25,17 +25,18 @@ #ifndef @GUARD_NAME@ #define @GUARD_NAME@ +#include <gr_core_api.h> #include <gr_sync_block.h> class @NAME@; typedef boost::shared_ptr<@NAME@> @SPTR_NAME@; -@SPTR_NAME@ gr_make_@BASE_NAME@ (size_t vlen); +GR_CORE_API @SPTR_NAME@ gr_make_@BASE_NAME@ (size_t vlen); -class @NAME@ : public gr_sync_block +class GR_CORE_API @NAME@ : public gr_sync_block { - friend @SPTR_NAME@ gr_make_@BASE_NAME@ (size_t vlen); + friend GR_CORE_API @SPTR_NAME@ gr_make_@BASE_NAME@ (size_t vlen); @NAME@ (size_t vlen); size_t d_vlen; diff --git a/gnuradio-core/src/lib/gengen/gr_moving_average_XX.h.t b/gnuradio-core/src/lib/gengen/gr_moving_average_XX.h.t index 2441ca65b..7e228abb6 100644 --- a/gnuradio-core/src/lib/gengen/gr_moving_average_XX.h.t +++ b/gnuradio-core/src/lib/gengen/gr_moving_average_XX.h.t @@ -25,13 +25,14 @@ #ifndef @GUARD_NAME@ #define @GUARD_NAME@ +#include <gr_core_api.h> #include <gr_sync_block.h> class @NAME@; typedef boost::shared_ptr<@NAME@> @SPTR_NAME@; -@SPTR_NAME@ gr_make_@BASE_NAME@ (int length, @O_TYPE@ scale, int max_iter = 4096); +GR_CORE_API @SPTR_NAME@ gr_make_@BASE_NAME@ (int length, @O_TYPE@ scale, int max_iter = 4096); /*! * \brief output is the moving sum of the last N samples, scaled by the scale factor @@ -40,10 +41,10 @@ typedef boost::shared_ptr<@NAME@> @SPTR_NAME@; * max_iter limits how long we go without flushing the accumulator * This is necessary to avoid numerical instability for float and complex. */ -class @NAME@ : public gr_sync_block +class GR_CORE_API @NAME@ : public gr_sync_block { private: - friend @SPTR_NAME@ gr_make_@BASE_NAME@(int length, @O_TYPE@ scale, int max_iter); + friend GR_CORE_API @SPTR_NAME@ gr_make_@BASE_NAME@(int length, @O_TYPE@ scale, int max_iter); @NAME@ (int length, @O_TYPE@ scale, int max_iter = 4096); diff --git a/gnuradio-core/src/lib/gengen/gr_multiply_XX.h.t b/gnuradio-core/src/lib/gengen/gr_multiply_XX.h.t index cb4a0273d..1feb16202 100644 --- a/gnuradio-core/src/lib/gengen/gr_multiply_XX.h.t +++ b/gnuradio-core/src/lib/gengen/gr_multiply_XX.h.t @@ -25,12 +25,13 @@ #ifndef @GUARD_NAME@ #define @GUARD_NAME@ +#include <gr_core_api.h> #include <gr_sync_block.h> class @NAME@; typedef boost::shared_ptr<@NAME@> @SPTR_NAME@; -@SPTR_NAME@ gr_make_@BASE_NAME@ (size_t vlen = 1); +GR_CORE_API @SPTR_NAME@ gr_make_@BASE_NAME@ (size_t vlen = 1); /*! * \brief output = prod (input_0, input_1, ...) @@ -38,9 +39,9 @@ typedef boost::shared_ptr<@NAME@> @SPTR_NAME@; * * Multiply across all input streams. */ -class @NAME@ : public gr_sync_block +class GR_CORE_API @NAME@ : public gr_sync_block { - friend @SPTR_NAME@ gr_make_@BASE_NAME@ (size_t vlen); + friend GR_CORE_API @SPTR_NAME@ gr_make_@BASE_NAME@ (size_t vlen); @NAME@ (size_t vlen); diff --git a/gnuradio-core/src/lib/gengen/gr_multiply_const_XX.h.t b/gnuradio-core/src/lib/gengen/gr_multiply_const_XX.h.t index 0c10185cc..6ff6f74a9 100644 --- a/gnuradio-core/src/lib/gengen/gr_multiply_const_XX.h.t +++ b/gnuradio-core/src/lib/gengen/gr_multiply_const_XX.h.t @@ -25,20 +25,21 @@ #ifndef @GUARD_NAME@ #define @GUARD_NAME@ +#include <gr_core_api.h> #include <gr_sync_block.h> class @NAME@; typedef boost::shared_ptr<@NAME@> @SPTR_NAME@; -@SPTR_NAME@ gr_make_@BASE_NAME@ (@O_TYPE@ k); +GR_CORE_API @SPTR_NAME@ gr_make_@BASE_NAME@ (@O_TYPE@ k); /*! * \brief output = input * constant * \ingroup math_blk */ -class @NAME@ : public gr_sync_block +class GR_CORE_API @NAME@ : public gr_sync_block { - friend @SPTR_NAME@ gr_make_@BASE_NAME@ (@O_TYPE@ k); + friend GR_CORE_API @SPTR_NAME@ gr_make_@BASE_NAME@ (@O_TYPE@ k); @O_TYPE@ d_k; // the constant @NAME@ (@O_TYPE@ k); diff --git a/gnuradio-core/src/lib/gengen/gr_multiply_const_vXX.h.t b/gnuradio-core/src/lib/gengen/gr_multiply_const_vXX.h.t index 81e781895..f696ab7b1 100755..100644 --- a/gnuradio-core/src/lib/gengen/gr_multiply_const_vXX.h.t +++ b/gnuradio-core/src/lib/gengen/gr_multiply_const_vXX.h.t @@ -25,20 +25,21 @@ #ifndef @GUARD_NAME@ #define @GUARD_NAME@ +#include <gr_core_api.h> #include <gr_sync_block.h> class @NAME@; typedef boost::shared_ptr<@NAME@> @SPTR_NAME@; -@SPTR_NAME@ gr_make_@BASE_NAME@ (const std::vector<@I_TYPE@> &k); +GR_CORE_API @SPTR_NAME@ gr_make_@BASE_NAME@ (const std::vector<@I_TYPE@> &k); /*! * \brief output vector = input vector * constant vector (element-wise) * \ingroup math_blk */ -class @NAME@ : public gr_sync_block +class GR_CORE_API @NAME@ : public gr_sync_block { - friend @SPTR_NAME@ gr_make_@BASE_NAME@ (const std::vector<@I_TYPE@> &k); + friend GR_CORE_API @SPTR_NAME@ gr_make_@BASE_NAME@ (const std::vector<@I_TYPE@> &k); std::vector<@I_TYPE@> d_k; // the constant @NAME@ (const std::vector<@I_TYPE@> &k); diff --git a/gnuradio-core/src/lib/gengen/gr_mute_XX.h.t b/gnuradio-core/src/lib/gengen/gr_mute_XX.h.t index 5007787c4..ccf966e53 100644 --- a/gnuradio-core/src/lib/gengen/gr_mute_XX.h.t +++ b/gnuradio-core/src/lib/gengen/gr_mute_XX.h.t @@ -25,20 +25,21 @@ #ifndef @GUARD_NAME@ #define @GUARD_NAME@ +#include <gr_core_api.h> #include <gr_sync_block.h> class @NAME@; typedef boost::shared_ptr<@NAME@> @SPTR_NAME@; -@SPTR_NAME@ gr_make_@BASE_NAME@ (bool mute=false); +GR_CORE_API @SPTR_NAME@ gr_make_@BASE_NAME@ (bool mute=false); /*! * \brief output = input or zero if muted. * \ingroup level_blk */ -class @NAME@ : public gr_sync_block +class GR_CORE_API @NAME@ : public gr_sync_block { - friend @SPTR_NAME@ gr_make_@BASE_NAME@ (bool mute); + friend GR_CORE_API @SPTR_NAME@ gr_make_@BASE_NAME@ (bool mute); bool d_mute; @NAME@ (bool mute); diff --git a/gnuradio-core/src/lib/gengen/gr_noise_source_X.h.t b/gnuradio-core/src/lib/gengen/gr_noise_source_X.h.t index a920ce04a..9dd92c8f5 100644 --- a/gnuradio-core/src/lib/gengen/gr_noise_source_X.h.t +++ b/gnuradio-core/src/lib/gengen/gr_noise_source_X.h.t @@ -25,6 +25,7 @@ #ifndef @GUARD_NAME@ #define @GUARD_NAME@ +#include <gr_core_api.h> #include <gr_sync_block.h> #include <gr_noise_type.h> #include <gr_random.h> @@ -33,15 +34,15 @@ class @NAME@; typedef boost::shared_ptr<@NAME@> @NAME@_sptr; -@NAME@_sptr +GR_CORE_API @NAME@_sptr gr_make_@BASE_NAME@ (gr_noise_type_t type, float ampl, long seed = 3021); /*! * \brief random number source * \ingroup source_blk */ -class @NAME@ : public gr_sync_block { - friend @NAME@_sptr +class GR_CORE_API @NAME@ : public gr_sync_block { + friend GR_CORE_API @NAME@_sptr gr_make_@BASE_NAME@ (gr_noise_type_t type, float ampl, long seed); gr_noise_type_t d_type; diff --git a/gnuradio-core/src/lib/gengen/gr_not_XX.h.t b/gnuradio-core/src/lib/gengen/gr_not_XX.h.t index cf8d96ede..b946ffc42 100644 --- a/gnuradio-core/src/lib/gengen/gr_not_XX.h.t +++ b/gnuradio-core/src/lib/gengen/gr_not_XX.h.t @@ -25,12 +25,13 @@ #ifndef @GUARD_NAME@ #define @GUARD_NAME@ +#include <gr_core_api.h> #include <gr_sync_block.h> class @NAME@; typedef boost::shared_ptr<@NAME@> @SPTR_NAME@; -@SPTR_NAME@ gr_make_@BASE_NAME@ (); +GR_CORE_API @SPTR_NAME@ gr_make_@BASE_NAME@ (); /*! * \brief output = ~input_0 @@ -38,9 +39,9 @@ typedef boost::shared_ptr<@NAME@> @SPTR_NAME@; * * bitwise boolean not across input stream. */ -class @NAME@ : public gr_sync_block +class GR_CORE_API @NAME@ : public gr_sync_block { - friend @SPTR_NAME@ gr_make_@BASE_NAME@ (); + friend GR_CORE_API @SPTR_NAME@ gr_make_@BASE_NAME@ (); @NAME@ (); diff --git a/gnuradio-core/src/lib/gengen/gr_or_XX.h.t b/gnuradio-core/src/lib/gengen/gr_or_XX.h.t index 3e02d9b1a..8d1fea951 100644 --- a/gnuradio-core/src/lib/gengen/gr_or_XX.h.t +++ b/gnuradio-core/src/lib/gengen/gr_or_XX.h.t @@ -25,12 +25,13 @@ #ifndef @GUARD_NAME@ #define @GUARD_NAME@ +#include <gr_core_api.h> #include <gr_sync_block.h> class @NAME@; typedef boost::shared_ptr<@NAME@> @SPTR_NAME@; -@SPTR_NAME@ gr_make_@BASE_NAME@ (); +GR_CORE_API @SPTR_NAME@ gr_make_@BASE_NAME@ (); /*! * \brief output = input_0 | input_1 | , ... | input_N) @@ -38,9 +39,9 @@ typedef boost::shared_ptr<@NAME@> @SPTR_NAME@; * * bitwise boolean or across all input streams. */ -class @NAME@ : public gr_sync_block +class GR_CORE_API @NAME@ : public gr_sync_block { - friend @SPTR_NAME@ gr_make_@BASE_NAME@ (); + friend GR_CORE_API @SPTR_NAME@ gr_make_@BASE_NAME@ (); @NAME@ (); diff --git a/gnuradio-core/src/lib/gengen/gr_packed_to_unpacked_XX.h.t b/gnuradio-core/src/lib/gengen/gr_packed_to_unpacked_XX.h.t index 803098c0d..77cd2b470 100644 --- a/gnuradio-core/src/lib/gengen/gr_packed_to_unpacked_XX.h.t +++ b/gnuradio-core/src/lib/gengen/gr_packed_to_unpacked_XX.h.t @@ -25,13 +25,14 @@ #ifndef @GUARD_NAME@ #define @GUARD_NAME@ +#include <gr_core_api.h> #include <gr_block.h> #include <gr_endianness.h> class @NAME@; typedef boost::shared_ptr<@NAME@> @SPTR_NAME@; -@SPTR_NAME@ +GR_CORE_API @SPTR_NAME@ gr_make_@BASE_NAME@ (unsigned int bits_per_chunk, gr_endianness_t endianness); /*! @@ -59,9 +60,9 @@ gr_make_@BASE_NAME@ (unsigned int bits_per_chunk, gr_endianness_t endianness); * \sa gr_chunks_to_symbols_sf, gr_chunks_to_symbols_sc. */ -class @NAME@ : public gr_block +class GR_CORE_API @NAME@ : public gr_block { - friend @SPTR_NAME@ + friend GR_CORE_API @SPTR_NAME@ gr_make_@BASE_NAME@ (unsigned int bits_per_chunk, gr_endianness_t endianness); @NAME@ (unsigned int bits_per_chunk, gr_endianness_t endianness); diff --git a/gnuradio-core/src/lib/gengen/gr_peak_detector_XX.h.t b/gnuradio-core/src/lib/gengen/gr_peak_detector_XX.h.t index d6a8caf76..d6d1e5e51 100644 --- a/gnuradio-core/src/lib/gengen/gr_peak_detector_XX.h.t +++ b/gnuradio-core/src/lib/gengen/gr_peak_detector_XX.h.t @@ -25,12 +25,13 @@ #ifndef @GUARD_NAME@ #define @GUARD_NAME@ +#include <gr_core_api.h> #include <gr_sync_block.h> class @NAME@; typedef boost::shared_ptr<@NAME@> @SPTR_NAME@; -@SPTR_NAME@ gr_make_@BASE_NAME@ (float threshold_factor_rise = 0.25, +GR_CORE_API @SPTR_NAME@ gr_make_@BASE_NAME@ (float threshold_factor_rise = 0.25, float threshold_factor_fall = 0.40, int look_ahead = 10, float alpha = 0.001); @@ -57,9 +58,9 @@ typedef boost::shared_ptr<@NAME@> @SPTR_NAME@; * This look-ahead range. * \param alpha The gain value of a moving average filter */ -class @NAME@ : public gr_sync_block +class GR_CORE_API @NAME@ : public gr_sync_block { - friend @SPTR_NAME@ gr_make_@BASE_NAME@ (float threshold_factor_rise, + friend GR_CORE_API @SPTR_NAME@ gr_make_@BASE_NAME@ (float threshold_factor_rise, float threshold_factor_fall, int look_ahead, float alpha); diff --git a/gnuradio-core/src/lib/gengen/gr_sample_and_hold_XX.h.t b/gnuradio-core/src/lib/gengen/gr_sample_and_hold_XX.h.t index b96487326..328c47106 100644 --- a/gnuradio-core/src/lib/gengen/gr_sample_and_hold_XX.h.t +++ b/gnuradio-core/src/lib/gengen/gr_sample_and_hold_XX.h.t @@ -25,12 +25,13 @@ #ifndef @GUARD_NAME@ #define @GUARD_NAME@ +#include <gr_core_api.h> #include <gr_sync_block.h> class @NAME@; typedef boost::shared_ptr<@NAME@> @SPTR_NAME@; -@SPTR_NAME@ gr_make_@BASE_NAME@ (); +GR_CORE_API @SPTR_NAME@ gr_make_@BASE_NAME@ (); /*! * \brief sample and hold circuit @@ -39,9 +40,9 @@ typedef boost::shared_ptr<@NAME@> @SPTR_NAME@; * Samples the data stream (input stream 0) and holds the value * if the control signal is 1 (intput stream 1). */ -class @NAME@ : public gr_sync_block +class GR_CORE_API @NAME@ : public gr_sync_block { - friend @SPTR_NAME@ gr_make_@BASE_NAME@ (); + friend GR_CORE_API @SPTR_NAME@ gr_make_@BASE_NAME@ (); @NAME@ (); diff --git a/gnuradio-core/src/lib/gengen/gr_sig_source_X.h.t b/gnuradio-core/src/lib/gengen/gr_sig_source_X.h.t index 9906d16ab..3df723868 100644 --- a/gnuradio-core/src/lib/gengen/gr_sig_source_X.h.t +++ b/gnuradio-core/src/lib/gengen/gr_sig_source_X.h.t @@ -25,6 +25,7 @@ #ifndef @GUARD_NAME@ #define @GUARD_NAME@ +#include <gr_core_api.h> #include <gr_sync_block.h> #include <gr_sig_source_waveform.h> #include <gr_fxpt_nco.h> @@ -37,8 +38,8 @@ typedef boost::shared_ptr<@NAME@> @NAME@_sptr; * \ingroup source_blk */ -class @NAME@ : public gr_sync_block { - friend @NAME@_sptr +class GR_CORE_API @NAME@ : public gr_sync_block { + friend GR_CORE_API @NAME@_sptr gr_make_@BASE_NAME@ (double sampling_freq, gr_waveform_t waveform, double frequency, double ampl, @TYPE@ offset); @@ -73,7 +74,7 @@ class @NAME@ : public gr_sync_block { void set_offset (@TYPE@ offset); }; -@NAME@_sptr +GR_CORE_API @NAME@_sptr gr_make_@BASE_NAME@ (double sampling_freq, gr_waveform_t waveform, double wave_freq, double ampl, @TYPE@ offset = 0); diff --git a/gnuradio-core/src/lib/gengen/gr_sub_XX.h.t b/gnuradio-core/src/lib/gengen/gr_sub_XX.h.t index a58d1f3b8..4c988945e 100644 --- a/gnuradio-core/src/lib/gengen/gr_sub_XX.h.t +++ b/gnuradio-core/src/lib/gengen/gr_sub_XX.h.t @@ -25,12 +25,13 @@ #ifndef @GUARD_NAME@ #define @GUARD_NAME@ +#include <gr_core_api.h> #include <gr_sync_block.h> class @NAME@; typedef boost::shared_ptr<@NAME@> @SPTR_NAME@; -@SPTR_NAME@ gr_make_@BASE_NAME@ (size_t vlen = 1); +GR_CORE_API @SPTR_NAME@ gr_make_@BASE_NAME@ (size_t vlen = 1); /*! * \brief output = input_0 - input_1 - ...) @@ -38,9 +39,9 @@ typedef boost::shared_ptr<@NAME@> @SPTR_NAME@; * * Subtract across all input streams. */ -class @NAME@ : public gr_sync_block +class GR_CORE_API @NAME@ : public gr_sync_block { - friend @SPTR_NAME@ gr_make_@BASE_NAME@ (size_t vlen); + friend GR_CORE_API @SPTR_NAME@ gr_make_@BASE_NAME@ (size_t vlen); @NAME@ (size_t vlen); diff --git a/gnuradio-core/src/lib/gengen/gr_unpacked_to_packed_XX.h.t b/gnuradio-core/src/lib/gengen/gr_unpacked_to_packed_XX.h.t index 42d201093..a7db84c5c 100644 --- a/gnuradio-core/src/lib/gengen/gr_unpacked_to_packed_XX.h.t +++ b/gnuradio-core/src/lib/gengen/gr_unpacked_to_packed_XX.h.t @@ -25,13 +25,14 @@ #ifndef @GUARD_NAME@ #define @GUARD_NAME@ +#include <gr_core_api.h> #include <gr_block.h> #include <gr_endianness.h> class @NAME@; typedef boost::shared_ptr<@NAME@> @NAME@_sptr; -@SPTR_NAME@ +GR_CORE_API @SPTR_NAME@ gr_make_@BASE_NAME@ (unsigned int bits_per_chunk, gr_endianness_t endianness); /*! @@ -57,9 +58,9 @@ gr_make_@BASE_NAME@ (unsigned int bits_per_chunk, gr_endianness_t endianness); * \sa gr_chunks_to_symbols_bf, gr_chunks_to_symbols_bc. * \sa gr_chunks_to_symbols_sf, gr_chunks_to_symbols_sc. */ -class @NAME@ : public gr_block +class GR_CORE_API @NAME@ : public gr_block { - friend @SPTR_NAME@ + friend GR_CORE_API @SPTR_NAME@ gr_make_@BASE_NAME@ (unsigned int bits_per_chunk, gr_endianness_t endianness); @NAME@ (unsigned int bits_per_chunk, gr_endianness_t endianness); diff --git a/gnuradio-core/src/lib/gengen/gr_vector_sink_X.h.t b/gnuradio-core/src/lib/gengen/gr_vector_sink_X.h.t index 7ba5ee9e9..475cc0112 100644 --- a/gnuradio-core/src/lib/gengen/gr_vector_sink_X.h.t +++ b/gnuradio-core/src/lib/gengen/gr_vector_sink_X.h.t @@ -25,12 +25,13 @@ #ifndef @GUARD_NAME@ #define @GUARD_NAME@ +#include <gr_core_api.h> #include <gr_sync_block.h> class @NAME@; typedef boost::shared_ptr<@NAME@> @NAME@_sptr; -@NAME@_sptr +GR_CORE_API @NAME@_sptr gr_make_@BASE_NAME@ (int vlen = 1); @@ -39,8 +40,8 @@ gr_make_@BASE_NAME@ (int vlen = 1); * \ingroup sink_blk */ -class @NAME@ : public gr_sync_block { - friend @NAME@_sptr gr_make_@BASE_NAME@ (int vlen); +class GR_CORE_API @NAME@ : public gr_sync_block { + friend GR_CORE_API @NAME@_sptr gr_make_@BASE_NAME@ (int vlen); std::vector<@TYPE@> d_data; int d_vlen; @NAME@ (int vlen); diff --git a/gnuradio-core/src/lib/gengen/gr_vector_source_X.h.t b/gnuradio-core/src/lib/gengen/gr_vector_source_X.h.t index 63edcb61c..fbab3effb 100644 --- a/gnuradio-core/src/lib/gengen/gr_vector_source_X.h.t +++ b/gnuradio-core/src/lib/gengen/gr_vector_source_X.h.t @@ -25,9 +25,10 @@ #ifndef @GUARD_NAME@ #define @GUARD_NAME@ +#include <gr_core_api.h> #include <gr_sync_block.h> -class @NAME@; +class GR_CORE_API @NAME@; typedef boost::shared_ptr<@NAME@> @NAME@_sptr; /*! @@ -36,7 +37,7 @@ typedef boost::shared_ptr<@NAME@> @NAME@_sptr; */ class @NAME@ : public gr_sync_block { - friend @NAME@_sptr + friend GR_CORE_API @NAME@_sptr gr_make_@BASE_NAME@ (const std::vector<@TYPE@> &data, bool repeat, int vlen); std::vector<@TYPE@> d_data; @@ -53,7 +54,7 @@ class @NAME@ : public gr_sync_block { gr_vector_void_star &output_items); }; -@NAME@_sptr +GR_CORE_API @NAME@_sptr gr_make_@BASE_NAME@ (const std::vector<@TYPE@> &data, bool repeat = false, int vlen = 1); #endif diff --git a/gnuradio-core/src/lib/gengen/gr_xor_XX.h.t b/gnuradio-core/src/lib/gengen/gr_xor_XX.h.t index 33d729450..b2e1a68c8 100644 --- a/gnuradio-core/src/lib/gengen/gr_xor_XX.h.t +++ b/gnuradio-core/src/lib/gengen/gr_xor_XX.h.t @@ -25,12 +25,13 @@ #ifndef @GUARD_NAME@ #define @GUARD_NAME@ +#include <gr_core_api.h> #include <gr_sync_block.h> class @NAME@; typedef boost::shared_ptr<@NAME@> @SPTR_NAME@; -@SPTR_NAME@ gr_make_@BASE_NAME@ (); +GR_CORE_API @SPTR_NAME@ gr_make_@BASE_NAME@ (); /*! * \brief output = input_0 ^ input_1 ^ , ... ^ input_N) @@ -38,9 +39,9 @@ typedef boost::shared_ptr<@NAME@> @SPTR_NAME@; * * bitwise boolean xor across all input streams. */ -class @NAME@ : public gr_sync_block +class GR_CORE_API @NAME@ : public gr_sync_block { - friend @SPTR_NAME@ gr_make_@BASE_NAME@ (); + friend GR_CORE_API @SPTR_NAME@ gr_make_@BASE_NAME@ (); @NAME@ (); diff --git a/gnuradio-core/src/lib/hier/CMakeLists.txt b/gnuradio-core/src/lib/hier/CMakeLists.txt new file mode 100644 index 000000000..fb922f60e --- /dev/null +++ b/gnuradio-core/src/lib/hier/CMakeLists.txt @@ -0,0 +1,42 @@ +# Copyright 2010-2011 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio 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 General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. + +######################################################################## +# This file included, use CMake directory variables +######################################################################## +INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}) + +LIST(APPEND gnuradio_core_sources + ${CMAKE_CURRENT_SOURCE_DIR}/gr_channel_model.cc +) + +INSTALL(FILES + ${CMAKE_CURRENT_SOURCE_DIR}/gr_channel_model.h + DESTINATION ${GR_INCLUDE_DIR}/gnuradio + COMPONENT "core_devel" +) + +IF(ENABLE_PYTHON) + INSTALL(FILES + ${CMAKE_CURRENT_SOURCE_DIR}/hier.i + ${CMAKE_CURRENT_SOURCE_DIR}/gr_channel_model.i + DESTINATION ${GR_INCLUDE_DIR}/gnuradio/swig + COMPONENT "core_swig" + ) +ENDIF(ENABLE_PYTHON) diff --git a/gnuradio-core/src/lib/hier/gr_channel_model.h b/gnuradio-core/src/lib/hier/gr_channel_model.h index 116b5dc14..07c0c76b6 100644 --- a/gnuradio-core/src/lib/hier/gr_channel_model.h +++ b/gnuradio-core/src/lib/hier/gr_channel_model.h @@ -19,6 +19,7 @@ * Boston, MA 02110-1301, USA. */ +#include <gr_core_api.h> #include <gr_top_block.h> #include <gr_fractional_interpolator_cc.h> #include <gr_sig_source_c.h> @@ -31,7 +32,7 @@ class gr_channel_model; typedef boost::shared_ptr<gr_channel_model> gr_channel_model_sptr; -gr_channel_model_sptr gr_make_channel_model(double noise_voltage=0.0, +GR_CORE_API gr_channel_model_sptr gr_make_channel_model(double noise_voltage=0.0, double frequency_offset=0.0, double epsilon=1.0, const std::vector<gr_complex> &taps=std::vector<gr_complex>(1, 1), @@ -41,7 +42,7 @@ gr_channel_model_sptr gr_make_channel_model(double noise_voltage=0.0, * \brief channel simulator * \ingroup misc_blk */ -class gr_channel_model : public gr_hier_block2 +class GR_CORE_API gr_channel_model : public gr_hier_block2 { private: gr_channel_model(double noise_voltage, @@ -50,7 +51,7 @@ class gr_channel_model : public gr_hier_block2 const std::vector<gr_complex> &taps, double noise_seed); - friend gr_channel_model_sptr gr_make_channel_model(double noise_voltage, + friend GR_CORE_API gr_channel_model_sptr gr_make_channel_model(double noise_voltage, double frequency_offset, double epsilon, const std::vector<gr_complex> &taps, diff --git a/gnuradio-core/src/lib/io/CMakeLists.txt b/gnuradio-core/src/lib/io/CMakeLists.txt new file mode 100644 index 000000000..7ffe8306e --- /dev/null +++ b/gnuradio-core/src/lib/io/CMakeLists.txt @@ -0,0 +1,108 @@ +# Copyright 2010-2011 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio 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 General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. + +######################################################################## +# This file included, use CMake directory variables +######################################################################## + +######################################################################## +# Append gnuradio-core library sources +######################################################################## +LIST(APPEND gnuradio_core_sources + ${CMAKE_CURRENT_SOURCE_DIR}/gr_histo_sink_f.cc + ${CMAKE_CURRENT_SOURCE_DIR}/gr_oscope_guts.cc + ${CMAKE_CURRENT_SOURCE_DIR}/gr_oscope_sink_f.cc + ${CMAKE_CURRENT_SOURCE_DIR}/gr_oscope_sink_x.cc + ${CMAKE_CURRENT_SOURCE_DIR}/i2c.cc + ${CMAKE_CURRENT_SOURCE_DIR}/i2c_bitbang.cc + ${CMAKE_CURRENT_SOURCE_DIR}/i2c_bbio.cc + ${CMAKE_CURRENT_SOURCE_DIR}/i2c_bbio_pp.cc + ${CMAKE_CURRENT_SOURCE_DIR}/microtune_4702.cc + ${CMAKE_CURRENT_SOURCE_DIR}/microtune_4937.cc + ${CMAKE_CURRENT_SOURCE_DIR}/microtune_xxxx.cc + ${CMAKE_CURRENT_SOURCE_DIR}/ppio_ppdev.cc + ${CMAKE_CURRENT_SOURCE_DIR}/gri_wavfile.cc +) + +######################################################################## +# Install runtime headers +######################################################################## +INSTALL(FILES + ${CMAKE_CURRENT_SOURCE_DIR}/gr_histo_sink_f.h + ${CMAKE_CURRENT_SOURCE_DIR}/gr_oscope_guts.h + ${CMAKE_CURRENT_SOURCE_DIR}/gr_oscope_sink_f.h + ${CMAKE_CURRENT_SOURCE_DIR}/gr_oscope_sink_x.h + ${CMAKE_CURRENT_SOURCE_DIR}/gr_trigger_mode.h + ${CMAKE_CURRENT_SOURCE_DIR}/i2c.h + ${CMAKE_CURRENT_SOURCE_DIR}/i2c_bitbang.h + ${CMAKE_CURRENT_SOURCE_DIR}/i2c_bbio.h + ${CMAKE_CURRENT_SOURCE_DIR}/i2c_bbio_pp.h + ${CMAKE_CURRENT_SOURCE_DIR}/microtune_4702.h + ${CMAKE_CURRENT_SOURCE_DIR}/microtune_4937.h + ${CMAKE_CURRENT_SOURCE_DIR}/microtune_eval_board_defs.h + ${CMAKE_CURRENT_SOURCE_DIR}/microtune_xxxx.h + ${CMAKE_CURRENT_SOURCE_DIR}/ppio_ppdev.h + ${CMAKE_CURRENT_SOURCE_DIR}/gri_wavfile.h + DESTINATION ${GR_INCLUDE_DIR}/gnuradio + COMPONENT "core_devel" +) + +######################################################################## +# Install swig headers +######################################################################## +IF(ENABLE_PYTHON) +INSTALL(FILES + ${CMAKE_CURRENT_SOURCE_DIR}/io.i + ${CMAKE_CURRENT_SOURCE_DIR}/gr_histo_sink.i + ${CMAKE_CURRENT_SOURCE_DIR}/gr_oscope_sink.i + DESTINATION ${GR_INCLUDE_DIR}/gnuradio/swig + COMPONENT "core_swig" +) +ENDIF(ENABLE_PYTHON) + +######################################################################## +# Handle triple-threat files that have cc, h, and i +######################################################################## +SET(gr_core_io_triple_threats + gr_file_sink + gr_file_sink_base + gr_file_source + gr_file_descriptor_sink + gr_file_descriptor_source + gr_message_sink + gr_message_source + microtune_xxxx_eval_board + microtune_4702_eval_board + microtune_4937_eval_board + ppio + sdr_1000 + gr_udp_sink + gr_udp_source + gr_wavfile_source + gr_wavfile_sink + gr_tagged_file_sink +) + +FOREACH(file_tt ${gr_core_io_triple_threats}) + LIST(APPEND gnuradio_core_sources ${CMAKE_CURRENT_SOURCE_DIR}/${file_tt}.cc) + INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${file_tt}.h DESTINATION ${GR_INCLUDE_DIR}/gnuradio COMPONENT "core_devel") + IF(ENABLE_PYTHON) + INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${file_tt}.i DESTINATION ${GR_INCLUDE_DIR}/gnuradio/swig COMPONENT "core_swig") + ENDIF(ENABLE_PYTHON) +ENDFOREACH(file_tt ${gr_core_io_triple_threats}) diff --git a/gnuradio-core/src/lib/io/gr_file_descriptor_sink.cc b/gnuradio-core/src/lib/io/gr_file_descriptor_sink.cc index 09fb6c826..11e0a8eb9 100644 --- a/gnuradio-core/src/lib/io/gr_file_descriptor_sink.cc +++ b/gnuradio-core/src/lib/io/gr_file_descriptor_sink.cc @@ -34,6 +34,9 @@ #include <stdexcept> #include <stdio.h> +#ifdef HAVE_IO_H +#include <io.h> +#endif gr_file_descriptor_sink::gr_file_descriptor_sink (size_t itemsize, int fd) : gr_sync_block ("file_descriptor_sink", diff --git a/gnuradio-core/src/lib/io/gr_file_descriptor_sink.h b/gnuradio-core/src/lib/io/gr_file_descriptor_sink.h index fa8fa3f05..5e4cc6505 100644 --- a/gnuradio-core/src/lib/io/gr_file_descriptor_sink.h +++ b/gnuradio-core/src/lib/io/gr_file_descriptor_sink.h @@ -23,21 +23,22 @@ #ifndef INCLUDED_GR_FILE_DESCRIPTOR_SINK_H #define INCLUDED_GR_FILE_DESCRIPTOR_SINK_H +#include <gr_core_api.h> #include <gr_sync_block.h> class gr_file_descriptor_sink; typedef boost::shared_ptr<gr_file_descriptor_sink> gr_file_descriptor_sink_sptr; -gr_file_descriptor_sink_sptr gr_make_file_descriptor_sink (size_t itemsize, int fd); +GR_CORE_API gr_file_descriptor_sink_sptr gr_make_file_descriptor_sink (size_t itemsize, int fd); /*! * \brief Write stream to file descriptor. * \ingroup sink_blk */ -class gr_file_descriptor_sink : public gr_sync_block +class GR_CORE_API gr_file_descriptor_sink : public gr_sync_block { - friend gr_file_descriptor_sink_sptr gr_make_file_descriptor_sink (size_t itemsize, int fd); + friend GR_CORE_API gr_file_descriptor_sink_sptr gr_make_file_descriptor_sink (size_t itemsize, int fd); private: size_t d_itemsize; diff --git a/gnuradio-core/src/lib/io/gr_file_descriptor_source.cc b/gnuradio-core/src/lib/io/gr_file_descriptor_source.cc index 700ad4aef..334a57848 100644 --- a/gnuradio-core/src/lib/io/gr_file_descriptor_source.cc +++ b/gnuradio-core/src/lib/io/gr_file_descriptor_source.cc @@ -35,6 +35,9 @@ #include <stdio.h> #include <string.h> +#ifdef HAVE_IO_H +#include <io.h> +#endif gr_file_descriptor_source::gr_file_descriptor_source (size_t itemsize, int fd, diff --git a/gnuradio-core/src/lib/io/gr_file_descriptor_source.h b/gnuradio-core/src/lib/io/gr_file_descriptor_source.h index a9f117286..fa513fd25 100644 --- a/gnuradio-core/src/lib/io/gr_file_descriptor_source.h +++ b/gnuradio-core/src/lib/io/gr_file_descriptor_source.h @@ -23,12 +23,13 @@ #ifndef INCLUDED_GR_FILE_DESCRIPTOR_SOURCE_H #define INCLUDED_GR_FILE_DESCRIPTOR_SOURCE_H +#include <gr_core_api.h> #include <gr_sync_block.h> class gr_file_descriptor_source; typedef boost::shared_ptr<gr_file_descriptor_source> gr_file_descriptor_source_sptr; -gr_file_descriptor_source_sptr +GR_CORE_API gr_file_descriptor_source_sptr gr_make_file_descriptor_source (size_t itemsize, int fd, bool repeat = false); /*! @@ -36,9 +37,9 @@ gr_make_file_descriptor_source (size_t itemsize, int fd, bool repeat = false); * \ingroup source_blk */ -class gr_file_descriptor_source : public gr_sync_block +class GR_CORE_API gr_file_descriptor_source : public gr_sync_block { - friend gr_file_descriptor_source_sptr + friend GR_CORE_API gr_file_descriptor_source_sptr gr_make_file_descriptor_source (size_t itemsize, int fd, bool repeat); private: size_t d_itemsize; diff --git a/gnuradio-core/src/lib/io/gr_file_sink.h b/gnuradio-core/src/lib/io/gr_file_sink.h index b9ad06cd6..180cbef2a 100644 --- a/gnuradio-core/src/lib/io/gr_file_sink.h +++ b/gnuradio-core/src/lib/io/gr_file_sink.h @@ -23,22 +23,23 @@ #ifndef INCLUDED_GR_FILE_SINK_H #define INCLUDED_GR_FILE_SINK_H +#include <gr_core_api.h> #include <gr_sync_block.h> #include <gr_file_sink_base.h> class gr_file_sink; typedef boost::shared_ptr<gr_file_sink> gr_file_sink_sptr; -gr_file_sink_sptr gr_make_file_sink(size_t itemsize, const char *filename); +GR_CORE_API gr_file_sink_sptr gr_make_file_sink(size_t itemsize, const char *filename); /*! * \brief Write stream to file. * \ingroup sink_blk */ -class gr_file_sink : public gr_sync_block, public gr_file_sink_base +class GR_CORE_API gr_file_sink : public gr_sync_block, public gr_file_sink_base { - friend gr_file_sink_sptr gr_make_file_sink(size_t itemsize, const char *filename); + friend GR_CORE_API gr_file_sink_sptr gr_make_file_sink(size_t itemsize, const char *filename); private: size_t d_itemsize; diff --git a/gnuradio-core/src/lib/io/gr_file_sink_base.h b/gnuradio-core/src/lib/io/gr_file_sink_base.h index 7b96cdb7f..6765dbad8 100644 --- a/gnuradio-core/src/lib/io/gr_file_sink_base.h +++ b/gnuradio-core/src/lib/io/gr_file_sink_base.h @@ -23,13 +23,14 @@ #ifndef INCLUDED_GR_FILE_SINK_BASE_H #define INCLUDED_GR_FILE_SINK_BASE_H +#include <gr_core_api.h> #include <boost/thread.hpp> #include <cstdio> /*! * \brief Common base class for file sinks */ -class gr_file_sink_base +class GR_CORE_API gr_file_sink_base { protected: FILE *d_fp; // current FILE pointer diff --git a/gnuradio-core/src/lib/io/gr_file_source.h b/gnuradio-core/src/lib/io/gr_file_source.h index 5f5c2564e..6e8fc4074 100644 --- a/gnuradio-core/src/lib/io/gr_file_source.h +++ b/gnuradio-core/src/lib/io/gr_file_source.h @@ -23,12 +23,13 @@ #ifndef INCLUDED_GR_FILE_SOURCE_H #define INCLUDED_GR_FILE_SOURCE_H +#include <gr_core_api.h> #include <gr_sync_block.h> class gr_file_source; typedef boost::shared_ptr<gr_file_source> gr_file_source_sptr; -gr_file_source_sptr +GR_CORE_API gr_file_source_sptr gr_make_file_source (size_t itemsize, const char *filename, bool repeat = false); /*! @@ -36,9 +37,9 @@ gr_make_file_source (size_t itemsize, const char *filename, bool repeat = false) * \ingroup source_blk */ -class gr_file_source : public gr_sync_block +class GR_CORE_API gr_file_source : public gr_sync_block { - friend gr_file_source_sptr gr_make_file_source (size_t itemsize, + friend GR_CORE_API gr_file_source_sptr gr_make_file_source (size_t itemsize, const char *filename, bool repeat); private: diff --git a/gnuradio-core/src/lib/io/gr_histo_sink_f.h b/gnuradio-core/src/lib/io/gr_histo_sink_f.h index 8ba45ec55..934066ba2 100644 --- a/gnuradio-core/src/lib/io/gr_histo_sink_f.h +++ b/gnuradio-core/src/lib/io/gr_histo_sink_f.h @@ -23,6 +23,7 @@ #ifndef INCLUDED_GR_HISTO_SINK_F_H #define INCLUDED_GR_HISTO_SINK_F_H +#include <gr_core_api.h> #include <gr_sync_block.h> #include <gr_msg_queue.h> #include <gruel/thread.h> @@ -30,13 +31,13 @@ class gr_histo_sink_f; typedef boost::shared_ptr<gr_histo_sink_f> gr_histo_sink_f_sptr; -gr_histo_sink_f_sptr gr_make_histo_sink_f (gr_msg_queue_sptr msgq); +GR_CORE_API gr_histo_sink_f_sptr gr_make_histo_sink_f (gr_msg_queue_sptr msgq); /*! * \brief Histogram module. * \ingroup sink_blk */ -class gr_histo_sink_f : public gr_sync_block +class GR_CORE_API gr_histo_sink_f : public gr_sync_block { private: gr_msg_queue_sptr d_msgq; @@ -47,7 +48,7 @@ private: float *d_samps; gruel::mutex d_mutex; - friend gr_histo_sink_f_sptr gr_make_histo_sink_f (gr_msg_queue_sptr msgq); + friend GR_CORE_API gr_histo_sink_f_sptr gr_make_histo_sink_f (gr_msg_queue_sptr msgq); gr_histo_sink_f (gr_msg_queue_sptr msgq); void send_frame(void); void clear(void); diff --git a/gnuradio-core/src/lib/io/gr_message_sink.h b/gnuradio-core/src/lib/io/gr_message_sink.h index 5f1e5f91f..180055261 100644 --- a/gnuradio-core/src/lib/io/gr_message_sink.h +++ b/gnuradio-core/src/lib/io/gr_message_sink.h @@ -23,6 +23,7 @@ #ifndef INCLUDED_GR_MESSAGE_SINK_H #define INCLUDED_GR_MESSAGE_SINK_H +#include <gr_core_api.h> #include <gr_sync_block.h> #include <gr_message.h> #include <gr_msg_queue.h> @@ -30,7 +31,7 @@ class gr_message_sink; typedef boost::shared_ptr<gr_message_sink> gr_message_sink_sptr; -gr_message_sink_sptr gr_make_message_sink (size_t itemsize, +GR_CORE_API gr_message_sink_sptr gr_make_message_sink (size_t itemsize, gr_msg_queue_sptr msgq, bool dont_block); @@ -38,14 +39,14 @@ gr_message_sink_sptr gr_make_message_sink (size_t itemsize, * \brief Gather received items into messages and insert into msgq * \ingroup sink_blk */ -class gr_message_sink : public gr_sync_block +class GR_CORE_API gr_message_sink : public gr_sync_block { private: size_t d_itemsize; gr_msg_queue_sptr d_msgq; bool d_dont_block; - friend gr_message_sink_sptr + friend GR_CORE_API gr_message_sink_sptr gr_make_message_sink(size_t itemsize, gr_msg_queue_sptr msgq, bool dont_block); protected: diff --git a/gnuradio-core/src/lib/io/gr_message_source.h b/gnuradio-core/src/lib/io/gr_message_source.h index 46a808754..16a0f4474 100644 --- a/gnuradio-core/src/lib/io/gr_message_source.h +++ b/gnuradio-core/src/lib/io/gr_message_source.h @@ -23,6 +23,7 @@ #ifndef INCLUDED_GR_MESSAGE_SOURCE_H #define INCLUDED_GR_MESSAGE_SOURCE_H +#include <gr_core_api.h> #include <gr_sync_block.h> #include <gr_message.h> #include <gr_msg_queue.h> @@ -30,14 +31,14 @@ class gr_message_source; typedef boost::shared_ptr<gr_message_source> gr_message_source_sptr; -gr_message_source_sptr gr_make_message_source (size_t itemsize, int msgq_limit=0); -gr_message_source_sptr gr_make_message_source (size_t itemsize, gr_msg_queue_sptr msgq); +GR_CORE_API gr_message_source_sptr gr_make_message_source (size_t itemsize, int msgq_limit=0); +GR_CORE_API gr_message_source_sptr gr_make_message_source (size_t itemsize, gr_msg_queue_sptr msgq); /*! * \brief Turn received messages into a stream * \ingroup source_blk */ -class gr_message_source : public gr_sync_block +class GR_CORE_API gr_message_source : public gr_sync_block { private: size_t d_itemsize; @@ -46,9 +47,9 @@ class gr_message_source : public gr_sync_block unsigned d_msg_offset; bool d_eof; - friend gr_message_source_sptr + friend GR_CORE_API gr_message_source_sptr gr_make_message_source(size_t itemsize, int msgq_limit); - friend gr_message_source_sptr + friend GR_CORE_API gr_message_source_sptr gr_make_message_source(size_t itemsize, gr_msg_queue_sptr msgq); protected: diff --git a/gnuradio-core/src/lib/io/gr_oscope_guts.h b/gnuradio-core/src/lib/io/gr_oscope_guts.h index f39db62f6..3223d4e38 100644 --- a/gnuradio-core/src/lib/io/gr_oscope_guts.h +++ b/gnuradio-core/src/lib/io/gr_oscope_guts.h @@ -24,6 +24,7 @@ #ifndef INCLUDED_GR_OSCOPE_GUTS_H #define INCLUDED_GR_OSCOPE_GUTS_H +#include <gr_core_api.h> #include <gr_trigger_mode.h> #include <gr_msg_queue.h> @@ -40,7 +41,7 @@ * consist of 50% pre-trigger data and 50% post-trigger data. */ -class gr_oscope_guts { +class GR_CORE_API gr_oscope_guts { public: static const int MAX_CHANNELS = 8; private: diff --git a/gnuradio-core/src/lib/io/gr_oscope_sink_f.h b/gnuradio-core/src/lib/io/gr_oscope_sink_f.h index 1a8022b89..e3d1f65e5 100644 --- a/gnuradio-core/src/lib/io/gr_oscope_sink_f.h +++ b/gnuradio-core/src/lib/io/gr_oscope_sink_f.h @@ -23,13 +23,14 @@ #ifndef INCLUDED_GR_OSCOPE_SINK_F_H #define INCLUDED_GR_OSCOPE_SINK_F_H +#include <gr_core_api.h> #include <gr_oscope_sink_x.h> #include <gr_msg_queue.h> class gr_oscope_sink_f; typedef boost::shared_ptr<gr_oscope_sink_x> gr_oscope_sink_f_sptr; -gr_oscope_sink_f_sptr gr_make_oscope_sink_f (double sampling_rate, gr_msg_queue_sptr msgq); +GR_CORE_API gr_oscope_sink_f_sptr gr_make_oscope_sink_f (double sampling_rate, gr_msg_queue_sptr msgq); /*! @@ -38,10 +39,10 @@ gr_oscope_sink_f_sptr gr_make_oscope_sink_f (double sampling_rate, gr_msg_queue_ * * Accepts multiple float streams. */ -class gr_oscope_sink_f : public gr_oscope_sink_x +class GR_CORE_API gr_oscope_sink_f : public gr_oscope_sink_x { private: - friend gr_oscope_sink_f_sptr + friend GR_CORE_API gr_oscope_sink_f_sptr gr_make_oscope_sink_f (double sampling_rate, gr_msg_queue_sptr msgq); gr_oscope_sink_f (double sampling_rate, gr_msg_queue_sptr msgq); diff --git a/gnuradio-core/src/lib/io/gr_oscope_sink_x.h b/gnuradio-core/src/lib/io/gr_oscope_sink_x.h index 62cf65100..aaff5870b 100644 --- a/gnuradio-core/src/lib/io/gr_oscope_sink_x.h +++ b/gnuradio-core/src/lib/io/gr_oscope_sink_x.h @@ -23,6 +23,7 @@ #ifndef INCLUDED_GR_OSCOPE_SINK_X_H #define INCLUDED_GR_OSCOPE_SINK_X_H +#include <gr_core_api.h> #include <gr_sync_block.h> #include <gr_trigger_mode.h> @@ -34,7 +35,7 @@ class gr_oscope_guts; * * Don't instantiate this. Use gr_oscope_sink_f or gr_oscope_sink_c instead. */ -class gr_oscope_sink_x : public gr_sync_block +class GR_CORE_API gr_oscope_sink_x : public gr_sync_block { protected: double d_sampling_rate; diff --git a/gnuradio-core/src/lib/io/gr_tagged_file_sink.cc b/gnuradio-core/src/lib/io/gr_tagged_file_sink.cc index 154611c32..91618bad6 100644 --- a/gnuradio-core/src/lib/io/gr_tagged_file_sink.cc +++ b/gnuradio-core/src/lib/io/gr_tagged_file_sink.cc @@ -34,6 +34,10 @@ #include <iostream> #include <gr_tag_info.h> +#ifdef HAVE_IO_H +#include <io.h> +#endif + #ifdef O_BINARY #define OUR_O_BINARY O_BINARY #else diff --git a/gnuradio-core/src/lib/io/gr_tagged_file_sink.h b/gnuradio-core/src/lib/io/gr_tagged_file_sink.h index 2e0a5c63a..da12dca78 100644 --- a/gnuradio-core/src/lib/io/gr_tagged_file_sink.h +++ b/gnuradio-core/src/lib/io/gr_tagged_file_sink.h @@ -23,13 +23,14 @@ #ifndef INCLUDED_GR_TAGGED_FILE_SINK_H #define INCLUDED_GR_TAGGED_FILE_SINK_H +#include <gr_core_api.h> #include <gr_sync_block.h> #include <cstdio> // for FILE class gr_tagged_file_sink; typedef boost::shared_ptr<gr_tagged_file_sink> gr_tagged_file_sink_sptr; -gr_tagged_file_sink_sptr gr_make_tagged_file_sink (size_t itemsize, +GR_CORE_API gr_tagged_file_sink_sptr gr_make_tagged_file_sink (size_t itemsize, double samp_rate); /*! @@ -37,9 +38,9 @@ gr_tagged_file_sink_sptr gr_make_tagged_file_sink (size_t itemsize, * \ingroup sink_blk */ -class gr_tagged_file_sink : public gr_sync_block +class GR_CORE_API gr_tagged_file_sink : public gr_sync_block { - friend gr_tagged_file_sink_sptr gr_make_tagged_file_sink (size_t itemsize, + friend GR_CORE_API gr_tagged_file_sink_sptr gr_make_tagged_file_sink (size_t itemsize, double samp_rate); private: diff --git a/gnuradio-core/src/lib/io/gr_udp_sink.h b/gnuradio-core/src/lib/io/gr_udp_sink.h index 421d514a4..e9d4f8c73 100644 --- a/gnuradio-core/src/lib/io/gr_udp_sink.h +++ b/gnuradio-core/src/lib/io/gr_udp_sink.h @@ -23,13 +23,14 @@ #ifndef INCLUDED_GR_UDP_SINK_H #define INCLUDED_GR_UDP_SINK_H +#include <gr_core_api.h> #include <gr_sync_block.h> #include <gruel/thread.h> class gr_udp_sink; typedef boost::shared_ptr<gr_udp_sink> gr_udp_sink_sptr; -gr_udp_sink_sptr +GR_CORE_API gr_udp_sink_sptr gr_make_udp_sink (size_t itemsize, const char *host, unsigned short port, int payload_size=1472, bool eof=true); @@ -47,9 +48,9 @@ gr_make_udp_sink (size_t itemsize, * \param eof Send zero-length packet on disconnect */ -class gr_udp_sink : public gr_sync_block +class GR_CORE_API gr_udp_sink : public gr_sync_block { - friend gr_udp_sink_sptr gr_make_udp_sink (size_t itemsize, + friend GR_CORE_API gr_udp_sink_sptr gr_make_udp_sink (size_t itemsize, const char *host, unsigned short port, int payload_size, bool eof); diff --git a/gnuradio-core/src/lib/io/gr_udp_source.h b/gnuradio-core/src/lib/io/gr_udp_source.h index 5d30fad30..e2898981d 100644 --- a/gnuradio-core/src/lib/io/gr_udp_source.h +++ b/gnuradio-core/src/lib/io/gr_udp_source.h @@ -23,13 +23,14 @@ #ifndef INCLUDED_GR_UDP_SOURCE_H #define INCLUDED_GR_UDP_SOURCE_H +#include <gr_core_api.h> #include <gr_sync_block.h> #include <gruel/thread.h> class gr_udp_source; typedef boost::shared_ptr<gr_udp_source> gr_udp_source_sptr; -gr_udp_source_sptr gr_make_udp_source(size_t itemsize, const char *host, +GR_CORE_API gr_udp_source_sptr gr_make_udp_source(size_t itemsize, const char *host, unsigned short port, int payload_size=1472, bool eof=true, bool wait=true); @@ -52,9 +53,9 @@ gr_udp_source_sptr gr_make_udp_source(size_t itemsize, const char *host, * */ -class gr_udp_source : public gr_sync_block +class GR_CORE_API gr_udp_source : public gr_sync_block { - friend gr_udp_source_sptr gr_make_udp_source(size_t itemsize, + friend GR_CORE_API gr_udp_source_sptr gr_make_udp_source(size_t itemsize, const char *host, unsigned short port, int payload_size, diff --git a/gnuradio-core/src/lib/io/gr_wavfile_sink.h b/gnuradio-core/src/lib/io/gr_wavfile_sink.h index a1d6ed527..5fd3eaadc 100644 --- a/gnuradio-core/src/lib/io/gr_wavfile_sink.h +++ b/gnuradio-core/src/lib/io/gr_wavfile_sink.h @@ -23,6 +23,7 @@ #ifndef INCLUDED_GR_WAVFILE_SINK_H #define INCLUDED_GR_WAVFILE_SINK_H +#include <gr_core_api.h> #include <gr_sync_block.h> #include <gr_file_sink_base.h> #include <boost/thread.hpp> @@ -36,7 +37,7 @@ typedef boost::shared_ptr<gr_wavfile_sink> gr_wavfile_sink_sptr; * \p sample_rate Sample rate [S/s] * \p bits_per_sample 16 or 8 bit, default is 16 */ -gr_wavfile_sink_sptr +GR_CORE_API gr_wavfile_sink_sptr gr_make_wavfile_sink (const char *filename, int n_channels, unsigned int sample_rate, @@ -50,10 +51,10 @@ gr_make_wavfile_sink (const char *filename, * * \ingroup sink_blk */ -class gr_wavfile_sink : public gr_sync_block +class GR_CORE_API gr_wavfile_sink : public gr_sync_block { private: - friend gr_wavfile_sink_sptr gr_make_wavfile_sink (const char *filename, + friend GR_CORE_API gr_wavfile_sink_sptr gr_make_wavfile_sink (const char *filename, int n_channels, unsigned int sample_rate, int bits_per_sample); diff --git a/gnuradio-core/src/lib/io/gr_wavfile_source.h b/gnuradio-core/src/lib/io/gr_wavfile_source.h index e434a6b4c..b300f2808 100644 --- a/gnuradio-core/src/lib/io/gr_wavfile_source.h +++ b/gnuradio-core/src/lib/io/gr_wavfile_source.h @@ -23,13 +23,14 @@ #ifndef INCLUDED_GR_WAVFILE_SOURCE_H #define INCLUDED_GR_WAVFILE_SOURCE_H +#include <gr_core_api.h> #include <gr_sync_block.h> #include <cstdio> // for FILE class gr_wavfile_source; typedef boost::shared_ptr<gr_wavfile_source> gr_wavfile_source_sptr; -gr_wavfile_source_sptr +GR_CORE_API gr_wavfile_source_sptr gr_make_wavfile_source (const char *filename, bool repeat = false); /*! @@ -41,10 +42,10 @@ gr_make_wavfile_source (const char *filename, bool repeat = false); * \ingroup source_blk */ -class gr_wavfile_source : public gr_sync_block +class GR_CORE_API gr_wavfile_source : public gr_sync_block { private: - friend gr_wavfile_source_sptr gr_make_wavfile_source (const char *filename, + friend GR_CORE_API gr_wavfile_source_sptr gr_make_wavfile_source (const char *filename, bool repeat); gr_wavfile_source(const char *filename, bool repeat); diff --git a/gnuradio-core/src/lib/io/gri_wavfile.cc b/gnuradio-core/src/lib/io/gri_wavfile.cc index b8375edc2..8f1c6a2bb 100644 --- a/gnuradio-core/src/lib/io/gri_wavfile.cc +++ b/gnuradio-core/src/lib/io/gri_wavfile.cc @@ -160,25 +160,25 @@ gri_wavheader_parse(FILE *fp, return false; } - fread(&file_size, 1, 4, fp); + fresult = fread(&file_size, 1, 4, fp); fresult = fread(str_buf, 1, 8, fp); if (fresult != 8 || strncmp(str_buf, "WAVEfmt ", 8) || feof(fp)) { return false; } - fread(&fmt_hdr_skip, 1, 4, fp); + fresult = fread(&fmt_hdr_skip, 1, 4, fp); - fread(&compression_type, 1, 2, fp); + fresult = fread(&compression_type, 1, 2, fp); if (wav_to_host(compression_type) != VALID_COMPRESSION_TYPE) { return false; } - fread(&nchans, 1, 2, fp); - fread(&sample_rate, 1, 4, fp); - fread(&avg_bytes_per_sec, 1, 4, fp); - fread(&block_align, 1, 2, fp); - fread(&bits_per_sample, 1, 2, fp); + fresult = fread(&nchans, 1, 2, fp); + fresult = fread(&sample_rate, 1, 4, fp); + fresult = fread(&avg_bytes_per_sec, 1, 4, fp); + fresult = fread(&block_align, 1, 2, fp); + fresult = fread(&bits_per_sample, 1, 2, fp); if (ferror(fp)) { return false; @@ -204,7 +204,7 @@ gri_wavheader_parse(FILE *fp, return false; } - fread(&chunk_size, 1, 4, fp); + fresult = fread(&chunk_size, 1, 4, fp); if (ferror(fp)) { return false; } @@ -226,7 +226,9 @@ short int gri_wav_read_sample(FILE *fp, int bytes_per_sample) { int16_t buf = 0; - fread(&buf, bytes_per_sample, 1, fp); + size_t fresult; + + fresult = fread(&buf, bytes_per_sample, 1, fp); return (short) wav_to_host(buf); } diff --git a/gnuradio-core/src/lib/io/gri_wavfile.h b/gnuradio-core/src/lib/io/gri_wavfile.h index 2c7c1207c..2268474fb 100644 --- a/gnuradio-core/src/lib/io/gri_wavfile.h +++ b/gnuradio-core/src/lib/io/gri_wavfile.h @@ -23,6 +23,7 @@ // This file stores all the RIFF file type knowledge for the gr_wavfile_* // blocks. +#include <gr_core_api.h> #include <cstdio> /*! diff --git a/gnuradio-core/src/lib/io/i2c.h b/gnuradio-core/src/lib/io/i2c.h index e959f59a8..7d446dfa3 100644 --- a/gnuradio-core/src/lib/io/i2c.h +++ b/gnuradio-core/src/lib/io/i2c.h @@ -23,6 +23,7 @@ #ifndef INCLUDED_I2C_H #define INCLUDED_I2C_H +#include <gr_core_api.h> #include <boost/shared_ptr.hpp> class i2c; @@ -31,7 +32,7 @@ typedef boost::shared_ptr<i2c> i2c_sptr; /*! * \brief abstract class for controlling i2c bus */ -class i2c { +class GR_CORE_API i2c { public: i2c () {} diff --git a/gnuradio-core/src/lib/io/i2c_bbio.h b/gnuradio-core/src/lib/io/i2c_bbio.h index c6b226e39..110a56555 100644 --- a/gnuradio-core/src/lib/io/i2c_bbio.h +++ b/gnuradio-core/src/lib/io/i2c_bbio.h @@ -23,6 +23,7 @@ #ifndef INCLUDED_I2C_BBIO_H #define INCLUDED_I2C_BBIO_H +#include <gr_core_api.h> #include <boost/shared_ptr.hpp> class i2c_bbio; @@ -33,7 +34,7 @@ typedef boost::shared_ptr<i2c_bbio> i2c_bbio_sptr; * \brief abstract class that implements bit banging i/o for i2c bus. * \ingroup base */ -class i2c_bbio { +class GR_CORE_API i2c_bbio { public: i2c_bbio () {} diff --git a/gnuradio-core/src/lib/io/i2c_bbio_pp.h b/gnuradio-core/src/lib/io/i2c_bbio_pp.h index 5a99cdcd1..4a311a2c9 100644 --- a/gnuradio-core/src/lib/io/i2c_bbio_pp.h +++ b/gnuradio-core/src/lib/io/i2c_bbio_pp.h @@ -23,6 +23,7 @@ #ifndef INCLUDED_I2C_BBIO_PP_H #define INCLUDED_I2C_BBIO_PP_H +#include <gr_core_api.h> #include "i2c_bbio.h" #include "ppio.h" @@ -33,8 +34,8 @@ * This class talks to the i2c bus on the microtune eval board using * the parallel port. This works for both the 4937 and 4702 boards. */ -class i2c_bbio_pp : public i2c_bbio { - friend i2c_bbio_sptr make_i2c_bbio_pp (ppio_sptr pp); +class GR_CORE_API i2c_bbio_pp : public i2c_bbio { + friend GR_CORE_API i2c_bbio_sptr make_i2c_bbio_pp (ppio_sptr pp); i2c_bbio_pp (ppio_sptr pp); public: @@ -50,7 +51,7 @@ class i2c_bbio_pp : public i2c_bbio { ppio_sptr d_pp; }; -i2c_bbio_sptr make_i2c_bbio_pp (ppio_sptr pp); +GR_CORE_API i2c_bbio_sptr make_i2c_bbio_pp (ppio_sptr pp); #endif /* INCLUDED_I2C_BBIO_PP_H */ diff --git a/gnuradio-core/src/lib/io/i2c_bitbang.h b/gnuradio-core/src/lib/io/i2c_bitbang.h index c9deb38ba..feb23b787 100644 --- a/gnuradio-core/src/lib/io/i2c_bitbang.h +++ b/gnuradio-core/src/lib/io/i2c_bitbang.h @@ -23,6 +23,7 @@ #ifndef INCLUDED_I2C_BITBANG_H #define INCLUDED_I2C_BITBANG_H +#include <gr_core_api.h> #include <i2c.h> #include <i2c_bbio.h> @@ -30,8 +31,8 @@ * \brief class for controlling i2c bus * \ingroup base */ -class i2c_bitbang : public i2c { - friend i2c_sptr make_i2c_bitbang (i2c_bbio_sptr io); +class GR_CORE_API i2c_bitbang : public i2c { + friend GR_CORE_API i2c_sptr make_i2c_bitbang (i2c_bbio_sptr io); i2c_bitbang (i2c_bbio_sptr io); public: @@ -57,7 +58,7 @@ private: i2c_bbio_sptr d_io; }; -i2c_sptr make_i2c_bitbang (i2c_bbio_sptr io); +GR_CORE_API i2c_sptr make_i2c_bitbang (i2c_bbio_sptr io); #endif /* INCLUDED_I2C_BITBANG_H */ diff --git a/gnuradio-core/src/lib/io/microtune_4702.h b/gnuradio-core/src/lib/io/microtune_4702.h index 95c64abe7..fd8d89305 100644 --- a/gnuradio-core/src/lib/io/microtune_4702.h +++ b/gnuradio-core/src/lib/io/microtune_4702.h @@ -23,6 +23,7 @@ #ifndef INCLUDED_MICROTUNE_4702_H #define INCLUDED_MICROTUNE_4702_H +#include <gr_core_api.h> #include <microtune_xxxx.h> /*! @@ -30,7 +31,7 @@ * \ingroup hardware */ -class microtune_4702 : public microtune_xxxx { +class GR_CORE_API microtune_4702 : public microtune_xxxx { public: microtune_4702 (i2c_sptr i2c, int i2c_addr); diff --git a/gnuradio-core/src/lib/io/microtune_4702_eval_board.h b/gnuradio-core/src/lib/io/microtune_4702_eval_board.h index 6e9726917..e3c07fdf9 100644 --- a/gnuradio-core/src/lib/io/microtune_4702_eval_board.h +++ b/gnuradio-core/src/lib/io/microtune_4702_eval_board.h @@ -23,6 +23,7 @@ #ifndef INCLUDED_MICROTUNE_4702_EVAL_BOARD_H #define INCLUDED_MICROTUNE_4702_EVAL_BOARD_H +#include <gr_core_api.h> #include "microtune_xxxx_eval_board.h" /*! @@ -30,7 +31,7 @@ * \ingroup hardware */ -class microtune_4702_eval_board : public microtune_xxxx_eval_board { +class GR_CORE_API microtune_4702_eval_board : public microtune_xxxx_eval_board { public: microtune_4702_eval_board (int which_pp = 0); ~microtune_4702_eval_board (); diff --git a/gnuradio-core/src/lib/io/microtune_4937.h b/gnuradio-core/src/lib/io/microtune_4937.h index b263ceb0f..bc8a26c64 100644 --- a/gnuradio-core/src/lib/io/microtune_4937.h +++ b/gnuradio-core/src/lib/io/microtune_4937.h @@ -23,13 +23,14 @@ #ifndef INCLUDED_MICROTUNE_4937_H #define INCLUDED_MICROTUNE_4937_H +#include <gr_core_api.h> #include <microtune_xxxx.h> /*! * \brief class for controlling microtune 4937 tuner module * \ingroup hardware */ -class microtune_4937 : public microtune_xxxx { +class GR_CORE_API microtune_4937 : public microtune_xxxx { public: microtune_4937 (i2c_sptr i2c, int i2c_addr = 0x61); virtual ~microtune_4937 (); diff --git a/gnuradio-core/src/lib/io/microtune_4937_eval_board.h b/gnuradio-core/src/lib/io/microtune_4937_eval_board.h index 154a7281a..09c00d116 100644 --- a/gnuradio-core/src/lib/io/microtune_4937_eval_board.h +++ b/gnuradio-core/src/lib/io/microtune_4937_eval_board.h @@ -23,6 +23,7 @@ #ifndef INCLUDED_MICROTUNE_4937_EVAL_BOARD_H #define INCLUDED_MICROTUNE_4937_EVAL_BOARD_H +#include <gr_core_api.h> #include "microtune_xxxx_eval_board.h" /*! @@ -30,7 +31,7 @@ * \ingroup hardware */ -class microtune_4937_eval_board : public microtune_xxxx_eval_board { +class GR_CORE_API microtune_4937_eval_board : public microtune_xxxx_eval_board { public: microtune_4937_eval_board (int which_pp = 0); ~microtune_4937_eval_board (); diff --git a/gnuradio-core/src/lib/io/microtune_xxxx.h b/gnuradio-core/src/lib/io/microtune_xxxx.h index 4d5074a85..8b6ec25aa 100644 --- a/gnuradio-core/src/lib/io/microtune_xxxx.h +++ b/gnuradio-core/src/lib/io/microtune_xxxx.h @@ -23,6 +23,7 @@ #ifndef INCLUDED_MICROTUNE_XXXX_H #define INCLUDED_MICROTUNE_XXXX_H +#include <gr_core_api.h> #include <boost/shared_ptr.hpp> class i2c; @@ -32,7 +33,7 @@ typedef boost::shared_ptr<i2c> i2c_sptr; * \brief abstract class for controlling microtune {4937,4702} tuner modules * \ingroup base */ -class microtune_xxxx { +class GR_CORE_API microtune_xxxx { public: microtune_xxxx () {} virtual ~microtune_xxxx (); diff --git a/gnuradio-core/src/lib/io/microtune_xxxx_eval_board.cc b/gnuradio-core/src/lib/io/microtune_xxxx_eval_board.cc index 668f04cad..14f2b8589 100644 --- a/gnuradio-core/src/lib/io/microtune_xxxx_eval_board.cc +++ b/gnuradio-core/src/lib/io/microtune_xxxx_eval_board.cc @@ -20,6 +20,10 @@ * Boston, MA 02110-1301, USA. */ +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + #include "microtune_xxxx_eval_board.h" #include "microtune_eval_board_defs.h" #include "microtune_xxxx.h" diff --git a/gnuradio-core/src/lib/io/microtune_xxxx_eval_board.h b/gnuradio-core/src/lib/io/microtune_xxxx_eval_board.h index 808075e55..08aa438c0 100644 --- a/gnuradio-core/src/lib/io/microtune_xxxx_eval_board.h +++ b/gnuradio-core/src/lib/io/microtune_xxxx_eval_board.h @@ -23,6 +23,7 @@ #ifndef INCLUDED_MICROTUNE_XXXX_EVAL_BOARD_H #define INCLUDED_MICROTUNE_XXXX_EVAL_BOARD_H +#include <gr_core_api.h> #include <boost/shared_ptr.hpp> class microtune_xxxx; @@ -37,7 +38,7 @@ typedef boost::shared_ptr<i2c> i2c_sptr; * \brief abstract class for controlling microtune xxxx eval board * \ingroup hardware */ -class microtune_xxxx_eval_board { +class GR_CORE_API microtune_xxxx_eval_board { public: microtune_xxxx_eval_board (int which_pp = 0); virtual ~microtune_xxxx_eval_board (); diff --git a/gnuradio-core/src/lib/io/ppio.h b/gnuradio-core/src/lib/io/ppio.h index e1a62e2a3..f7d14d52e 100644 --- a/gnuradio-core/src/lib/io/ppio.h +++ b/gnuradio-core/src/lib/io/ppio.h @@ -23,6 +23,7 @@ #ifndef INCLUDED_PPIO_H #define INCLUDED_PPIO_H +#include <gr_core_api.h> #include <boost/shared_ptr.hpp> class ppio; @@ -34,7 +35,7 @@ typedef boost::shared_ptr<ppio> ppio_sptr; * \ingroup hardware */ -class ppio { +class GR_CORE_API ppio { public: ppio () {} virtual ~ppio (); @@ -55,7 +56,7 @@ class ppio { * Split out from class to make life easier for SWIG */ -ppio_sptr make_ppio (int which_pp); +GR_CORE_API ppio_sptr make_ppio (int which_pp); #endif /* INCLUDED_PPIO_H */ diff --git a/gnuradio-core/src/lib/io/ppio_ppdev.h b/gnuradio-core/src/lib/io/ppio_ppdev.h index b5abe3f0a..5d082d784 100644 --- a/gnuradio-core/src/lib/io/ppio_ppdev.h +++ b/gnuradio-core/src/lib/io/ppio_ppdev.h @@ -23,6 +23,7 @@ #ifndef INCLUDED_PPIO_PPDEV_H #define INCLUDED_PPIO_PPDEV_H +#include <gr_core_api.h> #include <ppio.h> class ppio_ppdev; @@ -33,8 +34,8 @@ typedef boost::shared_ptr<ppio_ppdev> ppio_ppdev_sptr; * \ingroup hardware */ -class ppio_ppdev : public ppio { - friend ppio_ppdev_sptr make_ppio_ppdev (int which = 0); +class GR_CORE_API ppio_ppdev : public ppio { + friend GR_CORE_API ppio_ppdev_sptr make_ppio_ppdev (int which = 0); ppio_ppdev (int which = 0); public: diff --git a/gnuradio-core/src/lib/io/sdr_1000.h b/gnuradio-core/src/lib/io/sdr_1000.h index 113e85deb..6647fbba5 100644 --- a/gnuradio-core/src/lib/io/sdr_1000.h +++ b/gnuradio-core/src/lib/io/sdr_1000.h @@ -23,6 +23,7 @@ #ifndef INCLUDED_SDR_1000_H #define INCLUDED_SDR_1000_H +#include <gr_core_api.h> #include <boost/shared_ptr.hpp> class ppio; @@ -36,7 +37,7 @@ enum { L_EXT = 0, L_BAND = 1, L_DDS0 = 2, L_DDS1 = 3 }; * \sa sdr_1000.py for a higher level interface. * \ingroup hardware */ -class sdr_1000_base { +class GR_CORE_API sdr_1000_base { ppio_sptr d_ppio; int d_shadow[4]; // shadow latches diff --git a/gnuradio-core/src/lib/missing/CMakeLists.txt b/gnuradio-core/src/lib/missing/CMakeLists.txt new file mode 100644 index 000000000..fb4620452 --- /dev/null +++ b/gnuradio-core/src/lib/missing/CMakeLists.txt @@ -0,0 +1,32 @@ +# Copyright 2010 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio 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 General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. + +######################################################################## +# This file included, use CMake directory variables +######################################################################## + +LIST(APPEND gnuradio_core_sources + ${CMAKE_CURRENT_SOURCE_DIR}/bug_work_around_8.cc +) + +IF(CMAKE_SYSTEM_PROCESSOR MATCHES "^(powerpc|ppc)") + LIST(APPEND gnuradio_core_sources + ${CMAKE_CURRENT_SOURCE_DIR}/posix_memalign.cc + ) +ENDIF(CMAKE_SYSTEM_PROCESSOR MATCHES "^(powerpc|ppc)") diff --git a/gnuradio-core/src/lib/reed-solomon/CMakeLists.txt b/gnuradio-core/src/lib/reed-solomon/CMakeLists.txt new file mode 100644 index 000000000..5640b12a2 --- /dev/null +++ b/gnuradio-core/src/lib/reed-solomon/CMakeLists.txt @@ -0,0 +1,62 @@ +# Copyright 2010-2011 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio 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 General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. + +######################################################################## +# This file included, use CMake directory variables +######################################################################## +#MSVC workaround: we cant have dynamically sized arrays. +#So ifdef a max array bounds that is larger than NN and NROOTS +#Its a bit of a hack, but if you look at the code, its so full of ifdefs, +#and lacks optimization where it should be pre-allocating these arrays. +IF(MSVC) + SET_SOURCE_FILES_PROPERTIES( + ${CMAKE_CURRENT_SOURCE_DIR}/exercise.c + ${CMAKE_CURRENT_SOURCE_DIR}/decode_rs.c + PROPERTIES COMPILE_DEFINITIONS "MAX_ARRAY=256;" + ) +ENDIF(MSVC) + +SET(gr_core_rs_sources + ${CMAKE_CURRENT_SOURCE_DIR}/encode_rs.c + ${CMAKE_CURRENT_SOURCE_DIR}/decode_rs.c + ${CMAKE_CURRENT_SOURCE_DIR}/init_rs.c +) + +######################################################################## +# Setup sources and includes +######################################################################## +LIST(APPEND gnuradio_core_sources ${gr_core_rs_sources}) + +INSTALL( + FILES ${CMAKE_CURRENT_SOURCE_DIR}/rs.h + DESTINATION ${GR_INCLUDE_DIR}/gnuradio + COMPONENT "core_devel" +) + +######################################################################## +# Register unit tests +######################################################################## +IF(ENABLE_TESTING) +ADD_EXECUTABLE(gr_core_rstest + ${gr_core_rs_sources} + ${CMAKE_CURRENT_SOURCE_DIR}/rstest.c + ${CMAKE_CURRENT_SOURCE_DIR}/exercise.c +) +ADD_TEST(gr-core-reed-solomon-test gr_core_rstest) +ENDIF(ENABLE_TESTING) diff --git a/gnuradio-core/src/lib/reed-solomon/char.h b/gnuradio-core/src/lib/reed-solomon/char.h index 2fbcb504a..8010fb0b9 100644 --- a/gnuradio-core/src/lib/reed-solomon/char.h +++ b/gnuradio-core/src/lib/reed-solomon/char.h @@ -6,6 +6,8 @@ #define DTYPE unsigned char +#include <gr_core_api.h> + /* Reed-Solomon codec control block */ struct rs { unsigned int mm; /* Bits per symbol */ @@ -44,12 +46,11 @@ static inline int modnn(struct rs *rs,int x){ #define INIT_RS init_rs_char #define FREE_RS free_rs_char -void ENCODE_RS(void *p,DTYPE *data,DTYPE *parity); -int DECODE_RS(void *p,DTYPE *data,int *eras_pos,int no_eras); -void *INIT_RS(unsigned int symsize,unsigned int gfpoly,unsigned int fcr, +GR_CORE_API void ENCODE_RS(void *p,DTYPE *data,DTYPE *parity); +GR_CORE_API int DECODE_RS(void *p,DTYPE *data,int *eras_pos,int no_eras); +GR_CORE_API void *INIT_RS(unsigned int symsize,unsigned int gfpoly,unsigned int fcr, unsigned int prim,unsigned int nroots); -void FREE_RS(void *p); - +GR_CORE_API void FREE_RS(void *p); diff --git a/gnuradio-core/src/lib/reed-solomon/decode_rs.c b/gnuradio-core/src/lib/reed-solomon/decode_rs.c index 27ddd8532..ba60b89ee 100644 --- a/gnuradio-core/src/lib/reed-solomon/decode_rs.c +++ b/gnuradio-core/src/lib/reed-solomon/decode_rs.c @@ -8,7 +8,6 @@ #endif #include <string.h> -#include <strings.h> #define NULL ((void *)0) #define min(a,b) ((a) < (b) ? (a) : (b)) @@ -32,11 +31,19 @@ DTYPE *data, int *eras_pos, int no_eras){ #endif int deg_lambda, el, deg_omega; int i, j, r,k; +#ifdef MAX_ARRAY + DTYPE u,q,tmp,num1,num2,den,discr_r; + DTYPE lambda[MAX_ARRAY], s[MAX_ARRAY]; /* Err+Eras Locator poly + * and syndrome poly */ + DTYPE b[MAX_ARRAY], t[MAX_ARRAY], omega[MAX_ARRAY]; + DTYPE root[MAX_ARRAY], reg[MAX_ARRAY], loc[MAX_ARRAY]; +#else DTYPE u,q,tmp,num1,num2,den,discr_r; DTYPE lambda[NROOTS+1], s[NROOTS]; /* Err+Eras Locator poly * and syndrome poly */ DTYPE b[NROOTS+1], t[NROOTS+1], omega[NROOTS+1]; DTYPE root[NROOTS], reg[NROOTS+1], loc[NROOTS]; +#endif int syn_error, count; /* form the syndromes; i.e., evaluate data(x) at roots of g(x) */ diff --git a/gnuradio-core/src/lib/reed-solomon/encode_rs.c b/gnuradio-core/src/lib/reed-solomon/encode_rs.c index 147f0a9e3..9d56d0bf1 100644 --- a/gnuradio-core/src/lib/reed-solomon/encode_rs.c +++ b/gnuradio-core/src/lib/reed-solomon/encode_rs.c @@ -3,7 +3,6 @@ * May be used under the terms of the GNU General Public License (GPL) */ #include <string.h> -#include <strings.h> #ifdef FIXED #include "fixed.h" diff --git a/gnuradio-core/src/lib/reed-solomon/exercise.c b/gnuradio-core/src/lib/reed-solomon/exercise.c index 1e04f618d..987fe1aeb 100644 --- a/gnuradio-core/src/lib/reed-solomon/exercise.c +++ b/gnuradio-core/src/lib/reed-solomon/exercise.c @@ -13,7 +13,6 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> -#include <strings.h> #ifdef FIXED #include "fixed.h" @@ -47,11 +46,19 @@ int trials){ #if !defined(CCSDS) && !defined(FIXED) struct rs *rs = (struct rs *)p; #endif +#if MAX_ARRAY + DTYPE block[MAX_ARRAY],tblock[MAX_ARRAY]; + int i; + int errors; + int errlocs[MAX_ARRAY]; + int derrlocs[MAX_ARRAY]; +#else DTYPE block[NN],tblock[NN]; int i; int errors; int errlocs[NN]; int derrlocs[NROOTS]; +#endif int derrors; int errval,errloc; int erasures; diff --git a/gnuradio-core/src/lib/reed-solomon/fixed.h b/gnuradio-core/src/lib/reed-solomon/fixed.h index 9f0ddd9a4..30091e7bf 100644 --- a/gnuradio-core/src/lib/reed-solomon/fixed.h +++ b/gnuradio-core/src/lib/reed-solomon/fixed.h @@ -7,6 +7,8 @@ */ #define DTYPE unsigned char +#include <gr_core_api.h> + static inline int mod255(int x){ while (x >= 255) { x -= 255; @@ -34,5 +36,5 @@ extern unsigned char CCSDS_poly[]; #define ENCODE_RS encode_rs_8 #define DECODE_RS decode_rs_8 -void ENCODE_RS(DTYPE *data,DTYPE *parity); -int DECODE_RS(DTYPE *data, int *eras_pos, int no_eras); +GR_CORE_API void ENCODE_RS(DTYPE *data,DTYPE *parity); +GR_CORE_API int DECODE_RS(DTYPE *data, int *eras_pos, int no_eras);
\ No newline at end of file diff --git a/gnuradio-core/src/lib/reed-solomon/int.h b/gnuradio-core/src/lib/reed-solomon/int.h index 2b0405ae0..79979f827 100644 --- a/gnuradio-core/src/lib/reed-solomon/int.h +++ b/gnuradio-core/src/lib/reed-solomon/int.h @@ -5,8 +5,10 @@ */ #define DTYPE int +#include <gr_core_api.h> + /* Reed-Solomon codec control block */ -struct rs { +struct GR_CORE_API rs { unsigned int mm; /* Bits per symbol */ unsigned int nn; /* Symbols per block (= (1<<mm)-1) */ int *alpha_to; /* log lookup table */ @@ -43,12 +45,11 @@ static inline int modnn(struct rs *rs,int x){ #define INIT_RS init_rs_int #define FREE_RS free_rs_int -void ENCODE_RS(void *p,DTYPE *data,DTYPE *parity); -int DECODE_RS(void *p,DTYPE *data,int *eras_pos,int no_eras); +GR_CORE_API void ENCODE_RS(void *p,DTYPE *data,DTYPE *parity); +GR_CORE_API int DECODE_RS(void *p,DTYPE *data,int *eras_pos,int no_eras); void *INIT_RS(unsigned int symsize,unsigned int gfpoly,unsigned int fcr, unsigned int prim,unsigned int nroots); -void FREE_RS(void *p); - +GR_CORE_API void FREE_RS(void *p); diff --git a/gnuradio-core/src/lib/reed-solomon/rs.h b/gnuradio-core/src/lib/reed-solomon/rs.h index 9e731d9d9..97e78769e 100644 --- a/gnuradio-core/src/lib/reed-solomon/rs.h +++ b/gnuradio-core/src/lib/reed-solomon/rs.h @@ -1,28 +1,29 @@ +#include <gr_core_api.h> /* User include file for the Reed-Solomon codec * Copyright 2002, Phil Karn KA9Q * May be used under the terms of the GNU General Public License (GPL) */ /* General purpose RS codec, 8-bit symbols */ -void encode_rs_char(void *rs,unsigned char *data,unsigned char *parity); -int decode_rs_char(void *rs,unsigned char *data,int *eras_pos, +GR_CORE_API void encode_rs_char(void *rs,unsigned char *data,unsigned char *parity); +GR_CORE_API int decode_rs_char(void *rs,unsigned char *data,int *eras_pos, int no_eras); -void *init_rs_char(unsigned int symsize,unsigned int gfpoly, +GR_CORE_API void *init_rs_char(unsigned int symsize,unsigned int gfpoly, unsigned int fcr,unsigned int prim,unsigned int nroots); -void free_rs_char(void *rs); +GR_CORE_API void free_rs_char(void *rs); /* General purpose RS codec, integer symbols */ -void encode_rs_int(void *rs,int *data,int *parity); -int decode_rs_int(void *rs,int *data,int *eras_pos,int no_eras); -void *init_rs_int(unsigned int symsize,unsigned int gfpoly,unsigned int fcr, +GR_CORE_API void encode_rs_int(void *rs,int *data,int *parity); +GR_CORE_API int decode_rs_int(void *rs,int *data,int *eras_pos,int no_eras); +GR_CORE_API void *init_rs_int(unsigned int symsize,unsigned int gfpoly,unsigned int fcr, unsigned int prim,unsigned int nroots); -void free_rs_int(void *rs); +GR_CORE_API void free_rs_int(void *rs); /* CCSDS standard (255,223) RS codec with conventional (*not* dual-basis) * symbol representation */ -void encode_rs_8(unsigned char *data,unsigned char *parity); -int decode_rs_8(unsigned char *data,int *eras_pos,int no_eras); +GR_CORE_API void encode_rs_8(unsigned char *data,unsigned char *parity); +GR_CORE_API int decode_rs_8(unsigned char *data,int *eras_pos,int no_eras); /* Tables to map from conventional->dual (Taltab) and * dual->conventional (Tal1tab) bases diff --git a/gnuradio-core/src/lib/runtime/CMakeLists.txt b/gnuradio-core/src/lib/runtime/CMakeLists.txt new file mode 100644 index 000000000..4b1f85bbe --- /dev/null +++ b/gnuradio-core/src/lib/runtime/CMakeLists.txt @@ -0,0 +1,162 @@ +# Copyright 2010-2010 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio 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 General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. + +######################################################################## +# This file included, use CMake directory variables +######################################################################## + +######################################################################## +# Append gnuradio-core library sources +######################################################################## +LIST(APPEND gnuradio_core_sources + ${CMAKE_CURRENT_SOURCE_DIR}/gr_basic_block.cc + ${CMAKE_CURRENT_SOURCE_DIR}/gr_flowgraph.cc + ${CMAKE_CURRENT_SOURCE_DIR}/gr_flat_flowgraph.cc + ${CMAKE_CURRENT_SOURCE_DIR}/gr_block.cc + ${CMAKE_CURRENT_SOURCE_DIR}/gr_block_detail.cc + ${CMAKE_CURRENT_SOURCE_DIR}/gr_block_executor.cc + ${CMAKE_CURRENT_SOURCE_DIR}/gr_hier_block2.cc + ${CMAKE_CURRENT_SOURCE_DIR}/gr_hier_block2_detail.cc + ${CMAKE_CURRENT_SOURCE_DIR}/gr_buffer.cc + ${CMAKE_CURRENT_SOURCE_DIR}/gr_dispatcher.cc + ${CMAKE_CURRENT_SOURCE_DIR}/gr_error_handler.cc + ${CMAKE_CURRENT_SOURCE_DIR}/gr_io_signature.cc + ${CMAKE_CURRENT_SOURCE_DIR}/gr_local_sighandler.cc + ${CMAKE_CURRENT_SOURCE_DIR}/gr_message.cc + ${CMAKE_CURRENT_SOURCE_DIR}/gr_msg_accepter.cc + ${CMAKE_CURRENT_SOURCE_DIR}/gr_msg_handler.cc + ${CMAKE_CURRENT_SOURCE_DIR}/gr_msg_queue.cc + ${CMAKE_CURRENT_SOURCE_DIR}/gr_pagesize.cc + ${CMAKE_CURRENT_SOURCE_DIR}/gr_preferences.cc + ${CMAKE_CURRENT_SOURCE_DIR}/gr_realtime.cc + ${CMAKE_CURRENT_SOURCE_DIR}/gr_scheduler.cc + ${CMAKE_CURRENT_SOURCE_DIR}/gr_scheduler_sts.cc + ${CMAKE_CURRENT_SOURCE_DIR}/gr_scheduler_tpb.cc + ${CMAKE_CURRENT_SOURCE_DIR}/gr_single_threaded_scheduler.cc + ${CMAKE_CURRENT_SOURCE_DIR}/gr_sptr_magic.cc + ${CMAKE_CURRENT_SOURCE_DIR}/gr_sync_block.cc + ${CMAKE_CURRENT_SOURCE_DIR}/gr_sync_decimator.cc + ${CMAKE_CURRENT_SOURCE_DIR}/gr_sync_interpolator.cc + ${CMAKE_CURRENT_SOURCE_DIR}/gr_sys_paths.cc + ${CMAKE_CURRENT_SOURCE_DIR}/gr_top_block.cc + ${CMAKE_CURRENT_SOURCE_DIR}/gr_top_block_impl.cc + ${CMAKE_CURRENT_SOURCE_DIR}/gr_tpb_detail.cc + ${CMAKE_CURRENT_SOURCE_DIR}/gr_tpb_thread_body.cc + ${CMAKE_CURRENT_SOURCE_DIR}/gr_vmcircbuf.cc + ${CMAKE_CURRENT_SOURCE_DIR}/gr_vmcircbuf_mmap_shm_open.cc + ${CMAKE_CURRENT_SOURCE_DIR}/gr_vmcircbuf_mmap_tmpfile.cc + ${CMAKE_CURRENT_SOURCE_DIR}/gr_vmcircbuf_createfilemapping.cc + ${CMAKE_CURRENT_SOURCE_DIR}/gr_vmcircbuf_sysv_shm.cc + ${CMAKE_CURRENT_SOURCE_DIR}/gr_select_handler.cc + ${CMAKE_CURRENT_SOURCE_DIR}/gr_tag_info.cc +) + +######################################################################## +# Append gnuradio-core test sources +######################################################################## +LIST(APPEND test_gnuradio_core_sources + ${CMAKE_CURRENT_SOURCE_DIR}/qa_gr_block.cc + ${CMAKE_CURRENT_SOURCE_DIR}/qa_gr_hier_block2.cc + ${CMAKE_CURRENT_SOURCE_DIR}/qa_gr_hier_block2_derived.cc + ${CMAKE_CURRENT_SOURCE_DIR}/qa_gr_buffer.cc + ${CMAKE_CURRENT_SOURCE_DIR}/qa_gr_flowgraph.cc + ${CMAKE_CURRENT_SOURCE_DIR}/qa_gr_top_block.cc + ${CMAKE_CURRENT_SOURCE_DIR}/qa_gr_io_signature.cc + ${CMAKE_CURRENT_SOURCE_DIR}/qa_gr_vmcircbuf.cc + ${CMAKE_CURRENT_SOURCE_DIR}/qa_block_tags.cc + ${CMAKE_CURRENT_SOURCE_DIR}/qa_runtime.cc + ${CMAKE_CURRENT_SOURCE_DIR}/qa_set_msg_handler.cc +) + +######################################################################## +# Install runtime headers +######################################################################## +INSTALL(FILES + ${CMAKE_CURRENT_SOURCE_DIR}/gr_basic_block.h + ${CMAKE_CURRENT_SOURCE_DIR}/gr_flowgraph.h + ${CMAKE_CURRENT_SOURCE_DIR}/gr_flat_flowgraph.h + ${CMAKE_CURRENT_SOURCE_DIR}/gr_block.h + ${CMAKE_CURRENT_SOURCE_DIR}/gr_block_detail.h + ${CMAKE_CURRENT_SOURCE_DIR}/gr_block_executor.h + ${CMAKE_CURRENT_SOURCE_DIR}/gr_hier_block2.h + ${CMAKE_CURRENT_SOURCE_DIR}/gr_hier_block2_detail.h + ${CMAKE_CURRENT_SOURCE_DIR}/gr_buffer.h + ${CMAKE_CURRENT_SOURCE_DIR}/gr_complex.h + ${CMAKE_CURRENT_SOURCE_DIR}/gr_dispatcher.h + ${CMAKE_CURRENT_SOURCE_DIR}/gr_error_handler.h + ${CMAKE_CURRENT_SOURCE_DIR}/gr_io_signature.h + ${CMAKE_CURRENT_SOURCE_DIR}/gr_local_sighandler.h + ${CMAKE_CURRENT_SOURCE_DIR}/gr_message.h + ${CMAKE_CURRENT_SOURCE_DIR}/gr_msg_accepter.h + ${CMAKE_CURRENT_SOURCE_DIR}/gr_msg_handler.h + ${CMAKE_CURRENT_SOURCE_DIR}/gr_msg_queue.h + ${CMAKE_CURRENT_SOURCE_DIR}/gr_pagesize.h + ${CMAKE_CURRENT_SOURCE_DIR}/gr_preferences.h + ${CMAKE_CURRENT_SOURCE_DIR}/gr_realtime.h + ${CMAKE_CURRENT_SOURCE_DIR}/gr_runtime_types.h + ${CMAKE_CURRENT_SOURCE_DIR}/gr_scheduler.h + ${CMAKE_CURRENT_SOURCE_DIR}/gr_scheduler_sts.h + ${CMAKE_CURRENT_SOURCE_DIR}/gr_scheduler_tpb.h + ${CMAKE_CURRENT_SOURCE_DIR}/gr_select_handler.h + ${CMAKE_CURRENT_SOURCE_DIR}/gr_single_threaded_scheduler.h + ${CMAKE_CURRENT_SOURCE_DIR}/gr_sptr_magic.h + ${CMAKE_CURRENT_SOURCE_DIR}/gr_sync_block.h + ${CMAKE_CURRENT_SOURCE_DIR}/gr_sync_decimator.h + ${CMAKE_CURRENT_SOURCE_DIR}/gr_sync_interpolator.h + ${CMAKE_CURRENT_SOURCE_DIR}/gr_top_block.h + ${CMAKE_CURRENT_SOURCE_DIR}/gr_top_block_impl.h + ${CMAKE_CURRENT_SOURCE_DIR}/gr_tpb_detail.h + ${CMAKE_CURRENT_SOURCE_DIR}/gr_tpb_thread_body.h + ${CMAKE_CURRENT_SOURCE_DIR}/gr_timer.h + ${CMAKE_CURRENT_SOURCE_DIR}/gr_sys_paths.h + ${CMAKE_CURRENT_SOURCE_DIR}/gr_types.h + ${CMAKE_CURRENT_SOURCE_DIR}/gr_unittests.h + ${CMAKE_CURRENT_SOURCE_DIR}/gr_vmcircbuf.h + ${CMAKE_CURRENT_SOURCE_DIR}/gr_tag_info.h + DESTINATION ${GR_INCLUDE_DIR}/gnuradio + COMPONENT "core_devel" +) + +######################################################################## +# Install swig headers +######################################################################## +IF(ENABLE_PYTHON) +INSTALL(FILES + ${CMAKE_CURRENT_SOURCE_DIR}/gr_basic_block.i + ${CMAKE_CURRENT_SOURCE_DIR}/gr_block.i + ${CMAKE_CURRENT_SOURCE_DIR}/gr_block_detail.i + ${CMAKE_CURRENT_SOURCE_DIR}/gr_hier_block2.i + ${CMAKE_CURRENT_SOURCE_DIR}/gr_buffer.i + ${CMAKE_CURRENT_SOURCE_DIR}/gr_dispatcher.i + ${CMAKE_CURRENT_SOURCE_DIR}/gr_error_handler.i + ${CMAKE_CURRENT_SOURCE_DIR}/gr_io_signature.i + ${CMAKE_CURRENT_SOURCE_DIR}/gr_message.i + ${CMAKE_CURRENT_SOURCE_DIR}/gr_msg_handler.i + ${CMAKE_CURRENT_SOURCE_DIR}/gr_msg_queue.i + ${CMAKE_CURRENT_SOURCE_DIR}/gr_realtime.i + ${CMAKE_CURRENT_SOURCE_DIR}/gr_single_threaded_scheduler.i + ${CMAKE_CURRENT_SOURCE_DIR}/gr_sync_block.i + ${CMAKE_CURRENT_SOURCE_DIR}/gr_sync_decimator.i + ${CMAKE_CURRENT_SOURCE_DIR}/gr_sync_interpolator.i + ${CMAKE_CURRENT_SOURCE_DIR}/gr_top_block.i + ${CMAKE_CURRENT_SOURCE_DIR}/runtime.i + DESTINATION ${GR_INCLUDE_DIR}/gnuradio/swig + COMPONENT "core_swig" +) +ENDIF(ENABLE_PYTHON) diff --git a/gnuradio-core/src/lib/runtime/gr_basic_block.h b/gnuradio-core/src/lib/runtime/gr_basic_block.h index 3b0cd51dd..2adca8ccb 100644 --- a/gnuradio-core/src/lib/runtime/gr_basic_block.h +++ b/gnuradio-core/src/lib/runtime/gr_basic_block.h @@ -23,6 +23,7 @@ #ifndef INCLUDED_GR_BASIC_BLOCK_H #define INCLUDED_GR_BASIC_BLOCK_H +#include <gr_core_api.h> #include <gr_runtime_types.h> #include <gr_sptr_magic.h> #include <boost/enable_shared_from_this.hpp> @@ -41,7 +42,7 @@ * signal processing functions. */ -class gr_basic_block : public gr_msg_accepter, public boost::enable_shared_from_this<gr_basic_block> +class GR_CORE_API gr_basic_block : public gr_msg_accepter, public boost::enable_shared_from_this<gr_basic_block> { typedef boost::function<void(pmt::pmt_t)> msg_handler_t; @@ -158,7 +159,7 @@ inline bool operator<(gr_basic_block_sptr lhs, gr_basic_block_sptr rhs) typedef std::vector<gr_basic_block_sptr> gr_basic_block_vector_t; typedef std::vector<gr_basic_block_sptr>::iterator gr_basic_block_viter_t; -long gr_basic_block_ncurrently_allocated(); +GR_CORE_API long gr_basic_block_ncurrently_allocated(); inline std::ostream &operator << (std::ostream &os, gr_basic_block_sptr basic_block) { diff --git a/gnuradio-core/src/lib/runtime/gr_block.h b/gnuradio-core/src/lib/runtime/gr_block.h index fc22f9ea8..2453e97b8 100644 --- a/gnuradio-core/src/lib/runtime/gr_block.h +++ b/gnuradio-core/src/lib/runtime/gr_block.h @@ -23,6 +23,7 @@ #ifndef INCLUDED_GR_BLOCK_H #define INCLUDED_GR_BLOCK_H +#include <gr_core_api.h> #include <gr_basic_block.h> /*! @@ -53,7 +54,7 @@ * It reads the input items and writes the output items. */ -class gr_block : public gr_basic_block { +class GR_CORE_API gr_block : public gr_basic_block { public: @@ -300,7 +301,7 @@ class gr_block : public gr_basic_block { const pmt::pmt_t &key); // These are really only for internal use, but leaving them public avoids - // having to work up an ever-varying list of friends + // having to work up an ever-varying list of friend GR_CORE_APIs public: gr_block_detail_sptr detail () const { return d_detail; } diff --git a/gnuradio-core/src/lib/runtime/gr_block_detail.h b/gnuradio-core/src/lib/runtime/gr_block_detail.h index d7ec3b136..633da1b0c 100644 --- a/gnuradio-core/src/lib/runtime/gr_block_detail.h +++ b/gnuradio-core/src/lib/runtime/gr_block_detail.h @@ -23,6 +23,7 @@ #ifndef INCLUDED_GR_BLOCK_DETAIL_H #define INCLUDED_GR_BLOCK_DETAIL_H +#include <gr_core_api.h> #include <gr_runtime_types.h> #include <gr_tpb_detail.h> #include <gr_tag_info.h> @@ -36,7 +37,7 @@ * of almost all users of GNU Radio. This decoupling also means that * we can make changes to the guts without having to recompile everything. */ -class gr_block_detail { +class GR_CORE_API gr_block_detail { public: ~gr_block_detail (); @@ -172,16 +173,16 @@ class gr_block_detail { gr_block_detail (unsigned int ninputs, unsigned int noutputs); - friend class gr_tpb_detail; + friend struct gr_tpb_detail; - friend gr_block_detail_sptr + friend GR_CORE_API gr_block_detail_sptr gr_make_block_detail (unsigned int ninputs, unsigned int noutputs); }; -gr_block_detail_sptr +GR_CORE_API gr_block_detail_sptr gr_make_block_detail (unsigned int ninputs, unsigned int noutputs); -long +GR_CORE_API long gr_block_detail_ncurrently_allocated (); #endif /* INCLUDED_GR_BLOCK_DETAIL_H */ diff --git a/gnuradio-core/src/lib/runtime/gr_block_executor.cc b/gnuradio-core/src/lib/runtime/gr_block_executor.cc index a8d0bc1c8..b3f987f72 100644 --- a/gnuradio-core/src/lib/runtime/gr_block_executor.cc +++ b/gnuradio-core/src/lib/runtime/gr_block_executor.cc @@ -29,6 +29,7 @@ #include <gr_block_detail.h> #include <gr_buffer.h> #include <boost/thread.hpp> +#include <boost/format.hpp> #include <iostream> #include <limits> #include <assert.h> @@ -165,9 +166,8 @@ gr_block_executor::gr_block_executor (gr_block_sptr block) : d_block(block), d_log(0) { if (ENABLE_LOGGING){ - char name[100]; - snprintf(name, sizeof(name), "sst-%03d.log", which_scheduler++); - d_log = new std::ofstream(name); + std::string name = str(boost::format("sst-%03d.log") % which_scheduler++); + d_log = new std::ofstream(name.c_str()); std::unitbuf(*d_log); // make it unbuffered... *d_log << "gr_block_executor: " << d_block << std::endl; diff --git a/gnuradio-core/src/lib/runtime/gr_block_executor.h b/gnuradio-core/src/lib/runtime/gr_block_executor.h index 77ace5522..cd93212e1 100644 --- a/gnuradio-core/src/lib/runtime/gr_block_executor.h +++ b/gnuradio-core/src/lib/runtime/gr_block_executor.h @@ -23,6 +23,7 @@ #ifndef INCLUDED_GR_BLOCK_EXECUTOR_H #define INCLUDED_GR_BLOCK_EXECUTOR_H +#include <gr_core_api.h> #include <gr_runtime_types.h> #include <fstream> #include <gruel/pmt.h> @@ -36,7 +37,7 @@ * \ingroup internal */ -class gr_block_executor { +class GR_CORE_API gr_block_executor { protected: gr_block_sptr d_block; // The block we're trying to run std::ofstream *d_log; diff --git a/gnuradio-core/src/lib/runtime/gr_buffer.h b/gnuradio-core/src/lib/runtime/gr_buffer.h index e5725d386..e7c0a06a5 100644 --- a/gnuradio-core/src/lib/runtime/gr_buffer.h +++ b/gnuradio-core/src/lib/runtime/gr_buffer.h @@ -23,6 +23,7 @@ #ifndef INCLUDED_GR_BUFFER_H #define INCLUDED_GR_BUFFER_H +#include <gr_core_api.h> #include <gr_runtime_types.h> #include <boost/weak_ptr.hpp> #include <gruel/thread.h> @@ -42,14 +43,14 @@ class gr_vmcircbuf; * \param sizeof_item is the size of an item in bytes. * \param link is the block that writes to this buffer. */ -gr_buffer_sptr gr_make_buffer (int nitems, size_t sizeof_item, gr_block_sptr link=gr_block_sptr()); +GR_CORE_API gr_buffer_sptr gr_make_buffer (int nitems, size_t sizeof_item, gr_block_sptr link=gr_block_sptr()); /*! * \brief Single writer, multiple reader fifo. * \ingroup internal */ -class gr_buffer { +class GR_CORE_API gr_buffer { public: virtual ~gr_buffer (); @@ -115,8 +116,8 @@ class gr_buffer { private: friend class gr_buffer_reader; - friend gr_buffer_sptr gr_make_buffer (int nitems, size_t sizeof_item, gr_block_sptr link); - friend gr_buffer_reader_sptr gr_buffer_add_reader (gr_buffer_sptr buf, int nzero_preload, gr_block_sptr link); + friend GR_CORE_API gr_buffer_sptr gr_make_buffer (int nitems, size_t sizeof_item, gr_block_sptr link); + friend GR_CORE_API gr_buffer_reader_sptr gr_buffer_add_reader (gr_buffer_sptr buf, int nzero_preload, gr_block_sptr link); protected: char *d_base; // base address of buffer @@ -192,11 +193,11 @@ class gr_buffer { * \param nzero_preload -- number of zero items to "preload" into buffer. * \param link is the block that reads from the buffer using this gr_buffer_reader. */ -gr_buffer_reader_sptr +GR_CORE_API gr_buffer_reader_sptr gr_buffer_add_reader (gr_buffer_sptr buf, int nzero_preload, gr_block_sptr link=gr_block_sptr()); //! returns # of gr_buffers currently allocated -long gr_buffer_ncurrently_allocated (); +GR_CORE_API long gr_buffer_ncurrently_allocated (); // --------------------------------------------------------------------------- @@ -206,7 +207,7 @@ long gr_buffer_ncurrently_allocated (); * \ingroup internal */ -class gr_buffer_reader { +class GR_CORE_API gr_buffer_reader { public: ~gr_buffer_reader (); @@ -276,7 +277,7 @@ class gr_buffer_reader { private: friend class gr_buffer; - friend gr_buffer_reader_sptr + friend GR_CORE_API gr_buffer_reader_sptr gr_buffer_add_reader (gr_buffer_sptr buf, int nzero_preload, gr_block_sptr link); @@ -290,7 +291,7 @@ class gr_buffer_reader { }; //! returns # of gr_buffer_readers currently allocated -long gr_buffer_reader_ncurrently_allocated (); +GR_CORE_API long gr_buffer_reader_ncurrently_allocated (); #endif /* INCLUDED_GR_BUFFER_H */ diff --git a/gnuradio-core/src/lib/runtime/gr_dispatcher.h b/gnuradio-core/src/lib/runtime/gr_dispatcher.h index 34f825102..735974766 100644 --- a/gnuradio-core/src/lib/runtime/gr_dispatcher.h +++ b/gnuradio-core/src/lib/runtime/gr_dispatcher.h @@ -23,14 +23,15 @@ #ifndef INCLUDED_GR_DISPATCHER_H #define INCLUDED_GR_DISPATCHER_H +#include <gr_core_api.h> #include <gr_select_handler.h> #include <vector> class gr_dispatcher; typedef boost::shared_ptr<gr_dispatcher> gr_dispatcher_sptr; -gr_dispatcher_sptr gr_dispatcher_singleton(); -gr_dispatcher_sptr gr_make_dispatcher(); +GR_CORE_API gr_dispatcher_sptr gr_dispatcher_singleton(); +GR_CORE_API gr_dispatcher_sptr gr_make_dispatcher(); /*! * \brief invoke callbacks based on select. @@ -38,10 +39,10 @@ gr_dispatcher_sptr gr_make_dispatcher(); * * \sa gr_select_handler */ -class gr_dispatcher +class GR_CORE_API gr_dispatcher { gr_dispatcher(); - friend gr_dispatcher_sptr gr_make_dispatcher(); + friend GR_CORE_API gr_dispatcher_sptr gr_make_dispatcher(); std::vector<gr_select_handler_sptr> d_handler; int d_max_index; diff --git a/gnuradio-core/src/lib/runtime/gr_error_handler.h b/gnuradio-core/src/lib/runtime/gr_error_handler.h index aedb6f41f..4c30791f2 100644 --- a/gnuradio-core/src/lib/runtime/gr_error_handler.h +++ b/gnuradio-core/src/lib/runtime/gr_error_handler.h @@ -43,6 +43,7 @@ #ifndef INCLUDED_GR_ERROR_HANDLER_H #define INCLUDED_GR_ERROR_HANDLER_H +#include <gr_core_api.h> #include <stdarg.h> #include <string> #include <cstdio> // for FILE @@ -51,7 +52,7 @@ * \brief abstract error handler * \ingroup base */ -class gr_error_handler { +class GR_CORE_API gr_error_handler { public: enum seriousness { ERR_DEBUG = 0x00000000, @@ -90,7 +91,7 @@ protected: }; -class gr_base_error_handler : public gr_error_handler { +class GR_CORE_API gr_base_error_handler : public gr_error_handler { int d_nwarnings; int d_nerrors; @@ -102,7 +103,7 @@ public: void count_error(seriousness s); }; -class gr_file_error_handler : public gr_base_error_handler { +class GR_CORE_API gr_file_error_handler : public gr_base_error_handler { FILE *d_file; int d_fd; public: diff --git a/gnuradio-core/src/lib/runtime/gr_flat_flowgraph.h b/gnuradio-core/src/lib/runtime/gr_flat_flowgraph.h index 8e9834337..2cc883686 100644 --- a/gnuradio-core/src/lib/runtime/gr_flat_flowgraph.h +++ b/gnuradio-core/src/lib/runtime/gr_flat_flowgraph.h @@ -23,22 +23,23 @@ #ifndef INCLUDED_GR_FLAT_FLOWGRAPH_H #define INCLUDED_GR_FLAT_FLOWGRAPH_H +#include <gr_core_api.h> #include <gr_flowgraph.h> #include <gr_block.h> // Create a shared pointer to a heap allocated gr_flat_flowgraph // (types defined in gr_runtime_types.h) -gr_flat_flowgraph_sptr gr_make_flat_flowgraph(); +GR_CORE_API gr_flat_flowgraph_sptr gr_make_flat_flowgraph(); /*! *\brief Class specializing gr_flat_flowgraph that has all nodes * as gr_blocks, with no hierarchy * \ingroup internal */ -class gr_flat_flowgraph : public gr_flowgraph +class GR_CORE_API gr_flat_flowgraph : public gr_flowgraph { public: - friend gr_flat_flowgraph_sptr gr_make_flat_flowgraph(); + friend GR_CORE_API gr_flat_flowgraph_sptr gr_make_flat_flowgraph(); // Destruct an arbitrary gr_flat_flowgraph ~gr_flat_flowgraph(); diff --git a/gnuradio-core/src/lib/runtime/gr_flowgraph.h b/gnuradio-core/src/lib/runtime/gr_flowgraph.h index 8e988506b..8f9a8ba71 100644 --- a/gnuradio-core/src/lib/runtime/gr_flowgraph.h +++ b/gnuradio-core/src/lib/runtime/gr_flowgraph.h @@ -23,6 +23,7 @@ #ifndef INCLUDED_GR_FLOWGRAPH_H #define INCLUDED_GR_FLOWGRAPH_H +#include <gr_core_api.h> #include <gr_basic_block.h> #include <iostream> @@ -30,7 +31,7 @@ * \brief Class representing a specific input or output graph endpoint * \ingroup internal */ -class gr_endpoint +class GR_CORE_API gr_endpoint { private: gr_basic_block_sptr d_basic_block; @@ -59,7 +60,7 @@ typedef std::vector<gr_endpoint>::iterator gr_endpoint_viter_t; *\brief Class representing a connection between to graph endpoints * */ -class gr_edge +class GR_CORE_API gr_edge { public: gr_edge() : d_src(), d_dst() { }; @@ -81,16 +82,16 @@ typedef std::vector<gr_edge>::iterator gr_edge_viter_t; // Create a shared pointer to a heap allocated flowgraph // (types defined in gr_runtime_types.h) -gr_flowgraph_sptr gr_make_flowgraph(); +GR_CORE_API gr_flowgraph_sptr gr_make_flowgraph(); /*! * \brief Class representing a directed, acyclic graph of basic blocks * \ingroup internal */ -class gr_flowgraph +class GR_CORE_API gr_flowgraph { public: - friend gr_flowgraph_sptr gr_make_flowgraph(); + friend GR_CORE_API gr_flowgraph_sptr gr_make_flowgraph(); // Destruct an arbitrary flowgraph ~gr_flowgraph(); diff --git a/gnuradio-core/src/lib/runtime/gr_hier_block2.h b/gnuradio-core/src/lib/runtime/gr_hier_block2.h index 0a40c36b7..8687b7d99 100644 --- a/gnuradio-core/src/lib/runtime/gr_hier_block2.h +++ b/gnuradio-core/src/lib/runtime/gr_hier_block2.h @@ -22,13 +22,14 @@ #ifndef INCLUDED_GR_HIER_BLOCK2_H #define INCLUDED_GR_HIER_BLOCK2_H +#include <gr_core_api.h> #include <gr_basic_block.h> /*! * \brief public constructor for gr_hier_block2 */ -gr_hier_block2_sptr gr_make_hier_block2(const std::string &name, +GR_CORE_API gr_hier_block2_sptr gr_make_hier_block2(const std::string &name, gr_io_signature_sptr input_signature, gr_io_signature_sptr output_signature); @@ -40,11 +41,11 @@ class gr_hier_block2_detail; * \ingroup base_blk * */ -class gr_hier_block2 : public gr_basic_block +class GR_CORE_API gr_hier_block2 : public gr_basic_block { private: friend class gr_hier_block2_detail; - friend gr_hier_block2_sptr gr_make_hier_block2(const std::string &name, + friend GR_CORE_API gr_hier_block2_sptr gr_make_hier_block2(const std::string &name, gr_io_signature_sptr input_signature, gr_io_signature_sptr output_signature); diff --git a/gnuradio-core/src/lib/runtime/gr_hier_block2_detail.h b/gnuradio-core/src/lib/runtime/gr_hier_block2_detail.h index 6f5384e5a..5a77d6a03 100644 --- a/gnuradio-core/src/lib/runtime/gr_hier_block2_detail.h +++ b/gnuradio-core/src/lib/runtime/gr_hier_block2_detail.h @@ -22,6 +22,7 @@ #ifndef INCLUDED_GR_HIER_BLOCK2_DETAIL_H #define INCLUDED_GR_HIER_BLOCK2_DETAIL_H +#include <gr_core_api.h> #include <gr_hier_block2.h> #include <gr_flat_flowgraph.h> #include <boost/utility.hpp> @@ -29,7 +30,7 @@ /*! * \ingroup internal */ -class gr_hier_block2_detail : boost::noncopyable +class GR_CORE_API gr_hier_block2_detail : boost::noncopyable { public: gr_hier_block2_detail(gr_hier_block2 *owner); diff --git a/gnuradio-core/src/lib/runtime/gr_io_signature.h b/gnuradio-core/src/lib/runtime/gr_io_signature.h index 5d194cf55..11c6b7f13 100644 --- a/gnuradio-core/src/lib/runtime/gr_io_signature.h +++ b/gnuradio-core/src/lib/runtime/gr_io_signature.h @@ -23,6 +23,7 @@ #ifndef INCLUDED_IO_SIGNATURE_H #define INCLUDED_IO_SIGNATURE_H +#include <gr_core_api.h> #include <gr_runtime_types.h> /*! @@ -33,7 +34,7 @@ * \param max_streams specify maximum number of streams (>= min_streams or -1 -> infinite) * \param sizeof_stream_item specify the size of the items in each stream */ -gr_io_signature_sptr +GR_CORE_API gr_io_signature_sptr gr_make_io_signature(int min_streams, int max_streams, int sizeof_stream_item); @@ -45,7 +46,7 @@ gr_make_io_signature(int min_streams, int max_streams, * \param sizeof_stream_item1 specify the size of the items in the first stream * \param sizeof_stream_item2 specify the size of the items in the second and subsequent streams */ -gr_io_signature_sptr +GR_CORE_API gr_io_signature_sptr gr_make_io_signature2(int min_streams, int max_streams, int sizeof_stream_item1, int sizeof_stream_item2 @@ -60,7 +61,7 @@ gr_make_io_signature2(int min_streams, int max_streams, * \param sizeof_stream_item2 specify the size of the items in the second stream * \param sizeof_stream_item3 specify the size of the items in the third and subsequent streams */ -gr_io_signature_sptr +GR_CORE_API gr_io_signature_sptr gr_make_io_signature3(int min_streams, int max_streams, int sizeof_stream_item1, int sizeof_stream_item2, @@ -78,7 +79,7 @@ gr_make_io_signature3(int min_streams, int max_streams, * value of the last entry in sizeof_stream_items is used for the missing values. * sizeof_stream_items must contain at least 1 entry. */ -gr_io_signature_sptr +GR_CORE_API gr_io_signature_sptr gr_make_io_signaturev(int min_streams, int max_streams, const std::vector<int> &sizeof_stream_items); @@ -87,7 +88,7 @@ gr_make_io_signaturev(int min_streams, int max_streams, * \brief i/o signature for input and output ports. * \brief misc */ -class gr_io_signature { +class GR_CORE_API gr_io_signature { int d_min_streams; int d_max_streams; std::vector<int> d_sizeof_stream_item; @@ -95,7 +96,7 @@ class gr_io_signature { gr_io_signature(int min_streams, int max_streams, const std::vector<int> &sizeof_stream_items); - friend gr_io_signature_sptr + friend GR_CORE_API gr_io_signature_sptr gr_make_io_signaturev(int min_streams, int max_streams, const std::vector<int> &sizeof_stream_items); diff --git a/gnuradio-core/src/lib/runtime/gr_local_sighandler.h b/gnuradio-core/src/lib/runtime/gr_local_sighandler.h index 6b60cf09a..9e4eacc47 100644 --- a/gnuradio-core/src/lib/runtime/gr_local_sighandler.h +++ b/gnuradio-core/src/lib/runtime/gr_local_sighandler.h @@ -27,6 +27,7 @@ #include <signal.h> #endif +#include <gr_core_api.h> #include <string> /*! @@ -36,7 +37,7 @@ * Constructor installs new handler, destructor reinstalls * original value. */ -class gr_local_sighandler { +class GR_CORE_API gr_local_sighandler { int d_signum; #ifdef HAVE_SIGACTION struct sigaction d_old_action; @@ -52,7 +53,7 @@ public: /*! * \brief Representation of signal. */ -class gr_signal +class GR_CORE_API gr_signal { int d_signum; public: diff --git a/gnuradio-core/src/lib/runtime/gr_message.h b/gnuradio-core/src/lib/runtime/gr_message.h index 179f7d9bc..ead002616 100644 --- a/gnuradio-core/src/lib/runtime/gr_message.h +++ b/gnuradio-core/src/lib/runtime/gr_message.h @@ -22,6 +22,7 @@ #ifndef INCLUDED_GR_MESSAGE_H #define INCLUDED_GR_MESSAGE_H +#include <gr_core_api.h> #include <gr_types.h> #include <string> @@ -31,10 +32,10 @@ typedef boost::shared_ptr<gr_message> gr_message_sptr; /*! * \brief public constructor for gr_message */ -gr_message_sptr +GR_CORE_API gr_message_sptr gr_make_message(long type = 0, double arg1 = 0, double arg2 = 0, size_t length = 0); -gr_message_sptr +GR_CORE_API gr_message_sptr gr_make_message_from_string(const std::string s, long type = 0, double arg1 = 0, double arg2 = 0); /*! @@ -44,7 +45,7 @@ gr_make_message_from_string(const std::string s, long type = 0, double arg1 = 0, * The ideas and method names for adjustable message length were * lifted from the click modular router "Packet" class. */ -class gr_message { +class GR_CORE_API gr_message { gr_message_sptr d_next; // link field for msg queue long d_type; // type of the message double d_arg1; // optional arg1 @@ -57,10 +58,10 @@ class gr_message { gr_message (long type, double arg1, double arg2, size_t length); - friend gr_message_sptr + friend GR_CORE_API gr_message_sptr gr_make_message (long type, double arg1, double arg2, size_t length); - friend gr_message_sptr + friend GR_CORE_API gr_message_sptr gr_make_message_from_string (const std::string s, long type, double arg1, double arg2); friend class gr_msg_queue; @@ -85,6 +86,6 @@ public: }; -long gr_message_ncurrently_allocated (); +GR_CORE_API long gr_message_ncurrently_allocated (); #endif /* INCLUDED_GR_MESSAGE_H */ diff --git a/gnuradio-core/src/lib/runtime/gr_msg_accepter.h b/gnuradio-core/src/lib/runtime/gr_msg_accepter.h index 79a631f3a..4aec127a9 100644 --- a/gnuradio-core/src/lib/runtime/gr_msg_accepter.h +++ b/gnuradio-core/src/lib/runtime/gr_msg_accepter.h @@ -22,6 +22,7 @@ #ifndef INCLUDED_GR_MSG_ACCEPTER_H #define INCLUDED_GR_MSG_ACCEPTER_H +#include <gr_core_api.h> #include <gruel/msg_accepter.h> #include <gruel/pmt.h> @@ -29,7 +30,7 @@ * \brief Accepts messages and inserts them into a message queue, then notifies * subclass gr_basic_block there is a message pending. */ -class gr_msg_accepter : public gruel::msg_accepter +class GR_CORE_API gr_msg_accepter : public gruel::msg_accepter { public: gr_msg_accepter(); diff --git a/gnuradio-core/src/lib/runtime/gr_msg_handler.h b/gnuradio-core/src/lib/runtime/gr_msg_handler.h index 774dce73e..ebe3ffe37 100644 --- a/gnuradio-core/src/lib/runtime/gr_msg_handler.h +++ b/gnuradio-core/src/lib/runtime/gr_msg_handler.h @@ -22,6 +22,7 @@ #ifndef INCLUDED_GR_MSG_HANDLER_H #define INCLUDED_GR_MSG_HANDLER_H +#include <gr_core_api.h> #include <gr_message.h> class gr_msg_handler; @@ -31,7 +32,7 @@ typedef boost::shared_ptr<gr_msg_handler> gr_msg_handler_sptr; * \brief abstract class of message handlers * \ingroup base */ -class gr_msg_handler { +class GR_CORE_API gr_msg_handler { public: virtual ~gr_msg_handler (); diff --git a/gnuradio-core/src/lib/runtime/gr_msg_queue.h b/gnuradio-core/src/lib/runtime/gr_msg_queue.h index 477b1ddf1..bf7b89882 100644 --- a/gnuradio-core/src/lib/runtime/gr_msg_queue.h +++ b/gnuradio-core/src/lib/runtime/gr_msg_queue.h @@ -22,19 +22,20 @@ #ifndef INCLUDED_GR_MSG_QUEUE_H #define INCLUDED_GR_MSG_QUEUE_H +#include <gr_core_api.h> #include <gr_msg_handler.h> #include <gruel/thread.h> class gr_msg_queue; typedef boost::shared_ptr<gr_msg_queue> gr_msg_queue_sptr; -gr_msg_queue_sptr gr_make_msg_queue(unsigned int limit=0); +GR_CORE_API gr_msg_queue_sptr gr_make_msg_queue(unsigned int limit=0); /*! * \brief thread-safe message queue * \ingroup misc */ -class gr_msg_queue : public gr_msg_handler { +class GR_CORE_API gr_msg_queue : public gr_msg_handler { gruel::mutex d_mutex; gruel::condition_variable d_not_empty; diff --git a/gnuradio-core/src/lib/runtime/gr_pagesize.h b/gnuradio-core/src/lib/runtime/gr_pagesize.h index 3c1b8eb6b..60dad42c9 100644 --- a/gnuradio-core/src/lib/runtime/gr_pagesize.h +++ b/gnuradio-core/src/lib/runtime/gr_pagesize.h @@ -22,11 +22,13 @@ #ifndef _GR_PAGESIZE_H_ #define _GR_PAGESIZE_H_ +#include <gr_core_api.h> + /*! * \brief return the page size in bytes */ -int gr_pagesize (); +GR_CORE_API int gr_pagesize (); -#endif /* _GR_PAGESIZE_H_ */ +#endif /* _GR_PAGESIZE_H_ */
\ No newline at end of file diff --git a/gnuradio-core/src/lib/runtime/gr_preferences.h b/gnuradio-core/src/lib/runtime/gr_preferences.h index 7f2a25e6b..ab4dc0cb0 100644 --- a/gnuradio-core/src/lib/runtime/gr_preferences.h +++ b/gnuradio-core/src/lib/runtime/gr_preferences.h @@ -23,10 +23,12 @@ #ifndef _GR_PREFERENCES_H_ #define _GR_PREFERENCES_H_ -class gr_preferences { +#include <gr_core_api.h> + +class GR_CORE_API gr_preferences { public: static const char *get (const char *key); static void set (const char *key, const char *value); }; -#endif /* _GR_PREFERENCES_H_ */ +#endif /* _GR_PREFERENCES_H_ */
\ No newline at end of file diff --git a/gnuradio-core/src/lib/runtime/gr_realtime.h b/gnuradio-core/src/lib/runtime/gr_realtime.h index 830c201d7..58db83086 100644 --- a/gnuradio-core/src/lib/runtime/gr_realtime.h +++ b/gnuradio-core/src/lib/runtime/gr_realtime.h @@ -23,6 +23,7 @@ #ifndef INCLUDED_GR_REALTIME_H #define INCLUDED_GR_REALTIME_H +#include <gr_core_api.h> #include <gruel/realtime.h> typedef gruel::rt_status_t gr_rt_status_t; @@ -31,6 +32,6 @@ typedef gruel::rt_status_t gr_rt_status_t; * \brief If possible, enable high-priority "real time" scheduling. * \ingroup misc */ -gr_rt_status_t gr_enable_realtime_scheduling(); +GR_CORE_API gr_rt_status_t gr_enable_realtime_scheduling(); #endif /* INCLUDED_GR_REALTIME_H */ diff --git a/gnuradio-core/src/lib/runtime/gr_runtime_types.h b/gnuradio-core/src/lib/runtime/gr_runtime_types.h index 74d2614a8..98f08b417 100644 --- a/gnuradio-core/src/lib/runtime/gr_runtime_types.h +++ b/gnuradio-core/src/lib/runtime/gr_runtime_types.h @@ -23,6 +23,7 @@ #ifndef INCLUDED_GR_RUNTIME_TYPES_H #define INCLUDED_GR_RUNTIME_TYPES_H +#include <gr_core_api.h> #include <gr_types.h> /* diff --git a/gnuradio-core/src/lib/runtime/gr_scheduler.h b/gnuradio-core/src/lib/runtime/gr_scheduler.h index 13bc1ff14..4e97b5881 100644 --- a/gnuradio-core/src/lib/runtime/gr_scheduler.h +++ b/gnuradio-core/src/lib/runtime/gr_scheduler.h @@ -22,6 +22,7 @@ #ifndef INCLUDED_GR_SCHEDULER_H #define INCLUDED_GR_SCHEDULER_H +#include <gr_core_api.h> #include <boost/utility.hpp> #include <gr_block.h> #include <gr_flat_flowgraph.h> @@ -36,7 +37,7 @@ typedef boost::shared_ptr<gr_scheduler> gr_scheduler_sptr; * * Preconditions: details, buffers and buffer readers have been assigned. */ -class gr_scheduler : boost::noncopyable +class GR_CORE_API gr_scheduler : boost::noncopyable { public: diff --git a/gnuradio-core/src/lib/runtime/gr_scheduler_sts.h b/gnuradio-core/src/lib/runtime/gr_scheduler_sts.h index 4cf835156..9b73b68c1 100644 --- a/gnuradio-core/src/lib/runtime/gr_scheduler_sts.h +++ b/gnuradio-core/src/lib/runtime/gr_scheduler_sts.h @@ -21,13 +21,14 @@ #ifndef INCLUDED_GR_SCHEDULER_STS_H #define INCLUDED_GR_SCHEDULER_STS_H +#include <gr_core_api.h> #include <gr_scheduler.h> #include <gruel/thread_group.h> /*! * \brief Concrete scheduler that uses the single_threaded_scheduler */ -class gr_scheduler_sts : public gr_scheduler +class GR_CORE_API gr_scheduler_sts : public gr_scheduler { gruel::thread_group d_threads; diff --git a/gnuradio-core/src/lib/runtime/gr_scheduler_tpb.h b/gnuradio-core/src/lib/runtime/gr_scheduler_tpb.h index 16a0c0204..f97ab2e7f 100644 --- a/gnuradio-core/src/lib/runtime/gr_scheduler_tpb.h +++ b/gnuradio-core/src/lib/runtime/gr_scheduler_tpb.h @@ -21,13 +21,14 @@ #ifndef INCLUDED_GR_SCHEDULER_TPB_H #define INCLUDED_GR_SCHEDULER_TPB_H +#include <gr_core_api.h> #include <gr_scheduler.h> #include <gruel/thread_group.h> /*! * \brief Concrete scheduler that uses a kernel thread-per-block */ -class gr_scheduler_tpb : public gr_scheduler +class GR_CORE_API gr_scheduler_tpb : public gr_scheduler { gruel::thread_group d_threads; diff --git a/gnuradio-core/src/lib/runtime/gr_select_handler.h b/gnuradio-core/src/lib/runtime/gr_select_handler.h index c3808995b..532707a02 100644 --- a/gnuradio-core/src/lib/runtime/gr_select_handler.h +++ b/gnuradio-core/src/lib/runtime/gr_select_handler.h @@ -23,6 +23,7 @@ #ifndef INCLUDED_GR_SELECT_HANDLER_H #define INCLUDED_GR_SELECT_HANDLER_H +#include <gr_core_api.h> #include <boost/shared_ptr.hpp> class gr_select_handler; @@ -35,7 +36,7 @@ typedef boost::shared_ptr<gr_select_handler> gr_select_handler_sptr; * * \sa gr_dispatcher */ -class gr_select_handler +class GR_CORE_API gr_select_handler { int d_fd; diff --git a/gnuradio-core/src/lib/runtime/gr_single_threaded_scheduler.cc b/gnuradio-core/src/lib/runtime/gr_single_threaded_scheduler.cc index 7f1b40641..ae04e4a65 100644 --- a/gnuradio-core/src/lib/runtime/gr_single_threaded_scheduler.cc +++ b/gnuradio-core/src/lib/runtime/gr_single_threaded_scheduler.cc @@ -29,6 +29,7 @@ #include <gr_block_detail.h> #include <gr_buffer.h> #include <boost/thread.hpp> +#include <boost/format.hpp> #include <iostream> #include <limits> #include <assert.h> @@ -57,9 +58,8 @@ gr_single_threaded_scheduler::gr_single_threaded_scheduler ( : d_blocks (blocks), d_enabled (true), d_log(0) { if (ENABLE_LOGGING){ - char name[100]; - snprintf(name, sizeof(name), "sst-%d.log", which_scheduler++); - d_log = new std::ofstream(name); + std::string name = str(boost::format("sst-%d.log") % which_scheduler++); + d_log = new std::ofstream(name.c_str()); *d_log << "gr_single_threaded_scheduler: " << d_blocks.size () << " blocks\n"; diff --git a/gnuradio-core/src/lib/runtime/gr_single_threaded_scheduler.h b/gnuradio-core/src/lib/runtime/gr_single_threaded_scheduler.h index 060d3017d..17f4a1c54 100644 --- a/gnuradio-core/src/lib/runtime/gr_single_threaded_scheduler.h +++ b/gnuradio-core/src/lib/runtime/gr_single_threaded_scheduler.h @@ -23,6 +23,7 @@ #ifndef INCLUDED_GR_SINGLE_THREADED_SCHEDULER_H #define INCLUDED_GR_SINGLE_THREADED_SCHEDULER_H +#include <gr_core_api.h> #include <gr_runtime_types.h> #include <fstream> @@ -35,7 +36,7 @@ typedef boost::shared_ptr<gr_single_threaded_scheduler> gr_single_threaded_sched * \ingroup internal */ -class gr_single_threaded_scheduler { +class GR_CORE_API gr_single_threaded_scheduler { public: ~gr_single_threaded_scheduler (); @@ -51,11 +52,11 @@ class gr_single_threaded_scheduler { void main_loop (); - friend gr_single_threaded_scheduler_sptr + friend GR_CORE_API gr_single_threaded_scheduler_sptr gr_make_single_threaded_scheduler (const std::vector<gr_block_sptr> &blocks); }; -gr_single_threaded_scheduler_sptr +GR_CORE_API gr_single_threaded_scheduler_sptr gr_make_single_threaded_scheduler (const std::vector<gr_block_sptr> &blocks); #endif /* INCLUDED_GR_SINGLE_THREADED_SCHEDULER_H */ diff --git a/gnuradio-core/src/lib/runtime/gr_sptr_magic.h b/gnuradio-core/src/lib/runtime/gr_sptr_magic.h index 872374ab6..4b7f9899d 100644 --- a/gnuradio-core/src/lib/runtime/gr_sptr_magic.h +++ b/gnuradio-core/src/lib/runtime/gr_sptr_magic.h @@ -21,6 +21,7 @@ #ifndef INCLUDED_GR_SPTR_MAGIC_H #define INCLUDED_GR_SPTR_MAGIC_H +#include <gr_core_api.h> #include <boost/shared_ptr.hpp> class gr_basic_block; @@ -30,7 +31,7 @@ namespace gnuradio { namespace detail { - class sptr_magic { + class GR_CORE_API sptr_magic { public: static boost::shared_ptr<gr_basic_block> fetch_initial_sptr(gr_basic_block *p); static void create_and_stash_initial_sptr(gr_hier_block2 *p); diff --git a/gnuradio-core/src/lib/runtime/gr_sync_block.h b/gnuradio-core/src/lib/runtime/gr_sync_block.h index c5a6a50f1..808c1c18a 100644 --- a/gnuradio-core/src/lib/runtime/gr_sync_block.h +++ b/gnuradio-core/src/lib/runtime/gr_sync_block.h @@ -23,6 +23,7 @@ #ifndef INCLUDED_GR_SYNC_BLOCK_H #define INCLUDED_GR_SYNC_BLOCK_H +#include <gr_core_api.h> #include <gr_block.h> /*! @@ -31,7 +32,7 @@ * * Override work to provide the signal processing implementation. */ -class gr_sync_block : public gr_block +class GR_CORE_API gr_sync_block : public gr_block { protected: gr_sync_block (void){} //allows pure virtual interface sub-classes diff --git a/gnuradio-core/src/lib/runtime/gr_sync_decimator.h b/gnuradio-core/src/lib/runtime/gr_sync_decimator.h index 12cd54195..b2ed3c4fe 100644 --- a/gnuradio-core/src/lib/runtime/gr_sync_decimator.h +++ b/gnuradio-core/src/lib/runtime/gr_sync_decimator.h @@ -23,6 +23,7 @@ #ifndef INCLUDED_GR_SYNC_DECIMATOR_H #define INCLUDED_GR_SYNC_DECIMATOR_H +#include <gr_core_api.h> #include <gr_sync_block.h> /*! @@ -31,7 +32,7 @@ * * Override work to provide the signal processing implementation. */ -class gr_sync_decimator : public gr_sync_block +class GR_CORE_API gr_sync_decimator : public gr_sync_block { private: unsigned d_decimation; diff --git a/gnuradio-core/src/lib/runtime/gr_sync_interpolator.h b/gnuradio-core/src/lib/runtime/gr_sync_interpolator.h index 0363bc55c..d65b3da1e 100644 --- a/gnuradio-core/src/lib/runtime/gr_sync_interpolator.h +++ b/gnuradio-core/src/lib/runtime/gr_sync_interpolator.h @@ -23,6 +23,7 @@ #ifndef INCLUDED_GR_SYNC_INTERPOLATOR_H #define INCLUDED_GR_SYNC_INTERPOLATOR_H +#include <gr_core_api.h> #include <gr_sync_block.h> /*! @@ -31,7 +32,7 @@ * * Override work to provide the signal processing implementation. */ -class gr_sync_interpolator : public gr_sync_block +class GR_CORE_API gr_sync_interpolator : public gr_sync_block { private: unsigned d_interpolation; diff --git a/gnuradio-core/src/lib/runtime/gr_sys_paths.h b/gnuradio-core/src/lib/runtime/gr_sys_paths.h index aa8249775..1f1759c36 100644 --- a/gnuradio-core/src/lib/runtime/gr_sys_paths.h +++ b/gnuradio-core/src/lib/runtime/gr_sys_paths.h @@ -22,10 +22,12 @@ #ifndef _GR_SYS_PATHS_H_ #define _GR_SYS_PATHS_H_ +#include <gr_core_api.h> + //! directory to create temporary files -const char *gr_tmp_path(); +GR_CORE_API const char *gr_tmp_path(); //! directory to store application data -const char *gr_appdata_path(); +GR_CORE_API const char *gr_appdata_path(); #endif /* _GR_SYS_PATHS_H_ */ diff --git a/gnuradio-core/src/lib/runtime/gr_timer.h b/gnuradio-core/src/lib/runtime/gr_timer.h index ff14e315d..fa3c06ece 100644 --- a/gnuradio-core/src/lib/runtime/gr_timer.h +++ b/gnuradio-core/src/lib/runtime/gr_timer.h @@ -22,13 +22,14 @@ #ifndef INCLUDED_GR_TIMER_H #define INCLUDED_GR_TIMER_H +#include <gr_core_api.h> #include <gr_types.h> class gr_timer; typedef boost::shared_ptr<gr_timer> gr_timer_sptr; -typedef void (*gr_timer_hook)(gr_timer *, void *); +GR_CORE_API typedef void (*gr_timer_hook)(gr_timer *, void *); /*! * \brief create a timeout. @@ -36,18 +37,18 @@ typedef void (*gr_timer_hook)(gr_timer *, void *); * \ingroup misc * gr_timer_hook is called when timer fires. */ -gr_timer_sptr gr_make_timer (gr_timer_hook, void *); +GR_CORE_API gr_timer_sptr gr_make_timer (gr_timer_hook, void *); /*! * \brief implement timeouts */ -class gr_timer { +class GR_CORE_API gr_timer { double d_expiry; double d_period; gr_timer_hook d_hook; void *d_hook_arg; - friend gr_timer_sptr gr_make_timer (gr_timer_hook, void *); + friend GR_CORE_API gr_timer_sptr gr_make_timer (gr_timer_hook, void *); gr_timer (...); diff --git a/gnuradio-core/src/lib/runtime/gr_top_block.h b/gnuradio-core/src/lib/runtime/gr_top_block.h index ed244cb7c..fca68ae71 100644 --- a/gnuradio-core/src/lib/runtime/gr_top_block.h +++ b/gnuradio-core/src/lib/runtime/gr_top_block.h @@ -23,21 +23,22 @@ #ifndef INCLUDED_GR_TOP_BLOCK_H #define INCLUDED_GR_TOP_BLOCK_H +#include <gr_core_api.h> #include <gr_hier_block2.h> class gr_top_block_impl; -gr_top_block_sptr gr_make_top_block(const std::string &name); +GR_CORE_API gr_top_block_sptr gr_make_top_block(const std::string &name); /*! *\brief Top-level hierarchical block representing a flowgraph * \ingroup container_blk * */ -class gr_top_block : public gr_hier_block2 +class GR_CORE_API gr_top_block : public gr_hier_block2 { private: - friend gr_top_block_sptr gr_make_top_block(const std::string &name); + friend GR_CORE_API gr_top_block_sptr gr_make_top_block(const std::string &name); gr_top_block_impl *d_impl; diff --git a/gnuradio-core/src/lib/runtime/gr_top_block_impl.h b/gnuradio-core/src/lib/runtime/gr_top_block_impl.h index ef28dd829..904443be5 100644 --- a/gnuradio-core/src/lib/runtime/gr_top_block_impl.h +++ b/gnuradio-core/src/lib/runtime/gr_top_block_impl.h @@ -23,6 +23,7 @@ #ifndef INCLUDED_GR_TOP_BLOCK_IMPL_H #define INCLUDED_GR_TOP_BLOCK_IMPL_H +#include <gr_core_api.h> #include <gr_scheduler.h> #include <gruel/thread.h> @@ -34,7 +35,7 @@ * decoupling of changes from dependent classes. * */ -class gr_top_block_impl +class GR_CORE_API gr_top_block_impl { public: gr_top_block_impl(gr_top_block *owner); diff --git a/gnuradio-core/src/lib/runtime/gr_tpb_detail.h b/gnuradio-core/src/lib/runtime/gr_tpb_detail.h index acfa264c7..90908c2f5 100644 --- a/gnuradio-core/src/lib/runtime/gr_tpb_detail.h +++ b/gnuradio-core/src/lib/runtime/gr_tpb_detail.h @@ -21,6 +21,7 @@ #ifndef INCLUDED_GR_TPB_DETAIL_H #define INCLUDED_GR_TPB_DETAIL_H +#include <gr_core_api.h> #include <gruel/thread.h> #include <deque> #include <gruel/pmt.h> @@ -30,7 +31,7 @@ class gr_block_detail; /*! * \brief used by thread-per-block scheduler */ -struct gr_tpb_detail { +struct GR_CORE_API gr_tpb_detail { gruel::mutex mutex; //< protects all vars bool input_changed; diff --git a/gnuradio-core/src/lib/runtime/gr_tpb_thread_body.h b/gnuradio-core/src/lib/runtime/gr_tpb_thread_body.h index a630b1be9..548cfedfb 100644 --- a/gnuradio-core/src/lib/runtime/gr_tpb_thread_body.h +++ b/gnuradio-core/src/lib/runtime/gr_tpb_thread_body.h @@ -21,6 +21,7 @@ #ifndef INCLUDED_GR_TPB_THREAD_BODY_H #define INCLUDED_GR_TPB_THREAD_BODY_H +#include <gr_core_api.h> #include <gr_block_executor.h> #include <gr_block.h> #include <gr_block_detail.h> @@ -33,7 +34,7 @@ * done or is interrupted. */ -class gr_tpb_thread_body { +class GR_CORE_API gr_tpb_thread_body { gr_block_executor d_exec; public: diff --git a/gnuradio-core/src/lib/runtime/gr_types.h b/gnuradio-core/src/lib/runtime/gr_types.h index ad8f145b8..fd5ca7758 100644 --- a/gnuradio-core/src/lib/runtime/gr_types.h +++ b/gnuradio-core/src/lib/runtime/gr_types.h @@ -23,6 +23,7 @@ #ifndef INCLUDED_GR_TYPES_H #define INCLUDED_GR_TYPES_H +#include <gr_core_api.h> #include <boost/shared_ptr.hpp> #include <vector> #include <stddef.h> // size_t diff --git a/gnuradio-core/src/lib/runtime/gr_unittests.h b/gnuradio-core/src/lib/runtime/gr_unittests.h index 59149bb2e..7161b31e7 100644 --- a/gnuradio-core/src/lib/runtime/gr_unittests.h +++ b/gnuradio-core/src/lib/runtime/gr_unittests.h @@ -24,12 +24,14 @@ #include "config.h" #endif +#include <gr_core_api.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <sys/types.h> #include <sys/stat.h> #include <unistd.h> +#include <string> #include <boost/filesystem/operations.hpp> #include <boost/filesystem/path.hpp> diff --git a/gnuradio-core/src/lib/runtime/gr_vmcircbuf.cc b/gnuradio-core/src/lib/runtime/gr_vmcircbuf.cc index 3b8a6e617..7138605c9 100644 --- a/gnuradio-core/src/lib/runtime/gr_vmcircbuf.cc +++ b/gnuradio-core/src/lib/runtime/gr_vmcircbuf.cc @@ -30,6 +30,8 @@ #include <stdio.h> #include <string.h> #include <gr_local_sighandler.h> +#include <vector> +#include <boost/format.hpp> // all the factories we know about #include <gr_vmcircbuf_createfilemapping.h> @@ -130,7 +132,7 @@ init_buffer (gr_vmcircbuf *c, int counter, int size) } static bool -check_mapping (gr_vmcircbuf *c, int counter, int size, char *msg, bool verbose) +check_mapping (gr_vmcircbuf *c, int counter, int size, const char *msg, bool verbose) { bool ok = true; @@ -163,28 +165,28 @@ check_mapping (gr_vmcircbuf *c, int counter, int size, char *msg, bool verbose) return ok; } -static char * +static const char * memsize (int size) { - static char buf[100]; + static std::string buf; if (size >= (1 << 20)){ - snprintf (buf, sizeof (buf), "%dMB", size / (1 << 20)); + buf = str(boost::format("%dMB") % (size / (1 << 20))); } else if (size >= (1 << 10)){ - snprintf (buf, sizeof (buf), "%dKB", size / (1 << 10)); + buf = str(boost::format("%dKB") % (size / (1 << 10))); } else { - snprintf (buf, sizeof (buf), "%d", size); + buf = str(boost::format("%d") % size); } - return buf; + return buf.c_str(); } static bool test_a_bunch (gr_vmcircbuf_factory *factory, int n, int size, int *start_ptr, bool verbose) { bool ok = true; - int counter[n]; - gr_vmcircbuf *c[n]; + std::vector<int> counter(n); + std::vector<gr_vmcircbuf *> c(n); int cum_size = 0; for (int i = 0; i < n; i++){ @@ -202,9 +204,8 @@ test_a_bunch (gr_vmcircbuf_factory *factory, int n, int size, int *start_ptr, bo } for (int i = 0; i < n; i++){ - char msg[100]; - snprintf (msg, sizeof (msg), "test_a_bunch_%dx%s[%d]", n, memsize (size), i); - ok &= check_mapping (c[i], counter[i], size, msg, verbose); + std::string msg = str(boost::format("test_a_bunch_%dx%s[%d]") % n % memsize (size) % i); + ok &= check_mapping (c[i], counter[i], size, msg.c_str(), verbose); } for (int i = 0; i < n; i++){ diff --git a/gnuradio-core/src/lib/runtime/gr_vmcircbuf.h b/gnuradio-core/src/lib/runtime/gr_vmcircbuf.h index a73a1559c..0e67d405b 100644 --- a/gnuradio-core/src/lib/runtime/gr_vmcircbuf.h +++ b/gnuradio-core/src/lib/runtime/gr_vmcircbuf.h @@ -23,13 +23,14 @@ #ifndef _GR_VMCIRCBUF_H_ #define _GR_VMCIRCBUF_H_ +#include <gr_core_api.h> #include <vector> /*! * \brief abstract class to implement doubly mapped virtual memory circular buffers * \ingroup internal */ -class gr_vmcircbuf { +class GR_CORE_API gr_vmcircbuf { protected: int d_size; char *d_base; @@ -48,7 +49,7 @@ class gr_vmcircbuf { /*! * \brief abstract factory for creating circular buffers */ -class gr_vmcircbuf_factory { +class GR_CORE_API gr_vmcircbuf_factory { protected: gr_vmcircbuf_factory () {}; virtual ~gr_vmcircbuf_factory (); @@ -76,7 +77,7 @@ class gr_vmcircbuf_factory { /* * \brief pulls together all implementations of gr_vmcircbuf */ -class gr_vmcircbuf_sysconfig { +class GR_CORE_API gr_vmcircbuf_sysconfig { public: /* diff --git a/gnuradio-core/src/lib/runtime/gr_vmcircbuf_createfilemapping.cc b/gnuradio-core/src/lib/runtime/gr_vmcircbuf_createfilemapping.cc index 42c459484..1b4d9700a 100644 --- a/gnuradio-core/src/lib/runtime/gr_vmcircbuf_createfilemapping.cc +++ b/gnuradio-core/src/lib/runtime/gr_vmcircbuf_createfilemapping.cc @@ -37,6 +37,7 @@ #include <stdio.h> #include <gr_pagesize.h> #include <gr_vmcircbuf_createfilemapping.h> +#include <boost/format.hpp> #ifdef HAVE_CREATEFILEMAPPING // Print Windows error (could/should be global?) @@ -72,23 +73,21 @@ gr_vmcircbuf_createfilemapping::gr_vmcircbuf_createfilemapping (int size) throw std::runtime_error ("gr_vmcircbuf_createfilemapping"); } - char seg_name[1024]; - snprintf (seg_name, sizeof (seg_name), "/gnuradio-%d-%d", getpid (), s_seg_counter); + std::string seg_name = str(boost::format("/gnuradio-%d-%d") % getpid () % s_seg_counter); d_handle = CreateFileMapping(INVALID_HANDLE_VALUE, // use paging file NULL, // default security PAGE_READWRITE, // read/write access 0, // max. object size size, // buffer size - seg_name); // name of mapping object + seg_name.c_str()); // name of mapping object s_seg_counter++; if (d_handle == NULL || d_handle == INVALID_HANDLE_VALUE){ - char msg[1024]; - snprintf( msg, sizeof(msg), - "gr_vmcircbuf_mmap_createfilemapping: CreateFileMapping [%s]", + std::string msg = str(boost::format( + "gr_vmcircbuf_mmap_createfilemapping: CreateFileMapping [%s]") % seg_name ); - werror( msg, GetLastError() ); + werror((char *) msg.c_str(), GetLastError() ); throw std::runtime_error ("gr_vmcircbuf_mmap_createfilemapping"); } diff --git a/gnuradio-core/src/lib/runtime/gr_vmcircbuf_createfilemapping.h b/gnuradio-core/src/lib/runtime/gr_vmcircbuf_createfilemapping.h index 9276ae98b..5ef31f5c6 100644 --- a/gnuradio-core/src/lib/runtime/gr_vmcircbuf_createfilemapping.h +++ b/gnuradio-core/src/lib/runtime/gr_vmcircbuf_createfilemapping.h @@ -23,6 +23,7 @@ #ifndef _GR_VMCIRCBUF_CREATEFILEMAPPING_H_ #define _GR_VMCIRCBUF_CREATEFILEMAPPING_H_ +#include <gr_core_api.h> #include <gr_vmcircbuf.h> #ifdef HAVE_CREATEFILEMAPPING @@ -32,7 +33,7 @@ * \brief concrete class to implement circular buffers with mmap and shm_open * \ingroup internal */ -class gr_vmcircbuf_createfilemapping : public gr_vmcircbuf +class GR_CORE_API gr_vmcircbuf_createfilemapping : public gr_vmcircbuf { public: // CREATORS @@ -49,7 +50,7 @@ class gr_vmcircbuf_createfilemapping : public gr_vmcircbuf /*! * \brief concrete factory for circular buffers built using mmap and shm_open */ -class gr_vmcircbuf_createfilemapping_factory : public gr_vmcircbuf_factory +class GR_CORE_API gr_vmcircbuf_createfilemapping_factory : public gr_vmcircbuf_factory { private: static gr_vmcircbuf_factory *s_the_factory; diff --git a/gnuradio-core/src/lib/runtime/gr_vmcircbuf_mmap_shm_open.h b/gnuradio-core/src/lib/runtime/gr_vmcircbuf_mmap_shm_open.h index 238f44414..002f5b434 100644 --- a/gnuradio-core/src/lib/runtime/gr_vmcircbuf_mmap_shm_open.h +++ b/gnuradio-core/src/lib/runtime/gr_vmcircbuf_mmap_shm_open.h @@ -23,13 +23,14 @@ #ifndef _GR_VMCIRCBUF_MMAP_SHM_OPEN_H_ #define _GR_VMCIRCBUF_MMAP_SHM_OPEN_H_ +#include <gr_core_api.h> #include <gr_vmcircbuf.h> /*! * \brief concrete class to implement circular buffers with mmap and shm_open * \ingroup internal */ -class gr_vmcircbuf_mmap_shm_open : public gr_vmcircbuf { +class GR_CORE_API gr_vmcircbuf_mmap_shm_open : public gr_vmcircbuf { public: // CREATORS @@ -41,7 +42,7 @@ class gr_vmcircbuf_mmap_shm_open : public gr_vmcircbuf { /*! * \brief concrete factory for circular buffers built using mmap and shm_open */ -class gr_vmcircbuf_mmap_shm_open_factory : public gr_vmcircbuf_factory { +class GR_CORE_API gr_vmcircbuf_mmap_shm_open_factory : public gr_vmcircbuf_factory { private: static gr_vmcircbuf_factory *s_the_factory; diff --git a/gnuradio-core/src/lib/runtime/gr_vmcircbuf_mmap_tmpfile.h b/gnuradio-core/src/lib/runtime/gr_vmcircbuf_mmap_tmpfile.h index e5be52768..a2ed6b87b 100644 --- a/gnuradio-core/src/lib/runtime/gr_vmcircbuf_mmap_tmpfile.h +++ b/gnuradio-core/src/lib/runtime/gr_vmcircbuf_mmap_tmpfile.h @@ -23,13 +23,14 @@ #ifndef _GR_VMCIRCBUF_MMAP_TMPFILE_H_ #define _GR_VMCIRCBUF_MMAP_TMPFILE_H_ +#include <gr_core_api.h> #include <gr_vmcircbuf.h> /*! * \brief concrete class to implement circular buffers with mmap and shm_open * \ingroup internal */ -class gr_vmcircbuf_mmap_tmpfile : public gr_vmcircbuf { +class GR_CORE_API gr_vmcircbuf_mmap_tmpfile : public gr_vmcircbuf { public: // CREATORS @@ -41,7 +42,7 @@ class gr_vmcircbuf_mmap_tmpfile : public gr_vmcircbuf { /*! * \brief concrete factory for circular buffers built using mmap and shm_open */ -class gr_vmcircbuf_mmap_tmpfile_factory : public gr_vmcircbuf_factory { +class GR_CORE_API gr_vmcircbuf_mmap_tmpfile_factory : public gr_vmcircbuf_factory { private: static gr_vmcircbuf_factory *s_the_factory; diff --git a/gnuradio-core/src/lib/runtime/gr_vmcircbuf_sysv_shm.h b/gnuradio-core/src/lib/runtime/gr_vmcircbuf_sysv_shm.h index cc87f8fe6..c7a008581 100644 --- a/gnuradio-core/src/lib/runtime/gr_vmcircbuf_sysv_shm.h +++ b/gnuradio-core/src/lib/runtime/gr_vmcircbuf_sysv_shm.h @@ -23,13 +23,14 @@ #ifndef _GR_VMCIRCBUF_SYSV_SHM_H_ #define _GR_VMCIRCBUF_SYSV_SHM_H_ +#include <gr_core_api.h> #include <gr_vmcircbuf.h> /*! * \brief concrete class to implement circular buffers with mmap and shm_open * \ingroup internal */ -class gr_vmcircbuf_sysv_shm : public gr_vmcircbuf { +class GR_CORE_API gr_vmcircbuf_sysv_shm : public gr_vmcircbuf { public: // CREATORS @@ -41,7 +42,7 @@ class gr_vmcircbuf_sysv_shm : public gr_vmcircbuf { /*! * \brief concrete factory for circular buffers built using mmap and shm_open */ -class gr_vmcircbuf_sysv_shm_factory : public gr_vmcircbuf_factory { +class GR_CORE_API gr_vmcircbuf_sysv_shm_factory : public gr_vmcircbuf_factory { private: static gr_vmcircbuf_factory *s_the_factory; diff --git a/gnuradio-core/src/lib/runtime/qa_runtime.h b/gnuradio-core/src/lib/runtime/qa_runtime.h index c55208c39..e1038aaf6 100644 --- a/gnuradio-core/src/lib/runtime/qa_runtime.h +++ b/gnuradio-core/src/lib/runtime/qa_runtime.h @@ -23,11 +23,12 @@ #ifndef _QA_RUNTIME_H_ #define _QA_RUNTIME_H_ +#include <gruel/attributes.h> #include <cppunit/TestSuite.h> //! collect all the tests for the runtime directory -class qa_runtime { +class __GR_ATTR_EXPORT qa_runtime { public: //! return suite of tests for all of runtime directory static CppUnit::TestSuite *suite (); diff --git a/gnuradio-core/src/lib/swig/CMakeLists.txt b/gnuradio-core/src/lib/swig/CMakeLists.txt new file mode 100644 index 000000000..c46b720c5 --- /dev/null +++ b/gnuradio-core/src/lib/swig/CMakeLists.txt @@ -0,0 +1,93 @@ +# Copyright 2010-2011 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio 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 General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. + +######################################################################## +INCLUDE(GrPython) +INCLUDE(GrSwig) + +INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIRS}) +LINK_DIRECTORIES(${Boost_LIBRARY_DIRS}) + +SET(GR_SWIG_INCLUDE_DIRS + ${Boost_INCLUDE_DIRS} + ${GSL_INCLUDE_DIRS} + ${GRUEL_INCLUDE_DIRS} + ${GNURADIO_CORE_INCLUDE_DIRS} + ${CMAKE_CURRENT_BINARY_DIR} +) +SET(GR_SWIG_LIBRARIES gnuradio-core) + +######################################################################## +# Build and install the swig targets +######################################################################## +# ---------------------------------------------------------------- +# We've split the previously monstrous gnuradio_corethon into 6 +# smaller pieces. This reduces compile time coupling and creates +# smaller pieces for the compiler to digest. prior to this change, on +# X86_64, g++'s resident set size was 650MB! +# ---------------------------------------------------------------- +GR_SWIG_MAKE(gnuradio_core_runtime gnuradio_core_runtime.i) +GR_SWIG_MAKE(gnuradio_core_general gnuradio_core_general.i) +SET(GR_SWIG_TARGET_DEPS gengen_generated) +GR_SWIG_MAKE(gnuradio_core_gengen gnuradio_core_gengen.i) +SET(GR_SWIG_TARGET_DEPS filter_generated) +GR_SWIG_MAKE(gnuradio_core_filter gnuradio_core_filter.i) +UNSET(GR_SWIG_TARGET_DEPS) +GR_SWIG_MAKE(gnuradio_core_io gnuradio_core_io.i) +GR_SWIG_MAKE(gnuradio_core_hier gnuradio_core_hier.i) + +GR_SWIG_INSTALL(TARGETS + gnuradio_core_runtime + gnuradio_core_general + gnuradio_core_gengen + gnuradio_core_filter + gnuradio_core_io + gnuradio_core_hier + DESTINATION ${GR_PYTHON_DIR}/gnuradio/gr + COMPONENT "core_python" +) + +######################################################################## +# Install various files +######################################################################## +INSTALL(FILES + gnuradio.i + gr_swig_block_magic.i + gr_shared_ptr.i + gnuradio_core_runtime.i + gnuradio_core_general.i + gnuradio_core_gengen.i + gnuradio_core_filter.i + gnuradio_core_io.i + gnuradio_core_hier.i + DESTINATION ${GR_INCLUDE_DIR}/gnuradio/swig + COMPONENT "core_swig" +) + +GR_PYTHON_INSTALL( + FILES gnuradio_core.py + DESTINATION ${GR_PYTHON_DIR}/gnuradio/gr + COMPONENT "core_python" +) + +INSTALL( + FILES ${CMAKE_CURRENT_SOURCE_DIR}/gnuradio_swig_bug_workaround.h + DESTINATION ${GR_INCLUDE_DIR}/gnuradio + COMPONENT "core_swig" +) diff --git a/gnuradio-core/src/lib/swig/gnuradio_core_general.i b/gnuradio-core/src/lib/swig/gnuradio_core_general.i index adf6b469a..b34d4f936 100644 --- a/gnuradio-core/src/lib/swig/gnuradio_core_general.i +++ b/gnuradio-core/src/lib/swig/gnuradio_core_general.i @@ -19,6 +19,8 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ +#define GR_CORE_API + #ifndef SWIGIMPORTED %module(directors="1") gnuradio_core_general #endif diff --git a/gnuradio-core/src/lib/viterbi/CMakeLists.txt b/gnuradio-core/src/lib/viterbi/CMakeLists.txt new file mode 100644 index 000000000..aeb8a012d --- /dev/null +++ b/gnuradio-core/src/lib/viterbi/CMakeLists.txt @@ -0,0 +1,63 @@ +# Copyright 2010-2011 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio 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 General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. + +######################################################################## +# This file included, use CMake directory variables +######################################################################## + +SET(viterbi_sources + ${CMAKE_CURRENT_SOURCE_DIR}/metrics.c + ${CMAKE_CURRENT_SOURCE_DIR}/tab.c + ${CMAKE_CURRENT_SOURCE_DIR}/viterbi.c +) + +######################################################################## +# define missing erf function with C linkage (hack for metrics.c) +######################################################################## +IF(MSVC) +FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/boost_math_erf.cc " +#include <boost/math/special_functions/erf.hpp> +extern \"C\" double erf(double x){ + return boost::math::erf(x); +} +") +LIST(APPEND viterbi_sources ${CMAKE_CURRENT_BINARY_DIR}/boost_math_erf.cc) +ENDIF(MSVC) + +######################################################################## +# Append gnuradio-core library sources +######################################################################## +LIST(APPEND gnuradio_core_sources ${viterbi_sources}) + +######################################################################## +# Install runtime headers +######################################################################## +INSTALL( + FILES ${CMAKE_CURRENT_SOURCE_DIR}/viterbi.h + DESTINATION ${GR_INCLUDE_DIR}/gnuradio + COMPONENT "core_devel" +) + +######################################################################## +# Create some text executables (not registered tests) +# Its not much to build so the sources are just re-listed, +# rather than create a new library just for these two apps. +######################################################################## +#ADD_EXECUTABLE(viterbi_encode ${CMAKE_CURRENT_SOURCE_DIR}/encode.cc ${viterbi_sources}) +#ADD_EXECUTABLE(viterbi_decode ${CMAKE_CURRENT_SOURCE_DIR}/decode.cc ${viterbi_sources}) diff --git a/gnuradio-core/src/lib/viterbi/Makefile.am b/gnuradio-core/src/lib/viterbi/Makefile.am index 8384c52f0..1b86a86f8 100644 --- a/gnuradio-core/src/lib/viterbi/Makefile.am +++ b/gnuradio-core/src/lib/viterbi/Makefile.am @@ -21,6 +21,8 @@ include $(top_srcdir)/Makefile.common LIBS = -lm +AM_CPPFLAGS = -I$(top_srcdir)/gnuradio-core/src/lib/general + noinst_LTLIBRARIES = libviterbi.la libviterbi_la_SOURCES = \ diff --git a/gnuradio-core/src/lib/viterbi/metrics.c b/gnuradio-core/src/lib/viterbi/metrics.c index 9f958cab7..77c6a63c8 100644 --- a/gnuradio-core/src/lib/viterbi/metrics.c +++ b/gnuradio-core/src/lib/viterbi/metrics.c @@ -42,6 +42,9 @@ #include <stdlib.h> #include <math.h> +//declare erf in case it was missing in math.h and provided for by the build system +extern double erf(double x); + /* Normal function integrated from -Inf to x. Range: 0-1 */ #define normal(x) (0.5 + 0.5*erf((x)/M_SQRT2)) diff --git a/gnuradio-core/src/lib/viterbi/viterbi.h b/gnuradio-core/src/lib/viterbi/viterbi.h index 155b0d93a..5bb8b357a 100644 --- a/gnuradio-core/src/lib/viterbi/viterbi.h +++ b/gnuradio-core/src/lib/viterbi/viterbi.h @@ -23,27 +23,31 @@ * than we'd like for K=7, especially since we chain back every 8 bits. * But it fits so nicely into a 32-bit machine word... */ -struct viterbi_state { + +#include <gr_core_api.h> + +struct GR_CORE_API viterbi_state { unsigned long path; /* Decoded path to this state */ long metric; /* Cumulative metric to this state */ }; +GR_CORE_API int gen_met(int mettab[2][256], /* Metric table */ int amp, /* Signal amplitude */ double esn0, /* Es/N0 ratio in dB */ double bias, /* Metric bias */ int scale); /* Scale factor */ -unsigned char +GR_CORE_API unsigned char encode(unsigned char *symbols, unsigned char *data, unsigned int nbytes,unsigned char encstate); -void +GR_CORE_API void viterbi_chunks_init(struct viterbi_state* state); -void + GR_CORE_API void viterbi_butterfly2(unsigned char *symbols, int mettab[2][256], struct viterbi_state *state0, struct viterbi_state *state1); -unsigned char +GR_CORE_API unsigned char viterbi_get_output(struct viterbi_state *state, unsigned char *outbuf); diff --git a/gnuradio-core/src/python/build_utils.py b/gnuradio-core/src/python/build_utils.py index c7acf6bd0..90c7978f2 100644 --- a/gnuradio-core/src/python/build_utils.py +++ b/gnuradio-core/src/python/build_utils.py @@ -93,7 +93,7 @@ def output_makefile_fragment (): return # overwrite the source, which must be writable; this should have been # checked for beforehand in the top-level Makefile.gen.gen . - f = open_src ('Makefile.gen', 'w') + f = open (os.path.join (os.environ.get('gendir', os.environ.get('srcdir', '.')), 'Makefile.gen'), 'w') f.write ('#\n# This file is machine generated. All edits will be overwritten\n#\n') output_subfrag (f, 'h') output_subfrag (f, 'i') diff --git a/gnuradio-core/src/python/gnuradio/CMakeLists.txt b/gnuradio-core/src/python/gnuradio/CMakeLists.txt new file mode 100644 index 000000000..57bc91552 --- /dev/null +++ b/gnuradio-core/src/python/gnuradio/CMakeLists.txt @@ -0,0 +1,41 @@ +# Copyright 2010-2011 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio 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 General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. + +INCLUDE(GrPython) + +ADD_SUBDIRECTORY(gr) +ADD_SUBDIRECTORY(gru) +ADD_SUBDIRECTORY(gruimpl) +ADD_SUBDIRECTORY(blks2) +ADD_SUBDIRECTORY(blks2impl) + +GR_PYTHON_INSTALL(FILES + __init__.py + eng_notation.py + eng_option.py + modulation_utils2.py + ofdm_packet_utils.py + gr_unittest.py + gr_xmlrunner.py + optfir.py + usrp_options.py + window.py + DESTINATION ${GR_PYTHON_DIR}/gnuradio + COMPONENT "core_python" +) diff --git a/gnuradio-core/src/python/gnuradio/Makefile.am b/gnuradio-core/src/python/gnuradio/Makefile.am index 30b5d02ab..289e37662 100644 --- a/gnuradio-core/src/python/gnuradio/Makefile.am +++ b/gnuradio-core/src/python/gnuradio/Makefile.am @@ -22,7 +22,7 @@ include $(top_srcdir)/Makefile.common if PYTHON -SUBDIRS = gr gru gruimpl blks2 blks2impl vocoder +SUBDIRS = gr gru gruimpl blks2 blks2impl grpython_PYTHON = \ __init__.py \ diff --git a/gnuradio-core/src/python/gnuradio/blks2/CMakeLists.txt b/gnuradio-core/src/python/gnuradio/blks2/CMakeLists.txt new file mode 100644 index 000000000..3e210100b --- /dev/null +++ b/gnuradio-core/src/python/gnuradio/blks2/CMakeLists.txt @@ -0,0 +1,26 @@ +# Copyright 2010-2011 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio 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 General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. + +INCLUDE(GrPython) + +GR_PYTHON_INSTALL( + FILES __init__.py + DESTINATION ${GR_PYTHON_DIR}/gnuradio/blks2 + COMPONENT "core_python" +) diff --git a/gnuradio-core/src/python/gnuradio/blks2impl/CMakeLists.txt b/gnuradio-core/src/python/gnuradio/blks2impl/CMakeLists.txt new file mode 100644 index 000000000..8b0baedd9 --- /dev/null +++ b/gnuradio-core/src/python/gnuradio/blks2impl/CMakeLists.txt @@ -0,0 +1,54 @@ +# Copyright 2010-2011 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio 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 General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. + +INCLUDE(GrPython) + +GR_PYTHON_INSTALL(FILES + __init__.py + am_demod.py + channel_model.py + filterbank.py + fm_demod.py + fm_emph.py + generic_usrp.py + logpwrfft.py + nbfm_rx.py + nbfm_tx.py + ofdm.py + ofdm_receiver.py + ofdm_sync_fixed.py + ofdm_sync_pn.py + ofdm_sync_pnac.py + ofdm_sync_ml.py + pfb_arb_resampler.py + pfb_channelizer.py + pfb_decimator.py + pfb_interpolator.py + psk.py + qam.py + rational_resampler.py + standard_squelch.py + stream_to_vector_decimator.py + wfm_rcv.py + wfm_rcv_fmdet.py + wfm_rcv_pll.py + wfm_tx.py + DESTINATION ${GR_PYTHON_DIR}/gnuradio/blks2impl + COMPONENT "core_python" +) diff --git a/gnuradio-core/src/python/gnuradio/blks2impl/ofdm.py b/gnuradio-core/src/python/gnuradio/blks2impl/ofdm.py index 3b1cd12ac..2663f7cf8 100644 --- a/gnuradio-core/src/python/gnuradio/blks2impl/ofdm.py +++ b/gnuradio-core/src/python/gnuradio/blks2impl/ofdm.py @@ -21,26 +21,12 @@ # import math -from gnuradio import gr, ofdm_packet_utils, modulation_utils2 +from gnuradio import gr, ofdm_packet_utils import gnuradio.gr.gr_threading as _threading import psk, qam from gnuradio.blks2impl.ofdm_receiver import ofdm_receiver -def _add_common_options(normal, expert): - """ - Adds OFDM-specific options to the Options Parser that are common - both to the modulator and demodulator. - """ - mods_list = ", ".join(modulation_utils2.type_1_constellations().keys()) - normal.add_option("-m", "--modulation", type="string", default="psk", - help="set modulation type (" + mods_list + ") [default=%default]") - expert.add_option("", "--fft-length", type="intx", default=512, - help="set the number of FFT bins [default=%default]") - expert.add_option("", "--occupied-tones", type="intx", default=200, - help="set the number of occupied FFT bins [default=%default]") - expert.add_option("", "--cp-length", type="intx", default=128, - help="set the number of bits in the cyclic prefix [default=%default]") # ///////////////////////////////////////////////////////////////////////////// # mod/demod with packets as i/o @@ -75,8 +61,6 @@ class ofdm_mod(gr.hier_block2): self._fft_length = options.fft_length self._occupied_tones = options.occupied_tones self._cp_length = options.cp_length - - arity = options.constellation_points win = [] #[1 for i in range(self._fft_length)] @@ -98,9 +82,19 @@ class ofdm_mod(gr.hier_block2): symbol_length = options.fft_length + options.cp_length - const = modulation_utils2.type_1_constellations()[self._modulation](arity).points() - - self._pkt_input = gr.ofdm_mapper_bcv(const, msgq_limit, + mods = {"bpsk": 2, "qpsk": 4, "8psk": 8, "qam8": 8, "qam16": 16, "qam64": 64, "qam256": 256} + arity = mods[self._modulation] + + rot = 1 + if self._modulation == "qpsk": + rot = (0.707+0.707j) + + if(self._modulation.find("psk") >= 0): + rotated_const = map(lambda pt: pt * rot, psk.gray_constellation[arity]) + elif(self._modulation.find("qam") >= 0): + rotated_const = map(lambda pt: pt * rot, qam.constellation[arity]) + #print rotated_const + self._pkt_input = gr.ofdm_mapper_bcv(rotated_const, msgq_limit, options.occupied_tones, options.fft_length) self.preambles = gr.ofdm_insert_preamble(self._fft_length, padded_preambles) @@ -146,10 +140,14 @@ class ofdm_mod(gr.hier_block2): """ Adds OFDM-specific options to the Options Parser """ - _add_common_options(normal, expert) - for mod in modulation_utils2.type_1_mods().values(): - mod.add_options(expert) - + normal.add_option("-m", "--modulation", type="string", default="bpsk", + help="set modulation type (bpsk, qpsk, 8psk, qam{16,64}) [default=%default]") + expert.add_option("", "--fft-length", type="intx", default=512, + help="set the number of FFT bins [default=%default]") + expert.add_option("", "--occupied-tones", type="intx", default=200, + help="set the number of occupied FFT bins [default=%default]") + expert.add_option("", "--cp-length", type="intx", default=128, + help="set the number of bits in the cyclic prefix [default=%default]") # Make a static method to call before instantiation add_options = staticmethod(add_options) @@ -198,9 +196,6 @@ class ofdm_demod(gr.hier_block2): self._cp_length = options.cp_length self._snr = options.snr - arity = options.constellation_points - print("con points is %s" % options.constellation_points) - # Use freq domain to get doubled-up known symbol for correlation in time domain zeros_on_left = int(math.ceil((self._fft_length - self._occupied_tones)/2.0)) ksfreq = known_symbols_4512_3[0:self._occupied_tones] @@ -216,11 +211,22 @@ class ofdm_demod(gr.hier_block2): self._occupied_tones, self._snr, preambles, options.log) - constell = modulation_utils2.type_1_constellations()[self._modulation](arity) + mods = {"bpsk": 2, "qpsk": 4, "8psk": 8, "qam8": 8, "qam16": 16, "qam64": 64, "qam256": 256} + arity = mods[self._modulation] + + rot = 1 + if self._modulation == "qpsk": + rot = (0.707+0.707j) + + if(self._modulation.find("psk") >= 0): + rotated_const = map(lambda pt: pt * rot, psk.gray_constellation[arity]) + elif(self._modulation.find("qam") >= 0): + rotated_const = map(lambda pt: pt * rot, qam.constellation[arity]) + #print rotated_const phgain = 0.25 frgain = phgain*phgain / 4.0 - self.ofdm_demod = gr.ofdm_frame_sink2(constell.base(), + self.ofdm_demod = gr.ofdm_frame_sink(rotated_const, range(arity), self._rcvd_pktq, self._occupied_tones, phgain, frgain) @@ -247,9 +253,14 @@ class ofdm_demod(gr.hier_block2): """ Adds OFDM-specific options to the Options Parser """ - _add_common_options(normal, expert) - for mod in modulation_utils2.type_1_mods().values(): - mod.add_options(expert) + normal.add_option("-m", "--modulation", type="string", default="bpsk", + help="set modulation type (bpsk or qpsk) [default=%default]") + expert.add_option("", "--fft-length", type="intx", default=512, + help="set the number of FFT bins [default=%default]") + expert.add_option("", "--occupied-tones", type="intx", default=200, + help="set the number of occupied FFT bins [default=%default]") + expert.add_option("", "--cp-length", type="intx", default=128, + help="set the number of bits in the cyclic prefix [default=%default]") # Make a static method to call before instantiation add_options = staticmethod(add_options) diff --git a/gnuradio-core/src/python/gnuradio/gr/CMakeLists.txt b/gnuradio-core/src/python/gnuradio/gr/CMakeLists.txt new file mode 100644 index 000000000..bd7541a19 --- /dev/null +++ b/gnuradio-core/src/python/gnuradio/gr/CMakeLists.txt @@ -0,0 +1,52 @@ +# Copyright 2010-2011 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio 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 General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. + +######################################################################## +INCLUDE(GrPython) + +GR_PYTHON_INSTALL(FILES + __init__.py + exceptions.py + gr_threading.py + gr_threading_23.py + gr_threading_24.py + hier_block2.py + prefs.py + top_block.py + pubsub.py + DESTINATION ${GR_PYTHON_DIR}/gnuradio/gr + COMPONENT "core_python" +) + +######################################################################## +# Handle the unit tests +######################################################################## +IF(ENABLE_TESTING) +INCLUDE(GrTest) +FILE(GLOB py_qa_test_files "qa_*.py") +FOREACH(py_qa_test_file ${py_qa_test_files}) + GET_FILENAME_COMPONENT(py_qa_test_name ${py_qa_test_file} NAME_WE) + SET(GR_TEST_PYTHON_DIRS + ${CMAKE_BINARY_DIR}/gnuradio-core/src/python + ${CMAKE_BINARY_DIR}/gnuradio-core/src/lib/swig + ) + SET(GR_TEST_TARGET_DEPS gruel gnuradio-core) + GR_ADD_TEST(${py_qa_test_name} ${PYTHON_EXECUTABLE} ${py_qa_test_file}) +ENDFOREACH(py_qa_test_file) +ENDIF(ENABLE_TESTING) diff --git a/gnuradio-core/src/python/gnuradio/gru/CMakeLists.txt b/gnuradio-core/src/python/gnuradio/gru/CMakeLists.txt new file mode 100644 index 000000000..55971ce5b --- /dev/null +++ b/gnuradio-core/src/python/gnuradio/gru/CMakeLists.txt @@ -0,0 +1,26 @@ +# Copyright 2010-2011 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio 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 General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. + +INCLUDE(GrPython) + +GR_PYTHON_INSTALL( + FILES __init__.py + DESTINATION ${GR_PYTHON_DIR}/gnuradio/gru + COMPONENT "core_python" +) diff --git a/gnuradio-core/src/python/gnuradio/gruimpl/CMakeLists.txt b/gnuradio-core/src/python/gnuradio/gruimpl/CMakeLists.txt new file mode 100644 index 000000000..aa9338764 --- /dev/null +++ b/gnuradio-core/src/python/gnuradio/gruimpl/CMakeLists.txt @@ -0,0 +1,38 @@ +# Copyright 2010-2011 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio 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 General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. + +INCLUDE(GrPython) + +GR_PYTHON_INSTALL(FILES + __init__.py + freqz.py + gnuplot_freqz.py + hexint.py + listmisc.py + mathmisc.py + lmx2306.py + msgq_runner.py + os_read_exactly.py + sdr_1000.py + seq_with_cursor.py + socket_stuff.py + daemon.py + DESTINATION ${GR_PYTHON_DIR}/gnuradio/gruimpl + COMPONENT "core_python" +) diff --git a/gnuradio-core/src/python/gnuradio/modulation_utils2.py b/gnuradio-core/src/python/gnuradio/modulation_utils2.py index f30055f4a..c5dba3e79 100644 --- a/gnuradio-core/src/python/gnuradio/modulation_utils2.py +++ b/gnuradio-core/src/python/gnuradio/modulation_utils2.py @@ -47,15 +47,6 @@ def type_1_demods(): def add_type_1_demod(name, demod_class): _type_1_demodulators[name] = demod_class -# Also record the constellation making functions of the modulations -_type_1_constellations = {} - -def type_1_constellations(): - return _type_1_constellations - -def add_type_1_constellation(name, constellation): - _type_1_constellations[name] = constellation - def extract_kwargs_from_options(function, excluded_args, options): """ @@ -88,14 +79,3 @@ def extract_kwargs_from_options(function, excluded_args, options): if getattr(options, kw) is not None: d[kw] = getattr(options, kw) return d - -def extract_kwargs_from_options_for_class(cls, options): - """ - Given command line options, create dictionary suitable for passing to __init__ - """ - d = extract_kwargs_from_options( - cls.__init__, ('self',), options) - for base in cls.__bases__: - if hasattr(base, 'extract_kwargs_from_options'): - d.update(base.extract_kwargs_from_options(options)) - return d diff --git a/gnuradio-core/src/python/gnuradio/vocoder/__init__.py b/gnuradio-core/src/python/gnuradio/vocoder/__init__.py deleted file mode 100644 index a4917cf64..000000000 --- a/gnuradio-core/src/python/gnuradio/vocoder/__init__.py +++ /dev/null @@ -1 +0,0 @@ -# make this a package diff --git a/gnuradio-core/src/tests/CMakeLists.txt b/gnuradio-core/src/tests/CMakeLists.txt new file mode 100644 index 000000000..1096ab66e --- /dev/null +++ b/gnuradio-core/src/tests/CMakeLists.txt @@ -0,0 +1,69 @@ +# Copyright 2010-2011 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio 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 General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. + +######################################################################## +INCLUDE(GrMiscUtils) #check n def +GR_CHECK_HDR_N_DEF(sys/resource.h HAVE_SYS_RESOURCE_H) + +######################################################################## +# Setup the include and linker paths +######################################################################## +INCLUDE_DIRECTORIES(${GRUEL_INCLUDE_DIRS}) +INCLUDE_DIRECTORIES(${GNURADIO_CORE_INCLUDE_DIRS}) + +INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIRS}) +LINK_DIRECTORIES(${Boost_LIBRARY_DIRS}) + +INCLUDE_DIRECTORIES(${CPPUNIT_INCLUDE_DIRS}) +LINK_DIRECTORIES(${CPPUNIT_LIBRARY_DIRS}) + +######################################################################## +# Build benchmarks and non-registered tests +######################################################################## +SET(tests_not_run #single source per test + benchmark_dotprod_fff.cc + benchmark_dotprod_fsf.cc + benchmark_dotprod_ccf.cc + benchmark_dotprod_fcc.cc + benchmark_dotprod_scc.cc + benchmark_dotprod_ccc.cc + benchmark_nco.cc + benchmark_vco.cc + test_runtime.cc + test_general.cc + test_filter.cc + #test_atsc.cc + test_vmcircbuf.cc +) + +FOREACH(test_not_run_src ${tests_not_run}) + GET_FILENAME_COMPONENT(name ${test_not_run_src} NAME_WE) + ADD_EXECUTABLE(${name} ${test_not_run_src}) + TARGET_LINK_LIBRARIES(${name} test-gnuradio-core) +ENDFOREACH(test_not_run_src) + +######################################################################## +# Build the test-all test to end all tests +# Set the test environment so the build libs will be found under MSVC. +######################################################################## +INCLUDE(GrTest) +SET(GR_TEST_TARGET_DEPS gruel gnuradio-core test-gnuradio-core) +ADD_EXECUTABLE(gr_core_test_all test_all.cc) +TARGET_LINK_LIBRARIES(gr_core_test_all test-gnuradio-core) +GR_ADD_TEST(gr-core-test-all gr_core_test_all) diff --git a/gnuradio-examples/python/Makefile.am b/gnuradio-examples/python/Makefile.am index 30effdf9a..eba4c14ab 100644 --- a/gnuradio-examples/python/Makefile.am +++ b/gnuradio-examples/python/Makefile.am @@ -25,7 +25,6 @@ SUBDIRS = \ apps \ digital \ digital-bert \ - digital_voice \ mp-sched \ multi-antenna \ multi_usrp \ diff --git a/gnuradio-examples/python/digital_voice/cvsd_test.py b/gnuradio-examples/python/digital_voice/cvsd_test.py deleted file mode 100755 index f8f1b9cce..000000000 --- a/gnuradio-examples/python/digital_voice/cvsd_test.py +++ /dev/null @@ -1,63 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2007 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3, or (at your option) -# any later version. -# -# GNU Radio 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 General Public License -# along with GNU Radio; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. -# - -from gnuradio import gr, blks2 -from gnuradio import audio -from gnuradio.eng_option import eng_option -from optparse import OptionParser - -def main(): - parser = OptionParser(option_class=eng_option) - parser.add_option("-I", "--audio-input", type="string", default="", - help="pcm input device name. E.g., hw:0,0 or /dev/dsp") - parser.add_option("-O", "--audio-output", type="string", default="", - help="pcm output device name. E.g., hw:0,0 or /dev/dsp") - parser.add_option("-r", "--sample-rate", type="eng_float", default="32000", - help="Audio sampling rate [defaul=%default]") - parser.add_option("-S", "--resample-rate", type="int", default="8", - help="Resampling rate in CVSD [default=%default]") - (options, args) = parser.parse_args () - - if len(args) != 0: - parser.print_help() - raise SystemExit, 1 - - tb = gr.top_block() - - src = audio.source(int(options.sample_rate), options.audio_input) - tx = blks2.cvsd_encode(options.resample_rate) - - # todo: add noise - - rx = blks2.cvsd_decode(options.resample_rate) - dst = audio.sink(int(options.sample_rate), options.audio_output) - - tb.connect(src, tx, rx, dst) - tb.run() - -if __name__ == '__main__': - print "Enter CTRL-C to exit" - try: - main() - except KeyboardInterrupt: - pass - diff --git a/gnuradio-examples/python/digital_voice/encdec.py b/gnuradio-examples/python/digital_voice/encdec.py deleted file mode 100755 index e87d57e2b..000000000 --- a/gnuradio-examples/python/digital_voice/encdec.py +++ /dev/null @@ -1,58 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2005 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3, or (at your option) -# any later version. -# -# GNU Radio 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 General Public License -# along with GNU Radio; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. -# - -from gnuradio import gr, blks2 -from gnuradio import audio -from gnuradio.eng_option import eng_option -from optparse import OptionParser - -class my_top_block(gr.top_block): - - def __init__(self): - gr.top_block.__init__(self) - - parser = OptionParser(option_class=eng_option) - parser.add_option("-I", "--audio-input", type="string", default="", - help="pcm input device name. E.g., hw:0,0 or /dev/dsp") - parser.add_option("-O", "--audio-output", type="string", default="", - help="pcm output device name. E.g., hw:0,0 or /dev/dsp") - (options, args) = parser.parse_args () - if len(args) != 0: - parser.print_help() - raise SystemExit, 1 - - sample_rate = 8000 - src = audio.source(sample_rate, options.audio_input) - tx = blks2.digital_voice_tx(self) - if_gain = gr.multiply_const_cc(10000) - # channel simulator here... - rx = blks2.digital_voice_rx(self) - dst = audio.sink(sample_rate, options.audio_output) - - self.connect(src, tx, if_gain, rx, dst) - - -if __name__ == '__main__': - try: - my_top_block().run() - except KeyboardInterrupt: - pass diff --git a/gr-atsc/CMakeLists.txt b/gr-atsc/CMakeLists.txt new file mode 100644 index 000000000..86aa53991 --- /dev/null +++ b/gr-atsc/CMakeLists.txt @@ -0,0 +1,106 @@ +# Copyright 2011 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio 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 General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. + +######################################################################## +# Setup dependencies +######################################################################## +INCLUDE(GrBoost) + +######################################################################## +# Register component +######################################################################## +INCLUDE(GrComponent) +GR_REGISTER_COMPONENT("gr-atsc" ENABLE_GR_ATSC + Boost_FOUND + ENABLE_GR_CORE_ +) + +GR_SET_GLOBAL(GR_ATSC_INCLUDE_DIRS + ${CMAKE_CURRENT_SOURCE_DIR}/src/lib +) + +######################################################################## +# Begin conditional configuration +######################################################################## +IF(ENABLE_GR_ATSC) + +######################################################################## +# Setup CPack components +######################################################################## +INCLUDE(GrPackage) +CPACK_SET(CPACK_COMPONENT_GROUP_ATSC_DESCRIPTION "GNU Radio ATSC Blocks") + +CPACK_COMPONENT("atsc_runtime" + GROUP "ATSC" + DISPLAY_NAME "Runtime" + DESCRIPTION "Runtime" + DEPENDS "core_runtime" +) + +CPACK_COMPONENT("atsc_devel" + GROUP "ATSC" + DISPLAY_NAME "Development" + DESCRIPTION "C++ headers, package config, import libraries" + DEPENDS "core_devel" +) + +CPACK_COMPONENT("atsc_python" + GROUP "ATSC" + DISPLAY_NAME "Python" + DESCRIPTION "Python modules for runtime; GRC xml files" + DEPENDS "core_python;atsc_runtime" +) + +CPACK_COMPONENT("atsc_examples" + GROUP "ATSC" + DISPLAY_NAME "Examples" + DESCRIPTION "Python examples for ATSC" + DEPENDS "atsc_python" +) + +CPACK_COMPONENT("atsc_swig" + GROUP "ATSC" + DISPLAY_NAME "SWIG" + DESCRIPTION "SWIG development .i files" + DEPENDS "core_swig;atsc_python;atsc_devel" +) + +######################################################################## +# Add subdirectories +######################################################################## +ADD_SUBDIRECTORY(src/lib) +IF(ENABLE_PYTHON) + ADD_SUBDIRECTORY(src/python) +ENDIF(ENABLE_PYTHON) + +######################################################################## +# Create Pkg Config File +######################################################################## +CONFIGURE_FILE( + ${CMAKE_CURRENT_SOURCE_DIR}/gnuradio-atsc.pc.in + ${CMAKE_CURRENT_BINARY_DIR}/gnuradio-atsc.pc +@ONLY) + +INSTALL( + FILES ${CMAKE_CURRENT_BINARY_DIR}/gnuradio-atsc.pc + DESTINATION ${GR_LIBRARY_DIR}/pkgconfig + COMPONENT "atsc_devel" +) + +ENDIF(ENABLE_GR_ATSC) diff --git a/gr-atsc/src/lib/CMakeLists.txt b/gr-atsc/src/lib/CMakeLists.txt new file mode 100644 index 000000000..9b03d48dc --- /dev/null +++ b/gr-atsc/src/lib/CMakeLists.txt @@ -0,0 +1,230 @@ +# Copyright 2011 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio 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 General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. + +######################################################################## +# Setup the include and linker paths +######################################################################## +INCLUDE_DIRECTORIES( + ${GNURADIO_CORE_INCLUDE_DIRS} + ${GR_ATSC_INCLUDE_DIRS} + ${CMAKE_CURRENT_BINARY_DIR} +) + +INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIRS}) +LINK_DIRECTORIES(${Boost_LIBRARY_DIRS}) + +######################################################################## +# Generate viterbi mux source +######################################################################## +ADD_EXECUTABLE(atsci_viterbi_gen atsci_viterbi_gen.cc) + +SET(atsci_viterbi_mux_cc ${CMAKE_CURRENT_BINARY_DIR}/atsci_viterbi_mux.cc) + +ADD_CUSTOM_COMMAND( + OUTPUT ${atsci_viterbi_mux_cc} + DEPENDS atsci_viterbi_gen + COMMAND atsci_viterbi_gen -o ${atsci_viterbi_mux_cc} +) + +######################################################################## +# Setup library +######################################################################## +LIST(APPEND gr_atsc_sources + ${atsci_viterbi_mux_cc} + atsc_derandomizer.cc + atsc_randomizer.cc + atsc_rs_decoder.cc + atsc_rs_encoder.cc + atsc_interleaver.cc + atsc_deinterleaver.cc + atsc_trellis_encoder.cc + atsc_viterbi_decoder.cc + atsc_ds_to_softds.cc + atsc_field_sync_mux.cc + atsc_field_sync_demux.cc + atsc_equalizer.cc + atsc_fs_checker.cc + atsc_bit_timing_loop.cc + atsc_fpll.cc + atsc_depad.cc + atsc_pad.cc + atsci_basic_trellis_encoder.cc + atsci_data_interleaver.cc + atsci_equalizer.cc + atsci_equalizer_lms.cc + atsci_equalizer_lms2.cc + atsci_equalizer_nop.cc + atsci_fake_single_viterbi.cc + atsci_fs_checker.cc + atsci_fs_checker_naive.cc + atsci_fs_correlator.cc + atsci_fs_correlator_naive.cc + atsci_single_viterbi.cc + atsci_sssr.cc + atsci_pnXXX.cc + atsci_randomizer.cc + atsci_reed_solomon.cc + atsci_sliding_correlator.cc + atsci_trellis_encoder.cc + atsci_viterbi_decoder.cc + create_atsci_equalizer.cc + create_atsci_fs_checker.cc + create_atsci_fs_correlator.cc + plinfo.cc +) + +LIST(APPEND atsc_libs + gnuradio-core + ${Boost_LIBRARIES} +) + +ADD_LIBRARY(gnuradio-atsc SHARED ${gr_atsc_sources}) +TARGET_LINK_LIBRARIES(gnuradio-atsc ${atsc_libs}) +SET_TARGET_PROPERTIES(gnuradio-atsc PROPERTIES DEFINE_SYMBOL "gnuradio_atsc_EXPORTS") +SET_TARGET_PROPERTIES(gnuradio-atsc PROPERTIES SOVERSION ${LIBVER}) + +INSTALL(TARGETS gnuradio-atsc + LIBRARY DESTINATION ${GR_LIBRARY_DIR} COMPONENT "atsc_runtime" # .so/.dylib file + ARCHIVE DESTINATION ${GR_LIBRARY_DIR} COMPONENT "atsc_devel" # .lib file + RUNTIME DESTINATION ${GR_RUNTIME_DIR} COMPONENT "atsc_runtime" # .dll file +) + +######################################################################## +# Build and register unit test +######################################################################## +IF(ENABLE_TESTING) + +INCLUDE_DIRECTORIES(${CPPUNIT_INCLUDE_DIRS}) +LINK_DIRECTORIES(${CPPUNIT_LIBRARY_DIRS}) + +LIST(APPEND test_atsci_sources + qa_atsci_basic_trellis_encoder.cc + qa_atsci_data_interleaver.cc + qa_atsci_equalizer_nop.cc + qa_atsci_fake_single_viterbi.cc + qa_atsci_fs_correlator.cc + qa_atsci_single_viterbi.cc + qa_atsci_randomizer.cc + qa_atsci_reed_solomon.cc + qa_atsci_sliding_correlator.cc + qa_atsci_trellis_encoder.cc + qa_atsci_viterbi_decoder.cc + qa_convolutional_interleaver.cc + qa_atsci.cc + qa_interleaver_fifo.cc +) + +INCLUDE(GrTest) +SET(GR_TEST_TARGET_DEPS gnuradio-atsc gnuradio-core gruel) +ADD_EXECUTABLE(test_atsci ${test_atsci_sources} test_atsci.cc) +TARGET_LINK_LIBRARIES(test_atsci gnuradio-atsc gnuradio-core ${CPPUNIT_LIBRARIES}) +GR_ADD_TEST(atsci-test test_atsci) + +ENDIF(ENABLE_TESTING) + +######################################################################## +# Install public header files +######################################################################## +INSTALL(FILES + atsc_api.h + atsc_consts.h + atsc_derandomizer.h + atsc_randomizer.h + atsc_rs_decoder.h + atsc_rs_encoder.h + atsc_interleaver.h + atsc_deinterleaver.h + atsc_trellis_encoder.h + atsc_viterbi_decoder.h + atsc_ds_to_softds.h + atsc_field_sync_mux.h + atsc_field_sync_demux.h + atsc_equalizer.h + atsc_fs_checker.h + atsc_bit_timing_loop.h + atsc_fpll.h + atsc_depad.h + atsc_pad.h + atsc_types.h + atsci_basic_trellis_encoder.h + atsci_data_interleaver.h + atsci_diag_output.h + atsci_equalizer.h + atsci_equalizer_lms.h + atsci_equalizer_lms2.h + atsci_equalizer_nop.h + atsci_exp2_lp.h + atsci_fake_single_viterbi.h + atsci_fs_checker.h + atsci_fs_checker_naive.h + atsci_fs_correlator.h + atsci_fs_correlator_naive.h + atsci_pnXXX.h + atsci_randomizer.h + atsci_reed_solomon.h + atsci_root_raised_cosine.h + atsci_root_raised_cosine_bandpass.h + atsci_single_viterbi.h + atsci_slicer_agc.h + atsci_sliding_correlator.h + atsci_sssr.h + atsci_syminfo.h + atsci_sync_tag.h + atsci_trellis_encoder.h + atsci_viterbi_decoder.h + atsci_vsbtx_lp.h + convolutional_interleaver.h + create_atsci_equalizer.h + create_atsci_fs_checker.h + create_atsci_fs_correlator.h + fpll_btloop_coupling.h + interleaver_fifo.h + DESTINATION ${GR_INCLUDE_DIR}/gnuradio + COMPONENT "atsc_devel" +) + +######################################################################## +# Setup swig generation +######################################################################## +IF(ENABLE_PYTHON) +INCLUDE(GrPython) +INCLUDE(GrSwig) + +SET(GR_SWIG_INCLUDE_DIRS + ${GR_ATSC_INCLUDE_DIRS} + ${GNURADIO_CORE_SWIG_INCLUDE_DIRS} +) + +SET(GR_SWIG_LIBRARIES gnuradio-atsc) + +GR_SWIG_MAKE(atsc atsc.i) + +GR_SWIG_INSTALL( + TARGETS atsc + DESTINATION ${GR_PYTHON_DIR}/gnuradio + COMPONENT "atsc_python" +) + +INSTALL( + FILES atsc.i + DESTINATION ${GR_INCLUDE_DIR}/gnuradio/swig + COMPONENT "atsc_swig" +) + +ENDIF(ENABLE_PYTHON) diff --git a/gr-atsc/src/lib/Makefile.am b/gr-atsc/src/lib/Makefile.am index b1bda90ff..3cbdc8a1b 100644 --- a/gr-atsc/src/lib/Makefile.am +++ b/gr-atsc/src/lib/Makefile.am @@ -123,6 +123,7 @@ libgnuradio_atsc_qa_la_LDFLAGS = \ # These headers get installed in ${prefix}/include/gnuradio grinclude_HEADERS = \ + atsc_api.h \ atsc_consts.h \ atsc_derandomizer.h \ atsc_randomizer.h \ diff --git a/gr-atsc/src/lib/atsc_api.h b/gr-atsc/src/lib/atsc_api.h new file mode 100644 index 000000000..5add37762 --- /dev/null +++ b/gr-atsc/src/lib/atsc_api.h @@ -0,0 +1,33 @@ +/* + * Copyright 2011 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio 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 General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifndef INCLUDED_ATSC_API_H +#define INCLUDED_ATSC_API_H + +#include <gruel/attributes.h> + +#ifdef gnuradio_atsc_EXPORTS +# define ATSC_API __GR_ATTR_EXPORT +#else +# define ATSC_API __GR_ATTR_IMPORT +#endif + +#endif /* INCLUDED_ATSC_API_H */ diff --git a/gr-atsc/src/lib/atsc_bit_timing_loop.h b/gr-atsc/src/lib/atsc_bit_timing_loop.h index c9b63fee9..2adff26b8 100644 --- a/gr-atsc/src/lib/atsc_bit_timing_loop.h +++ b/gr-atsc/src/lib/atsc_bit_timing_loop.h @@ -22,6 +22,7 @@ #ifndef INCLUDED_ATSC_BIT_TIMING_LOOP_H #define INCLUDED_ATSC_BIT_TIMING_LOOP_H +#include <atsc_api.h> #include <cstdio> #include <gr_block.h> #include <atsci_diag_output.h> @@ -31,7 +32,7 @@ class atsc_bit_timing_loop; typedef boost::shared_ptr<atsc_bit_timing_loop> atsc_bit_timing_loop_sptr; -atsc_bit_timing_loop_sptr atsc_make_bit_timing_loop(); +ATSC_API atsc_bit_timing_loop_sptr atsc_make_bit_timing_loop(); /*! * \brief ATSC BitTimingLoop3 @@ -40,9 +41,9 @@ atsc_bit_timing_loop_sptr atsc_make_bit_timing_loop(); * This class accepts a single real input and produces two outputs, * the raw symbol (float) and the tag (atsc_syminfo) */ -class atsc_bit_timing_loop : public gr_block +class ATSC_API atsc_bit_timing_loop : public gr_block { - friend atsc_bit_timing_loop_sptr atsc_make_bit_timing_loop(); + friend ATSC_API atsc_bit_timing_loop_sptr atsc_make_bit_timing_loop(); atsc_bit_timing_loop(); diff --git a/gr-atsc/src/lib/atsc_deinterleaver.h b/gr-atsc/src/lib/atsc_deinterleaver.h index 0920818a4..8cab62b62 100644 --- a/gr-atsc/src/lib/atsc_deinterleaver.h +++ b/gr-atsc/src/lib/atsc_deinterleaver.h @@ -22,13 +22,14 @@ #ifndef INCLUDED_ATSC_DEINTERLEAVER_H #define INCLUDED_ATSC_DEINTERLEAVER_H +#include <atsc_api.h> #include <gr_sync_block.h> #include <atsci_data_interleaver.h> class atsc_deinterleaver; typedef boost::shared_ptr<atsc_deinterleaver> atsc_deinterleaver_sptr; -atsc_deinterleaver_sptr atsc_make_deinterleaver(); +ATSC_API atsc_deinterleaver_sptr atsc_make_deinterleaver(); /*! * \brief Deinterleave RS encoded ATSC data ( atsc_mpeg_packet_rs_encoded --> atsc_mpeg_packet_rs_encoded) @@ -36,9 +37,9 @@ atsc_deinterleaver_sptr atsc_make_deinterleaver(); * * input: atsc_mpeg_packet_rs_encoded; output: atsc_mpeg_packet_rs_encoded */ -class atsc_deinterleaver : public gr_sync_block +class ATSC_API atsc_deinterleaver : public gr_sync_block { - friend atsc_deinterleaver_sptr atsc_make_deinterleaver(); + friend ATSC_API atsc_deinterleaver_sptr atsc_make_deinterleaver(); atsci_data_deinterleaver d_deinterleaver; diff --git a/gr-atsc/src/lib/atsc_depad.h b/gr-atsc/src/lib/atsc_depad.h index 58dfdaf62..b514efe28 100644 --- a/gr-atsc/src/lib/atsc_depad.h +++ b/gr-atsc/src/lib/atsc_depad.h @@ -22,12 +22,13 @@ #ifndef INCLUDED_ATSC_DEPAD_H #define INCLUDED_ATSC_DEPAD_H +#include <atsc_api.h> #include <gr_sync_interpolator.h> class atsc_depad; typedef boost::shared_ptr<atsc_depad> atsc_depad_sptr; -atsc_depad_sptr atsc_make_depad(); +ATSC_API atsc_depad_sptr atsc_make_depad(); /*! * \brief depad mpeg ts packets from 256 byte atsc_mpeg_packet to 188 byte char @@ -35,9 +36,9 @@ atsc_depad_sptr atsc_make_depad(); * * input: atsc_mpeg_packet; output: unsigned char */ -class atsc_depad : public gr_sync_interpolator +class ATSC_API atsc_depad : public gr_sync_interpolator { - friend atsc_depad_sptr atsc_make_depad(); + friend ATSC_API atsc_depad_sptr atsc_make_depad(); atsc_depad(); diff --git a/gr-atsc/src/lib/atsc_derandomizer.h b/gr-atsc/src/lib/atsc_derandomizer.h index a72efbd4e..54254d0c5 100644 --- a/gr-atsc/src/lib/atsc_derandomizer.h +++ b/gr-atsc/src/lib/atsc_derandomizer.h @@ -22,13 +22,14 @@ #ifndef INCLUDED_ATSC_DERANDOMIZER_H #define INCLUDED_ATSC_DERANDOMIZER_H +#include <atsc_api.h> #include <gr_sync_block.h> #include <atsci_randomizer.h> class atsc_derandomizer; typedef boost::shared_ptr<atsc_derandomizer> atsc_derandomizer_sptr; -atsc_derandomizer_sptr atsc_make_derandomizer(); +ATSC_API atsc_derandomizer_sptr atsc_make_derandomizer(); /*! * \brief "dewhiten" incoming mpeg transport stream packets @@ -36,9 +37,9 @@ atsc_derandomizer_sptr atsc_make_derandomizer(); * * input: atsc_mpeg_packet_no_sync; output: atsc_mpeg_packet; */ -class atsc_derandomizer : public gr_sync_block +class ATSC_API atsc_derandomizer : public gr_sync_block { - friend atsc_derandomizer_sptr atsc_make_derandomizer(); + friend ATSC_API atsc_derandomizer_sptr atsc_make_derandomizer(); atsci_randomizer d_rand; diff --git a/gr-atsc/src/lib/atsc_ds_to_softds.h b/gr-atsc/src/lib/atsc_ds_to_softds.h index f8623e3b0..1021eed6f 100644 --- a/gr-atsc/src/lib/atsc_ds_to_softds.h +++ b/gr-atsc/src/lib/atsc_ds_to_softds.h @@ -22,13 +22,14 @@ #ifndef INCLUDED_ATSC_DS_TO_SOFTDS_H #define INCLUDED_ATSC_DS_TO_SOFTDS_H +#include <atsc_api.h> #include <gr_sync_block.h> #include <atsc_types.h> class atsc_ds_to_softds; typedef boost::shared_ptr<atsc_ds_to_softds> atsc_ds_to_softds_sptr; -atsc_ds_to_softds_sptr atsc_make_ds_to_softds(); +ATSC_API atsc_ds_to_softds_sptr atsc_make_ds_to_softds(); /*! * \brief Debug glue routine (atsc_data_segment --> atsc_soft_data_segment) @@ -36,9 +37,9 @@ atsc_ds_to_softds_sptr atsc_make_ds_to_softds(); * * input: atsc_data_segment; output: atsc_soft_data_segment */ -class atsc_ds_to_softds : public gr_sync_block +class ATSC_API atsc_ds_to_softds : public gr_sync_block { - friend atsc_ds_to_softds_sptr atsc_make_ds_to_softds(); + friend ATSC_API atsc_ds_to_softds_sptr atsc_make_ds_to_softds(); atsc_ds_to_softds(); diff --git a/gr-atsc/src/lib/atsc_equalizer.h b/gr-atsc/src/lib/atsc_equalizer.h index 52b5cd38d..773cd1a04 100644 --- a/gr-atsc/src/lib/atsc_equalizer.h +++ b/gr-atsc/src/lib/atsc_equalizer.h @@ -22,13 +22,14 @@ #ifndef INCLUDED_ATSC_EQUALIZER_H #define INCLUDED_ATSC_EQUALIZER_H +#include <atsc_api.h> #include <gr_sync_block.h> #include <atsci_equalizer.h> class atsc_equalizer; typedef boost::shared_ptr<atsc_equalizer> atsc_equalizer_sptr; -atsc_equalizer_sptr atsc_make_equalizer(); +atsc_equalizer_sptr ATSC_API atsc_make_equalizer(); /*! * \brief ATSC equalizer (float,syminfo --> float,syminfo) @@ -37,9 +38,9 @@ atsc_equalizer_sptr atsc_make_equalizer(); * first inputs are data samples, second inputs are tags. * first outputs are equalized data samples, second outputs are tags. */ -class atsc_equalizer : public gr_sync_block +class ATSC_API atsc_equalizer : public gr_sync_block { - friend atsc_equalizer_sptr atsc_make_equalizer(); + friend ATSC_API atsc_equalizer_sptr atsc_make_equalizer(); atsc_equalizer(); diff --git a/gr-atsc/src/lib/atsc_field_sync_demux.h b/gr-atsc/src/lib/atsc_field_sync_demux.h index 01cc33f87..0e3a5003d 100644 --- a/gr-atsc/src/lib/atsc_field_sync_demux.h +++ b/gr-atsc/src/lib/atsc_field_sync_demux.h @@ -22,13 +22,14 @@ #ifndef INCLUDED_ATSC_FIELD_SYNC_DEMUX_H #define INCLUDED_ATSC_FIELD_SYNC_DEMUX_H +#include <atsc_api.h> #include <gr_block.h> #include <atsc_types.h> class atsc_field_sync_demux; typedef boost::shared_ptr<atsc_field_sync_demux> atsc_field_sync_demux_sptr; -atsc_field_sync_demux_sptr atsc_make_field_sync_demux(); +ATSC_API atsc_field_sync_demux_sptr atsc_make_field_sync_demux(); /*! * \brief ATSC Field Sync Demux @@ -37,9 +38,9 @@ atsc_field_sync_demux_sptr atsc_make_field_sync_demux(); * \ingroup atsc * */ -class atsc_field_sync_demux : public gr_block +class ATSC_API atsc_field_sync_demux : public gr_block { - friend atsc_field_sync_demux_sptr atsc_make_field_sync_demux(); + friend ATSC_API atsc_field_sync_demux_sptr atsc_make_field_sync_demux(); atsc_field_sync_demux(); diff --git a/gr-atsc/src/lib/atsc_field_sync_mux.h b/gr-atsc/src/lib/atsc_field_sync_mux.h index 189341cb9..d08a99b5b 100644 --- a/gr-atsc/src/lib/atsc_field_sync_mux.h +++ b/gr-atsc/src/lib/atsc_field_sync_mux.h @@ -22,13 +22,14 @@ #ifndef INCLUDED_ATSC_FIELD_SYNC_MUX_H #define INCLUDED_ATSC_FIELD_SYNC_MUX_H +#include <atsc_api.h> #include <gr_sync_block.h> #include <atsc_types.h> class atsc_field_sync_mux; typedef boost::shared_ptr<atsc_field_sync_mux> atsc_field_sync_mux_sptr; -atsc_field_sync_mux_sptr atsc_make_field_sync_mux(); +ATSC_API atsc_field_sync_mux_sptr atsc_make_field_sync_mux(); /*! * \brief Insert ATSC Field Syncs as required (atsc_data_segment --> atsc_data_segment) @@ -36,9 +37,9 @@ atsc_field_sync_mux_sptr atsc_make_field_sync_mux(); * * input: atsc_data_segment; output: atsc_data_segment */ -class atsc_field_sync_mux : public gr_sync_block +class ATSC_API atsc_field_sync_mux : public gr_sync_block { - friend atsc_field_sync_mux_sptr atsc_make_field_sync_mux(); + friend ATSC_API atsc_field_sync_mux_sptr atsc_make_field_sync_mux(); atsc_field_sync_mux(); diff --git a/gr-atsc/src/lib/atsc_fpll.h b/gr-atsc/src/lib/atsc_fpll.h index 1ed41d865..dac3cda86 100644 --- a/gr-atsc/src/lib/atsc_fpll.h +++ b/gr-atsc/src/lib/atsc_fpll.h @@ -22,6 +22,7 @@ #ifndef INCLUDED_ATSC_FPLL_H #define INCLUDED_ATSC_FPLL_H +#include <atsc_api.h> #include <gr_sync_block.h> #include <gr_nco.h> #include <gr_single_pole_iir.h> @@ -32,7 +33,7 @@ class atsc_fpll; typedef boost::shared_ptr<atsc_fpll> atsc_fpll_sptr; -atsc_fpll_sptr atsc_make_fpll(); +ATSC_API atsc_fpll_sptr atsc_make_fpll(); /*! * \brief ATSC FPLL (2nd Version) @@ -45,9 +46,9 @@ atsc_fpll_sptr atsc_make_fpll(); * This class accepts a single real input and produces a single real output */ -class atsc_fpll : public gr_sync_block +class ATSC_API atsc_fpll : public gr_sync_block { - friend atsc_fpll_sptr atsc_make_fpll(); + friend ATSC_API atsc_fpll_sptr atsc_make_fpll(); atsc_fpll(); diff --git a/gr-atsc/src/lib/atsc_fs_checker.h b/gr-atsc/src/lib/atsc_fs_checker.h index e7271af22..03e50ee9d 100644 --- a/gr-atsc/src/lib/atsc_fs_checker.h +++ b/gr-atsc/src/lib/atsc_fs_checker.h @@ -22,13 +22,14 @@ #ifndef INCLUDED_ATSC_FS_CHECKER_H #define INCLUDED_ATSC_FS_CHECKER_H +#include <atsc_api.h> #include <atsci_fs_checker.h> #include <gr_sync_block.h> class atsc_fs_checker; typedef boost::shared_ptr<atsc_fs_checker> atsc_fs_checker_sptr; -atsc_fs_checker_sptr atsc_make_fs_checker(); +ATSC_API atsc_fs_checker_sptr atsc_make_fs_checker(); /*! * \brief ATSC field sync checker (float,syminfo --> float,syminfo) @@ -38,7 +39,7 @@ atsc_fs_checker_sptr atsc_make_fs_checker(); * second output is set of tags, one-for-one with first output. */ -class atsc_fs_checker : public gr_sync_block +class ATSC_API atsc_fs_checker : public gr_sync_block { friend atsc_fs_checker_sptr atsc_make_fs_checker(); diff --git a/gr-atsc/src/lib/atsc_interleaver.h b/gr-atsc/src/lib/atsc_interleaver.h index 5f82b7596..00cd54c11 100644 --- a/gr-atsc/src/lib/atsc_interleaver.h +++ b/gr-atsc/src/lib/atsc_interleaver.h @@ -22,22 +22,23 @@ #ifndef INCLUDED_ATSC_INTERLEAVER_H #define INCLUDED_ATSC_INTERLEAVER_H +#include <atsc_api.h> #include <gr_sync_block.h> #include <atsci_data_interleaver.h> class atsc_interleaver; typedef boost::shared_ptr<atsc_interleaver> atsc_interleaver_sptr; -atsc_interleaver_sptr atsc_make_interleaver(); +ATSC_API atsc_interleaver_sptr atsc_make_interleaver(); /*! \brief Interleave RS encoded ATSC data ( atsc_mpeg_packet_rs_encoded --> atsc_mpeg_packet_rs_encoded)* * \ingroup atsc * * input: atsc_mpeg_packet_rs_encoded; output: atsc_mpeg_packet_rs_encoded */ -class atsc_interleaver : public gr_sync_block +class ATSC_API atsc_interleaver : public gr_sync_block { - friend atsc_interleaver_sptr atsc_make_interleaver(); + friend ATSC_API atsc_interleaver_sptr atsc_make_interleaver(); atsci_data_interleaver d_interleaver; diff --git a/gr-atsc/src/lib/atsc_pad.h b/gr-atsc/src/lib/atsc_pad.h index e7e6874fb..866c72552 100644 --- a/gr-atsc/src/lib/atsc_pad.h +++ b/gr-atsc/src/lib/atsc_pad.h @@ -22,12 +22,13 @@ #ifndef INCLUDED_ATSC_PAD_H #define INCLUDED_ATSC_PAD_H +#include <atsc_api.h> #include <gr_sync_decimator.h> class atsc_pad; typedef boost::shared_ptr<atsc_pad> atsc_pad_sptr; -atsc_pad_sptr atsc_make_pad(); +ATSC_API atsc_pad_sptr atsc_make_pad(); /*! * \brief pad mpeg ts packets from 188 byte char to @@ -36,9 +37,9 @@ atsc_pad_sptr atsc_make_pad(); * * input: unsigned char; output: atsc_mpeg_packet */ -class atsc_pad : public gr_sync_decimator +class ATSC_API atsc_pad : public gr_sync_decimator { - friend atsc_pad_sptr atsc_make_pad(); + friend ATSC_API atsc_pad_sptr atsc_make_pad(); atsc_pad(); diff --git a/gr-atsc/src/lib/atsc_randomizer.h b/gr-atsc/src/lib/atsc_randomizer.h index 6617bcc28..1178f06c0 100644 --- a/gr-atsc/src/lib/atsc_randomizer.h +++ b/gr-atsc/src/lib/atsc_randomizer.h @@ -22,13 +22,14 @@ #ifndef INCLUDED_ATSC_RANDOMIZER_H #define INCLUDED_ATSC_RANDOMIZER_H +#include <atsc_api.h> #include <gr_sync_block.h> #include <atsci_randomizer.h> class atsc_randomizer; typedef boost::shared_ptr<atsc_randomizer> atsc_randomizer_sptr; -atsc_randomizer_sptr atsc_make_randomizer(); +ATSC_API atsc_randomizer_sptr atsc_make_randomizer(); /*! * \brief "Whiten" incoming mpeg transport stream packets @@ -36,9 +37,9 @@ atsc_randomizer_sptr atsc_make_randomizer(); * * input: atsc_mpeg_packet; output: atsc_mpeg_packet_no_sync */ -class atsc_randomizer : public gr_sync_block +class ATSC_API atsc_randomizer : public gr_sync_block { - friend atsc_randomizer_sptr atsc_make_randomizer(); + friend ATSC_API atsc_randomizer_sptr atsc_make_randomizer(); atsci_randomizer d_rand; bool d_field2; // user to init plinfo in output diff --git a/gr-atsc/src/lib/atsc_rs_decoder.h b/gr-atsc/src/lib/atsc_rs_decoder.h index 00dea1603..4b8d6c1b4 100644 --- a/gr-atsc/src/lib/atsc_rs_decoder.h +++ b/gr-atsc/src/lib/atsc_rs_decoder.h @@ -22,13 +22,14 @@ #ifndef INCLUDED_ATSC_RS_DECODER_H #define INCLUDED_ATSC_RS_DECODER_H +#include <atsc_api.h> #include <gr_sync_block.h> #include <atsci_reed_solomon.h> class atsc_rs_decoder; typedef boost::shared_ptr<atsc_rs_decoder> atsc_rs_decoder_sptr; -atsc_rs_decoder_sptr atsc_make_rs_decoder(); +ATSC_API atsc_rs_decoder_sptr atsc_make_rs_decoder(); /*! * \brief Reed-Solomon decoder for ATSC @@ -36,9 +37,9 @@ atsc_rs_decoder_sptr atsc_make_rs_decoder(); * * input: atsc_mpeg_packet_rs_encoded; output: atsc_mpeg_packet_no_sync */ -class atsc_rs_decoder : public gr_sync_block +class ATSC_API atsc_rs_decoder : public gr_sync_block { - friend atsc_rs_decoder_sptr atsc_make_rs_decoder(); + friend ATSC_API atsc_rs_decoder_sptr atsc_make_rs_decoder(); atsci_reed_solomon d_rs_decoder; diff --git a/gr-atsc/src/lib/atsc_rs_encoder.h b/gr-atsc/src/lib/atsc_rs_encoder.h index 312b2e1cb..d9812678a 100644 --- a/gr-atsc/src/lib/atsc_rs_encoder.h +++ b/gr-atsc/src/lib/atsc_rs_encoder.h @@ -22,13 +22,14 @@ #ifndef INCLUDED_ATSC_RS_ENCODER_H #define INCLUDED_ATSC_RS_ENCODER_H +#include <atsc_api.h> #include <gr_sync_block.h> #include <atsci_reed_solomon.h> class atsc_rs_encoder; typedef boost::shared_ptr<atsc_rs_encoder> atsc_rs_encoder_sptr; -atsc_rs_encoder_sptr atsc_make_rs_encoder(); +ATSC_API atsc_rs_encoder_sptr atsc_make_rs_encoder(); /*! * \brief Reed-Solomon encoder for ATSC @@ -36,9 +37,9 @@ atsc_rs_encoder_sptr atsc_make_rs_encoder(); * * input: atsc_mpeg_packet_no_sync; output: atsc_mpeg_packet_rs_encoded */ -class atsc_rs_encoder : public gr_sync_block +class ATSC_API atsc_rs_encoder : public gr_sync_block { - friend atsc_rs_encoder_sptr atsc_make_rs_encoder(); + friend ATSC_API atsc_rs_encoder_sptr atsc_make_rs_encoder(); atsci_reed_solomon d_rs_encoder; diff --git a/gr-atsc/src/lib/atsc_trellis_encoder.h b/gr-atsc/src/lib/atsc_trellis_encoder.h index 5c93daf99..c84816118 100644 --- a/gr-atsc/src/lib/atsc_trellis_encoder.h +++ b/gr-atsc/src/lib/atsc_trellis_encoder.h @@ -22,13 +22,14 @@ #ifndef INCLUDED_ATSC_TRELLIS_ENCODER_H #define INCLUDED_ATSC_TRELLIS_ENCODER_H +#include <atsc_api.h> #include <gr_sync_block.h> #include <atsci_trellis_encoder.h> class atsc_trellis_encoder; typedef boost::shared_ptr<atsc_trellis_encoder> atsc_trellis_encoder_sptr; -atsc_trellis_encoder_sptr atsc_make_trellis_encoder(); +ATSC_API atsc_trellis_encoder_sptr atsc_make_trellis_encoder(); /*! * \brief ATSC 12-way interleaved trellis encoder (atsc_mpeg_packet_rs_encoded --> atsc_data_segment) @@ -36,9 +37,9 @@ atsc_trellis_encoder_sptr atsc_make_trellis_encoder(); * * input: atsc_mpeg_packet_rs_encoded; output: atsc_data_segment */ -class atsc_trellis_encoder : public gr_sync_block +class ATSC_API atsc_trellis_encoder : public gr_sync_block { - friend atsc_trellis_encoder_sptr atsc_make_trellis_encoder(); + friend ATSC_API atsc_trellis_encoder_sptr atsc_make_trellis_encoder(); atsci_trellis_encoder d_trellis_encoder; diff --git a/gr-atsc/src/lib/atsc_viterbi_decoder.h b/gr-atsc/src/lib/atsc_viterbi_decoder.h index 511df0dff..1a43b4952 100644 --- a/gr-atsc/src/lib/atsc_viterbi_decoder.h +++ b/gr-atsc/src/lib/atsc_viterbi_decoder.h @@ -22,13 +22,14 @@ #ifndef INCLUDED_ATSC_VITERBI_DECODER_H #define INCLUDED_ATSC_VITERBI_DECODER_H +#include <atsc_api.h> #include <gr_sync_block.h> #include <atsci_viterbi_decoder.h> class atsc_viterbi_decoder; typedef boost::shared_ptr<atsc_viterbi_decoder> atsc_viterbi_decoder_sptr; -atsc_viterbi_decoder_sptr atsc_make_viterbi_decoder(); +ATSC_API atsc_viterbi_decoder_sptr atsc_make_viterbi_decoder(); /*! * \brief ATSC 12-way interleaved viterbi decoder (atsc_soft_data_segment --> atsc_mpeg_packet_rs_encoded) @@ -36,9 +37,9 @@ atsc_viterbi_decoder_sptr atsc_make_viterbi_decoder(); * * input: atsc_soft_data_segment; output: atsc_mpeg_packet_rs_encoded */ -class atsc_viterbi_decoder : public gr_sync_block +class ATSC_API atsc_viterbi_decoder : public gr_sync_block { - friend atsc_viterbi_decoder_sptr atsc_make_viterbi_decoder(); + friend ATSC_API atsc_viterbi_decoder_sptr atsc_make_viterbi_decoder(); atsci_viterbi_decoder d_viterbi_decoder; diff --git a/gr-atsc/src/lib/atsci_basic_trellis_encoder.h b/gr-atsc/src/lib/atsci_basic_trellis_encoder.h index 1e4073144..c17e5653e 100644 --- a/gr-atsc/src/lib/atsci_basic_trellis_encoder.h +++ b/gr-atsc/src/lib/atsci_basic_trellis_encoder.h @@ -22,6 +22,7 @@ #ifndef _ATSC_BASIC_TRELLIS_ENCODER_H_ #define _ATSC_BASIC_TRELLIS_ENCODER_H_ +#include <atsc_api.h> #include <assert.h> /*! @@ -36,7 +37,7 @@ * filter is not supported. */ -class atsci_basic_trellis_encoder { +class ATSC_API atsci_basic_trellis_encoder { private: int state; // two bit state; diff --git a/gr-atsc/src/lib/atsci_data_interleaver.h b/gr-atsc/src/lib/atsci_data_interleaver.h index ab4b64d4f..e7f982db4 100644 --- a/gr-atsc/src/lib/atsci_data_interleaver.h +++ b/gr-atsc/src/lib/atsci_data_interleaver.h @@ -23,13 +23,14 @@ #ifndef _ATSC_DATA_INTERLEAVER_H_ #define _ATSC_DATA_INTERLEAVER_H_ +#include <atsc_api.h> #include <atsc_types.h> #include <convolutional_interleaver.h> /*! * \brief atsc convolutional data interleaver */ -class atsci_data_interleaver : public convolutional_interleaver<unsigned char> { +class ATSC_API atsci_data_interleaver : public convolutional_interleaver<unsigned char> { public: atsci_data_interleaver () : convolutional_interleaver<unsigned char>(true, 52, 4) {} @@ -40,7 +41,7 @@ class atsci_data_interleaver : public convolutional_interleaver<unsigned char> { /*! * \brief atsc convolutional data deinterleaver */ -class atsci_data_deinterleaver : public convolutional_interleaver<unsigned char> { +class ATSC_API atsci_data_deinterleaver : public convolutional_interleaver<unsigned char> { public: atsci_data_deinterleaver () : convolutional_interleaver<unsigned char>(false, 52, 4), alignment_fifo (156) {} diff --git a/gr-atsc/src/lib/atsci_equalizer.h b/gr-atsc/src/lib/atsci_equalizer.h index 2120ea90a..853c52689 100644 --- a/gr-atsc/src/lib/atsci_equalizer.h +++ b/gr-atsc/src/lib/atsci_equalizer.h @@ -23,12 +23,13 @@ #ifndef _ATSC_EQUALIZER_H_ #define _ATSC_EQUALIZER_H_ +#include <atsc_api.h> #include <atsci_syminfo.h> /*! * \brief abstract base class for ATSC equalizer */ -class atsci_equalizer { +class ATSC_API atsci_equalizer { private: diff --git a/gr-atsc/src/lib/atsci_equalizer_lms.h b/gr-atsc/src/lib/atsci_equalizer_lms.h index 1626da234..8a39255c6 100644 --- a/gr-atsc/src/lib/atsci_equalizer_lms.h +++ b/gr-atsc/src/lib/atsci_equalizer_lms.h @@ -23,11 +23,12 @@ #ifndef _ATSC_EQUALIZER_LMS_H_ #define _ATSC_EQUALIZER_LMS_H_ +#include <atsc_api.h> #include <atsci_equalizer.h> #include <vector> #include <stdio.h> -class atsci_equalizer_lms : public atsci_equalizer +class ATSC_API atsci_equalizer_lms : public atsci_equalizer { public: atsci_equalizer_lms (); diff --git a/gr-atsc/src/lib/atsci_equalizer_lms2.h b/gr-atsc/src/lib/atsci_equalizer_lms2.h index 45b25b73f..7c60fc174 100644 --- a/gr-atsc/src/lib/atsci_equalizer_lms2.h +++ b/gr-atsc/src/lib/atsci_equalizer_lms2.h @@ -23,11 +23,12 @@ #ifndef _ATSC_EQUALIZER_LMS2_H_ #define _ATSC_EQUALIZER_LMS2_H_ +#include <atsc_api.h> #include <atsci_equalizer.h> #include <vector> #include <stdio.h> -class atsci_equalizer_lms2 : public atsci_equalizer +class ATSC_API atsci_equalizer_lms2 : public atsci_equalizer { public: atsci_equalizer_lms2 (); diff --git a/gr-atsc/src/lib/atsci_equalizer_nop.h b/gr-atsc/src/lib/atsci_equalizer_nop.h index 399f2da46..6d842601f 100644 --- a/gr-atsc/src/lib/atsci_equalizer_nop.h +++ b/gr-atsc/src/lib/atsci_equalizer_nop.h @@ -23,9 +23,10 @@ #ifndef _ATSC_EQUALIZER_NOP_H_ #define _ATSC_EQUALIZER_NOP_H_ +#include <atsc_api.h> #include <atsci_equalizer.h> -class atsci_equalizer_nop : public atsci_equalizer +class ATSC_API atsci_equalizer_nop : public atsci_equalizer { private: float scale (float input) { return input; } diff --git a/gr-atsc/src/lib/atsci_exp2_lp.h b/gr-atsc/src/lib/atsci_exp2_lp.h index cf66843c2..12d08fa6d 100644 --- a/gr-atsc/src/lib/atsci_exp2_lp.h +++ b/gr-atsc/src/lib/atsci_exp2_lp.h @@ -23,9 +23,10 @@ #ifndef _ATSC_EXP2_LP_H_ #define _ATSC_EXP2_LP_H_ +#include <atsc_api.h> #include <gr_fir_builder.h> -class atsci_exp2_lp : public gr_fir_builder +class ATSC_API atsci_exp2_lp : public gr_fir_builder { public: virtual std::vector<float> taps (double sampling_freq); diff --git a/gr-atsc/src/lib/atsci_fake_single_viterbi.h b/gr-atsc/src/lib/atsci_fake_single_viterbi.h index 1318256ec..b4cb6e3b3 100644 --- a/gr-atsc/src/lib/atsci_fake_single_viterbi.h +++ b/gr-atsc/src/lib/atsci_fake_single_viterbi.h @@ -23,10 +23,12 @@ #ifndef _ATSCFAKESINGLEVITERBI_H_ #define _ATSCFAKESINGLEVITERBI_H_ +#include <atsc_api.h> + /*! * \brief single channel viterbi decoder */ -class atsci_fake_single_viterbi +class ATSC_API atsci_fake_single_viterbi { public: diff --git a/gr-atsc/src/lib/atsci_fs_checker.h b/gr-atsc/src/lib/atsci_fs_checker.h index 76b754904..cdcd541e8 100644 --- a/gr-atsc/src/lib/atsci_fs_checker.h +++ b/gr-atsc/src/lib/atsci_fs_checker.h @@ -22,6 +22,7 @@ #ifndef _ATSC_FS_CHECKER_H_ #define _ATSC_FS_CHECKER_H_ +#include <atsc_api.h> #include <atsci_syminfo.h> /*! @@ -47,7 +48,7 @@ * occur every 832 samples assuming everything is working. */ -class atsci_fs_checker { +class ATSC_API atsci_fs_checker { public: diff --git a/gr-atsc/src/lib/atsci_fs_checker_naive.h b/gr-atsc/src/lib/atsci_fs_checker_naive.h index 951820492..3ef507111 100644 --- a/gr-atsc/src/lib/atsci_fs_checker_naive.h +++ b/gr-atsc/src/lib/atsci_fs_checker_naive.h @@ -23,12 +23,13 @@ #ifndef _ATSC_FS_CHECKER_NAIVE_H_ #define _ATSC_FS_CHECKER_NAIVE_H_ +#include <atsc_api.h> #include <atsci_fs_checker.h> /*! * \brief Naive concrete implementation of field sync checker */ -class atsci_fs_checker_naive : public atsci_fs_checker { +class ATSC_API atsci_fs_checker_naive : public atsci_fs_checker { private: static const int SRSIZE = 1024; // must be power of two diff --git a/gr-atsc/src/lib/atsci_fs_correlator.h b/gr-atsc/src/lib/atsci_fs_correlator.h index f7915364a..a6db7f518 100644 --- a/gr-atsc/src/lib/atsci_fs_correlator.h +++ b/gr-atsc/src/lib/atsci_fs_correlator.h @@ -22,6 +22,8 @@ #ifndef _ATSC_FS_CORRELATOR_H_ #define _ATSC_FS_CORRELATOR_H_ +#include <atsc_api.h> + /*! * \brief abstract base class for ATSC field sync correlator * @@ -42,7 +44,7 @@ * occur every 832 samples assuming everything is working. */ -class atsci_fs_correlator { +class ATSC_API atsci_fs_correlator { public: diff --git a/gr-atsc/src/lib/atsci_fs_correlator_naive.h b/gr-atsc/src/lib/atsci_fs_correlator_naive.h index c05cff0f7..92e3f7499 100644 --- a/gr-atsc/src/lib/atsci_fs_correlator_naive.h +++ b/gr-atsc/src/lib/atsci_fs_correlator_naive.h @@ -23,12 +23,13 @@ #ifndef _ATSC_FS_CORRELATOR_NAIVE_H_ #define _ATSC_FS_CORRELATOR_NAIVE_H_ +#include <atsc_api.h> #include <atsci_fs_correlator.h> /*! * \brief Naive concrete implementation of field sync correlator */ -class atsci_fs_correlator_naive : public atsci_fs_correlator { +class ATSC_API atsci_fs_correlator_naive : public atsci_fs_correlator { private: static const int SRSIZE = 1024; // must be power of two diff --git a/gr-atsc/src/lib/atsci_pnXXX.h b/gr-atsc/src/lib/atsci_pnXXX.h index 0e09ae831..58cb2d02d 100644 --- a/gr-atsc/src/lib/atsci_pnXXX.h +++ b/gr-atsc/src/lib/atsci_pnXXX.h @@ -20,5 +20,7 @@ * Boston, MA 02110-1301, USA. */ -extern const unsigned char atsc_pn511[]; -extern const unsigned char atsc_pn63[]; +#include <atsc_api.h> + +ATSC_API extern const unsigned char atsc_pn511[]; +ATSC_API extern const unsigned char atsc_pn63[]; diff --git a/gr-atsc/src/lib/atsci_randomizer.h b/gr-atsc/src/lib/atsci_randomizer.h index 36025d10b..30c3235bb 100644 --- a/gr-atsc/src/lib/atsci_randomizer.h +++ b/gr-atsc/src/lib/atsci_randomizer.h @@ -23,6 +23,7 @@ #ifndef _ATSC_RANDOMIZER_H_ #define _ATSC_RANDOMIZER_H_ +#include <atsc_api.h> #include <atsc_types.h> /*! @@ -32,7 +33,7 @@ * See figure D4 on page 54. */ -class atsci_randomizer { +class ATSC_API atsci_randomizer { friend class qa_atsci_randomizer; public: diff --git a/gr-atsc/src/lib/atsci_reed_solomon.h b/gr-atsc/src/lib/atsci_reed_solomon.h index c9cdca94b..6f53c77ca 100644 --- a/gr-atsc/src/lib/atsci_reed_solomon.h +++ b/gr-atsc/src/lib/atsci_reed_solomon.h @@ -23,6 +23,7 @@ #ifndef _ATSC_REED_SOLOMON_H_ #define _ATSC_REED_SOLOMON_H_ +#include <atsc_api.h> #include <atsc_types.h> /*! @@ -32,7 +33,7 @@ * See figure D5 on page 55. */ -class atsci_reed_solomon { +class ATSC_API atsci_reed_solomon { public: atsci_reed_solomon(); diff --git a/gr-atsc/src/lib/atsci_root_raised_cosine.h b/gr-atsc/src/lib/atsci_root_raised_cosine.h index cb2798ae5..12870faba 100644 --- a/gr-atsc/src/lib/atsci_root_raised_cosine.h +++ b/gr-atsc/src/lib/atsci_root_raised_cosine.h @@ -22,9 +22,10 @@ #ifndef _ATSC_RRC_H_ #define _ATSC_RRC_H_ +#include <atsc_api.h> #include <gr_fir_builder.h> -class atsc_root_raised_cosine : public gr_fir_builder +class ATSC_API atsc_root_raised_cosine : public gr_fir_builder { public: virtual std::vector<float> taps (double sampling_freq); diff --git a/gr-atsc/src/lib/atsci_root_raised_cosine_bandpass.h b/gr-atsc/src/lib/atsci_root_raised_cosine_bandpass.h index 00f609929..98329ab53 100644 --- a/gr-atsc/src/lib/atsci_root_raised_cosine_bandpass.h +++ b/gr-atsc/src/lib/atsci_root_raised_cosine_bandpass.h @@ -22,9 +22,10 @@ #ifndef _ATSC_RRC_BANDPASS_H_ #define _ATSC_RRC_BANDPASS_H_ +#include <atsc_api.h> #include <atsci_root_raised_cosine.h> -class atsc_root_raised_cosine_bandpass : public atsc_root_raised_cosine +class ATSC_API atsc_root_raised_cosine_bandpass : public atsc_root_raised_cosine { public: atsc_root_raised_cosine_bandpass (double center_freq) : _center_freq (center_freq) {} diff --git a/gr-atsc/src/lib/atsci_single_viterbi.h b/gr-atsc/src/lib/atsci_single_viterbi.h index a722a4aaf..cc752cb3a 100644 --- a/gr-atsc/src/lib/atsci_single_viterbi.h +++ b/gr-atsc/src/lib/atsci_single_viterbi.h @@ -23,10 +23,12 @@ #ifndef _ATSCSINGLEVITERBI_H_ #define _ATSCSINGLEVITERBI_H_ +#include <atsc_api.h> + /*! * \brief single channel viterbi decoder */ -class atsci_single_viterbi +class ATSC_API atsci_single_viterbi { public: diff --git a/gr-atsc/src/lib/atsci_slicer_agc.h b/gr-atsc/src/lib/atsci_slicer_agc.h index 2e7d3be7a..520fec44b 100644 --- a/gr-atsc/src/lib/atsci_slicer_agc.h +++ b/gr-atsc/src/lib/atsci_slicer_agc.h @@ -23,6 +23,7 @@ #ifndef _ATSC_SLICER_AGC_H_ #define _ATSC_SLICER_AGC_H_ +#include <atsc_api.h> #include <math.h> #include <gr_single_pole_iir.h> @@ -32,7 +33,7 @@ * Given perfect data, output values will be +/- {7, 5, 3, 1} */ -class atsci_slicer_agc { +class ATSC_API atsci_slicer_agc { public: atsci_slicer_agc () : _gain(1), dc(0.0025) {}; diff --git a/gr-atsc/src/lib/atsci_sliding_correlator.h b/gr-atsc/src/lib/atsci_sliding_correlator.h index c01bc9a20..64834a4e2 100644 --- a/gr-atsc/src/lib/atsci_sliding_correlator.h +++ b/gr-atsc/src/lib/atsci_sliding_correlator.h @@ -22,15 +22,17 @@ #ifndef _ATSC_SLIDING_CORRELATOR_H_ #define _ATSC_SLIDING_CORRELATOR_H_ +#include <atsc_api.h> #include <string.h> -extern const unsigned char atsc_pn511[511]; -extern const unsigned char atsc_pn63[63]; +#include <atsci_pnXXX.h> +//extern const unsigned char atsc_pn511[511]; +//extern const unsigned char atsc_pn63[63]; /*! * \brief look for the PN 511 field sync pattern */ -class atsci_sliding_correlator { +class ATSC_API atsci_sliding_correlator { public: atsci_sliding_correlator (); diff --git a/gr-atsc/src/lib/atsci_sssr.h b/gr-atsc/src/lib/atsci_sssr.h index 4555dc23c..1dee54c1d 100644 --- a/gr-atsc/src/lib/atsci_sssr.h +++ b/gr-atsc/src/lib/atsci_sssr.h @@ -27,6 +27,7 @@ #ifndef _ATSC_SSSR_H_ #define _ATSC_SSSR_H_ +#include <atsc_api.h> #include <atsc_consts.h> #include <gri_mmse_fir_interpolator.h> #include <gr_single_pole_iir.h> @@ -43,7 +44,7 @@ namespace sssr { // ---------------------------------------------------------------- //! digital correlator for 1001 and 0110 patterns - class digital_correlator { + class ATSC_API digital_correlator { int d_sr; // 4 bit shift register public: @@ -70,7 +71,7 @@ namespace sssr { // ---------------------------------------------------------------- //! segment sync integrator - class seg_sync_integrator { + class ATSC_API seg_sync_integrator { signed char d_integrator[ATSC_DATA_SEGMENT_LENGTH]; public: @@ -94,7 +95,7 @@ namespace sssr { // ---------------------------------------------------------------- //! quad filter (used to compute timing error) - class quad_filter { + class ATSC_API quad_filter { sample_t d_delay[4]; public: @@ -128,7 +129,7 @@ namespace sssr { * by Wayne E. Bretl of Zenith, pgs 41-45. */ -class atsci_sssr { +class ATSC_API atsci_sssr { sssr::digital_correlator d_correlator; sssr::seg_sync_integrator d_integrator; sssr::quad_filter d_quad_filter; @@ -193,7 +194,7 @@ public: * \brief interpolator control for segment and symbol sync recovery */ -class atsci_interpolator { +class ATSC_API atsci_interpolator { gri_mmse_fir_interpolator d_interp; gr_single_pole_iir<float,float,float> d_loop; // ``VCO'' loop filter double d_nominal_ratio_of_rx_clock_to_symbol_freq; // FREQ diff --git a/gr-atsc/src/lib/atsci_trellis_encoder.h b/gr-atsc/src/lib/atsci_trellis_encoder.h index dc5c16d76..53be3fc22 100644 --- a/gr-atsc/src/lib/atsci_trellis_encoder.h +++ b/gr-atsc/src/lib/atsci_trellis_encoder.h @@ -23,6 +23,7 @@ #ifndef _ATSC_TRELLIS_ENCODER_H_ #define _ATSC_TRELLIS_ENCODER_H_ +#include <atsc_api.h> #include <atsci_basic_trellis_encoder.h> #include <atsc_types.h> @@ -30,7 +31,7 @@ * \brief fancy, schmancy 12-way interleaved trellis encoder for ATSC */ -class atsci_trellis_encoder { +class ATSC_API atsci_trellis_encoder { public: static const int NCODERS = 12; diff --git a/gr-atsc/src/lib/atsci_viterbi_decoder.h b/gr-atsc/src/lib/atsci_viterbi_decoder.h index 22e3c1892..1243feeb5 100644 --- a/gr-atsc/src/lib/atsci_viterbi_decoder.h +++ b/gr-atsc/src/lib/atsci_viterbi_decoder.h @@ -25,6 +25,7 @@ #define USE_SIMPLE_SLICER 0 +#include <atsc_api.h> #include <atsc_types.h> #include <interleaver_fifo.h> @@ -40,7 +41,7 @@ typedef atsci_single_viterbi single_viterbi_t; * \brief fancy, schmancy 12-way interleaved viterbi decoder for ATSC */ -class atsci_viterbi_decoder { +class ATSC_API atsci_viterbi_decoder { public: static const int NCODERS = 12; diff --git a/gr-atsc/src/lib/atsci_vsbtx_lp.h b/gr-atsc/src/lib/atsci_vsbtx_lp.h index 7193c87d0..d3bb0c9d1 100644 --- a/gr-atsc/src/lib/atsci_vsbtx_lp.h +++ b/gr-atsc/src/lib/atsci_vsbtx_lp.h @@ -23,9 +23,10 @@ #ifndef _ATSC_VSBTX_LP_H_ #define _ATSC_VSBTX_LP_H_ +#include <atsc_api.h> #include <gr_fir_builder.h> -class atsc_vsbtx_lp : public gr_fir_builder +class ATSC_API atsc_vsbtx_lp : public gr_fir_builder { public: virtual std::vector<float> taps (double sampling_freq); diff --git a/gr-atsc/src/lib/create_atsci_equalizer.h b/gr-atsc/src/lib/create_atsci_equalizer.h index 57c167f59..fd26237d8 100644 --- a/gr-atsc/src/lib/create_atsci_equalizer.h +++ b/gr-atsc/src/lib/create_atsci_equalizer.h @@ -22,10 +22,12 @@ #ifndef _CREATE_ATSC_EQUALIZER_H_ #define _CREATE_ATSC_EQUALIZER_H_ +#include <atsc_api.h> + class atsci_equalizer; -atsci_equalizer *create_atsci_equalizer_nop (); -atsci_equalizer *create_atsci_equalizer_lms (); -atsci_equalizer *create_atsci_equalizer_lms2 (); +ATSC_API atsci_equalizer *create_atsci_equalizer_nop (); +ATSC_API atsci_equalizer *create_atsci_equalizer_lms (); +ATSC_API atsci_equalizer *create_atsci_equalizer_lms2 (); #endif /* _CREATE_ATSC_EQUALIZER_H_ */ diff --git a/gr-atsc/src/lib/create_atsci_fs_checker.h b/gr-atsc/src/lib/create_atsci_fs_checker.h index d08745052..23451757a 100644 --- a/gr-atsc/src/lib/create_atsci_fs_checker.h +++ b/gr-atsc/src/lib/create_atsci_fs_checker.h @@ -23,12 +23,14 @@ #ifndef _CREATE_ATSC_FS_CHECKER_H_ #define _CREATE_ATSC_FS_CHECKER_H_ +#include <atsc_api.h> + class atsci_fs_checker; /*! * Factory that creates appropriate atsci_fs_checker */ -atsci_fs_checker *create_atsci_fs_checker (); +ATSC_API atsci_fs_checker *create_atsci_fs_checker (); #endif /* _CREATE_ATSC_FS_CHECKER_H_ */ diff --git a/gr-atsc/src/lib/create_atsci_fs_correlator.h b/gr-atsc/src/lib/create_atsci_fs_correlator.h index 9162be888..7b663fd56 100644 --- a/gr-atsc/src/lib/create_atsci_fs_correlator.h +++ b/gr-atsc/src/lib/create_atsci_fs_correlator.h @@ -23,12 +23,14 @@ #ifndef _CREATE_ATSC_FS_CORRELATOR_H_ #define _CREATE_ATSC_FS_CORRELATOR_H_ +#include <atsc_api.h> + class atsci_fs_correlator; /*! * Factory that creates appropriate atsci_fs_correlator */ -atsci_fs_correlator *create_atsci_fs_correlator (); +ATSC_API atsci_fs_correlator *create_atsci_fs_correlator (); #endif /* _CREATE_ATSC_FS_CORRELATOR_H_ */ diff --git a/gr-atsc/src/lib/interleaver_fifo.h b/gr-atsc/src/lib/interleaver_fifo.h index 98764af49..6d1a44580 100644 --- a/gr-atsc/src/lib/interleaver_fifo.h +++ b/gr-atsc/src/lib/interleaver_fifo.h @@ -26,7 +26,6 @@ #include <interleaver_fifo.h> #include <string.h> -#include <strings.h> /*! * \brief template class for interleaver fifo diff --git a/gr-atsc/src/lib/qa_atsci_fake_single_viterbi.cc b/gr-atsc/src/lib/qa_atsci_fake_single_viterbi.cc index f50f3b6b8..1f5ba6b59 100644 --- a/gr-atsc/src/lib/qa_atsci_fake_single_viterbi.cc +++ b/gr-atsc/src/lib/qa_atsci_fake_single_viterbi.cc @@ -70,7 +70,7 @@ qa_atsci_fake_single_viterbi::noise () void qa_atsci_fake_single_viterbi::t0 () { - int blocklen = NN; + static const int blocklen = NN; unsigned char in[blocklen]; unsigned char enc[blocklen]; unsigned char out[blocklen]; diff --git a/gr-atsc/src/lib/qa_atsci_single_viterbi.cc b/gr-atsc/src/lib/qa_atsci_single_viterbi.cc index d7c29097e..dac1e94c3 100644 --- a/gr-atsc/src/lib/qa_atsci_single_viterbi.cc +++ b/gr-atsc/src/lib/qa_atsci_single_viterbi.cc @@ -67,7 +67,7 @@ qa_atsci_single_viterbi::noise () void qa_atsci_single_viterbi::t0 () { - int blocklen = NN; + static const int blocklen = NN; unsigned char in[blocklen]; unsigned char enc[blocklen]; unsigned char out[blocklen]; @@ -142,7 +142,7 @@ qa_atsci_single_viterbi::t0 () void qa_atsci_single_viterbi::t1 () { - int blocklen = NN; + static const int blocklen = NN; unsigned char in[blocklen]; unsigned char enc[blocklen]; unsigned char out[blocklen]; diff --git a/gr-atsc/src/python/CMakeLists.txt b/gr-atsc/src/python/CMakeLists.txt new file mode 100644 index 000000000..a8394d3da --- /dev/null +++ b/gr-atsc/src/python/CMakeLists.txt @@ -0,0 +1,58 @@ +# Copyright 2011 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio 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 General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. + +######################################################################## +# Install python examples +######################################################################## +INCLUDE(GrPython) + +GR_PYTHON_INSTALL( + PROGRAMS + btl-fsd.py + fpll.py + interp.py + xlate.py + viterbi-out.py + DESTINATION ${GR_PKG_DATA_DIR}/examples/atsc + COMPONENT "atsc_examples" +) + +INSTALL( + FILES README + DESTINATION ${GR_PKG_DATA_DIR}/examples/atsc + COMPONENT "atsc_examples" +) + +######################################################################## +# Handle the unit tests +######################################################################## +IF(ENABLE_TESTING) +INCLUDE(GrTest) +FILE(GLOB py_qa_test_files "qa_*.py") +FOREACH(py_qa_test_file ${py_qa_test_files}) + GET_FILENAME_COMPONENT(py_qa_test_name ${py_qa_test_file} NAME_WE) + SET(GR_TEST_PYTHON_DIRS + ${CMAKE_BINARY_DIR}/gnuradio-core/src/python + ${CMAKE_BINARY_DIR}/gnuradio-core/src/lib/swig + ${CMAKE_BINARY_DIR}/gr-atsc/src/lib + ) + SET(GR_TEST_TARGET_DEPS gruel gnuradio-core gnuradio-atsc) + GR_ADD_TEST(${py_qa_test_name} ${PYTHON_EXECUTABLE} ${py_qa_test_file}) +ENDFOREACH(py_qa_test_file) +ENDIF(ENABLE_TESTING) diff --git a/gr-audio/CMakeLists.txt b/gr-audio/CMakeLists.txt new file mode 100644 index 000000000..c78a9cc38 --- /dev/null +++ b/gr-audio/CMakeLists.txt @@ -0,0 +1,101 @@ +# Copyright 2011 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio 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 General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. + +######################################################################## +# Setup dependencies +######################################################################## +INCLUDE(GrBoost) + +######################################################################## +# Register component +######################################################################## +INCLUDE(GrComponent) +GR_REGISTER_COMPONENT("gr-audio" ENABLE_GR_AUDIO + Boost_FOUND + ENABLE_GR_CORE_ +) + +GR_SET_GLOBAL(GR_AUDIO_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/include) + +######################################################################## +# Begin conditional configuration +######################################################################## +IF(ENABLE_GR_AUDIO) + +######################################################################## +# Setup CPack components +######################################################################## +INCLUDE(GrPackage) +CPACK_SET(CPACK_COMPONENT_GROUP_AUDIO_DESCRIPTION "GNU Radio Audio Blocks") + +CPACK_COMPONENT("audio_runtime" + GROUP "Audio" + DISPLAY_NAME "Runtime" + DESCRIPTION "Runtime" + DEPENDS "core_runtime" +) + +CPACK_COMPONENT("audio_devel" + GROUP "Audio" + DISPLAY_NAME "Development" + DESCRIPTION "C++ headers, package config, import libraries" + DEPENDS "core_devel" +) + +CPACK_COMPONENT("audio_python" + GROUP "Audio" + DISPLAY_NAME "Python" + DESCRIPTION "Python modules for runtime; GRC xml files" + DEPENDS "core_python;audio_runtime" +) + +CPACK_COMPONENT("audio_swig" + GROUP "Audio" + DISPLAY_NAME "SWIG" + DESCRIPTION "SWIG development .i files" + DEPENDS "core_swig;audio_python;audio_devel" +) + +######################################################################## +# Add subdirectories +######################################################################## +ADD_SUBDIRECTORY(include) +ADD_SUBDIRECTORY(lib) +ADD_SUBDIRECTORY(examples/c++) +IF(ENABLE_PYTHON) + ADD_SUBDIRECTORY(swig) + ADD_SUBDIRECTORY(grc) + ADD_SUBDIRECTORY(examples/python) +ENDIF(ENABLE_PYTHON) + +######################################################################## +# Create Pkg Config File +######################################################################## +CONFIGURE_FILE( + ${CMAKE_CURRENT_SOURCE_DIR}/gnuradio-audio.pc.in + ${CMAKE_CURRENT_BINARY_DIR}/gnuradio-audio.pc +@ONLY) + +INSTALL( + FILES ${CMAKE_CURRENT_BINARY_DIR}/gnuradio-audio.pc + DESTINATION ${GR_LIBRARY_DIR}/pkgconfig + COMPONENT "audio_devel" +) + +ENDIF(ENABLE_GR_AUDIO) diff --git a/gr-audio/examples/c++/CMakeLists.txt b/gr-audio/examples/c++/CMakeLists.txt new file mode 100644 index 000000000..07b5426de --- /dev/null +++ b/gr-audio/examples/c++/CMakeLists.txt @@ -0,0 +1,23 @@ +# Copyright 2011 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio 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 General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. + +INCLUDE_DIRECTORIES(${GR_AUDIO_INCLUDE_DIRS}) +INCLUDE_DIRECTORIES(${GNURADIO_CORE_INCLUDE_DIRS}) +ADD_EXECUTABLE(dial_tone dial_tone.cc) +TARGET_LINK_LIBRARIES(dial_tone gnuradio-audio) diff --git a/gr-audio/examples/python/CMakeLists.txt b/gr-audio/examples/python/CMakeLists.txt new file mode 100644 index 000000000..c5ca2bba0 --- /dev/null +++ b/gr-audio/examples/python/CMakeLists.txt @@ -0,0 +1,37 @@ +# Copyright 2011 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio 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 General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. + +INCLUDE(GrPython) + +GR_PYTHON_INSTALL(PROGRAMS + audio_copy.py + audio_fft.py + audio_play.py + audio_to_file.py + dial_tone.py + dial_tone_daemon.py + dial_tone_wav.py + mono_tone.py + multi_tone.py + noise.py + spectrum_inversion.py + test_resampler.py + DESTINATION ${GR_PKG_DATA_DIR}/examples/audio + COMPONENT "audio_python" +) diff --git a/gr-audio/grc/CMakeLists.txt b/gr-audio/grc/CMakeLists.txt new file mode 100644 index 000000000..067761fed --- /dev/null +++ b/gr-audio/grc/CMakeLists.txt @@ -0,0 +1,22 @@ +# Copyright 2011 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio 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 General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. + +######################################################################## +FILE(GLOB xml_files "*.xml") +INSTALL(FILES ${xml_files} DESTINATION ${GRC_BLOCKS_DIR} COMPONENT "audio_python") diff --git a/gr-audio/include/CMakeLists.txt b/gr-audio/include/CMakeLists.txt new file mode 100644 index 000000000..9b7ed46c9 --- /dev/null +++ b/gr-audio/include/CMakeLists.txt @@ -0,0 +1,29 @@ +# Copyright 2011 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio 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 General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. + +######################################################################## +# Install header files +######################################################################## +INSTALL(FILES + gr_audio_api.h + gr_audio_source.h + gr_audio_sink.h + DESTINATION ${GR_INCLUDE_DIR}/gnuradio + COMPONENT "audio_devel" +) diff --git a/gr-audio/lib/CMakeLists.txt b/gr-audio/lib/CMakeLists.txt new file mode 100644 index 000000000..cc81ef123 --- /dev/null +++ b/gr-audio/lib/CMakeLists.txt @@ -0,0 +1,159 @@ +# Copyright 2011 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio 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 General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. + +######################################################################## +# Setup the include and linker paths +######################################################################## +INCLUDE_DIRECTORIES( + ${GNURADIO_CORE_INCLUDE_DIRS} + ${GR_AUDIO_INCLUDE_DIRS} + ${CMAKE_CURRENT_SOURCE_DIR} +) + +INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIRS}) +LINK_DIRECTORIES(${Boost_LIBRARY_DIRS}) + +LIST(APPEND gr_audio_libs gnuradio-core ${Boost_LIBRARIES}) +LIST(APPEND gr_audio_sources gr_audio_registry.cc) +LIST(APPEND gr_audio_confs ${CMAKE_CURRENT_SOURCE_DIR}/gr-audio.conf) + +######################################################################## +## ALSA Support +######################################################################## +FIND_PACKAGE(ALSA) + +IF(ALSA_FOUND) + + INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/alsa ${ALSA_INCLUDE_DIRS}) + LIST(APPEND gr_audio_libs ${ALSA_LIBRARIES}) + LIST(APPEND gr_audio_sources + ${CMAKE_CURRENT_SOURCE_DIR}/alsa/gri_alsa.cc + ${CMAKE_CURRENT_SOURCE_DIR}/alsa/audio_alsa_source.cc + ${CMAKE_CURRENT_SOURCE_DIR}/alsa/audio_alsa_sink.cc + ) + LIST(APPEND gr_audio_confs ${CMAKE_CURRENT_SOURCE_DIR}/alsa/gr-audio-alsa.conf) + +ENDIF(ALSA_FOUND) + +######################################################################## +## OSS Support +######################################################################## +FIND_PACKAGE(OSS) + +IF(OSS_FOUND) + + INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/oss ${OSS_INCLUDE_DIRS}) + LIST(APPEND gr_audio_sources + ${CMAKE_CURRENT_SOURCE_DIR}/oss/audio_oss_source.cc + ${CMAKE_CURRENT_SOURCE_DIR}/oss/audio_oss_sink.cc + ) + LIST(APPEND gr_audio_confs ${CMAKE_CURRENT_SOURCE_DIR}/oss/gr-audio-oss.conf) + +ENDIF(OSS_FOUND) + + +######################################################################## +## Jack Support +######################################################################## +FIND_PACKAGE(Jack) + +IF(JACK_FOUND) + + INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/jack ${JACK_INCLUDE_DIRS}) + LIST(APPEND gr_audio_libs ${JACK_LIBRARIES}) + ADD_DEFINITIONS(${JACK_DEFINITIONS}) + LIST(APPEND gr_audio_sources + ${CMAKE_CURRENT_SOURCE_DIR}/jack/gri_jack.cc + ${CMAKE_CURRENT_SOURCE_DIR}/jack/audio_jack_source.cc + ${CMAKE_CURRENT_SOURCE_DIR}/jack/audio_jack_sink.cc + ) + LIST(APPEND gr_audio_confs ${CMAKE_CURRENT_SOURCE_DIR}/jack/gr-audio-jack.conf) + +ENDIF(JACK_FOUND) + +######################################################################## +## OSX Support +######################################################################## +INCLUDE(CheckIncludeFileCXX) +CHECK_INCLUDE_FILE_CXX(AudioUnit/AudioUnit.h AUDIO_UNIT_H) +CHECK_INCLUDE_FILE_CXX(AudioToolbox/AudioToolbox.h AUDIO_TOOLBOX_H) + +IF(AUDIO_UNIT_H AND AUDIO_TOOLBOX_H) + + INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/osx) + LIST(APPEND gr_audio_libs + "-framework AudioUnit" + "-framework CoreAudio" + "-framework AudioToolbox" + ) + LIST(APPEND gr_audio_sources + ${CMAKE_CURRENT_SOURCE_DIR}/osx/audio_osx_source.cc + ${CMAKE_CURRENT_SOURCE_DIR}/osx/audio_osx_sink.cc + ) + +ENDIF(AUDIO_UNIT_H AND AUDIO_TOOLBOX_H) + +######################################################################## +## PortAudio Support +######################################################################## +FIND_PACKAGE(Portaudio) + +IF(PORTAUDIO_FOUND) + + INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/portaudio ${PORTAUDIO_INCLUDE_DIRS}) + LIST(APPEND gr_audio_libs ${PORTAUDIO_LIBRARIES}) + ADD_DEFINITIONS(${PORTAUDIO_DEFINITIONS}) + LIST(APPEND gr_audio_sources + ${CMAKE_CURRENT_SOURCE_DIR}/portaudio/gri_portaudio.cc + ${CMAKE_CURRENT_SOURCE_DIR}/portaudio/audio_portaudio_source.cc + ${CMAKE_CURRENT_SOURCE_DIR}/portaudio/audio_portaudio_sink.cc + ) + LIST(APPEND gr_audio_confs ${CMAKE_CURRENT_SOURCE_DIR}/portaudio/gr-audio-portaudio.conf) + +ENDIF(PORTAUDIO_FOUND) + +######################################################################## +## Windows Support +######################################################################## +IF(WIN32) + + INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/windows) + LIST(APPEND gr_audio_libs winmm.lib) + LIST(APPEND gr_audio_sources + ${CMAKE_CURRENT_SOURCE_DIR}/windows/audio_windows_source.cc + ${CMAKE_CURRENT_SOURCE_DIR}/windows/audio_windows_sink.cc + ) + +ENDIF(WIN32) + +######################################################################## +# Setup library +######################################################################## +ADD_LIBRARY(gnuradio-audio SHARED ${gr_audio_sources}) +TARGET_LINK_LIBRARIES(gnuradio-audio ${gr_audio_libs}) +SET_TARGET_PROPERTIES(gnuradio-audio PROPERTIES DEFINE_SYMBOL "gnuradio_audio_EXPORTS") +SET_TARGET_PROPERTIES(gnuradio-audio PROPERTIES SOVERSION ${LIBVER}) + +INSTALL(TARGETS gnuradio-audio + LIBRARY DESTINATION ${GR_LIBRARY_DIR} COMPONENT "audio_runtime" # .so/.dylib file + ARCHIVE DESTINATION ${GR_LIBRARY_DIR} COMPONENT "audio_devel" # .lib file + RUNTIME DESTINATION ${GR_RUNTIME_DIR} COMPONENT "audio_runtime" # .dll file +) + +INSTALL(FILES ${gr_audio_confs} DESTINATION ${GR_PKG_CONF_DIR} COMPONENT "audio_runtime") diff --git a/gr-audio/lib/alsa/audio_alsa_source.cc b/gr-audio/lib/alsa/audio_alsa_source.cc index 4f0042b22..2f4506f71 100644 --- a/gr-audio/lib/alsa/audio_alsa_source.cc +++ b/gr-audio/lib/alsa/audio_alsa_source.cc @@ -217,8 +217,14 @@ audio_alsa_source::check_topology (int ninputs, int noutputs) unsigned int nchan = noutputs; int err; - // FIXME check_topology may be called more than once. + // Check the state of the stream // Ensure that the pcm is in a state where we can still mess with the hw_params + snd_pcm_state_t state; + state=snd_pcm_state(d_pcm_handle); + if ( state== SND_PCM_STATE_RUNNING) + return true; // If stream is running, don't change any parameters + else if(state == SND_PCM_STATE_XRUN ) + snd_pcm_prepare ( d_pcm_handle ); // Prepare stream on underrun, and we can set parameters; bool special_case = nchan == 1 && d_special_case_stereo_to_mono; if (special_case) diff --git a/gr-audio/swig/CMakeLists.txt b/gr-audio/swig/CMakeLists.txt new file mode 100644 index 000000000..a113239e9 --- /dev/null +++ b/gr-audio/swig/CMakeLists.txt @@ -0,0 +1,51 @@ +# Copyright 2011 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio 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 General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. + +######################################################################## +# Setup swig generation +######################################################################## +INCLUDE(GrPython) +INCLUDE(GrSwig) + +SET(GR_SWIG_INCLUDE_DIRS + ${GR_AUDIO_INCLUDE_DIRS} + ${GNURADIO_CORE_SWIG_INCLUDE_DIRS} +) + +SET(GR_SWIG_LIBRARIES gnuradio-audio) + +GR_SWIG_MAKE(audio_swig audio_swig.i) + +GR_SWIG_INSTALL( + TARGETS audio_swig + DESTINATION ${GR_PYTHON_DIR}/gnuradio/audio + COMPONENT "audio_python" +) + +INSTALL( + FILES audio_swig.i + DESTINATION ${GR_INCLUDE_DIR}/gnuradio/swig + COMPONENT "audio_swig" +) + +GR_PYTHON_INSTALL( + FILES __init__.py + DESTINATION ${GR_PYTHON_DIR}/gnuradio/audio + COMPONENT "audio_python" +) diff --git a/gr-comedi/CMakeLists.txt b/gr-comedi/CMakeLists.txt new file mode 100644 index 000000000..16a930b49 --- /dev/null +++ b/gr-comedi/CMakeLists.txt @@ -0,0 +1,104 @@ +# Copyright 2011 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio 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 General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. + +######################################################################## +# Setup dependencies +######################################################################## +INCLUDE(GrBoost) + +INCLUDE(FindPkgConfig) + +PKG_CHECK_MODULES(COMEDI comedilib) + +######################################################################## +# Register component +######################################################################## +INCLUDE(GrComponent) +GR_REGISTER_COMPONENT("gr-comedi" ENABLE_GR_COMEDI + COMEDI_FOUND + LINUX #comedi uses linux specific device noces + Boost_FOUND + ENABLE_GR_CORE_ +) + +REMOVE_DEFINITIONS(-fvisibility=hidden) #FIXME until we do symbol visibility + +GR_SET_GLOBAL(GR_COMEDI_INCLUDE_DIRS + ${CMAKE_CURRENT_SOURCE_DIR}/src +) + +######################################################################## +# Begin conditional configuration +######################################################################## +IF(ENABLE_GR_COMEDI) + +######################################################################## +# Setup CPack components +######################################################################## +INCLUDE(GrPackage) +CPACK_SET(CPACK_COMPONENT_GROUP_COMEDI_DESCRIPTION "GNU Radio Comedi Blocks") + +CPACK_COMPONENT("comedi_runtime" + GROUP "Comedi" + DISPLAY_NAME "Runtime" + DESCRIPTION "Runtime" + DEPENDS "core_runtime" +) + +CPACK_COMPONENT("comedi_devel" + GROUP "Comedi" + DISPLAY_NAME "Development" + DESCRIPTION "C++ headers, package config, import libraries" + DEPENDS "core_devel" +) + +CPACK_COMPONENT("comedi_python" + GROUP "Comedi" + DISPLAY_NAME "Python" + DESCRIPTION "Python modules for runtime; GRC xml files" + DEPENDS "core_python;comedi_runtime" +) + +CPACK_COMPONENT("comedi_swig" + GROUP "Comedi" + DISPLAY_NAME "SWIG" + DESCRIPTION "SWIG development .i files" + DEPENDS "core_swig;comedi_python;comedi_devel" +) + +######################################################################## +# Add subdirectories +######################################################################## +ADD_SUBDIRECTORY(src) + +######################################################################## +# Create Pkg Config File +######################################################################## +CONFIGURE_FILE( + ${CMAKE_CURRENT_SOURCE_DIR}/gnuradio-comedi.pc.in + ${CMAKE_CURRENT_BINARY_DIR}/gnuradio-comedi.pc +@ONLY) + +INSTALL( + FILES ${CMAKE_CURRENT_BINARY_DIR}/gnuradio-comedi.pc + DESTINATION ${GR_LIBRARY_DIR}/pkgconfig + COMPONENT "comedi_devel" +) + +ENDIF(ENABLE_GR_COMEDI) diff --git a/gr-comedi/src/CMakeLists.txt b/gr-comedi/src/CMakeLists.txt new file mode 100644 index 000000000..af1fc372c --- /dev/null +++ b/gr-comedi/src/CMakeLists.txt @@ -0,0 +1,116 @@ +# Copyright 2011 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio 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 General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. + +######################################################################## +# Setup the include and linker paths +######################################################################## +INCLUDE_DIRECTORIES( + ${GNURADIO_CORE_INCLUDE_DIRS} + ${GR_COMEDI_INCLUDE_DIRS} +) + +INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIRS}) +LINK_DIRECTORIES(${Boost_LIBRARY_DIRS}) + +INCLUDE_DIRECTORIES(${COMEDI_INCLUDE_DIRS}) +LINK_DIRECTORIES(${COMEDI_LIBRARY_DIRS}) + +######################################################################## +# Setup library +######################################################################## +LIST(APPEND gr_comedi_sources + comedi_sink_s.cc + comedi_source_s.cc + gri_comedi.cc +) + +LIST(APPEND comedi_libs + gnuradio-core + ${Boost_LIBRARIES} + ${COMEDI_LIBRARIES} +) + +ADD_LIBRARY(gnuradio-comedi SHARED ${gr_comedi_sources}) +TARGET_LINK_LIBRARIES(gnuradio-comedi ${comedi_libs}) +SET_TARGET_PROPERTIES(gnuradio-comedi PROPERTIES DEFINE_SYMBOL "gnuradio_comedi_EXPORTS") +SET_TARGET_PROPERTIES(gnuradio-comedi PROPERTIES SOVERSION ${LIBVER}) + +INSTALL(TARGETS gnuradio-comedi + LIBRARY DESTINATION ${GR_LIBRARY_DIR} COMPONENT "comedi_runtime" # .so/.dylib file + ARCHIVE DESTINATION ${GR_LIBRARY_DIR} COMPONENT "comedi_devel" # .lib file + RUNTIME DESTINATION ${GR_RUNTIME_DIR} COMPONENT "comedi_runtime" # .dll file +) + +######################################################################## +# Install public header files +######################################################################## +INSTALL(FILES + comedi_sink_s.h + comedi_source_s.h + DESTINATION ${GR_INCLUDE_DIR}/gnuradio + COMPONENT "comedi_devel" +) + +######################################################################## +# Setup swig generation +######################################################################## +IF(ENABLE_PYTHON) +INCLUDE(GrPython) +INCLUDE(GrSwig) + +SET(GR_SWIG_INCLUDE_DIRS + ${GR_COMEDI_INCLUDE_DIRS} + ${GNURADIO_CORE_SWIG_INCLUDE_DIRS} +) + +SET(GR_SWIG_LIBRARIES gnuradio-comedi) + +GR_SWIG_MAKE(comedi comedi.i) + +GR_SWIG_INSTALL( + TARGETS comedi + DESTINATION ${GR_PYTHON_DIR}/gnuradio + COMPONENT "comedi_python" +) + +INSTALL( + FILES comedi.i + DESTINATION ${GR_INCLUDE_DIR}/gnuradio/swig + COMPONENT "comedi_swig" +) + +ENDIF(ENABLE_PYTHON) + +######################################################################## +# Handle the unit tests +######################################################################## +IF(ENABLE_TESTING AND ENABLE_PYTHON) +INCLUDE(GrTest) +FILE(GLOB py_qa_test_files "qa_*.py") +FOREACH(py_qa_test_file ${py_qa_test_files}) + GET_FILENAME_COMPONENT(py_qa_test_name ${py_qa_test_file} NAME_WE) + SET(GR_TEST_PYTHON_DIRS + ${CMAKE_BINARY_DIR}/gnuradio-core/src/python + ${CMAKE_BINARY_DIR}/gnuradio-core/src/lib/swig + ${CMAKE_BINARY_DIR}/gr-comedi/src + ) + SET(GR_TEST_TARGET_DEPS gruel gnuradio-core gnuradio-comedi) + GR_ADD_TEST(${py_qa_test_name} ${PYTHON_EXECUTABLE} ${py_qa_test_file}) +ENDFOREACH(py_qa_test_file) +ENDIF(ENABLE_TESTING AND ENABLE_PYTHON) diff --git a/gr-comedi/src/comedi_sink_s.cc b/gr-comedi/src/comedi_sink_s.cc index d4a668758..fc5c14931 100644 --- a/gr-comedi/src/comedi_sink_s.cc +++ b/gr-comedi/src/comedi_sink_s.cc @@ -88,7 +88,7 @@ comedi_sink_s::comedi_sink_s (int sampling_freq, comedi_cmd cmd; int ret; - ret = comedi_get_cmd_generic_timed(d_dev,d_subdevice,&cmd,(unsigned int)(1e9/sampling_freq)); + ret = comedi_get_cmd_generic_timed(d_dev,d_subdevice,&cmd,d_n_chan,(unsigned int)(1e9/sampling_freq)); if(ret<0) bail ("comedi_get_cmd_generic_timed", comedi_errno()); diff --git a/gr-comedi/src/comedi_source_s.cc b/gr-comedi/src/comedi_source_s.cc index a52d04e2a..5d9f2f6b0 100644 --- a/gr-comedi/src/comedi_source_s.cc +++ b/gr-comedi/src/comedi_source_s.cc @@ -85,7 +85,7 @@ comedi_source_s::comedi_source_s (int sampling_freq, comedi_cmd cmd; int ret; - ret = comedi_get_cmd_generic_timed(d_dev,d_subdevice,&cmd,(unsigned int)(1e9/sampling_freq)); + ret = comedi_get_cmd_generic_timed(d_dev,d_subdevice,&cmd,d_n_chan,(unsigned int)(1e9/sampling_freq)); if(ret<0) bail ("comedi_get_cmd_generic_timed", comedi_errno()); diff --git a/gr-cvsd-vocoder/src/lib/Makefile.am b/gr-cvsd-vocoder/src/lib/Makefile.am deleted file mode 100644 index 9c8c96b96..000000000 --- a/gr-cvsd-vocoder/src/lib/Makefile.am +++ /dev/null @@ -1,58 +0,0 @@ -# -# Copyright 2004,2005,2008,2009,2010 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3, or (at your option) -# any later version. -# -# GNU Radio 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 General Public License -# along with GNU Radio; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. -# - -include $(top_srcdir)/Makefile.common -include $(top_srcdir)/Makefile.swig - -AM_CPPFLAGS = $(STD_DEFINES_AND_INCLUDES) $(PYTHON_CPPFLAGS) $(WITH_INCLUDES) - -# These headers get installed in ${prefix}/include/gnuradio -grinclude_HEADERS = \ - cvsd_decode_bs.h \ - cvsd_encode_sb.h - -lib_LTLIBRARIES = libgnuradio-cvsd-vocoder.la - -libgnuradio_cvsd_vocoder_la_SOURCES = \ - cvsd_decode_bs.cc \ - cvsd_encode_sb.cc - -libgnuradio_cvsd_vocoder_la_LIBADD = \ - $(GNURADIO_CORE_LA) - -libgnuradio_cvsd_vocoder_la_LDFLAGS = $(NO_UNDEFINED) $(LTVERSIONFLAGS) - -################################### -# SWIG interface and library - -TOP_SWIG_IFILES = \ - cvsd_vocoder.i - -# Install so that they end up available as: -# import gnuradio.vocoder.cvsd_vocoder -# This ends up at: -# ${prefix}/lib/python${python_version}/site-packages/gnuradio/vocoder -cvsd_vocoder_pythondir_category = \ - gnuradio/vocoder - -# additional libraries for linking with the SWIG-generated library -cvsd_vocoder_la_swig_libadd = \ - libgnuradio-cvsd-vocoder.la diff --git a/gr-cvsd-vocoder/src/lib/cvsd_vocoder.i b/gr-cvsd-vocoder/src/lib/cvsd_vocoder.i deleted file mode 100644 index 82662e84e..000000000 --- a/gr-cvsd-vocoder/src/lib/cvsd_vocoder.i +++ /dev/null @@ -1,91 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2007,2009 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio 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 General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -%include "gnuradio.i" - -%{ -#include "cvsd_encode_sb.h" -#include "cvsd_decode_bs.h" -%} - -GR_SWIG_BLOCK_MAGIC(cvsd,encode_sb); - -cvsd_encode_sb_sptr cvsd_make_encode_sb (short min_step=10, - short max_step=1280, - double step_decay=0.9990234375, - double accum_decay= 0.96875, - int K=32, - int J=4, - short pos_accum_max=32767, - short neg_accum_max=-32767); - -class cvsd_encode_sb : public gr_sync_decimator -{ -private: - cvsd_encode_sb (short min_step, short max_step, double step_decay, - double accum_decay, int K, int J, - short pos_accum_max, short neg_accum_max); - - - public: - short min_step() { return d_min_step; } - short max_step() { return d_max_step; } - double step_decay() { return d_step_decay; } - double accum_decay() { return d_accum_decay; } - int K() { return d_K; } - int J() { return d_J; } - short pos_accum_max() { return d_pos_accum_max; } - short neg_accum_max() { return d_neg_accum_max; } -}; - -// ---------------------------------------------------------------- - -GR_SWIG_BLOCK_MAGIC(cvsd,decode_bs); - -cvsd_decode_bs_sptr cvsd_make_decode_bs (short min_step=10, - short max_step=1280, - double step_decay=0.9990234375, - double accum_decay= 0.96875, - int K=32, - int J=4, - short pos_accum_max=32767, - short neg_accum_max=-32767); - -class cvsd_decode_bs : public gr_sync_interpolator -{ -private: - cvsd_decode_bs (short min_step, short max_step, double step_decay, - double accum_decay, int K, int J, - short pos_accum_max, short neg_accum_max); - - public: -}; - -#if SWIGGUILE -%scheme %{ -(load-extension-global "libguile-gnuradio-cvsd_vocoder" "scm_init_gnuradio_cvsd_vocoder_module") -%} - -%goops %{ -(use-modules (gnuradio gnuradio_core_runtime)) -%} -#endif diff --git a/gr-digital/CMakeLists.txt b/gr-digital/CMakeLists.txt new file mode 100644 index 000000000..bd11be4d3 --- /dev/null +++ b/gr-digital/CMakeLists.txt @@ -0,0 +1,108 @@ +# Copyright 2011 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio 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 General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. + +######################################################################## +# Setup dependencies +######################################################################## +INCLUDE(GrBoost) + +######################################################################## +# Register component +######################################################################## +INCLUDE(GrComponent) +GR_REGISTER_COMPONENT("gr-digital" ENABLE_GR_DIGITAL + Boost_FOUND + ENABLE_GR_CORE_ +) + +GR_SET_GLOBAL(GR_DIGITAL_INCLUDE_DIRS + ${CMAKE_CURRENT_SOURCE_DIR}/lib + ${CMAKE_CURRENT_SOURCE_DIR}/hier +) + +GR_SET_GLOBAL(GR_DIGITAL_SWIG_INCLUDE_DIRS + ${CMAKE_CURRENT_SOURCE_DIR}/swig +) + +######################################################################## +# Begin conditional configuration +######################################################################## +IF(ENABLE_GR_DIGITAL) + +######################################################################## +# Setup CPack components +######################################################################## +INCLUDE(GrPackage) +CPACK_SET(CPACK_COMPONENT_GROUP_DIGITAL_DESCRIPTION "GNU Radio Digital Blocks") + +CPACK_COMPONENT("digital_runtime" + GROUP "Digital" + DISPLAY_NAME "Runtime" + DESCRIPTION "Dynamic link libraries" + DEPENDS "core_runtime" +) + +CPACK_COMPONENT("digital_devel" + GROUP "Digital" + DISPLAY_NAME "Development" + DESCRIPTION "C++ headers, package config, import libraries" + DEPENDS "core_devel" +) + +CPACK_COMPONENT("digital_python" + GROUP "Digital" + DISPLAY_NAME "Python" + DESCRIPTION "Python modules for runtime" + DEPENDS "core_python;digital_runtime" +) + +CPACK_COMPONENT("digital_swig" + GROUP "Digital" + DISPLAY_NAME "SWIG" + DESCRIPTION "SWIG development .i files" + DEPENDS "core_swig;digital_python;digital_devel" +) + +######################################################################## +# Add subdirectories +######################################################################## +GR_INCLUDE_SUBDIRECTORY(hier) #appends to lib sources +ADD_SUBDIRECTORY(lib) +IF(ENABLE_PYTHON) + ADD_SUBDIRECTORY(swig) + ADD_SUBDIRECTORY(python) + ADD_SUBDIRECTORY(grc) + ADD_SUBDIRECTORY(examples) +ENDIF(ENABLE_PYTHON) + +######################################################################## +# Create Pkg Config File +######################################################################## +CONFIGURE_FILE( + ${CMAKE_CURRENT_SOURCE_DIR}/gnuradio-digital.pc.in + ${CMAKE_CURRENT_BINARY_DIR}/gnuradio-digital.pc +@ONLY) + +INSTALL( + FILES ${CMAKE_CURRENT_BINARY_DIR}/gnuradio-digital.pc + DESTINATION ${GR_LIBRARY_DIR}/pkgconfig + COMPONENT "digital_devel" +) + +ENDIF(ENABLE_GR_DIGITAL) diff --git a/gr-digital/examples/CMakeLists.txt b/gr-digital/examples/CMakeLists.txt new file mode 100644 index 000000000..f494d0f1e --- /dev/null +++ b/gr-digital/examples/CMakeLists.txt @@ -0,0 +1,33 @@ +# Copyright 2011 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio 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 General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. + +INCLUDE(GrPython) + +GR_PYTHON_INSTALL(PROGRAMS + transmit_path.py + receive_path.py + benchmark_tx.py + benchmark_rx.py + tx_voice.py + rx_voice.py + run_length.py + gen_whitener.py + DESTINATION ${GR_PKG_DATA_DIR}/examples/digital + COMPONENT "digital_python" +) diff --git a/gr-digital/grc/CMakeLists.txt b/gr-digital/grc/CMakeLists.txt new file mode 100644 index 000000000..89c6db6e2 --- /dev/null +++ b/gr-digital/grc/CMakeLists.txt @@ -0,0 +1,40 @@ +# Copyright 2011 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio 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 General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. + +INSTALL(FILES + digital_block_tree.xml + digital_binary_slicer_fb.xml + digital_clock_recovery_mm_xx.xml + digital_constellation_decoder_cb.xml + digital_correlate_access_code_bb.xml + digital_costas_loop_cc.xml + digital_cma_equalizer_cc.xml + digital_fll_band_edge_cc.xml + digital_kurtotic_equalizer_cc.xml + digital_lms_dd_equalizer_cc.xml + digital_mpsk_receiver_cc.xml + digital_dxpsk_mod.xml + digital_dxpsk_demod.xml + digital_psk_mod.xml + digital_psk_demod.xml + digital_qam_mod.xml + digital_qam_demod.xml + DESTINATION ${GRC_BLOCKS_DIR} + COMPONENT "digital_python" +) diff --git a/gr-digital/hier/CMakeLists.txt b/gr-digital/hier/CMakeLists.txt new file mode 100644 index 000000000..f46acc81e --- /dev/null +++ b/gr-digital/hier/CMakeLists.txt @@ -0,0 +1,43 @@ +# Copyright 2011 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio 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 General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. + +######################################################################## +# This file included, use CMake directory variables +######################################################################## + +LIST(APPEND gr_digital_sources + ${CMAKE_CURRENT_SOURCE_DIR}/digital_gmskmod_bc.cc + ${CMAKE_CURRENT_SOURCE_DIR}/digital_cpmmod_bc.cc +) + +INSTALL(FILES + ${CMAKE_CURRENT_SOURCE_DIR}/digital_gmskmod_bc.h + ${CMAKE_CURRENT_SOURCE_DIR}/digital_cpmmod_bc.h + DESTINATION ${GR_INCLUDE_DIR}/gnuradio + COMPONENT "digital_devel" +) + +INSTALL( + FILES + ${CMAKE_CURRENT_SOURCE_DIR}/_digital_hier.i + ${CMAKE_CURRENT_SOURCE_DIR}/digital_gmskmod_bc.i + ${CMAKE_CURRENT_SOURCE_DIR}/digital_cpmmod_bc.i + DESTINATION ${GR_INCLUDE_DIR}/gnuradio/swig + COMPONENT "digital_swig" +) diff --git a/gr-digital/hier/digital_cpmmod_bc.h b/gr-digital/hier/digital_cpmmod_bc.h index 6212fc777..4e9547cd6 100644 --- a/gr-digital/hier/digital_cpmmod_bc.h +++ b/gr-digital/hier/digital_cpmmod_bc.h @@ -23,6 +23,7 @@ #ifndef INCLUDED_DIGITAL_CPMMOD_BC_H #define INCLUDED_DIGITAL_CPMMOD_BC_H +#include <digital_api.h> #include <gr_hier_block2.h> #include <gr_char_to_float.h> #include <gr_interp_fir_filter_fff.h> @@ -34,7 +35,7 @@ class digital_cpmmod_bc; typedef boost::shared_ptr<digital_cpmmod_bc> digital_cpmmod_bc_sptr; -digital_cpmmod_bc_sptr +DIGITAL_API digital_cpmmod_bc_sptr digital_make_cpmmod_bc(int type, float h, unsigned samples_per_sym, unsigned L, double beta=0.3); @@ -70,9 +71,9 @@ digital_make_cpmmod_bc(int type, float h, * The modulator will silently accept any other inputs, though. * The output is the phase-modulated signal. */ -class digital_cpmmod_bc : public gr_hier_block2 +class DIGITAL_API digital_cpmmod_bc : public gr_hier_block2 { - friend digital_cpmmod_bc_sptr digital_make_cpmmod_bc(int type, float h, + friend DIGITAL_API digital_cpmmod_bc_sptr digital_make_cpmmod_bc(int type, float h, unsigned samples_per_sym, unsigned L, double beta); diff --git a/gr-digital/hier/digital_gmskmod_bc.h b/gr-digital/hier/digital_gmskmod_bc.h index 92b53cd4b..33fcc6c12 100644 --- a/gr-digital/hier/digital_gmskmod_bc.h +++ b/gr-digital/hier/digital_gmskmod_bc.h @@ -23,13 +23,14 @@ #ifndef INCLUDED_DIGITAL_GMSKMOD_BC_H #define INCLUDED_DIGITAL_GMSKMOD_BC_H +#include <digital_api.h> #include <digital_cpmmod_bc.h> class digital_gmskmod_bc; typedef boost::shared_ptr<digital_gmskmod_bc> digital_gmskmod_bc_sptr; -digital_gmskmod_bc_sptr +DIGITAL_API digital_gmskmod_bc_sptr digital_make_gmskmod_bc(unsigned samples_per_sym=2, double bt=0.3, unsigned L=4); @@ -49,9 +50,9 @@ digital_make_gmskmod_bc(unsigned samples_per_sym=2, * The modulator will silently accept any other inputs, though. * The output is the phase-modulated signal. */ -class digital_gmskmod_bc : public digital_cpmmod_bc +class DIGITAL_API digital_gmskmod_bc : public digital_cpmmod_bc { - friend digital_gmskmod_bc_sptr digital_make_gmskmod_bc(unsigned samples_per_sym, + friend DIGITAL_API digital_gmskmod_bc_sptr digital_make_gmskmod_bc(unsigned samples_per_sym, double bt, unsigned L); digital_gmskmod_bc(unsigned samples_per_sym, double bt, unsigned L); diff --git a/gr-digital/lib/CMakeLists.txt b/gr-digital/lib/CMakeLists.txt new file mode 100644 index 000000000..30e1e3a40 --- /dev/null +++ b/gr-digital/lib/CMakeLists.txt @@ -0,0 +1,89 @@ +# Copyright 2011 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio 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 General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. + +######################################################################## +# Setup the include and linker paths +######################################################################## +INCLUDE_DIRECTORIES( + ${GNURADIO_CORE_INCLUDE_DIRS} + ${GR_DIGITAL_INCLUDE_DIRS} +) + +INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIRS}) +LINK_DIRECTORIES(${Boost_LIBRARY_DIRS}) + +######################################################################## +# Setup library +######################################################################## +LIST(APPEND gr_digital_sources + digital_binary_slicer_fb.cc + digital_clock_recovery_mm_cc.cc + digital_clock_recovery_mm_ff.cc + digital_constellation.cc + digital_constellation_receiver_cb.cc + digital_constellation_decoder_cb.cc + digital_correlate_access_code_bb.cc + digital_costas_loop_cc.cc + digital_cma_equalizer_cc.cc + digital_crc32.cc + digital_fll_band_edge_cc.cc + digital_lms_dd_equalizer_cc.cc + digital_kurtotic_equalizer_cc.cc + digital_mpsk_receiver_cc.cc +) + +LIST(APPEND digital_libs + gnuradio-core + ${Boost_LIBRARIES} +) + +ADD_LIBRARY(gnuradio-digital SHARED ${gr_digital_sources}) +TARGET_LINK_LIBRARIES(gnuradio-digital ${digital_libs}) +SET_TARGET_PROPERTIES(gnuradio-digital PROPERTIES DEFINE_SYMBOL "gnuradio_digital_EXPORTS") +SET_TARGET_PROPERTIES(gnuradio-digital PROPERTIES SOVERSION ${LIBVER}) + +INSTALL(TARGETS gnuradio-digital + LIBRARY DESTINATION ${GR_LIBRARY_DIR} COMPONENT "digital_runtime" # .so/.dylib file + ARCHIVE DESTINATION ${GR_LIBRARY_DIR} COMPONENT "digital_devel" # .lib file + RUNTIME DESTINATION ${GR_RUNTIME_DIR} COMPONENT "digital_runtime" # .dll file +) + +######################################################################## +# Install header files +######################################################################## +INSTALL(FILES + digital_api.h + digital_binary_slicer_fb.h + digital_clock_recovery_mm_cc.h + digital_clock_recovery_mm_ff.h + digital_constellation.h + digital_constellation_receiver_cb.h + digital_constellation_decoder_cb.h + digital_correlate_access_code_bb.h + digital_costas_loop_cc.h + digital_cma_equalizer_cc.h + digital_crc32.h + digital_fll_band_edge_cc.h + digital_lms_dd_equalizer_cc.h + digital_kurtotic_equalizer_cc.h + digital_metric_type.h + digital_mpsk_receiver_cc.h + DESTINATION ${GR_INCLUDE_DIR}/gnuradio + COMPONENT "digital_devel" +) diff --git a/gr-digital/lib/Makefile.am b/gr-digital/lib/Makefile.am index 60db19821..ce961ef2e 100644 --- a/gr-digital/lib/Makefile.am +++ b/gr-digital/lib/Makefile.am @@ -25,6 +25,7 @@ AM_CPPFLAGS = $(STD_DEFINES_AND_INCLUDES) $(PYTHON_CPPFLAGS) $(WITH_INCLUDES) # These headers get installed in ${prefix}/include/gnuradio grinclude_HEADERS = \ + digital_api.h \ digital_binary_slicer_fb.h \ digital_clock_recovery_mm_cc.h \ digital_clock_recovery_mm_ff.h \ diff --git a/gr-digital/lib/digital_api.h b/gr-digital/lib/digital_api.h new file mode 100644 index 000000000..d45ace13f --- /dev/null +++ b/gr-digital/lib/digital_api.h @@ -0,0 +1,33 @@ +/* + * Copyright 2011 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio 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 General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifndef INCLUDED_DIGITAL_API_H +#define INCLUDED_DIGITAL_API_H + +#include <gruel/attributes.h> + +#ifdef gnuradio_digital_EXPORTS +# define DIGITAL_API __GR_ATTR_EXPORT +#else +# define DIGITAL_API __GR_ATTR_IMPORT +#endif + +#endif /* INCLUDED_DIGITAL_API_H */ diff --git a/gr-digital/lib/digital_binary_slicer_fb.h b/gr-digital/lib/digital_binary_slicer_fb.h index 2d10484db..9da776012 100644 --- a/gr-digital/lib/digital_binary_slicer_fb.h +++ b/gr-digital/lib/digital_binary_slicer_fb.h @@ -23,12 +23,13 @@ #ifndef INCLUDED_DIGITAL_BINARY_SLICER_FB_H #define INCLUDED_DIGITAL_BINARY_SLICER_FB_H +#include <digital_api.h> #include <gr_sync_block.h> class digital_binary_slicer_fb; typedef boost::shared_ptr<digital_binary_slicer_fb> digital_binary_slicer_fb_sptr; -digital_binary_slicer_fb_sptr digital_make_binary_slicer_fb (); +DIGITAL_API digital_binary_slicer_fb_sptr digital_make_binary_slicer_fb (); /*! * \brief slice float binary symbol outputting 1 bit output @@ -37,9 +38,9 @@ digital_binary_slicer_fb_sptr digital_make_binary_slicer_fb (); * x < 0 --> 0 * x >= 0 --> 1 */ -class digital_binary_slicer_fb : public gr_sync_block +class DIGITAL_API digital_binary_slicer_fb : public gr_sync_block { - friend digital_binary_slicer_fb_sptr digital_make_binary_slicer_fb (); + friend DIGITAL_API digital_binary_slicer_fb_sptr digital_make_binary_slicer_fb (); digital_binary_slicer_fb (); public: diff --git a/gr-digital/lib/digital_clock_recovery_mm_cc.h b/gr-digital/lib/digital_clock_recovery_mm_cc.h index 422bf811c..e45b79229 100644 --- a/gr-digital/lib/digital_clock_recovery_mm_cc.h +++ b/gr-digital/lib/digital_clock_recovery_mm_cc.h @@ -23,6 +23,7 @@ #ifndef INCLUDED_DIGITAL_CLOCK_RECOVERY_MM_CC_H #define INCLUDED_DIGITAL_CLOCK_RECOVERY_MM_CC_H +#include <digital_api.h> #include <gr_block.h> #include <gr_complex.h> #include <gr_math.h> @@ -33,7 +34,7 @@ class digital_clock_recovery_mm_cc; typedef boost::shared_ptr<digital_clock_recovery_mm_cc> digital_clock_recovery_mm_cc_sptr; // public constructor -digital_clock_recovery_mm_cc_sptr +DIGITAL_API digital_clock_recovery_mm_cc_sptr digital_make_clock_recovery_mm_cc (float omega, float gain_omega, float mu, float gain_mu, float omega_relative_limit=0.001); @@ -49,7 +50,7 @@ digital_make_clock_recovery_mm_cc (float omega, float gain_omega, * G. R. Danesfahani, T.G. Jeans, "Optimisation of modified Mueller and Muller * algorithm," Electronics Letters, Vol. 31, no. 13, 22 June 1995, pp. 1032 - 1033. */ -class digital_clock_recovery_mm_cc : public gr_block +class DIGITAL_API digital_clock_recovery_mm_cc : public gr_block { public: ~digital_clock_recovery_mm_cc (); @@ -103,7 +104,7 @@ protected: gr_complex slicer_0deg (gr_complex sample); gr_complex slicer_45deg (gr_complex sample); - friend digital_clock_recovery_mm_cc_sptr + friend DIGITAL_API digital_clock_recovery_mm_cc_sptr digital_make_clock_recovery_mm_cc (float omega, float gain_omega, float mu, float gain_mu, float omega_relative_limit); diff --git a/gr-digital/lib/digital_clock_recovery_mm_ff.h b/gr-digital/lib/digital_clock_recovery_mm_ff.h index 6fc5ac261..6f88a4dcd 100644 --- a/gr-digital/lib/digital_clock_recovery_mm_ff.h +++ b/gr-digital/lib/digital_clock_recovery_mm_ff.h @@ -23,6 +23,7 @@ #ifndef INCLUDED_DIGITAL_CLOCK_RECOVERY_MM_FF_H #define INCLUDED_DIGITAL_CLOCK_RECOVERY_MM_FF_H +#include <digital_api.h> #include <gr_block.h> #include <gr_math.h> #include <stdio.h> @@ -33,7 +34,7 @@ class digital_clock_recovery_mm_ff; typedef boost::shared_ptr<digital_clock_recovery_mm_ff> digital_clock_recovery_mm_ff_sptr; // public constructor -digital_clock_recovery_mm_ff_sptr +DIGITAL_API digital_clock_recovery_mm_ff_sptr digital_make_clock_recovery_mm_ff (float omega, float gain_omega, float mu, float gain_mu, float omega_relative_limit=0.001); @@ -48,7 +49,7 @@ digital_make_clock_recovery_mm_ff (float omega, float gain_omega, * Estimation and Signal Processing" by Heinrich Meyr, Marc Moeneclaey, & Stefan Fechtel. * ISBN 0-471-50275-8. */ -class digital_clock_recovery_mm_ff : public gr_block +class DIGITAL_API digital_clock_recovery_mm_ff : public gr_block { public: ~digital_clock_recovery_mm_ff (); @@ -89,7 +90,7 @@ protected: FILE *d_logfile; float d_omega_relative_limit; // used to compute min and max omega - friend digital_clock_recovery_mm_ff_sptr + friend DIGITAL_API digital_clock_recovery_mm_ff_sptr digital_make_clock_recovery_mm_ff (float omega, float gain_omega, float mu, float gain_mu, float omega_relative_limit); diff --git a/gr-digital/lib/digital_cma_equalizer_cc.h b/gr-digital/lib/digital_cma_equalizer_cc.h index 0dd99debd..69e2f657a 100644 --- a/gr-digital/lib/digital_cma_equalizer_cc.h +++ b/gr-digital/lib/digital_cma_equalizer_cc.h @@ -23,6 +23,7 @@ #ifndef INCLUDED_DIGITAL_CMA_EQUALIZER_CC_H #define INCLUDED_DIGITAL_CMA_EQUALIZER_CC_H +#include <digital_api.h> #include <gr_adaptive_fir_ccc.h> #include <gr_math.h> #include <iostream> @@ -30,7 +31,7 @@ class digital_cma_equalizer_cc; typedef boost::shared_ptr<digital_cma_equalizer_cc> digital_cma_equalizer_cc_sptr; -digital_cma_equalizer_cc_sptr +DIGITAL_API digital_cma_equalizer_cc_sptr digital_make_cma_equalizer_cc(int num_taps, float modulus, float mu, int sps); /*! @@ -43,13 +44,13 @@ digital_make_cma_equalizer_cc(int num_taps, float modulus, float mu, int sps); * Two-Dimensional Data Communication Systems," IEEE Transactions on * Communications, Vol. 28, No. 11, pp. 1867 - 1875, 1980, */ -class digital_cma_equalizer_cc : public gr_adaptive_fir_ccc +class DIGITAL_API digital_cma_equalizer_cc : public gr_adaptive_fir_ccc { private: float d_modulus; float d_mu; - friend digital_cma_equalizer_cc_sptr digital_make_cma_equalizer_cc(int num_taps, + friend DIGITAL_API digital_cma_equalizer_cc_sptr digital_make_cma_equalizer_cc(int num_taps, float modulus, float mu, int sps); diff --git a/gr-digital/lib/digital_constellation.cc b/gr-digital/lib/digital_constellation.cc index 3dfc70273..0c100f38e 100644 --- a/gr-digital/lib/digital_constellation.cc +++ b/gr-digital/lib/digital_constellation.cc @@ -20,6 +20,10 @@ * Boston, MA 02110-1301, USA. */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include <gr_io_signature.h> #include <digital_constellation.h> #include <digital_metric_type.h> diff --git a/gr-digital/lib/digital_constellation.h b/gr-digital/lib/digital_constellation.h index 3e54e7d96..9b2a58588 100644 --- a/gr-digital/lib/digital_constellation.h +++ b/gr-digital/lib/digital_constellation.h @@ -23,6 +23,7 @@ #ifndef INCLUDED_DIGITAL_CONSTELLATION_H #define INCLUDED_DIGITAL_CONSTELLATION_H +#include <digital_api.h> #include <vector> #include <math.h> #include <gr_complex.h> @@ -38,7 +39,7 @@ class digital_constellation; typedef boost::shared_ptr<digital_constellation> digital_constellation_sptr; -class digital_constellation : public boost::enable_shared_from_this<digital_constellation> +class DIGITAL_API digital_constellation : public boost::enable_shared_from_this<digital_constellation> { public: digital_constellation (std::vector<gr_complex> constellation, @@ -122,14 +123,14 @@ class digital_constellation_calcdist; typedef boost::shared_ptr<digital_constellation_calcdist> digital_constellation_calcdist_sptr; // public constructor -digital_constellation_calcdist_sptr +DIGITAL_API digital_constellation_calcdist_sptr digital_make_constellation_calcdist (std::vector<gr_complex> constellation, std::vector<unsigned int> pre_diff_code, unsigned int rotational_symmetry, unsigned int dimensionality); -class digital_constellation_calcdist : public digital_constellation +class DIGITAL_API digital_constellation_calcdist : public digital_constellation { public: digital_constellation_calcdist (std::vector<gr_complex> constellation, @@ -142,7 +143,7 @@ class digital_constellation_calcdist : public digital_constellation // void calc_hard_symbol_metric(gr_complex *sample, float *metric); private: - friend digital_constellation_calcdist_sptr + friend DIGITAL_API digital_constellation_calcdist_sptr digital_make_constellation_calcdist (std::vector<gr_complex> constellation); }; @@ -155,7 +156,7 @@ class digital_constellation_calcdist : public digital_constellation /* point. */ /************************************************************/ -class digital_constellation_sector : public digital_constellation +class DIGITAL_API digital_constellation_sector : public digital_constellation { public: @@ -198,7 +199,7 @@ class digital_constellation_rect; typedef boost::shared_ptr<digital_constellation_rect> digital_constellation_rect_sptr; // public constructor -digital_constellation_rect_sptr +DIGITAL_API digital_constellation_rect_sptr digital_make_constellation_rect (std::vector<gr_complex> constellation, std::vector<unsigned int> pre_diff_code, unsigned int rotational_symmetry, @@ -207,7 +208,7 @@ digital_make_constellation_rect (std::vector<gr_complex> constellation, float width_real_sectors, float width_imag_sectors); -class digital_constellation_rect : public digital_constellation_sector +class DIGITAL_API digital_constellation_rect : public digital_constellation_sector { public: @@ -232,7 +233,7 @@ class digital_constellation_rect : public digital_constellation_sector float d_width_real_sectors; float d_width_imag_sectors; - friend digital_constellation_rect_sptr + friend DIGITAL_API digital_constellation_rect_sptr digital_make_constellation_rect (std::vector<gr_complex> constellation, std::vector<unsigned int> pre_diff_code, unsigned int rotational_symmetry, @@ -257,12 +258,12 @@ class digital_constellation_psk; typedef boost::shared_ptr<digital_constellation_psk> digital_constellation_psk_sptr; // public constructor -digital_constellation_psk_sptr +DIGITAL_API digital_constellation_psk_sptr digital_make_constellation_psk (std::vector<gr_complex> constellation, std::vector<unsigned int> pre_diff_code, unsigned int n_sectors); -class digital_constellation_psk : public digital_constellation_sector +class DIGITAL_API digital_constellation_psk : public digital_constellation_sector { public: @@ -278,7 +279,7 @@ class digital_constellation_psk : public digital_constellation_sector private: - friend digital_constellation_psk_sptr + friend DIGITAL_API digital_constellation_psk_sptr digital_make_constellation_psk (std::vector<gr_complex> constellation, std::vector<unsigned int> pre_diff_code, unsigned int n_sectors); @@ -296,17 +297,17 @@ class digital_constellation_bpsk; typedef boost::shared_ptr<digital_constellation_bpsk> digital_constellation_bpsk_sptr; // public constructor -digital_constellation_bpsk_sptr +DIGITAL_API digital_constellation_bpsk_sptr digital_make_constellation_bpsk (); -class digital_constellation_bpsk : public digital_constellation +class DIGITAL_API digital_constellation_bpsk : public digital_constellation { public: digital_constellation_bpsk (); unsigned int decision_maker (const gr_complex *sample); - friend digital_constellation_bpsk_sptr + friend DIGITAL_API digital_constellation_bpsk_sptr digital_make_constellation_bpsk (); }; @@ -322,17 +323,17 @@ class digital_constellation_qpsk; typedef boost::shared_ptr<digital_constellation_qpsk> digital_constellation_qpsk_sptr; // public constructor -digital_constellation_qpsk_sptr +DIGITAL_API digital_constellation_qpsk_sptr digital_make_constellation_qpsk (); -class digital_constellation_qpsk : public digital_constellation +class DIGITAL_API digital_constellation_qpsk : public digital_constellation { public: digital_constellation_qpsk (); unsigned int decision_maker (const gr_complex *sample); - friend digital_constellation_qpsk_sptr + friend DIGITAL_API digital_constellation_qpsk_sptr digital_make_constellation_qpsk (); }; @@ -349,17 +350,17 @@ class digital_constellation_dqpsk; typedef boost::shared_ptr<digital_constellation_dqpsk> digital_constellation_dqpsk_sptr; // public constructor -digital_constellation_dqpsk_sptr +DIGITAL_API digital_constellation_dqpsk_sptr digital_make_constellation_dqpsk (); -class digital_constellation_dqpsk : public digital_constellation +class DIGITAL_API digital_constellation_dqpsk : public digital_constellation { public: digital_constellation_dqpsk (); unsigned int decision_maker (const gr_complex *sample); - friend digital_constellation_dqpsk_sptr + friend DIGITAL_API digital_constellation_dqpsk_sptr digital_make_constellation_dqpsk (); }; @@ -376,17 +377,17 @@ class digital_constellation_8psk; typedef boost::shared_ptr<digital_constellation_8psk> digital_constellation_8psk_sptr; // public constructor -digital_constellation_8psk_sptr +DIGITAL_API digital_constellation_8psk_sptr digital_make_constellation_8psk (); -class digital_constellation_8psk : public digital_constellation +class DIGITAL_API digital_constellation_8psk : public digital_constellation { public: digital_constellation_8psk (); unsigned int decision_maker (const gr_complex *sample); - friend digital_constellation_8psk_sptr + friend DIGITAL_API digital_constellation_8psk_sptr digital_make_constellation_8psk (); }; diff --git a/gr-digital/lib/digital_constellation_decoder_cb.h b/gr-digital/lib/digital_constellation_decoder_cb.h index 022456733..1ce01fe12 100644 --- a/gr-digital/lib/digital_constellation_decoder_cb.h +++ b/gr-digital/lib/digital_constellation_decoder_cb.h @@ -23,6 +23,7 @@ #ifndef INCLUDED_DIGITAL_CONSTELLATION_DECODER_CB_H #define INCLUDED_DIGITAL_CONSTELLATION_DECODER_CB_H +#include <digital_api.h> #include <gr_block.h> #include <digital_constellation.h> #include <vector> @@ -30,7 +31,7 @@ class digital_constellation_decoder_cb; typedef boost::shared_ptr<digital_constellation_decoder_cb>digital_constellation_decoder_cb_sptr; -digital_constellation_decoder_cb_sptr +DIGITAL_API digital_constellation_decoder_cb_sptr digital_make_constellation_decoder_cb (digital_constellation_sptr constellation); /*! @@ -38,14 +39,14 @@ digital_make_constellation_decoder_cb (digital_constellation_sptr constellation) * \ingroup coding_blk * */ -class digital_constellation_decoder_cb : public gr_block +class DIGITAL_API digital_constellation_decoder_cb : public gr_block { private: digital_constellation_sptr d_constellation; unsigned int d_dim; - friend digital_constellation_decoder_cb_sptr + friend DIGITAL_API digital_constellation_decoder_cb_sptr digital_make_constellation_decoder_cb (digital_constellation_sptr constellation); digital_constellation_decoder_cb (digital_constellation_sptr constellation); diff --git a/gr-digital/lib/digital_constellation_receiver_cb.h b/gr-digital/lib/digital_constellation_receiver_cb.h index 0ac80450f..d33be8958 100644 --- a/gr-digital/lib/digital_constellation_receiver_cb.h +++ b/gr-digital/lib/digital_constellation_receiver_cb.h @@ -23,6 +23,7 @@ #ifndef INCLUDED_DIGITAL_CONSTELLATION_RECEIVER_CB_H #define INCLUDED_DIGITAL_CONSTELLATION_RECEIVER_CB_H +#include <digital_api.h> #include <gr_block.h> #include <digital_constellation.h> #include <gri_control_loop.h> @@ -34,7 +35,7 @@ class digital_constellation_receiver_cb; typedef boost::shared_ptr<digital_constellation_receiver_cb> digital_constellation_receiver_cb_sptr; // public constructor -digital_constellation_receiver_cb_sptr +DIGITAL_API digital_constellation_receiver_cb_sptr digital_make_constellation_receiver_cb (digital_constellation_sptr constellation, float loop_bw, float fmin, float fmax); @@ -64,7 +65,7 @@ digital_make_constellation_receiver_cb (digital_constellation_sptr constellation * */ -class digital_constellation_receiver_cb : public gr_block, public gri_control_loop +class DIGITAL_API digital_constellation_receiver_cb : public gr_block, public gri_control_loop { public: int general_work (int noutput_items, @@ -106,7 +107,7 @@ private: //! index to delay line unsigned int d_dl_idx; - friend digital_constellation_receiver_cb_sptr + friend DIGITAL_API digital_constellation_receiver_cb_sptr digital_make_constellation_receiver_cb (digital_constellation_sptr constell, float loop_bw, float fmin, float fmax); }; diff --git a/gr-digital/lib/digital_correlate_access_code_bb.h b/gr-digital/lib/digital_correlate_access_code_bb.h index 2607ae84c..c4cb60428 100644 --- a/gr-digital/lib/digital_correlate_access_code_bb.h +++ b/gr-digital/lib/digital_correlate_access_code_bb.h @@ -23,6 +23,7 @@ #ifndef INCLUDED_DIGITAL_CORRELATE_ACCESS_CODE_BB_H #define INCLUDED_DIGITAL_CORRELATE_ACCESS_CODE_BB_H +#include <digital_api.h> #include <gr_sync_block.h> #include <string> @@ -33,7 +34,7 @@ typedef boost::shared_ptr<digital_correlate_access_code_bb> digital_correlate_ac * \param access_code is represented with 1 byte per bit, e.g., "010101010111000100" * \param threshold maximum number of bits that may be wrong */ -digital_correlate_access_code_bb_sptr +DIGITAL_API digital_correlate_access_code_bb_sptr digital_make_correlate_access_code_bb (const std::string &access_code, int threshold); /*! @@ -49,9 +50,9 @@ digital_make_correlate_access_code_bb (const std::string &access_code, int thres * flag bit and is 1 if the corresponding data bit is the first data * bit following the access code. Otherwise the flag bit is 0. */ -class digital_correlate_access_code_bb : public gr_sync_block +class DIGITAL_API digital_correlate_access_code_bb : public gr_sync_block { - friend digital_correlate_access_code_bb_sptr + friend DIGITAL_API digital_correlate_access_code_bb_sptr digital_make_correlate_access_code_bb (const std::string &access_code, int threshold); private: unsigned long long d_access_code; // access code to locate start of packet diff --git a/gr-digital/lib/digital_costas_loop_cc.h b/gr-digital/lib/digital_costas_loop_cc.h index 7b2cd6dad..c78726341 100644 --- a/gr-digital/lib/digital_costas_loop_cc.h +++ b/gr-digital/lib/digital_costas_loop_cc.h @@ -54,11 +54,14 @@ * \param min_freq the minimum frequency deviation (radians/sample) the loop can handle * \param order the loop order, either 2 or 4 */ + +#include <digital_api.h> + class digital_costas_loop_cc; typedef boost::shared_ptr<digital_costas_loop_cc> digital_costas_loop_cc_sptr; -digital_costas_loop_cc_sptr +DIGITAL_API digital_costas_loop_cc_sptr digital_make_costas_loop_cc (float loop_bw, int order ) throw (std::invalid_argument); @@ -73,9 +76,9 @@ digital_make_costas_loop_cc (float loop_bw, int order * * \p order must be 2 or 4. */ -class digital_costas_loop_cc : public gr_sync_block, public gri_control_loop +class DIGITAL_API digital_costas_loop_cc : public gr_sync_block, public gri_control_loop { - friend digital_costas_loop_cc_sptr + friend DIGITAL_API digital_costas_loop_cc_sptr digital_make_costas_loop_cc (float loop_bw, int order ) throw (std::invalid_argument); diff --git a/gr-digital/lib/digital_crc32.h b/gr-digital/lib/digital_crc32.h index 64aa12f7b..852d06f49 100644 --- a/gr-digital/lib/digital_crc32.h +++ b/gr-digital/lib/digital_crc32.h @@ -23,6 +23,7 @@ #ifndef INCLUDED_DIGITAL_CRC32_H #define INCLUDED_DIGITAL_CRC32_H +#include <digital_api.h> #include <string> #include <gr_types.h> @@ -35,16 +36,16 @@ * complement of the final running CRC. The resulting CRC should be * transmitted in big endian order. */ -unsigned int +DIGITAL_API unsigned int digital_update_crc32(unsigned int crc, const unsigned char *buf, size_t len); -unsigned int +DIGITAL_API unsigned int digital_update_crc32(unsigned int crc, const std::string buf); -unsigned int +DIGITAL_API unsigned int digital_crc32(const unsigned char *buf, size_t len); -unsigned int +DIGITAL_API unsigned int digital_crc32(const std::string buf); #endif /* INCLUDED_CRC32_H */ diff --git a/gr-digital/lib/digital_fll_band_edge_cc.h b/gr-digital/lib/digital_fll_band_edge_cc.h index 4fa7b3a3e..6ef8376ac 100644 --- a/gr-digital/lib/digital_fll_band_edge_cc.h +++ b/gr-digital/lib/digital_fll_band_edge_cc.h @@ -24,12 +24,13 @@ #ifndef INCLUDED_DIGITAL_FLL_BAND_EDGE_CC_H #define INCLUDED_DIGITAL_FLL_BAND_EDGE_CC_H +#include <digital_api.h> #include <gr_sync_block.h> #include <gri_control_loop.h> class digital_fll_band_edge_cc; typedef boost::shared_ptr<digital_fll_band_edge_cc> digital_fll_band_edge_cc_sptr; -digital_fll_band_edge_cc_sptr digital_make_fll_band_edge_cc (float samps_per_sym, +DIGITAL_API digital_fll_band_edge_cc_sptr digital_make_fll_band_edge_cc (float samps_per_sym, float rolloff, int filter_size, float bandwidth); @@ -84,7 +85,7 @@ digital_fll_band_edge_cc_sptr digital_make_fll_band_edge_cc (float samps_per_sym * */ -class digital_fll_band_edge_cc : public gr_sync_block, public gri_control_loop +class DIGITAL_API digital_fll_band_edge_cc : public gr_sync_block, public gri_control_loop { private: /*! @@ -94,7 +95,7 @@ class digital_fll_band_edge_cc : public gr_sync_block, public gri_control_loop * \param filter_size (int) Size (in taps) of the filter * \param bandwidth (float) Loop bandwidth */ - friend digital_fll_band_edge_cc_sptr digital_make_fll_band_edge_cc (float samps_per_sym, + friend DIGITAL_API digital_fll_band_edge_cc_sptr digital_make_fll_band_edge_cc (float samps_per_sym, float rolloff, int filter_size, float bandwidth); diff --git a/gr-digital/lib/digital_kurtotic_equalizer_cc.h b/gr-digital/lib/digital_kurtotic_equalizer_cc.h index e01cbd6e6..c07862e11 100644 --- a/gr-digital/lib/digital_kurtotic_equalizer_cc.h +++ b/gr-digital/lib/digital_kurtotic_equalizer_cc.h @@ -23,6 +23,7 @@ #ifndef INCLUDED_DIGITAL_KURTOTIC_EQUALIZER_CC_H #define INCLUDED_DIGITAL_KURTOTIC_EQUALIZER_CC_H +#include <digital_api.h> #include <gr_adaptive_fir_ccc.h> #include <gr_math.h> #include <iostream> @@ -30,7 +31,7 @@ class digital_kurtotic_equalizer_cc; typedef boost::shared_ptr<digital_kurtotic_equalizer_cc> digital_kurtotic_equalizer_cc_sptr; -digital_kurtotic_equalizer_cc_sptr +DIGITAL_API digital_kurtotic_equalizer_cc_sptr digital_make_kurtotic_equalizer_cc(int num_taps, float mu); /*! @@ -41,7 +42,7 @@ digital_make_kurtotic_equalizer_cc(int num_taps, float mu); * equalization algorithm," IEEE Conf. on Control, Automation, * Robotics and Vision, Vol. 3, Dec. 2004, pp. 2052 - 2057. */ -class digital_kurtotic_equalizer_cc : public gr_adaptive_fir_ccc +class DIGITAL_API digital_kurtotic_equalizer_cc : public gr_adaptive_fir_ccc { private: float d_mu; @@ -49,7 +50,7 @@ private: gr_complex d_q, d_u; float d_alpha_p, d_alpha_q, d_alpha_m; - friend digital_kurtotic_equalizer_cc_sptr digital_make_kurtotic_equalizer_cc(int num_taps, + friend DIGITAL_API digital_kurtotic_equalizer_cc_sptr digital_make_kurtotic_equalizer_cc(int num_taps, float mu); digital_kurtotic_equalizer_cc(int num_taps, float mu); diff --git a/gr-digital/lib/digital_lms_dd_equalizer_cc.h b/gr-digital/lib/digital_lms_dd_equalizer_cc.h index e3ad4bf4a..edfa18e23 100644 --- a/gr-digital/lib/digital_lms_dd_equalizer_cc.h +++ b/gr-digital/lib/digital_lms_dd_equalizer_cc.h @@ -23,13 +23,14 @@ #ifndef INCLUDED_DIGITAL_LMS_DD_EQUALIZER_CC_H #define INCLUDED_DIGITAL_LMS_DD_EQUALIZER_CC_H +#include <digital_api.h> #include <gr_adaptive_fir_ccc.h> #include <digital_constellation.h> class digital_lms_dd_equalizer_cc; typedef boost::shared_ptr<digital_lms_dd_equalizer_cc> digital_lms_dd_equalizer_cc_sptr; -digital_lms_dd_equalizer_cc_sptr digital_make_lms_dd_equalizer_cc (int num_taps, +DIGITAL_API digital_lms_dd_equalizer_cc_sptr digital_make_lms_dd_equalizer_cc (int num_taps, float mu, int sps, digital_constellation_sptr cnst); @@ -65,10 +66,10 @@ digital_lms_dd_equalizer_cc_sptr digital_make_lms_dd_equalizer_cc (int num_taps, * Prentice Hall, 1996. * */ -class digital_lms_dd_equalizer_cc : public gr_adaptive_fir_ccc +class DIGITAL_API digital_lms_dd_equalizer_cc : public gr_adaptive_fir_ccc { private: - friend digital_lms_dd_equalizer_cc_sptr digital_make_lms_dd_equalizer_cc (int num_taps, + friend DIGITAL_API digital_lms_dd_equalizer_cc_sptr digital_make_lms_dd_equalizer_cc (int num_taps, float mu, int sps, digital_constellation_sptr cnst); diff --git a/gr-digital/lib/digital_mpsk_receiver_cc.h b/gr-digital/lib/digital_mpsk_receiver_cc.h index f8aa4e341..85cd81e99 100644 --- a/gr-digital/lib/digital_mpsk_receiver_cc.h +++ b/gr-digital/lib/digital_mpsk_receiver_cc.h @@ -23,6 +23,7 @@ #ifndef INCLUDED_DIGITAL_MPSK_RECEIVER_CC_H #define INCLUDED_DIGITAL_MPSK_RECEIVER_CC_H +#include <digital_api.h> #include <gruel/attributes.h> #include <gri_control_loop.h> #include <gr_block.h> @@ -35,7 +36,7 @@ class digital_mpsk_receiver_cc; typedef boost::shared_ptr<digital_mpsk_receiver_cc> digital_mpsk_receiver_cc_sptr; // public constructor -digital_mpsk_receiver_cc_sptr +DIGITAL_API digital_mpsk_receiver_cc_sptr digital_make_mpsk_receiver_cc (unsigned int M, float theta, float loop_bw, float fmin, float fmax, @@ -78,7 +79,7 @@ digital_make_mpsk_receiver_cc (unsigned int M, float theta, * */ -class digital_mpsk_receiver_cc : public gr_block, public gri_control_loop +class DIGITAL_API digital_mpsk_receiver_cc : public gr_block, public gri_control_loop { public: ~digital_mpsk_receiver_cc (); @@ -290,7 +291,7 @@ private: //! index to delay line unsigned int d_dl_idx; - friend digital_mpsk_receiver_cc_sptr + friend DIGITAL_API digital_mpsk_receiver_cc_sptr digital_make_mpsk_receiver_cc (unsigned int M, float theta, float loop_bw, float fmin, float fmax, diff --git a/gr-digital/python/CMakeLists.txt b/gr-digital/python/CMakeLists.txt new file mode 100644 index 000000000..2d09a4945 --- /dev/null +++ b/gr-digital/python/CMakeLists.txt @@ -0,0 +1,72 @@ +# Copyright 2011 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio 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 General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. + +######################################################################## +# Setup python install +######################################################################## +INCLUDE(GrPython) + +GR_PYTHON_INSTALL( + FILES + __init__.py + bpsk.py + cpm.py + crc.py + generic_mod_demod.py + gmsk.py + modulation_utils.py + modulation_utils2.py + packet_utils.py + pkt.py + psk.py + psk2.py + qam.py + qpsk.py + DESTINATION ${GR_PYTHON_DIR}/gnuradio/digital + COMPONENT "digital_python" +) + +GR_PYTHON_INSTALL( + FILES + utils/__init__.py + utils/gray_code.py + utils/mod_codes.py + utils/alignment.py + DESTINATION ${GR_PYTHON_DIR}/gnuradio/digital/utils + COMPONENT "digital_python" +) + +######################################################################## +# Handle the unit tests +######################################################################## +IF(ENABLE_TESTING) +INCLUDE(GrTest) +FILE(GLOB py_qa_test_files "qa_*.py") +FOREACH(py_qa_test_file ${py_qa_test_files}) + GET_FILENAME_COMPONENT(py_qa_test_name ${py_qa_test_file} NAME_WE) + SET(GR_TEST_PYTHON_DIRS + ${CMAKE_BINARY_DIR}/gnuradio-core/src/python + ${CMAKE_BINARY_DIR}/gnuradio-core/src/lib/swig + ${CMAKE_BINARY_DIR}/gr-digital/python + ${CMAKE_BINARY_DIR}/gr-digital/swig + ) + SET(GR_TEST_TARGET_DEPS gruel gnuradio-core gnuradio-digital) + GR_ADD_TEST(${py_qa_test_name} ${PYTHON_EXECUTABLE} ${py_qa_test_file}) +ENDFOREACH(py_qa_test_file) +ENDIF(ENABLE_TESTING) diff --git a/gr-digital/python/ofdm.py b/gr-digital/python/ofdm.py new file mode 100644 index 000000000..e05f074f4 --- /dev/null +++ b/gr-digital/python/ofdm.py @@ -0,0 +1,295 @@ +#!/usr/bin/env python +# +# Copyright 2006,2007,2008 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio 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 General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. +# + +import math +from gnuradio import gr, ofdm_packet_utils, modulation_utils2 +import gnuradio.gr.gr_threading as _threading +import psk, qam + +from gnuradio.blks2impl.ofdm_receiver import ofdm_receiver + +def _add_common_options(normal, expert): + """ + Adds OFDM-specific options to the Options Parser that are common + both to the modulator and demodulator. + """ + mods_list = ", ".join(modulation_utils2.type_1_constellations().keys()) + print dir(modulation_utils2) + print "MODS LIST: ", mods_list + print modulation_utils2.type_1_mods() + normal.add_option("-m", "--modulation", type="string", default="psk", + help="set modulation type (" + mods_list + ") [default=%default]") + normal.add_option("-c", "--constellation-points", type="int", default=2, + help="set number of constellation points [default=%default]") + expert.add_option("", "--fft-length", type="intx", default=512, + help="set the number of FFT bins [default=%default]") + expert.add_option("", "--occupied-tones", type="intx", default=200, + help="set the number of occupied FFT bins [default=%default]") + expert.add_option("", "--cp-length", type="intx", default=128, + help="set the number of bits in the cyclic prefix [default=%default]") + +# ///////////////////////////////////////////////////////////////////////////// +# mod/demod with packets as i/o +# ///////////////////////////////////////////////////////////////////////////// + +class ofdm_mod(gr.hier_block2): + """ + Modulates an OFDM stream. Based on the options fft_length, occupied_tones, and + cp_length, this block creates OFDM symbols using a specified modulation option. + + Send packets by calling send_pkt + """ + def __init__(self, options, msgq_limit=2, pad_for_usrp=True): + """ + Hierarchical block for sending packets + + Packets to be sent are enqueued by calling send_pkt. + The output is the complex modulated signal at baseband. + + @param options: pass modulation options from higher layers (fft length, occupied tones, etc.) + @param msgq_limit: maximum number of messages in message queue + @type msgq_limit: int + @param pad_for_usrp: If true, packets are padded such that they end up a multiple of 128 samples + """ + + gr.hier_block2.__init__(self, "ofdm_mod", + gr.io_signature(0, 0, 0), # Input signature + gr.io_signature(1, 1, gr.sizeof_gr_complex)) # Output signature + + self._pad_for_usrp = pad_for_usrp + self._modulation = options.modulation + self._fft_length = options.fft_length + self._occupied_tones = options.occupied_tones + self._cp_length = options.cp_length + + print (options) + arity = options.constellation_points + + win = [] #[1 for i in range(self._fft_length)] + + # Use freq domain to get doubled-up known symbol for correlation in time domain + zeros_on_left = int(math.ceil((self._fft_length - self._occupied_tones)/2.0)) + ksfreq = known_symbols_4512_3[0:self._occupied_tones] + for i in range(len(ksfreq)): + if((zeros_on_left + i) & 1): + ksfreq[i] = 0 + + # hard-coded known symbols + preambles = (ksfreq,) + + padded_preambles = list() + for pre in preambles: + padded = self._fft_length*[0,] + padded[zeros_on_left : zeros_on_left + self._occupied_tones] = pre + padded_preambles.append(padded) + + symbol_length = options.fft_length + options.cp_length + + print modulation_utils2.type_1_constellations + const = modulation_utils2.type_1_constellations()[self._modulation](arity).points() + + self._pkt_input = gr.ofdm_mapper_bcv(const, msgq_limit, + options.occupied_tones, options.fft_length) + + self.preambles = gr.ofdm_insert_preamble(self._fft_length, padded_preambles) + self.ifft = gr.fft_vcc(self._fft_length, False, win, True) + self.cp_adder = gr.ofdm_cyclic_prefixer(self._fft_length, symbol_length) + self.scale = gr.multiply_const_cc(1.0 / math.sqrt(self._fft_length)) + + self.connect((self._pkt_input, 0), (self.preambles, 0)) + self.connect((self._pkt_input, 1), (self.preambles, 1)) + self.connect(self.preambles, self.ifft, self.cp_adder, self.scale, self) + + if options.verbose: + self._print_verbage() + + if options.log: + self.connect(self._pkt_input, gr.file_sink(gr.sizeof_gr_complex*options.fft_length, + "ofdm_mapper_c.dat")) + self.connect(self.preambles, gr.file_sink(gr.sizeof_gr_complex*options.fft_length, + "ofdm_preambles.dat")) + self.connect(self.ifft, gr.file_sink(gr.sizeof_gr_complex*options.fft_length, + "ofdm_ifft_c.dat")) + self.connect(self.cp_adder, gr.file_sink(gr.sizeof_gr_complex, + "ofdm_cp_adder_c.dat")) + + def send_pkt(self, payload='', eof=False): + """ + Send the payload. + + @param payload: data to send + @type payload: string + """ + if eof: + msg = gr.message(1) # tell self._pkt_input we're not sending any more packets + else: + # print "original_payload =", string_to_hex_list(payload) + pkt = ofdm_packet_utils.make_packet(payload, 1, 1, self._pad_for_usrp, whitening=True) + + #print "pkt =", string_to_hex_list(pkt) + msg = gr.message_from_string(pkt) + self._pkt_input.msgq().insert_tail(msg) + + def add_options(normal, expert): + """ + Adds OFDM-specific options to the Options Parser + """ + _add_common_options(normal, expert) + for mod in modulation_utils2.type_1_mods().values(): + mod.add_options(expert) + + # Make a static method to call before instantiation + add_options = staticmethod(add_options) + + def _print_verbage(self): + """ + Prints information about the OFDM modulator + """ + print "\nOFDM Modulator:" + print "Modulation Type: %s" % (self._modulation) + print "FFT length: %3d" % (self._fft_length) + print "Occupied Tones: %3d" % (self._occupied_tones) + print "CP length: %3d" % (self._cp_length) + + +class ofdm_demod(gr.hier_block2): + """ + Demodulates a received OFDM stream. Based on the options fft_length, occupied_tones, and + cp_length, this block performs synchronization, FFT, and demodulation of incoming OFDM + symbols and passes packets up the a higher layer. + + The input is complex baseband. When packets are demodulated, they are passed to the + app via the callback. + """ + + def __init__(self, options, callback=None): + """ + Hierarchical block for demodulating and deframing packets. + + The input is the complex modulated signal at baseband. + Demodulated packets are sent to the handler. + + @param options: pass modulation options from higher layers (fft length, occupied tones, etc.) + @param callback: function of two args: ok, payload + @type callback: ok: bool; payload: string + """ + gr.hier_block2.__init__(self, "ofdm_demod", + gr.io_signature(1, 1, gr.sizeof_gr_complex), # Input signature + gr.io_signature(1, 1, gr.sizeof_gr_complex)) # Output signature + + + self._rcvd_pktq = gr.msg_queue() # holds packets from the PHY + + self._modulation = options.modulation + self._fft_length = options.fft_length + self._occupied_tones = options.occupied_tones + self._cp_length = options.cp_length + self._snr = options.snr + + arity = options.constellation_points + print("con points is %s" % options.constellation_points) + + # Use freq domain to get doubled-up known symbol for correlation in time domain + zeros_on_left = int(math.ceil((self._fft_length - self._occupied_tones)/2.0)) + ksfreq = known_symbols_4512_3[0:self._occupied_tones] + for i in range(len(ksfreq)): + if((zeros_on_left + i) & 1): + ksfreq[i] = 0 + + # hard-coded known symbols + preambles = (ksfreq,) + + symbol_length = self._fft_length + self._cp_length + self.ofdm_recv = ofdm_receiver(self._fft_length, self._cp_length, + self._occupied_tones, self._snr, preambles, + options.log) + + constell = modulation_utils2.type_1_constellations()[self._modulation](arity) + + phgain = 0.25 + frgain = phgain*phgain / 4.0 + self.ofdm_demod = gr.ofdm_frame_sink2(constell.base(), + self._rcvd_pktq, + self._occupied_tones, + phgain, frgain) + + self.connect(self, self.ofdm_recv) + self.connect((self.ofdm_recv, 0), (self.ofdm_demod, 0)) + self.connect((self.ofdm_recv, 1), (self.ofdm_demod, 1)) + + # added output signature to work around bug, though it might not be a bad + # thing to export, anyway + self.connect(self.ofdm_recv.chan_filt, self) + + if options.log: + self.connect(self.ofdm_demod, gr.file_sink(gr.sizeof_gr_complex*self._occupied_tones, "ofdm_frame_sink_c.dat")) + else: + self.connect(self.ofdm_demod, gr.null_sink(gr.sizeof_gr_complex*self._occupied_tones)) + + if options.verbose: + self._print_verbage() + + self._watcher = _queue_watcher_thread(self._rcvd_pktq, callback) + + def add_options(normal, expert): + """ + Adds OFDM-specific options to the Options Parser + """ + _add_common_options(normal, expert) + for mod in modulation_utils2.type_1_mods().values(): + mod.add_options(expert) + # Make a static method to call before instantiation + add_options = staticmethod(add_options) + + def _print_verbage(self): + """ + Prints information about the OFDM demodulator + """ + print "\nOFDM Demodulator:" + print "Modulation Type: %s" % (self._modulation) + print "FFT length: %3d" % (self._fft_length) + print "Occupied Tones: %3d" % (self._occupied_tones) + print "CP length: %3d" % (self._cp_length) + + + +class _queue_watcher_thread(_threading.Thread): + def __init__(self, rcvd_pktq, callback): + _threading.Thread.__init__(self) + self.setDaemon(1) + self.rcvd_pktq = rcvd_pktq + self.callback = callback + self.keep_running = True + self.start() + + + def run(self): + while self.keep_running: + msg = self.rcvd_pktq.delete_head() + ok, payload = ofdm_packet_utils.unmake_packet(msg.to_string()) + if self.callback: + self.callback(ok, payload) + +# Generating known symbols with: +# i = [2*random.randint(0,1)-1 for i in range(4512)] + +known_symbols_4512_3 = [-1, -1, 1, -1, 1, 1, -1, -1, 1, -1, 1, 1, -1, 1, -1, -1, 1, -1, 1, -1, 1, 1, -1, -1, -1, 1, -1, 1, 1, -1, 1, -1, -1, -1, -1, -1, -1, -1, 1, 1, -1, -1, 1, 1, 1, -1, 1, -1, -1, -1, 1, 1, 1, 1, 1, 1, 1, -1, -1, 1, -1, 1, -1, -1, 1, -1, 1, 1, 1, 1, -1, 1, -1, 1, -1, 1, -1, -1, -1, 1, -1, -1, -1, 1, 1, 1, -1, -1, -1, -1, -1, -1, -1, 1, -1, -1, 1, -1, 1, 1, 1, -1, -1, -1, -1, -1, -1, 1, -1, -1, -1, -1, 1, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -1, -1, -1, 1, 1, 1, 1, -1, -1, 1, -1, 1, -1, 1, 1, 1, 1, -1, -1, 1, -1, 1, 1, 1, 1, -1, 1, -1, -1, 1, -1, 1, 1, 1, -1, -1, -1, 1, 1, 1, 1, 1, 1, -1, -1, 1, 1, 1, -1, -1, 1, -1, -1, 1, 1, 1, -1, -1, 1, 1, -1, 1, -1, -1, -1, -1, -1, -1, 1, 1, -1, -1, 1, -1, -1, 1, -1, 1, -1, -1, 1, 1, -1, 1, 1, 1, 1, -1, 1, 1, 1, -1, 1, -1, 1, 1, 1, -1, 1, 1, -1, 1, 1, 1, -1, 1, 1, 1, 1, -1, 1, -1, -1, 1, -1, -1, 1, 1, 1, -1, 1, -1, -1, -1, -1, -1, 1, -1, 1, -1, 1, 1, 1, 1, -1, 1, -1, -1, -1, 1, -1, 1, 1, -1, -1, -1, 1, 1, -1, -1, 1, 1, 1, 1, 1, 1, 1, -1, -1, -1, 1, -1, 1, 1, 1, 1, -1, 1, -1, 1, 1, 1, -1, -1, 1, -1, 1, -1, -1, -1, -1, -1, 1, 1, -1, 1, 1, 1, -1, 1, -1, 1, 1, -1, -1, -1, 1, -1, -1, 1, -1, -1, 1, 1, -1, 1, 1, -1, 1, 1, -1, -1, 1, 1, -1, 1, 1, -1, 1, 1, 1, -1, -1, 1, 1, 1, -1, 1, 1, -1, 1, 1, 1, -1, 1, -1, 1, 1, -1, -1, 1, -1, -1, -1, 1, 1, -1, -1, 1, -1, -1, 1, -1, 1, 1, -1, -1, -1, -1, 1, -1, -1, 1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, -1, -1, -1, 1, -1, 1, 1, 1, 1, 1, 1, 1, -1, -1, 1, -1, 1, -1, -1, 1, -1, 1, 1, -1, 1, -1, 1, 1, -1, 1, -1, -1, -1, 1, 1, -1, 1, 1, 1, 1, -1, 1, -1, -1, -1, 1, -1, -1, 1, 1, 1, -1, 1, -1, 1, 1, -1, -1, -1, -1, 1, -1, 1, -1, -1, -1, 1, 1, -1, -1, 1, -1, -1, 1, 1, -1, -1, 1, -1, -1, 1, -1, -1, -1, 1, -1, 1, -1, 1, 1, 1, 1, 1, 1, -1, -1, 1, -1, 1, -1, -1, -1, -1, -1, 1, 1, -1, 1, 1, 1, 1, -1, 1, 1, 1, -1, -1, 1, 1, 1, -1, 1, 1, 1, 1, 1, -1, 1, -1, -1, -1, -1, -1, -1, 1, 1, -1, -1, 1, -1, 1, 1, 1, 1, -1, 1, -1, 1, -1, -1, 1, -1, -1, -1, -1, 1, 1, -1, 1, 1, 1, -1, -1, 1, 1, 1, -1, -1, -1, -1, 1, -1, 1, -1, 1, -1, -1, -1, -1, -1, -1, 1, 1, -1, 1, 1, 1, 1, 1, -1, -1, -1, 1, 1, 1, 1, 1, 1, 1, 1, -1, 1, 1, 1, 1, 1, 1, -1, 1, -1, 1, -1, -1, -1, 1, 1, -1, 1, 1, 1, -1, 1, -1, -1, 1, 1, 1, 1, -1, 1, 1, 1, 1, 1, 1, -1, -1, -1, 1, 1, 1, -1, 1, 1, -1, -1, -1, -1, 1, 1, 1, -1, 1, 1, -1, 1, 1, -1, -1, -1, -1, -1, -1, -1, 1, 1, 1, 1, -1, -1, 1, -1, -1, 1, 1, -1, -1, -1, -1, -1, -1, 1, 1, -1, -1, 1, 1, -1, 1, -1, -1, -1, -1, 1, -1, 1, -1, 1, 1, 1, -1, 1, 1, -1, -1, 1, 1, 1, 1, -1, -1, 1, -1, -1, -1, 1, -1, -1, -1, 1, 1, -1, -1, -1, 1, -1, 1, -1, 1, 1, -1, 1, -1, 1, 1, 1, -1, 1, 1, 1, -1, -1, 1, -1, -1, -1, -1, 1, 1, 1, 1, 1, -1, 1, -1, -1, 1, 1, -1, 1, -1, 1, -1, -1, 1, -1, -1, -1, 1, 1, -1, -1, 1, 1, 1, -1, 1, 1, -1, -1, -1, -1, -1, -1, -1, -1, 1, -1, -1, 1, 1, -1, -1, 1, -1, 1, 1, 1, -1, -1, 1, 1, -1, 1, -1, -1, -1, 1, -1, -1, -1, 1, 1, -1, 1, -1, 1, 1, -1, 1, -1, -1, 1, 1, 1, -1, -1, -1, 1, 1, -1, 1, 1, 1, 1, -1, 1, 1, -1, -1, 1, 1, 1, -1, 1, 1, 1, -1, 1, 1, 1, 1, 1, -1, 1, 1, -1, 1, 1, -1, -1, 1, 1, -1, 1, -1, -1, 1, -1, 1, 1, 1, 1, -1, -1, -1, 1, 1, -1, -1, -1, -1, -1, 1, -1, -1, 1, 1, -1, -1, 1, 1, -1, -1, 1, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -1, -1, 1, 1, -1, 1, -1, -1, -1, 1, -1, -1, 1, 1, 1, -1, -1, 1, -1, 1, 1, 1, -1, -1, 1, -1, -1, 1, 1, 1, -1, -1, 1, -1, 1, 1, -1, 1, 1, 1, 1, 1, 1, 1, 1, -1, 1, -1, -1, 1, -1, 1, -1, -1, -1, -1, 1, -1, -1, 1, 1, -1, 1, -1, -1, -1, -1, -1, 1, 1, 1, 1, -1, 1, 1, 1, 1, 1, 1, -1, 1, 1, 1, 1, -1, -1, -1, -1, 1, -1, -1, 1, 1, -1, 1, 1, -1, 1, -1, 1, -1, -1, 1, -1, 1, -1, -1, 1, -1, -1, 1, 1, 1, -1, 1, 1, 1, 1, 1, -1, 1, -1, -1, 1, -1, 1, -1, -1, 1, 1, -1, 1, -1, -1, -1, -1, 1, -1, 1, -1, 1, 1, 1, -1, -1, 1, -1, -1, -1, -1, -1, -1, -1, -1, 1, -1, -1, 1, 1, 1, 1, -1, -1, 1, 1, -1, -1, 1, -1, -1, 1, -1, 1, 1, -1, 1, 1, 1, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -1, 1, -1, 1, -1, 1, -1, -1, 1, 1, 1, 1, 1, 1, -1, 1, -1, -1, 1, -1, 1, 1, -1, 1, 1, 1, -1, -1, 1, 1, -1, 1, 1, 1, -1, -1, 1, -1, 1, 1, -1, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, 1, 1, -1, 1, 1, -1, 1, -1, 1, -1, 1, 1, -1, 1, -1, 1, 1, -1, 1, 1, 1, -1, -1, 1, -1, 1, -1, -1, -1, 1, -1, -1, -1, 1, -1, -1, 1, -1, 1, -1, 1, 1, 1, 1, 1, -1, 1, 1, 1, 1, -1, 1, -1, 1, 1, -1, 1, -1, 1, 1, -1, -1, 1, -1, 1, 1, 1, -1, 1, -1, 1, 1, -1, 1, 1, 1, -1, 1, 1, 1, -1, -1, 1, -1, -1, 1, 1, -1, -1, 1, 1, -1, -1, -1, -1, -1, 1, -1, 1, 1, -1, -1, 1, 1, 1, 1, 1, 1, -1, -1, -1, -1, -1, -1, 1, -1, 1, 1, 1, -1, 1, 1, 1, -1, 1, 1, -1, 1, -1, -1, -1, 1, -1, 1, -1, 1, 1, -1, 1, -1, -1, 1, -1, 1, -1, -1, -1, 1, -1, 1, 1, 1, 1, -1, -1, 1, -1, 1, -1, 1, 1, -1, -1, 1, 1, 1, -1, 1, -1, -1, -1, -1, -1, 1, -1, 1, -1, -1, 1, -1, 1, 1, 1, 1, 1, -1, 1, 1, -1, 1, 1, 1, -1, -1, -1, -1, -1, -1, -1, 1, -1, 1, -1, 1, -1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, 1, -1, 1, 1, -1, -1, 1, 1, -1, 1, -1, -1, -1, 1, 1, 1, 1, 1, -1, -1, -1, 1, 1, 1, 1, 1, 1, -1, 1, -1, 1, -1, -1, 1, 1, 1, 1, -1, -1, 1, -1, 1, 1, 1, 1, -1, 1, 1, 1, 1, -1, 1, 1, -1, 1, -1, 1, -1, -1, 1, -1, -1, -1, -1, 1, -1, 1, -1, 1, 1, 1, 1, 1, -1, 1, -1, 1, 1, 1, -1, -1, 1, 1, 1, 1, -1, -1, 1, 1, -1, 1, 1, 1, 1, -1, -1, 1, 1, 1, -1, 1, 1, -1, -1, -1, -1, 1, 1, 1, 1, 1, -1, -1, 1, -1, 1, 1, 1, -1, -1, -1, -1, -1, -1, 1, -1, 1, -1, -1, -1, 1, -1, 1, -1, 1, -1, -1, -1, 1, -1, 1, -1, 1, 1, 1, -1, -1, -1, -1, 1, -1, 1, -1, -1, -1, -1, -1, -1, -1, -1, 1, 1, -1, 1, -1, 1, 1, -1, 1, -1, 1, 1, 1, -1, 1, -1, -1, 1, 1, 1, -1, 1, 1, 1, -1, -1, 1, -1, -1, 1, 1, 1, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, -1, 1, -1, -1, 1, -1, 1, -1, 1, 1, 1, 1, 1, 1, -1, 1, -1, 1, -1, -1, 1, -1, 1, -1, -1, -1, 1, 1, 1, 1, -1, 1, 1, 1, -1, -1, 1, 1, 1, 1, 1, -1, 1, -1, -1, -1, -1, -1, 1, 1, 1, -1, 1, -1, 1, -1, -1, -1, 1, -1, -1, -1, 1, 1, 1, 1, -1, -1, -1, 1, -1, -1, 1, 1, 1, -1, -1, -1, -1, -1, -1, 1, -1, 1, -1, 1, 1, 1, 1, -1, -1, 1, 1, -1, 1, 1, 1, -1, 1, -1, -1, -1, 1, -1, 1, 1, -1, -1, 1, 1, 1, -1, -1, -1, -1, -1, -1, -1, 1, -1, -1, -1, 1, -1, 1, -1, -1, 1, 1, -1, 1, -1, -1, -1, -1, 1, -1, 1, 1, -1, -1, -1, 1, 1, 1, 1, 1, -1, -1, -1, 1, -1, -1, 1, 1, -1, -1, -1, 1, -1, 1, 1, 1, -1, -1, 1, 1, -1, -1, -1, 1, -1, 1, -1, -1, -1, -1, -1, -1, 1, 1, 1, 1, 1, 1, -1, -1, 1, -1, 1, 1, -1, -1, -1, -1, 1, -1, -1, 1, -1, 1, 1, 1, -1, 1, -1, 1, -1, 1, -1, -1, -1, 1, -1, -1, -1, 1, -1, -1, 1, -1, 1, -1, -1, 1, -1, 1, 1, 1, 1, 1, -1, -1, -1, 1, 1, -1, 1, 1, 1, -1, -1, 1, 1, -1, -1, 1, -1, -1, 1, 1, -1, -1, -1, -1, 1, -1, -1, 1, -1, -1, -1, 1, 1, -1, -1, 1, -1, 1, -1, -1, 1, -1, -1, 1, -1, 1, -1, 1, 1, 1, -1, 1, 1, -1, -1, -1, 1, 1, -1, 1, 1, -1, 1, 1, 1, 1, 1, -1, 1, -1, -1, 1, 1, -1, 1, 1, 1, -1, -1, 1, -1, -1, -1, -1, -1, 1, -1, 1, 1, 1, 1, -1, 1, -1, 1, 1, -1, 1, -1, 1, 1, 1, 1, 1, -1, -1, -1, -1, -1, 1, 1, 1, 1, 1, -1, -1, -1, -1, -1, -1, 1, 1, 1, -1, 1, -1, -1, -1, -1, 1, -1, -1, 1, 1, 1, -1, 1, -1, 1, 1, -1, -1, 1, -1, 1, 1, 1, 1, 1, 1, 1, 1, -1, -1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, 1, -1, 1, 1, -1, 1, -1, -1, 1, -1, -1, -1, 1, 1, 1, -1, 1, -1, -1, 1, -1, -1, -1, -1, -1, -1, 1, -1, -1, -1, -1, 1, -1, 1, 1, 1, -1, 1, -1, -1, -1, 1, 1, -1, 1, -1, -1, -1, -1, 1, -1, -1, -1, -1, 1, -1, 1, 1, -1, 1, 1, -1, 1, 1, 1, -1, 1, 1, 1, -1, 1, 1, 1, -1, -1, -1, -1, 1, -1, -1, -1, -1, -1, 1, -1, -1, 1, -1, 1, -1, 1, -1, -1, 1, -1, 1, -1, -1, 1, 1, -1, -1, 1, 1, -1, -1, 1, 1, -1, 1, 1, -1, 1, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -1, -1, -1, 1, 1, 1, -1, 1, -1, -1, -1, -1, 1, -1, -1, -1, -1, 1, -1, 1, 1, -1, -1, -1, 1, -1, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, 1, 1, -1, -1, 1, -1, 1, -1, 1, -1, -1, -1, -1, -1, -1, -1, -1, 1, 1, -1, -1, 1, 1, 1, -1, -1, 1, -1, 1, 1, 1, -1, 1, -1, 1, 1, 1, -1, 1, 1, -1, 1, 1, -1, 1, -1, -1, 1, 1, 1, -1, 1, -1, -1, 1, -1, -1, -1, 1, -1, -1, 1, -1, -1, 1, 1, -1, -1, -1, 1, 1, -1, -1, 1, 1, -1, -1, -1, 1, 1, -1, 1, 1, 1, -1, 1, -1, -1, 1, 1, 1, 1, -1, 1, 1, 1, -1, 1, -1, 1, 1, 1, 1, -1, -1, 1, 1, 1, -1, 1, -1, 1, -1, -1, -1, -1, 1, -1, 1, -1, -1, -1, 1, -1, -1, -1, 1, 1, -1, 1, 1, 1, 1, -1, 1, 1, 1, 1, -1, -1, -1, 1, -1, -1, 1, 1, 1, -1, 1, -1, -1, -1, 1, 1, 1, 1, 1, 1, 1, -1, 1, -1, -1, -1, 1, 1, -1, -1, -1, -1, -1, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, -1, 1, 1, -1, 1, -1, -1, -1, 1, -1, 1, -1, 1, -1, -1, 1, -1, -1, 1, -1, 1, -1, 1, -1, -1, 1, -1, 1, 1, 1, -1, 1, -1, 1, 1, -1, -1, -1, 1, -1, 1, 1, 1, 1, -1, -1, 1, 1, 1, -1, -1, 1, 1, 1, 1, 1, 1, 1, -1, -1, -1, -1, 1, 1, -1, 1, 1, -1, 1, -1, -1, -1, 1, 1, -1, -1, -1, -1, 1, 1, -1, -1, 1, 1, -1, 1, -1, -1, -1, 1, -1, -1, -1, -1, -1, -1, -1, 1, 1, -1, -1, -1, 1, -1, 1, -1, 1, -1, 1, -1, -1, 1, 1, -1, 1, 1, 1, -1, 1, 1, -1, 1, 1, -1, -1, -1, 1, 1, -1, -1, -1, -1, 1, -1, -1, -1, 1, 1, 1, -1, 1, 1, 1, 1, -1, -1, -1, -1, -1, 1, 1, 1, 1, -1, -1, 1, -1, 1, -1, 1, -1, 1, 1, 1, -1, 1, 1, 1, -1, 1, 1, 1, -1, 1, 1, -1, -1, 1, -1, -1, 1, -1, -1, -1, 1, 1, 1, 1, 1, 1, 1, -1, -1, 1, 1, 1, 1, -1, -1, 1, -1, 1, -1, 1, -1, 1, -1, -1, 1, -1, 1, -1, -1, -1, -1, 1, 1, -1, 1, 1, 1, 1, -1, -1, 1, 1, -1, -1, 1, -1, -1, -1, 1, 1, -1, -1, -1, -1, 1, 1, 1, -1, -1, -1, -1, -1, -1, 1, -1, -1, -1, -1, -1, -1, 1, 1, -1, -1, -1, -1, 1, -1, -1, -1, 1, 1, 1, -1, 1, -1, -1, -1, -1, -1, -1, 1, -1, 1, 1, -1, 1, 1, 1, 1, -1, 1, 1, 1, 1, 1, -1, -1, 1, 1, -1, -1, -1, -1, -1, -1, -1, 1, 1, -1, 1, -1, -1, -1, 1, 1, 1, 1, 1, 1, -1, -1, 1, 1, -1, 1, -1, -1, 1, -1, 1, 1, 1, 1, 1, -1, -1, -1, -1, -1, -1, 1, -1, 1, 1, -1, -1, 1, -1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, -1, 1, -1, 1, 1, -1, 1, -1, -1, -1, 1, -1, -1, -1, 1, 1, -1, -1, 1, -1, 1, 1, 1, -1, -1, -1, -1, -1, 1, 1, 1, -1, -1, 1, -1, 1, 1, 1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, -1, -1, 1, -1, 1, -1, 1, -1, 1, -1, -1, 1, -1, 1, 1, -1, 1, -1, 1, -1, 1, 1, -1, 1, -1, 1, -1, -1, 1, -1, -1, -1, 1, -1, -1, 1, 1, -1, -1, 1, -1, 1, -1, 1, 1, 1, 1, -1, 1, 1, -1, 1, 1, 1, 1, -1, -1, -1, -1, -1, -1, 1, -1, -1, 1, -1, 1, 1, -1, -1, 1, -1, -1, -1, 1, -1, 1, 1, -1, 1, 1, 1, 1, 1, -1, 1, 1, 1, -1, 1, -1, 1, -1, 1, -1, -1, 1, -1, 1, -1, -1, -1, 1, 1, -1, -1, 1, -1, 1, -1, 1, -1, 1, 1, 1, -1, 1, -1, 1, -1, 1, -1, 1, 1, 1, -1, 1, -1, 1, -1, 1, 1, 1, 1, -1, 1, 1, 1, -1, -1, -1, -1, -1, 1, -1, 1, -1, -1, 1, 1, 1, -1, -1, -1, 1, -1, -1, 1, -1, -1, -1, 1, -1, 1, -1, 1, 1, -1, 1, -1, 1, -1, -1, 1, -1, 1, -1, -1, 1, -1, -1, 1, -1, -1, 1, -1, -1, -1, -1, 1, -1, 1, 1, 1, -1, -1, -1, -1, 1, 1, 1, -1, -1, 1, -1, 1, -1, -1, -1, 1, 1, -1, 1, 1, -1, -1, 1, 1, 1, -1, -1, -1, 1, -1, 1, 1, -1, -1, -1, -1, -1, -1, 1, 1, -1, 1, -1, -1, -1, -1, 1, 1, 1, -1, 1, 1, 1, 1, -1, 1, -1, -1, -1, 1, 1, -1, -1, -1, 1, -1, 1, -1, 1, -1, -1, 1, -1, 1, 1, -1, -1, 1, -1, -1, -1, 1, -1, 1, 1, -1, -1, -1, 1, -1, 1, -1, -1, -1, -1, 1, 1, -1, 1, 1, -1, 1, 1, 1, -1, -1, -1, -1, -1, 1, 1, -1, 1, -1, 1, -1, -1, -1, -1, -1, 1, 1, -1, -1, 1, 1, 1, 1, -1, -1, 1, 1, 1, -1, 1, 1, 1, -1, 1, -1, -1, -1, -1, 1, 1, -1, -1, 1, -1, -1, 1, -1, -1, -1, 1, 1, 1, -1, -1, 1, -1, 1, 1, -1, -1, 1, -1, -1, -1, -1, -1, -1, 1, -1, 1, -1, -1, 1, -1, -1, -1, 1, 1, 1, 1, -1, 1, 1, -1, -1, 1, -1, 1, -1, 1, 1, -1, 1, 1, -1, 1, 1, 1, 1, -1, -1, -1, 1, -1, -1, 1, 1, -1, -1, 1, -1, -1, 1, 1, 1, -1, -1, -1, -1, -1, 1, -1, -1, 1, 1, 1, 1, -1, -1, -1, -1, 1, 1, -1, -1, 1, -1, -1, -1, 1, -1, 1, -1, -1, 1, 1, 1, -1, 1, -1, 1, -1, -1, -1, -1, -1, 1, -1, 1, 1, -1, -1, 1, 1, 1, 1, -1, 1, -1, 1, 1, -1, -1, 1, 1, 1, -1, -1, 1, 1, -1, -1, -1, -1, -1, -1, -1, -1, 1, -1, -1, -1, -1, 1, -1, 1, 1, 1, 1, -1, 1, -1, 1, 1, 1, 1, -1, 1, 1, 1, 1, -1, 1, -1, -1, -1, -1, 1, 1, 1, -1, 1, 1, 1, 1, -1, -1, 1, 1, -1, 1, -1, 1, -1, -1, 1, 1, -1, -1, -1, -1, 1, -1, -1, 1, 1, 1, -1, -1, -1, -1, -1, -1, -1, 1, -1, -1, -1, -1, -1, 1, 1, -1, 1, -1, -1, -1, 1, 1, -1, 1, -1, -1, -1, 1, -1, 1, -1, -1, 1, -1, -1, -1, -1, 1, -1, -1, -1, 1, -1, -1, 1, -1, -1, -1, -1, -1, -1, 1, -1, 1, 1, -1, 1, -1, 1, 1, -1, 1, -1, -1, -1, -1, 1, -1, -1, -1, 1, 1, -1, -1, 1, 1, -1, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -1, -1, 1, -1, -1, -1, -1, -1, -1, -1, 1, 1, 1, -1, -1, -1, -1, -1, -1, -1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, 1, 1, -1, -1, 1, 1, -1, -1, 1, 1, 1, 1, -1, 1, -1, -1, 1, -1, 1, -1, -1, -1, -1, 1, 1, -1, -1, 1, -1, 1, 1, 1, 1, -1, -1, 1, 1, -1, 1, 1, -1, 1, 1, -1, -1, -1, 1, -1, 1, 1, -1, -1, 1, -1, 1, 1, -1, -1, 1, 1, 1, -1, 1, 1, -1, -1, 1, 1, -1, -1, 1, 1, 1, 1, 1, -1, 1, -1, 1, -1, 1, 1, 1, -1, 1, -1, 1, 1, 1, -1, 1, 1, 1, 1, -1, -1, 1, -1, 1, -1, -1, -1, -1, 1, 1, -1, 1, -1, 1, -1, 1, 1, 1, 1, -1, -1, 1, 1, -1, 1, -1, 1, -1, 1, 1, 1, -1, -1, -1, 1, -1, -1, -1, 1, 1, 1, 1, 1, -1, 1, 1, 1, 1, -1, -1, -1, 1, 1, -1, -1, 1, -1, -1, -1, 1, 1, -1, -1, 1, 1, -1, -1, -1, 1, 1, -1, -1, 1, -1, 1, -1, -1, 1, 1, -1, -1, 1, -1, 1, 1, 1, 1, -1, -1, -1, -1, 1, -1, -1, -1, -1, 1, 1, -1, -1, -1, -1, 1, -1, -1, -1, -1, -1, 1, 1, -1, 1, -1, -1, 1, -1, 1, -1, 1, 1, -1, -1, -1, 1, 1, -1, 1, 1, -1, -1, 1, 1, -1, 1, 1, -1, 1, 1, 1, -1, 1, -1, -1, 1, -1, 1, 1, 1, -1, -1, -1, 1, 1, 1, -1, 1, -1, 1, 1, 1, -1, -1, -1, -1, -1, -1, -1, -1, 1, -1, 1, 1, 1, 1, 1, -1, -1, -1, -1, -1, -1, 1, -1, 1, 1, -1, -1, -1, -1, 1, -1, 1, -1, 1, 1, 1, 1, -1, 1, -1, -1, -1, -1, 1, -1, -1, -1, -1, 1, 1, -1, 1, -1, 1, 1, -1, -1, 1, -1, -1, -1, -1, 1, 1, 1, -1, -1, -1, -1, -1, -1, -1, -1, 1, -1, -1, 1, -1, 1, -1, 1, 1, 1, -1, -1, 1, 1, 1, 1, -1, -1, 1, 1, 1, 1, -1, -1, 1, 1, 1, 1, 1, 1, -1, -1, 1, -1, 1, 1, -1, 1, -1, 1, 1, -1, -1, 1, 1, -1, 1, -1, -1, 1, -1, -1, -1, -1, 1, -1, -1, -1, -1, -1, 1, 1, -1, 1, -1, -1, -1, -1, 1, 1, -1, 1, 1, -1, -1, 1, 1, -1, 1, -1, 1, -1, 1, 1, 1, 1, 1, 1, -1, -1, -1, -1, 1, 1, -1, -1, 1, -1, 1, -1, -1, -1, -1, -1, -1, 1, -1, 1, 1, -1, 1, -1, -1, -1, 1, 1, -1, 1, -1, -1, 1, -1, 1, 1, -1, 1, -1, -1, 1, -1, 1, -1, 1, -1, -1, 1, -1, -1, -1, 1, 1, -1, -1, 1, -1, -1, 1, -1, -1, -1, 1, -1, 1, 1, -1, -1, -1, -1, -1, 1, -1, 1, 1, -1, 1, 1, -1, -1, 1, 1, 1, -1, 1, 1, 1, -1, 1, 1, -1, -1, 1, 1, 1, 1, 1, 1, -1, -1, -1, 1, 1, -1, -1, -1, -1, 1, 1, -1, -1, 1, 1, -1, 1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, -1, 1, 1, -1, 1, -1, 1, -1, 1, -1, 1, 1, -1, -1, -1, -1, 1, 1, -1, 1, -1, -1, 1, 1, -1, 1, 1, -1, -1, -1, 1, 1, 1, -1, 1, 1, 1, -1, 1, 1, -1, 1, 1, -1, 1, -1, -1, 1, 1, 1, -1, 1, -1, 1, 1, 1, 1, -1, -1, -1, 1, -1, 1, -1, -1, 1, -1, 1, 1, -1, -1, -1, 1, -1, 1, -1, 1, 1, 1, -1, 1, 1, -1, 1, 1, -1, -1, -1, -1, 1, -1, 1, 1, -1, -1, 1, 1, -1, 1, -1, -1, -1, 1, 1, 1, -1, -1, 1, -1, -1, -1, 1, 1, 1, 1, -1, -1, -1, 1, -1, 1, 1, 1, -1, 1, 1, 1, -1, -1, -1, 1, 1, -1, -1, 1, 1, -1, 1, -1, -1, 1, -1, -1, -1, 1, 1, -1, 1, -1, -1, 1, 1, -1, 1, -1, -1, 1, -1, -1, -1, 1, 1, -1, 1, 1, -1, 1, -1, -1, -1, -1, 1, -1, -1, 1, 1, -1, 1, 1, 1, 1, 1, -1, 1, -1, 1, 1, 1, 1, -1, -1, 1, 1, -1, 1, -1, 1, -1, -1, 1, -1, -1, -1, 1, -1, -1, -1, 1, 1, 1, -1, -1, 1, 1, -1, -1, -1, -1, 1, -1, 1, -1, 1, 1, 1, -1, 1, 1, -1, 1, -1, 1, -1, -1, 1, -1, -1, -1, -1, 1, 1, -1, -1, 1, -1, -1, 1, 1, 1, -1, -1, -1, -1, 1, -1, -1, 1, -1, 1, 1, 1, 1, 1, -1, -1, -1, -1, 1, -1, -1, -1, 1, 1, 1, 1, -1, -1, -1, -1, 1, -1, -1, 1, 1, 1, -1, 1, -1, 1, -1, 1, 1, -1, -1, -1, 1, 1, 1, 1, -1, -1, -1, 1, 1, -1, 1, 1, 1, 1, 1, -1, 1, 1, -1, 1, 1, 1, -1, 1, -1, -1, 1, 1, -1, 1, -1, 1, -1, 1, 1, -1, -1, -1, 1, 1, -1, 1, -1, 1, -1, -1, -1, -1, 1, 1, 1, 1, -1, 1, -1, 1, -1, -1, -1, 1, -1, -1, 1, -1, 1, 1, -1, -1, -1, -1, 1, 1, -1, -1, 1, -1, 1, -1, -1, 1, -1, 1, -1, -1, 1, -1, -1, 1, 1, -1, 1, -1, -1, 1, -1, 1, -1, 1, -1, 1, 1, -1, -1, 1, 1, -1, 1, -1, -1, 1, 1, 1, 1, -1, -1, -1, -1, 1, -1, 1, -1, 1, -1, -1, 1, 1, 1, 1, -1, -1, -1, -1, -1, -1, 1, 1, -1, 1, -1, 1, -1, 1, -1, -1, 1, -1, 1, 1, 1, 1, -1, -1, -1, -1, 1, -1, -1, 1, -1, -1, -1, 1, 1, 1, 1, 1, 1, 1, -1, 1, -1, 1, -1, -1, -1, 1, 1, 1, 1, -1, -1, 1, 1, 1, -1, 1, -1, -1, 1, -1, 1, 1, 1, -1, 1, 1, -1, 1, -1, 1, -1, 1, 1, -1, 1, 1, -1, 1, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, 1, 1, -1, 1, -1, 1, -1, -1, -1, 1, -1, -1, 1, -1, -1, 1, 1, 1, 1, 1, 1, -1, 1, 1, -1, 1, -1, 1, -1, -1, -1, 1, 1, -1, 1, -1, 1, -1, 1, -1, 1, 1, 1, 1, -1, 1, 1, -1, -1, -1, 1, -1, 1, -1, 1, 1, 1, 1, -1, 1, 1, 1, 1, -1, 1, -1, -1, -1, -1, -1, -1, -1, 1, -1, -1, -1, -1, -1, 1, 1, -1, 1, -1] diff --git a/gr-digital/swig/CMakeLists.txt b/gr-digital/swig/CMakeLists.txt new file mode 100644 index 000000000..5c6477aa1 --- /dev/null +++ b/gr-digital/swig/CMakeLists.txt @@ -0,0 +1,60 @@ +# Copyright 2011 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio 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 General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. + +######################################################################## +# Setup swig generation +######################################################################## +INCLUDE(GrPython) +INCLUDE(GrSwig) + +SET(GR_SWIG_INCLUDE_DIRS + ${GR_DIGITAL_INCLUDE_DIRS} + ${GNURADIO_CORE_SWIG_INCLUDE_DIRS} +) + +SET(GR_SWIG_LIBRARIES gnuradio-digital) + +GR_SWIG_MAKE(digital_hier digital_hier.i) +GR_SWIG_MAKE(digital_swig digital_swig.i) + +GR_SWIG_INSTALL( + TARGETS digital_hier digital_swig + DESTINATION ${GR_PYTHON_DIR}/gnuradio/digital + COMPONENT "digital_python" +) + +INSTALL( + FILES + digital_binary_slicer_fb.i + digital_clock_recovery_mm_cc.i + digital_clock_recovery_mm_ff.i + digital_constellation.i + digital_constellation_receiver_cb.i + digital_constellation_decoder_cb.i + digital_correlate_access_code_bb.i + digital_costas_loop_cc.i + digital_cma_equalizer_cc.i + digital_crc32.i + digital_fll_band_edge_cc.i + digital_lms_dd_equalizer_cc.i + digital_kurtotic_equalizer_cc.i + digital_mpsk_receiver_cc.i + DESTINATION ${GR_INCLUDE_DIR}/gnuradio/swig + COMPONENT "digital_swig" +) diff --git a/gr-gsm-fr-vocoder/.gitignore b/gr-gsm-fr-vocoder/.gitignore deleted file mode 100644 index f3462d009..000000000 --- a/gr-gsm-fr-vocoder/.gitignore +++ /dev/null @@ -1,23 +0,0 @@ -/Makefile -/Makefile.in -/aclocal.m4 -/configure -/config.h.in -/stamp-h.in -/libtool -/config.log -/config.h -/config.cache -/config.status -/missing -/stamp-h -/stamp-h1 -/.deps -/.libs -/*.la -/*.lo -/autom4te.cache -/*.cache -/missing -/make.log -/*.pc diff --git a/gr-gsm-fr-vocoder/gnuradio-gsm-fr-vocoder.pc.in b/gr-gsm-fr-vocoder/gnuradio-gsm-fr-vocoder.pc.in deleted file mode 100644 index a799fcd82..000000000 --- a/gr-gsm-fr-vocoder/gnuradio-gsm-fr-vocoder.pc.in +++ /dev/null @@ -1,11 +0,0 @@ -prefix=@prefix@ -exec_prefix=@exec_prefix@ -libdir=@libdir@ -includedir=@includedir@ - -Name: gnuradio-comedi -Description: GNU Radio blocks implementing a GSM full rate vocoder -Requires: gnuradio-core -Version: @LIBVER@ -Libs: -L${libdir} -lgnuradio-gsm-fr-vocoder-$@LIBVER@ -Cflags: -I${includedir} diff --git a/gr-gsm-fr-vocoder/src/.gitignore b/gr-gsm-fr-vocoder/src/.gitignore deleted file mode 100644 index bb3f27777..000000000 --- a/gr-gsm-fr-vocoder/src/.gitignore +++ /dev/null @@ -1,10 +0,0 @@ -/Makefile -/Makefile.in -/.la -/.lo -/.deps -/.libs -/*.la -/*.lo -/howto.cc -/howto.py diff --git a/gr-gsm-fr-vocoder/src/lib/.gitignore b/gr-gsm-fr-vocoder/src/lib/.gitignore deleted file mode 100644 index 5cf6fde83..000000000 --- a/gr-gsm-fr-vocoder/src/lib/.gitignore +++ /dev/null @@ -1,14 +0,0 @@ -/Makefile -/Makefile.in -/.la -/.lo -/.deps -/.libs -/*.la -/*.lo -/gsm_full_rate.py -/gsm_full_rate.cc -/*.pyc -/gnuradio -/guile -/python diff --git a/gr-gsm-fr-vocoder/src/lib/Makefile.am b/gr-gsm-fr-vocoder/src/lib/Makefile.am deleted file mode 100644 index 4ce65bc31..000000000 --- a/gr-gsm-fr-vocoder/src/lib/Makefile.am +++ /dev/null @@ -1,61 +0,0 @@ -# -# Copyright 2004,2005,2008,2009,2010 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3, or (at your option) -# any later version. -# -# GNU Radio 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 General Public License -# along with GNU Radio; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. -# - -include $(top_srcdir)/Makefile.common -include $(top_srcdir)/Makefile.swig - -SUBDIRS = gsm . - -AM_CPPFLAGS = $(STD_DEFINES_AND_INCLUDES) $(PYTHON_CPPFLAGS) $(WITH_INCLUDES) - -# C/C++ headers get installed in ${prefix}/include/gnuradio -grinclude_HEADERS = \ - gsm_fr_decode_ps.h \ - gsm_fr_encode_sp.h - -lib_LTLIBRARIES = libgnuradio-gsm-fr-vocoder.la - -libgnuradio_gsm_fr_vocoder_la_SOURCES = \ - gsm_fr_decode_ps.cc \ - gsm_fr_encode_sp.cc - -libgnuradio_gsm_fr_vocoder_la_LIBADD = \ - $(GNURADIO_CORE_LA) \ - gsm/libgsm.la - -libgnuradio_gsm_fr_vocoder_la_LDFLAGS = $(NO_UNDEFINED) $(LTVERSIONFLAGS) - - -# SWIG interface and library -TOP_SWIG_IFILES = \ - gsm_full_rate.i - -# Install so that they end up available as: -# import gnuradio.vocoder.gsm_full_rate -# This ends up at: -# ${prefix}/lib/python${python_version}/site-packages/gnuradio/vocoder -gsm_full_rate_pythondir_category = \ - gnuradio/vocoder - -# additional libraries for linking with the SWIG-generated library -gsm_full_rate_la_swig_libadd = \ - libgnuradio-gsm-fr-vocoder.la - diff --git a/gr-gsm-fr-vocoder/src/lib/Makefile.swig.gen b/gr-gsm-fr-vocoder/src/lib/Makefile.swig.gen deleted file mode 100644 index 174ef046d..000000000 --- a/gr-gsm-fr-vocoder/src/lib/Makefile.swig.gen +++ /dev/null @@ -1,145 +0,0 @@ -# -*- Makefile -*- -# -# Copyright 2009 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3, or (at your option) -# any later version. -# -# GNU Radio 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 General Public License -# along with GNU Radio; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. -# - -# Makefile.swig.gen for gsm_full_rate.i - -## Default install locations for these files: -## -## Default location for the Python directory is: -## ${prefix}/lib/python${python_version}/site-packages/[category]/gsm_full_rate -## Default location for the Python exec directory is: -## ${exec_prefix}/lib/python${python_version}/site-packages/[category]/gsm_full_rate -## -## The following can be overloaded to change the install location, but -## this has to be done in the including Makefile.am -before- -## Makefile.swig is included. - -gsm_full_rate_pythondir_category ?= gnuradio/gsm_full_rate -gsm_full_rate_pylibdir_category ?= $(gsm_full_rate_pythondir_category) -gsm_full_rate_pythondir = $(pythondir)/$(gsm_full_rate_pythondir_category) -gsm_full_rate_pylibdir = $(pyexecdir)/$(gsm_full_rate_pylibdir_category) - -# The .so libraries for the guile modules get installed whereever guile -# is installed, usually /usr/lib/guile/gnuradio/ -# FIXME: determince whether these should be installed with gnuradio. -gsm_full_rate_scmlibdir = $(libdir) - -# The scm files for the guile modules get installed where ever guile -# is installed, usually /usr/share/guile/site/gsm_full_rate -# FIXME: determince whether these should be installed with gnuradio. -gsm_full_rate_scmdir = $(guiledir) - -## SWIG headers are always installed into the same directory. - -gsm_full_rate_swigincludedir = $(swigincludedir) - -## This is a template file for a "generated" Makefile addition (in -## this case, "Makefile.swig.gen"). By including the top-level -## Makefile.swig, this file will be used to generate the SWIG -## dependencies. Assign the variable TOP_SWIG_FILES to be the list of -## SWIG .i files to generated wrappings for; there can be more than 1 -## so long as the names are unique (no sorting is done on the -## TOP_SWIG_FILES list). This file explicitly assumes that a SWIG .i -## file will generate .cc, .py, and possibly .h files -- meaning that -## all of these files will have the same base name (that provided for -## the SWIG .i file). -## -## This code is setup to ensure parallel MAKE ("-j" or "-jN") does the -## right thing. For more info, see < -## http://sources.redhat.com/automake/automake.html#Multiple-Outputs > - -## Other cleaned files: dependency files generated by SWIG or this Makefile - -MOSTLYCLEANFILES += $(DEPDIR)/*.S* - -## Various SWIG variables. These can be overloaded in the including -## Makefile.am by setting the variable value there, then including -## Makefile.swig . - -gsm_full_rate_swiginclude_HEADERS = \ - gsm_full_rate.i \ - $(gsm_full_rate_swiginclude_headers) - -if PYTHON -gsm_full_rate_pylib_LTLIBRARIES = \ - _gsm_full_rate.la - -_gsm_full_rate_la_SOURCES = \ - python/gsm_full_rate.cc \ - $(gsm_full_rate_la_swig_sources) - -gsm_full_rate_python_PYTHON = \ - gsm_full_rate.py \ - $(gsm_full_rate_python) - -_gsm_full_rate_la_LIBADD = \ - $(STD_SWIG_LA_LIB_ADD) \ - $(gsm_full_rate_la_swig_libadd) - -_gsm_full_rate_la_LDFLAGS = \ - $(STD_SWIG_LA_LD_FLAGS) \ - $(gsm_full_rate_la_swig_ldflags) - -_gsm_full_rate_la_CXXFLAGS = \ - $(STD_SWIG_CXX_FLAGS) \ - -I$(top_builddir) \ - $(gsm_full_rate_la_swig_cxxflags) - -python/gsm_full_rate.cc: gsm_full_rate.py -gsm_full_rate.py: gsm_full_rate.i - -# Include the python dependencies for this file --include python/gsm_full_rate.d - -endif # end of if python - -if GUILE - -gsm_full_rate_scmlib_LTLIBRARIES = \ - libguile-gnuradio-gsm_full_rate.la -libguile_gnuradio_gsm_full_rate_la_SOURCES = \ - guile/gsm_full_rate.cc \ - $(gsm_full_rate_la_swig_sources) -nobase_gsm_full_rate_scm_DATA = \ - gnuradio/gsm_full_rate.scm \ - gnuradio/gsm_full_rate-primitive.scm -libguile_gnuradio_gsm_full_rate_la_LIBADD = \ - $(STD_SWIG_LA_LIB_ADD) \ - $(gsm_full_rate_la_swig_libadd) -libguile_gnuradio_gsm_full_rate_la_LDFLAGS = \ - $(STD_SWIG_LA_LD_FLAGS) \ - $(gsm_full_rate_la_swig_ldflags) -libguile_gnuradio_gsm_full_rate_la_CXXFLAGS = \ - $(STD_SWIG_CXX_FLAGS) \ - -I$(top_builddir) \ - $(gsm_full_rate_la_swig_cxxflags) - -guile/gsm_full_rate.cc: gnuradio/gsm_full_rate.scm -gnuradio/gsm_full_rate.scm: gsm_full_rate.i -gnuradio/gsm_full_rate-primitive.scm: gnuradio/gsm_full_rate.scm - -# Include the guile dependencies for this file --include guile/gsm_full_rate.d - -endif # end of GUILE - - diff --git a/gr-gsm-fr-vocoder/src/python/run_tests.in b/gr-gsm-fr-vocoder/src/python/run_tests.in deleted file mode 100644 index 96eefc559..000000000 --- a/gr-gsm-fr-vocoder/src/python/run_tests.in +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh - -# 1st parameter is absolute path to component source directory -# 2nd parameter is absolute path to component build directory -# 3rd parameter is path to Python QA directory - -@top_builddir@/run_tests.sh \ - @abs_top_srcdir@/gr-gsm-fr-vocoder \ - @abs_top_builddir@/gr-gsm-fr-vocoder \ - @srcdir@ diff --git a/gr-howto-write-a-block-cmake/CMakeLists.txt b/gr-howto-write-a-block-cmake/CMakeLists.txt new file mode 100644 index 000000000..9de061414 --- /dev/null +++ b/gr-howto-write-a-block-cmake/CMakeLists.txt @@ -0,0 +1,103 @@ +# Copyright 2011 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio 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 General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. + + +######################################################################## +# Project setup +######################################################################## +CMAKE_MINIMUM_REQUIRED(VERSION 2.6) +PROJECT(gr-howto-write-a-block CXX) +ENABLE_TESTING() + +#select the release build type by default to get optimization flags +IF(NOT CMAKE_BUILD_TYPE) + SET(CMAKE_BUILD_TYPE "Release") + MESSAGE(STATUS "Build type not specified: defaulting to release.") +ENDIF(NOT CMAKE_BUILD_TYPE) +SET(CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE} CACHE STRING "") + +LIST(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/Modules) + +######################################################################## +# Compiler specific setup +######################################################################## +IF(CMAKE_COMPILER_IS_GNUCXX AND NOT WIN32) + #http://gcc.gnu.org/wiki/Visibility + ADD_DEFINITIONS(-fvisibility=hidden) +ENDIF() + +######################################################################## +# Find boost +######################################################################## +IF(UNIX AND EXISTS "/usr/lib64") + LIST(APPEND BOOST_LIBRARYDIR "/usr/lib64") #fedora 64-bit fix +ENDIF(UNIX AND EXISTS "/usr/lib64") +SET(Boost_ADDITIONAL_VERSIONS + "1.35.0" "1.35" "1.36.0" "1.36" "1.37.0" "1.37" "1.38.0" "1.38" "1.39.0" "1.39" + "1.40.0" "1.40" "1.41.0" "1.41" "1.42.0" "1.42" "1.43.0" "1.43" "1.44.0" "1.44" + "1.45.0" "1.45" "1.46.0" "1.46" "1.47.0" "1.47" "1.48.0" "1.48" "1.49.0" "1.49" + "1.50.0" "1.50" "1.51.0" "1.51" "1.52.0" "1.52" "1.53.0" "1.53" "1.54.0" "1.54" + "1.55.0" "1.55" "1.56.0" "1.56" "1.57.0" "1.57" "1.58.0" "1.58" "1.59.0" "1.59" + "1.60.0" "1.60" "1.61.0" "1.61" "1.62.0" "1.62" "1.63.0" "1.63" "1.64.0" "1.64" + "1.65.0" "1.65" "1.66.0" "1.66" "1.67.0" "1.67" "1.68.0" "1.68" "1.69.0" "1.69" +) +FIND_PACKAGE(Boost "1.35") + +IF(NOT Boost_FOUND) + MESSAGE(FATAL_ERROR "Boost required to compile howto") +ENDIF() + +######################################################################## +# Find gnuradio build dependencies +######################################################################## +FIND_PACKAGE(Gruel) +FIND_PACKAGE(GnuradioCore) + +IF(NOT GRUEL_FOUND) + MESSAGE(FATAL_ERROR "Gruel required to compile howto") +ENDIF() + +IF(NOT GNURADIO_CORE_FOUND) + MESSAGE(FATAL_ERROR "GnuRadio Core required to compile howto") +ENDIF() + +######################################################################## +# Setup the include and linker paths +######################################################################## +INCLUDE_DIRECTORIES( + ${CMAKE_SOURCE_DIR}/lib + ${Boost_INCLUDE_DIRS} + ${GRUEL_INCLUDE_DIRS} + ${GNURADIO_CORE_INCLUDE_DIRS} +) + +LINK_DIRECTORIES( + ${Boost_LIBRARY_DIRS} + ${GRUEL_LIBRARY_DIRS} + ${GNURADIO_CORE_LIBRARY_DIRS} +) + +######################################################################## +# Add subdirectories +######################################################################## +ADD_SUBDIRECTORY(lib) +ADD_SUBDIRECTORY(swig) +ADD_SUBDIRECTORY(python) +ADD_SUBDIRECTORY(grc) +ADD_SUBDIRECTORY(apps) diff --git a/gr-howto-write-a-block-cmake/apps/CMakeLists.txt b/gr-howto-write-a-block-cmake/apps/CMakeLists.txt new file mode 100644 index 000000000..e89cae26b --- /dev/null +++ b/gr-howto-write-a-block-cmake/apps/CMakeLists.txt @@ -0,0 +1,26 @@ +# Copyright 2011 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio 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 General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. + +INCLUDE(GrPython) + +GR_PYTHON_INSTALL( + PROGRAMS + howto_square.py + DESTINATION bin +) diff --git a/gr-howto-write-a-block-cmake/apps/howto_square.grc b/gr-howto-write-a-block-cmake/apps/howto_square.grc new file mode 100644 index 000000000..a8563698b --- /dev/null +++ b/gr-howto-write-a-block-cmake/apps/howto_square.grc @@ -0,0 +1,325 @@ +<?xml version='1.0' encoding='ASCII'?> +<flow_graph> + <timestamp>Thu Nov 12 11:26:07 2009</timestamp> + <block> + <key>options</key> + <param> + <key>id</key> + <value>howto_square</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>title</key> + <value></value> + </param> + <param> + <key>author</key> + <value></value> + </param> + <param> + <key>description</key> + <value></value> + </param> + <param> + <key>window_size</key> + <value>1280, 1024</value> + </param> + <param> + <key>generate_options</key> + <value>wx_gui</value> + </param> + <param> + <key>category</key> + <value>Custom</value> + </param> + <param> + <key>run_options</key> + <value>prompt</value> + </param> + <param> + <key>run</key> + <value>True</value> + </param> + <param> + <key>realtime_scheduling</key> + <value></value> + </param> + <param> + <key>_coordinate</key> + <value>(10, 10)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>variable</key> + <param> + <key>id</key> + <value>samp_rate</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>value</key> + <value>10e3</value> + </param> + <param> + <key>_coordinate</key> + <value>(10, 170)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>wxgui_scopesink2</key> + <param> + <key>id</key> + <value>sink</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>type</key> + <value>float</value> + </param> + <param> + <key>title</key> + <value>Input</value> + </param> + <param> + <key>samp_rate</key> + <value>samp_rate</value> + </param> + <param> + <key>v_scale</key> + <value>20</value> + </param> + <param> + <key>v_offset</key> + <value>0</value> + </param> + <param> + <key>t_scale</key> + <value>0.002</value> + </param> + <param> + <key>ac_couple</key> + <value>False</value> + </param> + <param> + <key>xy_mode</key> + <value>False</value> + </param> + <param> + <key>num_inputs</key> + <value>1</value> + </param> + <param> + <key>win_size</key> + <value></value> + </param> + <param> + <key>grid_pos</key> + <value></value> + </param> + <param> + <key>notebook</key> + <value></value> + </param> + <param> + <key>_coordinate</key> + <value>(691, 222)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>howto_square_ff</key> + <param> + <key>id</key> + <value>sqr</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>_coordinate</key> + <value>(709, 344)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>gr_throttle</key> + <param> + <key>id</key> + <value>thr</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>type</key> + <value>float</value> + </param> + <param> + <key>samples_per_second</key> + <value>samp_rate</value> + </param> + <param> + <key>vlen</key> + <value>1</value> + </param> + <param> + <key>_coordinate</key> + <value>(497, 340)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>gr_vector_source_x</key> + <param> + <key>id</key> + <value>src</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>type</key> + <value>float</value> + </param> + <param> + <key>vector</key> + <value>[float(n)-50 for n in range(100)]</value> + </param> + <param> + <key>repeat</key> + <value>True</value> + </param> + <param> + <key>vlen</key> + <value>1</value> + </param> + <param> + <key>_coordinate</key> + <value>(246, 332)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>wxgui_scopesink2</key> + <param> + <key>id</key> + <value>sink2</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>type</key> + <value>float</value> + </param> + <param> + <key>title</key> + <value>Output</value> + </param> + <param> + <key>samp_rate</key> + <value>samp_rate</value> + </param> + <param> + <key>v_scale</key> + <value>0</value> + </param> + <param> + <key>v_offset</key> + <value>0</value> + </param> + <param> + <key>t_scale</key> + <value>0.002</value> + </param> + <param> + <key>ac_couple</key> + <value>False</value> + </param> + <param> + <key>xy_mode</key> + <value>False</value> + </param> + <param> + <key>num_inputs</key> + <value>1</value> + </param> + <param> + <key>win_size</key> + <value></value> + </param> + <param> + <key>grid_pos</key> + <value></value> + </param> + <param> + <key>notebook</key> + <value></value> + </param> + <param> + <key>_coordinate</key> + <value>(869, 324)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <connection> + <source_block_id>thr</source_block_id> + <sink_block_id>sqr</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>src</source_block_id> + <sink_block_id>thr</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>thr</source_block_id> + <sink_block_id>sink</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>sqr</source_block_id> + <sink_block_id>sink2</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> +</flow_graph> diff --git a/gr-howto-write-a-block-cmake/apps/howto_square.py b/gr-howto-write-a-block-cmake/apps/howto_square.py new file mode 100755 index 000000000..f14e28325 --- /dev/null +++ b/gr-howto-write-a-block-cmake/apps/howto_square.py @@ -0,0 +1,77 @@ +#!/usr/bin/env python +################################################## +# Gnuradio Python Flow Graph +# Title: Howto Square +# Generated: Thu Nov 12 11:26:07 2009 +################################################## + +import howto +from gnuradio import eng_notation +from gnuradio import gr +from gnuradio.eng_option import eng_option +from gnuradio.gr import firdes +from gnuradio.wxgui import scopesink2 +from grc_gnuradio import wxgui as grc_wxgui +from optparse import OptionParser +import wx + +class howto_square(grc_wxgui.top_block_gui): + + def __init__(self): + grc_wxgui.top_block_gui.__init__(self, title="Howto Square") + + ################################################## + # Variables + ################################################## + self.samp_rate = samp_rate = 10e3 + + ################################################## + # Blocks + ################################################## + self.sink = scopesink2.scope_sink_f( + self.GetWin(), + title="Input", + sample_rate=samp_rate, + v_scale=20, + v_offset=0, + t_scale=0.002, + ac_couple=False, + xy_mode=False, + num_inputs=1, + ) + self.Add(self.sink.win) + self.sink2 = scopesink2.scope_sink_f( + self.GetWin(), + title="Output", + sample_rate=samp_rate, + v_scale=0, + v_offset=0, + t_scale=0.002, + ac_couple=False, + xy_mode=False, + num_inputs=1, + ) + self.Add(self.sink2.win) + self.sqr = howto.square_ff() + self.src = gr.vector_source_f(([float(n)-50 for n in range(100)]), True, 1) + self.thr = gr.throttle(gr.sizeof_float*1, samp_rate) + + ################################################## + # Connections + ################################################## + self.connect((self.thr, 0), (self.sqr, 0)) + self.connect((self.src, 0), (self.thr, 0)) + self.connect((self.thr, 0), (self.sink, 0)) + self.connect((self.sqr, 0), (self.sink2, 0)) + + def set_samp_rate(self, samp_rate): + self.samp_rate = samp_rate + self.sink.set_sample_rate(self.samp_rate) + self.sink2.set_sample_rate(self.samp_rate) + +if __name__ == '__main__': + parser = OptionParser(option_class=eng_option, usage="%prog: [options]") + (options, args) = parser.parse_args() + tb = howto_square() + tb.Run(True) + diff --git a/gr-howto-write-a-block-cmake/cmake/Modules/CMakeParseArgumentsCopy.cmake b/gr-howto-write-a-block-cmake/cmake/Modules/CMakeParseArgumentsCopy.cmake new file mode 100644 index 000000000..7ce4c49ae --- /dev/null +++ b/gr-howto-write-a-block-cmake/cmake/Modules/CMakeParseArgumentsCopy.cmake @@ -0,0 +1,138 @@ +# CMAKE_PARSE_ARGUMENTS(<prefix> <options> <one_value_keywords> <multi_value_keywords> args...) +# +# CMAKE_PARSE_ARGUMENTS() is intended to be used in macros or functions for +# parsing the arguments given to that macro or function. +# It processes the arguments and defines a set of variables which hold the +# values of the respective options. +# +# The <options> argument contains all options for the respective macro, +# i.e. keywords which can be used when calling the macro without any value +# following, like e.g. the OPTIONAL keyword of the install() command. +# +# The <one_value_keywords> argument contains all keywords for this macro +# which are followed by one value, like e.g. DESTINATION keyword of the +# install() command. +# +# The <multi_value_keywords> argument contains all keywords for this macro +# which can be followed by more than one value, like e.g. the TARGETS or +# FILES keywords of the install() command. +# +# When done, CMAKE_PARSE_ARGUMENTS() will have defined for each of the +# keywords listed in <options>, <one_value_keywords> and +# <multi_value_keywords> a variable composed of the given <prefix> +# followed by "_" and the name of the respective keyword. +# These variables will then hold the respective value from the argument list. +# For the <options> keywords this will be TRUE or FALSE. +# +# All remaining arguments are collected in a variable +# <prefix>_UNPARSED_ARGUMENTS, this can be checked afterwards to see whether +# your macro was called with unrecognized parameters. +# +# As an example here a my_install() macro, which takes similar arguments as the +# real install() command: +# +# function(MY_INSTALL) +# set(options OPTIONAL FAST) +# set(oneValueArgs DESTINATION RENAME) +# set(multiValueArgs TARGETS CONFIGURATIONS) +# cmake_parse_arguments(MY_INSTALL "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} ) +# ... +# +# Assume my_install() has been called like this: +# my_install(TARGETS foo bar DESTINATION bin OPTIONAL blub) +# +# After the cmake_parse_arguments() call the macro will have set the following +# variables: +# MY_INSTALL_OPTIONAL = TRUE +# MY_INSTALL_FAST = FALSE (this option was not used when calling my_install() +# MY_INSTALL_DESTINATION = "bin" +# MY_INSTALL_RENAME = "" (was not used) +# MY_INSTALL_TARGETS = "foo;bar" +# MY_INSTALL_CONFIGURATIONS = "" (was not used) +# MY_INSTALL_UNPARSED_ARGUMENTS = "blub" (no value expected after "OPTIONAL" +# +# You can the continue and process these variables. +# +# Keywords terminate lists of values, e.g. if directly after a one_value_keyword +# another recognized keyword follows, this is interpreted as the beginning of +# the new option. +# E.g. my_install(TARGETS foo DESTINATION OPTIONAL) would result in +# MY_INSTALL_DESTINATION set to "OPTIONAL", but MY_INSTALL_DESTINATION would +# be empty and MY_INSTALL_OPTIONAL would be set to TRUE therefor. + +#============================================================================= +# Copyright 2010 Alexander Neundorf <neundorf@kde.org> +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) + + +if(__CMAKE_PARSE_ARGUMENTS_INCLUDED) + return() +endif() +set(__CMAKE_PARSE_ARGUMENTS_INCLUDED TRUE) + + +function(CMAKE_PARSE_ARGUMENTS prefix _optionNames _singleArgNames _multiArgNames) + # first set all result variables to empty/FALSE + foreach(arg_name ${_singleArgNames} ${_multiArgNames}) + set(${prefix}_${arg_name}) + endforeach(arg_name) + + foreach(option ${_optionNames}) + set(${prefix}_${option} FALSE) + endforeach(option) + + set(${prefix}_UNPARSED_ARGUMENTS) + + set(insideValues FALSE) + set(currentArgName) + + # now iterate over all arguments and fill the result variables + foreach(currentArg ${ARGN}) + list(FIND _optionNames "${currentArg}" optionIndex) # ... then this marks the end of the arguments belonging to this keyword + list(FIND _singleArgNames "${currentArg}" singleArgIndex) # ... then this marks the end of the arguments belonging to this keyword + list(FIND _multiArgNames "${currentArg}" multiArgIndex) # ... then this marks the end of the arguments belonging to this keyword + + if(${optionIndex} EQUAL -1 AND ${singleArgIndex} EQUAL -1 AND ${multiArgIndex} EQUAL -1) + if(insideValues) + if("${insideValues}" STREQUAL "SINGLE") + set(${prefix}_${currentArgName} ${currentArg}) + set(insideValues FALSE) + elseif("${insideValues}" STREQUAL "MULTI") + list(APPEND ${prefix}_${currentArgName} ${currentArg}) + endif() + else(insideValues) + list(APPEND ${prefix}_UNPARSED_ARGUMENTS ${currentArg}) + endif(insideValues) + else() + if(NOT ${optionIndex} EQUAL -1) + set(${prefix}_${currentArg} TRUE) + set(insideValues FALSE) + elseif(NOT ${singleArgIndex} EQUAL -1) + set(currentArgName ${currentArg}) + set(${prefix}_${currentArgName}) + set(insideValues "SINGLE") + elseif(NOT ${multiArgIndex} EQUAL -1) + set(currentArgName ${currentArg}) + set(${prefix}_${currentArgName}) + set(insideValues "MULTI") + endif() + endif() + + endforeach(currentArg) + + # propagate the result variables to the caller: + foreach(arg_name ${_singleArgNames} ${_multiArgNames} ${_optionNames}) + set(${prefix}_${arg_name} ${${prefix}_${arg_name}} PARENT_SCOPE) + endforeach(arg_name) + set(${prefix}_UNPARSED_ARGUMENTS ${${prefix}_UNPARSED_ARGUMENTS} PARENT_SCOPE) + +endfunction(CMAKE_PARSE_ARGUMENTS _options _singleArgs _multiArgs) diff --git a/gr-howto-write-a-block-cmake/cmake/Modules/FindGnuradioCore.cmake b/gr-howto-write-a-block-cmake/cmake/Modules/FindGnuradioCore.cmake new file mode 100644 index 000000000..f76364acf --- /dev/null +++ b/gr-howto-write-a-block-cmake/cmake/Modules/FindGnuradioCore.cmake @@ -0,0 +1,26 @@ +INCLUDE(FindPkgConfig) +PKG_CHECK_MODULES(GNURADIO_CORE gnuradio-core) +IF(NOT GNURADIO_CORE_FOUND) + +FIND_PATH( + GNURADIO_CORE_INCLUDE_DIRS + NAMES gr_random.h + HINTS $ENV{GNURADIO_CORE_DIR}/include/gnuradio + PATHS /usr/local/include/gnuradio + /usr/include/gnuradio +) + +FIND_LIBRARY( + GNURADIO_CORE_LIBRARIES + NAMES gnuradio-core + HINTS $ENV{GNURADIO_CORE_DIR}/lib + PATHS /usr/local/lib + /usr/local/lib64 + /usr/lib + /usr/lib64 +) + +INCLUDE(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(GNURADIO_CORE DEFAULT_MSG GNURADIO_CORE_LIBRARIES GNURADIO_CORE_INCLUDE_DIRS) + +ENDIF(NOT GNURADIO_CORE_FOUND) diff --git a/gr-howto-write-a-block-cmake/cmake/Modules/FindGruel.cmake b/gr-howto-write-a-block-cmake/cmake/Modules/FindGruel.cmake new file mode 100644 index 000000000..c142c905e --- /dev/null +++ b/gr-howto-write-a-block-cmake/cmake/Modules/FindGruel.cmake @@ -0,0 +1,26 @@ +INCLUDE(FindPkgConfig) +PKG_CHECK_MODULES(GRUEL gnuradio-core) +IF(NOT GRUEL_FOUND) + +FIND_PATH( + GRUEL_INCLUDE_DIRS + NAMES gruel/attributes.h + HINTS $ENV{GRUEL_DIR}/include + PATHS /usr/local/include + /usr/include +) + +FIND_LIBRARY( + GRUEL_LIBRARIES + NAMES gruel + HINTS $ENV{GRUEL_DIR}/lib + PATHS /usr/local/lib + /usr/local/lib64 + /usr/lib + /usr/lib64 +) + +INCLUDE(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(GRUEL DEFAULT_MSG GRUEL_LIBRARIES GRUEL_INCLUDE_DIRS) + +ENDIF(NOT GRUEL_FOUND) diff --git a/gr-howto-write-a-block-cmake/cmake/Modules/GrPlatform.cmake b/gr-howto-write-a-block-cmake/cmake/Modules/GrPlatform.cmake new file mode 100644 index 000000000..85f318618 --- /dev/null +++ b/gr-howto-write-a-block-cmake/cmake/Modules/GrPlatform.cmake @@ -0,0 +1,46 @@ +# Copyright 2011 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio 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 General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. + +IF(DEFINED __INCLUDED_GR_PLATFORM_CMAKE) + RETURN() +ENDIF() +SET(__INCLUDED_GR_PLATFORM_CMAKE TRUE) + +######################################################################## +# Setup additional defines for OS types +######################################################################## +IF(CMAKE_SYSTEM_NAME STREQUAL "Linux") + SET(LINUX TRUE) +ENDIF() + +IF(LINUX AND EXISTS "/etc/debian_version") + SET(DEBIAN TRUE) +ENDIF() + +IF(LINUX AND EXISTS "/etc/redhat-release") + SET(REDHAT TRUE) +ENDIF() + +######################################################################## +# when the library suffix should be 64 (applies to redhat linux family) +######################################################################## +IF(NOT DEFINED LIB_SUFFIX AND REDHAT AND CMAKE_SYSTEM_PROCESSOR MATCHES "64$") + SET(LIB_SUFFIX 64) +ENDIF() +SET(LIB_SUFFIX ${LIB_SUFFIX} CACHE STRING "lib directory suffix") diff --git a/gr-howto-write-a-block-cmake/cmake/Modules/GrPython.cmake b/gr-howto-write-a-block-cmake/cmake/Modules/GrPython.cmake new file mode 100644 index 000000000..f54dbc9ba --- /dev/null +++ b/gr-howto-write-a-block-cmake/cmake/Modules/GrPython.cmake @@ -0,0 +1,177 @@ +# Copyright 2010-2011 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio 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 General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. + +IF(DEFINED __INCLUDED_GR_PYTHON_CMAKE) + RETURN() +ENDIF() +SET(__INCLUDED_GR_PYTHON_CMAKE TRUE) + +######################################################################## +# Setup the python interpreter: +# This allows the user to specify a specific interpreter, +# or finds the interpreter via the built-in cmake module. +######################################################################## +#this allows the user to override PYTHON_EXECUTABLE +IF(PYTHON_EXECUTABLE) + + SET(PYTHONINTERP_FOUND TRUE) + +#otherwise if not set, try to automatically find it +ELSE(PYTHON_EXECUTABLE) + + #use the built-in find script + FIND_PACKAGE(PythonInterp) + + #and if that fails use the find program routine + IF(NOT PYTHONINTERP_FOUND) + FIND_PROGRAM(PYTHON_EXECUTABLE NAMES python python2.7 python2.6 python2.5) + IF(PYTHON_EXECUTABLE) + SET(PYTHONINTERP_FOUND TRUE) + ENDIF(PYTHON_EXECUTABLE) + ENDIF(NOT PYTHONINTERP_FOUND) + +ENDIF(PYTHON_EXECUTABLE) + +#make the path to the executable appear in the cmake gui +SET(PYTHON_EXECUTABLE ${PYTHON_EXECUTABLE} CACHE FILEPATH "python interpreter") + +######################################################################## +# Check for the existence of a python module: +# - desc a string description of the check +# - mod the name of the module to import +# - cmd an additional command to run +# - have the result variable to set +######################################################################## +MACRO(GR_PYTHON_CHECK_MODULE desc mod cmd have) + MESSAGE(STATUS "") + MESSAGE(STATUS "Python checking for ${desc}") + EXECUTE_PROCESS( + COMMAND ${PYTHON_EXECUTABLE} -c " +######################################### +try: import ${mod} +except: exit(-1) +try: assert ${cmd} +except: exit(-1) +#########################################" + RESULT_VARIABLE ${have} + ) + IF(${have} EQUAL 0) + MESSAGE(STATUS "Python checking for ${desc} - found") + SET(${have} TRUE) + ELSE(${have} EQUAL 0) + MESSAGE(STATUS "Python checking for ${desc} - not found") + SET(${have} FALSE) + ENDIF(${have} EQUAL 0) +ENDMACRO(GR_PYTHON_CHECK_MODULE) + +######################################################################## +# Sets the python installation directory GR_PYTHON_DIR +######################################################################## +EXECUTE_PROCESS(COMMAND ${PYTHON_EXECUTABLE} -c " +from distutils import sysconfig +print sysconfig.get_python_lib(plat_specific=True, prefix='') +" OUTPUT_VARIABLE GR_PYTHON_DIR OUTPUT_STRIP_TRAILING_WHITESPACE +) +FILE(TO_CMAKE_PATH ${GR_PYTHON_DIR} GR_PYTHON_DIR) + +######################################################################## +# Create an always-built target with a unique name +# Usage: GR_UNIQUE_TARGET(<description> <dependencies list>) +######################################################################## +FUNCTION(GR_UNIQUE_TARGET desc) + FILE(RELATIVE_PATH reldir ${CMAKE_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}) + EXECUTE_PROCESS(COMMAND ${PYTHON_EXECUTABLE} -c "import re, hashlib +unique = hashlib.md5('${reldir}${ARGN}').hexdigest()[:5] +print(re.sub('\\W', '_', '${desc} ${reldir} ' + unique))" + OUTPUT_VARIABLE _target OUTPUT_STRIP_TRAILING_WHITESPACE) + ADD_CUSTOM_TARGET(${_target} ALL DEPENDS ${ARGN}) +ENDFUNCTION(GR_UNIQUE_TARGET) + +######################################################################## +# Install python sources (also builds and installs byte-compiled python) +######################################################################## +FUNCTION(GR_PYTHON_INSTALL) + INCLUDE(CMakeParseArgumentsCopy) + CMAKE_PARSE_ARGUMENTS(GR_PYTHON_INSTALL "" "DESTINATION;COMPONENT" "FILES;PROGRAMS" ${ARGN}) + + #################################################################### + IF(GR_PYTHON_INSTALL_FILES) + #################################################################### + INSTALL(${ARGN}) #installs regular python files + + FOREACH(pyfile ${GR_PYTHON_INSTALL_FILES}) + GET_FILENAME_COMPONENT(pyfile_name ${pyfile} NAME) + GET_FILENAME_COMPONENT(pyfile ${pyfile} ABSOLUTE) + STRING(REPLACE "${CMAKE_SOURCE_DIR}" "${CMAKE_BINARY_DIR}" pycfile "${pyfile}c") + LIST(APPEND python_install_gen_targets ${pycfile}) + + GET_FILENAME_COMPONENT(pycfile_path ${pycfile} PATH) + FILE(MAKE_DIRECTORY ${pycfile_path}) + + #create a command to generate the byte-compiled pyc file + ADD_CUSTOM_COMMAND( + OUTPUT ${pycfile} DEPENDS ${pyfile} + COMMAND ${PYTHON_EXECUTABLE} -c + \"import py_compile\; py_compile.compile(file='${pyfile}', cfile='${pycfile}', doraise=True)\" + COMMENT "Byte-compiling ${pyfile_name}" + ) + INSTALL(FILES ${pycfile} + DESTINATION ${GR_PYTHON_INSTALL_DESTINATION} + COMPONENT ${GR_PYTHON_INSTALL_COMPONENT} + ) + ENDFOREACH(pyfile) + + #################################################################### + ELSEIF(GR_PYTHON_INSTALL_PROGRAMS) + #################################################################### + FILE(TO_NATIVE_PATH ${PYTHON_EXECUTABLE} pyexe_native) + + FOREACH(pyfile ${GR_PYTHON_INSTALL_PROGRAMS}) + GET_FILENAME_COMPONENT(pyfile_name ${pyfile} NAME) + GET_FILENAME_COMPONENT(pyfile ${pyfile} ABSOLUTE) + STRING(REPLACE "${CMAKE_SOURCE_DIR}" "${CMAKE_BINARY_DIR}" pyexefile "${pyfile}.exe") + LIST(APPEND python_install_gen_targets ${pyexefile}) + + GET_FILENAME_COMPONENT(pyexefile_path ${pyexefile} PATH) + FILE(MAKE_DIRECTORY ${pyexefile_path}) + + ADD_CUSTOM_COMMAND( + OUTPUT ${pyexefile} DEPENDS ${pyfile} + COMMAND ${PYTHON_EXECUTABLE} -c + \"open('${pyexefile}', 'w').write('\#!${pyexe_native}\\n'+open('${pyfile}').read())\" + COMMENT "Shebangin ${pyfile_name}" + ) + + #on windows, python files need an extension to execute + GET_FILENAME_COMPONENT(pyfile_ext ${pyfile} EXT) + IF(WIN32 AND NOT pyfile_ext) + SET(pyfile_name "${pyfile_name}.py") + ENDIF() + + INSTALL(PROGRAMS ${pyexefile} RENAME ${pyfile_name} + DESTINATION ${GR_PYTHON_INSTALL_DESTINATION} + COMPONENT ${GR_PYTHON_INSTALL_COMPONENT} + ) + ENDFOREACH(pyfile) + + ENDIF() + + GR_UNIQUE_TARGET("pygen" ${python_install_gen_targets}) + +ENDFUNCTION(GR_PYTHON_INSTALL) diff --git a/gr-howto-write-a-block-cmake/cmake/Modules/GrSwig.cmake b/gr-howto-write-a-block-cmake/cmake/Modules/GrSwig.cmake new file mode 100644 index 000000000..9fca29a4f --- /dev/null +++ b/gr-howto-write-a-block-cmake/cmake/Modules/GrSwig.cmake @@ -0,0 +1,90 @@ +# Copyright 2010-2011 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio 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 General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. + +IF(DEFINED __INCLUDED_GR_SWIG_CMAKE) + RETURN() +ENDIF() +SET(__INCLUDED_GR_SWIG_CMAKE TRUE) + +######################################################################## +# Build a swig target for the common gnuradio use case. Usage: +# GR_SWIG_MAKE(target ifile ifile ifile...) +# +# Set the following variables before calling: +# - GR_SWIG_FLAGS +# - GR_SWIG_INCLUDE_DIRS +# - GR_SWIG_LIBRARIES +# - GR_SWIG_SOURCE_DEPS +# - GR_SWIG_TARGET_DEPS +######################################################################## +MACRO(GR_SWIG_MAKE name) + SET(ifiles ${ARGN}) + + INCLUDE_DIRECTORIES(${GR_SWIG_INCLUDE_DIRS}) + SET(SWIG_MODULE_${name}_EXTRA_DEPS ${GR_SWIG_SOURCE_DEPS}) + + FIND_PACKAGE(PythonLibs) + INCLUDE_DIRECTORIES(${PYTHON_INCLUDE_DIRS}) + + #setup the swig flags with flags and include directories + SET(CMAKE_SWIG_FLAGS -fvirtual -modern -keyword -w511 -module ${name} ${GR_SWIG_FLAGS}) + FOREACH(dir ${GR_SWIG_INCLUDE_DIRS}) + LIST(APPEND CMAKE_SWIG_FLAGS "-I${dir}") + ENDFOREACH(dir) + + #set the C++ property on the swig .i file so it builds + SET_SOURCE_FILES_PROPERTIES(${ifiles} PROPERTIES CPLUSPLUS ON) + + #setup the actual swig library target to be built + INCLUDE(UseSWIG) + SWIG_ADD_MODULE(${name} python ${ifiles}) + SWIG_LINK_LIBRARIES(${name} ${PYTHON_LIBRARIES} ${GR_SWIG_LIBRARIES}) + IF(GR_SWIG_TARGET_DEPS) + ADD_DEPENDENCIES(${SWIG_MODULE_${name}_REAL_NAME} ${GR_SWIG_TARGET_DEPS}) + ENDIF(GR_SWIG_TARGET_DEPS) + +ENDMACRO(GR_SWIG_MAKE) + +######################################################################## +# Install swig targets generated by GR_SWIG_MAKE. Usage: +# GR_SWIG_INSTALL( +# TARGETS target target target... +# [DESTINATION destination] +# [COMPONENT component] +# ) +######################################################################## +MACRO(GR_SWIG_INSTALL) + + INCLUDE(CMakeParseArgumentsCopy) + CMAKE_PARSE_ARGUMENTS(GR_SWIG_INSTALL "" "DESTINATION;COMPONENT" "TARGETS" ${ARGN}) + + FOREACH(name ${GR_SWIG_INSTALL_TARGETS}) + INSTALL(TARGETS ${SWIG_MODULE_${name}_REAL_NAME} + DESTINATION ${GR_SWIG_INSTALL_DESTINATION} + COMPONENT ${GR_SWIG_INSTALL_COMPONENT} + ) + + INCLUDE(GrPython) + GR_PYTHON_INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${name}.py + DESTINATION ${GR_SWIG_INSTALL_DESTINATION} + COMPONENT ${GR_SWIG_INSTALL_COMPONENT} + ) + ENDFOREACH(name) + +ENDMACRO(GR_SWIG_INSTALL) diff --git a/gr-howto-write-a-block-cmake/cmake/Modules/GrTest.cmake b/gr-howto-write-a-block-cmake/cmake/Modules/GrTest.cmake new file mode 100644 index 000000000..e9e2a0c2e --- /dev/null +++ b/gr-howto-write-a-block-cmake/cmake/Modules/GrTest.cmake @@ -0,0 +1,133 @@ +# Copyright 2010-2011 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio 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 General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. + +IF(DEFINED __INCLUDED_GR_TEST_CMAKE) + RETURN() +ENDIF() +SET(__INCLUDED_GR_TEST_CMAKE TRUE) + +######################################################################## +# Add a unit test and setup the environment for a unit test. +# Takes the same arguments as the ADD_TEST function. +# +# Before calling set the following variables: +# GR_TEST_TARGET_DEPS - built targets for the library path +# GR_TEST_LIBRARY_DIRS - directories for the library path +# GR_TEST_PYTHON_DIRS - directories for the python path +######################################################################## +FUNCTION(GR_ADD_TEST test_name) + + IF(WIN32) + #Ensure that the build exe also appears in the PATH. + LIST(APPEND GR_TEST_TARGET_DEPS ${ARGN}) + + #In the land of windows, all libraries must be in the PATH. + #Since the dependent libraries are not yet installed, + #we must manually set them in the PATH to run tests. + #The following appends the path of a target dependency. + FOREACH(target ${GR_TEST_TARGET_DEPS}) + GET_TARGET_PROPERTY(location ${target} LOCATION) + IF(location) + GET_FILENAME_COMPONENT(path ${location} PATH) + STRING(REGEX REPLACE "\\$\\(.*\\)" ${CMAKE_BUILD_TYPE} path ${path}) + LIST(APPEND GR_TEST_LIBRARY_DIRS ${path}) + ENDIF(location) + ENDFOREACH(target) + + #SWIG generates the python library files into a subdirectory. + #Therefore, we must append this subdirectory into PYTHONPATH. + #Only do this for the python directories matching the following: + FOREACH(pydir ${GR_TEST_PYTHON_DIRS}) + GET_FILENAME_COMPONENT(name ${pydir} NAME) + IF(name MATCHES "^(swig|lib|src)$") + LIST(APPEND GR_TEST_PYTHON_DIRS ${pydir}/${CMAKE_BUILD_TYPE}) + ENDIF() + ENDFOREACH(pydir) + ENDIF(WIN32) + + FILE(TO_NATIVE_PATH ${CMAKE_CURRENT_SOURCE_DIR} srcdir) + FILE(TO_NATIVE_PATH "${GR_TEST_LIBRARY_DIRS}" libpath) #ok to use on dir list? + FILE(TO_NATIVE_PATH "${GR_TEST_PYTHON_DIRS}" pypath) #ok to use on dir list? + + SET(environs "GR_DONT_LOAD_PREFS=1" "srcdir=${srcdir}") + + #http://www.cmake.org/pipermail/cmake/2009-May/029464.html + #Replaced this add test + set environs code with the shell script generation. + #Its nicer to be able to manually run the shell script to diagnose problems. + #ADD_TEST(${ARGV}) + #SET_TESTS_PROPERTIES(${test_name} PROPERTIES ENVIRONMENT "${environs}") + + IF(UNIX) + SET(binpath "${CMAKE_CURRENT_BINARY_DIR}:$PATH") + #set both LD and DYLD paths to cover multiple UNIX OS library paths + LIST(APPEND libpath "$LD_LIBRARY_PATH" "$DYLD_LIBRARY_PATH") + LIST(APPEND pypath "$PYTHONPATH") + + #replace list separator with the path separator + STRING(REPLACE ";" ":" libpath "${libpath}") + STRING(REPLACE ";" ":" pypath "${pypath}") + LIST(APPEND environs "PATH=${binpath}" "LD_LIBRARY_PATH=${libpath}" "DYLD_LIBRARY_PATH=${libpath}" "PYTHONPATH=${pypath}") + + #generate a bat file that sets the environment and runs the test + FIND_PROGRAM(SHELL sh) + SET(sh_file ${CMAKE_CURRENT_BINARY_DIR}/${test_name}_test.sh) + FILE(WRITE ${sh_file} "#!${SHELL}\n") + #each line sets an environment variable + FOREACH(environ ${environs}) + FILE(APPEND ${sh_file} "export ${environ}\n") + ENDFOREACH(environ) + #load the command to run with its arguments + FOREACH(arg ${ARGN}) + FILE(APPEND ${sh_file} "${arg} ") + ENDFOREACH(arg) + FILE(APPEND ${sh_file} "\n") + + #make the shell file executable + EXECUTE_PROCESS(COMMAND chmod +x ${sh_file}) + + ADD_TEST(${test_name} ${SHELL} ${sh_file}) + + ENDIF(UNIX) + + IF(WIN32) + LIST(APPEND libpath ${DLL_PATHS} "%PATH%") + LIST(APPEND pypath "%PYTHONPATH%") + + #replace list separator with the path separator (escaped) + STRING(REPLACE ";" "\\;" libpath "${libpath}") + STRING(REPLACE ";" "\\;" pypath "${pypath}") + LIST(APPEND environs "PATH=${libpath}" "PYTHONPATH=${pypath}") + + #generate a bat file that sets the environment and runs the test + SET(bat_file ${CMAKE_CURRENT_BINARY_DIR}/${test_name}_test.bat) + FILE(WRITE ${bat_file} "@echo off\n") + #each line sets an environment variable + FOREACH(environ ${environs}) + FILE(APPEND ${bat_file} "SET ${environ}\n") + ENDFOREACH(environ) + #load the command to run with its arguments + FOREACH(arg ${ARGN}) + FILE(APPEND ${bat_file} "${arg} ") + ENDFOREACH(arg) + FILE(APPEND ${bat_file} "\n") + + ADD_TEST(${test_name} ${bat_file}) + ENDIF(WIN32) + +ENDFUNCTION(GR_ADD_TEST) diff --git a/gr-howto-write-a-block-cmake/grc/CMakeLists.txt b/gr-howto-write-a-block-cmake/grc/CMakeLists.txt new file mode 100644 index 000000000..257113079 --- /dev/null +++ b/gr-howto-write-a-block-cmake/grc/CMakeLists.txt @@ -0,0 +1,24 @@ +# Copyright 2011 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio 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 General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. + +INSTALL(FILES + howto_square_ff.xml + howto_square2_ff.xml + DESTINATION share/gnuradio/grc/blocks +) diff --git a/gr-howto-write-a-block-cmake/grc/howto_square2_ff.xml b/gr-howto-write-a-block-cmake/grc/howto_square2_ff.xml new file mode 100644 index 000000000..c58ef0047 --- /dev/null +++ b/gr-howto-write-a-block-cmake/grc/howto_square2_ff.xml @@ -0,0 +1,18 @@ +<?xml version="1.0"?> +<block> + <name>Square2</name> + <key>howto_square2_ff</key> + <category>HOWTO</category> + <import>import howto</import> + <make>howto.square2_ff()</make> + + <sink> + <name>in</name> + <type>float</type> + </sink> + + <source> + <name>out</name> + <type>float</type> + </source> +</block> diff --git a/gr-howto-write-a-block-cmake/grc/howto_square_ff.xml b/gr-howto-write-a-block-cmake/grc/howto_square_ff.xml new file mode 100644 index 000000000..34a0b0a3f --- /dev/null +++ b/gr-howto-write-a-block-cmake/grc/howto_square_ff.xml @@ -0,0 +1,18 @@ +<?xml version="1.0"?> +<block> + <name>Square</name> + <key>howto_square_ff</key> + <category>HOWTO</category> + <import>import howto</import> + <make>howto.square_ff()</make> + + <sink> + <name>in</name> + <type>float</type> + </sink> + + <source> + <name>out</name> + <type>float</type> + </source> +</block> diff --git a/gr-howto-write-a-block-cmake/lib/CMakeLists.txt b/gr-howto-write-a-block-cmake/lib/CMakeLists.txt new file mode 100644 index 000000000..798bc6ad6 --- /dev/null +++ b/gr-howto-write-a-block-cmake/lib/CMakeLists.txt @@ -0,0 +1,64 @@ +# Copyright 2011 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio 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 General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. + +######################################################################## +# Setup library +######################################################################## +INCLUDE(GrPlatform) #define LIB_SUFFIX + +ADD_LIBRARY(gnuradio-howto SHARED howto_square_ff.cc howto_square2_ff.cc) +TARGET_LINK_LIBRARIES(gnuradio-howto ${Boost_LIBRARIES} ${GRUEL_LIBRARIES} ${GNURADIO_CORE_LIBRARIES}) +SET_TARGET_PROPERTIES(gnuradio-howto PROPERTIES DEFINE_SYMBOL "gnuradio_howto_EXPORTS") + +######################################################################## +# Install built library files +######################################################################## +INSTALL(TARGETS gnuradio-howto + LIBRARY DESTINATION ${LIB_SUFFIX}/lib # .so/.dylib file + ARCHIVE DESTINATION ${LIB_SUFFIX}/lib # .lib file + RUNTIME DESTINATION bin # .dll file +) + +######################################################################## +# Install public header files +######################################################################## +INSTALL(FILES + howto_api.h + howto_square_ff.h + howto_square2_ff.h + DESTINATION include/howto +) + +######################################################################## +# Build and register unit test +######################################################################## +FIND_PACKAGE(Boost COMPONENTS unit_test_framework) + +INCLUDE(GrTest) +SET(GR_TEST_TARGET_DEPS gnuradio-howto) +#turn each test cpp file into an executable with an int main() function +ADD_DEFINITIONS(-DBOOST_TEST_DYN_LINK -DBOOST_TEST_MAIN) + +ADD_EXECUTABLE(qa_howto_square_ff qa_howto_square_ff.cc) +TARGET_LINK_LIBRARIES(qa_howto_square_ff gnuradio-howto ${Boost_LIBRARIES}) +GR_ADD_TEST(qa_howto_square_ff qa_howto_square_ff) + +ADD_EXECUTABLE(qa_howto_square2_ff qa_howto_square2_ff.cc) +TARGET_LINK_LIBRARIES(qa_howto_square2_ff gnuradio-howto ${Boost_LIBRARIES}) +GR_ADD_TEST(qa_howto_square2_ff qa_howto_square2_ff) diff --git a/gr-howto-write-a-block-cmake/lib/howto_api.h b/gr-howto-write-a-block-cmake/lib/howto_api.h new file mode 100644 index 000000000..5263a1cf7 --- /dev/null +++ b/gr-howto-write-a-block-cmake/lib/howto_api.h @@ -0,0 +1,33 @@ +/* + * Copyright 2011 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio 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 General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifndef INCLUDED_HOWTO_API_H +#define INCLUDED_HOWTO_API_H + +#include <gruel/attributes.h> + +#ifdef gnuradio_howto_EXPORTS +# define HOWTO_API __GR_ATTR_EXPORT +#else +# define HOWTO_API __GR_ATTR_IMPORT +#endif + +#endif /* INCLUDED_HOWTO_API_H */ diff --git a/gr-howto-write-a-block-cmake/lib/howto_square2_ff.cc b/gr-howto-write-a-block-cmake/lib/howto_square2_ff.cc new file mode 100644 index 000000000..5e0fd7a43 --- /dev/null +++ b/gr-howto-write-a-block-cmake/lib/howto_square2_ff.cc @@ -0,0 +1,92 @@ +/* -*- c++ -*- */ +/* + * Copyright 2004,2010 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio 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 General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +/* + * config.h is generated by configure. It contains the results + * of probing for features, options etc. It should be the first + * file included in your .cc file. + */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <howto_square2_ff.h> +#include <gr_io_signature.h> + +/* + * Create a new instance of howto_square2_ff and return + * a boost shared_ptr. This is effectively the public constructor. + */ +howto_square2_ff_sptr +howto_make_square2_ff () +{ + return gnuradio::get_initial_sptr(new howto_square2_ff ()); +} + +/* + * Specify constraints on number of input and output streams. + * This info is used to construct the input and output signatures + * (2nd & 3rd args to gr_block's constructor). The input and + * output signatures are used by the runtime system to + * check that a valid number and type of inputs and outputs + * are connected to this block. In this case, we accept + * only 1 input and 1 output. + */ +static const int MIN_IN = 1; // mininum number of input streams +static const int MAX_IN = 1; // maximum number of input streams +static const int MIN_OUT = 1; // minimum number of output streams +static const int MAX_OUT = 1; // maximum number of output streams + +/* + * The private constructor + */ +howto_square2_ff::howto_square2_ff () + : gr_sync_block ("square2_ff", + gr_make_io_signature (MIN_IN, MAX_IN, sizeof (float)), + gr_make_io_signature (MIN_OUT, MAX_OUT, sizeof (float))) +{ + // nothing else required in this example +} + +/* + * Our virtual destructor. + */ +howto_square2_ff::~howto_square2_ff () +{ + // nothing else required in this example +} + +int +howto_square2_ff::work (int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items) +{ + const float *in = (const float *) input_items[0]; + float *out = (float *) output_items[0]; + + for (int i = 0; i < noutput_items; i++){ + out[i] = in[i] * in[i]; + } + + // Tell runtime system how many output items we produced. + return noutput_items; +} diff --git a/gr-howto-write-a-block-cmake/lib/howto_square2_ff.h b/gr-howto-write-a-block-cmake/lib/howto_square2_ff.h new file mode 100644 index 000000000..c45a1851f --- /dev/null +++ b/gr-howto-write-a-block-cmake/lib/howto_square2_ff.h @@ -0,0 +1,78 @@ +/* -*- c++ -*- */ +/* + * Copyright 2004 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio 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 General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ +#ifndef INCLUDED_HOWTO_SQUARE2_FF_H +#define INCLUDED_HOWTO_SQUARE2_FF_H + +#include <howto_api.h> +#include <gr_sync_block.h> + +class howto_square2_ff; + +/* + * We use boost::shared_ptr's instead of raw pointers for all access + * to gr_blocks (and many other data structures). The shared_ptr gets + * us transparent reference counting, which greatly simplifies storage + * management issues. This is especially helpful in our hybrid + * C++ / Python system. + * + * See http://www.boost.org/libs/smart_ptr/smart_ptr.htm + * + * As a convention, the _sptr suffix indicates a boost::shared_ptr + */ +typedef boost::shared_ptr<howto_square2_ff> howto_square2_ff_sptr; + +/*! + * \brief Return a shared_ptr to a new instance of howto_square2_ff. + * + * To avoid accidental use of raw pointers, howto_square2_ff's + * constructor is private. howto_make_square2_ff is the public + * interface for creating new instances. + */ +HOWTO_API howto_square2_ff_sptr howto_make_square2_ff (); + +/*! + * \brief square2 a stream of floats. + * \ingroup block + * + * This uses the preferred technique: subclassing gr_sync_block. + */ +class HOWTO_API howto_square2_ff : public gr_sync_block +{ +private: + // The friend declaration allows howto_make_square2_ff to + // access the private constructor. + + friend HOWTO_API howto_square2_ff_sptr howto_make_square2_ff (); + + howto_square2_ff (); // private constructor + + public: + ~howto_square2_ff (); // public destructor + + // Where all the action really happens + + int work (int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items); +}; + +#endif /* INCLUDED_HOWTO_SQUARE2_FF_H */ diff --git a/gr-howto-write-a-block-cmake/lib/howto_square_ff.cc b/gr-howto-write-a-block-cmake/lib/howto_square_ff.cc new file mode 100644 index 000000000..f1d5a7848 --- /dev/null +++ b/gr-howto-write-a-block-cmake/lib/howto_square_ff.cc @@ -0,0 +1,98 @@ +/* -*- c++ -*- */ +/* + * Copyright 2004,2010 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio 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 General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +/* + * config.h is generated by configure. It contains the results + * of probing for features, options etc. It should be the first + * file included in your .cc file. + */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <howto_square_ff.h> +#include <gr_io_signature.h> + +/* + * Create a new instance of howto_square_ff and return + * a boost shared_ptr. This is effectively the public constructor. + */ +howto_square_ff_sptr +howto_make_square_ff () +{ + return gnuradio::get_initial_sptr(new howto_square_ff ()); +} + +/* + * Specify constraints on number of input and output streams. + * This info is used to construct the input and output signatures + * (2nd & 3rd args to gr_block's constructor). The input and + * output signatures are used by the runtime system to + * check that a valid number and type of inputs and outputs + * are connected to this block. In this case, we accept + * only 1 input and 1 output. + */ +static const int MIN_IN = 1; // mininum number of input streams +static const int MAX_IN = 1; // maximum number of input streams +static const int MIN_OUT = 1; // minimum number of output streams +static const int MAX_OUT = 1; // maximum number of output streams + +/* + * The private constructor + */ +howto_square_ff::howto_square_ff () + : gr_block ("square_ff", + gr_make_io_signature (MIN_IN, MAX_IN, sizeof (float)), + gr_make_io_signature (MIN_OUT, MAX_OUT, sizeof (float))) +{ + // nothing else required in this example +} + +/* + * Our virtual destructor. + */ +howto_square_ff::~howto_square_ff () +{ + // nothing else required in this example +} + +int +howto_square_ff::general_work (int noutput_items, + gr_vector_int &ninput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items) +{ + const float *in = (const float *) input_items[0]; + float *out = (float *) output_items[0]; + + for (int i = 0; i < noutput_items; i++){ + out[i] = in[i] * in[i]; + } + + // Tell runtime system how many input items we consumed on + // each input stream. + + consume_each (noutput_items); + + // Tell runtime system how many output items we produced. + return noutput_items; +} diff --git a/gr-howto-write-a-block-cmake/lib/howto_square_ff.h b/gr-howto-write-a-block-cmake/lib/howto_square_ff.h new file mode 100644 index 000000000..f07a1d4f6 --- /dev/null +++ b/gr-howto-write-a-block-cmake/lib/howto_square_ff.h @@ -0,0 +1,79 @@ +/* -*- c++ -*- */ +/* + * Copyright 2004 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio 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 General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ +#ifndef INCLUDED_HOWTO_SQUARE_FF_H +#define INCLUDED_HOWTO_SQUARE_FF_H + +#include <howto_api.h> +#include <gr_block.h> + +class howto_square_ff; + +/* + * We use boost::shared_ptr's instead of raw pointers for all access + * to gr_blocks (and many other data structures). The shared_ptr gets + * us transparent reference counting, which greatly simplifies storage + * management issues. This is especially helpful in our hybrid + * C++ / Python system. + * + * See http://www.boost.org/libs/smart_ptr/smart_ptr.htm + * + * As a convention, the _sptr suffix indicates a boost::shared_ptr + */ +typedef boost::shared_ptr<howto_square_ff> howto_square_ff_sptr; + +/*! + * \brief Return a shared_ptr to a new instance of howto_square_ff. + * + * To avoid accidental use of raw pointers, howto_square_ff's + * constructor is private. howto_make_square_ff is the public + * interface for creating new instances. + */ +HOWTO_API howto_square_ff_sptr howto_make_square_ff (); + +/*! + * \brief square a stream of floats. + * \ingroup block + * + * \sa howto_square2_ff for a version that subclasses gr_sync_block. + */ +class HOWTO_API howto_square_ff : public gr_block +{ +private: + // The friend declaration allows howto_make_square_ff to + // access the private constructor. + + friend HOWTO_API howto_square_ff_sptr howto_make_square_ff (); + + howto_square_ff (); // private constructor + + public: + ~howto_square_ff (); // public destructor + + // Where all the action really happens + + int general_work (int noutput_items, + gr_vector_int &ninput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items); +}; + +#endif /* INCLUDED_HOWTO_SQUARE_FF_H */ diff --git a/gr-howto-write-a-block-cmake/lib/qa_howto_square2_ff.cc b/gr-howto-write-a-block-cmake/lib/qa_howto_square2_ff.cc new file mode 100644 index 000000000..9c37b62c1 --- /dev/null +++ b/gr-howto-write-a-block-cmake/lib/qa_howto_square2_ff.cc @@ -0,0 +1,32 @@ +/* -*- c++ -*- */ +/* + * Copyright 2011 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio 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 General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#include <boost/test/unit_test.hpp> + +BOOST_AUTO_TEST_CASE(qa_howto_square2_ff_t1){ + BOOST_CHECK_EQUAL(2 + 2, 4); + // TODO BOOST_* test macros here +} + +BOOST_AUTO_TEST_CASE(qa_howto_square2_ff_t2){ + BOOST_CHECK_EQUAL(2 + 2, 4); + // TODO BOOST_* test macros here +} diff --git a/gr-howto-write-a-block-cmake/lib/qa_howto_square_ff.cc b/gr-howto-write-a-block-cmake/lib/qa_howto_square_ff.cc new file mode 100644 index 000000000..da1d3040a --- /dev/null +++ b/gr-howto-write-a-block-cmake/lib/qa_howto_square_ff.cc @@ -0,0 +1,32 @@ +/* -*- c++ -*- */ +/* + * Copyright 2011 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio 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 General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#include <boost/test/unit_test.hpp> + +BOOST_AUTO_TEST_CASE(qa_howto_square_ff_t1){ + BOOST_CHECK_EQUAL(2 + 2, 4); + // TODO BOOST_* test macros here +} + +BOOST_AUTO_TEST_CASE(qa_howto_square_ff_t2){ + BOOST_CHECK_EQUAL(2 + 2, 4); + // TODO BOOST_* test macros here +} diff --git a/gr-howto-write-a-block-cmake/python/CMakeLists.txt b/gr-howto-write-a-block-cmake/python/CMakeLists.txt new file mode 100644 index 000000000..6208f8a87 --- /dev/null +++ b/gr-howto-write-a-block-cmake/python/CMakeLists.txt @@ -0,0 +1,44 @@ +# Copyright 2011 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio 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 General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. + +######################################################################## +# Include python install macros +######################################################################## +INCLUDE(GrPython) +IF(NOT PYTHONINTERP_FOUND) + RETURN() +ENDIF() + +######################################################################## +# Install python sources +######################################################################## +GR_PYTHON_INSTALL( + FILES + __init__.py + DESTINATION ${GR_PYTHON_DIR}/howto +) + +######################################################################## +# Handle the unit tests +######################################################################## +INCLUDE(GrTest) + +SET(GR_TEST_TARGET_DEPS gnuradio-howto) +SET(GR_TEST_PYTHON_DIRS ${CMAKE_BINARY_DIR}/swig) +GR_ADD_TEST(qa_howto ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/qa_howto.py) diff --git a/gr-howto-write-a-block-cmake/python/__init__.py b/gr-howto-write-a-block-cmake/python/__init__.py new file mode 100644 index 000000000..d4a41c271 --- /dev/null +++ b/gr-howto-write-a-block-cmake/python/__init__.py @@ -0,0 +1,49 @@ +# +# Copyright 2008,2009 Free Software Foundation, Inc. +# +# This application is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# This application 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 General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +# + +# The presence of this file turns this directory into a Python package + +# ---------------------------------------------------------------- +# Temporary workaround for ticket:181 (swig+python problem) +import sys +_RTLD_GLOBAL = 0 +try: + from dl import RTLD_GLOBAL as _RTLD_GLOBAL +except ImportError: + try: + from DLFCN import RTLD_GLOBAL as _RTLD_GLOBAL + except ImportError: + pass + +if _RTLD_GLOBAL != 0: + _dlopenflags = sys.getdlopenflags() + sys.setdlopenflags(_dlopenflags|_RTLD_GLOBAL) +# ---------------------------------------------------------------- + + +# import swig generated symbols into the howto namespace +from howto_swig import * + +# import any pure python here +# + +# ---------------------------------------------------------------- +# Tail of workaround +if _RTLD_GLOBAL != 0: + sys.setdlopenflags(_dlopenflags) # Restore original flags +# ---------------------------------------------------------------- diff --git a/gr-howto-write-a-block-cmake/python/qa_howto.py b/gr-howto-write-a-block-cmake/python/qa_howto.py new file mode 100755 index 000000000..630f57bf4 --- /dev/null +++ b/gr-howto-write-a-block-cmake/python/qa_howto.py @@ -0,0 +1,59 @@ +#!/usr/bin/env python +# +# Copyright 2004,2007 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio 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 General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. +# + +from gnuradio import gr, gr_unittest +import howto_swig + +class qa_howto (gr_unittest.TestCase): + + def setUp (self): + self.tb = gr.top_block () + + def tearDown (self): + self.tb = None + + def test_001_square_ff (self): + src_data = (-3, 4, -5.5, 2, 3) + expected_result = (9, 16, 30.25, 4, 9) + src = gr.vector_source_f (src_data) + sqr = howto_swig.square_ff () + dst = gr.vector_sink_f () + self.tb.connect (src, sqr) + self.tb.connect (sqr, dst) + self.tb.run () + result_data = dst.data () + self.assertFloatTuplesAlmostEqual (expected_result, result_data, 6) + + def test_002_square2_ff (self): + src_data = (-3, 4, -5.5, 2, 3) + expected_result = (9, 16, 30.25, 4, 9) + src = gr.vector_source_f (src_data) + sqr = howto_swig.square2_ff () + dst = gr.vector_sink_f () + self.tb.connect (src, sqr) + self.tb.connect (sqr, dst) + self.tb.run () + result_data = dst.data () + self.assertFloatTuplesAlmostEqual (expected_result, result_data, 6) + +if __name__ == '__main__': + gr_unittest.main () diff --git a/gr-howto-write-a-block-cmake/swig/CMakeLists.txt b/gr-howto-write-a-block-cmake/swig/CMakeLists.txt new file mode 100644 index 000000000..40f2b1051 --- /dev/null +++ b/gr-howto-write-a-block-cmake/swig/CMakeLists.txt @@ -0,0 +1,55 @@ +# Copyright 2011 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio 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 General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. + +######################################################################## +# Include swig generation macros +######################################################################## +FIND_PACKAGE(SWIG) +FIND_PACKAGE(PythonLibs) +IF(NOT SWIG_FOUND OR NOT PYTHONLIBS_FOUND) + RETURN() +ENDIF() +INCLUDE(GrSwig) + +######################################################################## +# Setup swig generation +######################################################################## +FOREACH(incdir ${GNURADIO_CORE_INCLUDE_DIRS}) + LIST(APPEND GR_SWIG_INCLUDE_DIRS ${incdir}/swig) +ENDFOREACH(incdir) + +SET(GR_SWIG_LIBRARIES gnuradio-howto) + +GR_SWIG_MAKE(howto_swig howto_swig.i) + +######################################################################## +# Install the build swig module +######################################################################## +GR_SWIG_INSTALL(TARGETS howto_swig DESTINATION ${GR_PYTHON_DIR}/howto) + +######################################################################## +# Install swig .i files for development +######################################################################## +INSTALL( + FILES + howto_swig.i + howto_square_ff.i + howto_square2_ff.i + DESTINATION include/howto/swig +) diff --git a/gr-howto-write-a-block-cmake/swig/howto_square2_ff.i b/gr-howto-write-a-block-cmake/swig/howto_square2_ff.i new file mode 100644 index 000000000..683a93d61 --- /dev/null +++ b/gr-howto-write-a-block-cmake/swig/howto_square2_ff.i @@ -0,0 +1,9 @@ +GR_SWIG_BLOCK_MAGIC(howto,square2_ff); + +howto_square2_ff_sptr howto_make_square2_ff (); + +class howto_square2_ff : public gr_sync_block +{ +private: + howto_square2_ff (); +}; diff --git a/gr-howto-write-a-block-cmake/swig/howto_square_ff.i b/gr-howto-write-a-block-cmake/swig/howto_square_ff.i new file mode 100644 index 000000000..f8ae76986 --- /dev/null +++ b/gr-howto-write-a-block-cmake/swig/howto_square_ff.i @@ -0,0 +1,16 @@ +/* + * First arg is the package prefix. + * Second arg is the name of the class minus the prefix. + * + * This does some behind-the-scenes magic so we can + * access howto_square_ff from python as howto.square_ff + */ +GR_SWIG_BLOCK_MAGIC(howto,square_ff); + +howto_square_ff_sptr howto_make_square_ff (); + +class howto_square_ff : public gr_block +{ +private: + howto_square_ff (); +}; diff --git a/gr-howto-write-a-block-cmake/swig/howto_swig.i b/gr-howto-write-a-block-cmake/swig/howto_swig.i new file mode 100644 index 000000000..d0bbcdc11 --- /dev/null +++ b/gr-howto-write-a-block-cmake/swig/howto_swig.i @@ -0,0 +1,21 @@ +/* -*- c++ -*- */ + +%include "gnuradio.i" // the common stuff + +%{ +#include "howto_square_ff.h" +#include "howto_square2_ff.h" +%} + +%include "howto_square_ff.i" +%include "howto_square2_ff.i" + +#if SWIGGUILE +%scheme %{ +(load-extension-global "libguile-gnuradio-howto_swig" "scm_init_gnuradio_howto_swig_module") +%} + +%goops %{ +(use-modules (gnuradio gnuradio_core_runtime)) +%} +#endif diff --git a/gr-noaa/CMakeLists.txt b/gr-noaa/CMakeLists.txt new file mode 100644 index 000000000..b854a5e18 --- /dev/null +++ b/gr-noaa/CMakeLists.txt @@ -0,0 +1,87 @@ +# Copyright 2011 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio 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 General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. + +######################################################################## +# Setup dependencies +######################################################################## +INCLUDE(GrBoost) + +######################################################################## +# Register component +######################################################################## +INCLUDE(GrComponent) +GR_REGISTER_COMPONENT("gr-noaa" ENABLE_GR_NOAA + Boost_FOUND + ENABLE_GR_CORE_ +) + +GR_SET_GLOBAL(GR_NOAA_INCLUDE_DIRS + ${CMAKE_CURRENT_SOURCE_DIR}/lib +) + +######################################################################## +# Begin conditional configuration +######################################################################## +IF(ENABLE_GR_NOAA) + +######################################################################## +# Setup CPack components +######################################################################## +INCLUDE(GrPackage) +CPACK_SET(CPACK_COMPONENT_GROUP_NOAA_DESCRIPTION "GNU Radio NOAA Blocks") + +CPACK_COMPONENT("noaa_runtime" + GROUP "NOAA" + DISPLAY_NAME "Runtime" + DESCRIPTION "Runtime" + DEPENDS "core_runtime" +) + +CPACK_COMPONENT("noaa_devel" + GROUP "NOAA" + DISPLAY_NAME "Development" + DESCRIPTION "C++ headers, package config, import libraries" + DEPENDS "core_devel" +) + +CPACK_COMPONENT("noaa_python" + GROUP "NOAA" + DISPLAY_NAME "Python" + DESCRIPTION "Python modules for runtime; GRC xml files" + DEPENDS "core_python;noaa_runtime" +) + +CPACK_COMPONENT("noaa_swig" + GROUP "NOAA" + DISPLAY_NAME "SWIG" + DESCRIPTION "SWIG development .i files" + DEPENDS "core_swig;noaa_python;noaa_devel" +) + +######################################################################## +# Add subdirectories +######################################################################## +ADD_SUBDIRECTORY(lib) +IF(ENABLE_PYTHON) + ADD_SUBDIRECTORY(swig) + ADD_SUBDIRECTORY(grc) + ADD_SUBDIRECTORY(apps) +ENDIF(ENABLE_PYTHON) + +ENDIF(ENABLE_GR_NOAA) diff --git a/gr-noaa/apps/.gitignore b/gr-noaa/apps/.gitignore index cd8d543cc..be02dd265 100644 --- a/gr-noaa/apps/.gitignore +++ b/gr-noaa/apps/.gitignore @@ -1,3 +1,3 @@ *.dat -*.txt +#*.txt *.hrpt diff --git a/gr-noaa/apps/CMakeLists.txt b/gr-noaa/apps/CMakeLists.txt new file mode 100644 index 000000000..8ec45eb7d --- /dev/null +++ b/gr-noaa/apps/CMakeLists.txt @@ -0,0 +1,33 @@ +# Copyright 2011 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio 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 General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. + +INCLUDE(GrPython) + +GR_PYTHON_INSTALL( + PROGRAMS + hrpt_decode.py + hrpt_demod.py + file_rx_hrpt.py + file_rx_lrit.py + #usrp_rx_hrpt.py #FIXME no support for usrp + #usrp_rx_hrpt_nogui.py + #usrp_rx_lrit.py + DESTINATION ${GR_RUNTIME_DIR} + COMPONENT "noaa_python" +) diff --git a/gnuradio-examples/python/digital_voice/Makefile.am b/gr-noaa/grc/CMakeLists.txt index 60f363b90..99f8bc837 100644 --- a/gnuradio-examples/python/digital_voice/Makefile.am +++ b/gr-noaa/grc/CMakeLists.txt @@ -1,5 +1,4 @@ -# -# Copyright 2004,2005,2009 Free Software Foundation, Inc. +# Copyright 2011 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -17,12 +16,11 @@ # along with GNU Radio; see the file COPYING. If not, write to # the Free Software Foundation, Inc., 51 Franklin Street, # Boston, MA 02110-1301, USA. -# - -include $(top_srcdir)/Makefile.common - -ourdatadir = $(exampledir)/digital_voice -dist_ourdata_SCRIPTS = \ - encdec.py \ - cvsd_test.py +INSTALL(FILES + noaa_hrpt_decoder.xml + noaa_hrpt_deframer.xml + noaa_hrpt_pll_cf.xml + DESTINATION ${GRC_BLOCKS_DIR} + COMPONENT "noaa_python" +) diff --git a/gr-noaa/lib/CMakeLists.txt b/gr-noaa/lib/CMakeLists.txt new file mode 100644 index 000000000..2388a450e --- /dev/null +++ b/gr-noaa/lib/CMakeLists.txt @@ -0,0 +1,66 @@ +# Copyright 2011 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio 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 General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. + +######################################################################## +# Setup the include and linker paths +######################################################################## +INCLUDE_DIRECTORIES( + ${GNURADIO_CORE_INCLUDE_DIRS} + ${GR_NOAA_INCLUDE_DIRS} +) + +INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIRS}) +LINK_DIRECTORIES(${Boost_LIBRARY_DIRS}) + +######################################################################## +# Setup library +######################################################################## +LIST(APPEND gr_noaa_sources + noaa_hrpt_decoder.cc + noaa_hrpt_deframer.cc + noaa_hrpt_pll_cf.cc +) + +LIST(APPEND noaa_libs + gnuradio-core + ${Boost_LIBRARIES} +) + +ADD_LIBRARY(gnuradio-noaa SHARED ${gr_noaa_sources}) +TARGET_LINK_LIBRARIES(gnuradio-noaa ${noaa_libs}) +SET_TARGET_PROPERTIES(gnuradio-noaa PROPERTIES DEFINE_SYMBOL "gnuradio_noaa_EXPORTS") +SET_TARGET_PROPERTIES(gnuradio-noaa PROPERTIES SOVERSION ${LIBVER}) + +INSTALL(TARGETS gnuradio-noaa + LIBRARY DESTINATION ${GR_LIBRARY_DIR} COMPONENT "noaa_runtime" # .so/.dylib file + ARCHIVE DESTINATION ${GR_LIBRARY_DIR} COMPONENT "noaa_devel" # .lib file + RUNTIME DESTINATION ${GR_RUNTIME_DIR} COMPONENT "noaa_runtime" # .dll file +) + +######################################################################## +# Install header files +######################################################################## +INSTALL(FILES + noaa_api.h + noaa_hrpt_decoder.h + noaa_hrpt_deframer.h + noaa_hrpt_pll_cf.h + DESTINATION ${GR_INCLUDE_DIR}/gnuradio + COMPONENT "noaa_devel" +) diff --git a/gr-noaa/lib/Makefile.am b/gr-noaa/lib/Makefile.am index ba660a398..8eedbbb18 100644 --- a/gr-noaa/lib/Makefile.am +++ b/gr-noaa/lib/Makefile.am @@ -42,6 +42,7 @@ libgnuradio_noaa_la_LIBADD = \ libgnuradio_noaa_la_LDFLAGS = $(NO_UNDEFINED) $(LTVERSIONFLAGS) grinclude_HEADERS = \ + noaa_api.h \ noaa_hrpt_decoder.h \ noaa_hrpt_deframer.h \ noaa_hrpt_pll_cf.h diff --git a/gr-noaa/lib/noaa_api.h b/gr-noaa/lib/noaa_api.h new file mode 100644 index 000000000..d3c3fbf2d --- /dev/null +++ b/gr-noaa/lib/noaa_api.h @@ -0,0 +1,33 @@ +/* + * Copyright 2011 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio 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 General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifndef INCLUDED_NOAA_API_H +#define INCLUDED_NOAA_API_H + +#include <gruel/attributes.h> + +#ifdef gnuradio_noaa_EXPORTS +# define NOAA_API __GR_ATTR_EXPORT +#else +# define NOAA_API __GR_ATTR_IMPORT +#endif + +#endif /* INCLUDED_NOAA_API_H */ diff --git a/gr-noaa/lib/noaa_hrpt_decoder.h b/gr-noaa/lib/noaa_hrpt_decoder.h index 9d67d7108..4db09106e 100644 --- a/gr-noaa/lib/noaa_hrpt_decoder.h +++ b/gr-noaa/lib/noaa_hrpt_decoder.h @@ -23,17 +23,18 @@ #ifndef INCLUDED_NOAA_HRPT_DECODER_H #define INCLUDED_NOAA_HRPT_DECODER_H +#include <noaa_api.h> #include <gr_sync_block.h> class noaa_hrpt_decoder; typedef boost::shared_ptr<noaa_hrpt_decoder> noaa_hrpt_decoder_sptr; -noaa_hrpt_decoder_sptr +NOAA_API noaa_hrpt_decoder_sptr noaa_make_hrpt_decoder(bool verbose, bool output_files); -class noaa_hrpt_decoder : public gr_sync_block +class NOAA_API noaa_hrpt_decoder : public gr_sync_block { - friend noaa_hrpt_decoder_sptr noaa_make_hrpt_decoder(bool verbose, bool output_files); + friend NOAA_API noaa_hrpt_decoder_sptr noaa_make_hrpt_decoder(bool verbose, bool output_files); noaa_hrpt_decoder(bool verbose, bool output_files); // Configuration diff --git a/gr-noaa/lib/noaa_hrpt_deframer.h b/gr-noaa/lib/noaa_hrpt_deframer.h index b11d0fa2b..d254746af 100644 --- a/gr-noaa/lib/noaa_hrpt_deframer.h +++ b/gr-noaa/lib/noaa_hrpt_deframer.h @@ -23,17 +23,18 @@ #ifndef INCLUDED_NOAA_HRPT_DEFRAMER_H #define INCLUDED_NOAA_HRPT_DEFRAMER_H +#include <noaa_api.h> #include <gr_block.h> class noaa_hrpt_deframer; typedef boost::shared_ptr<noaa_hrpt_deframer> noaa_hrpt_deframer_sptr; -noaa_hrpt_deframer_sptr +NOAA_API noaa_hrpt_deframer_sptr noaa_make_hrpt_deframer(); -class noaa_hrpt_deframer : public gr_block +class NOAA_API noaa_hrpt_deframer : public gr_block { - friend noaa_hrpt_deframer_sptr noaa_make_hrpt_deframer(); + friend NOAA_API noaa_hrpt_deframer_sptr noaa_make_hrpt_deframer(); noaa_hrpt_deframer(); unsigned int d_state; diff --git a/gr-noaa/lib/noaa_hrpt_pll_cf.h b/gr-noaa/lib/noaa_hrpt_pll_cf.h index 507d47fe7..8d3e8f8d5 100644 --- a/gr-noaa/lib/noaa_hrpt_pll_cf.h +++ b/gr-noaa/lib/noaa_hrpt_pll_cf.h @@ -23,17 +23,18 @@ #ifndef INCLUDED_NOAA_HRPT_PLL_CF_H #define INCLUDED_NOAA_HRPT_PLL_CF_H +#include <noaa_api.h> #include <gr_sync_block.h> class noaa_hrpt_pll_cf; typedef boost::shared_ptr<noaa_hrpt_pll_cf> noaa_hrpt_pll_cf_sptr; -noaa_hrpt_pll_cf_sptr +NOAA_API noaa_hrpt_pll_cf_sptr noaa_make_hrpt_pll_cf(float alpha, float beta, float max_offset); -class noaa_hrpt_pll_cf : public gr_sync_block +class NOAA_API noaa_hrpt_pll_cf : public gr_sync_block { - friend noaa_hrpt_pll_cf_sptr noaa_make_hrpt_pll_cf(float alpha, float beta, float max_offset); + friend NOAA_API noaa_hrpt_pll_cf_sptr noaa_make_hrpt_pll_cf(float alpha, float beta, float max_offset); noaa_hrpt_pll_cf(float alpha, float beta, float max_offset); float d_alpha; // 1st order loop constant diff --git a/gr-noaa/swig/CMakeLists.txt b/gr-noaa/swig/CMakeLists.txt new file mode 100644 index 000000000..8b8afcb6f --- /dev/null +++ b/gr-noaa/swig/CMakeLists.txt @@ -0,0 +1,56 @@ +# Copyright 2011 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio 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 General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. + +######################################################################## +# Setup swig generation +######################################################################## +INCLUDE(GrPython) +INCLUDE(GrSwig) + +SET(GR_SWIG_INCLUDE_DIRS + ${GR_NOAA_INCLUDE_DIRS} + ${GNURADIO_CORE_SWIG_INCLUDE_DIRS} +) + +SET(GR_SWIG_LIBRARIES gnuradio-noaa) + +GR_SWIG_MAKE(noaa_swig noaa_swig.i) + +GR_SWIG_INSTALL( + TARGETS noaa_swig + DESTINATION ${GR_PYTHON_DIR}/gnuradio/noaa + COMPONENT "noaa_python" +) + +INSTALL( + FILES + noaa_swig.i + noaa_hrpt_decoder.i + noaa_hrpt_deframer.i + noaa_hrpt_pll_cf.i + DESTINATION ${GR_INCLUDE_DIR}/gnuradio/swig + COMPONENT "noaa_swig" +) + +GR_PYTHON_INSTALL( + FILES + __init__.py + DESTINATION ${GR_PYTHON_DIR}/gnuradio/noaa + COMPONENT "noaa_python" +) diff --git a/gr-pager/CMakeLists.txt b/gr-pager/CMakeLists.txt new file mode 100644 index 000000000..ac02a28c9 --- /dev/null +++ b/gr-pager/CMakeLists.txt @@ -0,0 +1,102 @@ +# Copyright 2011 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio 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 General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. + +######################################################################## +# Setup dependencies +######################################################################## +INCLUDE(GrBoost) + +######################################################################## +# Register component +######################################################################## +INCLUDE(GrComponent) +GR_REGISTER_COMPONENT("gr-pager" ENABLE_GR_PAGER + Boost_FOUND + ENABLE_GR_CORE_ +) + +GR_SET_GLOBAL(GR_PAGER_INCLUDE_DIRS + ${CMAKE_CURRENT_SOURCE_DIR}/lib +) + +######################################################################## +# Begin conditional configuration +######################################################################## +IF(ENABLE_GR_PAGER) + +######################################################################## +# Setup CPack components +######################################################################## +INCLUDE(GrPackage) +CPACK_SET(CPACK_COMPONENT_GROUP_PAGER_DESCRIPTION "GNU Radio Pager Blocks") + +CPACK_COMPONENT("pager_runtime" + GROUP "Pager" + DISPLAY_NAME "Runtime" + DESCRIPTION "Runtime" + DEPENDS "core_runtime" +) + +CPACK_COMPONENT("pager_devel" + GROUP "Pager" + DISPLAY_NAME "Development" + DESCRIPTION "C++ headers, package config, import libraries" + DEPENDS "core_devel" +) + +CPACK_COMPONENT("pager_python" + GROUP "Pager" + DISPLAY_NAME "Python" + DESCRIPTION "Python modules for runtime; GRC xml files" + DEPENDS "core_python;pager_runtime" +) + +CPACK_COMPONENT("pager_swig" + GROUP "Pager" + DISPLAY_NAME "SWIG" + DESCRIPTION "SWIG development .i files" + DEPENDS "core_swig;pager_python;pager_devel" +) + +######################################################################## +# Add subdirectories +######################################################################## +ADD_SUBDIRECTORY(lib) +IF(ENABLE_PYTHON) + ADD_SUBDIRECTORY(python) + ADD_SUBDIRECTORY(swig) + ADD_SUBDIRECTORY(grc) + ADD_SUBDIRECTORY(apps) +ENDIF(ENABLE_PYTHON) + +######################################################################## +# Create Pkg Config File +######################################################################## +CONFIGURE_FILE( + ${CMAKE_CURRENT_SOURCE_DIR}/gnuradio-pager.pc.in + ${CMAKE_CURRENT_BINARY_DIR}/gnuradio-pager.pc +@ONLY) + +INSTALL( + FILES ${CMAKE_CURRENT_BINARY_DIR}/gnuradio-pager.pc + DESTINATION ${GR_LIBRARY_DIR}/pkgconfig + COMPONENT "pager_devel" +) + +ENDIF(ENABLE_GR_PAGER) diff --git a/gr-pager/apps/CMakeLists.txt b/gr-pager/apps/CMakeLists.txt new file mode 100644 index 000000000..4b7cd54fa --- /dev/null +++ b/gr-pager/apps/CMakeLists.txt @@ -0,0 +1,22 @@ +# Copyright 2011 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio 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 General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. + +#FIXME +#not bothering to install because the apps require gr-usrp +#which we are choosing not to support in the cmake build system diff --git a/gr-pager/grc/CMakeLists.txt b/gr-pager/grc/CMakeLists.txt new file mode 100644 index 000000000..a9c39c4c4 --- /dev/null +++ b/gr-pager/grc/CMakeLists.txt @@ -0,0 +1,26 @@ +# Copyright 2011 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio 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 General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. + +INSTALL(FILES + pager_slicer_fb.xml + pager_flex_sync.xml + pager_flex_deinterleave.xml + DESTINATION ${GRC_BLOCKS_DIR} + COMPONENT "pager_python" +) diff --git a/gr-pager/lib/CMakeLists.txt b/gr-pager/lib/CMakeLists.txt new file mode 100644 index 000000000..c797f733b --- /dev/null +++ b/gr-pager/lib/CMakeLists.txt @@ -0,0 +1,76 @@ +# Copyright 2011 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio 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 General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. + +######################################################################## +# Setup the include and linker paths +######################################################################## +INCLUDE_DIRECTORIES( + ${GNURADIO_CORE_INCLUDE_DIRS} + ${GR_PAGER_INCLUDE_DIRS} +) + +INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIRS}) +LINK_DIRECTORIES(${Boost_LIBRARY_DIRS}) + +######################################################################## +# Setup library +######################################################################## +LIST(APPEND gr_pager_sources + pager_flex_frame.cc + pager_slicer_fb.cc + pager_flex_sync.cc + pager_flex_deinterleave.cc + pager_flex_parse.cc + pageri_bch3221.cc + pageri_flex_modes.cc + pageri_util.cc +) + +LIST(APPEND pager_libs + gnuradio-core + ${Boost_LIBRARIES} +) + +ADD_LIBRARY(gnuradio-pager SHARED ${gr_pager_sources}) +TARGET_LINK_LIBRARIES(gnuradio-pager ${pager_libs}) +SET_TARGET_PROPERTIES(gnuradio-pager PROPERTIES DEFINE_SYMBOL "gnuradio_pager_EXPORTS") +SET_TARGET_PROPERTIES(gnuradio-pager PROPERTIES SOVERSION ${LIBVER}) + +INSTALL(TARGETS gnuradio-pager + LIBRARY DESTINATION ${GR_LIBRARY_DIR} COMPONENT "pager_runtime" # .so/.dylib file + ARCHIVE DESTINATION ${GR_LIBRARY_DIR} COMPONENT "pager_devel" # .lib file + RUNTIME DESTINATION ${GR_RUNTIME_DIR} COMPONENT "pager_runtime" # .dll file +) + +######################################################################## +# Install header files +######################################################################## +INSTALL(FILES + pager_api.h + pager_slicer_fb.h + pager_flex_sync.h + pager_flex_deinterleave.h + pager_flex_parse.h + pager_flex_frame.h + pageri_bch3221.h + pageri_flex_modes.h + pageri_util.h + DESTINATION ${GR_INCLUDE_DIR}/gnuradio + COMPONENT "pager_devel" +) diff --git a/gr-pager/lib/Makefile.am b/gr-pager/lib/Makefile.am index 29c82ebe8..b6131171d 100644 --- a/gr-pager/lib/Makefile.am +++ b/gr-pager/lib/Makefile.am @@ -25,6 +25,7 @@ AM_CPPFLAGS = $(STD_DEFINES_AND_INCLUDES) $(PYTHON_CPPFLAGS) $(WITH_INCLUDES) # These headers get installed in ${prefix}/include/gnuradio grinclude_HEADERS = \ + pager_api.h \ pager_slicer_fb.h \ pager_flex_sync.h \ pager_flex_deinterleave.h \ diff --git a/gr-pager/lib/pager_api.h b/gr-pager/lib/pager_api.h new file mode 100644 index 000000000..4312c5ae3 --- /dev/null +++ b/gr-pager/lib/pager_api.h @@ -0,0 +1,33 @@ +/* + * Copyright 2011 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio 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 General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifndef INCLUDED_PAGER_API_H +#define INCLUDED_PAGER_API_H + +#include <gruel/attributes.h> + +#ifdef gnuradio_pager_EXPORTS +# define PAGER_API __GR_ATTR_EXPORT +#else +# define PAGER_API __GR_ATTR_IMPORT +#endif + +#endif /* INCLUDED_PAGER_API_H */ diff --git a/gr-pager/lib/pager_flex_deinterleave.h b/gr-pager/lib/pager_flex_deinterleave.h index 7211a71ad..87094490d 100644 --- a/gr-pager/lib/pager_flex_deinterleave.h +++ b/gr-pager/lib/pager_flex_deinterleave.h @@ -22,23 +22,24 @@ #ifndef INCLUDED_PAGER_FLEX_DEINTERLEAVE_H #define INCLUDED_PAGER_FLEX_DEINTERLEAVE_H +#include <pager_api.h> #include <gr_sync_decimator.h> class pager_flex_deinterleave; typedef boost::shared_ptr<pager_flex_deinterleave> pager_flex_deinterleave_sptr; -pager_flex_deinterleave_sptr pager_make_flex_deinterleave(); +PAGER_API pager_flex_deinterleave_sptr pager_make_flex_deinterleave(); /*! * \brief flex deinterleave description * \ingroup pager_blk */ -class pager_flex_deinterleave : public gr_sync_decimator +class PAGER_API pager_flex_deinterleave : public gr_sync_decimator { private: // Constructors - friend pager_flex_deinterleave_sptr pager_make_flex_deinterleave(); + friend PAGER_API pager_flex_deinterleave_sptr pager_make_flex_deinterleave(); pager_flex_deinterleave(); // One FLEX block of deinterleaved data diff --git a/gr-pager/lib/pager_flex_frame.h b/gr-pager/lib/pager_flex_frame.h index 1f4999e2b..857b49d29 100644 --- a/gr-pager/lib/pager_flex_frame.h +++ b/gr-pager/lib/pager_flex_frame.h @@ -21,6 +21,7 @@ #ifndef INCLUDED_PAGER_FLEX_FRAME_H #define INCLUDED_PAGER_FLEX_FRAME_H +#include <pager_api.h> #include <boost/shared_ptr.hpp> class pager_flex_frame; @@ -29,15 +30,15 @@ typedef boost::shared_ptr<pager_flex_frame> pager_flex_frame_sptr; /*! * \brief public constructor for pager_flex_frame */ -pager_flex_frame_sptr pager_make_flex_frame(); +PAGER_API pager_flex_frame_sptr pager_make_flex_frame(); /*! * \brief flex_frame. */ -class pager_flex_frame { +class PAGER_API pager_flex_frame { // Constructor is private to force use of shared_ptr pager_flex_frame(); - friend pager_flex_frame_sptr pager_make_flex_frame(); + friend PAGER_API pager_flex_frame_sptr pager_make_flex_frame(); public: ~pager_flex_frame(); diff --git a/gr-pager/lib/pager_flex_parse.h b/gr-pager/lib/pager_flex_parse.h index 0f7cfb370..dcbd19eae 100644 --- a/gr-pager/lib/pager_flex_parse.h +++ b/gr-pager/lib/pager_flex_parse.h @@ -22,6 +22,7 @@ #ifndef INCLUDED_PAGER_FLEX_PARSE_H #define INCLUDED_PAGER_FLEX_PARSE_H +#include <pager_api.h> #include <gr_sync_block.h> #include <gr_msg_queue.h> #include <pageri_flex_modes.h> @@ -30,7 +31,7 @@ class pager_flex_parse; typedef boost::shared_ptr<pager_flex_parse> pager_flex_parse_sptr; -pager_flex_parse_sptr pager_make_flex_parse(gr_msg_queue_sptr queue, float freq); +PAGER_API pager_flex_parse_sptr pager_make_flex_parse(gr_msg_queue_sptr queue, float freq); #define FIELD_DELIM ((unsigned char)128) @@ -38,11 +39,11 @@ pager_flex_parse_sptr pager_make_flex_parse(gr_msg_queue_sptr queue, float freq) * \brief flex parse description * \ingroup pager_blk */ -class pager_flex_parse : public gr_sync_block +class PAGER_API pager_flex_parse : public gr_sync_block { private: // Constructors - friend pager_flex_parse_sptr pager_make_flex_parse(gr_msg_queue_sptr queue, float freq); + friend PAGER_API pager_flex_parse_sptr pager_make_flex_parse(gr_msg_queue_sptr queue, float freq); pager_flex_parse(gr_msg_queue_sptr queue, float freq); std::ostringstream d_payload; diff --git a/gr-pager/lib/pager_flex_sync.cc b/gr-pager/lib/pager_flex_sync.cc index 61cf4ad38..30666298f 100644 --- a/gr-pager/lib/pager_flex_sync.cc +++ b/gr-pager/lib/pager_flex_sync.cc @@ -274,7 +274,7 @@ int pager_flex_sync::general_work(int noutput_items, while (i < ninputs && j < noutput_items) { unsigned char sym = *in++; i++; - d_index = ++d_index % d_spb; + d_index = (d_index+1) % d_spb; switch (d_state) { case ST_IDLE: diff --git a/gr-pager/lib/pager_flex_sync.h b/gr-pager/lib/pager_flex_sync.h index b401bf532..53b6f950a 100644 --- a/gr-pager/lib/pager_flex_sync.h +++ b/gr-pager/lib/pager_flex_sync.h @@ -22,24 +22,25 @@ #ifndef INCLUDED_PAGER_FLEX_SYNC_H #define INCLUDED_PAGER_FLEX_SYNC_H +#include <pager_api.h> #include <gr_block.h> class pager_flex_sync; typedef boost::shared_ptr<pager_flex_sync> pager_flex_sync_sptr; typedef std::vector<gr_int64> gr_int64_vector; -pager_flex_sync_sptr pager_make_flex_sync(); +PAGER_API pager_flex_sync_sptr pager_make_flex_sync(); /*! * \brief flex sync description * \ingroup pager_blk */ -class pager_flex_sync : public gr_block +class PAGER_API pager_flex_sync : public gr_block { private: // Constructors - friend pager_flex_sync_sptr pager_make_flex_sync(); + friend PAGER_API pager_flex_sync_sptr pager_make_flex_sync(); pager_flex_sync(); // State machine transitions diff --git a/gr-pager/lib/pager_slicer_fb.h b/gr-pager/lib/pager_slicer_fb.h index 75eea3cd3..b3d92780f 100644 --- a/gr-pager/lib/pager_slicer_fb.h +++ b/gr-pager/lib/pager_slicer_fb.h @@ -22,21 +22,22 @@ #ifndef INCLUDED_PAGER_SLICER_FB_H #define INCLUDED_PAGER_SLICER_FB_H +#include <pager_api.h> #include <gr_sync_block.h> class pager_slicer_fb; typedef boost::shared_ptr<pager_slicer_fb> pager_slicer_fb_sptr; -pager_slicer_fb_sptr pager_make_slicer_fb(float alpha); +PAGER_API pager_slicer_fb_sptr pager_make_slicer_fb(float alpha); /*! * \brief slicer description * \ingroup pager_blk */ -class pager_slicer_fb : public gr_sync_block +class PAGER_API pager_slicer_fb : public gr_sync_block { private: - friend pager_slicer_fb_sptr pager_make_slicer_fb(float alpha); + friend PAGER_API pager_slicer_fb_sptr pager_make_slicer_fb(float alpha); pager_slicer_fb(float alpha); unsigned char slice(float sample); diff --git a/gr-pager/python/CMakeLists.txt b/gr-pager/python/CMakeLists.txt new file mode 100644 index 000000000..26fbf6f09 --- /dev/null +++ b/gr-pager/python/CMakeLists.txt @@ -0,0 +1,49 @@ +# Copyright 2011 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio 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 General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. + +######################################################################## +INCLUDE(GrPython) + +GR_PYTHON_INSTALL( + FILES + __init__.py + pager_utils.py + flex_demod.py + DESTINATION ${GR_PYTHON_DIR}/gnuradio/pager + COMPONENT "pager_python" +) + +######################################################################## +# Handle the unit tests +######################################################################## +IF(ENABLE_TESTING) +INCLUDE(GrTest) +FILE(GLOB py_qa_test_files "qa_*.py") +FOREACH(py_qa_test_file ${py_qa_test_files}) + GET_FILENAME_COMPONENT(py_qa_test_name ${py_qa_test_file} NAME_WE) + SET(GR_TEST_PYTHON_DIRS + ${CMAKE_BINARY_DIR}/gnuradio-core/src/python + ${CMAKE_BINARY_DIR}/gnuradio-core/src/lib/swig + ${CMAKE_BINARY_DIR}/gr-pager/python + ${CMAKE_BINARY_DIR}/gr-pager/swig + ) + SET(GR_TEST_TARGET_DEPS gruel gnuradio-core gnuradio-pager) + GR_ADD_TEST(${py_qa_test_name} ${PYTHON_EXECUTABLE} ${py_qa_test_file}) +ENDFOREACH(py_qa_test_file) +ENDIF(ENABLE_TESTING) diff --git a/gr-pager/swig/CMakeLists.txt b/gr-pager/swig/CMakeLists.txt new file mode 100644 index 000000000..24cab0c9a --- /dev/null +++ b/gr-pager/swig/CMakeLists.txt @@ -0,0 +1,51 @@ +# Copyright 2011 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio 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 General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. + +######################################################################## +# Setup swig generation +######################################################################## +INCLUDE(GrPython) +INCLUDE(GrSwig) + +SET(GR_SWIG_INCLUDE_DIRS + ${GR_PAGER_INCLUDE_DIRS} + ${GNURADIO_CORE_SWIG_INCLUDE_DIRS} +) + +SET(GR_SWIG_LIBRARIES gnuradio-pager) + +GR_SWIG_MAKE(pager_swig pager_swig.i) + +GR_SWIG_INSTALL( + TARGETS pager_swig + DESTINATION ${GR_PYTHON_DIR}/gnuradio/pager + COMPONENT "pager_python" +) + +INSTALL( + FILES + pager_swig.i + pager_flex_deinterleave.i + pager_flex_frame.i + pager_flex_parse.i + pager_flex_sync.i + pager_slicer_fb.i + DESTINATION ${GR_INCLUDE_DIR}/gnuradio/swig + COMPONENT "pager_swig" +) diff --git a/gr-qtgui/CMakeLists.txt b/gr-qtgui/CMakeLists.txt new file mode 100644 index 000000000..280d856af --- /dev/null +++ b/gr-qtgui/CMakeLists.txt @@ -0,0 +1,116 @@ +# Copyright 2010-2011 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio 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 General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. + +######################################################################## +# Setup dependencies +######################################################################## +INCLUDE(GrBoost) + +FIND_PACKAGE(Qt4 4.2.0 COMPONENTS QtCore QtGui) +INCLUDE(${QT_USE_FILE}) #sets up the environment + +FIND_PACKAGE(Qwt) + +FIND_PACKAGE(PythonLibs) + +INCLUDE(GrPython) +GR_PYTHON_CHECK_MODULE("PyQt4" PyQt4 True PYQT4_FOUND) + +######################################################################## +# Register component +######################################################################## +INCLUDE(GrComponent) +GR_REGISTER_COMPONENT("gr-qtgui" ENABLE_GR_QTGUI + Boost_FOUND + QT4_FOUND + QWT_FOUND + ENABLE_GR_CORE_ + PYTHONLIBS_FOUND + PYQT4_FOUND +) + +GR_SET_GLOBAL(GR_QTGUI_INCLUDE_DIRS + ${CMAKE_CURRENT_SOURCE_DIR}/lib + ${CMAKE_CURRENT_BINARY_DIR}/lib +) + +######################################################################## +# Begin conditional configuration +######################################################################## +IF(ENABLE_GR_QTGUI) + +######################################################################## +# Setup CPack components +######################################################################## +INCLUDE(GrPackage) +CPACK_SET(CPACK_COMPONENT_GROUP_QTGUI_DESCRIPTION "GNU Radio QtGUI Blocks") + +CPACK_COMPONENT("qtgui_runtime" + GROUP "QtGUI" + DISPLAY_NAME "Runtime" + DESCRIPTION "Runtime" + DEPENDS "core_runtime" +) + +CPACK_COMPONENT("qtgui_devel" + GROUP "QtGUI" + DISPLAY_NAME "Development" + DESCRIPTION "C++ headers, package config, import libraries" + DEPENDS "core_devel" +) + +CPACK_COMPONENT("qtgui_python" + GROUP "QtGUI" + DISPLAY_NAME "Python" + DESCRIPTION "Python modules for runtime; GRC xml files" + DEPENDS "core_python;qtgui_runtime" +) + +CPACK_COMPONENT("qtgui_swig" + GROUP "QtGUI" + DISPLAY_NAME "SWIG" + DESCRIPTION "SWIG development .i files" + DEPENDS "core_swig;qtgui_python;qtgui_devel" +) + +######################################################################## +# Add subdirectories +######################################################################## +ADD_SUBDIRECTORY(lib) +IF(ENABLE_PYTHON) + ADD_SUBDIRECTORY(grc) + ADD_SUBDIRECTORY(swig) + ADD_SUBDIRECTORY(python) +ENDIF(ENABLE_PYTHON) + +######################################################################## +# Create Pkg Config File +######################################################################## +CONFIGURE_FILE( + ${CMAKE_CURRENT_SOURCE_DIR}/gnuradio-qtgui.pc.in + ${CMAKE_CURRENT_BINARY_DIR}/gnuradio-qtgui.pc +@ONLY) + +INSTALL( + FILES ${CMAKE_CURRENT_BINARY_DIR}/gnuradio-qtgui.pc + DESTINATION ${GR_LIBRARY_DIR}/pkgconfig + COMPONENT "qtgui_devel" +) + +ENDIF(ENABLE_GR_QTGUI) diff --git a/gr-qtgui/grc/CMakeLists.txt b/gr-qtgui/grc/CMakeLists.txt new file mode 100644 index 000000000..023c38b01 --- /dev/null +++ b/gr-qtgui/grc/CMakeLists.txt @@ -0,0 +1,22 @@ +# Copyright 2011 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio 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 General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. + +######################################################################## +FILE(GLOB xml_files "*.xml") +INSTALL(FILES ${xml_files} DESTINATION ${GRC_BLOCKS_DIR} COMPONENT "qtgui_python") diff --git a/gr-qtgui/lib/CMakeLists.txt b/gr-qtgui/lib/CMakeLists.txt new file mode 100644 index 000000000..5bc67573e --- /dev/null +++ b/gr-qtgui/lib/CMakeLists.txt @@ -0,0 +1,120 @@ +# Copyright 2010-2011 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio 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 General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. + +######################################################################## +# Setup the QT file generations stuff +######################################################################## +SET(qtgui_moc_hdrs + spectrumdisplayform.h + timedisplayform.h + FrequencyDisplayPlot.h + TimeDomainDisplayPlot.h + WaterfallDisplayPlot.h + ConstellationDisplayPlot.h +) +QT4_WRAP_CPP(qtgui_moc_srcs ${qtgui_moc_hdrs}) +QT4_WRAP_UI(qtgui_ui_hdrs spectrumdisplayform.ui) + +#FIXME the sources expect <foo>.ui.h, but the macros generate ui_foo.h +#avoid changing the sources by generating the header with the include +SET(spectrum_ui_hdr ${CMAKE_CURRENT_BINARY_DIR}/spectrumdisplayform.ui.h) +IF(NOT EXISTS ${spectrum_ui_hdr}) + FILE(WRITE ${spectrum_ui_hdr} "#include <ui_spectrumdisplayform.h>\n") +ENDIF(NOT EXISTS ${spectrum_ui_hdr}) + +SET(qtgui_srcs + ${qtgui_moc_srcs} + ${qtgui_ui_hdrs} + FrequencyDisplayPlot.cc + TimeDomainDisplayPlot.cc + WaterfallDisplayPlot.cc + waterfallGlobalData.cc + ConstellationDisplayPlot.cc + spectrumdisplayform.cc + timedisplayform.cc + SpectrumGUIClass.cc + spectrumUpdateEvents.cc + plot_waterfall.cc + qtgui_sink_c.cc + qtgui_sink_f.cc + qtgui_time_sink_c.cc + qtgui_time_sink_f.cc + qtgui_util.cc +) + +######################################################################## +# Setup the include and linker paths +######################################################################## +INCLUDE_DIRECTORIES( + ${GNURADIO_CORE_INCLUDE_DIRS} + ${CMAKE_CURRENT_SOURCE_DIR} + ${CMAKE_CURRENT_BINARY_DIR} +) + +INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIRS}) +LINK_DIRECTORIES(${Boost_LIBRARY_DIRS}) + +INCLUDE_DIRECTORIES(${QWT_INCLUDE_DIRS}) +LINK_DIRECTORIES(${QWT_LIBRARY_DIRS}) + +INCLUDE_DIRECTORIES(${PYTHON_INCLUDE_DIRS}) + +######################################################################## +# Setup library +######################################################################## +LIST(APPEND qtgui_libs + gnuradio-core + ${QT_LIBRARIES} + ${QWT_LIBRARIES} + ${PYTHON_LIBRARIES} +) + +ADD_DEFINITIONS(-DQWT_DLL) #setup QWT library linkage +ADD_LIBRARY(gnuradio-qtgui SHARED ${qtgui_srcs}) +TARGET_LINK_LIBRARIES(gnuradio-qtgui ${qtgui_libs}) +SET_TARGET_PROPERTIES(gnuradio-qtgui PROPERTIES DEFINE_SYMBOL "libgnuradio_qtgui_EXPORTS") +SET_TARGET_PROPERTIES(gnuradio-qtgui PROPERTIES SOVERSION ${LIBVER}) + +INSTALL(TARGETS gnuradio-qtgui + LIBRARY DESTINATION ${GR_LIBRARY_DIR} COMPONENT "qtgui_runtime" # .so/.dylib file + ARCHIVE DESTINATION ${GR_LIBRARY_DIR} COMPONENT "qtgui_devel" # .lib file + RUNTIME DESTINATION ${GR_RUNTIME_DIR} COMPONENT "qtgui_runtime" # .dll file +) + +######################################################################## +# Install the header files +######################################################################## +INSTALL(FILES + FrequencyDisplayPlot.h + TimeDomainDisplayPlot.h + WaterfallDisplayPlot.h + waterfallGlobalData.h + ConstellationDisplayPlot.h + highResTimeFunctions.h + plot_waterfall.h + spectrumdisplayform.h + SpectrumGUIClass.h + spectrumUpdateEvents.h + qtgui_sink_c.h + qtgui_sink_f.h + qtgui_util.h + gr_qtgui_api.h + DESTINATION ${GR_INCLUDE_DIR}/gnuradio + COMPONENT "qtgui_devel" +) diff --git a/gr-qtgui/lib/spectrumUpdateEvents.h b/gr-qtgui/lib/spectrumUpdateEvents.h index 5a17657b7..760619f88 100644 --- a/gr-qtgui/lib/spectrumUpdateEvents.h +++ b/gr-qtgui/lib/spectrumUpdateEvents.h @@ -101,7 +101,6 @@ public: int which() const; const std::vector<double*> getTimeDomainPoints() const; uint64_t getNumTimeDomainDataPoints() const; - timespec getDataTimestamp() const; bool getRepeatDataFlag() const; protected: diff --git a/gr-qtgui/python/CMakeLists.txt b/gr-qtgui/python/CMakeLists.txt new file mode 100644 index 000000000..e80fa6b75 --- /dev/null +++ b/gr-qtgui/python/CMakeLists.txt @@ -0,0 +1,46 @@ +# Copyright 2010-2011 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio 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 General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. + +######################################################################## +INCLUDE(GrPython) + +GR_PYTHON_INSTALL( + FILES __init__.py + DESTINATION ${GR_PYTHON_DIR}/gnuradio/qtgui + COMPONENT "qtgui_python" +) + +######################################################################## +# Handle the unit tests +######################################################################## +IF(ENABLE_TESTING) +INCLUDE(GrTest) +FILE(GLOB py_qa_test_files "qa_*.py") +FOREACH(py_qa_test_file ${py_qa_test_files}) + GET_FILENAME_COMPONENT(py_qa_test_name ${py_qa_test_file} NAME_WE) + SET(GR_TEST_PYTHON_DIRS + ${CMAKE_BINARY_DIR}/gnuradio-core/src/python + ${CMAKE_BINARY_DIR}/gnuradio-core/src/lib/swig + ${CMAKE_BINARY_DIR}/gr-qtgui/python + ${CMAKE_BINARY_DIR}/gr-qtgui/swig + ) + SET(GR_TEST_TARGET_DEPS gruel gnuradio-core gnuradio-qtgui) + GR_ADD_TEST(${py_qa_test_name} ${PYTHON_EXECUTABLE} ${py_qa_test_file}) +ENDFOREACH(py_qa_test_file) +ENDIF(ENABLE_TESTING) diff --git a/gr-qtgui/swig/CMakeLists.txt b/gr-qtgui/swig/CMakeLists.txt new file mode 100644 index 000000000..047229944 --- /dev/null +++ b/gr-qtgui/swig/CMakeLists.txt @@ -0,0 +1,49 @@ +# Copyright 2010-2011 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio 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 General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. + +######################################################################## +# Setup swig generation +######################################################################## +INCLUDE(GrPython) +INCLUDE(GrSwig) + +SET(GR_SWIG_INCLUDE_DIRS + ${GNURADIO_CORE_SWIG_INCLUDE_DIRS} + ${GR_QTGUI_INCLUDE_DIRS} + ${QWT_INCLUDE_DIRS} +) + +SET(GR_SWIG_LIBRARIES gnuradio-qtgui) + +GR_SWIG_MAKE(qtgui_swig qtgui_swig.i) + +GR_SWIG_INSTALL( + TARGETS qtgui_swig + DESTINATION ${GR_PYTHON_DIR}/gnuradio/qtgui + COMPONENT "qtgui_python" +) + +INSTALL(FILES + qtgui_sink_c.i + qtgui_sink_f.i + qtgui_time_sink_c.i + qtgui_time_sink_f.i + DESTINATION ${GR_INCLUDE_DIR}/gnuradio/swig + COMPONENT "qtgui_swig" +) diff --git a/gr-qtgui/swig/qtgui_swig.i b/gr-qtgui/swig/qtgui_swig.i index 5a4ffd6fb..7cf8873e7 100644 --- a/gr-qtgui/swig/qtgui_swig.i +++ b/gr-qtgui/swig/qtgui_swig.i @@ -23,10 +23,10 @@ %include "gnuradio.i" %{ -#include <qtgui_sink_c.h> -#include <qtgui_sink_f.h> -#include <qtgui_time_sink_c.h> -#include <qtgui_time_sink_f.h> +#include "qtgui_sink_c.h" +#include "qtgui_sink_f.h" +#include "qtgui_time_sink_c.h" +#include "qtgui_time_sink_f.h" %} %include "qtgui_sink_c.i" diff --git a/gr-trellis/CMakeLists.txt b/gr-trellis/CMakeLists.txt new file mode 100644 index 000000000..11b547d70 --- /dev/null +++ b/gr-trellis/CMakeLists.txt @@ -0,0 +1,116 @@ +# Copyright 2011 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio 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 General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. + +######################################################################## +# Setup dependencies +######################################################################## +INCLUDE(GrBoost) + +######################################################################## +# Register component +######################################################################## +INCLUDE(GrComponent) +GR_REGISTER_COMPONENT("gr-trellis" ENABLE_GR_TRELLIS + Boost_FOUND + ENABLE_GR_CORE_ + ENABLE_GR_DIGITAL_ +) + +GR_SET_GLOBAL(GR_TRELLIS_INCLUDE_DIRS + ${CMAKE_CURRENT_SOURCE_DIR}/src/lib + ${CMAKE_CURRENT_BINARY_DIR}/src/lib +) + +######################################################################## +# Begin conditional configuration +######################################################################## +IF(ENABLE_GR_TRELLIS) + +######################################################################## +# Setup CPack components +######################################################################## +INCLUDE(GrPackage) +CPACK_SET(CPACK_COMPONENT_GROUP_TRELLIS_DESCRIPTION "GNU Radio Trellis Blocks") + +CPACK_COMPONENT("trellis_docs" + GROUP "Trellis" + DISPLAY_NAME "Documentation" + DESCRIPTION "Doxygen HTML and XML" +) + +CPACK_COMPONENT("trellis_runtime" + GROUP "Trellis" + DISPLAY_NAME "Runtime" + DESCRIPTION "Dynamic link libraries" + DEPENDS "core_runtime" +) + +CPACK_COMPONENT("trellis_devel" + GROUP "Trellis" + DISPLAY_NAME "Development" + DESCRIPTION "C++ headers, package config, import libraries" + DEPENDS "core_devel" +) + +CPACK_COMPONENT("trellis_python" + GROUP "Trellis" + DISPLAY_NAME "Python" + DESCRIPTION "Python modules for runtime" + DEPENDS "core_python;trellis_runtime" +) + +CPACK_COMPONENT("trellis_examples" + GROUP "Trellis" + DISPLAY_NAME "Examples" + DESCRIPTION "Python examples for trellis" + DEPENDS "trellis_python" +) + +CPACK_COMPONENT("trellis_swig" + GROUP "Trellis" + DISPLAY_NAME "SWIG" + DESCRIPTION "SWIG development .i files" + DEPENDS "core_swig;trellis_python;trellis_devel" +) + +######################################################################## +# Add subdirectories +######################################################################## +ADD_SUBDIRECTORY(src/lib) +ADD_SUBDIRECTORY(doc) +IF(ENABLE_PYTHON) + ADD_SUBDIRECTORY(src/python) + ADD_SUBDIRECTORY(src/examples) +ENDIF(ENABLE_PYTHON) + +######################################################################## +# Create Pkg Config File +######################################################################## +CONFIGURE_FILE( + ${CMAKE_CURRENT_SOURCE_DIR}/gnuradio-trellis.pc.in + ${CMAKE_CURRENT_BINARY_DIR}/gnuradio-trellis.pc +@ONLY) + +INSTALL( + FILES ${CMAKE_CURRENT_BINARY_DIR}/gnuradio-trellis.pc + DESTINATION ${GR_LIBRARY_DIR}/pkgconfig + COMPONENT "trellis_devel" +) + +ENDIF(ENABLE_GR_TRELLIS) diff --git a/gr-trellis/doc/CMakeLists.txt b/gr-trellis/doc/CMakeLists.txt new file mode 100644 index 000000000..41ccf7f8e --- /dev/null +++ b/gr-trellis/doc/CMakeLists.txt @@ -0,0 +1,73 @@ +# Copyright 2011 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio 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 General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. + +INCLUDE(GrPython) + +######################################################################## +# Generate HTML doc with xmlto +######################################################################## +FIND_PROGRAM(XMLTO_EXECUTABLE xmlto) + +IF(XMLTO_EXECUTABLE) +ADD_CUSTOM_COMMAND( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/gr-trellis.html + DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/gr-trellis.xml + COMMAND ${XMLTO_EXECUTABLE} html-nochunks + ${CMAKE_CURRENT_SOURCE_DIR}/gr-trellis.xml +) +ADD_CUSTOM_TARGET(gr_trellis_html ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/gr-trellis.html) +INSTALL( + FILES ${CMAKE_CURRENT_BINARY_DIR}/gr-trellis.html + DESTINATION ${GR_PKG_DOC_DIR}/html + COMPONENT "trellis_docs" + +) +ENDIF(XMLTO_EXECUTABLE) + +######################################################################## +# Generate xml doc +######################################################################## +ADD_CUSTOM_COMMAND( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/test_tcm.py.xml + DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/test_tcm.py + DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/make_numbered_listing.py + COMMAND ${PYTHON_EXECUTABLE} + ${CMAKE_CURRENT_SOURCE_DIR}/make_numbered_listing.py + ${CMAKE_CURRENT_SOURCE_DIR}/test_tcm.py +) + +ADD_CUSTOM_COMMAND( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/test_viterbi_equalization1.py.xml + DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/test_viterbi_equalization1.py + DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/make_numbered_listing.py + COMMAND ${PYTHON_EXECUTABLE} + ${CMAKE_CURRENT_SOURCE_DIR}/make_numbered_listing.py + ${CMAKE_CURRENT_SOURCE_DIR}/test_viterbi_equalization1.py +) + +ADD_CUSTOM_TARGET(gr_trellis_xml ALL DEPENDS + ${CMAKE_CURRENT_BINARY_DIR}/test_tcm.py.xml + ${CMAKE_CURRENT_BINARY_DIR}/test_viterbi_equalization1.py.xml +) +INSTALL(FILES + ${CMAKE_CURRENT_BINARY_DIR}/test_tcm.py.xml + ${CMAKE_CURRENT_BINARY_DIR}/test_viterbi_equalization1.py.xml + DESTINATION ${GR_PKG_DOC_DIR}/xml + COMPONENT "trellis_docs" +) diff --git a/gr-trellis/src/examples/CMakeLists.txt b/gr-trellis/src/examples/CMakeLists.txt new file mode 100644 index 000000000..2a98c9c67 --- /dev/null +++ b/gr-trellis/src/examples/CMakeLists.txt @@ -0,0 +1,64 @@ +# Copyright 2011 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio 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 General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. + +INCLUDE(GrPython) + +GR_PYTHON_INSTALL( + PROGRAMS + fsm_utils.py + test_tcm.py + test_tcm_parallel.py + test_tcm_combined.py + test_sccc_hard.py + test_sccc_soft.py + test_sccc_turbo.py + test_viterbi_equalization1.py + test_viterbi_equalization.py + test_turbo_equalization.py + test_turbo_equalization1.py + test_turbo_equalization2.py + DESTINATION ${GR_PKG_DATA_DIR}/examples/trellis + COMPONENT "trellis_examples" +) + +INSTALL( + FILES README + DESTINATION ${GR_PKG_DATA_DIR}/examples/trellis + COMPONENT "trellis_examples" +) + +INSTALL( + FILES + fsm_files/awgn1o2_128.fsm + fsm_files/awgn1o2_16.fsm + fsm_files/awgn1o2_4.fsm + fsm_files/awgn1o2_8.fsm + fsm_files/awgn2o3_16.fsm + fsm_files/awgn2o3_4.fsm + fsm_files/awgn2o3_4_msb.fsm + fsm_files/awgn2o3_4_msbG.fsm + fsm_files/awgn2o3_8.fsm + fsm_files/awgn2o4_4.fsm + fsm_files/disconnected.fsm + fsm_files/rep3.fsm + fsm_files/rep5.fsm + fsm_files/simple.fsm + DESTINATION ${GR_PKG_DATA_DIR}/examples/trellis/fsm_files + COMPONENT "trellis_examples" +) diff --git a/gr-trellis/src/lib/CMakeLists.txt b/gr-trellis/src/lib/CMakeLists.txt new file mode 100644 index 000000000..338baac9d --- /dev/null +++ b/gr-trellis/src/lib/CMakeLists.txt @@ -0,0 +1,218 @@ +# Copyright 2011 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio 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 General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. + +######################################################################## +# Setup the include and linker paths +######################################################################## +INCLUDE_DIRECTORIES( + ${GNURADIO_CORE_INCLUDE_DIRS} + ${GR_TRELLIS_INCLUDE_DIRS} + ${GR_DIGITAL_INCLUDE_DIRS} +) + +INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIRS}) +LINK_DIRECTORIES(${Boost_LIBRARY_DIRS}) + +######################################################################## +# Generate the makefile.gen, then extract its sources: +# This is a round-about way to extract the sources, +# but it requires minimum changed to the python utils. +# +# The recommended way to do this: +# - Make a generation macro that registers the sources command. +# - List the generation macro with each templated source file. +# - Create a python script (very generic) to perform generation. +# - This way the targets would depend only on their sources. +######################################################################## +EXECUTE_PROCESS( + COMMAND ${PYTHON_EXECUTABLE} -c " +import os, sys +sys.path.append('${GR_CORE_PYTHONPATH}') +sys.path.append('${CMAKE_CURRENT_SOURCE_DIR}') +os.environ['srcdir'] = '${CMAKE_CURRENT_SOURCE_DIR}' +os.environ['gendir'] = '${CMAKE_CURRENT_BINARY_DIR}' +os.environ['do_makefile'] = '1' +os.environ['do_sources'] = '0' +from generate_all import generate_all +generate_all() + " WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} +) + +MACRO(GEGEN_GEN_EXTRACT outvar ext) + EXECUTE_PROCESS(COMMAND ${PYTHON_EXECUTABLE} -c "import os; print ';'.join( + map(lambda x: os.path.join('${CMAKE_CURRENT_BINARY_DIR}', x.replace('\\\\', '').strip()), + filter(lambda f: '${ext}' in f, open('${CMAKE_CURRENT_BINARY_DIR}/Makefile.gen').readlines() + )))" OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_VARIABLE ${outvar}) + FILE(TO_CMAKE_PATH "${${outvar}}" ${outvar}) +ENDMACRO(GEGEN_GEN_EXTRACT) + +GEGEN_GEN_EXTRACT(generated_trellis_sources ".cc") +GEGEN_GEN_EXTRACT(generated_trellis_includes ".h") +GEGEN_GEN_EXTRACT(generated_trellis_swigs ".i") + +#TODO simplify this list with a triple-threat for loop +SET(generated_trellis_deps + generate_all.py + generate_trellis.py + trellis_encoder_XX.cc.t + trellis_encoder_XX.h.t + trellis_encoder_XX.i.t + trellis_sccc_encoder_XX.cc.t + trellis_sccc_encoder_XX.h.t + trellis_sccc_encoder_XX.i.t + trellis_pccc_encoder_XX.cc.t + trellis_pccc_encoder_XX.h.t + trellis_pccc_encoder_XX.i.t + trellis_metrics_X.cc.t + trellis_metrics_X.h.t + trellis_metrics_X.i.t + trellis_viterbi_combined_XX.cc.t + trellis_viterbi_combined_XX.h.t + trellis_viterbi_combined_XX.i.t + trellis_sccc_decoder_combined_XX.cc.t + trellis_sccc_decoder_combined_XX.h.t + trellis_sccc_decoder_combined_XX.i.t + trellis_sccc_decoder_X.cc.t + trellis_sccc_decoder_X.h.t + trellis_sccc_decoder_X.i.t + trellis_pccc_decoder_X.cc.t + trellis_pccc_decoder_X.h.t + trellis_pccc_decoder_X.i.t + trellis_viterbi_X.cc.t + trellis_viterbi_X.h.t + trellis_viterbi_X.i.t +) + +ADD_CUSTOM_COMMAND( + OUTPUT + ${generated_trellis_sources} + ${generated_trellis_includes} + ${generated_trellis_swigs} + DEPENDS ${generated_trellis_deps} + COMMAND ${PYTHON_EXECUTABLE} -B -c + \"import os, sys\;sys.path.append('${GR_CORE_PYTHONPATH}')\;sys.path.append('${CMAKE_CURRENT_SOURCE_DIR}')\;os.environ['srcdir'] = '${CMAKE_CURRENT_SOURCE_DIR}'\;from generate_all import generate_all\;generate_all()\" + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + COMMENT "generating trellis files" +) + +ADD_CUSTOM_TARGET(trellis_generated DEPENDS + ${generated_trellis_sources} + ${generated_trellis_includes} + ${generated_trellis_swigs} +) + +######################################################################## +# Setup library +######################################################################## +LIST(APPEND gr_trellis_sources + fsm.cc + quicksort_index.cc + base.cc + interleaver.cc + calc_metric.cc + core_algorithms.cc + trellis_permutation.cc + trellis_siso_f.cc + trellis_siso_combined_f.cc + trellis_constellation_metrics_cf.cc + ${generated_trellis_sources} +) + +LIST(APPEND trellis_libs + gnuradio-core + ${Boost_LIBRARIES} +) + +ADD_LIBRARY(gnuradio-trellis SHARED ${gr_trellis_sources}) +TARGET_LINK_LIBRARIES(gnuradio-trellis ${trellis_libs}) +SET_TARGET_PROPERTIES(gnuradio-trellis PROPERTIES DEFINE_SYMBOL "gnuradio_trellis_EXPORTS") +SET_TARGET_PROPERTIES(gnuradio-trellis PROPERTIES SOVERSION ${LIBVER}) + +INSTALL(TARGETS gnuradio-trellis + LIBRARY DESTINATION ${GR_LIBRARY_DIR} COMPONENT "trellis_runtime" # .so/.dylib file + ARCHIVE DESTINATION ${GR_LIBRARY_DIR} COMPONENT "trellis_devel" # .lib file + RUNTIME DESTINATION ${GR_RUNTIME_DIR} COMPONENT "trellis_runtime" # .dll file +) + +######################################################################## +# Handle the generated sources + a few non-generated ones +######################################################################## +INSTALL(FILES + ${generated_trellis_includes} + trellis_api.h + fsm.h + quicksort_index.h + base.h + interleaver.h + calc_metric.h + core_algorithms.h + trellis_permutation.h + siso_type.h + trellis_siso_f.h + trellis_siso_combined_f.h + trellis_constellation_metrics_cf.h + DESTINATION ${GR_INCLUDE_DIR}/gnuradio + COMPONENT "trellis_devel" +) + +IF(ENABLE_PYTHON) + INSTALL(FILES + ${generated_trellis_swigs} + fsm.i + interleaver.i + trellis_permutation.i + trellis_siso_f.i + trellis_siso_combined_f.i + trellis_constellation_metrics_cf.i + ${CMAKE_CURRENT_BINARY_DIR}/trellis_generated.i + DESTINATION ${GR_INCLUDE_DIR}/gnuradio/swig + COMPONENT "trellis_swig" + ) + +######################################################################## +# Setup swig generation +######################################################################## +INCLUDE(GrPython) +INCLUDE(GrSwig) + +SET(GR_SWIG_INCLUDE_DIRS + ${GR_TRELLIS_INCLUDE_DIRS} + ${GNURADIO_CORE_SWIG_INCLUDE_DIRS} + ${GR_DIGITAL_SWIG_INCLUDE_DIRS} +) + +SET(GR_SWIG_LIBRARIES gnuradio-trellis) + +SET(GR_SWIG_TARGET_DEPS trellis_generated) + +GR_SWIG_MAKE(trellis trellis.i) + +GR_SWIG_INSTALL( + TARGETS trellis + DESTINATION ${GR_PYTHON_DIR}/gnuradio + COMPONENT "trellis_python" +) + +INSTALL( + FILES trellis.i + DESTINATION ${GR_INCLUDE_DIR}/gnuradio/swig + COMPONENT "trellis_swig" +) + +ENDIF(ENABLE_PYTHON) diff --git a/gr-trellis/src/lib/Makefile.am b/gr-trellis/src/lib/Makefile.am index 795ac28b4..5f2fc1825 100644 --- a/gr-trellis/src/lib/Makefile.am +++ b/gr-trellis/src/lib/Makefile.am @@ -78,6 +78,7 @@ EXTRA_DIST += \ # These headers get installed in ${prefix}/include/gnuradio grinclude_HEADERS = \ + trellis_api.h \ fsm.h \ quicksort_index.h \ base.h \ diff --git a/gr-trellis/src/lib/fsm.cc b/gr-trellis/src/lib/fsm.cc index 889a3918b..71e54b05a 100644 --- a/gr-trellis/src/lib/fsm.cc +++ b/gr-trellis/src/lib/fsm.cc @@ -132,7 +132,7 @@ fsm::fsm(int k, int n, const std::vector<int> &G) for(int j=0;j<n;j++) { int mem = -1; if(G[i*n+j]!=0) - mem=(int)(log(G[i*n+j])/log(2.0)); + mem=(int)(log(double(G[i*n+j]))/log(2.0)); if(mem>max_mem_x[i]) max_mem_x[i]=mem; if(mem>max_mem) @@ -417,7 +417,7 @@ void fsm::generate_TM() done = find_es(s); attempts ++; } - if (done == false and d_S > 1) { + if (done == false && d_S > 1) { //throw std::runtime_error ("fsm::generate_TM(): FSM appears to be disconnected\n"); printf("fsm::generate_TM(): FSM appears to be disconnected\n"); printf("state %d cannot be reached from all other states\n",s); diff --git a/gr-trellis/src/lib/fsm.h b/gr-trellis/src/lib/fsm.h index 8bae91754..7dc7e0d9d 100644 --- a/gr-trellis/src/lib/fsm.h +++ b/gr-trellis/src/lib/fsm.h @@ -23,6 +23,7 @@ #ifndef INCLUDED_TRELLIS_FSM_H #define INCLUDED_TRELLIS_FSM_H +#include <trellis_api.h> #include <vector> #include <iosfwd> @@ -33,7 +34,7 @@ * rather than the FSM itself. It particular the state of the FSM * is not stored within an instance of this class. */ -class fsm { +class TRELLIS_API fsm { private: // Input alphabet cardinality. int d_I; @@ -106,7 +107,7 @@ public: * \brief Creates an FSMS describing ISI. * * \param mod_size modulation size - * \param ch_lenth channel length + * \param ch_length channel length * */ fsm(int mod_size, int ch_length); @@ -125,14 +126,14 @@ public: /*! * \brief Creates an FSMS describing the joint trellis of two FSMs. * - * \param fsm1 first FSMS - * \param fsm2 second FSMS + * \param FSM1 first FSMS + * \param FSM2 second FSMS */ fsm(const fsm &FSM1, const fsm &FSM2); /*! * \brief Creates an FSMS representing n stages through the originial FSM (AKA radix-n FSM). * - * \param original FSMS + * \param FSM Original FSMs * \param n Number of stages. */ fsm(const fsm &FSM, int n); diff --git a/gr-trellis/src/lib/interleaver.h b/gr-trellis/src/lib/interleaver.h index f6a289c52..fbd378d62 100644 --- a/gr-trellis/src/lib/interleaver.h +++ b/gr-trellis/src/lib/interleaver.h @@ -23,12 +23,13 @@ #ifndef INCLUDED_TRELLIS_INTERLEAVER_H #define INCLUDED_TRELLIS_INTERLEAVER_H +#include <trellis_api.h> #include <vector> /*! * \brief INTERLEAVER class */ -class interleaver { +class TRELLIS_API interleaver { private: int d_K; std::vector<int> d_INTER; diff --git a/gr-trellis/src/lib/trellis_api.h b/gr-trellis/src/lib/trellis_api.h new file mode 100644 index 000000000..c09b340d6 --- /dev/null +++ b/gr-trellis/src/lib/trellis_api.h @@ -0,0 +1,33 @@ +/* + * Copyright 2011 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio 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 General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifndef INCLUDED_TRELLIS_API_H +#define INCLUDED_TRELLIS_API_H + +#include <gruel/attributes.h> + +#ifdef gnuradio_trellis_EXPORTS +# define TRELLIS_API __GR_ATTR_EXPORT +#else +# define TRELLIS_API __GR_ATTR_IMPORT +#endif + +#endif /* INCLUDED_TRELLIS_API_H */ diff --git a/gr-trellis/src/lib/trellis_constellation_metrics_cf.cc b/gr-trellis/src/lib/trellis_constellation_metrics_cf.cc index 1d03886f1..91520e4ce 100644 --- a/gr-trellis/src/lib/trellis_constellation_metrics_cf.cc +++ b/gr-trellis/src/lib/trellis_constellation_metrics_cf.cc @@ -20,9 +20,7 @@ * Boston, MA 02110-1301, USA. */ -// WARNING: this file is machine generated. Edits will be over written - -#ifndef HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H #include "config.h" #endif diff --git a/gr-trellis/src/lib/trellis_constellation_metrics_cf.h b/gr-trellis/src/lib/trellis_constellation_metrics_cf.h index a34c335ec..1851bb89c 100644 --- a/gr-trellis/src/lib/trellis_constellation_metrics_cf.h +++ b/gr-trellis/src/lib/trellis_constellation_metrics_cf.h @@ -23,6 +23,7 @@ #ifndef INCLUDED_TRELLIS_CONSTELLATION_METRICS_CF_H #define INCLUDED_TRELLIS_CONSTELLATION_METRICS_CF_H +#include <trellis_api.h> #include <gr_block.h> #include <digital_constellation.h> #include <digital_metric_type.h> @@ -30,13 +31,13 @@ class trellis_constellation_metrics_cf; typedef boost::shared_ptr<trellis_constellation_metrics_cf> trellis_constellation_metrics_cf_sptr; -trellis_constellation_metrics_cf_sptr trellis_make_constellation_metrics_cf (digital_constellation_sptr constellation, trellis_metric_type_t TYPE); +TRELLIS_API trellis_constellation_metrics_cf_sptr trellis_make_constellation_metrics_cf (digital_constellation_sptr constellation, trellis_metric_type_t TYPE); /*! * \brief Evaluate metrics for use by the Viterbi algorithm. * \ingroup coding_blk */ -class trellis_constellation_metrics_cf : public gr_block +class TRELLIS_API trellis_constellation_metrics_cf : public gr_block { public: void forecast (int noutput_items, @@ -53,7 +54,7 @@ class trellis_constellation_metrics_cf : public gr_block trellis_metric_type_t d_TYPE; unsigned int d_O; unsigned int d_D; - friend trellis_constellation_metrics_cf_sptr trellis_make_constellation_metrics_cf (digital_constellation_sptr constellation, trellis_metric_type_t TYPE); + friend TRELLIS_API trellis_constellation_metrics_cf_sptr trellis_make_constellation_metrics_cf (digital_constellation_sptr constellation, trellis_metric_type_t TYPE); }; diff --git a/gr-trellis/src/lib/trellis_encoder_XX.h.t b/gr-trellis/src/lib/trellis_encoder_XX.h.t index b56fde0bf..4038caac9 100644 --- a/gr-trellis/src/lib/trellis_encoder_XX.h.t +++ b/gr-trellis/src/lib/trellis_encoder_XX.h.t @@ -25,22 +25,23 @@ #ifndef @GUARD_NAME@ #define @GUARD_NAME@ +#include <trellis_api.h> #include "fsm.h" #include <gr_sync_block.h> class @NAME@; typedef boost::shared_ptr<@NAME@> @SPTR_NAME@; -@SPTR_NAME@ trellis_make_@BASE_NAME@ (const fsm &FSM, int ST); +TRELLIS_API @SPTR_NAME@ trellis_make_@BASE_NAME@ (const fsm &FSM, int ST); /*! * \brief Convolutional encoder. * \ingroup coding_blk */ -class @NAME@ : public gr_sync_block +class TRELLIS_API @NAME@ : public gr_sync_block { private: - friend @SPTR_NAME@ trellis_make_@BASE_NAME@ (const fsm &FSM, int ST); + friend TRELLIS_API @SPTR_NAME@ trellis_make_@BASE_NAME@ (const fsm &FSM, int ST); fsm d_FSM; int d_ST; @NAME@ (const fsm &FSM, int ST); diff --git a/gr-trellis/src/lib/trellis_metrics_X.h.t b/gr-trellis/src/lib/trellis_metrics_X.h.t index 45d4ace10..809c27e65 100644 --- a/gr-trellis/src/lib/trellis_metrics_X.h.t +++ b/gr-trellis/src/lib/trellis_metrics_X.h.t @@ -25,26 +25,27 @@ #ifndef @GUARD_NAME@ #define @GUARD_NAME@ +#include <trellis_api.h> #include <gr_block.h> #include "calc_metric.h" class @NAME@; typedef boost::shared_ptr<@NAME@> @SPTR_NAME@; -@SPTR_NAME@ trellis_make_@BASE_NAME@ (int O, int D, const std::vector<@I_TYPE@> &TABLE, trellis_metric_type_t TYPE); +TRELLIS_API @SPTR_NAME@ trellis_make_@BASE_NAME@ (int O, int D, const std::vector<@I_TYPE@> &TABLE, trellis_metric_type_t TYPE); /*! * \brief Evaluate metrics for use by the Viterbi algorithm. * \ingroup coding_blk */ -class @NAME@ : public gr_block +class TRELLIS_API @NAME@ : public gr_block { int d_O; int d_D; trellis_metric_type_t d_TYPE; std::vector<@I_TYPE@> d_TABLE; - friend @SPTR_NAME@ trellis_make_@BASE_NAME@ (int O, int D, const std::vector<@I_TYPE@> &TABLE, trellis_metric_type_t TYPE); + friend TRELLIS_API @SPTR_NAME@ trellis_make_@BASE_NAME@ (int O, int D, const std::vector<@I_TYPE@> &TABLE, trellis_metric_type_t TYPE); @NAME@ (int O, int D, const std::vector<@I_TYPE@> &TABLE, trellis_metric_type_t TYPE); public: diff --git a/gr-trellis/src/lib/trellis_pccc_decoder_X.h.t b/gr-trellis/src/lib/trellis_pccc_decoder_X.h.t index ff4b7a1f8..a58a03264 100644 --- a/gr-trellis/src/lib/trellis_pccc_decoder_X.h.t +++ b/gr-trellis/src/lib/trellis_pccc_decoder_X.h.t @@ -25,6 +25,7 @@ #ifndef @GUARD_NAME@ #define @GUARD_NAME@ +#include <trellis_api.h> #include "fsm.h" #include "interleaver.h" #include <gr_block.h> @@ -34,7 +35,7 @@ class @NAME@; typedef boost::shared_ptr<@NAME@> @SPTR_NAME@; -@SPTR_NAME@ trellis_make_@BASE_NAME@ ( +TRELLIS_API @SPTR_NAME@ trellis_make_@BASE_NAME@ ( const fsm &FSM1, int ST10, int ST1K, const fsm &FSM2, int ST20, int ST2K, const interleaver &INTERLEAVER, @@ -47,12 +48,12 @@ typedef boost::shared_ptr<@NAME@> @SPTR_NAME@; /*! * \ingroup coding_blk */ -class @NAME@ : public gr_block +class TRELLIS_API @NAME@ : public gr_block { fsm d_FSM1; - fsm d_FSM2; int d_ST10; int d_ST1K; + fsm d_FSM2; int d_ST20; int d_ST2K; interleaver d_INTERLEAVER; @@ -61,7 +62,7 @@ class @NAME@ : public gr_block trellis_siso_type_t d_SISO_TYPE; std::vector<float> d_buffer; - friend @SPTR_NAME@ trellis_make_@BASE_NAME@ ( + friend TRELLIS_API @SPTR_NAME@ trellis_make_@BASE_NAME@ ( const fsm &FSM1, int ST10, int ST1K, const fsm &FSM2, int ST20, int ST2K, const interleaver &INTERLEAVER, diff --git a/gr-trellis/src/lib/trellis_pccc_encoder_XX.h.t b/gr-trellis/src/lib/trellis_pccc_encoder_XX.h.t index 68ccf75db..2b6110e37 100644 --- a/gr-trellis/src/lib/trellis_pccc_encoder_XX.h.t +++ b/gr-trellis/src/lib/trellis_pccc_encoder_XX.h.t @@ -25,6 +25,7 @@ #ifndef @GUARD_NAME@ #define @GUARD_NAME@ +#include <trellis_api.h> #include <vector> #include "fsm.h" #include "interleaver.h" @@ -33,7 +34,7 @@ class @NAME@; typedef boost::shared_ptr<@NAME@> @SPTR_NAME@; -@SPTR_NAME@ trellis_make_@BASE_NAME@ ( +TRELLIS_API @SPTR_NAME@ trellis_make_@BASE_NAME@ ( const fsm &FSM1, int ST1, const fsm &FSM2, int ST2, const interleaver &INTERLEAVER, @@ -44,10 +45,10 @@ typedef boost::shared_ptr<@NAME@> @SPTR_NAME@; * \brief SCCC encoder. * \ingroup coding_blk */ -class @NAME@ : public gr_sync_block +class TRELLIS_API @NAME@ : public gr_sync_block { private: - friend @SPTR_NAME@ trellis_make_@BASE_NAME@ ( + friend TRELLIS_API @SPTR_NAME@ trellis_make_@BASE_NAME@ ( const fsm &FSM1, int ST1, const fsm &FSM2, int ST2, const interleaver &INTERLEAVER, diff --git a/gr-trellis/src/lib/trellis_permutation.h b/gr-trellis/src/lib/trellis_permutation.h index 5505caf89..7fec9682f 100644 --- a/gr-trellis/src/lib/trellis_permutation.h +++ b/gr-trellis/src/lib/trellis_permutation.h @@ -24,22 +24,23 @@ #ifndef INCLUDED_TRELLIS_PERMUTATION_H #define INCLUDED_TRELLIS_PERMUTATION_H +#include <trellis_api.h> #include <vector> #include <gr_sync_block.h> class trellis_permutation; typedef boost::shared_ptr<trellis_permutation> trellis_permutation_sptr; -trellis_permutation_sptr trellis_make_permutation (int K, const std::vector<int> &TABLE, int SYMS_PER_BLOCK, size_t NBYTES_INOUT); +TRELLIS_API trellis_permutation_sptr trellis_make_permutation (int K, const std::vector<int> &TABLE, int SYMS_PER_BLOCK, size_t NBYTES_INOUT); /*! * \brief Permutation. * \ingroup coding_blk */ -class trellis_permutation : public gr_sync_block +class TRELLIS_API trellis_permutation : public gr_sync_block { private: - friend trellis_permutation_sptr trellis_make_permutation (int K, const std::vector<int> &TABLE, int SYMS_PER_BLOCK, size_t NBYTES_INOUT); + friend TRELLIS_API trellis_permutation_sptr trellis_make_permutation (int K, const std::vector<int> &TABLE, int SYMS_PER_BLOCK, size_t NBYTES_INOUT); int d_K; std::vector<int> d_TABLE; int d_SYMS_PER_BLOCK; diff --git a/gr-trellis/src/lib/trellis_sccc_decoder_X.h.t b/gr-trellis/src/lib/trellis_sccc_decoder_X.h.t index 3adb8a5b7..9857c6a34 100644 --- a/gr-trellis/src/lib/trellis_sccc_decoder_X.h.t +++ b/gr-trellis/src/lib/trellis_sccc_decoder_X.h.t @@ -25,6 +25,7 @@ #ifndef @GUARD_NAME@ #define @GUARD_NAME@ +#include <trellis_api.h> #include "fsm.h" #include "interleaver.h" #include <gr_block.h> @@ -34,7 +35,7 @@ class @NAME@; typedef boost::shared_ptr<@NAME@> @SPTR_NAME@; -@SPTR_NAME@ trellis_make_@BASE_NAME@ ( +TRELLIS_API @SPTR_NAME@ trellis_make_@BASE_NAME@ ( const fsm &FSMo, int STo0, int SToK, const fsm &FSMi, int STi0, int STiK, const interleaver &INTERLEAVER, @@ -47,12 +48,12 @@ typedef boost::shared_ptr<@NAME@> @SPTR_NAME@; /*! * \ingroup coding_blk */ -class @NAME@ : public gr_block +class TRELLIS_API @NAME@ : public gr_block { fsm d_FSMo; - fsm d_FSMi; int d_STo0; int d_SToK; + fsm d_FSMi; int d_STi0; int d_STiK; interleaver d_INTERLEAVER; @@ -61,7 +62,7 @@ class @NAME@ : public gr_block trellis_siso_type_t d_SISO_TYPE; std::vector<float> d_buffer; - friend @SPTR_NAME@ trellis_make_@BASE_NAME@ ( + friend TRELLIS_API @SPTR_NAME@ trellis_make_@BASE_NAME@ ( const fsm &FSMo, int STo0, int SToK, const fsm &FSMi, int STi0, int STiK, const interleaver &INTERLEAVER, diff --git a/gr-trellis/src/lib/trellis_sccc_decoder_combined_XX.h.t b/gr-trellis/src/lib/trellis_sccc_decoder_combined_XX.h.t index 146c26516..5d2c2b85c 100644 --- a/gr-trellis/src/lib/trellis_sccc_decoder_combined_XX.h.t +++ b/gr-trellis/src/lib/trellis_sccc_decoder_combined_XX.h.t @@ -25,6 +25,7 @@ #ifndef @GUARD_NAME@ #define @GUARD_NAME@ +#include <trellis_api.h> #include "fsm.h" #include "interleaver.h" #include <gr_block.h> @@ -35,7 +36,7 @@ class @NAME@; typedef boost::shared_ptr<@NAME@> @SPTR_NAME@; -@SPTR_NAME@ trellis_make_@BASE_NAME@ ( +TRELLIS_API @SPTR_NAME@ trellis_make_@BASE_NAME@ ( const fsm &FSMo, int STo0, int SToK, const fsm &FSMi, int STi0, int STiK, const interleaver &INTERLEAVER, @@ -52,12 +53,12 @@ typedef boost::shared_ptr<@NAME@> @SPTR_NAME@; /*! * \ingroup coding_blk */ -class @NAME@ : public gr_block +class TRELLIS_API @NAME@ : public gr_block { fsm d_FSMo; - fsm d_FSMi; int d_STo0; int d_SToK; + fsm d_FSMi; int d_STi0; int d_STiK; interleaver d_INTERLEAVER; @@ -70,7 +71,7 @@ class @NAME@ : public gr_block float d_scaling; std::vector<float> d_buffer; - friend @SPTR_NAME@ trellis_make_@BASE_NAME@ ( + friend TRELLIS_API @SPTR_NAME@ trellis_make_@BASE_NAME@ ( const fsm &FSMo, int STo0, int SToK, const fsm &FSMi, int STi0, int STiK, const interleaver &INTERLEAVER, diff --git a/gr-trellis/src/lib/trellis_sccc_encoder_XX.h.t b/gr-trellis/src/lib/trellis_sccc_encoder_XX.h.t index a9e4dc454..0e8ff45a4 100644 --- a/gr-trellis/src/lib/trellis_sccc_encoder_XX.h.t +++ b/gr-trellis/src/lib/trellis_sccc_encoder_XX.h.t @@ -25,6 +25,7 @@ #ifndef @GUARD_NAME@ #define @GUARD_NAME@ +#include <trellis_api.h> #include <vector> #include "fsm.h" #include "interleaver.h" @@ -33,7 +34,7 @@ class @NAME@; typedef boost::shared_ptr<@NAME@> @SPTR_NAME@; -@SPTR_NAME@ trellis_make_@BASE_NAME@ ( +TRELLIS_API @SPTR_NAME@ trellis_make_@BASE_NAME@ ( const fsm &FSMo, int STo, const fsm &FSMi, int STi, const interleaver &INTERLEAVER, @@ -44,10 +45,10 @@ typedef boost::shared_ptr<@NAME@> @SPTR_NAME@; * \brief SCCC encoder. * \ingroup coding_blk */ -class @NAME@ : public gr_sync_block +class TRELLIS_API @NAME@ : public gr_sync_block { private: - friend @SPTR_NAME@ trellis_make_@BASE_NAME@ ( + friend TRELLIS_API @SPTR_NAME@ trellis_make_@BASE_NAME@ ( const fsm &FSMo, int STo, const fsm &FSMi, int STi, const interleaver &INTERLEAVER, diff --git a/gr-trellis/src/lib/trellis_siso_combined_f.h b/gr-trellis/src/lib/trellis_siso_combined_f.h index 786e79386..2d043df62 100644 --- a/gr-trellis/src/lib/trellis_siso_combined_f.h +++ b/gr-trellis/src/lib/trellis_siso_combined_f.h @@ -23,6 +23,7 @@ #ifndef INCLUDED_TRELLIS_SISO_COMBINED_F_H #define INCLUDED_TRELLIS_SISO_COMBINED_F_H +#include <trellis_api.h> #include "fsm.h" #include "siso_type.h" #include "calc_metric.h" @@ -32,7 +33,7 @@ class trellis_siso_combined_f; typedef boost::shared_ptr<trellis_siso_combined_f> trellis_siso_combined_f_sptr; -trellis_siso_combined_f_sptr trellis_make_siso_combined_f ( +TRELLIS_API trellis_siso_combined_f_sptr trellis_make_siso_combined_f ( const fsm &FSM, // underlying FSM int K, // block size in trellis steps int S0, // initial state (put -1 if not specified) @@ -48,7 +49,7 @@ trellis_siso_combined_f_sptr trellis_make_siso_combined_f ( /*! * \ingroup coding_blk */ -class trellis_siso_combined_f : public gr_block +class TRELLIS_API trellis_siso_combined_f : public gr_block { fsm d_FSM; int d_K; @@ -63,7 +64,7 @@ class trellis_siso_combined_f : public gr_block //std::vector<float> d_alpha; //std::vector<float> d_beta; - friend trellis_siso_combined_f_sptr trellis_make_siso_combined_f ( + friend TRELLIS_API trellis_siso_combined_f_sptr trellis_make_siso_combined_f ( const fsm &FSM, int K, int S0, diff --git a/gr-trellis/src/lib/trellis_siso_f.h b/gr-trellis/src/lib/trellis_siso_f.h index 0e2cba67a..b3d02ad05 100644 --- a/gr-trellis/src/lib/trellis_siso_f.h +++ b/gr-trellis/src/lib/trellis_siso_f.h @@ -23,6 +23,7 @@ #ifndef INCLUDED_TRELLIS_SISO_F_H #define INCLUDED_TRELLIS_SISO_F_H +#include <trellis_api.h> #include "fsm.h" #include "siso_type.h" #include "core_algorithms.h" @@ -31,7 +32,7 @@ class trellis_siso_f; typedef boost::shared_ptr<trellis_siso_f> trellis_siso_f_sptr; -trellis_siso_f_sptr trellis_make_siso_f ( +TRELLIS_API trellis_siso_f_sptr trellis_make_siso_f ( const fsm &FSM, // underlying FSM int K, // block size in trellis steps int S0, // initial state (put -1 if not specified) @@ -45,7 +46,7 @@ trellis_siso_f_sptr trellis_make_siso_f ( /*! * \ingroup coding_blk */ -class trellis_siso_f : public gr_block +class TRELLIS_API trellis_siso_f : public gr_block { fsm d_FSM; int d_K; @@ -57,7 +58,7 @@ class trellis_siso_f : public gr_block //std::vector<float> d_alpha; //std::vector<float> d_beta; - friend trellis_siso_f_sptr trellis_make_siso_f ( + friend TRELLIS_API trellis_siso_f_sptr trellis_make_siso_f ( const fsm &FSM, int K, int S0, diff --git a/gr-trellis/src/lib/trellis_viterbi_X.h.t b/gr-trellis/src/lib/trellis_viterbi_X.h.t index 362d3f57e..c679649bb 100644 --- a/gr-trellis/src/lib/trellis_viterbi_X.h.t +++ b/gr-trellis/src/lib/trellis_viterbi_X.h.t @@ -25,6 +25,7 @@ #ifndef @GUARD_NAME@ #define @GUARD_NAME@ +#include <trellis_api.h> #include "fsm.h" #include <gr_block.h> #include "core_algorithms.h" @@ -32,7 +33,7 @@ class @NAME@; typedef boost::shared_ptr<@NAME@> @SPTR_NAME@; -@SPTR_NAME@ trellis_make_@BASE_NAME@ ( +TRELLIS_API @SPTR_NAME@ trellis_make_@BASE_NAME@ ( const fsm &FSM, int K, int S0, @@ -43,7 +44,7 @@ typedef boost::shared_ptr<@NAME@> @SPTR_NAME@; /*! * \ingroup coding_blk */ -class @NAME@ : public gr_block +class TRELLIS_API @NAME@ : public gr_block { fsm d_FSM; int d_K; @@ -51,7 +52,7 @@ class @NAME@ : public gr_block int d_SK; //std::vector<int> d_trace; - friend @SPTR_NAME@ trellis_make_@BASE_NAME@ ( + friend TRELLIS_API @SPTR_NAME@ trellis_make_@BASE_NAME@ ( const fsm &FSM, int K, int S0, diff --git a/gr-trellis/src/lib/trellis_viterbi_combined_XX.h.t b/gr-trellis/src/lib/trellis_viterbi_combined_XX.h.t index 35e6c4ce0..072f66158 100644 --- a/gr-trellis/src/lib/trellis_viterbi_combined_XX.h.t +++ b/gr-trellis/src/lib/trellis_viterbi_combined_XX.h.t @@ -25,6 +25,7 @@ #ifndef @GUARD_NAME@ #define @GUARD_NAME@ +#include <trellis_api.h> #include "fsm.h" #include <gr_block.h> #include "calc_metric.h" @@ -33,7 +34,7 @@ class @NAME@; typedef boost::shared_ptr<@NAME@> @SPTR_NAME@; -@SPTR_NAME@ trellis_make_@BASE_NAME@ ( +TRELLIS_API @SPTR_NAME@ trellis_make_@BASE_NAME@ ( const fsm &FSM, int K, int S0, @@ -46,7 +47,7 @@ typedef boost::shared_ptr<@NAME@> @SPTR_NAME@; /*! * \ingroup coding_blk */ -class @NAME@ : public gr_block +class TRELLIS_API @NAME@ : public gr_block { fsm d_FSM; int d_K; @@ -57,7 +58,7 @@ class @NAME@ : public gr_block trellis_metric_type_t d_TYPE; //std::vector<int> d_trace; - friend @SPTR_NAME@ trellis_make_@BASE_NAME@ ( + friend TRELLIS_API @SPTR_NAME@ trellis_make_@BASE_NAME@ ( const fsm &FSM, int K, int S0, diff --git a/gr-trellis/src/python/CMakeLists.txt b/gr-trellis/src/python/CMakeLists.txt new file mode 100644 index 000000000..9cd645fe4 --- /dev/null +++ b/gr-trellis/src/python/CMakeLists.txt @@ -0,0 +1,37 @@ +# Copyright 2011 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio 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 General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. + +######################################################################## +# Handle the unit tests +######################################################################## +IF(ENABLE_TESTING) +INCLUDE(GrTest) +FILE(GLOB py_qa_test_files "qa_*.py") +FOREACH(py_qa_test_file ${py_qa_test_files}) + GET_FILENAME_COMPONENT(py_qa_test_name ${py_qa_test_file} NAME_WE) + SET(GR_TEST_PYTHON_DIRS + ${CMAKE_BINARY_DIR}/gnuradio-core/src/python + ${CMAKE_BINARY_DIR}/gnuradio-core/src/lib/swig + ${CMAKE_BINARY_DIR}/gr-digital/swig + ${CMAKE_BINARY_DIR}/gr-trellis/src/lib + ) + SET(GR_TEST_TARGET_DEPS gruel gnuradio-core gnuradio-digital gnuradio-trellis) + GR_ADD_TEST(${py_qa_test_name} ${PYTHON_EXECUTABLE} ${py_qa_test_file}) +ENDFOREACH(py_qa_test_file) +ENDIF(ENABLE_TESTING) diff --git a/gr-uhd/CMakeLists.txt b/gr-uhd/CMakeLists.txt new file mode 100644 index 000000000..2e7e26ab0 --- /dev/null +++ b/gr-uhd/CMakeLists.txt @@ -0,0 +1,106 @@ +# Copyright 2011 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio 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 General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. + +######################################################################## +# Setup dependencies +######################################################################## +INCLUDE(GrBoost) + +FIND_PACKAGE(UHD) + +######################################################################## +# Register component +######################################################################## +INCLUDE(GrComponent) +GR_REGISTER_COMPONENT("gr-uhd" ENABLE_GR_UHD + Boost_FOUND + UHD_FOUND + ENABLE_GR_CORE_ +) + +GR_SET_GLOBAL(GR_UHD_INCLUDE_DIRS + ${CMAKE_CURRENT_SOURCE_DIR}/include + ${UHD_INCLUDE_DIRS} +) + +######################################################################## +# Begin conditional configuration +######################################################################## +IF(ENABLE_GR_UHD) + +######################################################################## +# Setup CPack components +######################################################################## +INCLUDE(GrPackage) +CPACK_SET(CPACK_COMPONENT_GROUP_UHD_DESCRIPTION "GNU Radio UHD Blocks") + +CPACK_COMPONENT("uhd_runtime" + GROUP "UHD" + DISPLAY_NAME "Runtime" + DESCRIPTION "Runtime" + DEPENDS "core_runtime" +) + +CPACK_COMPONENT("uhd_devel" + GROUP "UHD" + DISPLAY_NAME "Development" + DESCRIPTION "C++ headers, package config, import libraries" + DEPENDS "core_devel" +) + +CPACK_COMPONENT("uhd_python" + GROUP "UHD" + DISPLAY_NAME "Python" + DESCRIPTION "Python modules for runtime; GRC xml files" + DEPENDS "core_python;uhd_runtime" +) + +CPACK_COMPONENT("uhd_swig" + GROUP "UHD" + DISPLAY_NAME "SWIG" + DESCRIPTION "SWIG development .i files" + DEPENDS "core_swig;uhd_python;uhd_devel" +) + +######################################################################## +# Add subdirectories +######################################################################## +ADD_SUBDIRECTORY(include) +ADD_SUBDIRECTORY(lib) +IF(ENABLE_PYTHON) + ADD_SUBDIRECTORY(swig) + ADD_SUBDIRECTORY(grc) + ADD_SUBDIRECTORY(apps) +ENDIF(ENABLE_PYTHON) + +######################################################################## +# Create Pkg Config File +######################################################################## +CONFIGURE_FILE( + ${CMAKE_CURRENT_SOURCE_DIR}/gnuradio-uhd.pc.in + ${CMAKE_CURRENT_BINARY_DIR}/gnuradio-uhd.pc +@ONLY) + +INSTALL( + FILES ${CMAKE_CURRENT_BINARY_DIR}/gnuradio-uhd.pc + DESTINATION ${GR_LIBRARY_DIR}/pkgconfig + COMPONENT "uhd_devel" +) + +ENDIF(ENABLE_GR_UHD) diff --git a/gr-uhd/apps/CMakeLists.txt b/gr-uhd/apps/CMakeLists.txt new file mode 100644 index 000000000..33e3abe15 --- /dev/null +++ b/gr-uhd/apps/CMakeLists.txt @@ -0,0 +1,26 @@ +# Copyright 2011 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio 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 General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. + +INCLUDE(GrPython) + +GR_PYTHON_INSTALL( + PROGRAMS uhd_fft.py uhd_rx_cfile.py + DESTINATION ${GR_RUNTIME_DIR} + COMPONENT "uhd_python" +) diff --git a/gr-uhd/grc/CMakeLists.txt b/gr-uhd/grc/CMakeLists.txt new file mode 100644 index 000000000..9e1cdb015 --- /dev/null +++ b/gr-uhd/grc/CMakeLists.txt @@ -0,0 +1,45 @@ +# Copyright 2011 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio 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 General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. + +######################################################################## +# Rules for generating the source and sink xml wrappers +######################################################################## +INCLUDE(GrPython) + +MACRO(GEN_BLOCK_XML _generator _xml_block) + SET(generator ${CMAKE_CURRENT_SOURCE_DIR}/${_generator}) + SET(xml_block ${CMAKE_CURRENT_BINARY_DIR}/${_xml_block}) + LIST(APPEND xml_blocks ${xml_block}) + ADD_CUSTOM_COMMAND( + DEPENDS ${generator} OUTPUT ${xml_block} + COMMAND ${PYTHON_EXECUTABLE} ${generator} ${xml_block} + ) +ENDMACRO(GEN_BLOCK_XML) + +GEN_BLOCK_XML(gen_uhd_usrp_blocks.py uhd_usrp_source.xml) +GEN_BLOCK_XML(gen_uhd_usrp_blocks.py uhd_usrp_sink.xml) + +ADD_CUSTOM_TARGET(uhd_grc_xml_blocks ALL DEPENDS ${xml_blocks}) + +INSTALL(FILES + ${xml_blocks} + uhd_block_tree.xml + DESTINATION ${GRC_BLOCKS_DIR} + COMPONENT "uhd_python" +) diff --git a/gr-uhd/include/CMakeLists.txt b/gr-uhd/include/CMakeLists.txt new file mode 100644 index 000000000..d13f85c0f --- /dev/null +++ b/gr-uhd/include/CMakeLists.txt @@ -0,0 +1,29 @@ +# Copyright 2011 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio 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 General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. + +######################################################################## +# Install header files +######################################################################## +INSTALL(FILES + gr_uhd_api.h + gr_uhd_usrp_source.h + gr_uhd_usrp_sink.h + DESTINATION ${GR_INCLUDE_DIR}/gnuradio + COMPONENT "uhd_devel" +) diff --git a/gr-uhd/include/gr_uhd_usrp_sink.h b/gr-uhd/include/gr_uhd_usrp_sink.h index 320d07d41..2adc5f1bf 100644 --- a/gr-uhd/include/gr_uhd_usrp_sink.h +++ b/gr-uhd/include/gr_uhd_usrp_sink.h @@ -125,7 +125,6 @@ public: /*! * Get the actual dboard gain setting of named stage. - * \param name the name of the gain stage * \param chan the channel index 0 to N-1 * \return the actual gain in dB */ diff --git a/gr-uhd/include/gr_uhd_usrp_source.h b/gr-uhd/include/gr_uhd_usrp_source.h index 36331f782..6e51a1423 100644 --- a/gr-uhd/include/gr_uhd_usrp_source.h +++ b/gr-uhd/include/gr_uhd_usrp_source.h @@ -125,7 +125,6 @@ public: /*! * Get the actual dboard gain setting of named stage. - * \param name the name of the gain stage * \param chan the channel index 0 to N-1 * \return the actual gain in dB */ diff --git a/gr-uhd/lib/CMakeLists.txt b/gr-uhd/lib/CMakeLists.txt new file mode 100644 index 000000000..086126eb5 --- /dev/null +++ b/gr-uhd/lib/CMakeLists.txt @@ -0,0 +1,57 @@ +# Copyright 2011 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio 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 General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. + +######################################################################## +# Setup the include and linker paths +######################################################################## +INCLUDE_DIRECTORIES( + ${GNURADIO_CORE_INCLUDE_DIRS} + ${GR_UHD_INCLUDE_DIRS} +) + +INCLUDE_DIRECTORIES(${UHD_INCLUDE_DIRS}) +LINK_DIRECTORIES(${UHD_LIBRARY_DIRS}) + +INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIRS}) +LINK_DIRECTORIES(${Boost_LIBRARY_DIRS}) + +######################################################################## +# Setup library +######################################################################## +LIST(APPEND gr_uhd_sources + gr_uhd_usrp_source.cc + gr_uhd_usrp_sink.cc +) + +LIST(APPEND uhd_libs + gnuradio-core + ${Boost_LIBRARIES} + ${UHD_LIBRARIES} +) + +ADD_LIBRARY(gnuradio-uhd SHARED ${gr_uhd_sources}) +TARGET_LINK_LIBRARIES(gnuradio-uhd ${uhd_libs}) +SET_TARGET_PROPERTIES(gnuradio-uhd PROPERTIES DEFINE_SYMBOL "gnuradio_uhd_EXPORTS") +SET_TARGET_PROPERTIES(gnuradio-uhd PROPERTIES SOVERSION ${LIBVER}) + +INSTALL(TARGETS gnuradio-uhd + LIBRARY DESTINATION ${GR_LIBRARY_DIR} COMPONENT "uhd_runtime" # .so/.dylib file + ARCHIVE DESTINATION ${GR_LIBRARY_DIR} COMPONENT "uhd_devel" # .lib file + RUNTIME DESTINATION ${GR_RUNTIME_DIR} COMPONENT "uhd_runtime" # .dll file +) diff --git a/gr-uhd/swig/CMakeLists.txt b/gr-uhd/swig/CMakeLists.txt new file mode 100644 index 000000000..fec3cba6f --- /dev/null +++ b/gr-uhd/swig/CMakeLists.txt @@ -0,0 +1,53 @@ +# Copyright 2011 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio 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 General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. + +######################################################################## +# Setup swig generation +######################################################################## +INCLUDE(GrPython) +INCLUDE(GrSwig) + +SET(GR_SWIG_FLAGS -DGR_HAVE_UHD) #needed to parse uhd_swig.i + +SET(GR_SWIG_INCLUDE_DIRS + ${GR_UHD_INCLUDE_DIRS} + ${GNURADIO_CORE_SWIG_INCLUDE_DIRS} +) +LINK_DIRECTORIES(${UHD_LIBRARY_DIRS}) +SET(GR_SWIG_LIBRARIES gnuradio-uhd ${UHD_LIBRARIES}) + +GR_SWIG_MAKE(uhd_swig uhd_swig.i) + +GR_SWIG_INSTALL( + TARGETS uhd_swig + DESTINATION ${GR_PYTHON_DIR}/gnuradio/uhd + COMPONENT "uhd_python" +) + +INSTALL( + FILES uhd_swig.i + DESTINATION ${GR_INCLUDE_DIR}/gnuradio/swig + COMPONENT "uhd_swig" +) + +GR_PYTHON_INSTALL( + FILES __init__.py + DESTINATION ${GR_PYTHON_DIR}/gnuradio/uhd + COMPONENT "uhd_python" +) diff --git a/gr-video-sdl/CMakeLists.txt b/gr-video-sdl/CMakeLists.txt new file mode 100644 index 000000000..4dc9874ba --- /dev/null +++ b/gr-video-sdl/CMakeLists.txt @@ -0,0 +1,99 @@ +# Copyright 2011 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio 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 General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. + +######################################################################## +# Setup dependencies +######################################################################## +INCLUDE(GrBoost) + +FIND_PACKAGE(SDL) + +######################################################################## +# Register component +######################################################################## +INCLUDE(GrComponent) +GR_REGISTER_COMPONENT("gr-video-sdl" ENABLE_GR_VIDEO_SDL + SDL_FOUND + Boost_FOUND + ENABLE_GR_CORE_ +) + +GR_SET_GLOBAL(GR_VIDEO_SDL_INCLUDE_DIRS + ${CMAKE_CURRENT_SOURCE_DIR}/src +) + +######################################################################## +# Begin conditional configuration +######################################################################## +IF(ENABLE_GR_VIDEO_SDL) + +######################################################################## +# Setup CPack components +######################################################################## +INCLUDE(GrPackage) +CPACK_SET(CPACK_COMPONENT_GROUP_VIDEO_SDL_DESCRIPTION "GNU Radio Video SDL Blocks") + +CPACK_COMPONENT("video_sdl_runtime" + GROUP "Video SDL" + DISPLAY_NAME "Runtime" + DESCRIPTION "Runtime" + DEPENDS "core_runtime" +) + +CPACK_COMPONENT("video_sdl_devel" + GROUP "Video SDL" + DISPLAY_NAME "Development" + DESCRIPTION "C++ headers, package config, import libraries" + DEPENDS "core_devel" +) + +CPACK_COMPONENT("video_sdl_python" + GROUP "Video SDL" + DISPLAY_NAME "Python" + DESCRIPTION "Python modules for runtime; GRC xml files" + DEPENDS "core_python;video_sdl_runtime" +) + +CPACK_COMPONENT("video_sdl_swig" + GROUP "Video SDL" + DISPLAY_NAME "SWIG" + DESCRIPTION "SWIG development .i files" + DEPENDS "core_swig;video_sdl_python;video_sdl_devel" +) + +######################################################################## +# Add subdirectories +######################################################################## +ADD_SUBDIRECTORY(src) + +######################################################################## +# Create Pkg Config File +######################################################################## +CONFIGURE_FILE( + ${CMAKE_CURRENT_SOURCE_DIR}/gnuradio-video-sdl.pc.in + ${CMAKE_CURRENT_BINARY_DIR}/gnuradio-video-sdl.pc +@ONLY) + +INSTALL( + FILES ${CMAKE_CURRENT_BINARY_DIR}/gnuradio-video-sdl.pc + DESTINATION ${GR_LIBRARY_DIR}/pkgconfig + COMPONENT "video_sdl_devel" +) + +ENDIF(ENABLE_GR_VIDEO_SDL) diff --git a/gr-video-sdl/src/CMakeLists.txt b/gr-video-sdl/src/CMakeLists.txt new file mode 100644 index 000000000..38181075a --- /dev/null +++ b/gr-video-sdl/src/CMakeLists.txt @@ -0,0 +1,115 @@ +# Copyright 2011 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio 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 General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. + +######################################################################## +# Setup the include and linker paths +######################################################################## +INCLUDE_DIRECTORIES( + ${GNURADIO_CORE_INCLUDE_DIRS} + ${GR_VIDEO_SDL_INCLUDE_DIRS} +) + +INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIRS}) +LINK_DIRECTORIES(${Boost_LIBRARY_DIRS}) + +INCLUDE_DIRECTORIES(${SDL_INCLUDE_DIR}) + +######################################################################## +# Setup library +######################################################################## +LIST(APPEND gr_video_sdl_sources + video_sdl_sink_uc.cc + video_sdl_sink_s.cc +) + +LIST(APPEND video_sdl_libs + gnuradio-core + ${Boost_LIBRARIES} + ${SDL_LIBRARY} +) + +ADD_LIBRARY(gnuradio-video-sdl SHARED ${gr_video_sdl_sources}) +TARGET_LINK_LIBRARIES(gnuradio-video-sdl ${video_sdl_libs}) +SET_TARGET_PROPERTIES(gnuradio-video-sdl PROPERTIES DEFINE_SYMBOL "gnuradio_video_sdl_EXPORTS") +SET_TARGET_PROPERTIES(gnuradio-video-sdl PROPERTIES SOVERSION ${LIBVER}) + +INSTALL(TARGETS gnuradio-video-sdl + LIBRARY DESTINATION ${GR_LIBRARY_DIR} COMPONENT "video_sdl_runtime" # .so/.dylib file + ARCHIVE DESTINATION ${GR_LIBRARY_DIR} COMPONENT "video_sdl_devel" # .lib file + RUNTIME DESTINATION ${GR_RUNTIME_DIR} COMPONENT "video_sdl_runtime" # .dll file +) + +######################################################################## +# Install public header files +######################################################################## +INSTALL(FILES + video_sdl_api.h + video_sdl_sink_uc.h + video_sdl_sink_s.h + DESTINATION ${GR_INCLUDE_DIR}/gnuradio + COMPONENT "video_sdl_devel" +) + +######################################################################## +# Setup swig generation +######################################################################## +IF(ENABLE_PYTHON) +INCLUDE(GrPython) +INCLUDE(GrSwig) + +SET(GR_SWIG_INCLUDE_DIRS + ${GR_COMEDI_INCLUDE_DIRS} + ${GNURADIO_CORE_SWIG_INCLUDE_DIRS} +) + +SET(GR_SWIG_LIBRARIES gnuradio-video-sdl) + +GR_SWIG_MAKE(video_sdl video_sdl.i) + +GR_SWIG_INSTALL( + TARGETS video_sdl + DESTINATION ${GR_PYTHON_DIR}/gnuradio + COMPONENT "video_sdl_python" +) + +INSTALL( + FILES video_sdl.i + DESTINATION ${GR_INCLUDE_DIR}/gnuradio/swig + COMPONENT "video_sdl_swig" +) + +ENDIF(ENABLE_PYTHON) + +######################################################################## +# Handle the unit tests +######################################################################## +IF(ENABLE_TESTING AND ENABLE_PYTHON) +INCLUDE(GrTest) +FILE(GLOB py_qa_test_files "qa_*.py") +FOREACH(py_qa_test_file ${py_qa_test_files}) + GET_FILENAME_COMPONENT(py_qa_test_name ${py_qa_test_file} NAME_WE) + SET(GR_TEST_PYTHON_DIRS + ${CMAKE_BINARY_DIR}/gnuradio-core/src/python + ${CMAKE_BINARY_DIR}/gnuradio-core/src/lib/swig + ${CMAKE_BINARY_DIR}/gr-video-sdl/src + ) + SET(GR_TEST_TARGET_DEPS gruel gnuradio-core gnuradio-video-sdl) + GR_ADD_TEST(${py_qa_test_name} ${PYTHON_EXECUTABLE} ${py_qa_test_file}) +ENDFOREACH(py_qa_test_file) +ENDIF(ENABLE_TESTING AND ENABLE_PYTHON) diff --git a/gr-video-sdl/src/Makefile.am b/gr-video-sdl/src/Makefile.am index 04c39542a..496671bea 100644 --- a/gr-video-sdl/src/Makefile.am +++ b/gr-video-sdl/src/Makefile.am @@ -33,6 +33,7 @@ noinst_PYTHON = \ qa_video_sdl.py grinclude_HEADERS = \ + video_sdl_api.h \ video_sdl_sink_uc.h \ video_sdl_sink_s.h diff --git a/gr-video-sdl/src/video_sdl_api.h b/gr-video-sdl/src/video_sdl_api.h new file mode 100644 index 000000000..5418f86f0 --- /dev/null +++ b/gr-video-sdl/src/video_sdl_api.h @@ -0,0 +1,33 @@ +/* + * Copyright 2011 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio 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 General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifndef INCLUDED_VIDEO_SDL_API_H +#define INCLUDED_VIDEO_SDL_API_H + +#include <gruel/attributes.h> + +#ifdef gnuradio_video_sdl_EXPORTS +# define VIDEO_SDL_API __GR_ATTR_EXPORT +#else +# define VIDEO_SDL_API __GR_ATTR_IMPORT +#endif + +#endif /* INCLUDED_VIDEO_SDL_API_H */ diff --git a/gr-video-sdl/src/video_sdl_sink_s.h b/gr-video-sdl/src/video_sdl_sink_s.h index 9d3651402..2ec15e36d 100644 --- a/gr-video-sdl/src/video_sdl_sink_s.h +++ b/gr-video-sdl/src/video_sdl_sink_s.h @@ -23,6 +23,7 @@ #ifndef INCLUDED_VIDEO_SDL_SINK_S_H #define INCLUDED_VIDEO_SDL_SINK_S_H +#include <video_sdl_api.h> #include <gr_sync_block.h> #include <string> #include <SDL.h> @@ -34,7 +35,7 @@ class video_sdl_sink_s; typedef boost::shared_ptr<video_sdl_sink_s> video_sdl_sink_s_sptr; -video_sdl_sink_s_sptr +VIDEO_SDL_API video_sdl_sink_s_sptr video_sdl_make_sink_s (double framerate,int width=640, int height=480,unsigned int format=IMGFMT_YV12,int dst_width=-1,int dst_height=-1); /*! @@ -47,8 +48,8 @@ video_sdl_make_sink_s (double framerate,int width=640, int height=480,unsigned i * Input samples must be in the range [0,255]. */ -class video_sdl_sink_s : public gr_sync_block { - friend video_sdl_sink_s_sptr +class VIDEO_SDL_API video_sdl_sink_s : public gr_sync_block { + friend VIDEO_SDL_API video_sdl_sink_s_sptr video_sdl_make_sink_s (double framerate,int width, int height,unsigned int format,int dst_width,int dst_height); int d_chunk_size; diff --git a/gr-video-sdl/src/video_sdl_sink_uc.h b/gr-video-sdl/src/video_sdl_sink_uc.h index 955b003f8..435ddaa8f 100644 --- a/gr-video-sdl/src/video_sdl_sink_uc.h +++ b/gr-video-sdl/src/video_sdl_sink_uc.h @@ -23,6 +23,7 @@ #ifndef INCLUDED_VIDEO_SDL_SINK_UC_H #define INCLUDED_VIDEO_SDL_SINK_UC_H +#include <video_sdl_api.h> #include <gr_sync_block.h> #include <string> #include <SDL.h> @@ -34,7 +35,7 @@ class video_sdl_sink_uc; typedef boost::shared_ptr<video_sdl_sink_uc> video_sdl_sink_uc_sptr; -video_sdl_sink_uc_sptr +VIDEO_SDL_API video_sdl_sink_uc_sptr video_sdl_make_sink_uc (double framerate,int width=640, int height=480,unsigned int format=IMGFMT_YV12,int dst_width=-1,int dst_height=-1); /*! @@ -47,8 +48,8 @@ video_sdl_make_sink_uc (double framerate,int width=640, int height=480,unsigned * Input samples must be in the range [0,255]. */ -class video_sdl_sink_uc : public gr_sync_block { - friend video_sdl_sink_uc_sptr +class VIDEO_SDL_API video_sdl_sink_uc : public gr_sync_block { + friend VIDEO_SDL_API video_sdl_sink_uc_sptr video_sdl_make_sink_uc (double framerate,int width, int height,unsigned int format,int dst_width,int dst_height); int d_chunk_size; diff --git a/gr-cvsd-vocoder/.gitignore b/gr-vocoder/.gitignore index a37fc0c1a..a37fc0c1a 100644 --- a/gr-cvsd-vocoder/.gitignore +++ b/gr-vocoder/.gitignore diff --git a/gr-vocoder/CMakeLists.txt b/gr-vocoder/CMakeLists.txt new file mode 100644 index 000000000..16ee6bbf0 --- /dev/null +++ b/gr-vocoder/CMakeLists.txt @@ -0,0 +1,109 @@ +# Copyright 2011 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio 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 General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. + +######################################################################## +# Setup dependencies +######################################################################## +INCLUDE(GrBoost) + +######################################################################## +# Register component +######################################################################## +INCLUDE(GrComponent) +GR_REGISTER_COMPONENT("gr-vocoder" ENABLE_GR_VOCODER + Boost_FOUND + ENABLE_GR_CORE_ +) + +GR_SET_GLOBAL(GR_VOCODER_INCLUDE_DIRS + ${CMAKE_CURRENT_SOURCE_DIR}/include +) + +######################################################################## +# Begin conditional configuration +######################################################################## +IF(ENABLE_GR_VOCODER) + +######################################################################## +# Setup CPack components +######################################################################## +INCLUDE(GrPackage) +CPACK_SET(CPACK_COMPONENT_GROUP_VOCODER_DESCRIPTION "GNU Radio Vocoder Blocks") + +CPACK_COMPONENT("vocoder_runtime" + GROUP "Vocoder" + DISPLAY_NAME "Runtime" + DESCRIPTION "Dynamic link libraries" + DEPENDS "core_runtime" +) + +CPACK_COMPONENT("vocoder_devel" + GROUP "Vocoder" + DISPLAY_NAME "Development" + DESCRIPTION "C++ headers, package config, import libraries" + DEPENDS "core_devel" +) + +CPACK_COMPONENT("vocoder_python" + GROUP "Vocoder" + DISPLAY_NAME "Python" + DESCRIPTION "Python modules for runtime" + DEPENDS "core_python;vocoder_runtime" +) + +CPACK_COMPONENT("vocoder_examples" + GROUP "Vocoder" + DISPLAY_NAME "Examples" + DESCRIPTION "Python examples for vocoder" + DEPENDS "vocoder_python" +) + +CPACK_COMPONENT("vocoder_swig" + GROUP "Vocoder" + DISPLAY_NAME "SWIG" + DESCRIPTION "SWIG development .i files" + DEPENDS "core_swig;vocoder_python;vocoder_devel" +) + +######################################################################## +# Add subdirectories +######################################################################## +ADD_SUBDIRECTORY(lib) +ADD_SUBDIRECTORY(include) +IF(ENABLE_PYTHON) + ADD_SUBDIRECTORY(swig) + ADD_SUBDIRECTORY(python) + ADD_SUBDIRECTORY(examples) +ENDIF(ENABLE_PYTHON) + +######################################################################## +# Create Pkg Config File +######################################################################## +CONFIGURE_FILE( + ${CMAKE_CURRENT_SOURCE_DIR}/gnuradio-vocoder.pc.in + ${CMAKE_CURRENT_BINARY_DIR}/gnuradio-vocoder.pc +@ONLY) + +INSTALL( + FILES ${CMAKE_CURRENT_BINARY_DIR}/gnuradio-vocoder.pc + DESTINATION ${GR_LIBRARY_DIR}/pkgconfig + COMPONENT "vocoder_devel" +) + +ENDIF(ENABLE_GR_VOCODER) diff --git a/gr-gsm-fr-vocoder/Makefile.am b/gr-vocoder/Makefile.am index 968ce327c..c280358a8 100644 --- a/gr-gsm-fr-vocoder/Makefile.am +++ b/gr-vocoder/Makefile.am @@ -1,5 +1,5 @@ # -# Copyright 2004,2009 Free Software Foundation, Inc. +# Copyright 2011 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -21,7 +21,11 @@ include $(top_srcdir)/Makefile.common -SUBDIRS = src +SUBDIRS = include lib python swig grc apps examples doc + +if PYTHON +SUBDIRS += python swig +endif pkgconfigdir = $(libdir)/pkgconfig -dist_pkgconfig_DATA = gnuradio-gsm-fr-vocoder.pc +dist_pkgconfig_DATA = gnuradio-vocoder.pc diff --git a/gnuradio-core/src/python/gnuradio/vocoder/.gitignore b/gr-vocoder/apps/.gitignore index b336cc7ce..b336cc7ce 100644 --- a/gnuradio-core/src/python/gnuradio/vocoder/.gitignore +++ b/gr-vocoder/apps/.gitignore diff --git a/gr-cvsd-vocoder/src/Makefile.am b/gr-vocoder/apps/Makefile.am index be38b7c1a..b1c7b44d5 100644 --- a/gr-cvsd-vocoder/src/Makefile.am +++ b/gr-vocoder/apps/Makefile.am @@ -1,5 +1,5 @@ # -# Copyright 2004 Free Software Foundation, Inc. +# Copyright 2011 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -19,7 +19,6 @@ # Boston, MA 02110-1301, USA. # -SUBDIRS = lib -if PYTHON -SUBDIRS += python -endif +include $(top_srcdir)/Makefile.common + +SUBDIRS = diff --git a/gr-cvsd-vocoder/src/.gitignore b/gr-vocoder/doc/.gitignore index b336cc7ce..b336cc7ce 100644 --- a/gr-cvsd-vocoder/src/.gitignore +++ b/gr-vocoder/doc/.gitignore diff --git a/gnuradio-core/src/python/gnuradio/vocoder/Makefile.am b/gr-vocoder/doc/Makefile.am index 69c140c10..b1c7b44d5 100644 --- a/gnuradio-core/src/python/gnuradio/vocoder/Makefile.am +++ b/gr-vocoder/doc/Makefile.am @@ -1,5 +1,5 @@ # -# Copyright 2004,2007 Free Software Foundation, Inc. +# Copyright 2011 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -21,6 +21,4 @@ include $(top_srcdir)/Makefile.common -grvocoderpythondir = $(grpythondir)/vocoder -grvocoderpython_PYTHON = \ - __init__.py +SUBDIRS = diff --git a/gr-cvsd-vocoder/src/python/.gitignore b/gr-vocoder/examples/.gitignore index 604b402c5..0a864cc38 100644 --- a/gr-cvsd-vocoder/src/python/.gitignore +++ b/gr-vocoder/examples/.gitignore @@ -1,3 +1,3 @@ /Makefile /Makefile.in -/run_tests + diff --git a/gr-vocoder/examples/CMakeLists.txt b/gr-vocoder/examples/CMakeLists.txt new file mode 100644 index 000000000..9f8172a75 --- /dev/null +++ b/gr-vocoder/examples/CMakeLists.txt @@ -0,0 +1,37 @@ +# Copyright 2011 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio 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 General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. + +######################################################################## +# Install Examples +######################################################################## +INCLUDE(GrPython) + +GR_PYTHON_INSTALL( + PROGRAMS + alaw_audio_loopback.py + codec2_audio_loopback.py + cvsd_audio_loopback.py + g721_audio_loopback.py + g723_24_audio_loopback.py + g723_40_audio_loopback.py + gsm_audio_loopback.py + ulaw_audio_loopback.py + DESTINATION ${GR_PKG_DATA_DIR}/examples/vocoder + COMPONENT "vocoder_examples" +) diff --git a/gr-vocoder/examples/Makefile.am b/gr-vocoder/examples/Makefile.am new file mode 100644 index 000000000..32176cf23 --- /dev/null +++ b/gr-vocoder/examples/Makefile.am @@ -0,0 +1,34 @@ +# +# Copyright 2011 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio 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 General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. +# + +include $(top_srcdir)/Makefile.common + +ourdatadir = $(exampledir)/vocoder + +dist_ourdata_SCRIPTS = \ + alaw_audio_loopback.py \ + codec2_audio_loopback.py \ + cvsd_audio_loopback.py \ + g721_audio_loopback.py \ + g723_24_audio_loopback.py \ + g723_40_audio_loopback.py \ + gsm_audio_loopback.py \ + ulaw_audio_loopback.py diff --git a/gr-gsm-fr-vocoder/src/python/encdec.py b/gr-vocoder/examples/alaw_audio_loopback.py index 94e4e5b82..8fdd64d44 100755 --- a/gr-gsm-fr-vocoder/src/python/encdec.py +++ b/gr-vocoder/examples/alaw_audio_loopback.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2005,2007 Free Software Foundation, Inc. +# Copyright 2011 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -22,15 +22,15 @@ from gnuradio import gr from gnuradio import audio -from gnuradio.vocoder import gsm_full_rate +from gnuradio import vocoder def build_graph(): tb = gr.top_block() src = audio.source(8000) src_scale = gr.multiply_const_ff(32767) f2s = gr.float_to_short () - enc = gsm_full_rate.encode_sp() - dec = gsm_full_rate.decode_ps() + enc = vocoder.alaw_encode_sb() + dec = vocoder.alaw_decode_bs() s2f = gr.short_to_float () sink_scale = gr.multiply_const_ff(1.0/32767.) sink = audio.sink(8000) @@ -42,3 +42,4 @@ if __name__ == '__main__': tb.start() raw_input ('Press Enter to exit: ') tb.stop() + tb.wait() diff --git a/gr-vocoder/examples/codec2_audio_loopback.py b/gr-vocoder/examples/codec2_audio_loopback.py new file mode 100755 index 000000000..54b453f8a --- /dev/null +++ b/gr-vocoder/examples/codec2_audio_loopback.py @@ -0,0 +1,45 @@ +#!/usr/bin/env python +# +# Copyright 2005,2007,2011 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio 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 General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. +# + +from gnuradio import gr +from gnuradio import audio +from gnuradio import vocoder + +def build_graph(): + tb = gr.top_block() + src = audio.source(8000) + src_scale = gr.multiply_const_ff(32767) + f2s = gr.float_to_short () + enc = vocoder.codec2_encode_sp() + dec = vocoder.codec2_decode_ps() + s2f = gr.short_to_float () + sink_scale = gr.multiply_const_ff(1.0/32767.) + sink = audio.sink(8000) + tb.connect(src, src_scale, f2s, enc, dec, s2f, sink_scale, sink) + return tb + +if __name__ == '__main__': + tb = build_graph() + tb.start() + raw_input ('Press Enter to exit: ') + tb.stop() + tb.wait() diff --git a/gr-cvsd-vocoder/src/python/encdec.py b/gr-vocoder/examples/cvsd_audio_loopback.py index 34c153b06..7f2a00dbf 100755 --- a/gr-cvsd-vocoder/src/python/encdec.py +++ b/gr-vocoder/examples/cvsd_audio_loopback.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2007 Free Software Foundation, Inc. +# Copyright 2007,2011 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -22,7 +22,7 @@ from gnuradio import gr, blks2 from gnuradio import audio -from gnuradio.vocoder import cvsd_vocoder +from gnuradio import vocoder def build_graph(): sample_rate = 8000 @@ -35,8 +35,8 @@ def build_graph(): interp = blks2.rational_resampler_fff(8, 1) f2s = gr.float_to_short () - enc = cvsd_vocoder.encode_sb() - dec = cvsd_vocoder.decode_bs() + enc = vocoder.cvsd_encode_sb() + dec = vocoder.cvsd_decode_bs() s2f = gr.short_to_float () decim = blks2.rational_resampler_fff(1, 8) @@ -62,8 +62,7 @@ def build_graph(): if __name__ == '__main__': tb = build_graph() - print "Enter CTRL-C to stop" - try: - tb.run() - except KeyboardInterrupt: - pass + tb.start() + raw_input ('Press Enter to exit: ') + tb.stop() + tb.wait() diff --git a/gr-vocoder/examples/g721_audio_loopback.py b/gr-vocoder/examples/g721_audio_loopback.py new file mode 100755 index 000000000..8b5bc8f33 --- /dev/null +++ b/gr-vocoder/examples/g721_audio_loopback.py @@ -0,0 +1,45 @@ +#!/usr/bin/env python +# +# Copyright 2011 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio 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 General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. +# + +from gnuradio import gr +from gnuradio import audio +from gnuradio import vocoder + +def build_graph(): + tb = gr.top_block() + src = audio.source(8000) + src_scale = gr.multiply_const_ff(32767) + f2s = gr.float_to_short () + enc = vocoder.g721_encode_sb() + dec = vocoder.g721_decode_bs() + s2f = gr.short_to_float () + sink_scale = gr.multiply_const_ff(1.0/32767.) + sink = audio.sink(8000) + tb.connect(src, src_scale, f2s, enc, dec, s2f, sink_scale, sink) + return tb + +if __name__ == '__main__': + tb = build_graph() + tb.start() + raw_input ('Press Enter to exit: ') + tb.stop() + tb.wait() diff --git a/gr-vocoder/examples/g723_24_audio_loopback.py b/gr-vocoder/examples/g723_24_audio_loopback.py new file mode 100755 index 000000000..f125282dc --- /dev/null +++ b/gr-vocoder/examples/g723_24_audio_loopback.py @@ -0,0 +1,45 @@ +#!/usr/bin/env python +# +# Copyright 2011 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio 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 General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. +# + +from gnuradio import gr +from gnuradio import audio +from gnuradio import vocoder + +def build_graph(): + tb = gr.top_block() + src = audio.source(8000) + src_scale = gr.multiply_const_ff(32767) + f2s = gr.float_to_short () + enc = vocoder.g723_24_encode_sb() + dec = vocoder.g723_24_decode_bs() + s2f = gr.short_to_float () + sink_scale = gr.multiply_const_ff(1.0/32767.) + sink = audio.sink(8000) + tb.connect(src, src_scale, f2s, enc, dec, s2f, sink_scale, sink) + return tb + +if __name__ == '__main__': + tb = build_graph() + tb.start() + raw_input ('Press Enter to exit: ') + tb.stop() + tb.wait() diff --git a/gr-vocoder/examples/g723_40_audio_loopback.py b/gr-vocoder/examples/g723_40_audio_loopback.py new file mode 100755 index 000000000..cd2ea5ff1 --- /dev/null +++ b/gr-vocoder/examples/g723_40_audio_loopback.py @@ -0,0 +1,45 @@ +#!/usr/bin/env python +# +# Copyright 2011 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio 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 General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. +# + +from gnuradio import gr +from gnuradio import audio +from gnuradio import vocoder + +def build_graph(): + tb = gr.top_block() + src = audio.source(8000) + src_scale = gr.multiply_const_ff(32767) + f2s = gr.float_to_short () + enc = vocoder.g723_40_encode_sb() + dec = vocoder.g723_40_decode_bs() + s2f = gr.short_to_float () + sink_scale = gr.multiply_const_ff(1.0/32767.) + sink = audio.sink(8000) + tb.connect(src, src_scale, f2s, enc, dec, s2f, sink_scale, sink) + return tb + +if __name__ == '__main__': + tb = build_graph() + tb.start() + raw_input ('Press Enter to exit: ') + tb.stop() + tb.wait() diff --git a/gr-vocoder/examples/gsm_audio_loopback.py b/gr-vocoder/examples/gsm_audio_loopback.py new file mode 100755 index 000000000..f4e96f471 --- /dev/null +++ b/gr-vocoder/examples/gsm_audio_loopback.py @@ -0,0 +1,45 @@ +#!/usr/bin/env python +# +# Copyright 2005,2007,2011 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio 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 General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. +# + +from gnuradio import gr +from gnuradio import audio +from gnuradio import vocoder + +def build_graph(): + tb = gr.top_block() + src = audio.source(8000) + src_scale = gr.multiply_const_ff(32767) + f2s = gr.float_to_short () + enc = vocoder.gsm_fr_encode_sp() + dec = vocoder.gsm_fr_decode_ps() + s2f = gr.short_to_float () + sink_scale = gr.multiply_const_ff(1.0/32767.) + sink = audio.sink(8000) + tb.connect(src, src_scale, f2s, enc, dec, s2f, sink_scale, sink) + return tb + +if __name__ == '__main__': + tb = build_graph() + tb.start() + raw_input ('Press Enter to exit: ') + tb.stop() + tb.wait() diff --git a/gr-vocoder/examples/ulaw_audio_loopback.py b/gr-vocoder/examples/ulaw_audio_loopback.py new file mode 100755 index 000000000..afe0921fa --- /dev/null +++ b/gr-vocoder/examples/ulaw_audio_loopback.py @@ -0,0 +1,45 @@ +#!/usr/bin/env python +# +# Copyright 2011 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio 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 General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. +# + +from gnuradio import gr +from gnuradio import audio +from gnuradio import vocoder + +def build_graph(): + tb = gr.top_block() + src = audio.source(8000) + src_scale = gr.multiply_const_ff(32767) + f2s = gr.float_to_short () + enc = vocoder.ulaw_encode_sb() + dec = vocoder.ulaw_decode_bs() + s2f = gr.short_to_float () + sink_scale = gr.multiply_const_ff(1.0/32767.) + sink = audio.sink(8000) + tb.connect(src, src_scale, f2s, enc, dec, s2f, sink_scale, sink) + return tb + +if __name__ == '__main__': + tb = build_graph() + tb.start() + raw_input ('Press Enter to exit: ') + tb.stop() + tb.wait() diff --git a/gr-cvsd-vocoder/gnuradio-cvsd-vocoder.pc.in b/gr-vocoder/gnuradio-vocoder.pc.in index f5f0c2e64..7ff4420b6 100644 --- a/gr-cvsd-vocoder/gnuradio-cvsd-vocoder.pc.in +++ b/gr-vocoder/gnuradio-vocoder.pc.in @@ -3,9 +3,9 @@ exec_prefix=@exec_prefix@ libdir=@libdir@ includedir=@includedir@ -Name: gnuradio-cvsd-vocoder -Description: GNU Radio blocks implementing a CVSD vocoder +Name: gnuradio-vocoder +Description: GNU Radio blocks implementing voice codecs Requires: gnuradio-core Version: @LIBVER@ -Libs: -L${libdir} -lgnuradio-cvsd-vocoder +Libs: -L${libdir} -lgnuradio-vocoder Cflags: -I${includedir} diff --git a/gr-cvsd-vocoder/src/lib/.gitignore b/gr-vocoder/grc/.gitignore index ea0a01678..d2e2e9ce8 100644 --- a/gr-cvsd-vocoder/src/lib/.gitignore +++ b/gr-vocoder/grc/.gitignore @@ -2,8 +2,6 @@ /Makefile.in /.libs /.deps -/cvsd_vocoder.cc -/cvsd_vocoder.py* /gnuradio /guile /python diff --git a/gr-cvsd-vocoder/Makefile.am b/gr-vocoder/grc/Makefile.am index 48807a34b..b1c7b44d5 100644 --- a/gr-cvsd-vocoder/Makefile.am +++ b/gr-vocoder/grc/Makefile.am @@ -1,5 +1,5 @@ # -# Copyright 2004 Free Software Foundation, Inc. +# Copyright 2011 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -21,7 +21,4 @@ include $(top_srcdir)/Makefile.common -SUBDIRS = src - -pkgconfigdir = $(libdir)/pkgconfig -dist_pkgconfig_DATA = gnuradio-cvsd-vocoder.pc +SUBDIRS = diff --git a/gr-vocoder/include/.gitignore b/gr-vocoder/include/.gitignore new file mode 100644 index 000000000..b336cc7ce --- /dev/null +++ b/gr-vocoder/include/.gitignore @@ -0,0 +1,2 @@ +/Makefile +/Makefile.in diff --git a/gr-vocoder/include/CMakeLists.txt b/gr-vocoder/include/CMakeLists.txt new file mode 100644 index 000000000..390a0afb5 --- /dev/null +++ b/gr-vocoder/include/CMakeLists.txt @@ -0,0 +1,43 @@ +# Copyright 2011 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio 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 General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. + +######################################################################## +# Install header files +######################################################################## +INSTALL(FILES + vocoder_api.h + vocoder_alaw_decode_bs.h + vocoder_alaw_encode_sb.h + vocoder_codec2_decode_ps.h + vocoder_codec2_encode_sp.h + vocoder_cvsd_decode_bs.h + vocoder_cvsd_encode_sb.h + vocoder_g721_decode_bs.h + vocoder_g721_encode_sb.h + vocoder_g723_24_decode_bs.h + vocoder_g723_24_encode_sb.h + vocoder_g723_40_decode_bs.h + vocoder_g723_40_encode_sb.h + vocoder_gsm_fr_decode_ps.h + vocoder_gsm_fr_encode_sp.h + vocoder_ulaw_decode_bs.h + vocoder_ulaw_encode_sb.h + DESTINATION ${GR_INCLUDE_DIR}/gnuradio + COMPONENT "vocoder_devel" +) diff --git a/gr-vocoder/include/Makefile.am b/gr-vocoder/include/Makefile.am new file mode 100644 index 000000000..b579333a3 --- /dev/null +++ b/gr-vocoder/include/Makefile.am @@ -0,0 +1,42 @@ +# +# Copyright 2011 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio 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 General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. +# + +include $(top_srcdir)/Makefile.common + +# C/C++ headers get installed in ${prefix}/include/gnuradio +grinclude_HEADERS = \ + vocoder_api.h \ + vocoder_alaw_decode_bs.h \ + vocoder_alaw_encode_sb.h \ + vocoder_codec2_decode_ps.h \ + vocoder_codec2_encode_sp.h \ + vocoder_cvsd_decode_bs.h \ + vocoder_cvsd_encode_sb.h \ + vocoder_g721_decode_bs.h \ + vocoder_g721_encode_sb.h \ + vocoder_g723_24_decode_bs.h \ + vocoder_g723_24_encode_sb.h \ + vocoder_g723_40_decode_bs.h \ + vocoder_g723_40_encode_sb.h \ + vocoder_gsm_fr_decode_ps.h \ + vocoder_gsm_fr_encode_sp.h \ + vocoder_ulaw_decode_bs.h \ + vocoder_ulaw_encode_sb.h diff --git a/gr-vocoder/include/vocoder_alaw_decode_bs.h b/gr-vocoder/include/vocoder_alaw_decode_bs.h new file mode 100644 index 000000000..f20dfefdb --- /dev/null +++ b/gr-vocoder/include/vocoder_alaw_decode_bs.h @@ -0,0 +1,56 @@ +/* -*- c++ -*- */ +/* + * Copyright 2011 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio 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 General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifndef INCLUDED_VOCODER_ALAW_DECODE_BS_H +#define INCLUDED_VOCODER_ALAW_DECODE_BS_H + +#include <vocoder_api.h> +#include <gr_sync_block.h> + +class vocoder_alaw_decode_bs; + +typedef boost::shared_ptr<vocoder_alaw_decode_bs> vocoder_alaw_decode_bs_sptr; + +VOCODER_API vocoder_alaw_decode_bs_sptr vocoder_make_alaw_decode_bs(); + +/*! + * \brief This block performs alaw audio decoding. + * + * \ingroup vocoder_blk + */ + +class VOCODER_API vocoder_alaw_decode_bs : public gr_sync_block +{ +private: + friend VOCODER_API vocoder_alaw_decode_bs_sptr vocoder_make_alaw_decode_bs(); + + vocoder_alaw_decode_bs(); + + public: + ~vocoder_alaw_decode_bs(); + + int work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items); +}; + +#endif /* INCLUDED_VOCODER_ALAW_DECODE_BS_H */ diff --git a/gr-vocoder/include/vocoder_alaw_encode_sb.h b/gr-vocoder/include/vocoder_alaw_encode_sb.h new file mode 100644 index 000000000..c00080fb7 --- /dev/null +++ b/gr-vocoder/include/vocoder_alaw_encode_sb.h @@ -0,0 +1,55 @@ +/* -*- c++ -*- */ +/* + * Copyright 2011 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio 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 General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifndef INCLUDED_VOCODER_ALAW_ENCODER_SB_H +#define INCLUDED_VOCODER_ALAW_ENCODER_SB_H + +#include <vocoder_api.h> +#include <gr_sync_block.h> + +class vocoder_alaw_encode_sb; + +typedef boost::shared_ptr<vocoder_alaw_encode_sb> vocoder_alaw_encode_sb_sptr; + +VOCODER_API vocoder_alaw_encode_sb_sptr vocoder_make_alaw_encode_sb(); + +/*! + * \brief This block performs g.711 alaw audio encoding. + * + * \ingroup vocoder_blk + */ +class VOCODER_API vocoder_alaw_encode_sb : public gr_sync_block +{ +private: + friend VOCODER_API vocoder_alaw_encode_sb_sptr vocoder_make_alaw_encode_sb(); + + vocoder_alaw_encode_sb(); + + public: + ~vocoder_alaw_encode_sb(); + + int work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items); +}; + +#endif /* INCLUDED_VOCODER_ALAW_ENCODE_SB_H */ diff --git a/gr-vocoder/include/vocoder_api.h b/gr-vocoder/include/vocoder_api.h new file mode 100644 index 000000000..331cf5d0b --- /dev/null +++ b/gr-vocoder/include/vocoder_api.h @@ -0,0 +1,33 @@ +/* + * Copyright 2011 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio 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 General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifndef INCLUDED_VOCODER_API_H +#define INCLUDED_VOCODER_API_H + +#include <gruel/attributes.h> + +#ifdef gnuradio_vocoder_EXPORTS +# define VOCODER_API __GR_ATTR_EXPORT +#else +# define VOCODER_API __GR_ATTR_IMPORT +#endif + +#endif /* INCLUDED_VOCODER_API_H */ diff --git a/gr-vocoder/include/vocoder_codec2_decode_ps.h b/gr-vocoder/include/vocoder_codec2_decode_ps.h new file mode 100644 index 000000000..7e7ea2d5c --- /dev/null +++ b/gr-vocoder/include/vocoder_codec2_decode_ps.h @@ -0,0 +1,51 @@ +/* -*- c++ -*- */ +/* + * Copyright 2011 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio 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 General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ +#ifndef INCLUDED_VOCODER_CODEC2_DECODE_PS_H +#define INCLUDED_VOCODER_CODEC2_DECODE_PS_H + +#include <vocoder_api.h> +#include <gr_sync_interpolator.h> + +class vocoder_codec2_decode_ps; +typedef boost::shared_ptr<vocoder_codec2_decode_ps> vocoder_codec2_decode_ps_sptr; + +VOCODER_API vocoder_codec2_decode_ps_sptr vocoder_make_codec2_decode_ps (); + +/*! + * \brief CODEC2 Vocoder Decoder + * \ingroup vocoder_blk + */ +class VOCODER_API vocoder_codec2_decode_ps : public gr_sync_interpolator { + void *d_codec2; + + friend VOCODER_API vocoder_codec2_decode_ps_sptr vocoder_make_codec2_decode_ps (); + vocoder_codec2_decode_ps (); + +public: + ~vocoder_codec2_decode_ps (); + + int work (int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items); +}; + +#endif /* INCLUDED_VOCODER_CODEC2_DECODE_PS_H */ diff --git a/gr-vocoder/include/vocoder_codec2_encode_sp.h b/gr-vocoder/include/vocoder_codec2_encode_sp.h new file mode 100644 index 000000000..8d8588daf --- /dev/null +++ b/gr-vocoder/include/vocoder_codec2_encode_sp.h @@ -0,0 +1,51 @@ +/* -*- c++ -*- */ +/* + * Copyright 2005 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio 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 General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ +#ifndef INCLUDED_VOCODER_CODEC2_ENCODE_SP_H +#define INCLUDED_VOCODER_CODEC2_ENCODE_SP_H + +#include <vocoder_api.h> +#include <gr_sync_decimator.h> + +class vocoder_codec2_encode_sp; +typedef boost::shared_ptr<vocoder_codec2_encode_sp> vocoder_codec2_encode_sp_sptr; + +VOCODER_API vocoder_codec2_encode_sp_sptr vocoder_make_codec2_encode_sp (); + +/*! + * \brief CODEC2 Vocoder Encoder + * \ingroup vocoder_blk + */ +class VOCODER_API vocoder_codec2_encode_sp : public gr_sync_decimator { + void *d_codec2; + + friend VOCODER_API vocoder_codec2_encode_sp_sptr vocoder_make_codec2_encode_sp (); + vocoder_codec2_encode_sp (); + +public: + ~vocoder_codec2_encode_sp (); + + int work (int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items); +}; + +#endif /* INCLUDED_VOCODER_CODEC2_ENCODE_SP_H */ diff --git a/gr-cvsd-vocoder/src/lib/cvsd_decode_bs.h b/gr-vocoder/include/vocoder_cvsd_decode_bs.h index f7b50909f..1204e298b 100644 --- a/gr-cvsd-vocoder/src/lib/cvsd_decode_bs.h +++ b/gr-vocoder/include/vocoder_cvsd_decode_bs.h @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2007 Free Software Foundation, Inc. + * Copyright 2007,2011 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -19,14 +19,16 @@ * the Free Software Foundation, Inc., 51 Franklin Street, * Boston, MA 02110-1301, USA. */ -#ifndef INCLUDED_CVSD_DECODE_BS_H -#define INCLUDED_CVSD_DECODE_BS_H +#ifndef INCLUDED_VOCODER_CVSD_DECODE_BS_H +#define INCLUDED_VOCODER_CVSD_DECODE_BS_H + +#include <vocoder_api.h> #include <gr_sync_interpolator.h> -class cvsd_decode_bs; +class vocoder_cvsd_decode_bs; -typedef boost::shared_ptr<cvsd_decode_bs> cvsd_decode_bs_sptr; +typedef boost::shared_ptr<vocoder_cvsd_decode_bs> vocoder_cvsd_decode_bs_sptr; /*! * \brief Constructor parameters to initialize the CVSD decoder. The default @@ -43,14 +45,14 @@ typedef boost::shared_ptr<cvsd_decode_bs> cvsd_decode_bs_sptr; * \param neg_accum_max Minimum integer value allowed for the internal reference. Default: "-32767" (-2^15 + 1 or MINSHORT+1) * */ -cvsd_decode_bs_sptr cvsd_make_decode_bs (short min_step=10, - short max_step=1280, - double step_decay=0.9990234375, - double accum_decay= 0.96875, - int K=32, - int J=4, - short pos_accum_max=32767, - short neg_accum_max=-32767); +VOCODER_API vocoder_cvsd_decode_bs_sptr vocoder_make_cvsd_decode_bs (short min_step=10, + short max_step=1280, + double step_decay=0.9990234375, + double accum_decay= 0.96875, + int K=32, + int J=4, + short pos_accum_max=32767, + short neg_accum_max=-32767); /*! * \brief This block performs CVSD audio decoding. Its design and implementation @@ -104,21 +106,21 @@ cvsd_decode_bs_sptr cvsd_make_decode_bs (short min_step=10, * */ -class cvsd_decode_bs : public gr_sync_interpolator +class VOCODER_API vocoder_cvsd_decode_bs : public gr_sync_interpolator { private: - friend cvsd_decode_bs_sptr cvsd_make_decode_bs (short min_step, - short max_step, - double step_decay, - double accum_decay, - int K, - int J, - short pos_accum_max, - short neg_accum_max); - - cvsd_decode_bs (short min_step, short max_step, double step_decay, - double accum_decay, int K, int J, - short pos_accum_max, short neg_accum_max); + friend VOCODER_API vocoder_cvsd_decode_bs_sptr vocoder_make_cvsd_decode_bs (short min_step, + short max_step, + double step_decay, + double accum_decay, + int K, + int J, + short pos_accum_max, + short neg_accum_max); + + vocoder_cvsd_decode_bs (short min_step, short max_step, double step_decay, + double accum_decay, int K, int J, + short pos_accum_max, short neg_accum_max); //! Member functions required by the encoder/decoder //! \brief Rounding function specific to CVSD @@ -151,7 +153,7 @@ private: short d_stepsize; //!< \brief Current value of the step sizer public: - ~cvsd_decode_bs (); // public destructor + ~vocoder_cvsd_decode_bs (); // public destructor short min_step() { return d_min_step; } short max_step() { return d_max_step; } @@ -167,4 +169,4 @@ private: gr_vector_void_star &output_items); }; -#endif /* INCLUDED_CVSD_DECODE_BS_H */ +#endif /* INCLUDED_VOCODER_CVSD_DECODE_BS_H */ diff --git a/gr-cvsd-vocoder/src/lib/cvsd_encode_sb.h b/gr-vocoder/include/vocoder_cvsd_encode_sb.h index a7994d4ed..4a2d31147 100644 --- a/gr-cvsd-vocoder/src/lib/cvsd_encode_sb.h +++ b/gr-vocoder/include/vocoder_cvsd_encode_sb.h @@ -19,14 +19,15 @@ * the Free Software Foundation, Inc., 51 Franklin Street, * Boston, MA 02110-1301, USA. */ -#ifndef INCLUDED_CVSD_ENCODER_SB_H -#define INCLUDED_CVSD_ENCODER_SB_H +#ifndef INCLUDED_VOCODER_CVSD_ENCODER_SB_H +#define INCLUDED_VOCODER_CVSD_ENCODER_SB_H +#include <vocoder_api.h> #include <gr_sync_decimator.h> -class cvsd_encode_sb; +class vocoder_cvsd_encode_sb; -typedef boost::shared_ptr<cvsd_encode_sb> cvsd_encode_sb_sptr; +typedef boost::shared_ptr<vocoder_cvsd_encode_sb> vocoder_cvsd_encode_sb_sptr; /*! * \brief Constructor parameters to initialize the CVSD encoder. The default @@ -44,14 +45,14 @@ typedef boost::shared_ptr<cvsd_encode_sb> cvsd_encode_sb_sptr; * */ -cvsd_encode_sb_sptr cvsd_make_encode_sb (short min_step=10, - short max_step=1280, - double step_decay=0.9990234375, - double accum_decay= 0.96875, - int K=32, - int J=4, - short pos_accum_max=32767, - short neg_accum_max=-32767); +VOCODER_API vocoder_cvsd_encode_sb_sptr vocoder_make_cvsd_encode_sb(short min_step=10, + short max_step=1280, + double step_decay=0.9990234375, + double accum_decay= 0.96875, + int K=32, + int J=4, + short pos_accum_max=32767, + short neg_accum_max=-32767); /*! * \brief This block performs CVSD audio encoding. Its design and implementation @@ -107,21 +108,21 @@ cvsd_encode_sb_sptr cvsd_make_encode_sb (short min_step=10, * */ -class cvsd_encode_sb : public gr_sync_decimator +class VOCODER_API vocoder_cvsd_encode_sb : public gr_sync_decimator { private: - friend cvsd_encode_sb_sptr cvsd_make_encode_sb (short min_step, - short max_step, - double step_decay, - double accum_decay, - int K, - int J, - short pos_accum_max, - short neg_accum_max); + friend VOCODER_API vocoder_cvsd_encode_sb_sptr vocoder_make_cvsd_encode_sb(short min_step, + short max_step, + double step_decay, + double accum_decay, + int K, + int J, + short pos_accum_max, + short neg_accum_max); - cvsd_encode_sb (short min_step, short max_step, double step_decay, - double accum_decay, int K, int J, - short pos_accum_max, short neg_accum_max); + vocoder_cvsd_encode_sb(short min_step, short max_step, double step_decay, + double accum_decay, int K, int J, + short pos_accum_max, short neg_accum_max); //! Member functions required by the encoder/decoder //! \brief Rounding function specific to CVSD @@ -154,7 +155,7 @@ private: short d_stepsize; //!< \brief Current value of the step sizer public: - ~cvsd_encode_sb (); // public destructor + ~vocoder_cvsd_encode_sb (); // public destructor short min_step() { return d_min_step; } short max_step() { return d_max_step; } @@ -170,4 +171,4 @@ private: gr_vector_void_star &output_items); }; -#endif /* INCLUDED_CVSD_ENCODE_SB_H */ +#endif /* INCLUDED_VOCODER_CVSD_ENCODE_SB_H */ diff --git a/gr-vocoder/include/vocoder_g721_decode_bs.h b/gr-vocoder/include/vocoder_g721_decode_bs.h new file mode 100644 index 000000000..1ac7b993a --- /dev/null +++ b/gr-vocoder/include/vocoder_g721_decode_bs.h @@ -0,0 +1,45 @@ +/* -*- c++ -*- */ +/* + * Copyright 2011 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio 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 General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifndef INCLUDED_VOCODER_G721_DECODE_BS_H +#define INCLUDED_VOCODER_G721_DECODE_BS_H + +#include <vocoder_api.h> +#include <gr_sync_block.h> + +class vocoder_g721_decode_bs; + +typedef boost::shared_ptr<vocoder_g721_decode_bs> vocoder_g721_decode_bs_sptr; + +VOCODER_API vocoder_g721_decode_bs_sptr vocoder_make_g721_decode_bs(); + +/*! + * \brief This block performs g721 audio decoding. + * + * \ingroup vocoder_blk + */ + +class VOCODER_API vocoder_g721_decode_bs : virtual public gr_sync_block +{ +}; + +#endif /* INCLUDED_VOCODER_G721_DECODE_BS_H */ diff --git a/gr-vocoder/include/vocoder_g721_encode_sb.h b/gr-vocoder/include/vocoder_g721_encode_sb.h new file mode 100644 index 000000000..a154537d0 --- /dev/null +++ b/gr-vocoder/include/vocoder_g721_encode_sb.h @@ -0,0 +1,45 @@ +/* -*- c++ -*- */ +/* + * Copyright 2011 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio 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 General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifndef INCLUDED_VOCODER_G721_ENCODE_SB_H +#define INCLUDED_VOCODER_G721_ENCODE_SB_H + +#include <vocoder_api.h> +#include <gr_sync_block.h> + +class vocoder_g721_encode_sb; + +typedef boost::shared_ptr<vocoder_g721_encode_sb> vocoder_g721_encode_sb_sptr; + +VOCODER_API vocoder_g721_encode_sb_sptr vocoder_make_g721_encode_sb(); + +/*! + * \brief This block performs g721 audio encoding. + * + * \ingroup vocoder_blk + */ + +class VOCODER_API vocoder_g721_encode_sb : virtual public gr_sync_block +{ +}; + +#endif /* INCLUDED_VOCODER_G721_ENCODE_SB_H */ diff --git a/gr-vocoder/include/vocoder_g723_24_decode_bs.h b/gr-vocoder/include/vocoder_g723_24_decode_bs.h new file mode 100644 index 000000000..80cdbddd4 --- /dev/null +++ b/gr-vocoder/include/vocoder_g723_24_decode_bs.h @@ -0,0 +1,45 @@ +/* -*- c++ -*- */ +/* + * Copyright 2011 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio 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 General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifndef INCLUDED_VOCODER_G723_24_DECODE_BS_H +#define INCLUDED_VOCODER_G723_24_DECODE_BS_H + +#include <vocoder_api.h> +#include <gr_sync_block.h> + +class vocoder_g723_24_decode_bs; + +typedef boost::shared_ptr<vocoder_g723_24_decode_bs> vocoder_g723_24_decode_bs_sptr; + +VOCODER_API vocoder_g723_24_decode_bs_sptr vocoder_make_g723_24_decode_bs(); + +/*! + * \brief This block performs g723_24 audio decoding. + * + * \ingroup vocoder_blk + */ + +class VOCODER_API vocoder_g723_24_decode_bs : virtual public gr_sync_block +{ +}; + +#endif /* INCLUDED_VOCODER_G723_24_DECODE_BS_H */ diff --git a/gr-vocoder/include/vocoder_g723_24_encode_sb.h b/gr-vocoder/include/vocoder_g723_24_encode_sb.h new file mode 100644 index 000000000..d290e0971 --- /dev/null +++ b/gr-vocoder/include/vocoder_g723_24_encode_sb.h @@ -0,0 +1,45 @@ +/* -*- c++ -*- */ +/* + * Copyright 2011 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio 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 General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifndef INCLUDED_VOCODER_G723_24_ENCODE_SB_H +#define INCLUDED_VOCODER_G723_24_ENCODE_SB_H + +#include <vocoder_api.h> +#include <gr_sync_block.h> + +class vocoder_g723_24_encode_sb; + +typedef boost::shared_ptr<vocoder_g723_24_encode_sb> vocoder_g723_24_encode_sb_sptr; + +VOCODER_API vocoder_g723_24_encode_sb_sptr vocoder_make_g723_24_encode_sb(); + +/*! + * \brief This block performs g723_24 audio encoding. + * + * \ingroup vocoder_blk + */ + +class VOCODER_API vocoder_g723_24_encode_sb : virtual public gr_sync_block +{ +}; + +#endif /* INCLUDED_VOCODER_G723_24_ENCODE_SB_H */ diff --git a/gr-vocoder/include/vocoder_g723_40_decode_bs.h b/gr-vocoder/include/vocoder_g723_40_decode_bs.h new file mode 100644 index 000000000..87a2f6892 --- /dev/null +++ b/gr-vocoder/include/vocoder_g723_40_decode_bs.h @@ -0,0 +1,45 @@ +/* -*- c++ -*- */ +/* + * Copyright 2011 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio 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 General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifndef INCLUDED_VOCODER_G723_40_DECODE_BS_H +#define INCLUDED_VOCODER_G723_40_DECODE_BS_H + +#include <vocoder_api.h> +#include <gr_sync_block.h> + +class vocoder_g723_40_decode_bs; + +typedef boost::shared_ptr<vocoder_g723_40_decode_bs> vocoder_g723_40_decode_bs_sptr; + +VOCODER_API vocoder_g723_40_decode_bs_sptr vocoder_make_g723_40_decode_bs(); + +/*! + * \brief This block performs g723_40 audio decoding. + * + * \ingroup vocoder_blk + */ + +class VOCODER_API vocoder_g723_40_decode_bs : virtual public gr_sync_block +{ +}; + +#endif /* INCLUDED_VOCODER_G723_40_DECODE_BS_H */ diff --git a/gr-vocoder/include/vocoder_g723_40_encode_sb.h b/gr-vocoder/include/vocoder_g723_40_encode_sb.h new file mode 100644 index 000000000..6ac0f6d05 --- /dev/null +++ b/gr-vocoder/include/vocoder_g723_40_encode_sb.h @@ -0,0 +1,45 @@ +/* -*- c++ -*- */ +/* + * Copyright 2011 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio 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 General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifndef INCLUDED_VOCODER_G723_40_ENCODE_SB_H +#define INCLUDED_VOCODER_G723_40_ENCODE_SB_H + +#include <vocoder_api.h> +#include <gr_sync_block.h> + +class vocoder_g723_40_encode_sb; + +typedef boost::shared_ptr<vocoder_g723_40_encode_sb> vocoder_g723_40_encode_sb_sptr; + +VOCODER_API vocoder_g723_40_encode_sb_sptr vocoder_make_g723_40_encode_sb(); + +/*! + * \brief This block performs g723_40 audio encoding. + * + * \ingroup vocoder_blk + */ + +class VOCODER_API vocoder_g723_40_encode_sb : virtual public gr_sync_block +{ +}; + +#endif /* INCLUDED_VOCODER_G723_40_ENCODE_SB_H */ diff --git a/gr-gsm-fr-vocoder/src/lib/gsm_fr_decode_ps.h b/gr-vocoder/include/vocoder_gsm_fr_decode_ps.h index 8002c2ce3..748ff5f0f 100644 --- a/gr-gsm-fr-vocoder/src/lib/gsm_fr_decode_ps.h +++ b/gr-vocoder/include/vocoder_gsm_fr_decode_ps.h @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2005 Free Software Foundation, Inc. + * Copyright 2005,2011 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -19,32 +19,34 @@ * the Free Software Foundation, Inc., 51 Franklin Street, * Boston, MA 02110-1301, USA. */ -#ifndef INCLUDED_GSM_FR_DECODE_PS_H -#define INCLUDED_GSM_FR_DECODE_PS_H +#ifndef INCLUDED_VOCODER_GSM_FR_DECODE_PS_H +#define INCLUDED_VOCODER_GSM_FR_DECODE_PS_H + +#include <vocoder_api.h> #include <gr_sync_interpolator.h> -class gsm_fr_decode_ps; -typedef boost::shared_ptr<gsm_fr_decode_ps> gsm_fr_decode_ps_sptr; +class vocoder_gsm_fr_decode_ps; +typedef boost::shared_ptr<vocoder_gsm_fr_decode_ps> vocoder_gsm_fr_decode_ps_sptr; -gsm_fr_decode_ps_sptr gsm_fr_make_decode_ps (); +VOCODER_API vocoder_gsm_fr_decode_ps_sptr vocoder_make_gsm_fr_decode_ps (); /*! * \brief GSM 06.10 Full Rate Vocoder Decoder * \ingroup vocoder_blk */ -class gsm_fr_decode_ps : public gr_sync_interpolator { +class VOCODER_API vocoder_gsm_fr_decode_ps : public gr_sync_interpolator { struct gsm_state *d_gsm; - friend gsm_fr_decode_ps_sptr gsm_fr_make_decode_ps (); - gsm_fr_decode_ps (); + friend VOCODER_API vocoder_gsm_fr_decode_ps_sptr vocoder_make_gsm_fr_decode_ps (); + vocoder_gsm_fr_decode_ps (); public: - ~gsm_fr_decode_ps (); + ~vocoder_gsm_fr_decode_ps (); int work (int noutput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items); }; -#endif /* INCLUDED_GSM_FR_DECODE_PS_H */ +#endif /* INCLUDED_VOCODER_GSM_FR_DECODE_PS_H */ diff --git a/gr-gsm-fr-vocoder/src/lib/gsm_fr_encode_sp.h b/gr-vocoder/include/vocoder_gsm_fr_encode_sp.h index f158a3d02..18f78f525 100644 --- a/gr-gsm-fr-vocoder/src/lib/gsm_fr_encode_sp.h +++ b/gr-vocoder/include/vocoder_gsm_fr_encode_sp.h @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2005 Free Software Foundation, Inc. + * Copyright 2005,2011 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -19,15 +19,17 @@ * the Free Software Foundation, Inc., 51 Franklin Street, * Boston, MA 02110-1301, USA. */ -#ifndef INCLUDED_GSM_FR_ENCODE_SP_H -#define INCLUDED_GSM_FR_ENCODE_SP_H +#ifndef INCLUDED_VOCODER_GSM_FR_ENCODE_SP_H +#define INCLUDED_VOCODER_GSM_FR_ENCODE_SP_H + +#include <vocoder_api.h> #include <gr_sync_decimator.h> -class gsm_fr_encode_sp; -typedef boost::shared_ptr<gsm_fr_encode_sp> gsm_fr_encode_sp_sptr; +class vocoder_gsm_fr_encode_sp; +typedef boost::shared_ptr<vocoder_gsm_fr_encode_sp> vocoder_gsm_fr_encode_sp_sptr; -gsm_fr_encode_sp_sptr gsm_fr_make_encode_sp (); +VOCODER_API vocoder_gsm_fr_encode_sp_sptr vocoder_make_gsm_fr_encode_sp (); /*! * \brief GSM 06.10 Full Rate Vocoder Encoder @@ -35,18 +37,18 @@ gsm_fr_encode_sp_sptr gsm_fr_make_encode_sp (); * * shorts in; 33 byte packets out */ -class gsm_fr_encode_sp : public gr_sync_decimator { +class VOCODER_API vocoder_gsm_fr_encode_sp : public gr_sync_decimator { struct gsm_state *d_gsm; - friend gsm_fr_encode_sp_sptr gsm_fr_make_encode_sp (); - gsm_fr_encode_sp (); + friend VOCODER_API vocoder_gsm_fr_encode_sp_sptr vocoder_make_gsm_fr_encode_sp (); + vocoder_gsm_fr_encode_sp (); public: - ~gsm_fr_encode_sp (); + ~vocoder_gsm_fr_encode_sp (); int work (int noutput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items); }; -#endif /* INCLUDED_GSM_FR_ENCODE_SP_H */ +#endif /* INCLUDED_VOCODER_GSM_FR_ENCODE_SP_H */ diff --git a/gr-vocoder/include/vocoder_ulaw_decode_bs.h b/gr-vocoder/include/vocoder_ulaw_decode_bs.h new file mode 100644 index 000000000..f69358168 --- /dev/null +++ b/gr-vocoder/include/vocoder_ulaw_decode_bs.h @@ -0,0 +1,56 @@ +/* -*- c++ -*- */ +/* + * Copyright 2011 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio 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 General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifndef INCLUDED_VOCODER_ULAW_DECODE_BS_H +#define INCLUDED_VOCODER_ULAW_DECODE_BS_H + +#include <vocoder_api.h> +#include <gr_sync_block.h> + +class vocoder_ulaw_decode_bs; + +typedef boost::shared_ptr<vocoder_ulaw_decode_bs> vocoder_ulaw_decode_bs_sptr; + +VOCODER_API vocoder_ulaw_decode_bs_sptr vocoder_make_ulaw_decode_bs(); + +/*! + * \brief This block performs ulaw audio decoding. + * + * \ingroup vocoder_blk + */ + +class VOCODER_API vocoder_ulaw_decode_bs : public gr_sync_block +{ +private: + friend VOCODER_API vocoder_ulaw_decode_bs_sptr vocoder_make_ulaw_decode_bs(); + + vocoder_ulaw_decode_bs(); + + public: + ~vocoder_ulaw_decode_bs(); + + int work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items); +}; + +#endif /* INCLUDED_VOCODER_ULAW_DECODE_BS_H */ diff --git a/gr-vocoder/include/vocoder_ulaw_encode_sb.h b/gr-vocoder/include/vocoder_ulaw_encode_sb.h new file mode 100644 index 000000000..a1c2af05b --- /dev/null +++ b/gr-vocoder/include/vocoder_ulaw_encode_sb.h @@ -0,0 +1,55 @@ +/* -*- c++ -*- */ +/* + * Copyright 2011 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio 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 General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifndef INCLUDED_VOCODER_ULAW_ENCODER_SB_H +#define INCLUDED_VOCODER_ULAW_ENCODER_SB_H + +#include <vocoder_api.h> +#include <gr_sync_block.h> + +class vocoder_ulaw_encode_sb; + +typedef boost::shared_ptr<vocoder_ulaw_encode_sb> vocoder_ulaw_encode_sb_sptr; + +VOCODER_API vocoder_ulaw_encode_sb_sptr vocoder_make_ulaw_encode_sb(); + +/*! + * \brief This block performs g.711 ulaw audio encoding. + * + * \ingroup vocoder_blk + */ +class VOCODER_API vocoder_ulaw_encode_sb : public gr_sync_block +{ +private: + friend VOCODER_API vocoder_ulaw_encode_sb_sptr vocoder_make_ulaw_encode_sb(); + + vocoder_ulaw_encode_sb(); + + public: + ~vocoder_ulaw_encode_sb(); + + int work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items); +}; + +#endif /* INCLUDED_VOCODER_ULAW_ENCODE_SB_H */ diff --git a/gnuradio-examples/python/digital_voice/.gitignore b/gr-vocoder/lib/.gitignore index c400497f5..d2e2e9ce8 100644 --- a/gnuradio-examples/python/digital_voice/.gitignore +++ b/gr-vocoder/lib/.gitignore @@ -1,10 +1,7 @@ /Makefile /Makefile.in -/.la -/.lo -/.deps /.libs -/*.la -/*.lo -/*.pyc -/*.pyo +/.deps +/gnuradio +/guile +/python diff --git a/gr-vocoder/lib/CMakeLists.txt b/gr-vocoder/lib/CMakeLists.txt new file mode 100644 index 000000000..74138b050 --- /dev/null +++ b/gr-vocoder/lib/CMakeLists.txt @@ -0,0 +1,74 @@ +# Copyright 2011 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio 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 General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. + +######################################################################## +# Setup the include and linker paths +######################################################################## +INCLUDE_DIRECTORIES( + ${GNURADIO_CORE_INCLUDE_DIRS} + ${GR_VOCODER_INCLUDE_DIRS} +) + +INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIRS}) +LINK_DIRECTORIES(${Boost_LIBRARY_DIRS}) + +######################################################################## +# Setup library +######################################################################## +LIST(APPEND gr_vocoder_sources + vocoder_alaw_decode_bs.cc + vocoder_alaw_encode_sb.cc + vocoder_codec2_decode_ps.cc + vocoder_codec2_encode_sp.cc + vocoder_cvsd_decode_bs.cc + vocoder_cvsd_encode_sb.cc + vocoder_g721_decode_bs.cc + vocoder_g721_encode_sb.cc + vocoder_g723_24_decode_bs.cc + vocoder_g723_24_encode_sb.cc + vocoder_g723_40_decode_bs.cc + vocoder_g723_40_encode_sb.cc + vocoder_gsm_fr_decode_ps.cc + vocoder_gsm_fr_encode_sp.cc + vocoder_ulaw_decode_bs.cc + vocoder_ulaw_encode_sb.cc +) + +######################################################################## +# Include subdirs rather to populate to the sources lists. +######################################################################## +GR_INCLUDE_SUBDIRECTORY(codec2) +GR_INCLUDE_SUBDIRECTORY(g7xx) +GR_INCLUDE_SUBDIRECTORY(gsm) + +LIST(APPEND vocoder_libs + gnuradio-core + ${Boost_LIBRARIES} +) + +ADD_LIBRARY(gnuradio-vocoder SHARED ${gr_vocoder_sources}) +TARGET_LINK_LIBRARIES(gnuradio-vocoder ${vocoder_libs}) +SET_TARGET_PROPERTIES(gnuradio-vocoder PROPERTIES DEFINE_SYMBOL "gnuradio_vocoder_EXPORTS") +SET_TARGET_PROPERTIES(gnuradio-vocoder PROPERTIES SOVERSION ${LIBVER}) + +INSTALL(TARGETS gnuradio-vocoder + LIBRARY DESTINATION ${GR_LIBRARY_DIR} COMPONENT "vocoder_runtime" # .so/.dylib file + ARCHIVE DESTINATION ${GR_LIBRARY_DIR} COMPONENT "vocoder_devel" # .lib file + RUNTIME DESTINATION ${GR_RUNTIME_DIR} COMPONENT "vocoder_runtime" # .dll file +) diff --git a/gr-vocoder/lib/Makefile.am b/gr-vocoder/lib/Makefile.am new file mode 100644 index 000000000..158347ffe --- /dev/null +++ b/gr-vocoder/lib/Makefile.am @@ -0,0 +1,55 @@ +# +# Copyright 2011 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio 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 General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. +# + +include $(top_srcdir)/Makefile.common + +SUBDIRS = codec2 g7xx gsm . + +AM_CPPFLAGS = $(STD_DEFINES_AND_INCLUDES) $(PYTHON_CPPFLAGS) $(WITH_INCLUDES) \ + -I$(top_srcdir)/gr-vocoder/include + +lib_LTLIBRARIES = libgnuradio-vocoder.la + +libgnuradio_vocoder_la_SOURCES = \ + vocoder_alaw_decode_bs.cc \ + vocoder_alaw_encode_sb.cc \ + vocoder_codec2_decode_ps.cc \ + vocoder_codec2_encode_sp.cc \ + vocoder_cvsd_decode_bs.cc \ + vocoder_cvsd_encode_sb.cc \ + vocoder_g721_decode_bs.cc \ + vocoder_g721_encode_sb.cc \ + vocoder_g723_24_decode_bs.cc \ + vocoder_g723_24_encode_sb.cc \ + vocoder_g723_40_decode_bs.cc \ + vocoder_g723_40_encode_sb.cc \ + vocoder_gsm_fr_decode_ps.cc \ + vocoder_gsm_fr_encode_sp.cc \ + vocoder_ulaw_decode_bs.cc \ + vocoder_ulaw_encode_sb.cc + +libgnuradio_vocoder_la_LIBADD = \ + $(GNURADIO_CORE_LA) \ + codec2/libcodec2.la \ + g7xx/libg7xx.la \ + gsm/libgsm.la + +libgnuradio_vocoder_la_LDFLAGS = $(NO_UNDEFINED) $(LTVERSIONFLAGS) diff --git a/gr-vocoder/lib/codec2/.gitignore b/gr-vocoder/lib/codec2/.gitignore new file mode 100644 index 000000000..b336cc7ce --- /dev/null +++ b/gr-vocoder/lib/codec2/.gitignore @@ -0,0 +1,2 @@ +/Makefile +/Makefile.in diff --git a/gr-vocoder/lib/codec2/CMakeLists.txt b/gr-vocoder/lib/codec2/CMakeLists.txt new file mode 100644 index 000000000..2b8273d16 --- /dev/null +++ b/gr-vocoder/lib/codec2/CMakeLists.txt @@ -0,0 +1,109 @@ +# Copyright 2011 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio 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 General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. + +######################################################################## +# Create executable to generate other sources +######################################################################## +INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}) +ADD_EXECUTABLE(generate_codebook ${CMAKE_CURRENT_SOURCE_DIR}/generate_codebook.c) +TARGET_LINK_LIBRARIES(generate_codebook -lm) + +######################################################################## +# Create codebook +######################################################################## +SET(CODEBOOKS + ${CMAKE_CURRENT_SOURCE_DIR}/codebook/lsp1.txt + ${CMAKE_CURRENT_SOURCE_DIR}/codebook/lsp2.txt + ${CMAKE_CURRENT_SOURCE_DIR}/codebook/lsp3.txt + ${CMAKE_CURRENT_SOURCE_DIR}/codebook/lsp4.txt + ${CMAKE_CURRENT_SOURCE_DIR}/codebook/lsp5.txt + ${CMAKE_CURRENT_SOURCE_DIR}/codebook/lsp6.txt + ${CMAKE_CURRENT_SOURCE_DIR}/codebook/lsp7.txt + ${CMAKE_CURRENT_SOURCE_DIR}/codebook/lsp8.txt + ${CMAKE_CURRENT_SOURCE_DIR}/codebook/lsp9.txt + ${CMAKE_CURRENT_SOURCE_DIR}/codebook/lsp10.txt +) + +ADD_CUSTOM_COMMAND( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/codebook.c + DEPENDS generate_codebook ${CODEBOOKS} + COMMAND generate_codebook lsp_cb ${CODEBOOKS} > ${CMAKE_CURRENT_BINARY_DIR}/codebook.c +) + +######################################################################## +# Create codebookd +######################################################################## +SET(CODEBOOKSD + ${CMAKE_CURRENT_SOURCE_DIR}/codebook/dlsp1.txt + ${CMAKE_CURRENT_SOURCE_DIR}/codebook/dlsp2.txt + ${CMAKE_CURRENT_SOURCE_DIR}/codebook/dlsp3.txt + ${CMAKE_CURRENT_SOURCE_DIR}/codebook/dlsp4.txt + ${CMAKE_CURRENT_SOURCE_DIR}/codebook/dlsp5.txt + ${CMAKE_CURRENT_SOURCE_DIR}/codebook/dlsp6.txt + ${CMAKE_CURRENT_SOURCE_DIR}/codebook/dlsp7.txt + ${CMAKE_CURRENT_SOURCE_DIR}/codebook/dlsp8.txt + ${CMAKE_CURRENT_SOURCE_DIR}/codebook/dlsp9.txt + ${CMAKE_CURRENT_SOURCE_DIR}/codebook/dlsp10.txt +) + +ADD_CUSTOM_COMMAND( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/codebookd.c + DEPENDS generate_codebook ${CODEBOOKSD} + COMMAND generate_codebook lsp_cbd ${CODEBOOKSD} > ${CMAKE_CURRENT_BINARY_DIR}/codebookd.c +) + +######################################################################## +# Create codebookdvq +######################################################################## +SET(CODEBOOKSDVQ + ${CMAKE_CURRENT_SOURCE_DIR}/codebook/dlsp1.txt + ${CMAKE_CURRENT_SOURCE_DIR}/codebook/dlsp2.txt + ${CMAKE_CURRENT_SOURCE_DIR}/codebook/dlsp3.txt + ${CMAKE_CURRENT_SOURCE_DIR}/codebook/dlsp4.txt + ${CMAKE_CURRENT_SOURCE_DIR}/codebook/dlsp5.txt +) + +ADD_CUSTOM_COMMAND( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/codebookdvq.c + DEPENDS generate_codebook ${CODEBOOKSDVQ} + COMMAND generate_codebook lsp_cbdvq ${CODEBOOKSDVQ} > ${CMAKE_CURRENT_BINARY_DIR}/codebookdvq.c +) + +######################################################################## +# Append all sources in this dir +######################################################################## +LIST(APPEND gr_vocoder_sources + ${CMAKE_CURRENT_BINARY_DIR}/codebook.c + ${CMAKE_CURRENT_BINARY_DIR}/codebookd.c + ${CMAKE_CURRENT_BINARY_DIR}/codebookdvq.c + + ${CMAKE_CURRENT_SOURCE_DIR}/dump.c + ${CMAKE_CURRENT_SOURCE_DIR}/lpc.c + ${CMAKE_CURRENT_SOURCE_DIR}/nlp.c + ${CMAKE_CURRENT_SOURCE_DIR}/postfilter.c + ${CMAKE_CURRENT_SOURCE_DIR}/sine.c + ${CMAKE_CURRENT_SOURCE_DIR}/codec2.c + ${CMAKE_CURRENT_SOURCE_DIR}/fft.c + ${CMAKE_CURRENT_SOURCE_DIR}/kiss_fft.c + ${CMAKE_CURRENT_SOURCE_DIR}/interp.c + ${CMAKE_CURRENT_SOURCE_DIR}/lsp.c + ${CMAKE_CURRENT_SOURCE_DIR}/phase.c + ${CMAKE_CURRENT_SOURCE_DIR}/quantise.c + ${CMAKE_CURRENT_SOURCE_DIR}/pack.c +) diff --git a/gr-vocoder/lib/codec2/Makefile.am b/gr-vocoder/lib/codec2/Makefile.am new file mode 100644 index 000000000..ae2094eff --- /dev/null +++ b/gr-vocoder/lib/codec2/Makefile.am @@ -0,0 +1,125 @@ +# +# Copyright 2011 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio 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 General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. +# + +include $(top_srcdir)/Makefile.common + +AM_CFLAGS = -fPIC -O3 + +# Helper program to create codebook source +noinst_PROGRAMS = generate_codebook +generate_codebook_LDFLAGS = -lm + +# lsp quantisers +CODEBOOKS= \ + $(srcdir)/codebook/lsp1.txt \ + $(srcdir)/codebook/lsp2.txt \ + $(srcdir)/codebook/lsp3.txt \ + $(srcdir)/codebook/lsp4.txt \ + $(srcdir)/codebook/lsp5.txt \ + $(srcdir)/codebook/lsp6.txt \ + $(srcdir)/codebook/lsp7.txt \ + $(srcdir)/codebook/lsp8.txt \ + $(srcdir)/codebook/lsp9.txt \ + $(srcdir)/codebook/lsp10.txt + +# lspd quantisers +CODEBOOKSD= \ + $(srcdir)/codebook/dlsp1.txt \ + $(srcdir)/codebook/dlsp2.txt \ + $(srcdir)/codebook/dlsp3.txt \ + $(srcdir)/codebook/dlsp4.txt \ + $(srcdir)/codebook/dlsp5.txt \ + $(srcdir)/codebook/dlsp6.txt \ + $(srcdir)/codebook/dlsp7.txt \ + $(srcdir)/codebook/dlsp8.txt \ + $(srcdir)/codebook/dlsp9.txt \ + $(srcdir)/codebook/dlsp10.txt + +# lspd VQ quantisers +CODEBOOKSDVQ= \ + $(srcdir)/codebook/dlsp1.txt \ + $(srcdir)/codebook/dlsp2.txt \ + $(srcdir)/codebook/dlsp3.txt \ + $(srcdir)/codebook/dlsp4.txt \ + $(srcdir)/codebook/dlsp5.txt + +# Generate codebook sources from text files +GENERATED_C = \ + codebook.c \ + codebookd.c \ + codebookdvq.c + +BUILT_SOURCES += $(GENERATED_C) + +codebook.c: $(builddir)/generate_codebook $(CODEBOOKS) + $(builddir)/generate_codebook lsp_cb $(CODEBOOKS) > codebook.c + +codebookd.c: $(builddir)/generate_codebook $(CODEBOOKSD) + $(builddir)/generate_codebook lsp_cbd $(CODEBOOKSD) > codebookd.c + +codebookdvq.c: $(builddir)/generate_codebook $(CODEBOOKSDVQ) + $(builddir)/generate_codebook lsp_cbdvq $(CODEBOOKSDVQ) > codebookdvq.c + +# Convenience library for linking into blocks +noinst_LTLIBRARIES = libcodec2.la + +libcodec2_la_CFLAGS = $(AM_CFLAGS) + +libcodec2_la_SOURCES = \ + dump.c \ + lpc.c \ + nlp.c \ + postfilter.c \ + sine.c \ + codec2.c \ + fft.c \ + kiss_fft.c \ + interp.c \ + lsp.c \ + phase.c \ + quantise.c \ + pack.c \ + $(GENERATED_C) + +# Evil inclusion of glottal.c by phase.c +EXTRA_DIST += glottal.c + +# Headers used locally but not installed in system +noinst_HEADERS = \ + codec2.h \ + codec2_internal.h \ + defines.h \ + kiss_fft.h\ + _kiss_fft_guts.h \ + fft.h \ + interp.h \ + lsp.h \ + phase.h \ + quantise.h \ + comp.h \ + dump.h \ + lpc.h \ + nlp.h \ + postfilter.h \ + sine.h + +EXTRA_DIST += $(CODEBOOKS) $(CODEBOOKSD) $(CODEBOOKSDVQ) + diff --git a/gr-vocoder/lib/codec2/_kiss_fft_guts.h b/gr-vocoder/lib/codec2/_kiss_fft_guts.h new file mode 100644 index 000000000..ba6614440 --- /dev/null +++ b/gr-vocoder/lib/codec2/_kiss_fft_guts.h @@ -0,0 +1,164 @@ +/* +Copyright (c) 2003-2010, Mark Borgerding + +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. + * Neither the author nor the names of any contributors may be used to endorse or promote products derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/* kiss_fft.h + defines kiss_fft_scalar as either short or a float type + and defines + typedef struct { kiss_fft_scalar r; kiss_fft_scalar i; }kiss_fft_cpx; */ +#include "kiss_fft.h" +#include <limits.h> + +#define MAXFACTORS 32 +/* e.g. an fft of length 128 has 4 factors + as far as kissfft is concerned + 4*4*4*2 + */ + +struct kiss_fft_state{ + int nfft; + int inverse; + int factors[2*MAXFACTORS]; + kiss_fft_cpx twiddles[1]; +}; + +/* + Explanation of macros dealing with complex math: + + C_MUL(m,a,b) : m = a*b + C_FIXDIV( c , div ) : if a fixed point impl., c /= div. noop otherwise + C_SUB( res, a,b) : res = a - b + C_SUBFROM( res , a) : res -= a + C_ADDTO( res , a) : res += a + * */ +#ifdef FIXED_POINT +#if (FIXED_POINT==32) +# define FRACBITS 31 +# define SAMPPROD int64_t +#define SAMP_MAX 2147483647 +#else +# define FRACBITS 15 +# define SAMPPROD int32_t +#define SAMP_MAX 32767 +#endif + +#define SAMP_MIN -SAMP_MAX + +#if defined(CHECK_OVERFLOW) +# define CHECK_OVERFLOW_OP(a,op,b) \ + if ( (SAMPPROD)(a) op (SAMPPROD)(b) > SAMP_MAX || (SAMPPROD)(a) op (SAMPPROD)(b) < SAMP_MIN ) { \ + fprintf(stderr,"WARNING:overflow @ " __FILE__ "(%d): (%d " #op" %d) = %ld\n",__LINE__,(a),(b),(SAMPPROD)(a) op (SAMPPROD)(b) ); } +#endif + + +# define smul(a,b) ( (SAMPPROD)(a)*(b) ) +# define sround( x ) (kiss_fft_scalar)( ( (x) + (1<<(FRACBITS-1)) ) >> FRACBITS ) + +# define S_MUL(a,b) sround( smul(a,b) ) + +# define C_MUL(m,a,b) \ + do{ (m).r = sround( smul((a).r,(b).r) - smul((a).i,(b).i) ); \ + (m).i = sround( smul((a).r,(b).i) + smul((a).i,(b).r) ); }while(0) + +# define DIVSCALAR(x,k) \ + (x) = sround( smul( x, SAMP_MAX/k ) ) + +# define C_FIXDIV(c,div) \ + do { DIVSCALAR( (c).r , div); \ + DIVSCALAR( (c).i , div); }while (0) + +# define C_MULBYSCALAR( c, s ) \ + do{ (c).r = sround( smul( (c).r , s ) ) ;\ + (c).i = sround( smul( (c).i , s ) ) ; }while(0) + +#else /* not FIXED_POINT*/ + +# define S_MUL(a,b) ( (a)*(b) ) +#define C_MUL(m,a,b) \ + do{ (m).r = (a).r*(b).r - (a).i*(b).i;\ + (m).i = (a).r*(b).i + (a).i*(b).r; }while(0) +# define C_FIXDIV(c,div) /* NOOP */ +# define C_MULBYSCALAR( c, s ) \ + do{ (c).r *= (s);\ + (c).i *= (s); }while(0) +#endif + +#ifndef CHECK_OVERFLOW_OP +# define CHECK_OVERFLOW_OP(a,op,b) /* noop */ +#endif + +#define C_ADD( res, a,b)\ + do { \ + CHECK_OVERFLOW_OP((a).r,+,(b).r)\ + CHECK_OVERFLOW_OP((a).i,+,(b).i)\ + (res).r=(a).r+(b).r; (res).i=(a).i+(b).i; \ + }while(0) +#define C_SUB( res, a,b)\ + do { \ + CHECK_OVERFLOW_OP((a).r,-,(b).r)\ + CHECK_OVERFLOW_OP((a).i,-,(b).i)\ + (res).r=(a).r-(b).r; (res).i=(a).i-(b).i; \ + }while(0) +#define C_ADDTO( res , a)\ + do { \ + CHECK_OVERFLOW_OP((res).r,+,(a).r)\ + CHECK_OVERFLOW_OP((res).i,+,(a).i)\ + (res).r += (a).r; (res).i += (a).i;\ + }while(0) + +#define C_SUBFROM( res , a)\ + do {\ + CHECK_OVERFLOW_OP((res).r,-,(a).r)\ + CHECK_OVERFLOW_OP((res).i,-,(a).i)\ + (res).r -= (a).r; (res).i -= (a).i; \ + }while(0) + + +#ifdef FIXED_POINT +# define KISS_FFT_COS(phase) floor(.5+SAMP_MAX * cos (phase)) +# define KISS_FFT_SIN(phase) floor(.5+SAMP_MAX * sin (phase)) +# define HALF_OF(x) ((x)>>1) +#elif defined(USE_SIMD) +# define KISS_FFT_COS(phase) _mm_set1_ps( cos(phase) ) +# define KISS_FFT_SIN(phase) _mm_set1_ps( sin(phase) ) +# define HALF_OF(x) ((x)*_mm_set1_ps(.5)) +#else +# define KISS_FFT_COS(phase) (kiss_fft_scalar) cos(phase) +# define KISS_FFT_SIN(phase) (kiss_fft_scalar) sin(phase) +# define HALF_OF(x) ((x)*.5) +#endif + +#define kf_cexp(x,phase) \ + do{ \ + (x)->r = KISS_FFT_COS(phase);\ + (x)->i = KISS_FFT_SIN(phase);\ + }while(0) + + +/* a debugging function */ +#define pcpx(c)\ + fprintf(stderr,"%g + %gi\n",(double)((c)->r),(double)((c)->i) ) + + +#ifdef KISS_FFT_USE_ALLOCA +// define this to allow use of alloca instead of malloc for temporary buffers +// Temporary buffers are used in two case: +// 1. FFT sizes that have "bad" factors. i.e. not 2,3 and 5 +// 2. "in-place" FFTs. Notice the quotes, since kissfft does not really do an in-place transform. +#include <alloca.h> +#define KISS_FFT_TMP_ALLOC(nbytes) alloca(nbytes) +#define KISS_FFT_TMP_FREE(ptr) +#else +#define KISS_FFT_TMP_ALLOC(nbytes) KISS_FFT_MALLOC(nbytes) +#define KISS_FFT_TMP_FREE(ptr) KISS_FFT_FREE(ptr) +#endif diff --git a/gr-vocoder/lib/codec2/c2dec.c b/gr-vocoder/lib/codec2/c2dec.c new file mode 100644 index 000000000..b866d04d6 --- /dev/null +++ b/gr-vocoder/lib/codec2/c2dec.c @@ -0,0 +1,82 @@ +/*---------------------------------------------------------------------------*\ + + FILE........: c2dec.c + AUTHOR......: David Rowe + DATE CREATED: 23/8/2010 + + Decodes a file of bits to a file of raw speech samples using codec2. + +\*---------------------------------------------------------------------------*/ + +/* + Copyright (C) 2010 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/>. +*/ + +#include "codec2.h" + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <errno.h> + +#define BITS_SIZE ((CODEC2_BITS_PER_FRAME + 7) / 8) + +int main(int argc, char *argv[]) +{ + void *codec2; + FILE *fin; + FILE *fout; + short buf[CODEC2_SAMPLES_PER_FRAME]; + unsigned char bits[BITS_SIZE]; + + if (argc != 3) { + printf("usage: %s InputBitFile OutputRawSpeechFile\n", argv[0]); + exit(1); + } + + if (strcmp(argv[1], "-") == 0) fin = stdin; + else if ( (fin = fopen(argv[1],"rb")) == NULL ) { + fprintf(stderr, "Error opening input bit file: %s: %s.\n", + argv[1], strerror(errno)); + exit(1); + } + + if (strcmp(argv[2], "-") == 0) fout = stdout; + else if ( (fout = fopen(argv[2],"wb")) == NULL ) { + fprintf(stderr, "Error opening output speech file: %s: %s.\n", + argv[2], strerror(errno)); + exit(1); + } + + codec2 = codec2_create(); + + while(fread(bits, sizeof(char), BITS_SIZE, fin) == BITS_SIZE) { + codec2_decode(codec2, buf, bits); + fwrite(buf, sizeof(short), CODEC2_SAMPLES_PER_FRAME, fout); + //if this is in a pipeline, we probably don't want the usual + //buffering to occur + if (fout == stdout) fflush(stdout); + if (fin == stdin) fflush(stdin); + + } + + codec2_destroy(codec2); + + fclose(fin); + fclose(fout); + + return 0; +} diff --git a/gr-vocoder/lib/codec2/c2demo.c b/gr-vocoder/lib/codec2/c2demo.c new file mode 100644 index 000000000..efa8d6449 --- /dev/null +++ b/gr-vocoder/lib/codec2/c2demo.c @@ -0,0 +1,86 @@ +/*---------------------------------------------------------------------------*\ + + FILE........: c2demo.c + AUTHOR......: David Rowe + DATE CREATED: 15/11/2010 + + Encodes and decodes a file of raw speech samples using Codec 2. + Demonstrates use of Codec 2 function API. + + Note to convert a wave file to raw and vice-versa: + + $ sox file.wav -r 8000 -s -2 file.raw + $ sox -r 8000 -s -2 file.raw file.wav + +\*---------------------------------------------------------------------------*/ + +/* + Copyright (C) 2010 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/>. +*/ + +#include "codec2.h" + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <errno.h> + +#define BITS_SIZE ((CODEC2_BITS_PER_FRAME + 7) / 8) + +int main(int argc, char *argv[]) +{ + void *codec2; + FILE *fin; + FILE *fout; + short buf[CODEC2_SAMPLES_PER_FRAME]; + unsigned char bits[BITS_SIZE]; + + if (argc != 3) { + printf("usage: %s InputRawSpeechFile OutputRawSpeechFile\n", argv[0]); + exit(1); + } + + if ( (fin = fopen(argv[1],"rb")) == NULL ) { + fprintf(stderr, "Error opening input speech file: %s: %s.\n", + argv[1], strerror(errno)); + exit(1); + } + + if ( (fout = fopen(argv[2],"wb")) == NULL ) { + fprintf(stderr, "Error opening output speech file: %s: %s.\n", + argv[2], strerror(errno)); + exit(1); + } + + /* Note only one set of Codec 2 states is required for an encoder + and decoder pair. */ + + codec2 = codec2_create(); + + while(fread(buf, sizeof(short), CODEC2_SAMPLES_PER_FRAME, fin) == + CODEC2_SAMPLES_PER_FRAME) { + codec2_encode(codec2, bits, buf); + codec2_decode(codec2, buf, bits); + fwrite(buf, sizeof(short), CODEC2_SAMPLES_PER_FRAME, fout); + } + + codec2_destroy(codec2); + + fclose(fin); + fclose(fout); + + return 0; +} diff --git a/gr-vocoder/lib/codec2/c2enc.c b/gr-vocoder/lib/codec2/c2enc.c new file mode 100644 index 000000000..4d1d019df --- /dev/null +++ b/gr-vocoder/lib/codec2/c2enc.c @@ -0,0 +1,83 @@ +/*---------------------------------------------------------------------------*\ + + FILE........: c2enc.c + AUTHOR......: David Rowe + DATE CREATED: 23/8/2010 + + Encodes a file of raw speech samples using codec2 and outputs a file + of bits. + +\*---------------------------------------------------------------------------*/ + +/* + Copyright (C) 2010 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/>. +*/ + +#include "codec2.h" + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <errno.h> + +#define BITS_SIZE ((CODEC2_BITS_PER_FRAME + 7) / 8) + +int main(int argc, char *argv[]) +{ + void *codec2; + FILE *fin; + FILE *fout; + short buf[CODEC2_SAMPLES_PER_FRAME]; + unsigned char bits[BITS_SIZE]; + + if (argc != 3) { + printf("usage: %s InputRawspeechFile OutputBitFile\n", argv[0]); + exit(1); + } + + if (strcmp(argv[1], "-") == 0) fin = stdin; + else if ( (fin = fopen(argv[1],"rb")) == NULL ) { + fprintf(stderr, "Error opening input bit file: %s: %s.\n", + argv[1], strerror(errno)); + exit(1); + } + + if (strcmp(argv[2], "-") == 0) fout = stdout; + else if ( (fout = fopen(argv[2],"wb")) == NULL ) { + fprintf(stderr, "Error opening output speech file: %s: %s.\n", + argv[2], strerror(errno)); + exit(1); + } + + codec2 = codec2_create(); + + while(fread(buf, sizeof(short), CODEC2_SAMPLES_PER_FRAME, fin) == + CODEC2_SAMPLES_PER_FRAME) { + codec2_encode(codec2, bits, buf); + fwrite(bits, sizeof(char), BITS_SIZE, fout); + //if this is in a pipeline, we probably don't want the usual + //buffering to occur + if (fout == stdout) fflush(stdout); + if (fin == stdin) fflush(stdin); + } + + codec2_destroy(codec2); + + fclose(fin); + fclose(fout); + + return 0; +} diff --git a/gr-vocoder/lib/codec2/c2sim.c b/gr-vocoder/lib/codec2/c2sim.c new file mode 100644 index 000000000..bb49c7899 --- /dev/null +++ b/gr-vocoder/lib/codec2/c2sim.c @@ -0,0 +1,469 @@ +/*---------------------------------------------------------------------------*\ + + FILE........: c2sim.c + AUTHOR......: David Rowe + DATE CREATED: 20/8/2010 + + Codec2 simulation. Combines encoder and decoder and allows switching in + out various algorithms and quantisation steps. + +\*---------------------------------------------------------------------------*/ + +/* + 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/>. +*/ + +#include <assert.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <errno.h> +#include <math.h> + +#include "defines.h" +#include "sine.h" +#include "nlp.h" +#include "dump.h" +#include "lpc.h" +#include "lsp.h" +#include "quantise.h" +#include "phase.h" +#include "postfilter.h" +#include "interp.h" + +/*---------------------------------------------------------------------------*\ + + switch_present() + + Searches the command line arguments for a "switch". If the switch is + found, returns the command line argument where it ws found, else returns + NULL. + +\*---------------------------------------------------------------------------*/ + +int switch_present(sw,argc,argv) +register char sw[]; /* switch in string form */ +register int argc; /* number of command line arguments */ +register char *argv[]; /* array of command line arguments in string form */ +{ + register int i; /* loop variable */ + + for(i=1; i<argc; i++) + if (!strcmp(sw,argv[i])) + return(i); + + return 0; +} + +void synth_one_frame(short buf[], MODEL *model, float Sn_[], float Pn[]); + +/*---------------------------------------------------------------------------*\ + + MAIN + +\*---------------------------------------------------------------------------*/ + +int main(int argc, char *argv[]) +{ + FILE *fout; /* output speech file */ + FILE *fin; /* input speech file */ + short buf[N]; /* input/output buffer */ + float Sn[M]; /* float input speech samples */ + COMP Sw[FFT_ENC]; /* DFT of Sn[] */ + float w[M]; /* time domain hamming window */ + COMP W[FFT_ENC]; /* DFT of w[] */ + MODEL model; + float Pn[2*N]; /* trapezoidal synthesis window */ + float Sn_[2*N]; /* synthesised speech */ + int i; /* loop variable */ + int frames; + float prev_Wo; + float pitch; + int voiced1 = 0; + + char out_file[MAX_STR]; + int arg; + float snr; + float sum_snr; + + int lpc_model, order = LPC_ORD; + int lsp, lspd, lspdvq, lsp_quantiser; + float ak[LPC_MAX]; + COMP Sw_[FFT_ENC]; + COMP Ew[FFT_ENC]; + + int dump; + + int phase0; + float ex_phase[MAX_AMP+1]; + + int postfilt; + float bg_est; + + int hand_voicing; + FILE *fvoicing = 0; + + MODEL prev_model, interp_model; + int decimate; + float lsps[LPC_ORD]; + float prev_lsps[LPC_ORD]; + float e, prev_e; + float ak_interp[LPC_MAX]; + + void *nlp_states; + float hpf_states[2]; + int resample; + float AresdB_prev[MAX_AMP]; + + for(i=0; i<MAX_AMP; i++) + AresdB_prev[i] = 0.0; + + for(i=0; i<M; i++) + Sn[i] = 1.0; + for(i=0; i<2*N; i++) + Sn_[i] = 0; + + prev_Wo = TWO_PI/P_MAX; + + prev_model.Wo = TWO_PI/P_MIN; + prev_model.L = floor(PI/prev_model.Wo); + for(i=1; i<=prev_model.L; i++) { + prev_model.A[i] = 0.0; + prev_model.phi[i] = 0.0; + } + for(i=1; i<=MAX_AMP; i++) { + ex_phase[i] = 0.0; + } + for(i=0; i<LPC_ORD; i++) { + prev_lsps[i] = i*PI/(LPC_ORD+1); + } + e = prev_e = 1; + hpf_states[0] = hpf_states[1] = 0.0; + + nlp_states = nlp_create(); + + if (argc < 2) { + fprintf(stderr, "\nCodec2 - 2400 bit/s speech codec - Simulation Program\n" + "\thttp://rowetel.com/codec2.html\n\n" + "usage: %s InputFile [-o OutputFile]\n" + "\t[--lpc Order]\n" + "\t[--lsp]\n" + "\t[--lspd]\n" + "\t[--lspdvq]\n" + "\t[--phase0]\n" + "\t[--postfilter]\n" + "\t[--hand_voicing]\n" + "\t[--dec]\n" + "\t[--dump DumpFilePrefix]\n", argv[0]); + exit(1); + } + + /* Interpret command line arguments -------------------------------------*/ + + /* Input file */ + + if ((fin = fopen(argv[1],"rb")) == NULL) { + fprintf(stderr, "Error opening input speech file: %s: %s.\n", + argv[1], strerror(errno)); + exit(1); + } + + /* Output file */ + + if ((arg = switch_present("-o",argc,argv))) { + if ((fout = fopen(argv[arg+1],"wb")) == NULL) { + fprintf(stderr, "Error opening output speech file: %s: %s.\n", + argv[arg+1], strerror(errno)); + exit(1); + } + strcpy(out_file,argv[arg+1]); + } + else + fout = NULL; + + lpc_model = 0; + if ((arg = switch_present("--lpc",argc,argv))) { + lpc_model = 1; + order = atoi(argv[arg+1]); + if ((order < 4) || (order > 20)) { + fprintf(stderr, "Error in lpc order: %d\n", order); + exit(1); + } + } + + dump = switch_present("--dump",argc,argv); +#ifdef DUMP + if (dump) + dump_on(argv[dump+1]); +#endif + + lsp = switch_present("--lsp",argc,argv); + lsp_quantiser = 0; + if (lsp) + assert(order == LPC_ORD); + + lspd = switch_present("--lspd",argc,argv); + if (lspd) + assert(order == LPC_ORD); + + lspdvq = switch_present("--lspdvq",argc,argv); + if (lspdvq) + assert(order == LPC_ORD); + + phase0 = switch_present("--phase0",argc,argv); + if (phase0) { + ex_phase[0] = 0; + } + + hand_voicing = switch_present("--hand_voicing",argc,argv); + if (hand_voicing) { + fvoicing = fopen(argv[hand_voicing+1],"rt"); + assert(fvoicing != NULL); + } + + bg_est = 0.0; + postfilt = switch_present("--postfilter",argc,argv); + + decimate = switch_present("--dec",argc,argv); + + arg = switch_present("--resample",argc,argv); + resample = atoi(argv[arg+1]); + + /* Initialise ------------------------------------------------------------*/ + + make_analysis_window(w,W); + make_synthesis_window(Pn); + quantise_init(); + + /* Main loop ------------------------------------------------------------*/ + + frames = 0; + sum_snr = 0; + while(fread(buf,sizeof(short),N,fin)) { + frames++; + //printf("frame: %d", frames); + + /* Read input speech */ + + for(i=0; i<M-N; i++) + Sn[i] = Sn[i+N]; + for(i=0; i<N; i++) { + //Sn[i+M-N] = hpf((float)buf[i], hpf_states); + Sn[i+M-N] = (float)buf[i]; + } + + /* Estimate pitch */ + + nlp(nlp_states,Sn,N,M,P_MIN,P_MAX,&pitch,Sw,&prev_Wo); + model.Wo = TWO_PI/pitch; + + /* estimate model parameters */ + + dft_speech(Sw, Sn, w); + two_stage_pitch_refinement(&model, Sw); + estimate_amplitudes(&model, Sw, W); +#ifdef DUMP + dump_Sn(Sn); dump_Sw(Sw); dump_model(&model); +#endif + + /* optional zero-phase modelling */ + + if (phase0) { + float Wn[M]; /* windowed speech samples */ + float Rk[LPC_MAX+1]; /* autocorrelation coeffs */ + +#ifdef DUMP + dump_phase(&model.phi[0], model.L); +#endif + + /* find aks here, these are overwritten if LPC modelling is enabled */ + + for(i=0; i<M; i++) + Wn[i] = Sn[i]*w[i]; + autocorrelate(Wn,Rk,M,order); + levinson_durbin(Rk,ak,order); + +#ifdef DUMP + dump_ak(ak, LPC_ORD); +#endif + + /* determine voicing */ + + snr = est_voicing_mbe(&model, Sw, W, Sw_, Ew, prev_Wo); +#ifdef DUMP + dump_Sw_(Sw_); + dump_Ew(Ew); + dump_snr(snr); +#endif + + /* just to make sure we are not cheating - kill all phases */ + + for(i=0; i<MAX_AMP; i++) + model.phi[i] = 0; + + if (hand_voicing) { + fscanf(fvoicing,"%d\n",&model.voiced); + } + } + + /* optional LPC model amplitudes */ + + if (lpc_model) { + int lsp_indexes[LPC_MAX]; + + e = speech_to_uq_lsps(lsps, ak, Sn, w, order); + + if (lsp) { + encode_lsps(lsp_indexes, lsps, LPC_ORD); + decode_lsps(lsps, lsp_indexes, LPC_ORD); + bw_expand_lsps(lsps, LPC_ORD); + lsp_to_lpc(lsps, ak, LPC_ORD); + } + + if (lspd) { + float lsps_[LPC_ORD]; + + lspd_quantise(lsps, lsps_, LPC_ORD); + lsp_to_lpc(lsps_, ak, LPC_ORD); + } + + if (lspdvq) { + float lsps_[LPC_ORD]; + + lspdvq_quantise(lsps, lsps_, LPC_ORD); + lsp_to_lpc(lsps_, ak, LPC_ORD); + } + + e = decode_energy(encode_energy(e)); + model.Wo = decode_Wo(encode_Wo(model.Wo)); + + aks_to_M2(ak, order, &model, e, &snr, 1); + apply_lpc_correction(&model); + sum_snr += snr; +#ifdef DUMP + dump_quantised_model(&model); +#endif + } + + /* optional resampling of model amplitudes */ + + printf("frames=%d\n", frames); + if (resample) { + snr = resample_amp_nl(&model, resample, AresdB_prev); + sum_snr += snr; +#ifdef DUMP + dump_quantised_model(&model); +#endif + } + + /* option decimation to 20ms rate, which enables interpolation + routine to synthesise in between frame */ + + if (decimate) { + if (!phase0) { + printf("needs --phase0 to resample phase for interpolated Wo\n"); + exit(0); + } + if (!lpc_model) { + printf("needs --lpc 10 to resample amplitudes\n"); + exit(0); + } + + /* odd frame - interpolate */ + + if (frames%2) { + + interp_model.voiced = voiced1; + + #ifdef LOG_LIN_INTERP + interpolate(&interp_model, &prev_model, &model); + #else + interpolate_lsp(&interp_model, &prev_model, &model, + prev_lsps, prev_e, lsps, e, ak_interp); + apply_lpc_correction(&interp_model); + #endif + + if (phase0) + phase_synth_zero_order(&interp_model, ak_interp, ex_phase, + order); + if (postfilt) + postfilter(&interp_model, &bg_est); + synth_one_frame(buf, &interp_model, Sn_, Pn); + if (fout != NULL) fwrite(buf,sizeof(short),N,fout); + + if (phase0) + phase_synth_zero_order(&model, ak, ex_phase, order); + if (postfilt) + postfilter(&model, &bg_est); + synth_one_frame(buf, &model, Sn_, Pn); + if (fout != NULL) fwrite(buf,sizeof(short),N,fout); + + prev_model = model; + for(i=0; i<LPC_ORD; i++) + prev_lsps[i] = lsps[i]; + prev_e = e; + } + else { + voiced1 = model.voiced; + } + } + else { + if (phase0) + phase_synth_zero_order(&model, ak, ex_phase, order); + if (postfilt) + postfilter(&model, &bg_est); + synth_one_frame(buf, &model, Sn_, Pn); + if (fout != NULL) fwrite(buf,sizeof(short),N,fout); + } + prev_Wo = TWO_PI/pitch; + } + fclose(fin); + + if (fout != NULL) + fclose(fout); + + if (lpc_model || resample) + printf("SNR av = %5.2f dB\n", sum_snr/frames); + +#ifdef DUMP + if (dump) + dump_off(); +#endif + + if (hand_voicing) + fclose(fvoicing); + + nlp_destroy(nlp_states); + + return 0; +} + +void synth_one_frame(short buf[], MODEL *model, float Sn_[], float Pn[]) +{ + int i; + + synthesise(Sn_, model, Pn, 1); + + for(i=0; i<N; i++) { + if (Sn_[i] > 32767.0) + buf[i] = 32767; + else if (Sn_[i] < -32767.0) + buf[i] = -32767; + else + buf[i] = Sn_[i]; + } + +} diff --git a/gr-vocoder/lib/codec2/codebook/dlsp1.txt b/gr-vocoder/lib/codec2/codebook/dlsp1.txt new file mode 100644 index 000000000..d126be771 --- /dev/null +++ b/gr-vocoder/lib/codec2/codebook/dlsp1.txt @@ -0,0 +1,17 @@ +1 16 +225 +250 +275 +300 +325 +350 +375 +400 +425 +450 +475 +500 +525 +550 +575 +600 diff --git a/gr-vocoder/lib/codec2/codebook/dlsp10.txt b/gr-vocoder/lib/codec2/codebook/dlsp10.txt new file mode 100644 index 000000000..dea9dd9d8 --- /dev/null +++ b/gr-vocoder/lib/codec2/codebook/dlsp10.txt @@ -0,0 +1,9 @@ +1 8 +50 +100 +200 +300 +425 +550 +675 +800 diff --git a/gr-vocoder/lib/codec2/codebook/dlsp2.txt b/gr-vocoder/lib/codec2/codebook/dlsp2.txt new file mode 100644 index 000000000..234bf2067 --- /dev/null +++ b/gr-vocoder/lib/codec2/codebook/dlsp2.txt @@ -0,0 +1,17 @@ +1 16 +25 +50 +75 +100 +125 +150 +175 +200 +225 +250 +275 +300 +325 +350 +375 +400 diff --git a/gr-vocoder/lib/codec2/codebook/dlsp3.txt b/gr-vocoder/lib/codec2/codebook/dlsp3.txt new file mode 100644 index 000000000..b2ee06da4 --- /dev/null +++ b/gr-vocoder/lib/codec2/codebook/dlsp3.txt @@ -0,0 +1,9 @@ +1 8 +50 +75 +100 +120 +150 +250 +350 +450 diff --git a/gr-vocoder/lib/codec2/codebook/dlsp4.txt b/gr-vocoder/lib/codec2/codebook/dlsp4.txt new file mode 100644 index 000000000..dea9dd9d8 --- /dev/null +++ b/gr-vocoder/lib/codec2/codebook/dlsp4.txt @@ -0,0 +1,9 @@ +1 8 +50 +100 +200 +300 +425 +550 +675 +800 diff --git a/gr-vocoder/lib/codec2/codebook/dlsp5.txt b/gr-vocoder/lib/codec2/codebook/dlsp5.txt new file mode 100644 index 000000000..dea9dd9d8 --- /dev/null +++ b/gr-vocoder/lib/codec2/codebook/dlsp5.txt @@ -0,0 +1,9 @@ +1 8 +50 +100 +200 +300 +425 +550 +675 +800 diff --git a/gr-vocoder/lib/codec2/codebook/dlsp6.txt b/gr-vocoder/lib/codec2/codebook/dlsp6.txt new file mode 100644 index 000000000..dea9dd9d8 --- /dev/null +++ b/gr-vocoder/lib/codec2/codebook/dlsp6.txt @@ -0,0 +1,9 @@ +1 8 +50 +100 +200 +300 +425 +550 +675 +800 diff --git a/gr-vocoder/lib/codec2/codebook/dlsp7.txt b/gr-vocoder/lib/codec2/codebook/dlsp7.txt new file mode 100644 index 000000000..dea9dd9d8 --- /dev/null +++ b/gr-vocoder/lib/codec2/codebook/dlsp7.txt @@ -0,0 +1,9 @@ +1 8 +50 +100 +200 +300 +425 +550 +675 +800 diff --git a/gr-vocoder/lib/codec2/codebook/dlsp8.txt b/gr-vocoder/lib/codec2/codebook/dlsp8.txt new file mode 100644 index 000000000..dea9dd9d8 --- /dev/null +++ b/gr-vocoder/lib/codec2/codebook/dlsp8.txt @@ -0,0 +1,9 @@ +1 8 +50 +100 +200 +300 +425 +550 +675 +800 diff --git a/gr-vocoder/lib/codec2/codebook/dlsp9.txt b/gr-vocoder/lib/codec2/codebook/dlsp9.txt new file mode 100644 index 000000000..dea9dd9d8 --- /dev/null +++ b/gr-vocoder/lib/codec2/codebook/dlsp9.txt @@ -0,0 +1,9 @@ +1 8 +50 +100 +200 +300 +425 +550 +675 +800 diff --git a/gr-vocoder/lib/codec2/codebook/lsp1.txt b/gr-vocoder/lib/codec2/codebook/lsp1.txt new file mode 100644 index 000000000..d126be771 --- /dev/null +++ b/gr-vocoder/lib/codec2/codebook/lsp1.txt @@ -0,0 +1,17 @@ +1 16 +225 +250 +275 +300 +325 +350 +375 +400 +425 +450 +475 +500 +525 +550 +575 +600 diff --git a/gr-vocoder/lib/codec2/codebook/lsp10.txt b/gr-vocoder/lib/codec2/codebook/lsp10.txt new file mode 100644 index 000000000..39aab7c56 --- /dev/null +++ b/gr-vocoder/lib/codec2/codebook/lsp10.txt @@ -0,0 +1,6 @@ +1 4 +2900 +3100 +3300 +3500 + diff --git a/gr-vocoder/lib/codec2/codebook/lsp2.txt b/gr-vocoder/lib/codec2/codebook/lsp2.txt new file mode 100644 index 000000000..597f14965 --- /dev/null +++ b/gr-vocoder/lib/codec2/codebook/lsp2.txt @@ -0,0 +1,17 @@ +1 16 +325 +350 +375 +400 +425 +450 +475 +500 +525 +550 +575 +600 +625 +650 +675 +700 diff --git a/gr-vocoder/lib/codec2/codebook/lsp3.txt b/gr-vocoder/lib/codec2/codebook/lsp3.txt new file mode 100644 index 000000000..36a64b158 --- /dev/null +++ b/gr-vocoder/lib/codec2/codebook/lsp3.txt @@ -0,0 +1,17 @@ +1 16 +500 +550 +600 +650 +700 +750 +800 +850 +900 +950 +1000 +1050 +1100 +1150 +1200 +1250 diff --git a/gr-vocoder/lib/codec2/codebook/lsp4.txt b/gr-vocoder/lib/codec2/codebook/lsp4.txt new file mode 100644 index 000000000..53a90bd8c --- /dev/null +++ b/gr-vocoder/lib/codec2/codebook/lsp4.txt @@ -0,0 +1,17 @@ +1 16 +700 +800 +900 +1000 +1100 +1200 +1300 +1400 +1500 +1600 +1700 +1800 +1900 +2000 +2100 +2200 diff --git a/gr-vocoder/lib/codec2/codebook/lsp5.txt b/gr-vocoder/lib/codec2/codebook/lsp5.txt new file mode 100644 index 000000000..94739b56e --- /dev/null +++ b/gr-vocoder/lib/codec2/codebook/lsp5.txt @@ -0,0 +1,19 @@ +1 16 + 950 +1050 +1150 +1250 +1350 +1450 +1550 +1650 +1750 +1850 +1950 +2050 +2150 +2250 +2350 +2450 + + diff --git a/gr-vocoder/lib/codec2/codebook/lsp6.txt b/gr-vocoder/lib/codec2/codebook/lsp6.txt new file mode 100644 index 000000000..992ea25c5 --- /dev/null +++ b/gr-vocoder/lib/codec2/codebook/lsp6.txt @@ -0,0 +1,19 @@ +1 16 +1100 +1200 +1300 +1400 +1500 +1600 +1700 +1800 +1900 +2000 +2100 +2200 +2300 +2400 +2500 +2600 + + diff --git a/gr-vocoder/lib/codec2/codebook/lsp7.txt b/gr-vocoder/lib/codec2/codebook/lsp7.txt new file mode 100644 index 000000000..839cbfdd5 --- /dev/null +++ b/gr-vocoder/lib/codec2/codebook/lsp7.txt @@ -0,0 +1,19 @@ +1 16 +1500 +1600 +1700 +1800 +1900 +2000 +2100 +2200 +2300 +2400 +2500 +2600 +2700 +2800 +2900 +3000 + + diff --git a/gr-vocoder/lib/codec2/codebook/lsp8.txt b/gr-vocoder/lib/codec2/codebook/lsp8.txt new file mode 100644 index 000000000..d9880c94e --- /dev/null +++ b/gr-vocoder/lib/codec2/codebook/lsp8.txt @@ -0,0 +1,11 @@ +1 8 +2300 +2400 +2500 +2600 +2700 +2800 +2900 +3000 + + diff --git a/gr-vocoder/lib/codec2/codebook/lsp8910.txt b/gr-vocoder/lib/codec2/codebook/lsp8910.txt new file mode 100644 index 000000000..93cfdd81d --- /dev/null +++ b/gr-vocoder/lib/codec2/codebook/lsp8910.txt @@ -0,0 +1,65 @@ +3 64 +2.048073 2.534502 2.645915 +2.019670 2.269744 2.605462 +1.961101 2.329646 2.562857 +1.968573 2.532712 2.616918 +2.183480 2.514381 2.629582 +2.259379 2.516615 2.620410 +2.172791 2.462460 2.567064 +2.097666 2.303933 2.421685 +2.052990 2.353242 2.546992 +2.043642 2.232362 2.499262 +2.106151 2.393131 2.488401 +2.099167 2.437862 2.558655 +2.013877 2.422875 2.530071 +2.033848 2.483776 2.584598 +2.114474 2.516856 2.602372 +2.229214 2.584056 2.678855 +2.131151 2.584299 2.674845 +1.472721 2.477091 2.630241 +2.010907 2.598415 2.682989 +2.353653 2.524066 2.619773 +2.419897 2.623938 2.699605 +2.319080 2.602148 2.689044 +1.860342 2.503881 2.616576 +1.910517 2.386693 2.610126 +1.748689 2.371809 2.496542 +1.618495 2.403425 2.554956 +1.844073 2.437026 2.533443 +1.924810 2.388543 2.502698 +1.937227 2.258363 2.501697 +1.687554 2.209123 2.545239 +1.851950 2.278628 2.565632 +1.868154 2.330150 2.444883 +1.874180 2.213118 2.351940 +1.757311 2.030626 2.433836 +1.650306 2.152371 2.243421 +1.612794 1.884686 2.339313 +1.745431 2.278895 2.389449 +1.590923 2.304155 2.408510 +1.475982 2.275548 2.509897 +1.508695 2.045463 2.455520 +1.872054 2.061777 2.246202 +1.983947 2.159155 2.445535 +1.745180 2.483765 2.593698 +1.900116 2.079600 2.407479 +1.841672 2.167042 2.486827 +1.932912 2.148464 2.569850 +2.134174 2.363673 2.584252 +2.106094 2.450645 2.638417 +1.954135 2.460313 2.666512 +1.907634 2.573801 2.674025 +1.625579 2.539569 2.656363 +1.785866 2.572616 2.676082 +1.798447 2.376454 2.624298 +2.020033 2.397244 2.619868 +1.946581 2.468791 2.564185 +2.008920 2.342400 2.469132 +1.983846 2.271044 2.395408 +1.988039 2.154150 2.317920 +2.077197 2.216622 2.389101 +2.117255 2.283907 2.512242 +2.177233 2.334622 2.458268 +2.214655 2.425510 2.620013 +2.199931 2.390272 2.520731 +2.271755 2.448682 2.552649 diff --git a/gr-vocoder/lib/codec2/codebook/lsp9.txt b/gr-vocoder/lib/codec2/codebook/lsp9.txt new file mode 100644 index 000000000..7e159af2f --- /dev/null +++ b/gr-vocoder/lib/codec2/codebook/lsp9.txt @@ -0,0 +1,11 @@ +1 8 +2500 +2600 +2700 +2800 +2900 +3000 +3100 +3200 + + diff --git a/gr-vocoder/lib/codec2/codec2.c b/gr-vocoder/lib/codec2/codec2.c new file mode 100644 index 000000000..92708ee32 --- /dev/null +++ b/gr-vocoder/lib/codec2/codec2.c @@ -0,0 +1,342 @@ +/*---------------------------------------------------------------------------*\ + + FILE........: codec2.c + AUTHOR......: David Rowe + DATE CREATED: 21/8/2010 + + Codec2 fully quantised encoder and decoder functions. If you want use + codec2, the codec2_xxx functions are for you. + +\*---------------------------------------------------------------------------*/ + +/* + Copyright (C) 2010 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/>. +*/ + +#include <assert.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <math.h> + +#include "defines.h" +#include "sine.h" +#include "nlp.h" +#include "dump.h" +#include "lpc.h" +#include "quantise.h" +#include "phase.h" +#include "interp.h" +#include "postfilter.h" +#include "codec2.h" +#include "codec2_internal.h" + +/*---------------------------------------------------------------------------*\ + + FUNCTIONS + +\*---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------*\ + + FUNCTION....: codec2_create + AUTHOR......: David Rowe + DATE CREATED: 21/8/2010 + + Create and initialise an instance of the codec. Returns a pointer + to the codec states or NULL on failure. One set of states is + sufficient for a full duuplex codec (i.e. an encoder and decoder). + You don't need separate states for encoders and decoders. See + c2enc.c and c2dec.c for examples. + +\*---------------------------------------------------------------------------*/ + +void *codec2_create() +{ + CODEC2 *c2; + int i,l; + + c2 = (CODEC2*)malloc(sizeof(CODEC2)); + if (c2 == NULL) + return NULL; + + for(i=0; i<M; i++) + c2->Sn[i] = 1.0; + c2->hpf_states[0] = c2->hpf_states[1] = 0.0; + for(i=0; i<2*N; i++) + c2->Sn_[i] = 0; + make_analysis_window(c2->w,c2->W); + make_synthesis_window(c2->Pn); + quantise_init(); + c2->prev_Wo = 0.0; + c2->bg_est = 0.0; + c2->ex_phase = 0.0; + + for(l=1; l<MAX_AMP; l++) + c2->prev_model.A[l] = 0.0; + c2->prev_model.Wo = TWO_PI/P_MAX; + c2->prev_model.L = PI/c2->prev_model.Wo; + c2->prev_model.voiced = 0; + + for(i=0; i<LPC_ORD; i++) { + c2->prev_lsps[i] = i*PI/(LPC_ORD+1); + } + c2->prev_energy = 1; + + c2->nlp = nlp_create(); + if (c2->nlp == NULL) { + free (c2); + return NULL; + } + + return (void*)c2; +} + +/*---------------------------------------------------------------------------*\ + + FUNCTION....: codec2_create + AUTHOR......: David Rowe + DATE CREATED: 21/8/2010 + + Destroy an instance of the codec. + +\*---------------------------------------------------------------------------*/ + +void codec2_destroy(void *codec2_state) +{ + CODEC2 *c2; + + assert(codec2_state != NULL); + c2 = (CODEC2*)codec2_state; + nlp_destroy(c2->nlp); + free(codec2_state); +} + +/*---------------------------------------------------------------------------*\ + + FUNCTION....: codec2_encode + AUTHOR......: David Rowe + DATE CREATED: 21/8/2010 + + Encodes 160 speech samples (20ms of speech) into 51 bits. + + The codec2 algorithm actually operates internally on 10ms (80 + sample) frames, so we run the encoding algorithm twice. On the + first frame we just send the voicing bit. One the second frame we + send all model parameters. + + The bit allocation is: + + Parameter bits/frame + -------------------------------------- + Harmonic magnitudes (LSPs) 36 + Low frequency LPC correction 1 + Energy 5 + Wo (fundamental frequnecy) 7 + Voicing (10ms update) 2 + TOTAL 51 + +\*---------------------------------------------------------------------------*/ + +void codec2_encode(void *codec2_state, unsigned char * bits, short speech[]) +{ + CODEC2 *c2; + MODEL model; + int voiced1, voiced2; + int lsp_indexes[LPC_ORD]; + int energy_index; + int Wo_index; + int i; + unsigned int nbit = 0; + + assert(codec2_state != NULL); + c2 = (CODEC2*)codec2_state; + + /* first 10ms analysis frame - we just want voicing */ + + analyse_one_frame(c2, &model, speech); + voiced1 = model.voiced; + + /* second 10ms analysis frame */ + + analyse_one_frame(c2, &model, &speech[N]); + voiced2 = model.voiced; + + Wo_index = encode_Wo(model.Wo); + encode_amplitudes(lsp_indexes, + &energy_index, + &model, + c2->Sn, + c2->w); + memset(bits, '\0', ((CODEC2_BITS_PER_FRAME + 7) / 8)); + pack(bits, &nbit, Wo_index, WO_BITS); + for(i=0; i<LPC_ORD; i++) { + pack(bits, &nbit, lsp_indexes[i], lsp_bits(i)); + } + pack(bits, &nbit, energy_index, E_BITS); + pack(bits, &nbit, voiced1, 1); + pack(bits, &nbit, voiced2, 1); + + assert(nbit == CODEC2_BITS_PER_FRAME); +} + +/*---------------------------------------------------------------------------*\ + + FUNCTION....: codec2_decode + AUTHOR......: David Rowe + DATE CREATED: 21/8/2010 + + Decodes frames of 51 bits into 160 samples (20ms) of speech. + +\*---------------------------------------------------------------------------*/ + +void codec2_decode(void *codec2_state, short speech[], + const unsigned char * bits) +{ + CODEC2 *c2; + MODEL model; + int voiced1, voiced2; + int lsp_indexes[LPC_ORD]; + float lsps[LPC_ORD]; + int energy_index; + float energy; + int Wo_index; + float ak[LPC_ORD+1]; + float ak_interp[LPC_ORD+1]; + int i; + unsigned int nbit = 0; + MODEL model_interp; + + assert(codec2_state != NULL); + c2 = (CODEC2*)codec2_state; + + /* unpack bit stream to integer codes */ + + Wo_index = unpack(bits, &nbit, WO_BITS); + for(i=0; i<LPC_ORD; i++) { + lsp_indexes[i] = unpack(bits, &nbit, lsp_bits(i)); + } + energy_index = unpack(bits, &nbit, E_BITS); + voiced1 = unpack(bits, &nbit, 1); + voiced2 = unpack(bits, &nbit, 1); + assert(nbit == CODEC2_BITS_PER_FRAME); + + /* decode integer codes to model parameters */ + + model.Wo = decode_Wo(Wo_index); + model.L = PI/model.Wo; + memset(&model.A, 0, (model.L+1)*sizeof(model.A[0])); + decode_amplitudes(&model, + ak, + lsp_indexes, + energy_index, + lsps, + &energy); + + model.voiced = voiced2; + model_interp.voiced = voiced1; + model_interp.Wo = P_MAX/2; + memset(&model_interp.A, 0, MAX_AMP*sizeof(model_interp.A[0])); + + /* interpolate middle frame's model parameters for adjacent frames */ + + interpolate_lsp(&model_interp, &c2->prev_model, &model, + c2->prev_lsps, c2->prev_energy, lsps, energy, ak_interp); + apply_lpc_correction(&model_interp); + + /* synthesis two 10ms frames */ + + synthesise_one_frame(c2, speech, &model_interp, ak_interp); + synthesise_one_frame(c2, &speech[N], &model, ak); + + /* update memories (decode states) for next time */ + + memcpy(&c2->prev_model, &model, sizeof(MODEL)); + memcpy(c2->prev_lsps, lsps, sizeof(lsps)); + c2->prev_energy = energy; +} + +/*---------------------------------------------------------------------------*\ + + FUNCTION....: synthesise_one_frame() + AUTHOR......: David Rowe + DATE CREATED: 23/8/2010 + + Synthesise 80 speech samples (10ms) from model parameters. + +\*---------------------------------------------------------------------------*/ + +void synthesise_one_frame(CODEC2 *c2, short speech[], MODEL *model, float ak[]) +{ + int i; + + phase_synth_zero_order(model, ak, &c2->ex_phase, LPC_ORD); + postfilter(model, &c2->bg_est); + synthesise(c2->Sn_, model, c2->Pn, 1); + + for(i=0; i<N; i++) { + if (c2->Sn_[i] > 32767.0) + speech[i] = 32767; + else if (c2->Sn_[i] < -32767.0) + speech[i] = -32767; + else + speech[i] = c2->Sn_[i]; + } + +} + +/*---------------------------------------------------------------------------*\ + + FUNCTION....: analyse_one_frame() + AUTHOR......: David Rowe + DATE CREATED: 23/8/2010 + + Extract sinusoidal model parameters from 80 speech samples (10ms of + speech). + +\*---------------------------------------------------------------------------*/ + +void analyse_one_frame(CODEC2 *c2, MODEL *model, short speech[]) +{ + COMP Sw[FFT_ENC]; + COMP Sw_[FFT_ENC]; + COMP Ew[FFT_ENC]; + float pitch; + int i; + + /* Read input speech */ + + for(i=0; i<M-N; i++) + c2->Sn[i] = c2->Sn[i+N]; + for(i=0; i<N; i++) + c2->Sn[i+M-N] = speech[i]; + + dft_speech(Sw, c2->Sn, c2->w); + + /* Estimate pitch */ + + nlp(c2->nlp,c2->Sn,N,M,P_MIN,P_MAX,&pitch,Sw,&c2->prev_Wo); + model->Wo = TWO_PI/pitch; + model->L = PI/model->Wo; + + /* estimate model parameters */ + + two_stage_pitch_refinement(model, Sw); + estimate_amplitudes(model, Sw, c2->W); + est_voicing_mbe(model, Sw, c2->W, Sw_, Ew, c2->prev_Wo); + + c2->prev_Wo = model->Wo; +} diff --git a/gr-vocoder/lib/codec2/codec2.h b/gr-vocoder/lib/codec2/codec2.h new file mode 100644 index 000000000..946dedca5 --- /dev/null +++ b/gr-vocoder/lib/codec2/codec2.h @@ -0,0 +1,41 @@ +/*---------------------------------------------------------------------------*\ + + FILE........: codec2.h + AUTHOR......: David Rowe + DATE CREATED: 21/8/2010 + + Codec2 fully quantised encoder and decoder functions. If you want use + codec2, these are the functions you need to call. + +\*---------------------------------------------------------------------------*/ + +/* + Copyright (C) 2010 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 __CODEC2__ +#define __CODEC2__ + +#define CODEC2_SAMPLES_PER_FRAME 160 +#define CODEC2_BITS_PER_FRAME 50 + +void *codec2_create(); +void codec2_destroy(void *codec2_state); +void codec2_encode(void *codec2_state, unsigned char * bits, short speech_in[]); +void codec2_decode(void *codec2_state, short speech_out[], + const unsigned char * bits); + +#endif diff --git a/gr-vocoder/lib/codec2/codec2_internal.h b/gr-vocoder/lib/codec2/codec2_internal.h new file mode 100644 index 000000000..3943ac29d --- /dev/null +++ b/gr-vocoder/lib/codec2/codec2_internal.h @@ -0,0 +1,63 @@ +/*---------------------------------------------------------------------------*\ + + FILE........: codec2_internal.h + AUTHOR......: David Rowe + DATE CREATED: 22 March 2011 + + Some internal structures and states broken out here as they are useful for + testing and development. + +\*---------------------------------------------------------------------------*/ + +/* + Copyright (C) 2011 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 __CODEC2_INTERNAL__ +#define __CODEC2_INTERNAL__ + +/*---------------------------------------------------------------------------*\ + + STATES + +\*---------------------------------------------------------------------------*/ + +typedef struct { + float w[M]; /* time domain hamming window */ + COMP W[FFT_ENC]; /* DFT of w[] */ + float Pn[2*N]; /* trapezoidal synthesis window */ + float Sn[M]; /* input speech */ + float hpf_states[2]; /* high pass filter states */ + void *nlp; /* pitch predictor states */ + float Sn_[2*N]; /* synthesised output speech */ + float ex_phase; /* excitation model phase track */ + float bg_est; /* background noise estimate for post filter */ + float prev_Wo; /* previous frame's pitch estimate */ + MODEL prev_model; /* previous frame's model parameters */ + float prev_lsps[LPC_ORD]; /* previous frame's LSPs */ + float prev_energy; /* previous frame's LPC energy */ +} CODEC2; + +/*---------------------------------------------------------------------------*\ + + FUNCTION HEADERS + +\*---------------------------------------------------------------------------*/ + +void analyse_one_frame(CODEC2 *c2, MODEL *model, short speech[]); +void synthesise_one_frame(CODEC2 *c2, short speech[], MODEL *model,float ak[]); + +#endif diff --git a/gr-vocoder/lib/codec2/comp.h b/gr-vocoder/lib/codec2/comp.h new file mode 100644 index 000000000..cedcab37f --- /dev/null +++ b/gr-vocoder/lib/codec2/comp.h @@ -0,0 +1,38 @@ +/*---------------------------------------------------------------------------*\ + + FILE........: comp.h + AUTHOR......: David Rowe + DATE CREATED: 24/08/09 + + Complex number definition. + +\*---------------------------------------------------------------------------*/ + +/* + 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 __COMP__ +#define __COMP__ + +/* Complex number */ + +typedef struct { + float real; + float imag; +} COMP; + +#endif diff --git a/gr-vocoder/lib/codec2/defines.h b/gr-vocoder/lib/codec2/defines.h new file mode 100644 index 000000000..2dcd527d3 --- /dev/null +++ b/gr-vocoder/lib/codec2/defines.h @@ -0,0 +1,88 @@ +/*---------------------------------------------------------------------------*\ + + FILE........: defines.h + AUTHOR......: David Rowe + DATE CREATED: 23/4/93 + + Defines and structures used throughout the codec. + +\*---------------------------------------------------------------------------*/ + +/* + 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 __DEFINES__ +#define __DEFINES__ + +/*---------------------------------------------------------------------------*\ + + DEFINES + +\*---------------------------------------------------------------------------*/ + +/* General defines */ + +#define N 80 /* number of samples per frame */ +#define MAX_AMP 80 /* maximum number of harmonics */ +#define PI 3.141592654 /* mathematical constant */ +#define TWO_PI 6.283185307 /* mathematical constant */ +#define FS 8000 /* sample rate in Hz */ +#define MAX_STR 256 /* maximum string size */ + +#define NW 279 /* analysis window size */ +#define FFT_ENC 512 /* size of FFT used for encoder */ +#define FFT_DEC 512 /* size of FFT used in decoder */ +#define TW 40 /* Trapezoidal synthesis window overlap */ +#define V_THRESH 6.0 /* voicing threshold in dB */ +#define LPC_MAX 20 /* maximum LPC order */ +#define LPC_ORD 10 /* phase modelling LPC order */ + +/* Pitch estimation defines */ + +#define M 320 /* pitch analysis frame size */ +#define P_MIN 20 /* minimum pitch */ +#define P_MAX 160 /* maximum pitch */ + +/*---------------------------------------------------------------------------*\ + + TYPEDEFS + +\*---------------------------------------------------------------------------*/ + +/* Structure to hold model parameters for one frame */ + +typedef struct { + float Wo; /* fundamental frequency estimate in radians */ + int L; /* number of harmonics */ + float A[MAX_AMP]; /* amplitiude of each harmonic */ + float phi[MAX_AMP]; /* phase of each harmonic */ + int voiced; /* non-zero if this frame is voiced */ +} MODEL; + +/* describes each codebook */ + +struct lsp_codebook { + int k; /* dimension of vector */ + int log2m; /* number of bits in m */ + int m; /* elements in codebook */ + const float * cb; /* The elements */ +}; +extern const struct lsp_codebook lsp_cb[]; +extern const struct lsp_codebook lsp_cbd[]; +extern const struct lsp_codebook lsp_cbdvq[]; + +#endif diff --git a/gr-vocoder/lib/codec2/dump.c b/gr-vocoder/lib/codec2/dump.c new file mode 100644 index 000000000..73a378e23 --- /dev/null +++ b/gr-vocoder/lib/codec2/dump.c @@ -0,0 +1,469 @@ +/*---------------------------------------------------------------------------*\ + + FILE........: dump.c + AUTHOR......: David Rowe + DATE CREATED: 25/8/09 + + Routines to dump data to text files for Octave analysis. + +\*---------------------------------------------------------------------------*/ + +/* + 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/>. +*/ + +#include "defines.h" +#include "comp.h" +#include "dump.h" +#include <assert.h> +#include <stdlib.h> +#include <stdio.h> +#include <string.h> +#include <math.h> + +#ifdef DUMP +static int dumpon = 0; + +static FILE *fsn = NULL; +static FILE *fsw = NULL; +static FILE *few = NULL; +static FILE *fsw_ = NULL; +static FILE *fmodel = NULL; +static FILE *fqmodel = NULL; +static FILE *fpw = NULL; +static FILE *flsp = NULL; +static FILE *fphase = NULL; +static FILE *fphase_ = NULL; +static FILE *ffw = NULL; +static FILE *fe = NULL; +static FILE *fsq = NULL; +static FILE *fdec = NULL; +static FILE *fsnr = NULL; +static FILE *fak = NULL; +static FILE *fbg = NULL; +static FILE *fE = NULL; +static FILE *frk = NULL; +static FILE *fres = NULL; + +static char prefix[MAX_STR]; + +void dump_on(char p[]) { + dumpon = 1; + strcpy(prefix, p); +} + +void dump_off(){ + if (fsn != NULL) + fclose(fsn); + if (fsw != NULL) + fclose(fsw); + if (fsw_ != NULL) + fclose(fsw_); + if (few != NULL) + fclose(few); + if (fmodel != NULL) + fclose(fmodel); + if (fqmodel != NULL) + fclose(fqmodel); + if (fpw != NULL) + fclose(fpw); + if (flsp != NULL) + fclose(flsp); + if (fphase != NULL) + fclose(fphase); + if (fphase_ != NULL) + fclose(fphase_); + if (ffw != NULL) + fclose(ffw); + if (fe != NULL) + fclose(fe); + if (fsq != NULL) + fclose(fsq); + if (fdec != NULL) + fclose(fdec); + if (fsnr != NULL) + fclose(fsnr); + if (fak != NULL) + fclose(fak); + if (fbg != NULL) + fclose(fbg); + if (fE != NULL) + fclose(fE); + if (frk != NULL) + fclose(frk); + if (fres != NULL) + fclose(fres); +} + +void dump_Sn(float Sn[]) { + int i; + char s[MAX_STR]; + + if (!dumpon) return; + + if (fsn == NULL) { + sprintf(s,"%s_sn.txt", prefix); + fsn = fopen(s, "wt"); + assert(fsn != NULL); + } + + /* split across two lines to avoid max line length problems */ + /* reconstruct in Octave */ + + for(i=0; i<M/2; i++) + fprintf(fsn,"%f\t",Sn[i]); + fprintf(fsn,"\n"); + for(i=M/2; i<M; i++) + fprintf(fsn,"%f\t",Sn[i]); + fprintf(fsn,"\n"); +} + +void dump_Sw(COMP Sw[]) { + int i; + char s[MAX_STR]; + + if (!dumpon) return; + + if (fsw == NULL) { + sprintf(s,"%s_sw.txt", prefix); + fsw = fopen(s, "wt"); + assert(fsw != NULL); + } + + for(i=0; i<FFT_ENC/2; i++) + fprintf(fsw,"%f\t", + 10.0*log10(Sw[i].real*Sw[i].real + Sw[i].imag*Sw[i].imag)); + fprintf(fsw,"\n"); +} + +void dump_Sw_(COMP Sw_[]) { + int i; + char s[MAX_STR]; + + if (!dumpon) return; + + if (fsw_ == NULL) { + sprintf(s,"%s_sw_.txt", prefix); + fsw_ = fopen(s, "wt"); + assert(fsw_ != NULL); + } + + for(i=0; i<FFT_ENC/2; i++) + fprintf(fsw_,"%f\t", + 10.0*log10(Sw_[i].real*Sw_[i].real + Sw_[i].imag*Sw_[i].imag)); + fprintf(fsw_,"\n"); +} + +void dump_Ew(COMP Ew[]) { + int i; + char s[MAX_STR]; + + if (!dumpon) return; + + if (few == NULL) { + sprintf(s,"%s_ew.txt", prefix); + few = fopen(s, "wt"); + assert(few != NULL); + } + + for(i=0; i<FFT_ENC/2; i++) + fprintf(few,"%f\t", + 10.0*log10(Ew[i].real*Ew[i].real + Ew[i].imag*Ew[i].imag)); + fprintf(few,"\n"); +} + +void dump_model(MODEL *model) { + int l; + char s[MAX_STR]; + + if (!dumpon) return; + + if (fmodel == NULL) { + sprintf(s,"%s_model.txt", prefix); + fmodel = fopen(s, "wt"); + assert(fmodel != NULL); + } + + fprintf(fmodel,"%f\t%d\t", model->Wo, model->L); + for(l=1; l<=model->L; l++) + fprintf(fmodel,"%f\t",model->A[l]); + for(l=model->L+1; l<MAX_AMP; l++) + fprintf(fmodel,"0.0\t"); + fprintf(fmodel,"%d\t",model->voiced); + fprintf(fmodel,"\n"); +} + +void dump_quantised_model(MODEL *model) { + int l; + char s[MAX_STR]; + + if (!dumpon) return; + + if (fqmodel == NULL) { + sprintf(s,"%s_qmodel.txt", prefix); + fqmodel = fopen(s, "wt"); + assert(fqmodel != NULL); + } + + fprintf(fqmodel,"%f\t%d\t", model->Wo, model->L); + for(l=1; l<=model->L; l++) + fprintf(fqmodel,"%f\t",model->A[l]); + for(l=model->L+1; l<MAX_AMP; l++) + fprintf(fqmodel,"0.0\t"); + fprintf(fqmodel,"\n"); +} + +void dump_resample(float w[], float A[], int n) { + int l; + char s[MAX_STR]; + + if (!dumpon) return; + + if (fres == NULL) { + sprintf(s,"%s_res.txt", prefix); + fres = fopen(s, "wt"); + assert(fres != NULL); + } + + fprintf(fres,"%d\t",n); + for(l=0; l<n; l++) + fprintf(fres,"%f\t",w[l]); + for(l=0; l<n; l++) + fprintf(fres,"%f\t",A[l]); + fprintf(fres,"\n"); +} + +void dump_phase(float phase[], int L) { + int l; + char s[MAX_STR]; + + if (!dumpon) return; + + if (fphase == NULL) { + sprintf(s,"%s_phase.txt", prefix); + fphase = fopen(s, "wt"); + assert(fphase != NULL); + } + + for(l=1; l<=L; l++) + fprintf(fphase,"%f\t",phase[l]); + for(l=L+1; l<MAX_AMP; l++) + fprintf(fphase,"%f\t",0.0); + fprintf(fphase,"\n"); +} + +void dump_phase_(float phase_[], int L) { + int l; + char s[MAX_STR]; + + if (!dumpon) return; + + if (fphase_ == NULL) { + sprintf(s,"%s_phase_.txt", prefix); + fphase_ = fopen(s, "wt"); + assert(fphase_ != NULL); + } + + for(l=1; l<=L; l++) + fprintf(fphase_,"%f\t",phase_[l]); + for(l=L+1; l<MAX_AMP; l++) + fprintf(fphase_,"%f\t",0.0); + fprintf(fphase_,"\n"); +} + +void dump_snr(float snr) { + char s[MAX_STR]; + + if (!dumpon) return; + + if (fsnr == NULL) { + sprintf(s,"%s_snr.txt", prefix); + fsnr = fopen(s, "wt"); + assert(fsnr != NULL); + } + + fprintf(fsnr,"%f\n",snr); +} + +void dump_Pw(COMP Pw[]) { + int i; + char s[MAX_STR]; + + if (!dumpon) return; + + if (fpw == NULL) { + sprintf(s,"%s_pw.txt", prefix); + fpw = fopen(s, "wt"); + assert(fpw != NULL); + } + + for(i=0; i<FFT_DEC/2; i++) + fprintf(fpw,"%f\t",Pw[i].real); + fprintf(fpw,"\n"); +} + +void dump_lsp(float lsp[]) { + int i; + char s[MAX_STR]; + + if (!dumpon) return; + + if (flsp == NULL) { + sprintf(s,"%s_lsp.txt", prefix); + flsp = fopen(s, "wt"); + assert(flsp != NULL); + } + + for(i=0; i<10; i++) + fprintf(flsp,"%f\t",lsp[i]); + fprintf(flsp,"\n"); +} + +void dump_ak(float ak[], int order) { + int i; + char s[MAX_STR]; + + if (!dumpon) return; + + if (fak == NULL) { + sprintf(s,"%s_ak.txt", prefix); + fak = fopen(s, "wt"); + assert(fak != NULL); + } + + for(i=0; i<=order; i++) + fprintf(fak,"%f\t",ak[i]); + fprintf(fak,"\n"); +} + +void dump_Fw(COMP Fw[]) { + int i; + char s[MAX_STR]; + + if (!dumpon) return; + + if (ffw == NULL) { + sprintf(s,"%s_fw.txt", prefix); + ffw = fopen(s, "wt"); + assert(ffw != NULL); + } + + for(i=0; i<256; i++) + fprintf(ffw,"%f\t",Fw[i].real); + fprintf(ffw,"\n"); +} + +void dump_e(float e_hz[]) { + int i; + char s[MAX_STR]; + + if (!dumpon) return; + + if (fe == NULL) { + sprintf(s,"%s_e.txt", prefix); + fe = fopen(s, "wt"); + assert(fe != NULL); + } + + for(i=0; i<500/2; i++) + fprintf(fe,"%f\t",e_hz[i]); + fprintf(fe,"\n"); + for(i=500/2; i<500; i++) + fprintf(fe,"%f\t",e_hz[i]); + fprintf(fe,"\n"); +} + +void dump_sq(float sq[]) { + int i; + char s[MAX_STR]; + + if (!dumpon) return; + + if (fsq == NULL) { + sprintf(s,"%s_sq.txt", prefix); + fsq = fopen(s, "wt"); + assert(fsq != NULL); + } + + for(i=0; i<M/2; i++) + fprintf(fsq,"%f\t",sq[i]); + fprintf(fsq,"\n"); + for(i=M/2; i<M; i++) + fprintf(fsq,"%f\t",sq[i]); + fprintf(fsq,"\n"); +} + +void dump_dec(COMP Fw[]) { + int i; + char s[MAX_STR]; + + if (!dumpon) return; + + if (fdec == NULL) { + sprintf(s,"%s_dec.txt", prefix); + fdec = fopen(s, "wt"); + assert(fdec != NULL); + } + + for(i=0; i<320/5; i++) + fprintf(fdec,"%f\t",Fw[i].real); + fprintf(fdec,"\n"); +} + +void dump_bg(float e, float bg_est, float percent_uv) { + char s[MAX_STR]; + + if (!dumpon) return; + + if (fbg == NULL) { + sprintf(s,"%s_bg.txt", prefix); + fbg = fopen(s, "wt"); + assert(fbg != NULL); + } + + fprintf(fbg,"%f\t%f\t%f\n", e, bg_est, percent_uv); +} + +void dump_E(float E) { + char s[MAX_STR]; + + if (!dumpon) return; + + if (fE == NULL) { + sprintf(s,"%s_E.txt", prefix); + fE = fopen(s, "wt"); + assert(fE != NULL); + } + + fprintf(fE,"%f\n", 10.0*log10(E)); +} + +void dump_Rk(float Rk[]) { + int i; + char s[MAX_STR]; + + if (!dumpon) return; + + if (frk == NULL) { + sprintf(s,"%s_rk.txt", prefix); + frk = fopen(s, "wt"); + assert(frk != NULL); + } + + for(i=0; i<P_MAX; i++) + fprintf(frk,"%f\t",Rk[i]); + fprintf(frk,"\n"); +} + +#endif diff --git a/gr-vocoder/lib/codec2/dump.h b/gr-vocoder/lib/codec2/dump.h new file mode 100644 index 000000000..eeddd3406 --- /dev/null +++ b/gr-vocoder/lib/codec2/dump.h @@ -0,0 +1,67 @@ +/*---------------------------------------------------------------------------*\ + + FILE........: dump.h + AUTHOR......: David Rowe + DATE CREATED: 25/8/09 + + Routines to dump data to text files for Octave analysis. + +\*---------------------------------------------------------------------------*/ + +/* + 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 __DUMP__ +#define __DUMP__ + +#include "comp.h" + +void dump_on(char filename_prefix[]); +void dump_off(); + +void dump_Sn(float Sn[]); +void dump_Sw(COMP Sw[]); +void dump_Sw_(COMP Sw_[]); +void dump_Ew(COMP Ew[]); + +/* amplitude modelling */ + +void dump_model(MODEL *m); +void dump_quantised_model(MODEL *m); +void dump_Pw(COMP Pw[]); +void dump_lsp(float lsp[]); +void dump_ak(float ak[], int order); +void dump_E(float E); +void dump_resample(float w[], float A[], int n); + +/* phase modelling */ + +void dump_snr(float snr); +void dump_phase(float phase[], int L); +void dump_phase_(float phase[], int L); + +/* NLP states */ + +void dump_sq(float sq[]); +void dump_dec(COMP Fw[]); +void dump_Fw(COMP Fw[]); +void dump_e(float e_hz[]); +void dump_Rk(float Rk[]); + +/* post filter */ + +void dump_bg(float e, float bg_est, float percent_uv); + +#endif diff --git a/gr-vocoder/lib/codec2/fft.c b/gr-vocoder/lib/codec2/fft.c new file mode 100644 index 000000000..a33e4d2c8 --- /dev/null +++ b/gr-vocoder/lib/codec2/fft.c @@ -0,0 +1,101 @@ +/*---------------------------------------------------------------------------*\ + + FILE........: fft.c + AUTHOR......: Bruce Robertson + DATE CREATED: 20/11/2010 + + Bridging function to the kiss_fft package. + +\*---------------------------------------------------------------------------*/ + +/* + Copyright (C) 2010 Bruce Robertson + + 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/>. +*/ + +#include <assert.h> +#include "kiss_fft.h" + +/*---------------------------------------------------------------------------*\ + + GLOBALS + +\*---------------------------------------------------------------------------*/ + +kiss_fft_cpx *fin; +kiss_fft_cpx *fout; +kiss_fft_cfg cfg_forward; +kiss_fft_cfg cfg_reverse; + +/*---------------------------------------------------------------------------*\ + + initialize_fft(int n) + + Initialisation function for kiss_fft. This assumes that all calls to fft() + use the same datatypes and are one arrays of the same size. + +\*---------------------------------------------------------------------------*/ + +void +initialize_fft (int n) +{ + fin = KISS_FFT_MALLOC (n * sizeof (kiss_fft_cpx)); + assert(fin != NULL); + fout = KISS_FFT_MALLOC (n * sizeof (kiss_fft_cpx)); + assert(fout != NULL); + cfg_forward = kiss_fft_alloc (n, 0, NULL, NULL); + assert(cfg_forward != NULL); + cfg_reverse = kiss_fft_alloc (n, 1, NULL, NULL); + assert(cfg_reverse != NULL); +} + +/*---------------------------------------------------------------------------*\ + + fft(float x[], int n, int isign) + Function that calls kiss_fft with the signature of four1 from NRC. + +\*---------------------------------------------------------------------------*/ + + +void +fft (float x[], int n, int isign) +{ + int isReverse = 0; + int c; + kiss_fft_cfg cfg; + if (cfg_forward == NULL) + { + initialize_fft (n); + } + for (c = 0; c < n * 2; c += 2) + { + fin[c / 2].r = x[c]; + fin[c / 2].i = -x[c + 1]; + } + if (isign == -1) + { + cfg = cfg_reverse; + } + else + { + cfg = cfg_forward; + } + kiss_fft (cfg, fin, fout); + for (c = 0; c < n * 2; c += 2) + { + x[c] = fout[(c) / 2].r; + x[c + 1] = -fout[(c) / 2].i; + } +} diff --git a/gr-vocoder/lib/codec2/fft.h b/gr-vocoder/lib/codec2/fft.h new file mode 100644 index 000000000..84c6737bd --- /dev/null +++ b/gr-vocoder/lib/codec2/fft.h @@ -0,0 +1,16 @@ +/*---------------------------------------------------------------------------*\ + + FILE........: fft.h + AUTHOR......: Bruce Robertson + DATE CREATED: 29/11/2010 + + Bridge between existing code and kiss_fft. + +\*---------------------------------------------------------------------------*/ + +#ifndef __FFT__ +#define __FFT__ +void fft(float x[], int n, int isign); + +#endif /* __FFT__ */ + diff --git a/gr-vocoder/lib/codec2/fq20.sh b/gr-vocoder/lib/codec2/fq20.sh new file mode 100755 index 000000000..b83784b43 --- /dev/null +++ b/gr-vocoder/lib/codec2/fq20.sh @@ -0,0 +1,8 @@ +#!/bin/sh +# fq20.shsh +# David Rowe 27 July 2010 +# +# Decode a file with fully quantised codec at 20ms frame rate + +../src/sinedec ../raw/$1.raw $1.mdl -o $1_phase0_lsp_20_EWo2.raw --phase 0 --lpc 10 --lsp --postfilter --dec + diff --git a/gr-vocoder/lib/codec2/generate_codebook.c b/gr-vocoder/lib/codec2/generate_codebook.c new file mode 100644 index 000000000..0bea80d85 --- /dev/null +++ b/gr-vocoder/lib/codec2/generate_codebook.c @@ -0,0 +1,179 @@ +/*---------------------------------------------------------------------------*\ + + FILE........: generate_codebook.c + AUTHOR......: Bruce Perens + DATE CREATED: 29 Sep 2010 + + Generate header files containing LSP quantisers, runs at compile time. + +\*---------------------------------------------------------------------------*/ + +/* + 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/>. +*/ + +#include <stdlib.h> +#include <stdio.h> +#include <ctype.h> +#include <math.h> + +static const char usage[] = +"Usage: %s filename array_name [filename ...]\n" +"\tCreate C code for codebook tables.\n"; + +static const char format[] = +"The table format must be:\n" +"\tTwo integers describing the dimensions of the codebook.\n" +"\tThen, enough numbers to fill the specified dimensions.\n"; + +static const char header[] = +"/* THIS IS A GENERATED FILE. Edit generate_codebook.c and its input */\n\n" +"/*\n" +" * This intermediary file and the files that used to create it are under \n" +" * The LGPL. See the file COPYING.\n" +" */\n\n" +"#include \"defines.h\"\n\n"; + +struct codebook { + unsigned int k; + unsigned int log2m; + unsigned int m; + float * cb; +}; + +static void +dump_array(const struct codebook * b, int index) +{ + int limit = b->k * b->m; + int i; + + printf("static const float codes%d[] = {\n", index); + for ( i = 0; i < limit; i++ ) { + printf(" %g", b->cb[i]); + if ( i < limit - 1 ) + printf(","); + + /* organise VQs by rows, looks prettier */ + if ( ((i+1) % b->k) == 0 ) + printf("\n"); + } + printf("};\n"); +} + +static void +dump_structure(const struct codebook * b, int index) +{ + printf(" {\n"); + printf(" %d,\n", b->k); + printf(" %g,\n", log(b->m) / log(2)); + printf(" %d,\n", b->m); + printf(" codes%d\n", index); + printf(" }"); +} + +float +get_float(FILE * in, const char * name, char * * cursor, char * buffer, + int size) +{ + for ( ; ; ) { + char * s = *cursor; + char c; + + while ( (c = *s) != '\0' && !isdigit(c) && c != '-' && c != '.' ) + s++; + + /* Comments start with "#" and continue to the end of the line. */ + if ( c != '\0' && c != '#' ) { + char * end = 0; + float f = 0; + + f = strtod(s, &end); + + if ( end != s ) + *cursor = end; + return f; + } + + if ( fgets(buffer, size, in) == NULL ) { + fprintf(stderr, "%s: Format error. %s\n", name, format); + exit(1); + } + *cursor = buffer; + } +} + +static struct codebook * +load(FILE * file, const char * name) +{ + char line[1024]; + char * cursor = line; + struct codebook * b = malloc(sizeof(struct codebook)); + int i; + int size; + + *cursor = '\0'; + + b->k = (int)get_float(file, name, &cursor, line, sizeof(line)); + b->m = (int)get_float(file, name ,&cursor, line, sizeof(line)); + size = b->k * b->m; + + b->cb = (float *)malloc(size * sizeof(float)); + + for ( i = 0; i < size; i++ ) + b->cb[i] = get_float(file, name, &cursor, line, sizeof(line)); + + return b; +} + +int +main(int argc, char * * argv) +{ + struct codebook * * cb = malloc(argc * sizeof(struct codebook *)); + int i; + + if ( argc < 2 ) { + fprintf(stderr, usage, argv[0]); + fprintf(stderr, format); + exit(1); + } + + for ( i = 0; i < argc - 2; i++ ) { + FILE * in = fopen(argv[i + 2], "r"); + + if ( in == NULL ) { + perror(argv[i + 2]); + exit(1); + } + + cb[i] = load(in, argv[i + 2]); + + fclose(in); + } + + printf(header); + for ( i = 0; i < argc - 2; i++ ) { + printf(" /* %s */\n", argv[i + 2]); + dump_array(cb[i], i); + } + printf("\nconst struct lsp_codebook %s[] = {\n", argv[1]); + for ( i = 0; i < argc - 2; i++ ) { + printf(" /* %s */\n", argv[i + 2]); + dump_structure(cb[i], i); + printf(",\n"); + } + printf(" { 0, 0, 0, 0 }\n"); + printf("};\n"); + + return 0; +} diff --git a/gr-vocoder/lib/codec2/globals.c b/gr-vocoder/lib/codec2/globals.c new file mode 100644 index 000000000..f2182f79a --- /dev/null +++ b/gr-vocoder/lib/codec2/globals.c @@ -0,0 +1,49 @@ +/*---------------------------------------------------------------------------*\ + + FILE........: globals.c + AUTHOR......: David Rowe + DATE CREATED: 11/5/94 + + Globals for sinusoidal speech coder. + +\*---------------------------------------------------------------------------*/ + +/* + 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/>. +*/ + +#include "sine.h" /* global defines for coder */ + +/* Globals used in encoder and decoder */ + +int frames; /* number of frames processed so far */ +float Sn[M]; /* float input speech samples */ +MODEL model; /* model parameters for the current frame */ +int Nw; /* number of samples in analysis window */ +float sig; /* energy of current frame */ + +/* Globals used in encoder */ + +float w[M]; /* time domain hamming window */ +COMP W[FFT_ENC]; /* DFT of w[] */ +COMP Sw[FFT_ENC]; /* DFT of current frame */ + +/* Globals used in decoder */ + +COMP Sw_[FFT_ENC]; /* DFT of all voiced synthesised signal */ +float Sn_[AW_DEC]; /* synthesised speech */ +float Pn[AW_DEC]; /* time domain Parzen (trapezoidal) window */ + diff --git a/gr-vocoder/lib/codec2/globals.h b/gr-vocoder/lib/codec2/globals.h new file mode 100644 index 000000000..cef720344 --- /dev/null +++ b/gr-vocoder/lib/codec2/globals.h @@ -0,0 +1,47 @@ +/*---------------------------------------------------------------------------*\ + + FILE........: globals.h + AUTHOR......: David Rowe + DATE CREATED: 1/11/94 + + Globals for sinusoidal speech coder. + +\*---------------------------------------------------------------------------*/ + +/* + 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/>. +*/ + +/* Globals used in encoder and decoder */ + +extern int frames; /* number of frames processed so far */ +extern float Sn[]; /* float input speech samples */ +extern MODEL model; /* model parameters for the current frame */ +extern int Nw; /* number of samples in analysis window */ +extern float sig; /* energy of current frame */ + +/* Globals used in encoder */ + +extern float w[]; /* time domain hamming window */ +extern COMP W[]; /* frequency domain hamming window */ +extern COMP Sw[]; /* DFT of current frame */ +extern COMP Sw_[]; /* DFT of all voiced synthesised signal */ + +/* Globals used in decoder */ + +extern float Sn_[]; /* output synthesised speech samples */ +extern float Pn[]; /* time domain Parzen (trapezoidal) window */ + diff --git a/gr-vocoder/lib/codec2/glottal.c b/gr-vocoder/lib/codec2/glottal.c new file mode 100644 index 000000000..8ac3ff4a9 --- /dev/null +++ b/gr-vocoder/lib/codec2/glottal.c @@ -0,0 +1,257 @@ +const float glottal[]={ + 0.000000, + -0.057687, + -0.115338, + -0.172917, + -0.230385, + -0.287707, + -0.344845, + -0.401762, + -0.458419, + -0.514781, + -0.570809, + -0.626467, + -0.681721, + -0.736537, + -0.790884, + -0.844733, + -0.898057, + -0.950834, + -1.003044, + -1.054670, + -1.105700, + -1.156124, + -1.205936, + -1.255132, + -1.303711, + -1.351675, + -1.399026, + -1.445769, + -1.491908, + -1.537448, + -1.582393, + -1.626747, + -1.670514, + -1.713693, + -1.756285, + -1.798288, + -1.839697, + -1.880507, + -1.920712, + -1.960302, + -1.999269, + -2.037603, + -2.075295, + -2.112335, + -2.148716, + -2.184430, + -2.219472, + -2.253839, + -2.287531, + -2.320550, + -2.352900, + -2.384588, + -2.415623, + -2.446019, + -2.475788, + -2.504946, + -2.533512, + -2.561501, + -2.588934, + -2.615827, + -2.642198, + -2.668064, + -2.693439, + -2.718337, + -2.742767, + -2.766738, + -2.790256, + -2.813322, + -2.835936, + -2.858094, + -2.879790, + -2.901016, + -2.921759, + -2.942008, + -2.961747, + -2.980961, + -2.999632, + -3.017745, + -3.035282, + -3.052228, + -3.068567, + -3.084285, + -3.099371, + -3.113813, + -3.127605, + -3.140738, + 3.129975, + 3.118167, + 3.107022, + 3.096537, + 3.086709, + 3.077531, + 3.068996, + 3.061096, + 3.053821, + 3.047159, + 3.041102, + 3.035636, + 3.030753, + 3.026441, + 3.022690, + 3.019491, + 3.016836, + 3.014718, + 3.013132, + 3.012072, + 3.011535, + 3.011521, + 3.012028, + 3.013057, + 3.014612, + 3.016695, + 3.019310, + 3.022463, + 3.026160, + 3.030407, + 3.035212, + 3.040580, + 3.046520, + 3.053038, + 3.060141, + 3.067836, + 3.076128, + 3.085023, + 3.094525, + 3.104639, + 3.115367, + 3.126712, + 3.138674, + -3.131930, + -3.118731, + -3.104915, + -3.090485, + -3.075444, + -3.059795, + -3.043543, + -3.026695, + -3.009254, + -2.991229, + -2.972625, + -2.953449, + -2.933710, + -2.913414, + -2.892567, + -2.871176, + -2.849248, + -2.826787, + -2.803798, + -2.780284, + -2.756247, + -2.731689, + -2.706609, + -2.681005, + -2.654875, + -2.628213, + -2.601015, + -2.573272, + -2.544977, + -2.516121, + -2.486694, + -2.456686, + -2.426084, + -2.394879, + -2.363060, + -2.330616, + -2.297538, + -2.263816, + -2.229444, + -2.194416, + -2.158727, + -2.122375, + -2.085359, + -2.047682, + -2.009347, + -1.970361, + -1.930732, + -1.890470, + -1.849587, + -1.808098, + -1.766017, + -1.723360, + -1.680145, + -1.636388, + -1.592105, + -1.547313, + -1.502025, + -1.456256, + -1.410016, + -1.363314, + -1.316157, + -1.268547, + -1.220486, + -1.171971, + -1.122997, + -1.073555, + -1.023636, + -0.973227, + -0.922312, + -0.870875, + -0.818899, + -0.766366, + -0.713257, + -0.659554, + -0.605242, + -0.550303, + -0.494723, + -0.438492, + -0.381598, + -0.324036, + -0.265800, + -0.206889, + -0.147303, + -0.087046, + -0.026121, + 0.035463, + 0.097698, + 0.160576, + 0.224087, + 0.288221, + 0.352969, + 0.418323, + 0.484276, + 0.550822, + 0.617958, + 0.685681, + 0.753991, + 0.822889, + 0.892378, + 0.962462, + 1.033144, + 1.104430, + 1.176325, + 1.248833, + 1.321956, + 1.395696, + 1.470051, + 1.545019, + 1.620593, + 1.696763, + 1.773516, + 1.850837, + 1.928705, + 2.007097, + 2.085987, + 2.165347, + 2.245145, + 2.325347, + 2.405919, + 2.486824, + 2.568025, + 2.649485, + 2.731167, + 2.813033, + 2.895045, + 2.977167, + 3.059362}; diff --git a/gr-vocoder/lib/codec2/interp.c b/gr-vocoder/lib/codec2/interp.c new file mode 100644 index 000000000..135d8c9e7 --- /dev/null +++ b/gr-vocoder/lib/codec2/interp.c @@ -0,0 +1,472 @@ +/*---------------------------------------------------------------------------*\ + + FILE........: interp.c + AUTHOR......: David Rowe + DATE CREATED: 9/10/09 + + Interpolation of 20ms frames to 10ms frames. + +\*---------------------------------------------------------------------------*/ + +/* + 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/>. +*/ + +#include <assert.h> +#include <math.h> +#include <string.h> +#include <stdio.h> +#include <stdlib.h> + +#include "defines.h" +#include "interp.h" +#include "lsp.h" +#include "quantise.h" +#include "dump.h" + +float sample_log_amp(MODEL *model, float w); + +/*---------------------------------------------------------------------------*\ + + FUNCTION....: interp() + AUTHOR......: David Rowe + DATE CREATED: 22/8/10 + + Given two frames decribed by model parameters 20ms apart, determines + the model parameters of the 10ms frame between them. Assumes + voicing is available for middle (interpolated) frame. Outputs are + amplitudes and Wo for the interpolated frame. + + This version can interpolate the amplitudes between two frames of + different Wo and L. + + This version works by log linear interpolation, but listening tests + showed it creates problems in background noise, e.g. hts2a and mmt1. + When this function is used (--dec mode) bg noise appears to be + amplitude modulated, and gets louder. The interp_lsp() function + below seems to do a better job. + +\*---------------------------------------------------------------------------*/ + +void interpolate( + MODEL *interp, /* interpolated model params */ + MODEL *prev, /* previous frames model params */ + MODEL *next /* next frames model params */ +) +{ + int l; + float w,log_amp; + + /* Wo depends on voicing of this and adjacent frames */ + + if (interp->voiced) { + if (prev->voiced && next->voiced) + interp->Wo = (prev->Wo + next->Wo)/2.0; + if (!prev->voiced && next->voiced) + interp->Wo = next->Wo; + if (prev->voiced && !next->voiced) + interp->Wo = prev->Wo; + } + else { + interp->Wo = TWO_PI/P_MAX; + } + interp->L = PI/interp->Wo; + + /* Interpolate amplitudes using linear interpolation in log domain */ + + for(l=1; l<=interp->L; l++) { + w = l*interp->Wo; + log_amp = (sample_log_amp(prev, w) + sample_log_amp(next, w))/2.0; + interp->A[l] = pow(10.0, log_amp); + } +} + +/*---------------------------------------------------------------------------*\ + + FUNCTION....: sample_log_amp() + AUTHOR......: David Rowe + DATE CREATED: 22/8/10 + + Samples the amplitude envelope at an arbitrary frequency w. Uses + linear interpolation in the log domain to sample between harmonic + amplitudes. + +\*---------------------------------------------------------------------------*/ + +float sample_log_amp(MODEL *model, float w) +{ + int m; + float f, log_amp; + + assert(w > 0.0); assert (w <= PI); + + m = 0; + while ((m+1)*model->Wo < w) m++; + f = (w - m*model->Wo)/model->Wo; + assert(f <= 1.0); + + if (m < 1) { + log_amp = f*log10(model->A[1] + 1E-6); + } + else if ((m+1) > model->L) { + log_amp = (1.0-f)*log10(model->A[model->L] + 1E-6); + } + else { + log_amp = (1.0-f)*log10(model->A[m] + 1E-6) + + f*log10(model->A[m+1] + 1E-6); + //printf("m=%d A[m] %f A[m+1] %f x %f %f %f\n", m, model->A[m], + // model->A[m+1], pow(10.0, log_amp), + // (1-f), f); + } + + return log_amp; +} + +/*---------------------------------------------------------------------------*\ + + FUNCTION....: sample_log_amp_quad() + AUTHOR......: David Rowe + DATE CREATED: 9 March 2011 + + Samples the amplitude envelope at an arbitrary frequency w. Uses + quadratic interpolation in the log domain to sample between harmonic + amplitudes. + + y(x) = ax*x + bx + c + + We assume three points are x=-1, x=0, x=1, which we map to m-1,m,m+1 + + c = y(0) + b = (y(1) - y(-1))/2 + a = y(-1) + b - y(0) + +\*---------------------------------------------------------------------------*/ + +float sample_log_amp_quad(MODEL *model, float w) +{ + int m; + float a,b,c,x, log_amp; + + assert(w > 0.0); assert (w <= PI); + + m = floor(w/model->Wo + 0.5); + if (m < 2) m = 2; + if (m > (model->L-1)) m = model->L-1; + c = log10(model->A[m]+1E-6); + b = (log10(model->A[m+1]+1E-6) - log10(model->A[m-1]+1E-6))/2.0; + a = log10(model->A[m-1]+1E-6) + b - c; + x = (w - m*model->Wo)/model->Wo; + + log_amp = a*x*x + b*x + c; + //printf("m=%d A[m-1] %f A[m] %f A[m+1] %f w %f x %f log_amp %f\n", m, + // model->A[m-1], + // model->A[m], model->A[m+1], w, x, pow(10.0, log_amp)); + return log_amp; +} + +/*---------------------------------------------------------------------------*\ + + FUNCTION....: sample_log_amp_quad_nl() + AUTHOR......: David Rowe + DATE CREATED: 10 March 2011 + + Samples the amplitude envelope at an arbitrary frequency w. Uses + quadratic interpolation in the log domain to sample between harmonic + amplitudes. This version can handle non-linear steps along a freq + axis defined by arbitrary steps. + + y(x) = ax*x + bx + c + + We assume three points are (x_1,y_1), (0,y0) and (x1,y1). + +\*---------------------------------------------------------------------------*/ + +float sample_log_amp_quad_nl( + float w[], /* frequency points */ + float A[], /* for these amplitude samples */ + int np, /* number of frequency points */ + float w_sample /* frequency of new samples */ +) +{ + int m,i; + float a,b,c,x, log_amp, best_dist; + float x_1, x1; + float y_1, y0, y1; + + //printf("w_sample %f\n", w_sample); + assert(w_sample >= 0.0); assert (w_sample <= 1.1*PI); + + /* find closest point to centre quadratic interpolator */ + + best_dist = 1E32; + for (i=0; i<np; i++) + if (fabs(w[i] - w_sample) < best_dist) { + best_dist = fabs(w[i] - w_sample); + m = i; + } + + /* stay one point away from edge of array */ + + if (m < 1) m = 1; + if (m > (np-2)) m = np - 2; + + /* find polynomial coeffs */ + + x_1 = w[m-1]- w[m]; x1 = w[m+1] - w[m]; + y_1 = log10(A[m-1]+1E-6); + y0 = log10(A[m]+1E-6); + y1 = log10(A[m+1]+1E-6); + + c = y0; + a = (y_1*x1 - y1*x_1 + c*x_1 - c*x1)/(x_1*x_1*x1 - x1*x1*x_1); + b = (y1 -a*x1*x1 - c)/x1; + x = w_sample - w[m]; + + //printf("%f %f %f\n", w[0], w[1], w[2]); + //printf("%f %f %f %f %f %f\n", x_1, y_1, 0.0, y0, x1, y1); + log_amp = a*x*x + b*x + c; + //printf("a %f b %f c %f\n", a, b, c); + //printf("m=%d A[m-1] %f A[m] %f A[m+1] %f w_sample %f w[m] %f x %f log_amp %f\n", m, + // A[m-1], + // A[m], A[m+1], w_sample, w[m], x, log_amp); + //exit(0); + return log_amp; +} + +#define M_MAX 40 + +float fres[] = {100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, + 1200, 1400, 1600, 1850, 2100, 2350, 2600, 2900, 3400, 3800}; + +/*---------------------------------------------------------------------------*\ + + FUNCTION....: resample_amp_nl() + AUTHOR......: David Rowe + DATE CREATED: 7 March 2011 + + Converts the current model with L {Am} samples spaced Wo apart to + RES_POINTS samples spaced Wo/RES_POINTS apart. Then subtracts + from the previous frames samples to get the delta. + +\*---------------------------------------------------------------------------*/ + +void resample_amp_fixed(MODEL *model, + float w[], float A[], + float wres[], float Ares[], + float AresdB_prev[], + float AresdB[], + float deltat[]) +{ + int i; + + for(i=1; i<=model->L; i++) { + w[i-1] = i*model->Wo; + A[i-1] = model->A[i]; + } + + for(i=0; i<RES_POINTS; i++) { + wres[i] = fres[i]*PI/4000.0; + } + + for(i=0; i<RES_POINTS; i++) { + Ares[i] = pow(10.0,sample_log_amp_quad_nl(w, A, model->L, wres[i])); + } + + /* work out delta T vector for this frame */ + + for(i=0; i<RES_POINTS; i++) { + AresdB[i] = 20.0*log10(Ares[i]); + deltat[i] = AresdB[i] - AresdB_prev[i]; + } + +} + +/*---------------------------------------------------------------------------*\ + + FUNCTION....: resample_amp_nl() + AUTHOR......: David Rowe + DATE CREATED: 7 March 2011 + + Converts the current model with L {Am} samples spaced Wo apart to M + samples spaced Wo/M apart. Then converts back to L {Am} samples. + used to prototype constant rate Amplitude encoding ideas. + + Returns the SNR in dB. + +\*---------------------------------------------------------------------------*/ + +float resample_amp_nl(MODEL *model, int m, float AresdB_prev[]) +{ + int i; + float w[MAX_AMP], A[MAX_AMP]; + float wres[MAX_AMP], Ares[MAX_AMP], AresdB[MAX_AMP]; + float signal, noise, snr; + float new_A; + float deltat[MAX_AMP], deltat_q[MAX_AMP], AresdB_q[MAX_AMP]; + + resample_amp_fixed(model, w, A, wres, Ares, AresdB_prev, AresdB, deltat); + + /* quantise delta T vector */ + + for(i=0; i<RES_POINTS; i++) { + noise = 3.0*(1.0 - 2.0*rand()/RAND_MAX); + //noise = 0.0; + deltat_q[i] = deltat[i] + noise; + } + + /* recover Ares vector */ + + for(i=0; i<RES_POINTS; i++) { + AresdB_q[i] = AresdB_prev[i] + deltat_q[i]; + Ares[i] = pow(10.0, AresdB_q[i]/20.0); + //printf("%d %f %f\n", i, AresdB[i], AresdB_q[i]); + } + + /* update memory based on version at decoder */ + + for(i=0; i<RES_POINTS; i++) { + AresdB_prev[i] = AresdB_q[i]; + } + +#ifdef DUMP + dump_resample(wres,Ares,M_MAX); +#endif + + signal = noise = 0.0; + + for(i=1; i<model->L; i++) { + new_A = pow(10.0,sample_log_amp_quad_nl(wres, Ares, RES_POINTS, model->Wo*i)); + signal += pow(model->A[i], 2.0); + noise += pow(model->A[i] - new_A, 2.0); + //printf("%f %f\n", model->A[i], new_A); + model->A[i] = new_A; + } + + snr = 10.0*log10(signal/noise); + printf("snr = %3.2f\n", snr); + //exit(0); + return snr; +} + +/*---------------------------------------------------------------------------*\ + + FUNCTION....: resample_amp() + AUTHOR......: David Rowe + DATE CREATED: 10 March 2011 + + Converts the current model with L {Am} samples spaced Wo apart to M + samples with a non-linear spacing. Then converts back to L {Am} + samples. used to prototype constant rate Amplitude encoding ideas. + + Returns the SNR in dB. + +\*---------------------------------------------------------------------------*/ + +float resample_amp(MODEL *model, int m) +{ + int i; + MODEL model_m; + float new_A, signal, noise, snr, log_amp_dB; + float n_db = 0.0; + + model_m.Wo = PI/(float)m; + model_m.L = PI/model_m.Wo; + + for(i=1; i<=model_m.L; i++) { + log_amp_dB = 20.0*sample_log_amp_quad(model, i*model_m.Wo); + log_amp_dB += n_db*(1.0 - 2.0*rand()/RAND_MAX); + model_m.A[i] = pow(10,log_amp_dB/20.0); + } + + //dump_resample(&model_m); + + signal = noise = 0.0; + + for(i=1; i<model->L/4; i++) { + new_A = pow(10,sample_log_amp_quad(&model_m, i*model->Wo)); + signal += pow(model->A[i], 2.0); + noise += pow(model->A[i] - new_A, 2.0); + //printf("%f %f\n", model->A[i], new_A); + model->A[i] = new_A; + } + + snr = 10.0*log10(signal/noise); + //printf("snr = %3.2f\n", snr); + //exit(0); + return snr; +} + +/*---------------------------------------------------------------------------*\ + + FUNCTION....: interp_lsp() + AUTHOR......: David Rowe + DATE CREATED: 10 Nov 2010 + + Given two frames decribed by model parameters 20ms apart, determines + the model parameters of the 10ms frame between them. Assumes + voicing is available for middle (interpolated) frame. Outputs are + amplitudes and Wo for the interpolated frame. + + This version uses interpolation of LSPs, seems to do a better job + with bg noise. + +\*---------------------------------------------------------------------------*/ + +void interpolate_lsp( + MODEL *interp, /* interpolated model params */ + MODEL *prev, /* previous frames model params */ + MODEL *next, /* next frames model params */ + float *prev_lsps, /* previous frames LSPs */ + float prev_e, /* previous frames LPC energy */ + float *next_lsps, /* next frames LSPs */ + float next_e, /* next frames LPC energy */ + float *ak_interp /* interpolated aks for this frame */ + ) +{ + int l,i; + float lsps[LPC_ORD],e; + float snr; + + /* Wo depends on voicing of this and adjacent frames */ + + if (interp->voiced) { + if (prev->voiced && next->voiced) + interp->Wo = (prev->Wo + next->Wo)/2.0; + if (!prev->voiced && next->voiced) + interp->Wo = next->Wo; + if (prev->voiced && !next->voiced) + interp->Wo = prev->Wo; + } + else { + interp->Wo = TWO_PI/P_MAX; + } + interp->L = PI/interp->Wo; + + /* interpolate LSPs */ + + for(i=0; i<LPC_ORD; i++) { + lsps[i] = (prev_lsps[i] + next_lsps[i])/2.0; + } + + /* Interpolate LPC energy in log domain */ + + e = pow(10.0, (log10(prev_e) + log10(next_e))/2.0); + + /* convert back to amplitudes */ + + lsp_to_lpc(lsps, ak_interp, LPC_ORD); + aks_to_M2(ak_interp, LPC_ORD, interp, e, &snr, 0); +} diff --git a/gr-vocoder/lib/codec2/interp.h b/gr-vocoder/lib/codec2/interp.h new file mode 100644 index 000000000..d41eac3f8 --- /dev/null +++ b/gr-vocoder/lib/codec2/interp.h @@ -0,0 +1,41 @@ +/*---------------------------------------------------------------------------*\ + + FILE........: interp.h + AUTHOR......: David Rowe + DATE CREATED: 9/10/09 + + Interpolation of 20ms frames to 10ms frames. + +\*---------------------------------------------------------------------------*/ + +/* + 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 __INTERP__ +#define __INTERP__ + +#define RES_POINTS 20 + +void interpolate(MODEL *interp, MODEL *prev, MODEL *next); +void interpolate_lsp(MODEL *interp, MODEL *prev, MODEL *next, + float *prev_lsps, float prev_e, + float *next_lsps, float next_e, + float *ak_interp); +float resample_amp(MODEL *model, int m); +float resample_amp_nl(MODEL *model, int m, float Ares_prev[]); + +#endif diff --git a/gr-vocoder/lib/codec2/kiss_fft.c b/gr-vocoder/lib/codec2/kiss_fft.c new file mode 100644 index 000000000..465d6c97a --- /dev/null +++ b/gr-vocoder/lib/codec2/kiss_fft.c @@ -0,0 +1,408 @@ +/* +Copyright (c) 2003-2010, Mark Borgerding + +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. + * Neither the author nor the names of any contributors may be used to endorse or promote products derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + + +#include "_kiss_fft_guts.h" +/* The guts header contains all the multiplication and addition macros that are defined for + fixed or floating point complex numbers. It also delares the kf_ internal functions. + */ + +static void kf_bfly2( + kiss_fft_cpx * Fout, + const size_t fstride, + const kiss_fft_cfg st, + int m + ) +{ + kiss_fft_cpx * Fout2; + kiss_fft_cpx * tw1 = st->twiddles; + kiss_fft_cpx t; + Fout2 = Fout + m; + do{ + C_FIXDIV(*Fout,2); C_FIXDIV(*Fout2,2); + + C_MUL (t, *Fout2 , *tw1); + tw1 += fstride; + C_SUB( *Fout2 , *Fout , t ); + C_ADDTO( *Fout , t ); + ++Fout2; + ++Fout; + }while (--m); +} + +static void kf_bfly4( + kiss_fft_cpx * Fout, + const size_t fstride, + const kiss_fft_cfg st, + const size_t m + ) +{ + kiss_fft_cpx *tw1,*tw2,*tw3; + kiss_fft_cpx scratch[6]; + size_t k=m; + const size_t m2=2*m; + const size_t m3=3*m; + + + tw3 = tw2 = tw1 = st->twiddles; + + do { + C_FIXDIV(*Fout,4); C_FIXDIV(Fout[m],4); C_FIXDIV(Fout[m2],4); C_FIXDIV(Fout[m3],4); + + C_MUL(scratch[0],Fout[m] , *tw1 ); + C_MUL(scratch[1],Fout[m2] , *tw2 ); + C_MUL(scratch[2],Fout[m3] , *tw3 ); + + C_SUB( scratch[5] , *Fout, scratch[1] ); + C_ADDTO(*Fout, scratch[1]); + C_ADD( scratch[3] , scratch[0] , scratch[2] ); + C_SUB( scratch[4] , scratch[0] , scratch[2] ); + C_SUB( Fout[m2], *Fout, scratch[3] ); + tw1 += fstride; + tw2 += fstride*2; + tw3 += fstride*3; + C_ADDTO( *Fout , scratch[3] ); + + if(st->inverse) { + Fout[m].r = scratch[5].r - scratch[4].i; + Fout[m].i = scratch[5].i + scratch[4].r; + Fout[m3].r = scratch[5].r + scratch[4].i; + Fout[m3].i = scratch[5].i - scratch[4].r; + }else{ + Fout[m].r = scratch[5].r + scratch[4].i; + Fout[m].i = scratch[5].i - scratch[4].r; + Fout[m3].r = scratch[5].r - scratch[4].i; + Fout[m3].i = scratch[5].i + scratch[4].r; + } + ++Fout; + }while(--k); +} + +static void kf_bfly3( + kiss_fft_cpx * Fout, + const size_t fstride, + const kiss_fft_cfg st, + size_t m + ) +{ + size_t k=m; + const size_t m2 = 2*m; + kiss_fft_cpx *tw1,*tw2; + kiss_fft_cpx scratch[5]; + kiss_fft_cpx epi3; + epi3 = st->twiddles[fstride*m]; + + tw1=tw2=st->twiddles; + + do{ + C_FIXDIV(*Fout,3); C_FIXDIV(Fout[m],3); C_FIXDIV(Fout[m2],3); + + C_MUL(scratch[1],Fout[m] , *tw1); + C_MUL(scratch[2],Fout[m2] , *tw2); + + C_ADD(scratch[3],scratch[1],scratch[2]); + C_SUB(scratch[0],scratch[1],scratch[2]); + tw1 += fstride; + tw2 += fstride*2; + + Fout[m].r = Fout->r - HALF_OF(scratch[3].r); + Fout[m].i = Fout->i - HALF_OF(scratch[3].i); + + C_MULBYSCALAR( scratch[0] , epi3.i ); + + C_ADDTO(*Fout,scratch[3]); + + Fout[m2].r = Fout[m].r + scratch[0].i; + Fout[m2].i = Fout[m].i - scratch[0].r; + + Fout[m].r -= scratch[0].i; + Fout[m].i += scratch[0].r; + + ++Fout; + }while(--k); +} + +static void kf_bfly5( + kiss_fft_cpx * Fout, + const size_t fstride, + const kiss_fft_cfg st, + int m + ) +{ + kiss_fft_cpx *Fout0,*Fout1,*Fout2,*Fout3,*Fout4; + int u; + kiss_fft_cpx scratch[13]; + kiss_fft_cpx * twiddles = st->twiddles; + kiss_fft_cpx *tw; + kiss_fft_cpx ya,yb; + ya = twiddles[fstride*m]; + yb = twiddles[fstride*2*m]; + + Fout0=Fout; + Fout1=Fout0+m; + Fout2=Fout0+2*m; + Fout3=Fout0+3*m; + Fout4=Fout0+4*m; + + tw=st->twiddles; + for ( u=0; u<m; ++u ) { + C_FIXDIV( *Fout0,5); C_FIXDIV( *Fout1,5); C_FIXDIV( *Fout2,5); C_FIXDIV( *Fout3,5); C_FIXDIV( *Fout4,5); + scratch[0] = *Fout0; + + C_MUL(scratch[1] ,*Fout1, tw[u*fstride]); + C_MUL(scratch[2] ,*Fout2, tw[2*u*fstride]); + C_MUL(scratch[3] ,*Fout3, tw[3*u*fstride]); + C_MUL(scratch[4] ,*Fout4, tw[4*u*fstride]); + + C_ADD( scratch[7],scratch[1],scratch[4]); + C_SUB( scratch[10],scratch[1],scratch[4]); + C_ADD( scratch[8],scratch[2],scratch[3]); + C_SUB( scratch[9],scratch[2],scratch[3]); + + Fout0->r += scratch[7].r + scratch[8].r; + Fout0->i += scratch[7].i + scratch[8].i; + + scratch[5].r = scratch[0].r + S_MUL(scratch[7].r,ya.r) + S_MUL(scratch[8].r,yb.r); + scratch[5].i = scratch[0].i + S_MUL(scratch[7].i,ya.r) + S_MUL(scratch[8].i,yb.r); + + scratch[6].r = S_MUL(scratch[10].i,ya.i) + S_MUL(scratch[9].i,yb.i); + scratch[6].i = -S_MUL(scratch[10].r,ya.i) - S_MUL(scratch[9].r,yb.i); + + C_SUB(*Fout1,scratch[5],scratch[6]); + C_ADD(*Fout4,scratch[5],scratch[6]); + + scratch[11].r = scratch[0].r + S_MUL(scratch[7].r,yb.r) + S_MUL(scratch[8].r,ya.r); + scratch[11].i = scratch[0].i + S_MUL(scratch[7].i,yb.r) + S_MUL(scratch[8].i,ya.r); + scratch[12].r = - S_MUL(scratch[10].i,yb.i) + S_MUL(scratch[9].i,ya.i); + scratch[12].i = S_MUL(scratch[10].r,yb.i) - S_MUL(scratch[9].r,ya.i); + + C_ADD(*Fout2,scratch[11],scratch[12]); + C_SUB(*Fout3,scratch[11],scratch[12]); + + ++Fout0;++Fout1;++Fout2;++Fout3;++Fout4; + } +} + +/* perform the butterfly for one stage of a mixed radix FFT */ +static void kf_bfly_generic( + kiss_fft_cpx * Fout, + const size_t fstride, + const kiss_fft_cfg st, + int m, + int p + ) +{ + int u,k,q1,q; + kiss_fft_cpx * twiddles = st->twiddles; + kiss_fft_cpx t; + int Norig = st->nfft; + + kiss_fft_cpx * scratch = (kiss_fft_cpx*)KISS_FFT_TMP_ALLOC(sizeof(kiss_fft_cpx)*p); + + for ( u=0; u<m; ++u ) { + k=u; + for ( q1=0 ; q1<p ; ++q1 ) { + scratch[q1] = Fout[ k ]; + C_FIXDIV(scratch[q1],p); + k += m; + } + + k=u; + for ( q1=0 ; q1<p ; ++q1 ) { + int twidx=0; + Fout[ k ] = scratch[0]; + for (q=1;q<p;++q ) { + twidx += fstride * k; + if (twidx>=Norig) twidx-=Norig; + C_MUL(t,scratch[q] , twiddles[twidx] ); + C_ADDTO( Fout[ k ] ,t); + } + k += m; + } + } + KISS_FFT_TMP_FREE(scratch); +} + +static +void kf_work( + kiss_fft_cpx * Fout, + const kiss_fft_cpx * f, + const size_t fstride, + int in_stride, + int * factors, + const kiss_fft_cfg st + ) +{ + kiss_fft_cpx * Fout_beg=Fout; + const int p=*factors++; /* the radix */ + const int m=*factors++; /* stage's fft length/p */ + const kiss_fft_cpx * Fout_end = Fout + p*m; + +#ifdef _OPENMP + // use openmp extensions at the + // top-level (not recursive) + if (fstride==1 && p<=5) + { + int k; + + // execute the p different work units in different threads +# pragma omp parallel for + for (k=0;k<p;++k) + kf_work( Fout +k*m, f+ fstride*in_stride*k,fstride*p,in_stride,factors,st); + // all threads have joined by this point + + switch (p) { + case 2: kf_bfly2(Fout,fstride,st,m); break; + case 3: kf_bfly3(Fout,fstride,st,m); break; + case 4: kf_bfly4(Fout,fstride,st,m); break; + case 5: kf_bfly5(Fout,fstride,st,m); break; + default: kf_bfly_generic(Fout,fstride,st,m,p); break; + } + return; + } +#endif + + if (m==1) { + do{ + *Fout = *f; + f += fstride*in_stride; + }while(++Fout != Fout_end ); + }else{ + do{ + // recursive call: + // DFT of size m*p performed by doing + // p instances of smaller DFTs of size m, + // each one takes a decimated version of the input + kf_work( Fout , f, fstride*p, in_stride, factors,st); + f += fstride*in_stride; + }while( (Fout += m) != Fout_end ); + } + + Fout=Fout_beg; + + // recombine the p smaller DFTs + switch (p) { + case 2: kf_bfly2(Fout,fstride,st,m); break; + case 3: kf_bfly3(Fout,fstride,st,m); break; + case 4: kf_bfly4(Fout,fstride,st,m); break; + case 5: kf_bfly5(Fout,fstride,st,m); break; + default: kf_bfly_generic(Fout,fstride,st,m,p); break; + } +} + +/* facbuf is populated by p1,m1,p2,m2, ... + where + p[i] * m[i] = m[i-1] + m0 = n */ +static +void kf_factor(int n,int * facbuf) +{ + int p=4; + double floor_sqrt; + floor_sqrt = floor( sqrt((double)n) ); + + /*factor out powers of 4, powers of 2, then any remaining primes */ + do { + while (n % p) { + switch (p) { + case 4: p = 2; break; + case 2: p = 3; break; + default: p += 2; break; + } + if (p > floor_sqrt) + p = n; /* no more factors, skip to end */ + } + n /= p; + *facbuf++ = p; + *facbuf++ = n; + } while (n > 1); +} + +/* + * + * User-callable function to allocate all necessary storage space for the fft. + * + * The return value is a contiguous block of memory, allocated with malloc. As such, + * It can be freed with free(), rather than a kiss_fft-specific function. + * */ +kiss_fft_cfg kiss_fft_alloc(int nfft,int inverse_fft,void * mem,size_t * lenmem ) +{ + kiss_fft_cfg st=NULL; + size_t memneeded = sizeof(struct kiss_fft_state) + + sizeof(kiss_fft_cpx)*(nfft-1); /* twiddle factors*/ + + if ( lenmem==NULL ) { + st = ( kiss_fft_cfg)KISS_FFT_MALLOC( memneeded ); + }else{ + if (mem != NULL && *lenmem >= memneeded) + st = (kiss_fft_cfg)mem; + *lenmem = memneeded; + } + if (st) { + int i; + st->nfft=nfft; + st->inverse = inverse_fft; + + for (i=0;i<nfft;++i) { + const double pi=3.141592653589793238462643383279502884197169399375105820974944; + double phase = -2*pi*i / nfft; + if (st->inverse) + phase *= -1; + kf_cexp(st->twiddles+i, phase ); + } + + kf_factor(nfft,st->factors); + } + return st; +} + + +void kiss_fft_stride(kiss_fft_cfg st,const kiss_fft_cpx *fin,kiss_fft_cpx *fout,int in_stride) +{ + if (fin == fout) { + //NOTE: this is not really an in-place FFT algorithm. + //It just performs an out-of-place FFT into a temp buffer + kiss_fft_cpx * tmpbuf = (kiss_fft_cpx*)KISS_FFT_TMP_ALLOC( sizeof(kiss_fft_cpx)*st->nfft); + kf_work(tmpbuf,fin,1,in_stride, st->factors,st); + memcpy(fout,tmpbuf,sizeof(kiss_fft_cpx)*st->nfft); + KISS_FFT_TMP_FREE(tmpbuf); + }else{ + kf_work( fout, fin, 1,in_stride, st->factors,st ); + } +} + +void kiss_fft(kiss_fft_cfg cfg,const kiss_fft_cpx *fin,kiss_fft_cpx *fout) +{ + kiss_fft_stride(cfg,fin,fout,1); +} + + +void kiss_fft_cleanup(void) +{ + // nothing needed any more +} + +int kiss_fft_next_fast_size(int n) +{ + while(1) { + int m=n; + while ( (m%2) == 0 ) m/=2; + while ( (m%3) == 0 ) m/=3; + while ( (m%5) == 0 ) m/=5; + if (m<=1) + break; /* n is completely factorable by twos, threes, and fives */ + n++; + } + return n; +} diff --git a/gr-vocoder/lib/codec2/kiss_fft.h b/gr-vocoder/lib/codec2/kiss_fft.h new file mode 100644 index 000000000..64c50f4aa --- /dev/null +++ b/gr-vocoder/lib/codec2/kiss_fft.h @@ -0,0 +1,124 @@ +#ifndef KISS_FFT_H +#define KISS_FFT_H + +#include <stdlib.h> +#include <stdio.h> +#include <math.h> +#include <string.h> + +#ifdef __cplusplus +extern "C" { +#endif + +/* + ATTENTION! + If you would like a : + -- a utility that will handle the caching of fft objects + -- real-only (no imaginary time component ) FFT + -- a multi-dimensional FFT + -- a command-line utility to perform ffts + -- a command-line utility to perform fast-convolution filtering + + Then see kfc.h kiss_fftr.h kiss_fftnd.h fftutil.c kiss_fastfir.c + in the tools/ directory. +*/ + +#ifdef USE_SIMD +# include <xmmintrin.h> +# define kiss_fft_scalar __m128 +#define KISS_FFT_MALLOC(nbytes) _mm_malloc(nbytes,16) +#define KISS_FFT_FREE _mm_free +#else +#define KISS_FFT_MALLOC malloc +#define KISS_FFT_FREE free +#endif + + +#ifdef FIXED_POINT +#include <sys/types.h> +# if (FIXED_POINT == 32) +# define kiss_fft_scalar int32_t +# else +# define kiss_fft_scalar int16_t +# endif +#else +# ifndef kiss_fft_scalar +/* default is float */ +# define kiss_fft_scalar float +# endif +#endif + +typedef struct { + kiss_fft_scalar r; + kiss_fft_scalar i; +}kiss_fft_cpx; + +typedef struct kiss_fft_state* kiss_fft_cfg; + +/* + * kiss_fft_alloc + * + * Initialize a FFT (or IFFT) algorithm's cfg/state buffer. + * + * typical usage: kiss_fft_cfg mycfg=kiss_fft_alloc(1024,0,NULL,NULL); + * + * The return value from fft_alloc is a cfg buffer used internally + * by the fft routine or NULL. + * + * If lenmem is NULL, then kiss_fft_alloc will allocate a cfg buffer using malloc. + * The returned value should be free()d when done to avoid memory leaks. + * + * The state can be placed in a user supplied buffer 'mem': + * If lenmem is not NULL and mem is not NULL and *lenmem is large enough, + * then the function places the cfg in mem and the size used in *lenmem + * and returns mem. + * + * If lenmem is not NULL and ( mem is NULL or *lenmem is not large enough), + * then the function returns NULL and places the minimum cfg + * buffer size in *lenmem. + * */ + +kiss_fft_cfg kiss_fft_alloc(int nfft,int inverse_fft,void * mem,size_t * lenmem); + +/* + * kiss_fft(cfg,in_out_buf) + * + * Perform an FFT on a complex input buffer. + * for a forward FFT, + * fin should be f[0] , f[1] , ... ,f[nfft-1] + * fout will be F[0] , F[1] , ... ,F[nfft-1] + * Note that each element is complex and can be accessed like + f[k].r and f[k].i + * */ +void kiss_fft(kiss_fft_cfg cfg,const kiss_fft_cpx *fin,kiss_fft_cpx *fout); + +/* + A more generic version of the above function. It reads its input from every Nth sample. + * */ +void kiss_fft_stride(kiss_fft_cfg cfg,const kiss_fft_cpx *fin,kiss_fft_cpx *fout,int fin_stride); + +/* If kiss_fft_alloc allocated a buffer, it is one contiguous + buffer and can be simply free()d when no longer needed*/ +#define kiss_fft_free free + +/* + Cleans up some memory that gets managed internally. Not necessary to call, but it might clean up + your compiler output to call this before you exit. +*/ +void kiss_fft_cleanup(void); + + +/* + * Returns the smallest integer k, such that k>=n and k has only "fast" factors (2,3,5) + */ +int kiss_fft_next_fast_size(int n); + +/* for real ffts, we need an even size */ +#define kiss_fftr_next_fast_size_real(n) \ + (kiss_fft_next_fast_size( ((n)+1)>>1)<<1) + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/gr-vocoder/lib/codec2/listensim.sh b/gr-vocoder/lib/codec2/listensim.sh new file mode 100755 index 000000000..0b27a1b0c --- /dev/null +++ b/gr-vocoder/lib/codec2/listensim.sh @@ -0,0 +1,9 @@ +#!/bin/sh +# listensim.sh +# David Rowe 10 Sep 2009 +# +# Listen to files processed with sim.sh + +../script/menu.sh ../raw/$1.raw $1_uq.raw $1_phase0.raw $1_lpc10.raw $1_phase0_lpc10.raw $1_phase0_lpc10_dec.raw $1_phase0_lsp_dec.raw $2 $3 + + diff --git a/gr-vocoder/lib/codec2/lpc.c b/gr-vocoder/lib/codec2/lpc.c new file mode 100644 index 000000000..ba8011377 --- /dev/null +++ b/gr-vocoder/lib/codec2/lpc.c @@ -0,0 +1,279 @@ +/*---------------------------------------------------------------------------*\ + + FILE........: lpc.c + AUTHOR......: David Rowe + DATE CREATED: 30/9/90 + + Linear Prediction functions written in C. + +\*---------------------------------------------------------------------------*/ + +/* + 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/>. +*/ + +#define LPC_MAX_N 512 /* maximum no. of samples in frame */ +#define PI 3.141592654 /* mathematical constant */ + +#include <assert.h> +#include <math.h> +#include "defines.h" +#include "lpc.h" + +/*---------------------------------------------------------------------------*\ + + hanning_window() + + Hanning windows a frame of speech samples. + +\*---------------------------------------------------------------------------*/ + +void hanning_window( + float Sn[], /* input frame of speech samples */ + float Wn[], /* output frame of windowed samples */ + int Nsam /* number of samples */ +) +{ + int i; /* loop variable */ + + for(i=0; i<Nsam; i++) + Wn[i] = Sn[i]*(0.5 - 0.5*cos(2*PI*(float)i/(Nsam-1))); +} + +/*---------------------------------------------------------------------------*\ + + autocorrelate() + + Finds the first P autocorrelation values of an array of windowed speech + samples Sn[]. + +\*---------------------------------------------------------------------------*/ + +void autocorrelate( + float Sn[], /* frame of Nsam windowed speech samples */ + float Rn[], /* array of P+1 autocorrelation coefficients */ + int Nsam, /* number of windowed samples to use */ + int order /* order of LPC analysis */ +) +{ + int i,j; /* loop variables */ + + for(j=0; j<order+1; j++) { + Rn[j] = 0.0; + for(i=0; i<Nsam-j; i++) + Rn[j] += Sn[i]*Sn[i+j]; + } +} + +/*---------------------------------------------------------------------------*\ + + autocorrelate_freq() + + Finds the first P autocorrelation values from an array of frequency domain + power samples. + +\*---------------------------------------------------------------------------*/ + +void autocorrelate_freq( + float Pw[], /* Nsam frequency domain power spectrum samples */ + float w[], /* frequency of each sample in Pw[] */ + float R[], /* array of order+1 autocorrelation coefficients */ + int Nsam, /* number of windowed samples to use */ + int order /* order of LPC analysis */ +) +{ + int i,j; /* loop variables */ + + for(j=0; j<order+1; j++) { + R[j] = 0.0; + for(i=0; i<Nsam; i++) + R[j] += Pw[i]*cos(j*w[i]); + } + R[j] /= Nsam; +} + +/*---------------------------------------------------------------------------*\ + + levinson_durbin() + + Given P+1 autocorrelation coefficients, finds P Linear Prediction Coeff. + (LPCs) where P is the order of the LPC all-pole model. The Levinson-Durbin + algorithm is used, and is described in: + + J. Makhoul + "Linear prediction, a tutorial review" + Proceedings of the IEEE + Vol-63, No. 4, April 1975 + +\*---------------------------------------------------------------------------*/ + +void levinson_durbin( + float R[], /* order+1 autocorrelation coeff */ + float lpcs[], /* order+1 LPC's */ + int order /* order of the LPC analysis */ +) +{ + float E[LPC_MAX+1]; + float k[LPC_MAX+1]; + float a[LPC_MAX+1][LPC_MAX+1]; + float sum; + int i,j; /* loop variables */ + + E[0] = R[0]; /* Equation 38a, Makhoul */ + + for(i=1; i<=order; i++) { + sum = 0.0; + for(j=1; j<=i-1; j++) + sum += a[i-1][j]*R[i-j]; + k[i] = -1.0*(R[i] + sum)/E[i-1]; /* Equation 38b, Makhoul */ + if (fabs(k[i]) > 1.0) + k[i] = 0.0; + + a[i][i] = k[i]; + + for(j=1; j<=i-1; j++) + a[i][j] = a[i-1][j] + k[i]*a[i-1][i-j]; /* Equation 38c, Makhoul */ + + E[i] = (1-k[i]*k[i])*E[i-1]; /* Equation 38d, Makhoul */ + } + + for(i=1; i<=order; i++) + lpcs[i] = a[order][i]; + lpcs[0] = 1.0; +} + +/*---------------------------------------------------------------------------*\ + + inverse_filter() + + Inverse Filter, A(z). Produces an array of residual samples from an array + of input samples and linear prediction coefficients. + + The filter memory is stored in the first order samples of the input array. + +\*---------------------------------------------------------------------------*/ + +void inverse_filter( + float Sn[], /* Nsam input samples */ + float a[], /* LPCs for this frame of samples */ + int Nsam, /* number of samples */ + float res[], /* Nsam residual samples */ + int order /* order of LPC */ +) +{ + int i,j; /* loop variables */ + + for(i=0; i<Nsam; i++) { + res[i] = 0.0; + for(j=0; j<=order; j++) + res[i] += Sn[i-j]*a[j]; + } +} + +/*---------------------------------------------------------------------------*\ + + synthesis_filter() + + C version of the Speech Synthesis Filter, 1/A(z). Given an array of + residual or excitation samples, and the the LP filter coefficients, this + function will produce an array of speech samples. This filter structure is + IIR. + + The synthesis filter has memory as well, this is treated in the same way + as the memory for the inverse filter (see inverse_filter() notes above). + The difference is that the memory for the synthesis filter is stored in + the output array, wheras the memory of the inverse filter is stored in the + input array. + + Note: the calling function must update the filter memory. + +\*---------------------------------------------------------------------------*/ + +void synthesis_filter( + float res[], /* Nsam input residual (excitation) samples */ + float a[], /* LPCs for this frame of speech samples */ + int Nsam, /* number of speech samples */ + int order, /* LPC order */ + float Sn_[] /* Nsam output synthesised speech samples */ +) +{ + int i,j; /* loop variables */ + + /* Filter Nsam samples */ + + for(i=0; i<Nsam; i++) { + Sn_[i] = res[i]*a[0]; + for(j=1; j<=order; j++) + Sn_[i] -= Sn_[i-j]*a[j]; + } +} + +/*---------------------------------------------------------------------------*\ + + find_aks() + + This function takes a frame of samples, and determines the linear + prediction coefficients for that frame of samples. + +\*---------------------------------------------------------------------------*/ + +void find_aks( + float Sn[], /* Nsam samples with order sample memory */ + float a[], /* order+1 LPCs with first coeff 1.0 */ + int Nsam, /* number of input speech samples */ + int order, /* order of the LPC analysis */ + float *E /* residual energy */ +) +{ + float Wn[LPC_MAX_N]; /* windowed frame of Nsam speech samples */ + float R[LPC_MAX+1]; /* order+1 autocorrelation values of Sn[] */ + int i; + + assert(order < LPC_MAX); + assert(Nsam < LPC_MAX_N); + + hanning_window(Sn,Wn,Nsam); + autocorrelate(Wn,R,Nsam,order); + levinson_durbin(R,a,order); + + *E = 0.0; + for(i=0; i<=order; i++) + *E += a[i]*R[i]; + if (*E < 0.0) + *E = 1E-12; +} + +/*---------------------------------------------------------------------------*\ + + weight() + + Weights a vector of LPCs. + +\*---------------------------------------------------------------------------*/ + +void weight( + float ak[], /* vector of order+1 LPCs */ + float gamma, /* weighting factor */ + int order, /* num LPCs (excluding leading 1.0) */ + float akw[] /* weighted vector of order+1 LPCs */ +) +{ + int i; + + for(i=1; i<=order; i++) + akw[i] = ak[i]*pow(gamma,(float)i); +} + diff --git a/gr-vocoder/lib/codec2/lpc.h b/gr-vocoder/lib/codec2/lpc.h new file mode 100644 index 000000000..ead05e1ba --- /dev/null +++ b/gr-vocoder/lib/codec2/lpc.h @@ -0,0 +1,42 @@ +/*---------------------------------------------------------------------------*\ + + FILE........: lpc.h + AUTHOR......: David Rowe + DATE CREATED: 24/8/09 + + Linear Prediction functions written in C. + +\*---------------------------------------------------------------------------*/ + +/* + 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 __LPC__ +#define __LPC__ + +#define LPC_MAX_ORDER 20 + +void hanning_window(float Sn[], float Wn[], int Nsam); +void autocorrelate(float Sn[], float Rn[], int Nsam, int order); +void autocorrelate_freq(float Pw[], float w[], float R[], int Nsam, int order); +void levinson_durbin(float R[], float lpcs[], int order); +void inverse_filter(float Sn[], float a[], int Nsam, float res[], int order); +void synthesis_filter(float res[], float a[], int Nsam, int order, float Sn_[]); +void find_aks(float Sn[], float a[], int Nsam, int order, float *E); +void weight(float ak[], float gamma, int order, float akw[]); + +#endif diff --git a/gr-vocoder/lib/codec2/lsp.c b/gr-vocoder/lib/codec2/lsp.c new file mode 100644 index 000000000..47001c1ef --- /dev/null +++ b/gr-vocoder/lib/codec2/lsp.c @@ -0,0 +1,325 @@ +/*---------------------------------------------------------------------------*\ + + FILE........: lsp.c + AUTHOR......: David Rowe + DATE CREATED: 24/2/93 + + + This file contains functions for LPC to LSP conversion and LSP to + LPC conversion. Note that the LSP coefficients are not in radians + format but in the x domain of the unit circle. + +\*---------------------------------------------------------------------------*/ + +/* + 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/>. +*/ + +#include "defines.h" +#include "lsp.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> + +/* Only 10 gets used, so far. */ +#define LSP_MAX_ORDER 20 + +/*---------------------------------------------------------------------------*\ + + Introduction to Line Spectrum Pairs (LSPs) + ------------------------------------------ + + LSPs are used to encode the LPC filter coefficients {ak} for + transmission over the channel. LSPs have several properties (like + less sensitivity to quantisation noise) that make them superior to + direct quantisation of {ak}. + + A(z) is a polynomial of order lpcrdr with {ak} as the coefficients. + + A(z) is transformed to P(z) and Q(z) (using a substitution and some + algebra), to obtain something like: + + A(z) = 0.5[P(z)(z+z^-1) + Q(z)(z-z^-1)] (1) + + As you can imagine A(z) has complex zeros all over the z-plane. P(z) + and Q(z) have the very neat property of only having zeros _on_ the + unit circle. So to find them we take a test point z=exp(jw) and + evaluate P (exp(jw)) and Q(exp(jw)) using a grid of points between 0 + and pi. + + The zeros (roots) of P(z) also happen to alternate, which is why we + swap coefficients as we find roots. So the process of finding the + LSP frequencies is basically finding the roots of 5th order + polynomials. + + The root so P(z) and Q(z) occur in symmetrical pairs at +/-w, hence + the name Line Spectrum Pairs (LSPs). + + To convert back to ak we just evaluate (1), "clocking" an impulse + thru it lpcrdr times gives us the impulse response of A(z) which is + {ak}. + +\*---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------*\ + + FUNCTION....: cheb_poly_eva() + AUTHOR......: David Rowe + DATE CREATED: 24/2/93 + + This function evalutes a series of chebyshev polynomials + + FIXME: performing memory allocation at run time is very inefficient, + replace with stack variables of MAX_P size. + +\*---------------------------------------------------------------------------*/ + + +static float +cheb_poly_eva(float *coef,float x,int m) +/* float coef[] coefficients of the polynomial to be evaluated */ +/* float x the point where polynomial is to be evaluated */ +/* int m order of the polynomial */ +{ + int i; + float *t,*u,*v,sum; + float T[(LSP_MAX_ORDER / 2) + 1]; + + /* Initialise pointers */ + + t = T; /* T[i-2] */ + *t++ = 1.0; + u = t--; /* T[i-1] */ + *u++ = x; + v = u--; /* T[i] */ + + /* Evaluate chebyshev series formulation using iterative approach */ + + for(i=2;i<=m/2;i++) + *v++ = (2*x)*(*u++) - *t++; /* T[i] = 2*x*T[i-1] - T[i-2] */ + + sum=0.0; /* initialise sum to zero */ + t = T; /* reset pointer */ + + /* Evaluate polynomial and return value also free memory space */ + + for(i=0;i<=m/2;i++) + sum+=coef[(m/2)-i]**t++; + + return sum; +} + + +/*---------------------------------------------------------------------------*\ + + FUNCTION....: lpc_to_lsp() + AUTHOR......: David Rowe + DATE CREATED: 24/2/93 + + This function converts LPC coefficients to LSP coefficients. + +\*---------------------------------------------------------------------------*/ + +int lpc_to_lsp (float *a, int lpcrdr, float *freq, int nb, float delta) +/* float *a lpc coefficients */ +/* int lpcrdr order of LPC coefficients (10) */ +/* float *freq LSP frequencies in radians */ +/* int nb number of sub-intervals (4) */ +/* float delta grid spacing interval (0.02) */ +{ + float psuml,psumr,psumm,temp_xr,xl,xr,xm = 0; + float temp_psumr; + int i,j,m,flag,k; + float *px; /* ptrs of respective P'(z) & Q'(z) */ + float *qx; + float *p; + float *q; + float *pt; /* ptr used for cheb_poly_eval() + whether P' or Q' */ + int roots=0; /* number of roots found */ + float Q[LSP_MAX_ORDER + 1]; + float P[LSP_MAX_ORDER + 1]; + + flag = 1; + m = lpcrdr/2; /* order of P'(z) & Q'(z) polynimials */ + + /* Allocate memory space for polynomials */ + + /* determine P'(z)'s and Q'(z)'s coefficients where + P'(z) = P(z)/(1 + z^(-1)) and Q'(z) = Q(z)/(1-z^(-1)) */ + + px = P; /* initilaise ptrs */ + qx = Q; + p = px; + q = qx; + *px++ = 1.0; + *qx++ = 1.0; + for(i=1;i<=m;i++){ + *px++ = a[i]+a[lpcrdr+1-i]-*p++; + *qx++ = a[i]-a[lpcrdr+1-i]+*q++; + } + px = P; + qx = Q; + for(i=0;i<m;i++){ + *px = 2**px; + *qx = 2**qx; + px++; + qx++; + } + px = P; /* re-initialise ptrs */ + qx = Q; + + /* Search for a zero in P'(z) polynomial first and then alternate to Q'(z). + Keep alternating between the two polynomials as each zero is found */ + + xr = 0; /* initialise xr to zero */ + xl = 1.0; /* start at point xl = 1 */ + + + for(j=0;j<lpcrdr;j++){ + if(j%2) /* determines whether P' or Q' is eval. */ + pt = qx; + else + pt = px; + + psuml = cheb_poly_eva(pt,xl,lpcrdr); /* evals poly. at xl */ + flag = 1; + while(flag && (xr >= -1.0)){ + xr = xl - delta ; /* interval spacing */ + psumr = cheb_poly_eva(pt,xr,lpcrdr);/* poly(xl-delta_x) */ + temp_psumr = psumr; + temp_xr = xr; + + /* if no sign change increment xr and re-evaluate + poly(xr). Repeat til sign change. if a sign change has + occurred the interval is bisected and then checked again + for a sign change which determines in which interval the + zero lies in. If there is no sign change between poly(xm) + and poly(xl) set interval between xm and xr else set + interval between xl and xr and repeat till root is located + within the specified limits */ + + if((psumr*psuml)<0.0){ + roots++; + + psumm=psuml; + for(k=0;k<=nb;k++){ + xm = (xl+xr)/2; /* bisect the interval */ + psumm=cheb_poly_eva(pt,xm,lpcrdr); + if(psumm*psuml>0.){ + psuml=psumm; + xl=xm; + } + else{ + psumr=psumm; + xr=xm; + } + } + + /* once zero is found, reset initial interval to xr */ + freq[j] = (xm); + xl = xm; + flag = 0; /* reset flag for next search */ + } + else{ + psuml=temp_psumr; + xl=temp_xr; + } + } + } + + /* convert from x domain to radians */ + + for(i=0; i<lpcrdr; i++) { + freq[i] = acos(freq[i]); + } + + return(roots); +} + +/*---------------------------------------------------------------------------*\ + + FUNCTION....: lsp_to_lpc() + AUTHOR......: David Rowe + DATE CREATED: 24/2/93 + + This function converts LSP coefficients to LPC coefficients. In the + Speex code we worked out a way to simplify this significantly. + +\*---------------------------------------------------------------------------*/ + +void lsp_to_lpc(float *lsp, float *ak, int lpcrdr) +/* float *freq array of LSP frequencies in radians */ +/* float *ak array of LPC coefficients */ +/* int lpcrdr order of LPC coefficients */ + + +{ + int i,j; + float xout1,xout2,xin1,xin2; + float *pw,*n1,*n2,*n3,*n4 = 0; + int m = lpcrdr/2; + float freq[LSP_MAX_ORDER]; + float Wp[(LSP_MAX_ORDER * 4) + 2]; + + /* convert from radians to the x=cos(w) domain */ + + for(i=0; i<lpcrdr; i++) + freq[i] = cos(lsp[i]); + + pw = Wp; + + /* initialise contents of array */ + + for(i=0;i<=4*m+1;i++){ /* set contents of buffer to 0 */ + *pw++ = 0.0; + } + + /* Set pointers up */ + + pw = Wp; + xin1 = 1.0; + xin2 = 1.0; + + /* reconstruct P(z) and Q(z) by cascading second order polynomials + in form 1 - 2xz(-1) +z(-2), where x is the LSP coefficient */ + + for(j=0;j<=lpcrdr;j++){ + for(i=0;i<m;i++){ + n1 = pw+(i*4); + n2 = n1 + 1; + n3 = n2 + 1; + n4 = n3 + 1; + xout1 = xin1 - 2*(freq[2*i]) * *n1 + *n2; + xout2 = xin2 - 2*(freq[2*i+1]) * *n3 + *n4; + *n2 = *n1; + *n4 = *n3; + *n1 = xin1; + *n3 = xin2; + xin1 = xout1; + xin2 = xout2; + } + xout1 = xin1 + *(n4+1); + xout2 = xin2 - *(n4+2); + ak[j] = (xout1 + xout2)*0.5; + *(n4+1) = xin1; + *(n4+2) = xin2; + + xin1 = 0.0; + xin2 = 0.0; + } +} + diff --git a/gr-vocoder/lib/codec2/lsp.h b/gr-vocoder/lib/codec2/lsp.h new file mode 100644 index 000000000..5acef0184 --- /dev/null +++ b/gr-vocoder/lib/codec2/lsp.h @@ -0,0 +1,37 @@ +/*---------------------------------------------------------------------------*\ + + FILE........: lsp.c + AUTHOR......: David Rowe + DATE CREATED: 24/2/93 + + + This file contains functions for LPC to LSP conversion and LSP to + LPC conversion. Note that the LSP coefficients are not in radians + format but in the x domain of the unit circle. + +\*---------------------------------------------------------------------------*/ + +/* + 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 __LSP__ +#define __LSP__ + +int lpc_to_lsp (float *a, int lpcrdr, float *freq, int nb, float delta); +void lsp_to_lpc(float *freq, float *ak, int lpcrdr); + +#endif diff --git a/gr-vocoder/lib/codec2/nlp.c b/gr-vocoder/lib/codec2/nlp.c new file mode 100644 index 000000000..42ae90919 --- /dev/null +++ b/gr-vocoder/lib/codec2/nlp.c @@ -0,0 +1,364 @@ +/*---------------------------------------------------------------------------*\ + + FILE........: nlp.c + AUTHOR......: David Rowe + DATE CREATED: 23/3/93 + + Non Linear Pitch (NLP) estimation 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/>. +*/ + +#include "defines.h" +#include "nlp.h" +#include "dump.h" +#include "fft.h" + +#include <assert.h> +#include <math.h> +#include <stdlib.h> + +/*---------------------------------------------------------------------------*\ + + DEFINES + +\*---------------------------------------------------------------------------*/ + +#define PMAX_M 600 /* maximum NLP analysis window size */ +#define COEFF 0.95 /* notch filter parameter */ +#define PE_FFT_SIZE 512 /* DFT size for pitch estimation */ +#define DEC 5 /* decimation factor */ +#define SAMPLE_RATE 8000 +#define PI 3.141592654 /* mathematical constant */ +#define T 0.1 /* threshold for local minima candidate */ +#define F0_MAX 500 +#define CNLP 0.3 /* post processor constant */ +#define NLP_NTAP 48 /* Decimation LPF order */ + +/*---------------------------------------------------------------------------*\ + + GLOBALS + +\*---------------------------------------------------------------------------*/ + +/* 48 tap 600Hz low pass FIR filter coefficients */ + +const float nlp_fir[] = { + -1.0818124e-03, + -1.1008344e-03, + -9.2768838e-04, + -4.2289438e-04, + 5.5034190e-04, + 2.0029849e-03, + 3.7058509e-03, + 5.1449415e-03, + 5.5924666e-03, + 4.3036754e-03, + 8.0284511e-04, + -4.8204610e-03, + -1.1705810e-02, + -1.8199275e-02, + -2.2065282e-02, + -2.0920610e-02, + -1.2808831e-02, + 3.2204775e-03, + 2.6683811e-02, + 5.5520624e-02, + 8.6305944e-02, + 1.1480192e-01, + 1.3674206e-01, + 1.4867556e-01, + 1.4867556e-01, + 1.3674206e-01, + 1.1480192e-01, + 8.6305944e-02, + 5.5520624e-02, + 2.6683811e-02, + 3.2204775e-03, + -1.2808831e-02, + -2.0920610e-02, + -2.2065282e-02, + -1.8199275e-02, + -1.1705810e-02, + -4.8204610e-03, + 8.0284511e-04, + 4.3036754e-03, + 5.5924666e-03, + 5.1449415e-03, + 3.7058509e-03, + 2.0029849e-03, + 5.5034190e-04, + -4.2289438e-04, + -9.2768838e-04, + -1.1008344e-03, + -1.0818124e-03 +}; + +typedef struct { + float sq[PMAX_M]; /* squared speech samples */ + float mem_x,mem_y; /* memory for notch filter */ + float mem_fir[NLP_NTAP]; /* decimation FIR filter memory */ +} NLP; + +float post_process_mbe(COMP Fw[], int pmin, int pmax, float gmax); +float post_process_sub_multiples(COMP Fw[], + int pmin, int pmax, float gmax, int gmax_bin, + float *prev_Wo); + +/*---------------------------------------------------------------------------*\ + + nlp_create() + + Initialisation function for NLP pitch estimator. + +\*---------------------------------------------------------------------------*/ + +void *nlp_create() +{ + NLP *nlp; + int i; + + nlp = (NLP*)malloc(sizeof(NLP)); + if (nlp == NULL) + return NULL; + + for(i=0; i<PMAX_M; i++) + nlp->sq[i] = 0.0; + nlp->mem_x = 0.0; + nlp->mem_y = 0.0; + for(i=0; i<NLP_NTAP; i++) + nlp->mem_fir[i] = 0.0; + + return (void*)nlp; +} + +/*---------------------------------------------------------------------------*\ + + nlp_destory() + + Initialisation function for NLP pitch estimator. + +\*---------------------------------------------------------------------------*/ + +void nlp_destroy(void *nlp_state) +{ + assert(nlp_state != NULL); + free(nlp_state); +} + +/*---------------------------------------------------------------------------*\ + + nlp() + + Determines the pitch in samples using the Non Linear Pitch (NLP) + algorithm [1]. Returns the fundamental in Hz. Note that the actual + pitch estimate is for the centre of the M sample Sn[] vector, not + the current N sample input vector. This is (I think) a delay of 2.5 + frames with N=80 samples. You should align further analysis using + this pitch estimate to be centred on the middle of Sn[]. + + Two post processors have been tried, the MBE version (as discussed + in [1]), and a post processor that checks sub-multiples. Both + suffer occasional gross pitch errors (i.e. neither are perfect). In + the presence of background noise the sub-multiple algorithm tends + towards low F0 which leads to better sounding background noise than + the MBE post processor. + + A good way to test and develop the NLP pitch estimator is using the + tnlp (codec2/unittest) and the codec2/octave/plnlp.m Octave script. + + A pitch tracker searching a few frames forward and backward in time + would be a useful addition. + + References: + + [1] http://www.itr.unisa.edu.au/~steven/thesis/dgr.pdf Chapter 4 + +\*---------------------------------------------------------------------------*/ + +float nlp( + void *nlp_state, + float Sn[], /* input speech vector */ + int n, /* frames shift (no. new samples in Sn[]) */ + int m, /* analysis window size */ + int pmin, /* minimum pitch value */ + int pmax, /* maximum pitch value */ + float *pitch, /* estimated pitch period in samples */ + COMP Sw[], /* Freq domain version of Sn[] */ + float *prev_Wo +) +{ + NLP *nlp; + float notch; /* current notch filter output */ + COMP Fw[PE_FFT_SIZE]; /* DFT of squared signal */ + float gmax; + int gmax_bin; + int i,j; + float best_f0; + + assert(nlp_state != NULL); + nlp = (NLP*)nlp_state; + + /* Square, notch filter at DC, and LP filter vector */ + + for(i=m-n; i<M; i++) /* square latest speech samples */ + nlp->sq[i] = Sn[i]*Sn[i]; + + for(i=m-n; i<m; i++) { /* notch filter at DC */ + notch = nlp->sq[i] - nlp->mem_x; + notch += COEFF*nlp->mem_y; + nlp->mem_x = nlp->sq[i]; + nlp->mem_y = notch; + nlp->sq[i] = notch; + } + + for(i=m-n; i<m; i++) { /* FIR filter vector */ + + for(j=0; j<NLP_NTAP-1; j++) + nlp->mem_fir[j] = nlp->mem_fir[j+1]; + nlp->mem_fir[NLP_NTAP-1] = nlp->sq[i]; + + nlp->sq[i] = 0.0; + for(j=0; j<NLP_NTAP; j++) + nlp->sq[i] += nlp->mem_fir[j]*nlp_fir[j]; + } + + /* Decimate and DFT */ + + for(i=0; i<PE_FFT_SIZE; i++) { + Fw[i].real = 0.0; + Fw[i].imag = 0.0; + } + for(i=0; i<m/DEC; i++) { + Fw[i].real = nlp->sq[i*DEC]*(0.5 - 0.5*cos(2*PI*i/(m/DEC-1))); + } +#ifdef DUMP + dump_dec(Fw); +#endif + fft(&Fw[0].real,PE_FFT_SIZE,1); + for(i=0; i<PE_FFT_SIZE; i++) + Fw[i].real = Fw[i].real*Fw[i].real + Fw[i].imag*Fw[i].imag; + +#ifdef DUMP + dump_sq(nlp->sq); + dump_Fw(Fw); +#endif + + /* find global peak */ + + gmax = 0.0; + gmax_bin = PE_FFT_SIZE*DEC/pmax; + for(i=PE_FFT_SIZE*DEC/pmax; i<=PE_FFT_SIZE*DEC/pmin; i++) { + if (Fw[i].real > gmax) { + gmax = Fw[i].real; + gmax_bin = i; + } + } + + best_f0 = post_process_sub_multiples(Fw, pmin, pmax, gmax, gmax_bin, + prev_Wo); + + /* Shift samples in buffer to make room for new samples */ + + for(i=0; i<m-n; i++) + nlp->sq[i] = nlp->sq[i+n]; + + /* return pitch and F0 estimate */ + + *pitch = (float)SAMPLE_RATE/best_f0; + return(best_f0); +} + +/*---------------------------------------------------------------------------*\ + + post_process_sub_multiples() + + Given the global maximma of Fw[] we search interger submultiples for + local maxima. If local maxima exist and they are above an + experimentally derived threshold (OK a magic number I pulled out of + the air) we choose the submultiple as the F0 estimate. + + The rational for this is that the lowest frequency peak of Fw[] + should be F0, as Fw[] can be considered the autocorrelation function + of Sw[] (the speech spectrum). However sometimes due to phase + effects the lowest frequency maxima may not be the global maxima. + + This works OK in practice and favours low F0 values in the presence + of background noise which means the sinusoidal codec does an OK job + of synthesising the background noise. High F0 in background noise + tends to sound more periodic introducing annoying artifacts. + +\*---------------------------------------------------------------------------*/ + +float post_process_sub_multiples(COMP Fw[], + int pmin, int pmax, float gmax, int gmax_bin, + float *prev_Wo) +{ + int min_bin, cmax_bin; + int mult; + float thresh, best_f0; + int b, bmin, bmax, lmax_bin; + float lmax, cmax; + int prev_f0_bin; + + /* post process estimate by searching submultiples */ + + mult = 2; + min_bin = PE_FFT_SIZE*DEC/pmax; + cmax_bin = gmax_bin; + prev_f0_bin = *prev_Wo*(4000.0/PI)*(PE_FFT_SIZE*DEC)/SAMPLE_RATE; + + while(gmax_bin/mult >= min_bin) { + + b = gmax_bin/mult; /* determine search interval */ + bmin = 0.8*b; + bmax = 1.2*b; + if (bmin < min_bin) + bmin = min_bin; + + /* lower threshold to favour previous frames pitch estimate, + this is a form of pitch tracking */ + + if ((prev_f0_bin > bmin) && (prev_f0_bin < bmax)) + thresh = CNLP*0.5*gmax; + else + thresh = CNLP*gmax; + + lmax = 0; + lmax_bin = bmin; + for (b=bmin; b<=bmax; b++) /* look for maximum in interval */ + if (Fw[b].real > lmax) { + lmax = Fw[b].real; + lmax_bin = b; + } + + if (lmax > thresh) + if ((lmax > Fw[lmax_bin-1].real) && (lmax > Fw[lmax_bin+1].real)) { + cmax = lmax; + cmax_bin = lmax_bin; + } + + mult++; + } + + best_f0 = (float)cmax_bin*SAMPLE_RATE/(PE_FFT_SIZE*DEC); + + return best_f0; +} + diff --git a/gr-vocoder/lib/codec2/nlp.h b/gr-vocoder/lib/codec2/nlp.h new file mode 100644 index 000000000..88a3733dc --- /dev/null +++ b/gr-vocoder/lib/codec2/nlp.h @@ -0,0 +1,39 @@ +/*---------------------------------------------------------------------------*\ + + FILE........: nlp.c + AUTHOR......: David Rowe + DATE CREATED: 23/3/93 + + Non Linear Pitch (NLP) estimation 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 __NLP__ +#define __NLP__ + +#include "comp.h" + +void *nlp_create(); +void nlp_destroy(void *nlp_state); +float nlp(void *nlp_state, float Sn[], int n, int m, int pmin, int pmax, + float *pitch, COMP Sw[], float *prev_Wo); +float test_candidate_mbe(COMP Sw[], float f0, COMP Sw_[]); + +#endif diff --git a/gr-vocoder/lib/codec2/pack.c b/gr-vocoder/lib/codec2/pack.c new file mode 100644 index 000000000..31551dfc4 --- /dev/null +++ b/gr-vocoder/lib/codec2/pack.c @@ -0,0 +1,105 @@ +/* + Copyright (C) 2010 Perens LLC <bruce@perens.com> + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + 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 General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + + */ +#include "defines.h" +#include "quantise.h" +#include <stdio.h> + +/* Compile-time constants */ +/* Size of unsigned char in bits. Assumes 8 bits-per-char. */ +static const unsigned int WordSize = 8; + +/* Mask to pick the bit component out of bitIndex. */ +static const unsigned int IndexMask = 0x7; + +/* Used to pick the word component out of bitIndex. */ +static const unsigned int ShiftRight = 3; + +/** Pack a bit field into a bit string, encoding the field in Gray code. + * + * The output is an array of unsigned char data. The fields are efficiently + * packed into the bit string. The Gray coding is a naive attempt to reduce + * the effect of single-bit errors, we expect to do a better job as the + * codec develops. + * + * This code would be simpler if it just set one bit at a time in the string, + * but would hit the same cache line more often. I'm not sure the complexity + * gains us anything here. + * + * Although field is currently of int type rather than unsigned for + * compatibility with the rest of the code, indices are always expected to + * be >= 0. + */ +void +pack( + unsigned char * bitArray, /* The output bit string. */ + unsigned int * bitIndex, /* Index into the string in BITS, not bytes.*/ + int field, /* The bit field to be packed. */ + unsigned int fieldWidth/* Width of the field in BITS, not bytes. */ + ) +{ + /* Convert the field to Gray code */ + field = (field >> 1) ^ field; + + do { + unsigned int bI = *bitIndex; + unsigned int bitsLeft = WordSize - (bI & IndexMask); + unsigned int sliceWidth = + bitsLeft < fieldWidth ? bitsLeft : fieldWidth; + unsigned int wordIndex = bI >> ShiftRight; + + bitArray[wordIndex] |= + ((unsigned char)((field >> (fieldWidth - sliceWidth)) + << (bitsLeft - sliceWidth))); + + *bitIndex = bI + sliceWidth; + fieldWidth -= sliceWidth; + } while ( fieldWidth != 0 ); +} + +/** Unpack a field from a bit string, converting from Gray code to binary. + * + */ +int +unpack( + const unsigned char * bitArray, /* The input bit string. */ + unsigned int * bitIndex, /* Index into the string in BITS, not bytes.*/ + unsigned int fieldWidth/* Width of the field in BITS, not bytes. */ + ) +{ + unsigned int field = 0; + unsigned int t; + + do { + unsigned int bI = *bitIndex; + unsigned int bitsLeft = WordSize - (bI & IndexMask); + unsigned int sliceWidth = + bitsLeft < fieldWidth ? bitsLeft : fieldWidth; + + field |= (((bitArray[bI >> ShiftRight] >> (bitsLeft - sliceWidth)) & ((1 << sliceWidth) - 1)) << (fieldWidth - sliceWidth)); + + *bitIndex = bI + sliceWidth; + fieldWidth -= sliceWidth; + } while ( fieldWidth != 0 ); + + /* Convert from Gray code to binary. Works for maximum 8-bit fields. */ + t = field ^ (field >> 8); + t ^= (t >> 4); + t ^= (t >> 2); + t ^= (t >> 1); + return t; +} diff --git a/gr-vocoder/lib/codec2/phase.c b/gr-vocoder/lib/codec2/phase.c new file mode 100644 index 000000000..0e1a14a60 --- /dev/null +++ b/gr-vocoder/lib/codec2/phase.c @@ -0,0 +1,262 @@ +/*---------------------------------------------------------------------------*\ + + FILE........: phase.c + AUTHOR......: David Rowe + DATE CREATED: 1/2/09 + + Functions for modelling and synthesising phase. + +\*---------------------------------------------------------------------------*/ + +/* + 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/>. +*/ + +#include "defines.h" +#include "phase.h" +#include "fft.h" +#include "comp.h" +#include "glottal.c" + +#include <assert.h> +#include <math.h> +#include <string.h> +#include <stdlib.h> + +#define GLOTTAL_FFT_SIZE 512 + +/*---------------------------------------------------------------------------*\ + + aks_to_H() + + Samples the complex LPC synthesis filter spectrum at the harmonic + frequencies. + +\*---------------------------------------------------------------------------*/ + +void aks_to_H( + MODEL *model, /* model parameters */ + float aks[], /* LPC's */ + float G, /* energy term */ + COMP H[], /* complex LPC spectral samples */ + int order +) +{ + COMP Pw[FFT_DEC]; /* power spectrum */ + int i,m; /* loop variables */ + int am,bm; /* limits of current band */ + float r; /* no. rads/bin */ + float Em; /* energy in band */ + float Am; /* spectral amplitude sample */ + int b; /* centre bin of harmonic */ + float phi_; /* phase of LPC spectra */ + + r = TWO_PI/(FFT_DEC); + + /* Determine DFT of A(exp(jw)) ------------------------------------------*/ + + for(i=0; i<FFT_DEC; i++) { + Pw[i].real = 0.0; + Pw[i].imag = 0.0; + } + + for(i=0; i<=order; i++) + Pw[i].real = aks[i]; + + fft(&Pw[0].real,FFT_DEC,-1); + + /* Sample magnitude and phase at harmonics */ + + for(m=1; m<=model->L; m++) { + am = floor((m - 0.5)*model->Wo/r + 0.5); + bm = floor((m + 0.5)*model->Wo/r + 0.5); + b = floor(m*model->Wo/r + 0.5); + + Em = 0.0; + for(i=am; i<bm; i++) + Em += G/(Pw[i].real*Pw[i].real + Pw[i].imag*Pw[i].imag); + Am = sqrt(fabs(Em/(bm-am))); + + phi_ = -atan2(Pw[b].imag,Pw[b].real); + H[m].real = Am*cos(phi_); + H[m].imag = Am*sin(phi_); + } +} + + +/*---------------------------------------------------------------------------*\ + + phase_synth_zero_order() + + Synthesises phases based on SNR and a rule based approach. No phase + parameters are required apart from the SNR (which can be reduced to a + 1 bit V/UV decision per frame). + + The phase of each harmonic is modelled as the phase of a LPC + synthesis filter excited by an impulse. Unlike the first order + model the position of the impulse is not transmitted, so we create + an excitation pulse train using a rule based approach. + + Consider a pulse train with a pulse starting time n=0, with pulses + repeated at a rate of Wo, the fundamental frequency. A pulse train + in the time domain is equivalent to harmonics in the frequency + domain. We can make an excitation pulse train using a sum of + sinsusoids: + + for(m=1; m<=L; m++) + ex[n] = cos(m*Wo*n) + + Note: the Octave script ../octave/phase.m is an example of this if + you would like to try making a pulse train. + + The phase of each excitation harmonic is: + + arg(E[m]) = mWo + + where E[m] are the complex excitation (freq domain) samples, + arg(x), just returns the phase of a complex sample x. + + As we don't transmit the pulse position for this model, we need to + synthesise it. Now the excitation pulses occur at a rate of Wo. + This means the phase of the first harmonic advances by N samples + over a synthesis frame of N samples. For example if Wo is pi/20 + (200 Hz), then over a 10ms frame (N=80 samples), the phase of the + first harmonic would advance (pi/20)*80 = 4*pi or two complete + cycles. + + We generate the excitation phase of the fundamental (first + harmonic): + + arg[E[1]] = Wo*N; + + We then relate the phase of the m-th excitation harmonic to the + phase of the fundamental as: + + arg(E[m]) = m*arg(E[1]) + + This E[m] then gets passed through the LPC synthesis filter to + determine the final harmonic phase. + + Comparing to speech synthesised using original phases: + + - Through headphones speech synthesised with this model is not as + good. Through a loudspeaker it is very close to original phases. + + - If there are voicing errors, the speech can sound clicky or + staticy. If V speech is mistakenly declared UV, this model tends to + synthesise impulses or clicks, as there is usually very little shift or + dispersion through the LPC filter. + + - When combined with LPC amplitude modelling there is an additional + drop in quality. I am not sure why, theory is interformant energy + is raised making any phase errors more obvious. + + NOTES: + + 1/ This synthesis model is effectively the same as a simple LPC-10 + vocoders, and yet sounds much better. Why? Conventional wisdom + (AMBE, MELP) says mixed voicing is required for high quality + speech. + + 2/ I am pretty sure the Lincoln Lab sinusoidal coding guys (like xMBE + also from MIT) first described this zero phase model, I need to look + up the paper. + + 3/ Note that this approach could cause some discontinuities in + the phase at the edge of synthesis frames, as no attempt is made + to make sure that the phase tracks are continuous (the excitation + phases are continuous, but not the final phases after filtering + by the LPC spectra). Technically this is a bad thing. However + this may actually be a good thing, disturbing the phase tracks a + bit. More research needed, e.g. test a synthesis model that adds + a small delta-W to make phase tracks line up for voiced + harmonics. + +\*---------------------------------------------------------------------------*/ + +void phase_synth_zero_order( + MODEL *model, + float aks[], + float *ex_phase, /* excitation phase of fundamental */ + int order +) +{ + int m; + float new_phi; + COMP Ex[MAX_AMP]; /* excitation samples */ + COMP A_[MAX_AMP]; /* synthesised harmonic samples */ + COMP H[MAX_AMP]; /* LPC freq domain samples */ + float G; + float jitter = 0.0; + float r; + int b; + + G = 1.0; + aks_to_H(model, aks, G, H, order); + + /* + Update excitation fundamental phase track, this sets the position + of each pitch pulse during voiced speech. After much experiment + I found that using just this frame's Wo improved quality for UV + sounds compared to interpolating two frames Wo like this: + + ex_phase[0] += (*prev_Wo+mode->Wo)*N/2; + */ + + ex_phase[0] += (model->Wo)*N; + ex_phase[0] -= TWO_PI*floor(ex_phase[0]/TWO_PI + 0.5); + r = TWO_PI/GLOTTAL_FFT_SIZE; + + for(m=1; m<=model->L; m++) { + + /* generate excitation */ + + if (model->voiced) { + /* I think adding a little jitter helps improve low pitch + males like hts1a. This moves the onset of each harmonic + over at +/- 0.25 of a sample. + */ + jitter = 0.25*(1.0 - 2.0*rand()/RAND_MAX); + b = floor(m*model->Wo/r + 0.5); + if (b > ((GLOTTAL_FFT_SIZE/2)-1)) { + b = (GLOTTAL_FFT_SIZE/2)-1; + } + Ex[m].real = cos(ex_phase[0]*m - jitter*model->Wo*m + glottal[b]); + Ex[m].imag = sin(ex_phase[0]*m - jitter*model->Wo*m + glottal[b]); + } + else { + + /* When a few samples were tested I found that LPC filter + phase is not needed in the unvoiced case, but no harm in + keeping it. + */ + float phi = TWO_PI*(float)rand()/RAND_MAX; + Ex[m].real = cos(phi); + Ex[m].imag = sin(phi); + } + + /* filter using LPC filter */ + + A_[m].real = H[m].real*Ex[m].real - H[m].imag*Ex[m].imag; + A_[m].imag = H[m].imag*Ex[m].real + H[m].real*Ex[m].imag; + + /* modify sinusoidal phase */ + + new_phi = atan2(A_[m].imag, A_[m].real+1E-12); + model->phi[m] = new_phi; + } + +} diff --git a/gr-vocoder/lib/codec2/phase.h b/gr-vocoder/lib/codec2/phase.h new file mode 100644 index 000000000..833bc7cdc --- /dev/null +++ b/gr-vocoder/lib/codec2/phase.h @@ -0,0 +1,34 @@ +/*---------------------------------------------------------------------------*\ + + FILE........: phase.h + AUTHOR......: David Rowe + DATE CREATED: 1/2/09 + + Functions for modelling phase. + +\*---------------------------------------------------------------------------*/ + +/* + 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 __PHASE__ +#define __PHASE__ + +void phase_synth_zero_order(MODEL *model, float aks[], float *ex_phase, + int order); + +#endif diff --git a/gr-vocoder/lib/codec2/postfilter.c b/gr-vocoder/lib/codec2/postfilter.c new file mode 100644 index 000000000..6e17eeb87 --- /dev/null +++ b/gr-vocoder/lib/codec2/postfilter.c @@ -0,0 +1,133 @@ +/*---------------------------------------------------------------------------*\ + + FILE........: postfilter.c + AUTHOR......: David Rowe + DATE CREATED: 13/09/09 + + Postfilter to improve sound quality for speech with high levels of + background noise. Unlike mixed-excitation models requires no bits + to be transmitted to handle background noise. + +\*---------------------------------------------------------------------------*/ + +/* + 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/>. +*/ + +#include <stdlib.h> +#include <stdio.h> +#include <math.h> + +#include "defines.h" +#include "comp.h" +#include "dump.h" +#include "postfilter.h" + +/*---------------------------------------------------------------------------*\ + + DEFINES + +\*---------------------------------------------------------------------------*/ + +#define BG_THRESH 40.0 /* only consider low levels signals for bg_est */ +#define BG_BETA 0.1 /* averaging filter constant */ + +/*---------------------------------------------------------------------------*\ + + postfilter() + + The post filter is designed to help with speech corrupted by + background noise. The zero phase model tends to make speech with + background noise sound "clicky". With high levels of background + noise the low level inter-formant parts of the spectrum will contain + noise rather than speech harmonics, so modelling them as voiced + (i.e. a continuous, non-random phase track) is inaccurate. + + Some codecs (like MBE) have a mixed voicing model that breaks the + spectrum into voiced and unvoiced regions. Several bits/frame + (5-12) are required to transmit the frequency selective voicing + information. Mixed excitation also requires accurate voicing + estimation (parameter estimators always break occasionally under + exceptional condition). + + In our case we use a post filter approach which requires no + additional bits to be transmitted. The decoder measures the average + level of the background noise during unvoiced frames. If a harmonic + is less than this level it is made unvoiced by randomising it's + phases. + + This idea is rather experimental. Some potential problems that may + happen: + + 1/ If someone says "aaaaaaaahhhhhhhhh" will background estimator track + up to speech level? This would be a bad thing. + + 2/ If background noise suddenly dissapears from the source speech does + estimate drop quickly? What is noise suddenly re-appears? + + 3/ Background noise with a non-flat sepctrum. Current algorithm just + comsiders scpetrum as a whole, but this could be broken up into + bands, each with their own estimator. + + 4/ Males and females with the same level of background noise. Check + performance the same. Changing Wo affects width of each band, may + affect bg energy estimates. + + 5/ Not sure what happens during long periods of voiced speech + e.g. "sshhhhhhh" + +\*---------------------------------------------------------------------------*/ + +void postfilter( + MODEL *model, + float *bg_est +) +{ + int m, uv; + float e; + + /* determine average energy across spectrum */ + + e = 0.0; + for(m=1; m<=model->L; m++) + e += model->A[m]*model->A[m]; + + e = 10.0*log10(e/model->L); + + /* If beneath threhold, update bg estimate. The idea + of the threshold is to prevent updating during high level + speech. */ + + if ((e < BG_THRESH) && !model->voiced) + *bg_est = *bg_est*(1.0 - BG_BETA) + e*BG_BETA; + + /* now mess with phases during voiced frames to make any harmonics + less then our background estimate unvoiced. + */ + + uv = 0; + if (model->voiced) + for(m=1; m<=model->L; m++) + if (20.0*log10(model->A[m]) < *bg_est) { + model->phi[m] = TWO_PI*(float)rand()/RAND_MAX; + uv++; + } + +#ifdef DUMP + dump_bg(e, *bg_est, 100.0*uv/model->L); +#endif + +} diff --git a/gr-vocoder/lib/codec2/postfilter.h b/gr-vocoder/lib/codec2/postfilter.h new file mode 100644 index 000000000..bf080b1b6 --- /dev/null +++ b/gr-vocoder/lib/codec2/postfilter.h @@ -0,0 +1,33 @@ +/*---------------------------------------------------------------------------*\ + + FILE........: postfilter.h + AUTHOR......: David Rowe + DATE CREATED: 13/09/09 + + Postfilter header file. + +\*---------------------------------------------------------------------------*/ + +/* + 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 __POSTFILTER__ +#define __POSTFILTER__ + +void postfilter(MODEL *model, float *bg_est); + +#endif diff --git a/gr-vocoder/lib/codec2/quantise.c b/gr-vocoder/lib/codec2/quantise.c new file mode 100644 index 000000000..ff8d156b5 --- /dev/null +++ b/gr-vocoder/lib/codec2/quantise.c @@ -0,0 +1,851 @@ +/*---------------------------------------------------------------------------*\ + + FILE........: quantise.c + AUTHOR......: David Rowe + DATE CREATED: 31/5/92 + + Quantisation functions for the sinusoidal coder. + +\*---------------------------------------------------------------------------*/ + +/* + 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/>. + +*/ + +#include <assert.h> +#include <ctype.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <math.h> + +#include "defines.h" +#include "dump.h" +#include "quantise.h" +#include "lpc.h" +#include "lsp.h" +#include "fft.h" + +#define LSP_DELTA1 0.01 /* grid spacing for LSP root searches */ + +/*---------------------------------------------------------------------------*\ + + FUNCTION HEADERS + +\*---------------------------------------------------------------------------*/ + +float speech_to_uq_lsps(float lsp[], float ak[], float Sn[], float w[], + int order); + +/*---------------------------------------------------------------------------*\ + + FUNCTIONS + +\*---------------------------------------------------------------------------*/ + +int lsp_bits(int i) { + return lsp_cb[i].log2m; +} + +#if VECTOR_QUANTISATION +/*---------------------------------------------------------------------------*\ + + quantise_uniform + + Simulates uniform quantising of a float. + +\*---------------------------------------------------------------------------*/ + +void quantise_uniform(float *val, float min, float max, int bits) +{ + int levels = 1 << (bits-1); + float norm; + int index; + + /* hard limit to quantiser range */ + + printf("min: %f max: %f val: %f ", min, max, val[0]); + if (val[0] < min) val[0] = min; + if (val[0] > max) val[0] = max; + + norm = (*val - min)/(max-min); + printf("%f norm: %f ", val[0], norm); + index = fabs(levels*norm + 0.5); + + *val = min + index*(max-min)/levels; + + printf("index %d val_: %f\n", index, val[0]); +} + +#endif + +/*---------------------------------------------------------------------------*\ + + quantise_init + + Loads the entire LSP quantiser comprised of several vector quantisers + (codebooks). + +\*---------------------------------------------------------------------------*/ + +void quantise_init() +{ +} + +/*---------------------------------------------------------------------------*\ + + quantise + + Quantises vec by choosing the nearest vector in codebook cb, and + returns the vector index. The squared error of the quantised vector + is added to se. + +\*---------------------------------------------------------------------------*/ + +long quantise(const float * cb, float vec[], float w[], int k, int m, float *se) +/* float cb[][K]; current VQ codebook */ +/* float vec[]; vector to quantise */ +/* float w[]; weighting vector */ +/* int k; dimension of vectors */ +/* int m; size of codebook */ +/* float *se; accumulated squared error */ +{ + float e; /* current error */ + long besti; /* best index so far */ + float beste; /* best error so far */ + long j; + int i; + + besti = 0; + beste = 1E32; + for(j=0; j<m; j++) { + e = 0.0; + for(i=0; i<k; i++) + e += pow((cb[j*k+i]-vec[i])*w[i],2.0); + if (e < beste) { + beste = e; + besti = j; + } + } + + *se += beste; + + return(besti); +} + +/*---------------------------------------------------------------------------*\ + + lspd_quantise + + Scalar lsp difference quantiser. + +\*---------------------------------------------------------------------------*/ + +void lspd_quantise( + float lsp[], + float lsp_[], + int order +) +{ + int i,k,m; + float lsp_hz[LPC_MAX]; + float lsp__hz[LPC_MAX]; + float dlsp[LPC_MAX]; + float dlsp_[LPC_MAX]; + float wt[1]; + const float *cb; + float se; + int indexes[LPC_MAX]; + + /* convert from radians to Hz so we can use human readable + frequencies */ + + for(i=0; i<order; i++) + lsp_hz[i] = (4000.0/PI)*lsp[i]; + + dlsp[0] = lsp_hz[0]; + for(i=1; i<order; i++) + dlsp[i] = lsp_hz[i] - lsp_hz[i-1]; + + /* simple uniform scalar quantisers */ + + wt[0] = 1.0; + for(i=0; i<order; i++) { + if (i) + dlsp[i] = lsp_hz[i] - lsp__hz[i-1]; + else + dlsp[0] = lsp_hz[0]; + + k = lsp_cbd[i].k; + m = lsp_cbd[i].m; + cb = lsp_cbd[i].cb; + indexes[i] = quantise(cb, &dlsp[i], wt, k, m, &se); + dlsp_[i] = cb[indexes[i]*k]; + + if (i) + lsp__hz[i] = lsp__hz[i-1] + dlsp_[i]; + else + lsp__hz[0] = dlsp_[0]; + } + for(; i<order; i++) + lsp__hz[i] = lsp__hz[i-1] + dlsp[i]; + + /* convert back to radians */ + + for(i=0; i<order; i++) + lsp_[i] = (PI/4000.0)*lsp__hz[i]; +} + +/*---------------------------------------------------------------------------*\ + + lspd_vq_quantise + + Vector lsp difference quantiser. + +\*---------------------------------------------------------------------------*/ + +void lspdvq_quantise( + float lsp[], + float lsp_[], + int order +) +{ + int i,k,m,ncb, nlsp; + float dlsp[LPC_MAX]; + float dlsp_[LPC_MAX]; + float wt[LPC_ORD]; + const float *cb; + float se; + int index; + + dlsp[0] = lsp[0]; + for(i=1; i<order; i++) + dlsp[i] = lsp[i] - lsp[i-1]; + + for(i=0; i<order; i++) + dlsp_[i] = dlsp[i]; + + for(i=0; i<order; i++) + wt[i] = 1.0; + + /* scalar quantise dLSPs 1,2,3,4,5 */ + + for(i=0; i<5; i++) { + if (i) + dlsp[i] = (lsp[i] - lsp_[i-1])*4000.0/PI; + else + dlsp[0] = lsp[0]*4000.0/PI; + + k = lsp_cbdvq[i].k; + m = lsp_cbdvq[i].m; + cb = lsp_cbdvq[i].cb; + index = quantise(cb, &dlsp[i], wt, k, m, &se); + dlsp_[i] = cb[index*k]*PI/4000.0; + + if (i) + lsp_[i] = lsp_[i-1] + dlsp_[i]; + else + lsp_[0] = dlsp_[0]; + } + dlsp[i] = lsp[i] - lsp_[i-1]; + dlsp_[i] = dlsp[i]; + + //printf("lsp[0] %f lsp_[0] %f\n", lsp[0], lsp_[0]); + //printf("lsp[1] %f lsp_[1] %f\n", lsp[1], lsp_[1]); + +#ifdef TT + /* VQ dLSPs 3,4,5 */ + + ncb = 2; + nlsp = 2; + k = lsp_cbdvq[ncb].k; + m = lsp_cbdvq[ncb].m; + cb = lsp_cbdvq[ncb].cb; + index = quantise(cb, &dlsp[nlsp], wt, k, m, &se); + dlsp_[nlsp] = cb[index*k]; + dlsp_[nlsp+1] = cb[index*k+1]; + dlsp_[nlsp+2] = cb[index*k+2]; + + lsp_[0] = dlsp_[0]; + for(i=1; i<5; i++) + lsp_[i] = lsp_[i-1] + dlsp_[i]; + dlsp[i] = lsp[i] - lsp_[i-1]; + dlsp_[i] = dlsp[i]; +#endif + /* VQ dLSPs 6,7,8,9,10 */ + + ncb = 5; + nlsp = 5; + k = lsp_cbdvq[ncb].k; + m = lsp_cbdvq[ncb].m; + cb = lsp_cbdvq[ncb].cb; + index = quantise(cb, &dlsp[nlsp], wt, k, m, &se); + dlsp_[nlsp] = cb[index*k]; + dlsp_[nlsp+1] = cb[index*k+1]; + dlsp_[nlsp+2] = cb[index*k+2]; + dlsp_[nlsp+3] = cb[index*k+3]; + dlsp_[nlsp+4] = cb[index*k+4]; + + /* rebuild LSPs for dLSPs */ + + lsp_[0] = dlsp_[0]; + for(i=1; i<order; i++) + lsp_[i] = lsp_[i-1] + dlsp_[i]; +} + +void check_lsp_order(float lsp[], int lpc_order) +{ + int i; + float tmp; + + for(i=1; i<lpc_order; i++) + if (lsp[i] < lsp[i-1]) { + printf("swap %d\n",i); + tmp = lsp[i-1]; + lsp[i-1] = lsp[i]-0.05; + lsp[i] = tmp+0.05; + } +} + +void force_min_lsp_dist(float lsp[], int lpc_order) +{ + int i; + + for(i=1; i<lpc_order; i++) + if ((lsp[i]-lsp[i-1]) < 0.01) { + lsp[i] += 0.01; + } +} + +/*---------------------------------------------------------------------------*\ + + lpc_model_amplitudes + + Derive a LPC model for amplitude samples then estimate amplitude samples + from this model with optional LSP quantisation. + + Returns the spectral distortion for this frame. + +\*---------------------------------------------------------------------------*/ + +float lpc_model_amplitudes( + float Sn[], /* Input frame of speech samples */ + float w[], + MODEL *model, /* sinusoidal model parameters */ + int order, /* LPC model order */ + int lsp_quant, /* optional LSP quantisation if non-zero */ + float ak[] /* output aks */ +) +{ + float Wn[M]; + float R[LPC_MAX+1]; + float E; + int i,j; + float snr; + float lsp[LPC_MAX]; + float lsp_hz[LPC_MAX]; + float lsp_[LPC_MAX]; + int roots; /* number of LSP roots found */ + int index; + float se; + int k,m; + const float * cb; + float wt[LPC_MAX]; + + for(i=0; i<M; i++) + Wn[i] = Sn[i]*w[i]; + autocorrelate(Wn,R,M,order); + levinson_durbin(R,ak,order); + + E = 0.0; + for(i=0; i<=order; i++) + E += ak[i]*R[i]; + + for(i=0; i<order; i++) + wt[i] = 1.0; + + if (lsp_quant) { + roots = lpc_to_lsp(ak, order, lsp, 5, LSP_DELTA1); + if (roots != order) + printf("LSP roots not found\n"); + + /* convert from radians to Hz to make quantisers more + human readable */ + + for(i=0; i<order; i++) + lsp_hz[i] = (4000.0/PI)*lsp[i]; + + /* simple uniform scalar quantisers */ + + for(i=0; i<10; i++) { + k = lsp_cb[i].k; + m = lsp_cb[i].m; + cb = lsp_cb[i].cb; + index = quantise(cb, &lsp_hz[i], wt, k, m, &se); + lsp_hz[i] = cb[index*k]; + } + + /* experiment: simulating uniform quantisation error + for(i=0; i<order; i++) + lsp[i] += PI*(12.5/4000.0)*(1.0 - 2.0*(float)rand()/RAND_MAX); + */ + + for(i=0; i<order; i++) + lsp[i] = (PI/4000.0)*lsp_hz[i]; + + /* Bandwidth Expansion (BW). Prevents any two LSPs getting too + close together after quantisation. We know from experiment + that LSP quantisation errors < 12.5Hz (25Hz setp size) are + inaudible so we use that as the minimum LSP separation. + */ + + for(i=1; i<5; i++) { + if (lsp[i] - lsp[i-1] < PI*(12.5/4000.0)) + lsp[i] = lsp[i-1] + PI*(12.5/4000.0); + } + + /* as quantiser gaps increased, larger BW expansion was required + to prevent twinkly noises */ + + for(i=5; i<8; i++) { + if (lsp[i] - lsp[i-1] < PI*(25.0/4000.0)) + lsp[i] = lsp[i-1] + PI*(25.0/4000.0); + } + for(i=8; i<order; i++) { + if (lsp[i] - lsp[i-1] < PI*(75.0/4000.0)) + lsp[i] = lsp[i-1] + PI*(75.0/4000.0); + } + + for(j=0; j<order; j++) + lsp_[j] = lsp[j]; + + lsp_to_lpc(lsp_, ak, order); +#ifdef DUMP + dump_lsp(lsp); +#endif + } + +#ifdef DUMP + dump_E(E); +#endif + #ifdef SIM_QUANT + /* simulated LPC energy quantisation */ + { + float e = 10.0*log10(E); + e += 2.0*(1.0 - 2.0*(float)rand()/RAND_MAX); + E = pow(10.0,e/10.0); + } + #endif + + aks_to_M2(ak,order,model,E,&snr, 1); /* {ak} -> {Am} LPC decode */ + + return snr; +} + +/*---------------------------------------------------------------------------*\ + + aks_to_M2() + + Transforms the linear prediction coefficients to spectral amplitude + samples. This function determines A(m) from the average energy per + band using an FFT. + +\*---------------------------------------------------------------------------*/ + +void aks_to_M2( + float ak[], /* LPC's */ + int order, + MODEL *model, /* sinusoidal model parameters for this frame */ + float E, /* energy term */ + float *snr, /* signal to noise ratio for this frame in dB */ + int dump /* true to dump sample to dump file */ +) +{ + COMP Pw[FFT_DEC]; /* power spectrum */ + int i,m; /* loop variables */ + int am,bm; /* limits of current band */ + float r; /* no. rads/bin */ + float Em; /* energy in band */ + float Am; /* spectral amplitude sample */ + float signal, noise; + + r = TWO_PI/(FFT_DEC); + + /* Determine DFT of A(exp(jw)) --------------------------------------------*/ + + for(i=0; i<FFT_DEC; i++) { + Pw[i].real = 0.0; + Pw[i].imag = 0.0; + } + + for(i=0; i<=order; i++) + Pw[i].real = ak[i]; + fft(&Pw[0].real,FFT_DEC,1); + + /* Determine power spectrum P(w) = E/(A(exp(jw))^2 ------------------------*/ + + for(i=0; i<FFT_DEC/2; i++) + Pw[i].real = E/(Pw[i].real*Pw[i].real + Pw[i].imag*Pw[i].imag); +#ifdef DUMP + if (dump) + dump_Pw(Pw); +#endif + + /* Determine magnitudes by linear interpolation of P(w) -------------------*/ + + signal = noise = 0.0; + for(m=1; m<=model->L; m++) { + am = floor((m - 0.5)*model->Wo/r + 0.5); + bm = floor((m + 0.5)*model->Wo/r + 0.5); + Em = 0.0; + + for(i=am; i<bm; i++) + Em += Pw[i].real; + Am = sqrt(Em); + + signal += pow(model->A[m],2.0); + noise += pow(model->A[m] - Am,2.0); + model->A[m] = Am; + } + *snr = 10.0*log10(signal/noise); +} + +/*---------------------------------------------------------------------------*\ + + FUNCTION....: encode_Wo() + AUTHOR......: David Rowe + DATE CREATED: 22/8/2010 + + Encodes Wo using a WO_LEVELS quantiser. + +\*---------------------------------------------------------------------------*/ + +int encode_Wo(float Wo) +{ + int index; + float Wo_min = TWO_PI/P_MAX; + float Wo_max = TWO_PI/P_MIN; + float norm; + + norm = (Wo - Wo_min)/(Wo_max - Wo_min); + index = floor(WO_LEVELS * norm + 0.5); + if (index < 0 ) index = 0; + if (index > (WO_LEVELS-1)) index = WO_LEVELS-1; + + return index; +} + +/*---------------------------------------------------------------------------*\ + + FUNCTION....: decode_Wo() + AUTHOR......: David Rowe + DATE CREATED: 22/8/2010 + + Decodes Wo using a WO_LEVELS quantiser. + +\*---------------------------------------------------------------------------*/ + +float decode_Wo(int index) +{ + float Wo_min = TWO_PI/P_MAX; + float Wo_max = TWO_PI/P_MIN; + float step; + float Wo; + + step = (Wo_max - Wo_min)/WO_LEVELS; + Wo = Wo_min + step*(index); + + return Wo; +} + +/*---------------------------------------------------------------------------*\ + + FUNCTION....: speech_to_uq_lsps() + AUTHOR......: David Rowe + DATE CREATED: 22/8/2010 + + Analyse a windowed frame of time domain speech to determine LPCs + which are the converted to LSPs for quantisation and transmission + over the channel. + +\*---------------------------------------------------------------------------*/ + +float speech_to_uq_lsps(float lsp[], + float ak[], + float Sn[], + float w[], + int order +) +{ + int i, roots; + float Wn[M]; + float R[LPC_MAX+1]; + float E; + + for(i=0; i<M; i++) + Wn[i] = Sn[i]*w[i]; + autocorrelate(Wn, R, M, order); + levinson_durbin(R, ak, order); + + E = 0.0; + for(i=0; i<=order; i++) + E += ak[i]*R[i]; + + roots = lpc_to_lsp(ak, order, lsp, 5, LSP_DELTA1); + if (roots != order) { + /* for some reason LSP roots could not be found */ + /* some alpha testers are reporting this condition */ + fprintf(stderr, "LSP roots not found!\nroots = %d\n", roots); + for(i=0; i<=order; i++) + fprintf(stderr, "a[%d] = %f\n", i, ak[i]); + + /* some benign LSP values we can use instead */ + for(i=0; i<order; i++) + lsp[i] = (PI/order)*(float)i; + } + + return E; +} + +/*---------------------------------------------------------------------------*\ + + FUNCTION....: encode_lsps() + AUTHOR......: David Rowe + DATE CREATED: 22/8/2010 + + From a vector of unquantised (floating point) LSPs finds the quantised + LSP indexes. + +\*---------------------------------------------------------------------------*/ + +void encode_lsps(int indexes[], float lsp[], int order) +{ + int i,k,m; + float wt[1]; + float lsp_hz[LPC_MAX]; + const float * cb; + float se; + + /* convert from radians to Hz so we can use human readable + frequencies */ + + for(i=0; i<order; i++) + lsp_hz[i] = (4000.0/PI)*lsp[i]; + + /* simple uniform scalar quantisers */ + + wt[0] = 1.0; + for(i=0; i<order; i++) { + k = lsp_cb[i].k; + m = lsp_cb[i].m; + cb = lsp_cb[i].cb; + indexes[i] = quantise(cb, &lsp_hz[i], wt, k, m, &se); + } +} + +/*---------------------------------------------------------------------------*\ + + FUNCTION....: decode_lsps() + AUTHOR......: David Rowe + DATE CREATED: 22/8/2010 + + From a vector of quantised LSP indexes, returns the quantised + (floating point) LSPs. + +\*---------------------------------------------------------------------------*/ + +void decode_lsps(float lsp[], int indexes[], int order) +{ + int i,k; + float lsp_hz[LPC_MAX]; + const float * cb; + + for(i=0; i<order; i++) { + k = lsp_cb[i].k; + cb = lsp_cb[i].cb; + lsp_hz[i] = cb[indexes[i]*k]; + } + + /* convert back to radians */ + + for(i=0; i<order; i++) + lsp[i] = (PI/4000.0)*lsp_hz[i]; +} + +/*---------------------------------------------------------------------------*\ + + FUNCTION....: bw_expand_lsps() + AUTHOR......: David Rowe + DATE CREATED: 22/8/2010 + + Applies Bandwidth Expansion (BW) to a vector of LSPs. Prevents any + two LSPs getting too close together after quantisation. We know + from experiment that LSP quantisation errors < 12.5Hz (25Hz setp + size) are inaudible so we use that as the minimum LSP separation. + +\*---------------------------------------------------------------------------*/ + +void bw_expand_lsps(float lsp[], + int order +) +{ + int i; + + for(i=1; i<5; i++) { + if (lsp[i] - lsp[i-1] < PI*(12.5/4000.0)) + lsp[i] = lsp[i-1] + PI*(12.5/4000.0); + } + + /* As quantiser gaps increased, larger BW expansion was required + to prevent twinkly noises. This may need more experiment for + different quanstisers. + */ + + for(i=5; i<8; i++) { + if (lsp[i] - lsp[i-1] < PI*(25.0/4000.0)) + lsp[i] = lsp[i-1] + PI*(25.0/4000.0); + } + for(i=8; i<order; i++) { + if (lsp[i] - lsp[i-1] < PI*(75.0/4000.0)) + lsp[i] = lsp[i-1] + PI*(75.0/4000.0); + } +} + +/*---------------------------------------------------------------------------*\ + + FUNCTION....: apply_lpc_correction() + AUTHOR......: David Rowe + DATE CREATED: 22/8/2010 + + Apply first harmonic LPC correction at decoder. This helps improve + low pitch males after LPC modelling, like hts1a and morig. + +\*---------------------------------------------------------------------------*/ + +void apply_lpc_correction(MODEL *model) +{ + if (model->Wo < (PI*150.0/4000)) { + model->A[1] *= 0.032; + } +} + +/*---------------------------------------------------------------------------*\ + + FUNCTION....: encode_energy() + AUTHOR......: David Rowe + DATE CREATED: 22/8/2010 + + Encodes LPC energy using an E_LEVELS quantiser. + +\*---------------------------------------------------------------------------*/ + +int encode_energy(float e) +{ + int index; + float e_min = E_MIN_DB; + float e_max = E_MAX_DB; + float norm; + + e = 10.0*log10(e); + norm = (e - e_min)/(e_max - e_min); + index = floor(E_LEVELS * norm + 0.5); + if (index < 0 ) index = 0; + if (index > (E_LEVELS-1)) index = E_LEVELS-1; + + return index; +} + +/*---------------------------------------------------------------------------*\ + + FUNCTION....: decode_energy() + AUTHOR......: David Rowe + DATE CREATED: 22/8/2010 + + Decodes energy using a WO_BITS quantiser. + +\*---------------------------------------------------------------------------*/ + +float decode_energy(int index) +{ + float e_min = E_MIN_DB; + float e_max = E_MAX_DB; + float step; + float e; + + step = (e_max - e_min)/E_LEVELS; + e = e_min + step*(index); + e = pow(10.0,e/10.0); + + return e; +} + +/*---------------------------------------------------------------------------*\ + + FUNCTION....: encode_amplitudes() + AUTHOR......: David Rowe + DATE CREATED: 22/8/2010 + + Time domain LPC is used model the amplitudes which are then + converted to LSPs and quantised. So we don't actually encode the + amplitudes directly, rather we derive an equivalent representation + from the time domain speech. + +\*---------------------------------------------------------------------------*/ + +void encode_amplitudes(int lsp_indexes[], + int *energy_index, + MODEL *model, + float Sn[], + float w[]) +{ + float lsps[LPC_ORD]; + float ak[LPC_ORD+1]; + float e; + + e = speech_to_uq_lsps(lsps, ak, Sn, w, LPC_ORD); + encode_lsps(lsp_indexes, lsps, LPC_ORD); + *energy_index = encode_energy(e); +} + +/*---------------------------------------------------------------------------*\ + + FUNCTION....: decode_amplitudes() + AUTHOR......: David Rowe + DATE CREATED: 22/8/2010 + + Given the amplitude quantiser indexes recovers the harmonic + amplitudes. + +\*---------------------------------------------------------------------------*/ + +float decode_amplitudes(MODEL *model, + float ak[], + int lsp_indexes[], + int energy_index, + float lsps[], + float *e +) +{ + float snr; + + decode_lsps(lsps, lsp_indexes, LPC_ORD); + bw_expand_lsps(lsps, LPC_ORD); + lsp_to_lpc(lsps, ak, LPC_ORD); + *e = decode_energy(energy_index); + aks_to_M2(ak, LPC_ORD, model, *e, &snr, 1); + apply_lpc_correction(model); + + return snr; +} diff --git a/gr-vocoder/lib/codec2/quantise.h b/gr-vocoder/lib/codec2/quantise.h new file mode 100644 index 000000000..90a3661ff --- /dev/null +++ b/gr-vocoder/lib/codec2/quantise.h @@ -0,0 +1,83 @@ +/*---------------------------------------------------------------------------*\ + + FILE........: quantise.h + AUTHOR......: David Rowe + DATE CREATED: 31/5/92 + + Quantisation functions for the sinusoidal coder. + +\*---------------------------------------------------------------------------*/ + +/* + 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 __QUANTISE__ +#define __QUANTISE__ + +#define WO_BITS 7 +#define WO_LEVELS (1<<WO_BITS) +#define E_BITS 5 +#define E_LEVELS (1<<E_BITS) +#define E_MIN_DB -10.0 +#define E_MAX_DB 40.0 + +void quantise_init(); +float lpc_model_amplitudes(float Sn[], float w[], MODEL *model, int order, + int lsp,float ak[]); +void aks_to_M2(float ak[], int order, MODEL *model, float E, float *snr, + int dump); + +int encode_Wo(float Wo); +float decode_Wo(int index); + +void encode_lsps(int indexes[], float lsp[], int order); +void decode_lsps(float lsp[], int indexes[], int order); +void lspd_quantise(float lsp[], float lsp_[], int order); +void lspdvq_quantise(float lsp[], float lsp_[], int order); + +int encode_energy(float e); +float decode_energy(int index); + +void encode_amplitudes(int lsp_indexes[], + int *energy_index, + MODEL *model, + float Sn[], + float w[]); + +float decode_amplitudes(MODEL *model, + float ak[], + int lsp_indexes[], + int energy_index, + float lsps[], + float *e); + +void pack(unsigned char * bits, unsigned int *nbit, int index, unsigned int index_bits); +int unpack(const unsigned char * bits, unsigned int *nbit, unsigned int index_bits); + +int lsp_bits(int i); + +void apply_lpc_correction(MODEL *model); +float speech_to_uq_lsps(float lsp[], + float ak[], + float Sn[], + float w[], + int order + ); +void bw_expand_lsps(float lsp[], + int order + ); +void decode_lsps(float lsp[], int indexes[], int order); + +#endif diff --git a/gr-vocoder/lib/codec2/sim.sh b/gr-vocoder/lib/codec2/sim.sh new file mode 100755 index 000000000..10152d979 --- /dev/null +++ b/gr-vocoder/lib/codec2/sim.sh @@ -0,0 +1,22 @@ +#!/bin/sh +# sim.sh +# David Rowe 10 Sep 2009 + +# Process a source file using the codec 2 simulation. An output +# speech file is generated for each major processing step, from the +# unquantised siusoidal model to fully quantised. This way we can +# listen to the effect of each processing step. Use listensim.sh to +# test the output files. + +../src/c2sim ../raw/$1.raw -o $1_uq.raw +../src/c2sim ../raw/$1.raw --phase0 -o $1_phase0.raw --postfilter +../src/c2sim ../raw/$1.raw --lpc 10 -o $1_lpc10.raw --postfilter +../src/c2sim ../raw/$1.raw --phase0 --lpc 10 -o $1_phase0_lpc10.raw --postfilter +../src/c2sim ../raw/$1.raw --phase0 --lpc 10 --dec -o $1_phase0_lpc10_dec.raw --postfilter +../src/c2sim ../raw/$1.raw --phase0 --lpc 10 --lsp --dec -o $1_phase0_lsp_dec.raw --postfilter + +#../src/c2sim ../raw/$1.raw --lpc 10 --lsp -o $1_lsp.raw +#../src/c2sim ../raw/$1.raw --phase0 --lpc 10 -o $1_phase0_lpc10.raw --postfilter +#../src/c2sim ../raw/$1.raw --phase0 --lpc 10 --lsp -o $1_phase0_lsp.raw --postfilter +#../src/c2sim ../raw/$1.raw --phase0 --lpc 10 --lsp -o $1_phase0_lsp_dec.raw --postfilter --dec + diff --git a/gr-vocoder/lib/codec2/sine.c b/gr-vocoder/lib/codec2/sine.c new file mode 100644 index 000000000..45cc9de71 --- /dev/null +++ b/gr-vocoder/lib/codec2/sine.c @@ -0,0 +1,638 @@ +/*---------------------------------------------------------------------------*\ + + FILE........: sine.c + AUTHOR......: David Rowe + DATE CREATED: 19/8/2010 + + Sinusoidal analysis and synthesis functions. + +\*---------------------------------------------------------------------------*/ + +/* + Copyright (C) 1990-2010 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/>. +*/ + +/*---------------------------------------------------------------------------*\ + + INCLUDES + +\*---------------------------------------------------------------------------*/ + +#include <stdlib.h> +#include <stdio.h> +#include <math.h> + +#include "defines.h" +#include "sine.h" +#include "fft.h" + +#define HPF_BETA 0.125 + +/*---------------------------------------------------------------------------*\ + + HEADERS + +\*---------------------------------------------------------------------------*/ + +void hs_pitch_refinement(MODEL *model, COMP Sw[], float pmin, float pmax, + float pstep); + +/*---------------------------------------------------------------------------*\ + + FUNCTIONS + +\*---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------*\ + + FUNCTION....: make_analysis_window + AUTHOR......: David Rowe + DATE CREATED: 11/5/94 + + Init function that generates the time domain analysis window and it's DFT. + +\*---------------------------------------------------------------------------*/ + +void make_analysis_window(float w[],COMP W[]) +{ + float m; + COMP temp; + int i,j; + + /* + Generate Hamming window centered on M-sample pitch analysis window + + 0 M/2 M-1 + |-------------|-------------| + |-------|-------| + NW samples + + All our analysis/synthsis is centred on the M/2 sample. + */ + + m = 0.0; + for(i=0; i<M/2-NW/2; i++) + w[i] = 0.0; + for(i=M/2-NW/2,j=0; i<M/2+NW/2; i++,j++) { + w[i] = 0.5 - 0.5*cos(TWO_PI*j/(NW-1)); + m += w[i]*w[i]; + } + for(i=M/2+NW/2; i<M; i++) + w[i] = 0.0; + + /* Normalise - makes freq domain amplitude estimation straight + forward */ + + m = 1.0/sqrt(m*FFT_ENC); + for(i=0; i<M; i++) { + w[i] *= m; + } + + /* + Generate DFT of analysis window, used for later processing. Note + we modulo FFT_ENC shift the time domain window w[], this makes the + imaginary part of the DFT W[] equal to zero as the shifted w[] is + even about the n=0 time axis if NW is odd. Having the imag part + of the DFT W[] makes computation easier. + + 0 FFT_ENC-1 + |-------------------------| + + ----\ /---- + \ / + \ / <- shifted version of window w[n] + \ / + \ / + ------- + + |---------| |---------| + NW/2 NW/2 + */ + + for(i=0; i<FFT_ENC; i++) { + W[i].real = 0.0; + W[i].imag = 0.0; + } + for(i=0; i<NW/2; i++) + W[i].real = w[i+M/2]; + for(i=FFT_ENC-NW/2,j=M/2-NW/2; i<FFT_ENC; i++,j++) + W[i].real = w[j]; + + fft(&W[0].real,FFT_ENC,-1); /* "Numerical Recipes in C" FFT */ + + /* + Re-arrange W[] to be symmetrical about FFT_ENC/2. Makes later + analysis convenient. + + Before: + + + 0 FFT_ENC-1 + |----------|---------| + __ _ + \ / + \_______________/ + + After: + + 0 FFT_ENC-1 + |----------|---------| + ___ + / \ + ________/ \_______ + + */ + + + for(i=0; i<FFT_ENC/2; i++) { + temp.real = W[i].real; + temp.imag = W[i].imag; + W[i].real = W[i+FFT_ENC/2].real; + W[i].imag = W[i+FFT_ENC/2].imag; + W[i+FFT_ENC/2].real = temp.real; + W[i+FFT_ENC/2].imag = temp.imag; + } + +} + +/*---------------------------------------------------------------------------*\ + + FUNCTION....: hpf + AUTHOR......: David Rowe + DATE CREATED: 16 Nov 2010 + + High pass filter with a -3dB point of about 160Hz. + + y(n) = -HPF_BETA*y(n-1) + x(n) - x(n-1) + +\*---------------------------------------------------------------------------*/ + +float hpf(float x, float states[]) +{ + states[0] += -HPF_BETA*states[0] + x - states[1]; + states[1] = x; + + return states[0]; +} + +/*---------------------------------------------------------------------------*\ + + FUNCTION....: dft_speech + AUTHOR......: David Rowe + DATE CREATED: 27/5/94 + + Finds the DFT of the current speech input speech frame. + +\*---------------------------------------------------------------------------*/ + +void dft_speech(COMP Sw[], float Sn[], float w[]) +{ + int i; + + for(i=0; i<FFT_ENC; i++) { + Sw[i].real = 0.0; + Sw[i].imag = 0.0; + } + + /* Centre analysis window on time axis, we need to arrange input + to FFT this way to make FFT phases correct */ + + /* move 2nd half to start of FFT input vector */ + + for(i=0; i<NW/2; i++) + Sw[i].real = Sn[i+M/2]*w[i+M/2]; + + /* move 1st half to end of FFT input vector */ + + for(i=0; i<NW/2; i++) + Sw[FFT_ENC-NW/2+i].real = Sn[i+M/2-NW/2]*w[i+M/2-NW/2]; + + fft(&Sw[0].real,FFT_ENC,-1); +} + +/*---------------------------------------------------------------------------*\ + + FUNCTION....: two_stage_pitch_refinement + AUTHOR......: David Rowe + DATE CREATED: 27/5/94 + + Refines the current pitch estimate using the harmonic sum pitch + estimation technique. + +\*---------------------------------------------------------------------------*/ + +void two_stage_pitch_refinement(MODEL *model, COMP Sw[]) +{ + float pmin,pmax,pstep; /* pitch refinment minimum, maximum and step */ + + /* Coarse refinement */ + + pmax = TWO_PI/model->Wo + 5; + pmin = TWO_PI/model->Wo - 5; + pstep = 1.0; + hs_pitch_refinement(model,Sw,pmin,pmax,pstep); + + /* Fine refinement */ + + pmax = TWO_PI/model->Wo + 1; + pmin = TWO_PI/model->Wo - 1; + pstep = 0.25; + hs_pitch_refinement(model,Sw,pmin,pmax,pstep); + + /* Limit range */ + + if (model->Wo < TWO_PI/P_MAX) + model->Wo = TWO_PI/P_MAX; + if (model->Wo > TWO_PI/P_MIN) + model->Wo = TWO_PI/P_MIN; + + model->L = floor(PI/model->Wo); +} + +/*---------------------------------------------------------------------------*\ + + FUNCTION....: hs_pitch_refinement + AUTHOR......: David Rowe + DATE CREATED: 27/5/94 + + Harmonic sum pitch refinement function. + + pmin pitch search range minimum + pmax pitch search range maximum + step pitch search step size + model current pitch estimate in model.Wo + + model refined pitch estimate in model.Wo + +\*---------------------------------------------------------------------------*/ + +void hs_pitch_refinement(MODEL *model, COMP Sw[], float pmin, float pmax, float pstep) +{ + int m; /* loop variable */ + int b; /* bin for current harmonic centre */ + float E; /* energy for current pitch*/ + float Wo; /* current "test" fundamental freq. */ + float Wom; /* Wo that maximises E */ + float Em; /* mamimum energy */ + float r; /* number of rads/bin */ + float p; /* current pitch */ + + /* Initialisation */ + + model->L = PI/model->Wo; /* use initial pitch est. for L */ + Wom = model->Wo; + Em = 0.0; + r = TWO_PI/FFT_ENC; + + /* Determine harmonic sum for a range of Wo values */ + + for(p=pmin; p<=pmax; p+=pstep) { + E = 0.0; + Wo = TWO_PI/p; + + /* Sum harmonic magnitudes */ + + for(m=1; m<=model->L; m++) { + b = floor(m*Wo/r + 0.5); + E += Sw[b].real*Sw[b].real + Sw[b].imag*Sw[b].imag; + } + + /* Compare to see if this is a maximum */ + + if (E > Em) { + Em = E; + Wom = Wo; + } + } + + model->Wo = Wom; +} + +/*---------------------------------------------------------------------------*\ + + FUNCTION....: estimate_amplitudes + AUTHOR......: David Rowe + DATE CREATED: 27/5/94 + + Estimates the complex amplitudes of the harmonics. + +\*---------------------------------------------------------------------------*/ + +void estimate_amplitudes(MODEL *model, COMP Sw[], COMP W[]) +{ + int i,m; /* loop variables */ + int am,bm; /* bounds of current harmonic */ + int b; /* DFT bin of centre of current harmonic */ + float den; /* denominator of amplitude expression */ + float r; /* number of rads/bin */ + int offset; + COMP Am; + + r = TWO_PI/FFT_ENC; + + for(m=1; m<=model->L; m++) { + den = 0.0; + am = floor((m - 0.5)*model->Wo/r + 0.5); + bm = floor((m + 0.5)*model->Wo/r + 0.5); + b = floor(m*model->Wo/r + 0.5); + + /* Estimate ampltude of harmonic */ + + den = 0.0; + Am.real = Am.imag = 0.0; + for(i=am; i<bm; i++) { + den += Sw[i].real*Sw[i].real + Sw[i].imag*Sw[i].imag; + offset = i + FFT_ENC/2 - floor(m*model->Wo/r + 0.5); + Am.real += Sw[i].real*W[offset].real; + Am.imag += Sw[i].imag*W[offset].real; + } + + model->A[m] = sqrt(den); + + /* Estimate phase of harmonic */ + + model->phi[m] = atan2(Sw[b].imag,Sw[b].real); + } +} + +/*---------------------------------------------------------------------------*\ + + est_voicing_mbe() + + Returns the error of the MBE cost function for a fiven F0. + + Note: I think a lot of the operations below can be simplified as + W[].imag = 0 and has been normalised such that den always equals 1. + +\*---------------------------------------------------------------------------*/ + +float est_voicing_mbe( + MODEL *model, + COMP Sw[], + COMP W[], + COMP Sw_[], /* DFT of all voiced synthesised signal */ + /* useful for debugging/dump file */ + COMP Ew[], /* DFT of error */ + float prev_Wo) +{ + int i,l,al,bl,m; /* loop variables */ + COMP Am; /* amplitude sample for this band */ + int offset; /* centers Hw[] about current harmonic */ + float den; /* denominator of Am expression */ + float error; /* accumulated error between original and synthesised */ + float Wo; + float sig, snr; + float elow, ehigh, eratio; + float dF0, sixty; + + sig = 0.0; + for(l=1; l<=model->L/4; l++) { + sig += model->A[l]*model->A[l]; + } + for(i=0; i<FFT_ENC; i++) { + Sw_[i].real = 0.0; + Sw_[i].imag = 0.0; + Ew[i].real = 0.0; + Ew[i].imag = 0.0; + } + + Wo = model->Wo; + error = 0.0; + + /* Just test across the harmonics in the first 1000 Hz (L/4) */ + + for(l=1; l<=model->L/4; l++) { + Am.real = 0.0; + Am.imag = 0.0; + den = 0.0; + al = ceil((l - 0.5)*Wo*FFT_ENC/TWO_PI); + bl = ceil((l + 0.5)*Wo*FFT_ENC/TWO_PI); + + /* Estimate amplitude of harmonic assuming harmonic is totally voiced */ + + for(m=al; m<bl; m++) { + offset = FFT_ENC/2 + m - l*Wo*FFT_ENC/TWO_PI + 0.5; + Am.real += Sw[m].real*W[offset].real + Sw[m].imag*W[offset].imag; + Am.imag += Sw[m].imag*W[offset].real - Sw[m].real*W[offset].imag; + den += W[offset].real*W[offset].real + W[offset].imag*W[offset].imag; + } + + Am.real = Am.real/den; + Am.imag = Am.imag/den; + + /* Determine error between estimated harmonic and original */ + + for(m=al; m<bl; m++) { + offset = FFT_ENC/2 + m - l*Wo*FFT_ENC/TWO_PI + 0.5; + Sw_[m].real = Am.real*W[offset].real - Am.imag*W[offset].imag; + Sw_[m].imag = Am.real*W[offset].imag + Am.imag*W[offset].real; + Ew[m].real = Sw[m].real - Sw_[m].real; + Ew[m].imag = Sw[m].imag - Sw_[m].imag; + error += Ew[m].real*Ew[m].real; + error += Ew[m].imag*Ew[m].imag; + } + } + + snr = 10.0*log10(sig/error); + if (snr > V_THRESH) + model->voiced = 1; + else + model->voiced = 0; + + /* post processing, helps clean up some voicing errors ------------------*/ + + /* + Determine the ratio of low freancy to high frequency energy, + voiced speech tends to be dominated by low frequency energy, + unvoiced by high frequency. This measure can be used to + determine if we have made any gross errors. + */ + + elow = ehigh = 0.0; + for(l=1; l<=model->L/2; l++) { + elow += model->A[l]*model->A[l]; + } + for(l=model->L/2; l<=model->L; l++) { + ehigh += model->A[l]*model->A[l]; + } + eratio = 10.0*log10(elow/ehigh); + dF0 = 0.0; + + /* Look for Type 1 errors, strongly V speech that has been + accidentally declared UV */ + + if (model->voiced == 0) + if (eratio > 10.0) + model->voiced = 1; + + /* Look for Type 2 errors, strongly UV speech that has been + accidentally declared V */ + + if (model->voiced == 1) { + if (eratio < -10.0) + model->voiced = 0; + + /* If pitch is jumping about it's likely this is UV */ + + dF0 = (model->Wo - prev_Wo)*FS/TWO_PI; + if (fabs(dF0) > 15.0) + model->voiced = 0; + + /* A common source of Type 2 errors is the pitch estimator + gives a low (50Hz) estimate for UV speech, which gives a + good match with noise due to the close harmoonic spacing. + These errors are much more common than people with 50Hz + pitch, so we have just a small eratio threshold. */ + + sixty = 60.0*TWO_PI/FS; + if ((eratio < -4.0) && (model->Wo <= sixty)) + model->voiced = 0; + } + //printf(" v: %d snr: %f eratio: %3.2f %f\n",model->voiced,snr,eratio,dF0); + + return snr; +} + +/*---------------------------------------------------------------------------*\ + + FUNCTION....: make_synthesis_window + AUTHOR......: David Rowe + DATE CREATED: 11/5/94 + + Init function that generates the trapezoidal (Parzen) sythesis window. + +\*---------------------------------------------------------------------------*/ + +void make_synthesis_window(float Pn[]) +{ + int i; + float win; + + /* Generate Parzen window in time domain */ + + win = 0.0; + for(i=0; i<N/2-TW; i++) + Pn[i] = 0.0; + win = 0.0; + for(i=N/2-TW; i<N/2+TW; win+=1.0/(2*TW), i++ ) + Pn[i] = win; + for(i=N/2+TW; i<3*N/2-TW; i++) + Pn[i] = 1.0; + win = 1.0; + for(i=3*N/2-TW; i<3*N/2+TW; win-=1.0/(2*TW), i++) + Pn[i] = win; + for(i=3*N/2+TW; i<2*N; i++) + Pn[i] = 0.0; +} + +/*---------------------------------------------------------------------------*\ + + FUNCTION....: synthesise + AUTHOR......: David Rowe + DATE CREATED: 20/2/95 + + Synthesise a speech signal in the frequency domain from the + sinusodal model parameters. Uses overlap-add with a trapezoidal + window to smoothly interpolate betwen frames. + +\*---------------------------------------------------------------------------*/ + +void synthesise( + float Sn_[], /* time domain synthesised signal */ + MODEL *model, /* ptr to model parameters for this frame */ + float Pn[], /* time domain Parzen window */ + int shift /* flag used to handle transition frames */ +) +{ + int i,l,j,b; /* loop variables */ + COMP Sw_[FFT_DEC]; /* DFT of synthesised signal */ + + if (shift) { + /* Update memories */ + + for(i=0; i<N-1; i++) { + Sn_[i] = Sn_[i+N]; + } + Sn_[N-1] = 0.0; + } + + for(i=0; i<FFT_DEC; i++) { + Sw_[i].real = 0.0; + Sw_[i].imag = 0.0; + } + + /* + Nov 2010 - found that synthesis using time domain cos() functions + gives better results for synthesis frames greater than 10ms. Inverse + FFT synthesis using a 512 pt FFT works well for 10ms window. I think + (but am not sure) that the problem is realted to the quantisation of + the harmonic frequencies to the FFT bin size, e.g. there is a + 8000/512 Hz step between FFT bins. For some reason this makes + the speech from longer frame > 10ms sound poor. The effect can also + be seen when synthesising test signals like single sine waves, some + sort of amplitude modulation at the frame rate. + + Another possibility is using a larger FFT size (1024 or 2048). + */ + +#define FFT_SYNTHESIS +#ifdef FFT_SYNTHESIS + /* Now set up frequency domain synthesised speech */ + for(l=1; l<=model->L; l++) { + b = floor(l*model->Wo*FFT_DEC/TWO_PI + 0.5); + if (b > ((FFT_DEC/2)-1)) { + b = (FFT_DEC/2)-1; + } + Sw_[b].real = model->A[l]*cos(model->phi[l]); + Sw_[b].imag = model->A[l]*sin(model->phi[l]); + Sw_[FFT_DEC-b].real = Sw_[b].real; + Sw_[FFT_DEC-b].imag = -Sw_[b].imag; + } + + /* Perform inverse DFT */ + + fft(&Sw_[0].real,FFT_DEC,1); +#else + /* + Direct time domain synthesis using the cos() function. Works + well at 10ms and 20ms frames rates. Note synthesis window is + still used to handle overlap-add between adjacent frames. This + could be simplified as we don't need to synthesise where Pn[] + is zero. + */ + for(l=1; l<=model->L; l++) { + for(i=0,j=-N+1; i<N-1; i++,j++) { + Sw_[FFT_DEC-N+1+i].real += 2.0*model->A[l]*cos(j*model->Wo*l + model->phi[l]); + } + for(i=N-1,j=0; i<2*N; i++,j++) + Sw_[j].real += 2.0*model->A[l]*cos(j*model->Wo*l + model->phi[l]); + } +#endif + + /* Overlap add to previous samples */ + + for(i=0; i<N-1; i++) { + Sn_[i] += Sw_[FFT_DEC-N+1+i].real*Pn[i]; + } + + if (shift) + for(i=N-1,j=0; i<2*N; i++,j++) + Sn_[i] = Sw_[j].real*Pn[i]; + else + for(i=N-1,j=0; i<2*N; i++,j++) + Sn_[i] += Sw_[j].real*Pn[i]; +} + diff --git a/gr-vocoder/lib/codec2/sine.h b/gr-vocoder/lib/codec2/sine.h new file mode 100644 index 000000000..ae578bf70 --- /dev/null +++ b/gr-vocoder/lib/codec2/sine.h @@ -0,0 +1,44 @@ +/*---------------------------------------------------------------------------*\ + + 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" + +void make_analysis_window(float w[], COMP W[]); +float hpf(float x, float states[]); +void dft_speech(COMP Sw[], float Sn[], float w[]); +void two_stage_pitch_refinement(MODEL *model, COMP Sw[]); +void estimate_amplitudes(MODEL *model, COMP Sw[], COMP W[]); +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(float Sn_[], MODEL *model, float Pn[], int shift); + +#endif diff --git a/gnuradio-core/src/lib/g72x/.gitignore b/gr-vocoder/lib/g7xx/.gitignore index a02b6ff73..a02b6ff73 100644 --- a/gnuradio-core/src/lib/g72x/.gitignore +++ b/gr-vocoder/lib/g7xx/.gitignore diff --git a/gr-vocoder/lib/g7xx/CMakeLists.txt b/gr-vocoder/lib/g7xx/CMakeLists.txt new file mode 100644 index 000000000..4c67109e1 --- /dev/null +++ b/gr-vocoder/lib/g7xx/CMakeLists.txt @@ -0,0 +1,30 @@ +# Copyright 2011 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio 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 General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. + +######################################################################## +# Append all sources in this dir +######################################################################## +INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}) +LIST(APPEND gr_vocoder_sources + ${CMAKE_CURRENT_SOURCE_DIR}/g711.c + ${CMAKE_CURRENT_SOURCE_DIR}/g72x.c + ${CMAKE_CURRENT_SOURCE_DIR}/g721.c + ${CMAKE_CURRENT_SOURCE_DIR}/g723_24.c + ${CMAKE_CURRENT_SOURCE_DIR}/g723_40.c +) diff --git a/gnuradio-core/src/lib/g72x/Makefile.am b/gr-vocoder/lib/g7xx/Makefile.am index d2700376f..929fd23ba 100644 --- a/gnuradio-core/src/lib/g72x/Makefile.am +++ b/gr-vocoder/lib/g7xx/Makefile.am @@ -1,5 +1,5 @@ # -# Copyright 2001 Free Software Foundation, Inc. +# Copyright 2001,2011 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -21,7 +21,7 @@ include $(top_srcdir)/Makefile.common -noinst_LTLIBRARIES = libccitt.la -libccitt_la_SOURCES = g711.c g72x.c g721.c g723_24.c g723_40.c g72x.h +noinst_LTLIBRARIES = libg7xx.la +libg7xx_la_SOURCES = g711.c g72x.c g721.c g723_24.c g723_40.c g72x.h EXTRA_DIST += encode.c decode.c diff --git a/gnuradio-core/src/lib/g72x/README b/gr-vocoder/lib/g7xx/README index 23b0e7dd5..23b0e7dd5 100644 --- a/gnuradio-core/src/lib/g72x/README +++ b/gr-vocoder/lib/g7xx/README diff --git a/gnuradio-core/src/lib/g72x/decode.c b/gr-vocoder/lib/g7xx/decode.c index cf8c739c5..cf8c739c5 100644 --- a/gnuradio-core/src/lib/g72x/decode.c +++ b/gr-vocoder/lib/g7xx/decode.c diff --git a/gnuradio-core/src/lib/g72x/encode.c b/gr-vocoder/lib/g7xx/encode.c index e74482869..e74482869 100644 --- a/gnuradio-core/src/lib/g72x/encode.c +++ b/gr-vocoder/lib/g7xx/encode.c diff --git a/gnuradio-core/src/lib/g72x/g711.c b/gr-vocoder/lib/g7xx/g711.c index d4d60a5c2..d4d60a5c2 100644 --- a/gnuradio-core/src/lib/g72x/g711.c +++ b/gr-vocoder/lib/g7xx/g711.c diff --git a/gnuradio-core/src/lib/g72x/g721.c b/gr-vocoder/lib/g7xx/g721.c index 445f177e8..445f177e8 100644 --- a/gnuradio-core/src/lib/g72x/g721.c +++ b/gr-vocoder/lib/g7xx/g721.c diff --git a/gnuradio-core/src/lib/g72x/g723_24.c b/gr-vocoder/lib/g7xx/g723_24.c index 452f4daeb..452f4daeb 100644 --- a/gnuradio-core/src/lib/g72x/g723_24.c +++ b/gr-vocoder/lib/g7xx/g723_24.c diff --git a/gnuradio-core/src/lib/g72x/g723_40.c b/gr-vocoder/lib/g7xx/g723_40.c index 4858baf40..4858baf40 100644 --- a/gnuradio-core/src/lib/g72x/g723_40.c +++ b/gr-vocoder/lib/g7xx/g723_40.c diff --git a/gnuradio-core/src/lib/g72x/g72x.c b/gr-vocoder/lib/g7xx/g72x.c index 9a823c755..9a823c755 100644 --- a/gnuradio-core/src/lib/g72x/g72x.c +++ b/gr-vocoder/lib/g7xx/g72x.c diff --git a/gnuradio-core/src/lib/g72x/g72x.h b/gr-vocoder/lib/g7xx/g72x.h index 33807171a..33807171a 100644 --- a/gnuradio-core/src/lib/g72x/g72x.h +++ b/gr-vocoder/lib/g7xx/g72x.h diff --git a/gr-gsm-fr-vocoder/src/lib/gsm/.gitignore b/gr-vocoder/lib/gsm/.gitignore index a02b6ff73..a02b6ff73 100644 --- a/gr-gsm-fr-vocoder/src/lib/gsm/.gitignore +++ b/gr-vocoder/lib/gsm/.gitignore diff --git a/gr-vocoder/lib/gsm/CMakeLists.txt b/gr-vocoder/lib/gsm/CMakeLists.txt new file mode 100644 index 000000000..128f87231 --- /dev/null +++ b/gr-vocoder/lib/gsm/CMakeLists.txt @@ -0,0 +1,49 @@ +# Copyright 2011 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio 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 General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. + +######################################################################## +# Append all sources in this dir +######################################################################## +INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}) + +SET(gsm_sources + ${CMAKE_CURRENT_SOURCE_DIR}/add.c + ${CMAKE_CURRENT_SOURCE_DIR}/code.c + ${CMAKE_CURRENT_SOURCE_DIR}/debug.c + ${CMAKE_CURRENT_SOURCE_DIR}/decode.c + ${CMAKE_CURRENT_SOURCE_DIR}/gsm_create.c + ${CMAKE_CURRENT_SOURCE_DIR}/gsm_decode.c + ${CMAKE_CURRENT_SOURCE_DIR}/gsm_destroy.c + ${CMAKE_CURRENT_SOURCE_DIR}/gsm_encode.c + ${CMAKE_CURRENT_SOURCE_DIR}/gsm_explode.c + ${CMAKE_CURRENT_SOURCE_DIR}/gsm_implode.c + ${CMAKE_CURRENT_SOURCE_DIR}/gsm_option.c + ${CMAKE_CURRENT_SOURCE_DIR}/gsm_print.c + ${CMAKE_CURRENT_SOURCE_DIR}/long_term.c + ${CMAKE_CURRENT_SOURCE_DIR}/lpc.c + ${CMAKE_CURRENT_SOURCE_DIR}/preprocess.c + ${CMAKE_CURRENT_SOURCE_DIR}/rpe.c + ${CMAKE_CURRENT_SOURCE_DIR}/short_term.c + ${CMAKE_CURRENT_SOURCE_DIR}/table.c +) + +SET_SOURCE_FILES_PROPERTIES(${gsm_sources} + PROPERTIES COMPILE_DEFINITION "NeedFunctionPrototypes=1" +) +LIST(APPEND gr_vocoder_sources ${gsm_sources}) diff --git a/gr-gsm-fr-vocoder/src/lib/gsm/COPYRIGHT b/gr-vocoder/lib/gsm/COPYRIGHT index eba0e523b..eba0e523b 100644 --- a/gr-gsm-fr-vocoder/src/lib/gsm/COPYRIGHT +++ b/gr-vocoder/lib/gsm/COPYRIGHT diff --git a/gr-gsm-fr-vocoder/src/lib/gsm/Makefile.am b/gr-vocoder/lib/gsm/Makefile.am index d0872ff39..d0872ff39 100644 --- a/gr-gsm-fr-vocoder/src/lib/gsm/Makefile.am +++ b/gr-vocoder/lib/gsm/Makefile.am diff --git a/gr-gsm-fr-vocoder/src/lib/gsm/README b/gr-vocoder/lib/gsm/README index 1927d878a..1927d878a 100644 --- a/gr-gsm-fr-vocoder/src/lib/gsm/README +++ b/gr-vocoder/lib/gsm/README diff --git a/gr-gsm-fr-vocoder/src/lib/gsm/README.gsm b/gr-vocoder/lib/gsm/README.gsm index cb6af85cf..cb6af85cf 100644 --- a/gr-gsm-fr-vocoder/src/lib/gsm/README.gsm +++ b/gr-vocoder/lib/gsm/README.gsm diff --git a/gr-gsm-fr-vocoder/src/lib/gsm/add.c b/gr-vocoder/lib/gsm/add.c index 21ccfabe7..21ccfabe7 100644 --- a/gr-gsm-fr-vocoder/src/lib/gsm/add.c +++ b/gr-vocoder/lib/gsm/add.c diff --git a/gr-gsm-fr-vocoder/src/lib/gsm/code.c b/gr-vocoder/lib/gsm/code.c index 19af507b7..19af507b7 100644 --- a/gr-gsm-fr-vocoder/src/lib/gsm/code.c +++ b/gr-vocoder/lib/gsm/code.c diff --git a/gr-gsm-fr-vocoder/src/lib/gsm/config.h b/gr-vocoder/lib/gsm/config.h index 2a962ac7d..2a962ac7d 100644 --- a/gr-gsm-fr-vocoder/src/lib/gsm/config.h +++ b/gr-vocoder/lib/gsm/config.h diff --git a/gr-gsm-fr-vocoder/src/lib/gsm/debug.c b/gr-vocoder/lib/gsm/debug.c index e05210428..e05210428 100644 --- a/gr-gsm-fr-vocoder/src/lib/gsm/debug.c +++ b/gr-vocoder/lib/gsm/debug.c diff --git a/gr-gsm-fr-vocoder/src/lib/gsm/decode.c b/gr-vocoder/lib/gsm/decode.c index 34e558663..34e558663 100644 --- a/gr-gsm-fr-vocoder/src/lib/gsm/decode.c +++ b/gr-vocoder/lib/gsm/decode.c diff --git a/gr-gsm-fr-vocoder/src/lib/gsm/gsm.h b/gr-vocoder/lib/gsm/gsm.h index 990e42af5..990e42af5 100644 --- a/gr-gsm-fr-vocoder/src/lib/gsm/gsm.h +++ b/gr-vocoder/lib/gsm/gsm.h diff --git a/gr-gsm-fr-vocoder/src/lib/gsm/gsm_create.c b/gr-vocoder/lib/gsm/gsm_create.c index de0b125b4..a59aa2f2a 100644 --- a/gr-gsm-fr-vocoder/src/lib/gsm/gsm_create.c +++ b/gr-vocoder/lib/gsm/gsm_create.c @@ -30,7 +30,6 @@ static char const ident[] = "$Header$"; #include "gsm.h" #include "private.h" #include "proto.h" -#include <strings.h> gsm gsm_create P0() { diff --git a/gr-gsm-fr-vocoder/src/lib/gsm/gsm_decode.c b/gr-vocoder/lib/gsm/gsm_decode.c index 7318ba2d4..7318ba2d4 100644 --- a/gr-gsm-fr-vocoder/src/lib/gsm/gsm_decode.c +++ b/gr-vocoder/lib/gsm/gsm_decode.c diff --git a/gr-gsm-fr-vocoder/src/lib/gsm/gsm_destroy.c b/gr-vocoder/lib/gsm/gsm_destroy.c index 4807c0acd..4807c0acd 100644 --- a/gr-gsm-fr-vocoder/src/lib/gsm/gsm_destroy.c +++ b/gr-vocoder/lib/gsm/gsm_destroy.c diff --git a/gr-gsm-fr-vocoder/src/lib/gsm/gsm_encode.c b/gr-vocoder/lib/gsm/gsm_encode.c index 62338300e..62338300e 100644 --- a/gr-gsm-fr-vocoder/src/lib/gsm/gsm_encode.c +++ b/gr-vocoder/lib/gsm/gsm_encode.c diff --git a/gr-gsm-fr-vocoder/src/lib/gsm/gsm_explode.c b/gr-vocoder/lib/gsm/gsm_explode.c index a906fc2ed..a906fc2ed 100644 --- a/gr-gsm-fr-vocoder/src/lib/gsm/gsm_explode.c +++ b/gr-vocoder/lib/gsm/gsm_explode.c diff --git a/gr-gsm-fr-vocoder/src/lib/gsm/gsm_implode.c b/gr-vocoder/lib/gsm/gsm_implode.c index 453b8cf39..453b8cf39 100644 --- a/gr-gsm-fr-vocoder/src/lib/gsm/gsm_implode.c +++ b/gr-vocoder/lib/gsm/gsm_implode.c diff --git a/gr-gsm-fr-vocoder/src/lib/gsm/gsm_option.c b/gr-vocoder/lib/gsm/gsm_option.c index 280780132..280780132 100644 --- a/gr-gsm-fr-vocoder/src/lib/gsm/gsm_option.c +++ b/gr-vocoder/lib/gsm/gsm_option.c diff --git a/gr-gsm-fr-vocoder/src/lib/gsm/gsm_print.c b/gr-vocoder/lib/gsm/gsm_print.c index af745bc48..af745bc48 100644 --- a/gr-gsm-fr-vocoder/src/lib/gsm/gsm_print.c +++ b/gr-vocoder/lib/gsm/gsm_print.c diff --git a/gr-gsm-fr-vocoder/src/lib/gsm/long_term.c b/gr-vocoder/lib/gsm/long_term.c index fd67bda19..fd67bda19 100644 --- a/gr-gsm-fr-vocoder/src/lib/gsm/long_term.c +++ b/gr-vocoder/lib/gsm/long_term.c diff --git a/gr-gsm-fr-vocoder/src/lib/gsm/lpc.c b/gr-vocoder/lib/gsm/lpc.c index ac2b8a9eb..ac2b8a9eb 100644 --- a/gr-gsm-fr-vocoder/src/lib/gsm/lpc.c +++ b/gr-vocoder/lib/gsm/lpc.c diff --git a/gr-gsm-fr-vocoder/src/lib/gsm/preprocess.c b/gr-vocoder/lib/gsm/preprocess.c index 99c0709dc..99c0709dc 100644 --- a/gr-gsm-fr-vocoder/src/lib/gsm/preprocess.c +++ b/gr-vocoder/lib/gsm/preprocess.c diff --git a/gr-gsm-fr-vocoder/src/lib/gsm/private.h b/gr-vocoder/lib/gsm/private.h index 6b538cc27..6b538cc27 100644 --- a/gr-gsm-fr-vocoder/src/lib/gsm/private.h +++ b/gr-vocoder/lib/gsm/private.h diff --git a/gr-gsm-fr-vocoder/src/lib/gsm/proto.h b/gr-vocoder/lib/gsm/proto.h index 87cf05e8a..87cf05e8a 100644 --- a/gr-gsm-fr-vocoder/src/lib/gsm/proto.h +++ b/gr-vocoder/lib/gsm/proto.h diff --git a/gr-gsm-fr-vocoder/src/lib/gsm/rpe.c b/gr-vocoder/lib/gsm/rpe.c index 8a6b81fae..8a6b81fae 100644 --- a/gr-gsm-fr-vocoder/src/lib/gsm/rpe.c +++ b/gr-vocoder/lib/gsm/rpe.c diff --git a/gr-gsm-fr-vocoder/src/lib/gsm/short_term.c b/gr-vocoder/lib/gsm/short_term.c index 4f5fd7be7..4f5fd7be7 100644 --- a/gr-gsm-fr-vocoder/src/lib/gsm/short_term.c +++ b/gr-vocoder/lib/gsm/short_term.c diff --git a/gr-gsm-fr-vocoder/src/lib/gsm/table.c b/gr-vocoder/lib/gsm/table.c index 16a04118c..16a04118c 100644 --- a/gr-gsm-fr-vocoder/src/lib/gsm/table.c +++ b/gr-vocoder/lib/gsm/table.c diff --git a/gr-gsm-fr-vocoder/src/lib/gsm/unproto.h b/gr-vocoder/lib/gsm/unproto.h index ccd565109..ccd565109 100644 --- a/gr-gsm-fr-vocoder/src/lib/gsm/unproto.h +++ b/gr-vocoder/lib/gsm/unproto.h diff --git a/gr-vocoder/lib/vocoder_alaw_decode_bs.cc b/gr-vocoder/lib/vocoder_alaw_decode_bs.cc new file mode 100644 index 000000000..7ffdddd81 --- /dev/null +++ b/gr-vocoder/lib/vocoder_alaw_decode_bs.cc @@ -0,0 +1,65 @@ +/* -*- c++ -*- */ +/* + * Copyright 2011 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio 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 General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <vocoder_alaw_decode_bs.h> +#include <gr_io_signature.h> +#include <limits.h> + +extern "C" { +#include "g7xx/g72x.h" +} + +vocoder_alaw_decode_bs_sptr vocoder_make_alaw_decode_bs() +{ + return gnuradio::get_initial_sptr(new vocoder_alaw_decode_bs()); +} + +vocoder_alaw_decode_bs::vocoder_alaw_decode_bs() + : gr_sync_block("vocoder_alaw_decode_bs", + gr_make_io_signature (1, 1, sizeof (unsigned char)), + gr_make_io_signature (1, 1, sizeof (short))) +{ +} + +vocoder_alaw_decode_bs::~vocoder_alaw_decode_bs() +{ +} + + + +int +vocoder_alaw_decode_bs::work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items) +{ + const unsigned char *in = (const unsigned char *)input_items[0]; + short *out = (short *)output_items[0]; + + for(int i = 0; i < noutput_items; i++) + out[i] = alaw2linear(in[i]); + + return noutput_items; +} diff --git a/gr-vocoder/lib/vocoder_alaw_encode_sb.cc b/gr-vocoder/lib/vocoder_alaw_encode_sb.cc new file mode 100644 index 000000000..e4d975271 --- /dev/null +++ b/gr-vocoder/lib/vocoder_alaw_encode_sb.cc @@ -0,0 +1,63 @@ +/* -*- c++ -*- */ +/* + * Copyright 2011 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio 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 General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <vocoder_alaw_encode_sb.h> +#include <gr_io_signature.h> +#include <limits.h> + +extern "C" { +#include "g7xx/g72x.h" +} + +vocoder_alaw_encode_sb_sptr vocoder_make_alaw_encode_sb() +{ + return gnuradio::get_initial_sptr(new vocoder_alaw_encode_sb()); +} + +vocoder_alaw_encode_sb::vocoder_alaw_encode_sb() + : gr_sync_block("vocoder_alaw_encode_sb", + gr_make_io_signature (1, 1, sizeof(short)), + gr_make_io_signature (1, 1, sizeof(unsigned char))) +{ +} + +vocoder_alaw_encode_sb::~vocoder_alaw_encode_sb() +{ +} + +int +vocoder_alaw_encode_sb::work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items) +{ + const short *in = (const short *)input_items[0]; + unsigned char *out = (unsigned char *)output_items[0]; + + for(int i = 0; i < noutput_items; i++) + out[i] = linear2alaw(in[i]); + + return noutput_items; +} diff --git a/gr-vocoder/lib/vocoder_codec2_decode_ps.cc b/gr-vocoder/lib/vocoder_codec2_decode_ps.cc new file mode 100644 index 000000000..b1feb1aaf --- /dev/null +++ b/gr-vocoder/lib/vocoder_codec2_decode_ps.cc @@ -0,0 +1,75 @@ +/* -*- c++ -*- */ +/* + * Copyright 2005,2011 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio 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 General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "vocoder_codec2_decode_ps.h" + +extern "C" { +#include "codec2/codec2.h" +} + +#include <gr_io_signature.h> +#include <stdexcept> +#include <assert.h> + +vocoder_codec2_decode_ps_sptr +vocoder_make_codec2_decode_ps () +{ + return gnuradio::get_initial_sptr(new vocoder_codec2_decode_ps ()); +} + +vocoder_codec2_decode_ps::vocoder_codec2_decode_ps () + : gr_sync_interpolator ("vocoder_codec2_decode_ps", + gr_make_io_signature (1, 1, CODEC2_BITS_PER_FRAME * sizeof (char)), + gr_make_io_signature (1, 1, sizeof (short)), + CODEC2_SAMPLES_PER_FRAME) +{ + if ((d_codec2 = codec2_create ()) == 0) + throw std::runtime_error ("vocoder_codec2_decode_ps: codec2_create failed"); +} + +vocoder_codec2_decode_ps::~vocoder_codec2_decode_ps () +{ + codec2_destroy(d_codec2); +} + +int +vocoder_codec2_decode_ps::work (int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items) +{ + const unsigned char *in = (const unsigned char *) input_items[0]; + short *out = (short *) output_items[0]; + + assert ((noutput_items % CODEC2_SAMPLES_PER_FRAME) == 0); + + for (int i = 0; i < noutput_items; i += CODEC2_SAMPLES_PER_FRAME){ + codec2_decode (d_codec2, out, const_cast<unsigned char*>(in)); + in += CODEC2_BITS_PER_FRAME * sizeof (char); + out += CODEC2_SAMPLES_PER_FRAME; + } + + return noutput_items; +} diff --git a/gr-vocoder/lib/vocoder_codec2_encode_sp.cc b/gr-vocoder/lib/vocoder_codec2_encode_sp.cc new file mode 100644 index 000000000..1f22e38b2 --- /dev/null +++ b/gr-vocoder/lib/vocoder_codec2_encode_sp.cc @@ -0,0 +1,72 @@ +/* -*- c++ -*- */ +/* + * Copyright 2005,2011 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio 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 General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "vocoder_codec2_encode_sp.h" + +extern "C" { +#include "codec2/codec2.h" +} + +#include <gr_io_signature.h> +#include <stdexcept> + +vocoder_codec2_encode_sp_sptr +vocoder_make_codec2_encode_sp () +{ + return gnuradio::get_initial_sptr(new vocoder_codec2_encode_sp ()); +} + +vocoder_codec2_encode_sp::vocoder_codec2_encode_sp () + : gr_sync_decimator ("vocoder_codec2_encode_sp", + gr_make_io_signature (1, 1, sizeof (short)), + gr_make_io_signature (1, 1, CODEC2_BITS_PER_FRAME * sizeof (char)), + CODEC2_SAMPLES_PER_FRAME) +{ + if ((d_codec2 = codec2_create ()) == 0) + throw std::runtime_error ("vocoder_codec2_encode_sp: codec2_create failed"); +} + +vocoder_codec2_encode_sp::~vocoder_codec2_encode_sp () +{ + codec2_destroy(d_codec2); +} + +int +vocoder_codec2_encode_sp::work (int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items) +{ + const short *in = (const short *) input_items[0]; + unsigned char *out = (unsigned char *) output_items[0]; + + for (int i = 0; i < noutput_items; i++){ + codec2_encode (d_codec2, out, const_cast<short*>(in)); + in += CODEC2_SAMPLES_PER_FRAME; + out += CODEC2_BITS_PER_FRAME * sizeof (char); + } + + return noutput_items; +} diff --git a/gr-cvsd-vocoder/src/lib/cvsd_decode_bs.cc b/gr-vocoder/lib/vocoder_cvsd_decode_bs.cc index 26dcb29da..baf99f041 100644 --- a/gr-cvsd-vocoder/src/lib/cvsd_decode_bs.cc +++ b/gr-vocoder/lib/vocoder_cvsd_decode_bs.cc @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2007,2010 Free Software Foundation, Inc. + * Copyright 2007,2010,2011 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -29,28 +29,28 @@ #include "config.h" #endif -#include <cvsd_decode_bs.h> +#include <vocoder_cvsd_decode_bs.h> #include <gr_io_signature.h> #include <limits.h> /* - * Create a new instance of cvsd_decode_bs and return + * Create a new instance of vocoder_cvsd_decode_bs and return * a boost shared_ptr. This is effectively the public constructor. */ -cvsd_decode_bs_sptr -cvsd_make_decode_bs (short min_step, short max_step, double step_decay, - double accum_decay, int K, int J, - short pos_accum_max, short neg_accum_max) +vocoder_cvsd_decode_bs_sptr +vocoder_make_cvsd_decode_bs (short min_step, short max_step, double step_decay, + double accum_decay, int K, int J, + short pos_accum_max, short neg_accum_max) { - return gnuradio::get_initial_sptr(new cvsd_decode_bs (min_step, max_step, - step_decay, accum_decay, K, J, - pos_accum_max, neg_accum_max)); + return gnuradio::get_initial_sptr(new vocoder_cvsd_decode_bs (min_step, max_step, + step_decay, accum_decay, K, J, + pos_accum_max, neg_accum_max)); } -cvsd_decode_bs::cvsd_decode_bs (short min_step, short max_step, double step_decay, - double accum_decay, int K, int J, - short pos_accum_max, short neg_accum_max) - : gr_sync_interpolator ("cvsd_decode_bs", +vocoder_cvsd_decode_bs::vocoder_cvsd_decode_bs (short min_step, short max_step, double step_decay, + double accum_decay, int K, int J, + short pos_accum_max, short neg_accum_max) + : gr_sync_interpolator ("vocoder_cvsd_decode_bs", gr_make_io_signature (1, 1, sizeof (unsigned char)), gr_make_io_signature (1, 1, sizeof (short)), 8), @@ -69,12 +69,12 @@ cvsd_decode_bs::cvsd_decode_bs (short min_step, short max_step, double step_deca } -cvsd_decode_bs::~cvsd_decode_bs () +vocoder_cvsd_decode_bs::~vocoder_cvsd_decode_bs () { // nothing else required in this example } -unsigned char cvsd_decode_bs::cvsd_bitwise_sum (unsigned int input) +unsigned char vocoder_cvsd_decode_bs::cvsd_bitwise_sum (unsigned int input) { unsigned int temp=input; unsigned char bits=0; @@ -86,7 +86,7 @@ unsigned char cvsd_decode_bs::cvsd_bitwise_sum (unsigned int input) return bits; } -int cvsd_decode_bs::cvsd_round (double input) +int vocoder_cvsd_decode_bs::cvsd_round (double input) { double temp; temp=input+0.5; @@ -95,7 +95,7 @@ int cvsd_decode_bs::cvsd_round (double input) return (int)temp; } -unsigned int cvsd_decode_bs::cvsd_pow (short radix, short power) +unsigned int vocoder_cvsd_decode_bs::cvsd_pow (short radix, short power) { double d_radix = (double) radix; int i_power = (int) power; @@ -107,9 +107,9 @@ unsigned int cvsd_decode_bs::cvsd_pow (short radix, short power) int -cvsd_decode_bs::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) +vocoder_cvsd_decode_bs::work (int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items) { diff --git a/gr-cvsd-vocoder/src/lib/cvsd_encode_sb.cc b/gr-vocoder/lib/vocoder_cvsd_encode_sb.cc index df867f3ba..71cf6df8c 100644 --- a/gr-cvsd-vocoder/src/lib/cvsd_encode_sb.cc +++ b/gr-vocoder/lib/vocoder_cvsd_encode_sb.cc @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2007,2010 Free Software Foundation, Inc. + * Copyright 2007,2010,2011 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -29,28 +29,28 @@ #include "config.h" #endif -#include <cvsd_encode_sb.h> +#include <vocoder_cvsd_encode_sb.h> #include <gr_io_signature.h> #include <limits.h> /* - * Create a new instance of cvsd_encode_sb and return + * Create a new instance of vocoder_cvsd_encode_sb and return * a boost shared_ptr. This is effectively the public constructor. */ -cvsd_encode_sb_sptr -cvsd_make_encode_sb (short min_step, short max_step, double step_decay, - double accum_decay, int K, int J, - short pos_accum_max, short neg_accum_max) +vocoder_cvsd_encode_sb_sptr +vocoder_make_cvsd_encode_sb (short min_step, short max_step, double step_decay, + double accum_decay, int K, int J, + short pos_accum_max, short neg_accum_max) { - return gnuradio::get_initial_sptr(new cvsd_encode_sb (min_step, max_step, - step_decay, accum_decay, K, J, - pos_accum_max, neg_accum_max)); + return gnuradio::get_initial_sptr(new vocoder_cvsd_encode_sb (min_step, max_step, + step_decay, accum_decay, K, J, + pos_accum_max, neg_accum_max)); } -cvsd_encode_sb::cvsd_encode_sb (short min_step, short max_step, double step_decay, - double accum_decay, int K, int J, - short pos_accum_max, short neg_accum_max) - : gr_sync_decimator ("cvsd_encode_sb", +vocoder_cvsd_encode_sb::vocoder_cvsd_encode_sb (short min_step, short max_step, double step_decay, + double accum_decay, int K, int J, + short pos_accum_max, short neg_accum_max) + : gr_sync_decimator ("vocoder_cvsd_encode_sb", gr_make_io_signature (1, 1, sizeof (short)), gr_make_io_signature (1, 1, sizeof (unsigned char)), 8), @@ -68,12 +68,12 @@ cvsd_encode_sb::cvsd_encode_sb (short min_step, short max_step, double step_deca } -cvsd_encode_sb::~cvsd_encode_sb () +vocoder_cvsd_encode_sb::~vocoder_cvsd_encode_sb () { // nothing else required in this example } -unsigned char cvsd_encode_sb::cvsd_bitwise_sum (unsigned int input) +unsigned char vocoder_cvsd_encode_sb::cvsd_bitwise_sum (unsigned int input) { unsigned int temp=input; unsigned char bits=0; @@ -85,7 +85,7 @@ unsigned char cvsd_encode_sb::cvsd_bitwise_sum (unsigned int input) return bits; } -int cvsd_encode_sb::cvsd_round (double input) +int vocoder_cvsd_encode_sb::cvsd_round (double input) { double temp; temp=input+0.5; @@ -94,7 +94,7 @@ int cvsd_encode_sb::cvsd_round (double input) return (int)temp; } -unsigned int cvsd_encode_sb::cvsd_pow (short radix, short power) +unsigned int vocoder_cvsd_encode_sb::cvsd_pow (short radix, short power) { double d_radix = (double) radix; int i_power = (int) power; @@ -104,12 +104,10 @@ unsigned int cvsd_encode_sb::cvsd_pow (short radix, short power) return ( (unsigned int) cvsd_round(output)); } - - int -cvsd_encode_sb::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) +vocoder_cvsd_encode_sb::work (int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items) { const short *in = (const short *) input_items[0]; unsigned char *out = (unsigned char *) output_items[0]; diff --git a/gr-vocoder/lib/vocoder_g721_decode_bs.cc b/gr-vocoder/lib/vocoder_g721_decode_bs.cc new file mode 100644 index 000000000..2abee8d14 --- /dev/null +++ b/gr-vocoder/lib/vocoder_g721_decode_bs.cc @@ -0,0 +1,81 @@ +/* -*- c++ -*- */ +/* + * Copyright 2011 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio 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 General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <vocoder_g721_decode_bs.h> +#include <gr_io_signature.h> +#include <limits.h> + +extern "C" { +#include "g7xx/g72x.h" +} + +class vocoder_g721_decode_bs_impl : public vocoder_g721_decode_bs +{ +public: + + vocoder_g721_decode_bs_impl(); + ~vocoder_g721_decode_bs_impl(); + + int work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items); + +private: + + g72x_state d_state; + +}; + +vocoder_g721_decode_bs_sptr vocoder_make_g721_decode_bs() +{ + return gnuradio::get_initial_sptr(new vocoder_g721_decode_bs_impl()); +} + +vocoder_g721_decode_bs_impl::vocoder_g721_decode_bs_impl() + : gr_sync_block("vocoder_g721_decode_bs", + gr_make_io_signature (1, 1, sizeof (unsigned char)), + gr_make_io_signature (1, 1, sizeof (short))) +{ + g72x_init_state(&d_state); +} + +vocoder_g721_decode_bs_impl::~vocoder_g721_decode_bs_impl() +{ +} + +int +vocoder_g721_decode_bs_impl::work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items) +{ + const unsigned char *in = (const unsigned char *)input_items[0]; + short *out = (short *)output_items[0]; + + for(int i = 0; i < noutput_items; i++) + out[i] = g721_decoder(in[i], AUDIO_ENCODING_LINEAR, &d_state); + + return noutput_items; +} diff --git a/gr-vocoder/lib/vocoder_g721_encode_sb.cc b/gr-vocoder/lib/vocoder_g721_encode_sb.cc new file mode 100644 index 000000000..667e983dc --- /dev/null +++ b/gr-vocoder/lib/vocoder_g721_encode_sb.cc @@ -0,0 +1,81 @@ +/* -*- c++ -*- */ +/* + * Copyright 2011 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio 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 General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <vocoder_g721_encode_sb.h> +#include <gr_io_signature.h> +#include <limits.h> + +extern "C" { +#include "g7xx/g72x.h" +} + +class vocoder_g721_encode_sb_impl : public vocoder_g721_encode_sb +{ +public: + + vocoder_g721_encode_sb_impl(); + ~vocoder_g721_encode_sb_impl(); + + int work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items); + +private: + + g72x_state d_state; + +}; + +vocoder_g721_encode_sb_sptr vocoder_make_g721_encode_sb() +{ + return gnuradio::get_initial_sptr(new vocoder_g721_encode_sb_impl()); +} + +vocoder_g721_encode_sb_impl::vocoder_g721_encode_sb_impl() + : gr_sync_block("vocoder_g721_encode_sb", + gr_make_io_signature (1, 1, sizeof (short)), + gr_make_io_signature (1, 1, sizeof (unsigned char))) +{ + g72x_init_state(&d_state); +} + +vocoder_g721_encode_sb_impl::~vocoder_g721_encode_sb_impl() +{ +} + +int +vocoder_g721_encode_sb_impl::work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items) +{ + const short *in = (const short *)input_items[0]; + unsigned char *out = (unsigned char *)output_items[0]; + + for(int i = 0; i < noutput_items; i++) + out[i] = g721_encoder(in[i], AUDIO_ENCODING_LINEAR, &d_state); + + return noutput_items; +} diff --git a/gr-vocoder/lib/vocoder_g723_24_decode_bs.cc b/gr-vocoder/lib/vocoder_g723_24_decode_bs.cc new file mode 100644 index 000000000..2ea036c58 --- /dev/null +++ b/gr-vocoder/lib/vocoder_g723_24_decode_bs.cc @@ -0,0 +1,81 @@ +/* -*- c++ -*- */ +/* + * Copyright 2011 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio 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 General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <vocoder_g723_24_decode_bs.h> +#include <gr_io_signature.h> +#include <limits.h> + +extern "C" { +#include "g7xx/g72x.h" +} + +class vocoder_g723_24_decode_bs_impl : public vocoder_g723_24_decode_bs +{ +public: + + vocoder_g723_24_decode_bs_impl(); + ~vocoder_g723_24_decode_bs_impl(); + + int work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items); + +private: + + g72x_state d_state; + +}; + +vocoder_g723_24_decode_bs_sptr vocoder_make_g723_24_decode_bs() +{ + return gnuradio::get_initial_sptr(new vocoder_g723_24_decode_bs_impl()); +} + +vocoder_g723_24_decode_bs_impl::vocoder_g723_24_decode_bs_impl() + : gr_sync_block("vocoder_g723_24_decode_bs", + gr_make_io_signature (1, 1, sizeof (unsigned char)), + gr_make_io_signature (1, 1, sizeof (short))) +{ + g72x_init_state(&d_state); +} + +vocoder_g723_24_decode_bs_impl::~vocoder_g723_24_decode_bs_impl() +{ +} + +int +vocoder_g723_24_decode_bs_impl::work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items) +{ + const unsigned char *in = (const unsigned char *)input_items[0]; + short *out = (short *)output_items[0]; + + for(int i = 0; i < noutput_items; i++) + out[i] = g723_24_decoder(in[i], AUDIO_ENCODING_LINEAR, &d_state); + + return noutput_items; +} diff --git a/gr-vocoder/lib/vocoder_g723_24_encode_sb.cc b/gr-vocoder/lib/vocoder_g723_24_encode_sb.cc new file mode 100644 index 000000000..7e6914223 --- /dev/null +++ b/gr-vocoder/lib/vocoder_g723_24_encode_sb.cc @@ -0,0 +1,81 @@ +/* -*- c++ -*- */ +/* + * Copyright 2011 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio 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 General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <vocoder_g723_24_encode_sb.h> +#include <gr_io_signature.h> +#include <limits.h> + +extern "C" { +#include "g7xx/g72x.h" +} + +class vocoder_g723_24_encode_sb_impl : public vocoder_g723_24_encode_sb +{ +public: + + vocoder_g723_24_encode_sb_impl(); + ~vocoder_g723_24_encode_sb_impl(); + + int work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items); + +private: + + g72x_state d_state; + +}; + +vocoder_g723_24_encode_sb_sptr vocoder_make_g723_24_encode_sb() +{ + return gnuradio::get_initial_sptr(new vocoder_g723_24_encode_sb_impl()); +} + +vocoder_g723_24_encode_sb_impl::vocoder_g723_24_encode_sb_impl() + : gr_sync_block("vocoder_g723_24_encode_sb", + gr_make_io_signature (1, 1, sizeof (short)), + gr_make_io_signature (1, 1, sizeof (unsigned char))) +{ + g72x_init_state(&d_state); +} + +vocoder_g723_24_encode_sb_impl::~vocoder_g723_24_encode_sb_impl() +{ +} + +int +vocoder_g723_24_encode_sb_impl::work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items) +{ + const short *in = (const short *)input_items[0]; + unsigned char *out = (unsigned char *)output_items[0]; + + for(int i = 0; i < noutput_items; i++) + out[i] = g723_24_encoder(in[i], AUDIO_ENCODING_LINEAR, &d_state); + + return noutput_items; +} diff --git a/gr-vocoder/lib/vocoder_g723_40_decode_bs.cc b/gr-vocoder/lib/vocoder_g723_40_decode_bs.cc new file mode 100644 index 000000000..38fd0fb5e --- /dev/null +++ b/gr-vocoder/lib/vocoder_g723_40_decode_bs.cc @@ -0,0 +1,81 @@ +/* -*- c++ -*- */ +/* + * Copyright 2011 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio 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 General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <vocoder_g723_40_decode_bs.h> +#include <gr_io_signature.h> +#include <limits.h> + +extern "C" { +#include "g7xx/g72x.h" +} + +class vocoder_g723_40_decode_bs_impl : public vocoder_g723_40_decode_bs +{ +public: + + vocoder_g723_40_decode_bs_impl(); + ~vocoder_g723_40_decode_bs_impl(); + + int work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items); + +private: + + g72x_state d_state; + +}; + +vocoder_g723_40_decode_bs_sptr vocoder_make_g723_40_decode_bs() +{ + return gnuradio::get_initial_sptr(new vocoder_g723_40_decode_bs_impl()); +} + +vocoder_g723_40_decode_bs_impl::vocoder_g723_40_decode_bs_impl() + : gr_sync_block("vocoder_g723_40_decode_bs", + gr_make_io_signature (1, 1, sizeof (unsigned char)), + gr_make_io_signature (1, 1, sizeof (short))) +{ + g72x_init_state(&d_state); +} + +vocoder_g723_40_decode_bs_impl::~vocoder_g723_40_decode_bs_impl() +{ +} + +int +vocoder_g723_40_decode_bs_impl::work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items) +{ + const unsigned char *in = (const unsigned char *)input_items[0]; + short *out = (short *)output_items[0]; + + for(int i = 0; i < noutput_items; i++) + out[i] = g723_40_decoder(in[i], AUDIO_ENCODING_LINEAR, &d_state); + + return noutput_items; +} diff --git a/gr-vocoder/lib/vocoder_g723_40_encode_sb.cc b/gr-vocoder/lib/vocoder_g723_40_encode_sb.cc new file mode 100644 index 000000000..1089306e7 --- /dev/null +++ b/gr-vocoder/lib/vocoder_g723_40_encode_sb.cc @@ -0,0 +1,81 @@ +/* -*- c++ -*- */ +/* + * Copyright 2011 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio 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 General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <vocoder_g723_40_encode_sb.h> +#include <gr_io_signature.h> +#include <limits.h> + +extern "C" { +#include "g7xx/g72x.h" +} + +class vocoder_g723_40_encode_sb_impl : public vocoder_g723_40_encode_sb +{ +public: + + vocoder_g723_40_encode_sb_impl(); + ~vocoder_g723_40_encode_sb_impl(); + + int work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items); + +private: + + g72x_state d_state; + +}; + +vocoder_g723_40_encode_sb_sptr vocoder_make_g723_40_encode_sb() +{ + return gnuradio::get_initial_sptr(new vocoder_g723_40_encode_sb_impl()); +} + +vocoder_g723_40_encode_sb_impl::vocoder_g723_40_encode_sb_impl() + : gr_sync_block("vocoder_g723_40_encode_sb", + gr_make_io_signature (1, 1, sizeof (short)), + gr_make_io_signature (1, 1, sizeof (unsigned char))) +{ + g72x_init_state(&d_state); +} + +vocoder_g723_40_encode_sb_impl::~vocoder_g723_40_encode_sb_impl() +{ +} + +int +vocoder_g723_40_encode_sb_impl::work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items) +{ + const short *in = (const short *)input_items[0]; + unsigned char *out = (unsigned char *)output_items[0]; + + for(int i = 0; i < noutput_items; i++) + out[i] = g723_40_encoder(in[i], AUDIO_ENCODING_LINEAR, &d_state); + + return noutput_items; +} diff --git a/gr-gsm-fr-vocoder/src/lib/gsm_fr_decode_ps.cc b/gr-vocoder/lib/vocoder_gsm_fr_decode_ps.cc index 9b788dedf..986e0814e 100644 --- a/gr-gsm-fr-vocoder/src/lib/gsm_fr_decode_ps.cc +++ b/gr-vocoder/lib/vocoder_gsm_fr_decode_ps.cc @@ -23,7 +23,7 @@ #ifdef HAVE_CONFIG_H #include "config.h" #endif -#include "gsm_fr_decode_ps.h" +#include "vocoder_gsm_fr_decode_ps.h" extern "C"{ #include "gsm/gsm.h" } @@ -31,29 +31,29 @@ extern "C"{ #include <stdexcept> #include <assert.h> -gsm_fr_decode_ps_sptr -gsm_fr_make_decode_ps () +vocoder_gsm_fr_decode_ps_sptr +vocoder_make_gsm_fr_decode_ps () { - return gnuradio::get_initial_sptr(new gsm_fr_decode_ps ()); + return gnuradio::get_initial_sptr(new vocoder_gsm_fr_decode_ps ()); } -gsm_fr_decode_ps::gsm_fr_decode_ps () - : gr_sync_interpolator ("gsm_fr_decode_ps", +vocoder_gsm_fr_decode_ps::vocoder_gsm_fr_decode_ps () + : gr_sync_interpolator ("vocoder_gsm_fr_decode_ps", gr_make_io_signature (1, 1, sizeof (gsm_frame)), gr_make_io_signature (1, 1, sizeof (short)), GSM_SAMPLES_PER_FRAME) { if ((d_gsm = gsm_create ()) == 0) - throw std::runtime_error ("gsm_fr_decode_ps: gsm_create failed"); + throw std::runtime_error ("vocoder_gsm_fr_decode_ps: gsm_create failed"); } -gsm_fr_decode_ps::~gsm_fr_decode_ps () +vocoder_gsm_fr_decode_ps::~vocoder_gsm_fr_decode_ps () { gsm_destroy (d_gsm); } int -gsm_fr_decode_ps::work (int noutput_items, +vocoder_gsm_fr_decode_ps::work (int noutput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items) { diff --git a/gr-gsm-fr-vocoder/src/lib/gsm_fr_encode_sp.cc b/gr-vocoder/lib/vocoder_gsm_fr_encode_sp.cc index 10bd1fef8..7a69b856d 100644 --- a/gr-gsm-fr-vocoder/src/lib/gsm_fr_encode_sp.cc +++ b/gr-vocoder/lib/vocoder_gsm_fr_encode_sp.cc @@ -23,36 +23,36 @@ #ifdef HAVE_CONFIG_H #include "config.h" #endif -#include "gsm_fr_encode_sp.h" +#include "vocoder_gsm_fr_encode_sp.h" extern "C"{ #include "gsm/gsm.h" } #include <gr_io_signature.h> #include <stdexcept> -gsm_fr_encode_sp_sptr -gsm_fr_make_encode_sp () +vocoder_gsm_fr_encode_sp_sptr +vocoder_make_gsm_fr_encode_sp () { - return gnuradio::get_initial_sptr(new gsm_fr_encode_sp ()); + return gnuradio::get_initial_sptr(new vocoder_gsm_fr_encode_sp ()); } -gsm_fr_encode_sp::gsm_fr_encode_sp () - : gr_sync_decimator ("gsm_fr_encode_sp", +vocoder_gsm_fr_encode_sp::vocoder_gsm_fr_encode_sp () + : gr_sync_decimator ("vocoder_gsm_fr_encode_sp", gr_make_io_signature (1, 1, sizeof (short)), gr_make_io_signature (1, 1, sizeof (gsm_frame)), GSM_SAMPLES_PER_FRAME) { if ((d_gsm = gsm_create ()) == 0) - throw std::runtime_error ("gsm_fr_encode_sp: gsm_create failed"); + throw std::runtime_error ("vocoder_gsm_fr_encode_sp: gsm_create failed"); } -gsm_fr_encode_sp::~gsm_fr_encode_sp () +vocoder_gsm_fr_encode_sp::~vocoder_gsm_fr_encode_sp () { gsm_destroy (d_gsm); } int -gsm_fr_encode_sp::work (int noutput_items, +vocoder_gsm_fr_encode_sp::work (int noutput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items) { diff --git a/gr-vocoder/lib/vocoder_ulaw_decode_bs.cc b/gr-vocoder/lib/vocoder_ulaw_decode_bs.cc new file mode 100644 index 000000000..3ade9d3f0 --- /dev/null +++ b/gr-vocoder/lib/vocoder_ulaw_decode_bs.cc @@ -0,0 +1,65 @@ +/* -*- c++ -*- */ +/* + * Copyright 2011 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio 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 General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <vocoder_ulaw_decode_bs.h> +#include <gr_io_signature.h> +#include <limits.h> + +extern "C" { +#include "g7xx/g72x.h" +} + +vocoder_ulaw_decode_bs_sptr vocoder_make_ulaw_decode_bs() +{ + return gnuradio::get_initial_sptr(new vocoder_ulaw_decode_bs()); +} + +vocoder_ulaw_decode_bs::vocoder_ulaw_decode_bs() + : gr_sync_block("vocoder_ulaw_decode_bs", + gr_make_io_signature (1, 1, sizeof (unsigned char)), + gr_make_io_signature (1, 1, sizeof (short))) +{ +} + +vocoder_ulaw_decode_bs::~vocoder_ulaw_decode_bs() +{ +} + + + +int +vocoder_ulaw_decode_bs::work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items) +{ + const unsigned char *in = (const unsigned char *)input_items[0]; + short *out = (short *)output_items[0]; + + for(int i = 0; i < noutput_items; i++) + out[i] = ulaw2linear(in[i]); + + return noutput_items; +} diff --git a/gr-vocoder/lib/vocoder_ulaw_encode_sb.cc b/gr-vocoder/lib/vocoder_ulaw_encode_sb.cc new file mode 100644 index 000000000..19c53d72c --- /dev/null +++ b/gr-vocoder/lib/vocoder_ulaw_encode_sb.cc @@ -0,0 +1,63 @@ +/* -*- c++ -*- */ +/* + * Copyright 2011 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio 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 General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <vocoder_ulaw_encode_sb.h> +#include <gr_io_signature.h> +#include <limits.h> + +extern "C" { +#include "g7xx/g72x.h" +} + +vocoder_ulaw_encode_sb_sptr vocoder_make_ulaw_encode_sb() +{ + return gnuradio::get_initial_sptr(new vocoder_ulaw_encode_sb()); +} + +vocoder_ulaw_encode_sb::vocoder_ulaw_encode_sb() + : gr_sync_block("vocoder_ulaw_encode_sb", + gr_make_io_signature (1, 1, sizeof(short)), + gr_make_io_signature (1, 1, sizeof(unsigned char))) +{ +} + +vocoder_ulaw_encode_sb::~vocoder_ulaw_encode_sb() +{ +} + +int +vocoder_ulaw_encode_sb::work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items) +{ + const short *in = (const short *)input_items[0]; + unsigned char *out = (unsigned char *)output_items[0]; + + for(int i = 0; i < noutput_items; i++) + out[i] = linear2ulaw(in[i]); + + return noutput_items; +} diff --git a/gr-gsm-fr-vocoder/src/python/.gitignore b/gr-vocoder/python/.gitignore index bf03975bb..bf03975bb 100644 --- a/gr-gsm-fr-vocoder/src/python/.gitignore +++ b/gr-vocoder/python/.gitignore diff --git a/gr-vocoder/python/CMakeLists.txt b/gr-vocoder/python/CMakeLists.txt new file mode 100644 index 000000000..c3702ad70 --- /dev/null +++ b/gr-vocoder/python/CMakeLists.txt @@ -0,0 +1,50 @@ +# Copyright 2011 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio 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 General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. + +######################################################################## +# Setup python install +######################################################################## +INCLUDE(GrPython) + +GR_PYTHON_INSTALL( + FILES + __init__.py + cvsd.py + DESTINATION ${GR_PYTHON_DIR}/gnuradio/vocoder + COMPONENT "vocoder_python" +) + +######################################################################## +# Handle the unit tests +######################################################################## +IF(ENABLE_TESTING) +INCLUDE(GrTest) +FILE(GLOB py_qa_test_files "qa_*.py") +FOREACH(py_qa_test_file ${py_qa_test_files}) + GET_FILENAME_COMPONENT(py_qa_test_name ${py_qa_test_file} NAME_WE) + SET(GR_TEST_PYTHON_DIRS + ${CMAKE_BINARY_DIR}/gnuradio-core/src/python + ${CMAKE_BINARY_DIR}/gnuradio-core/src/lib/swig + ${CMAKE_BINARY_DIR}/gr-vocoder/python + ${CMAKE_BINARY_DIR}/gr-vocoder/swig + ) + SET(GR_TEST_TARGET_DEPS gruel gnuradio-core gnuradio-vocoder) + GR_ADD_TEST(${py_qa_test_name} ${PYTHON_EXECUTABLE} ${py_qa_test_file}) +ENDFOREACH(py_qa_test_file) +ENDIF(ENABLE_TESTING) diff --git a/gr-cvsd-vocoder/src/python/Makefile.am b/gr-vocoder/python/Makefile.am index e6fd74828..4b6146ca7 100644 --- a/gr-cvsd-vocoder/src/python/Makefile.am +++ b/gr-vocoder/python/Makefile.am @@ -1,5 +1,5 @@ # -# Copyright 2004,2009,2010 Free Software Foundation, Inc. +# Copyright 2011 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -21,16 +21,22 @@ include $(top_srcdir)/Makefile.common -EXTRA_DIST += run_tests.in -DISTCLEANFILES += run_tests -TESTS = run_tests +vocoderdir = $(grpythondir)/vocoder +TESTS = run_tests -grblkspythondir = $(grpythondir)/blks2impl +noinst_PYTHON = \ + qa_alaw_vocoder.py \ + qa_codec2_vocoder.py \ + qa_cvsd_vocoder.py \ + qa_g721_vocoder.py \ + qa_g723_24_vocoder.py \ + qa_g723_40_vocoder.py \ + qa_gsm_full_rate.py \ + qa_ulaw_vocoder.py -grblkspython_PYTHON = \ +vocoder_PYTHON = \ + __init__.py \ cvsd.py -noinst_PYTHON = \ - encdec.py \ - qa_cvsd_vocoder.py +EXTRA_DIST += run_tests.in diff --git a/gr-gsm-fr-vocoder/src/Makefile.am b/gr-vocoder/python/__init__.py index be38b7c1a..eb5fa6fc1 100644 --- a/gr-gsm-fr-vocoder/src/Makefile.am +++ b/gr-vocoder/python/__init__.py @@ -1,5 +1,5 @@ # -# Copyright 2004 Free Software Foundation, Inc. +# Copyright 2011 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -19,7 +19,5 @@ # Boston, MA 02110-1301, USA. # -SUBDIRS = lib -if PYTHON -SUBDIRS += python -endif +from vocoder_swig import * +from cvsd import * diff --git a/gr-cvsd-vocoder/src/python/cvsd.py b/gr-vocoder/python/cvsd.py index 4defbf9a2..27b06ddeb 100644 --- a/gr-cvsd-vocoder/src/python/cvsd.py +++ b/gr-vocoder/python/cvsd.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2007 Free Software Foundation, Inc. +# Copyright 2007,2011 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -21,9 +21,9 @@ # from gnuradio import gr -from gnuradio.vocoder import cvsd_vocoder +import vocoder_swig -class cvsd_encode(gr.hier_block2): +class cvsd_encode_fb(gr.hier_block2): ''' This is a wrapper for the CVSD encoder that performs interpolation and filtering necessary to work with the vocoding. It converts an incoming float (+-1) to a short, scales @@ -50,12 +50,12 @@ class cvsd_encode(gr.hier_block2): taps = gr.firdes.low_pass(self.interp, self.interp, bw, 2*bw) interp = gr.interp_fir_filter_fff(self.interp, taps) f2s = gr.float_to_short() - enc = cvsd_vocoder.encode_sb() + enc = vocoder_swig.cvsd_encode_sb() self.connect(self, src_scale, interp, f2s, enc, self) -class cvsd_decode(gr.hier_block2): +class cvsd_decode_bf(gr.hier_block2): ''' This is a wrapper for the CVSD decoder that performs decimation and filtering necessary to work with the vocoding. It converts an incoming CVSD-encoded short to a float, decodes it @@ -77,11 +77,10 @@ class cvsd_decode(gr.hier_block2): scale_factor = 32000.0 self.decim = resample - dec = cvsd_vocoder.decode_bs() + dec = vocoder_swig.cvsd_decode_bs() s2f = gr.short_to_float() taps = gr.firdes.low_pass(1, 1, bw, 2*bw) decim = gr.fir_filter_fff(self.decim, taps) sink_scale = gr.multiply_const_ff(1.0/scale_factor) self.connect(self, dec, s2f, decim, sink_scale, self) - diff --git a/gr-gsm-fr-vocoder/src/python/Makefile.am b/gr-vocoder/python/qa_alaw_vocoder.py index 8a97395ee..b7b937138 100644..100755 --- a/gr-gsm-fr-vocoder/src/python/Makefile.am +++ b/gr-vocoder/python/qa_alaw_vocoder.py @@ -1,5 +1,6 @@ +#!/usr/bin/env python # -# Copyright 2004 Free Software Foundation, Inc. +# Copyright 2011 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -19,12 +20,20 @@ # Boston, MA 02110-1301, USA. # -include $(top_srcdir)/Makefile.common +from gnuradio import gr, gr_unittest +from vocoder_swig import * -EXTRA_DIST += run_tests.in +class test_alaw_vocoder (gr_unittest.TestCase): -TESTS = run_tests + def setUp (self): + self.tb = gr.top_block() + + def tearDown (self): + self.tb = None -noinst_PYTHON = \ - encdec.py \ - qa_gsm_full_rate.py + def test001_module_load (self): + enc = alaw_encode_sb(); + dec = alaw_decode_bs(); + +if __name__ == '__main__': + gr_unittest.run(test_alaw_vocoder, "test_alaw_vocoder.xml") diff --git a/gr-vocoder/python/qa_codec2_vocoder.py b/gr-vocoder/python/qa_codec2_vocoder.py new file mode 100755 index 000000000..699bb7dda --- /dev/null +++ b/gr-vocoder/python/qa_codec2_vocoder.py @@ -0,0 +1,39 @@ +#!/usr/bin/env python +# +# Copyright 2011 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio 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 General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. +# + +from gnuradio import gr, gr_unittest +from vocoder_swig import * + +class test_codec2_vocoder (gr_unittest.TestCase): + + def setUp (self): + self.tb = gr.top_block() + + def tearDown (self): + self.tb = None + + def test001_module_load (self): + raw_enc = codec2_encode_sp(); + raw_dec = codec2_decode_ps(); + +if __name__ == '__main__': + gr_unittest.run(test_codec2_vocoder, "test_codec2_vocoder.xml") diff --git a/gr-cvsd-vocoder/src/python/qa_cvsd_vocoder.py b/gr-vocoder/python/qa_cvsd_vocoder.py index 99a38d946..53045e4a9 100755 --- a/gr-cvsd-vocoder/src/python/qa_cvsd_vocoder.py +++ b/gr-vocoder/python/qa_cvsd_vocoder.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2007,2010 Free Software Foundation, Inc. +# Copyright 2007,2010,2011 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -20,17 +20,25 @@ # Boston, MA 02110-1301, USA. # -from gnuradio import gr, gr_unittest, blks2 -import cvsd_vocoder +from gnuradio import gr, gr_unittest +from vocoder_swig import * +from cvsd import * class test_cvsd_vocoder (gr_unittest.TestCase): def setUp (self): self.tb = gr.top_block() - + def tearDown (self): self.tb = None + def test001_module_load (self): + raw_enc = cvsd_encode_sb(); + raw_dec = cvsd_decode_bs(); + hb_enc = cvsd_encode_fb(); + hb_dec = cvsd_decode_bf(); + + """ Disable for now def test01(self): sample_rate = 8000 diff --git a/gr-vocoder/python/qa_g721_vocoder.py b/gr-vocoder/python/qa_g721_vocoder.py new file mode 100755 index 000000000..79cc944f3 --- /dev/null +++ b/gr-vocoder/python/qa_g721_vocoder.py @@ -0,0 +1,39 @@ +#!/usr/bin/env python +# +# Copyright 2011 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio 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 General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. +# + +from gnuradio import gr, gr_unittest +from vocoder_swig import * + +class test_g721_vocoder (gr_unittest.TestCase): + + def setUp (self): + self.tb = gr.top_block() + + def tearDown (self): + self.tb = None + + def test001_module_load (self): + enc = g721_encode_sb(); + dec = g721_decode_bs(); + +if __name__ == '__main__': + gr_unittest.run(test_g721_vocoder, "test_g721_vocoder.xml") diff --git a/gr-vocoder/python/qa_g723_24_vocoder.py b/gr-vocoder/python/qa_g723_24_vocoder.py new file mode 100755 index 000000000..ccf215f46 --- /dev/null +++ b/gr-vocoder/python/qa_g723_24_vocoder.py @@ -0,0 +1,39 @@ +#!/usr/bin/env python +# +# Copyright 2011 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio 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 General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. +# + +from gnuradio import gr, gr_unittest +from vocoder_swig import * + +class test_g723_24_vocoder (gr_unittest.TestCase): + + def setUp (self): + self.tb = gr.top_block() + + def tearDown (self): + self.tb = None + + def test001_module_load (self): + enc = g723_24_encode_sb(); + dec = g723_24_decode_bs(); + +if __name__ == '__main__': + gr_unittest.run(test_g723_24_vocoder, "test_g723_24_vocoder.xml") diff --git a/gr-vocoder/python/qa_g723_40_vocoder.py b/gr-vocoder/python/qa_g723_40_vocoder.py new file mode 100755 index 000000000..9e6a52339 --- /dev/null +++ b/gr-vocoder/python/qa_g723_40_vocoder.py @@ -0,0 +1,39 @@ +#!/usr/bin/env python +# +# Copyright 2011 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio 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 General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. +# + +from gnuradio import gr, gr_unittest +from vocoder_swig import * + +class test_g723_40_vocoder (gr_unittest.TestCase): + + def setUp (self): + self.tb = gr.top_block() + + def tearDown (self): + self.tb = None + + def test001_module_load (self): + enc = g723_40_encode_sb(); + dec = g723_40_decode_bs(); + +if __name__ == '__main__': + gr_unittest.run(test_g723_40_vocoder, "test_g723_40_vocoder.xml") diff --git a/gr-gsm-fr-vocoder/src/python/qa_gsm_full_rate.py b/gr-vocoder/python/qa_gsm_full_rate.py index 4164a1965..f9125905c 100755 --- a/gr-gsm-fr-vocoder/src/python/qa_gsm_full_rate.py +++ b/gr-vocoder/python/qa_gsm_full_rate.py @@ -21,7 +21,7 @@ # from gnuradio import gr, gr_unittest -import gsm_full_rate +import vocoder_swig class test_gsm_vocoder (gr_unittest.TestCase): @@ -31,5 +31,9 @@ class test_gsm_vocoder (gr_unittest.TestCase): def tearDown (self): self.tb = None + def test001_module_load (self): + enc = vocoder_swig.gsm_fr_encode_sp(); + dec = vocoder_swig.gsm_fr_decode_ps(); + if __name__ == '__main__': gr_unittest.run(test_gsm_vocoder, "test_gsm_vocoder.xml") diff --git a/gr-vocoder/python/qa_ulaw_vocoder.py b/gr-vocoder/python/qa_ulaw_vocoder.py new file mode 100755 index 000000000..0e201638c --- /dev/null +++ b/gr-vocoder/python/qa_ulaw_vocoder.py @@ -0,0 +1,39 @@ +#!/usr/bin/env python +# +# Copyright 2011 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio 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 General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. +# + +from gnuradio import gr, gr_unittest +from vocoder_swig import * + +class test_ulaw_vocoder (gr_unittest.TestCase): + + def setUp (self): + self.tb = gr.top_block() + + def tearDown (self): + self.tb = None + + def test001_module_load (self): + enc = ulaw_encode_sb(); + dec = ulaw_decode_bs(); + +if __name__ == '__main__': + gr_unittest.run(test_ulaw_vocoder, "test_ulaw_vocoder.xml") diff --git a/gr-cvsd-vocoder/src/python/run_tests.in b/gr-vocoder/python/run_tests.in index be969e287..e0c61a6b4 100644 --- a/gr-cvsd-vocoder/src/python/run_tests.in +++ b/gr-vocoder/python/run_tests.in @@ -5,6 +5,6 @@ # 3rd parameter is path to Python QA directory @top_builddir@/run_tests.sh \ - @abs_top_srcdir@/gr-cvsd-vocoder \ - @abs_top_builddir@/gr-cvsd-vocoder \ + @abs_top_srcdir@/gr-vocoder \ + @abs_top_builddir@/gr-vocoder \ @srcdir@ diff --git a/gr-vocoder/swig/.gitignore b/gr-vocoder/swig/.gitignore new file mode 100644 index 000000000..b336cc7ce --- /dev/null +++ b/gr-vocoder/swig/.gitignore @@ -0,0 +1,2 @@ +/Makefile +/Makefile.in diff --git a/gr-vocoder/swig/CMakeLists.txt b/gr-vocoder/swig/CMakeLists.txt new file mode 100644 index 000000000..61d123a74 --- /dev/null +++ b/gr-vocoder/swig/CMakeLists.txt @@ -0,0 +1,61 @@ +# Copyright 2011 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio 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 General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. + +######################################################################## +# Setup swig generation +######################################################################## +INCLUDE(GrPython) +INCLUDE(GrSwig) + +SET(GR_SWIG_INCLUDE_DIRS + ${GR_VOCODER_INCLUDE_DIRS} + ${GNURADIO_CORE_SWIG_INCLUDE_DIRS} +) + +SET(GR_SWIG_LIBRARIES gnuradio-vocoder) + +GR_SWIG_MAKE(vocoder_swig vocoder_swig.i) + +GR_SWIG_INSTALL( + TARGETS vocoder_swig + DESTINATION ${GR_PYTHON_DIR}/gnuradio/vocoder + COMPONENT "vocoder_python" +) + +INSTALL( + FILES + vocoder_alaw_decode_bs.i + vocoder_alaw_encode_sb.i + vocoder_codec2_decode_ps.i + vocoder_codec2_encode_sp.i + vocoder_cvsd_decode_bs.i + vocoder_cvsd_encode_sb.i + vocoder_g721_decode_bs.i + vocoder_g721_encode_sb.i + vocoder_g723_24_decode_bs.i + vocoder_g723_24_encode_sb.i + vocoder_g723_40_decode_bs.i + vocoder_g723_40_encode_sb.i + vocoder_gsm_fr_encode_sp.i + vocoder_gsm_fr_decode_ps.i + vocoder_ulaw_decode_bs.i + vocoder_ulaw_encode_sb.i + DESTINATION ${GR_INCLUDE_DIR}/gnuradio/swig + COMPONENT "vocoder_swig" +) diff --git a/gr-vocoder/swig/Makefile.am b/gr-vocoder/swig/Makefile.am new file mode 100644 index 000000000..500d72ec7 --- /dev/null +++ b/gr-vocoder/swig/Makefile.am @@ -0,0 +1,82 @@ +# +# Copyright 2011 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio 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 General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. +# + +include $(top_srcdir)/Makefile.common +include $(top_srcdir)/Makefile.swig + +TESTS = +EXTRA_DIST += $(nobase_guile_DATA) + +AM_CPPFLAGS = \ + -I$(abs_top_srcdir)/gr-vocoder/include \ + $(STD_DEFINES_AND_INCLUDES) \ + $(PYTHON_CPPFLAGS) \ + $(WITH_INCLUDES) + +if GUILE +nobase_guile_DATA = \ + gnuradio/vocoder_swig.scm +endif + +noinst_GUILE = vocoder.test + + +############################## +# SWIG interface and library +TOP_SWIG_IFILES = \ + vocoder_swig.i + +# Install so that they end up available as: +# import gnuradio.vocoder +# This ends up at: +# ${prefix}/lib/python${python_version}/site-packages/gnuradio/vocoder +vocoder_swig_pythondir_category = \ + gnuradio/vocoder + +# additional libraries for linking with the SWIG-generated library +vocoder_swig_la_swig_libadd = \ + $(abs_top_builddir)/gr-vocoder/lib/libgnuradio-vocoder.la + +# additional SWIG files to be installed +vocoder_swig_swiginclude_headers = \ + vocoder_alaw_decode_bs.i \ + vocoder_alaw_encode_sb.i \ + vocoder_codec2_decode_ps.i \ + vocoder_codec2_encode_sp.i \ + vocoder_cvsd_decode_bs.i \ + vocoder_cvsd_encode_sb.i \ + vocoder_g721_decode_bs.i \ + vocoder_g721_encode_sb.i \ + vocoder_g723_24_decode_bs.i \ + vocoder_g723_24_encode_sb.i \ + vocoder_g723_40_decode_bs.i \ + vocoder_g723_40_encode_sb.i \ + vocoder_gsm_fr_encode_sp.i \ + vocoder_gsm_fr_decode_ps.i \ + vocoder_ulaw_decode_bs.i \ + vocoder_ulaw_encode_sb.i + +vocoder_swig_swig_args = \ + -I$(abs_top_builddir)/gr-vocoder/lib + +if GUILE +TESTS += run_guile_tests +endif diff --git a/gr-cvsd-vocoder/src/lib/Makefile.swig.gen b/gr-vocoder/swig/Makefile.swig.gen index 8e22f0a98..b0d0504a8 100644 --- a/gr-cvsd-vocoder/src/lib/Makefile.swig.gen +++ b/gr-vocoder/swig/Makefile.swig.gen @@ -20,37 +20,37 @@ # Boston, MA 02110-1301, USA. # -# Makefile.swig.gen for cvsd_vocoder.i +# Makefile.swig.gen for vocoder_swig.i ## Default install locations for these files: ## ## Default location for the Python directory is: -## ${prefix}/lib/python${python_version}/site-packages/[category]/cvsd_vocoder +## ${prefix}/lib/python${python_version}/site-packages/[category]/vocoder_swig ## Default location for the Python exec directory is: -## ${exec_prefix}/lib/python${python_version}/site-packages/[category]/cvsd_vocoder +## ${exec_prefix}/lib/python${python_version}/site-packages/[category]/vocoder_swig ## ## The following can be overloaded to change the install location, but ## this has to be done in the including Makefile.am -before- ## Makefile.swig is included. -cvsd_vocoder_pythondir_category ?= gnuradio/cvsd_vocoder -cvsd_vocoder_pylibdir_category ?= $(cvsd_vocoder_pythondir_category) -cvsd_vocoder_pythondir = $(pythondir)/$(cvsd_vocoder_pythondir_category) -cvsd_vocoder_pylibdir = $(pyexecdir)/$(cvsd_vocoder_pylibdir_category) +vocoder_swig_pythondir_category ?= gnuradio/vocoder_swig +vocoder_swig_pylibdir_category ?= $(vocoder_swig_pythondir_category) +vocoder_swig_pythondir = $(pythondir)/$(vocoder_swig_pythondir_category) +vocoder_swig_pylibdir = $(pyexecdir)/$(vocoder_swig_pylibdir_category) # The .so libraries for the guile modules get installed whereever guile # is installed, usually /usr/lib/guile/gnuradio/ # FIXME: determince whether these should be installed with gnuradio. -cvsd_vocoder_scmlibdir = $(libdir) +vocoder_swig_scmlibdir = $(libdir) # The scm files for the guile modules get installed where ever guile -# is installed, usually /usr/share/guile/site/cvsd_vocoder +# is installed, usually /usr/share/guile/site/vocoder_swig # FIXME: determince whether these should be installed with gnuradio. -cvsd_vocoder_scmdir = $(guiledir) +vocoder_swig_scmdir = $(guiledir) ## SWIG headers are always installed into the same directory. -cvsd_vocoder_swigincludedir = $(swigincludedir) +vocoder_swig_swigincludedir = $(swigincludedir) ## This is a template file for a "generated" Makefile addition (in ## this case, "Makefile.swig.gen"). By including the top-level @@ -75,70 +75,70 @@ MOSTLYCLEANFILES += $(DEPDIR)/*.S* ## Makefile.am by setting the variable value there, then including ## Makefile.swig . -cvsd_vocoder_swiginclude_HEADERS = \ - cvsd_vocoder.i \ - $(cvsd_vocoder_swiginclude_headers) +vocoder_swig_swiginclude_HEADERS = \ + vocoder_swig.i \ + $(vocoder_swig_swiginclude_headers) if PYTHON -cvsd_vocoder_pylib_LTLIBRARIES = \ - _cvsd_vocoder.la +vocoder_swig_pylib_LTLIBRARIES = \ + _vocoder_swig.la -_cvsd_vocoder_la_SOURCES = \ - python/cvsd_vocoder.cc \ - $(cvsd_vocoder_la_swig_sources) +_vocoder_swig_la_SOURCES = \ + python/vocoder_swig.cc \ + $(vocoder_swig_la_swig_sources) -cvsd_vocoder_python_PYTHON = \ - cvsd_vocoder.py \ - $(cvsd_vocoder_python) +vocoder_swig_python_PYTHON = \ + vocoder_swig.py \ + $(vocoder_swig_python) -_cvsd_vocoder_la_LIBADD = \ +_vocoder_swig_la_LIBADD = \ $(STD_SWIG_LA_LIB_ADD) \ - $(cvsd_vocoder_la_swig_libadd) + $(vocoder_swig_la_swig_libadd) -_cvsd_vocoder_la_LDFLAGS = \ +_vocoder_swig_la_LDFLAGS = \ $(STD_SWIG_LA_LD_FLAGS) \ - $(cvsd_vocoder_la_swig_ldflags) + $(vocoder_swig_la_swig_ldflags) -_cvsd_vocoder_la_CXXFLAGS = \ +_vocoder_swig_la_CXXFLAGS = \ $(STD_SWIG_CXX_FLAGS) \ -I$(top_builddir) \ - $(cvsd_vocoder_la_swig_cxxflags) + $(vocoder_swig_la_swig_cxxflags) -python/cvsd_vocoder.cc: cvsd_vocoder.py -cvsd_vocoder.py: cvsd_vocoder.i +python/vocoder_swig.cc: vocoder_swig.py +vocoder_swig.py: vocoder_swig.i # Include the python dependencies for this file --include python/cvsd_vocoder.d +-include python/vocoder_swig.d endif # end of if python if GUILE -cvsd_vocoder_scmlib_LTLIBRARIES = \ - libguile-gnuradio-cvsd_vocoder.la -libguile_gnuradio_cvsd_vocoder_la_SOURCES = \ - guile/cvsd_vocoder.cc \ - $(cvsd_vocoder_la_swig_sources) -nobase_cvsd_vocoder_scm_DATA = \ - gnuradio/cvsd_vocoder.scm \ - gnuradio/cvsd_vocoder-primitive.scm -libguile_gnuradio_cvsd_vocoder_la_LIBADD = \ +vocoder_swig_scmlib_LTLIBRARIES = \ + libguile-gnuradio-vocoder_swig.la +libguile_gnuradio_vocoder_swig_la_SOURCES = \ + guile/vocoder_swig.cc \ + $(vocoder_swig_la_swig_sources) +nobase_vocoder_swig_scm_DATA = \ + gnuradio/vocoder_swig.scm \ + gnuradio/vocoder_swig-primitive.scm +libguile_gnuradio_vocoder_swig_la_LIBADD = \ $(STD_SWIG_LA_LIB_ADD) \ - $(cvsd_vocoder_la_swig_libadd) -libguile_gnuradio_cvsd_vocoder_la_LDFLAGS = \ + $(vocoder_swig_la_swig_libadd) +libguile_gnuradio_vocoder_swig_la_LDFLAGS = \ $(STD_SWIG_LA_LD_FLAGS) \ - $(cvsd_vocoder_la_swig_ldflags) -libguile_gnuradio_cvsd_vocoder_la_CXXFLAGS = \ + $(vocoder_swig_la_swig_ldflags) +libguile_gnuradio_vocoder_swig_la_CXXFLAGS = \ $(STD_SWIG_CXX_FLAGS) \ -I$(top_builddir) \ - $(cvsd_vocoder_la_swig_cxxflags) + $(vocoder_swig_la_swig_cxxflags) -guile/cvsd_vocoder.cc: gnuradio/cvsd_vocoder.scm -gnuradio/cvsd_vocoder.scm: cvsd_vocoder.i -gnuradio/cvsd_vocoder-primitive.scm: gnuradio/cvsd_vocoder.scm +guile/vocoder_swig.cc: gnuradio/vocoder_swig.scm +gnuradio/vocoder_swig.scm: vocoder_swig.i +gnuradio/vocoder_swig-primitive.scm: gnuradio/vocoder_swig.scm # Include the guile dependencies for this file --include guile/cvsd_vocoder.d +-include guile/vocoder_swig.d endif # end of GUILE diff --git a/gr-vocoder/swig/run_guile_tests.in b/gr-vocoder/swig/run_guile_tests.in new file mode 100644 index 000000000..5d08b0dd5 --- /dev/null +++ b/gr-vocoder/swig/run_guile_tests.in @@ -0,0 +1,14 @@ +#!/bin/sh + +. @top_builddir@/setup_guile_test_env + +# 1st argument is absolute path to hand coded guile source directory +# 2nd argument is absolute path to component C++ shared library build directory +# 3nd argument is absolute path to component SWIG build directory + +add_local_paths \ + @srcdir@ \ + @abs_builddir@ \ + @abs_builddir@ + +@GUILE@ -e main -c '(use-modules (gnuradio test-suite guile-test))' -t @srcdir@ diff --git a/gr-vocoder/swig/vocoder_alaw_decode_bs.i b/gr-vocoder/swig/vocoder_alaw_decode_bs.i new file mode 100644 index 000000000..f789c454f --- /dev/null +++ b/gr-vocoder/swig/vocoder_alaw_decode_bs.i @@ -0,0 +1,35 @@ +/* -*- c++ -*- */ +/* + * Copyright 2011 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio 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 General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +%{ +#include "vocoder_alaw_decode_bs.h" +%} + +GR_SWIG_BLOCK_MAGIC(vocoder,alaw_decode_bs); + +vocoder_alaw_decode_bs_sptr vocoder_make_alaw_decode_bs(); + +class vocoder_alaw_decode_bs : public gr_sync_block +{ +private: + vocoder_alaw_decode_bs(); +}; diff --git a/gr-vocoder/swig/vocoder_alaw_encode_sb.i b/gr-vocoder/swig/vocoder_alaw_encode_sb.i new file mode 100644 index 000000000..9fe537d55 --- /dev/null +++ b/gr-vocoder/swig/vocoder_alaw_encode_sb.i @@ -0,0 +1,35 @@ +/* -*- c++ -*- */ +/* + * Copyright 2011 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio 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 General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +%{ +#include "vocoder_alaw_encode_sb.h" +%} + +GR_SWIG_BLOCK_MAGIC(vocoder,alaw_encode_sb); + +vocoder_alaw_encode_sb_sptr vocoder_make_alaw_encode_sb(); + +class vocoder_alaw_encode_sb : public gr_sync_block +{ +private: + vocoder_alaw_encode_sb(); +}; diff --git a/gr-vocoder/swig/vocoder_codec2_decode_ps.i b/gr-vocoder/swig/vocoder_codec2_decode_ps.i new file mode 100644 index 000000000..e53cb078a --- /dev/null +++ b/gr-vocoder/swig/vocoder_codec2_decode_ps.i @@ -0,0 +1,34 @@ +/* -*- c++ -*- */ +/* + * Copyright 2011 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio 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 General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +%{ +#include "vocoder_codec2_decode_ps.h" +%} + +GR_SWIG_BLOCK_MAGIC(vocoder,codec2_decode_ps); + +vocoder_codec2_decode_ps_sptr vocoder_make_codec2_decode_ps (); + +class vocoder_codec2_decode_ps : public gr_sync_interpolator { +public: + ~vocoder_codec2_decode_ps (); +}; diff --git a/gr-vocoder/swig/vocoder_codec2_encode_sp.i b/gr-vocoder/swig/vocoder_codec2_encode_sp.i new file mode 100644 index 000000000..84f26954d --- /dev/null +++ b/gr-vocoder/swig/vocoder_codec2_encode_sp.i @@ -0,0 +1,34 @@ +/* -*- c++ -*- */ +/* + * Copyright 2011 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio 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 General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +%{ +#include "vocoder_codec2_encode_sp.h" +%} + +GR_SWIG_BLOCK_MAGIC(vocoder,codec2_encode_sp); + +vocoder_codec2_encode_sp_sptr vocoder_make_codec2_encode_sp (); + +class vocoder_codec2_encode_sp : public gr_sync_decimator { +public: + ~vocoder_codec2_encode_sp (); +}; diff --git a/gr-vocoder/swig/vocoder_cvsd_decode_bs.i b/gr-vocoder/swig/vocoder_cvsd_decode_bs.i new file mode 100644 index 000000000..e990f5440 --- /dev/null +++ b/gr-vocoder/swig/vocoder_cvsd_decode_bs.i @@ -0,0 +1,44 @@ +/* -*- c++ -*- */ +/* + * Copyright 2007,2009,2011 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio 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 General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +%{ +#include "vocoder_cvsd_decode_bs.h" +%} + +GR_SWIG_BLOCK_MAGIC(vocoder,cvsd_decode_bs); + +vocoder_cvsd_decode_bs_sptr vocoder_make_cvsd_decode_bs (short min_step=10, + short max_step=1280, + double step_decay=0.9990234375, + double accum_decay= 0.96875, + int K=32, + int J=4, + short pos_accum_max=32767, + short neg_accum_max=-32767); + +class vocoder_cvsd_decode_bs : public gr_sync_interpolator +{ +private: + vocoder_cvsd_decode_bs (short min_step, short max_step, double step_decay, + double accum_decay, int K, int J, + short pos_accum_max, short neg_accum_max); +}; diff --git a/gr-vocoder/swig/vocoder_cvsd_encode_sb.i b/gr-vocoder/swig/vocoder_cvsd_encode_sb.i new file mode 100644 index 000000000..5db7b3a48 --- /dev/null +++ b/gr-vocoder/swig/vocoder_cvsd_encode_sb.i @@ -0,0 +1,44 @@ +/* -*- c++ -*- */ +/* + * Copyright 2007,2009,2011 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio 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 General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +%{ +#include "vocoder_cvsd_encode_sb.h" +%} + +GR_SWIG_BLOCK_MAGIC(vocoder,cvsd_encode_sb); + +vocoder_cvsd_encode_sb_sptr vocoder_make_cvsd_encode_sb (short min_step=10, + short max_step=1280, + double step_decay=0.9990234375, + double accum_decay= 0.96875, + int K=32, + int J=4, + short pos_accum_max=32767, + short neg_accum_max=-32767); + +class vocoder_cvsd_encode_sb : public gr_sync_decimator +{ +private: + vocoder_cvsd_encode_sb (short min_step, short max_step, double step_decay, + double accum_decay, int K, int J, + short pos_accum_max, short neg_accum_max); +}; diff --git a/gr-vocoder/swig/vocoder_g721_decode_bs.i b/gr-vocoder/swig/vocoder_g721_decode_bs.i new file mode 100644 index 000000000..47e7d2861 --- /dev/null +++ b/gr-vocoder/swig/vocoder_g721_decode_bs.i @@ -0,0 +1,33 @@ +/* -*- c++ -*- */ +/* + * Copyright 2011 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio 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 General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +%{ +#include "vocoder_g721_decode_bs.h" +%} + +GR_SWIG_BLOCK_MAGIC(vocoder,g721_decode_bs); + +vocoder_g721_decode_bs_sptr vocoder_make_g721_decode_bs(); + +class vocoder_g721_decode_bs : public gr_sync_block +{ +}; diff --git a/gr-vocoder/swig/vocoder_g721_encode_sb.i b/gr-vocoder/swig/vocoder_g721_encode_sb.i new file mode 100644 index 000000000..0675087a0 --- /dev/null +++ b/gr-vocoder/swig/vocoder_g721_encode_sb.i @@ -0,0 +1,33 @@ +/* -*- c++ -*- */ +/* + * Copyright 2011 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio 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 General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +%{ +#include "vocoder_g721_encode_sb.h" +%} + +GR_SWIG_BLOCK_MAGIC(vocoder,g721_encode_sb); + +vocoder_g721_encode_sb_sptr vocoder_make_g721_encode_sb(); + +class vocoder_g721_encode_sb : public gr_sync_block +{ +}; diff --git a/gr-vocoder/swig/vocoder_g723_24_decode_bs.i b/gr-vocoder/swig/vocoder_g723_24_decode_bs.i new file mode 100644 index 000000000..41548059f --- /dev/null +++ b/gr-vocoder/swig/vocoder_g723_24_decode_bs.i @@ -0,0 +1,33 @@ +/* -*- c++ -*- */ +/* + * Copyright 2011 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio 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 General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +%{ +#include "vocoder_g723_24_decode_bs.h" +%} + +GR_SWIG_BLOCK_MAGIC(vocoder,g723_24_decode_bs); + +vocoder_g723_24_decode_bs_sptr vocoder_make_g723_24_decode_bs(); + +class vocoder_g723_24_decode_bs : public gr_sync_block +{ +}; diff --git a/gr-vocoder/swig/vocoder_g723_24_encode_sb.i b/gr-vocoder/swig/vocoder_g723_24_encode_sb.i new file mode 100644 index 000000000..7165a8a82 --- /dev/null +++ b/gr-vocoder/swig/vocoder_g723_24_encode_sb.i @@ -0,0 +1,33 @@ +/* -*- c++ -*- */ +/* + * Copyright 2011 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio 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 General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +%{ +#include "vocoder_g723_24_encode_sb.h" +%} + +GR_SWIG_BLOCK_MAGIC(vocoder,g723_24_encode_sb); + +vocoder_g723_24_encode_sb_sptr vocoder_make_g723_24_encode_sb(); + +class vocoder_g723_24_encode_sb : public gr_sync_block +{ +}; diff --git a/gr-vocoder/swig/vocoder_g723_40_decode_bs.i b/gr-vocoder/swig/vocoder_g723_40_decode_bs.i new file mode 100644 index 000000000..d9ec9d6c9 --- /dev/null +++ b/gr-vocoder/swig/vocoder_g723_40_decode_bs.i @@ -0,0 +1,33 @@ +/* -*- c++ -*- */ +/* + * Copyright 2011 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio 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 General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +%{ +#include "vocoder_g723_40_decode_bs.h" +%} + +GR_SWIG_BLOCK_MAGIC(vocoder,g723_40_decode_bs); + +vocoder_g723_40_decode_bs_sptr vocoder_make_g723_40_decode_bs(); + +class vocoder_g723_40_decode_bs : public gr_sync_block +{ +}; diff --git a/gr-vocoder/swig/vocoder_g723_40_encode_sb.i b/gr-vocoder/swig/vocoder_g723_40_encode_sb.i new file mode 100644 index 000000000..839ae46cf --- /dev/null +++ b/gr-vocoder/swig/vocoder_g723_40_encode_sb.i @@ -0,0 +1,33 @@ +/* -*- c++ -*- */ +/* + * Copyright 2011 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio 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 General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +%{ +#include "vocoder_g723_40_encode_sb.h" +%} + +GR_SWIG_BLOCK_MAGIC(vocoder,g723_40_encode_sb); + +vocoder_g723_40_encode_sb_sptr vocoder_make_g723_40_encode_sb(); + +class vocoder_g723_40_encode_sb : public gr_sync_block +{ +}; diff --git a/gr-vocoder/swig/vocoder_gsm_fr_decode_ps.i b/gr-vocoder/swig/vocoder_gsm_fr_decode_ps.i new file mode 100644 index 000000000..8e96689f6 --- /dev/null +++ b/gr-vocoder/swig/vocoder_gsm_fr_decode_ps.i @@ -0,0 +1,35 @@ +/* -*- c++ -*- */ +/* + * Copyright 2011 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio 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 General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +%{ +#include "vocoder_gsm_fr_decode_ps.h" +%} + +GR_SWIG_BLOCK_MAGIC(vocoder,gsm_fr_decode_ps); + +vocoder_gsm_fr_decode_ps_sptr vocoder_make_gsm_fr_decode_ps(); + +class vocoder_gsm_fr_decode_ps : public gr_sync_interpolator +{ +public: + ~vocoder_gsm_fr_decode_ps(); +}; diff --git a/gr-vocoder/swig/vocoder_gsm_fr_encode_sp.i b/gr-vocoder/swig/vocoder_gsm_fr_encode_sp.i new file mode 100644 index 000000000..8216336a9 --- /dev/null +++ b/gr-vocoder/swig/vocoder_gsm_fr_encode_sp.i @@ -0,0 +1,35 @@ +/* -*- c++ -*- */ +/* + * Copyright 2011 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio 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 General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +%{ +#include "vocoder_gsm_fr_encode_sp.h" +%} + +GR_SWIG_BLOCK_MAGIC(vocoder,gsm_fr_encode_sp); + +vocoder_gsm_fr_encode_sp_sptr vocoder_make_gsm_fr_encode_sp(); + +class vocoder_gsm_fr_encode_sp : public gr_sync_decimator +{ +public: + ~vocoder_gsm_fr_encode_sp(); +}; diff --git a/gr-gsm-fr-vocoder/src/lib/gsm_full_rate.i b/gr-vocoder/swig/vocoder_swig.i index 20bf8fdea..71a2952dd 100644 --- a/gr-gsm-fr-vocoder/src/lib/gsm_full_rate.i +++ b/gr-vocoder/swig/vocoder_swig.i @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2005,2009 Free Software Foundation, Inc. + * Copyright 2011 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -22,34 +22,26 @@ %include "gnuradio.i" -%{ -#include "gsm_fr_encode_sp.h" -#include "gsm_fr_decode_ps.h" -%} - -GR_SWIG_BLOCK_MAGIC(gsm_fr,encode_sp); - -gsm_fr_encode_sp_sptr gsm_fr_make_encode_sp (); - -class gsm_fr_encode_sp : public gr_sync_decimator { -public: - ~gsm_fr_encode_sp (); -}; - -// ---------------------------------------------------------------- - -GR_SWIG_BLOCK_MAGIC(gsm_fr,decode_ps); - -gsm_fr_decode_ps_sptr gsm_fr_make_decode_ps (); - -class gsm_fr_decode_ps : public gr_sync_interpolator { -public: - ~gsm_fr_decode_ps (); -}; +%include "vocoder_alaw_decode_bs.i" +%include "vocoder_alaw_encode_sb.i" +%include "vocoder_codec2_decode_ps.i" +%include "vocoder_codec2_encode_sp.i" +%include "vocoder_cvsd_decode_bs.i" +%include "vocoder_cvsd_encode_sb.i" +%include "vocoder_g721_decode_bs.i" +%include "vocoder_g721_encode_sb.i" +%include "vocoder_g723_24_decode_bs.i" +%include "vocoder_g723_24_encode_sb.i" +%include "vocoder_g723_40_decode_bs.i" +%include "vocoder_g723_40_encode_sb.i" +%include "vocoder_gsm_fr_decode_ps.i" +%include "vocoder_gsm_fr_encode_sp.i" +%include "vocoder_ulaw_decode_bs.i" +%include "vocoder_ulaw_encode_sb.i" #if SWIGGUILE %scheme %{ -(load-extension-global "libguile-gnuradio-gsm_full_rate" "scm_init_gnuradio_gsm_full_rate_module") +(load-extension-global "libguile-gnuradio-vocoder" "scm_init_gnuradio_gsm_vocoder_module") %} %goops %{ diff --git a/gr-vocoder/swig/vocoder_ulaw_decode_bs.i b/gr-vocoder/swig/vocoder_ulaw_decode_bs.i new file mode 100644 index 000000000..5e8e8c9ae --- /dev/null +++ b/gr-vocoder/swig/vocoder_ulaw_decode_bs.i @@ -0,0 +1,35 @@ +/* -*- c++ -*- */ +/* + * Copyright 2011 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio 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 General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +%{ +#include "vocoder_ulaw_decode_bs.h" +%} + +GR_SWIG_BLOCK_MAGIC(vocoder,ulaw_decode_bs); + +vocoder_ulaw_decode_bs_sptr vocoder_make_ulaw_decode_bs(); + +class vocoder_ulaw_decode_bs : public gr_sync_block +{ +private: + vocoder_ulaw_decode_bs(); +}; diff --git a/gr-vocoder/swig/vocoder_ulaw_encode_sb.i b/gr-vocoder/swig/vocoder_ulaw_encode_sb.i new file mode 100644 index 000000000..1665df480 --- /dev/null +++ b/gr-vocoder/swig/vocoder_ulaw_encode_sb.i @@ -0,0 +1,35 @@ +/* -*- c++ -*- */ +/* + * Copyright 2011 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio 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 General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +%{ +#include "vocoder_ulaw_encode_sb.h" +%} + +GR_SWIG_BLOCK_MAGIC(vocoder,ulaw_encode_sb); + +vocoder_ulaw_encode_sb_sptr vocoder_make_ulaw_encode_sb(); + +class vocoder_ulaw_encode_sb : public gr_sync_block +{ +private: + vocoder_ulaw_encode_sb(); +}; diff --git a/gr-wxgui/CMakeLists.txt b/gr-wxgui/CMakeLists.txt new file mode 100644 index 000000000..7002ce91b --- /dev/null +++ b/gr-wxgui/CMakeLists.txt @@ -0,0 +1,83 @@ +# Copyright 2011 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio 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 General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. + +######################################################################## +# Setup dependencies +######################################################################## +INCLUDE(GrPython) + +GR_PYTHON_CHECK_MODULE("wx >= 2.8" wx "wx.version().split()[0] >= '2.8'" WX_FOUND) +GR_PYTHON_CHECK_MODULE("numpy" numpy True NUMPY_FOUND) + +######################################################################## +# Register component +######################################################################## +INCLUDE(GrComponent) +GR_REGISTER_COMPONENT("gr-wxgui" ENABLE_WXGUI + ENABLE_GR_CORE_ + ENABLE_PYTHON_ + NUMPY_FOUND + WX_FOUND +) + +######################################################################## +# Begin conditional configuration +######################################################################## +IF(ENABLE_WXGUI) + +######################################################################## +# Setup CPack components +######################################################################## +INCLUDE(GrPackage) +CPACK_COMPONENT("wxgui" + DISPLAY_NAME "WxGUI" + DESCRIPTION "Wx GUI plotter widgets and grc wrappers" + DEPENDS "core_python" +) + +######################################################################## +# Create Pkg Config File +######################################################################## +CONFIGURE_FILE( + ${CMAKE_CURRENT_SOURCE_DIR}/gr-wxgui.pc.in + ${CMAKE_CURRENT_BINARY_DIR}/gr-wxgui.pc +@ONLY) + +INSTALL( + FILES ${CMAKE_CURRENT_BINARY_DIR}/gr-wxgui.pc + DESTINATION ${GR_LIBRARY_DIR}/pkgconfig + COMPONENT "wxgui" +) + +######################################################################## +# Install the conf file +######################################################################## +INSTALL( + FILES ${CMAKE_CURRENT_SOURCE_DIR}/gr-wxgui.conf + DESTINATION ${GR_PKG_CONF_DIR} + COMPONENT "wxgui" +) + +######################################################################## +# Add subdirectories +######################################################################## +ADD_SUBDIRECTORY(grc) +ADD_SUBDIRECTORY(src/python) + +ENDIF(ENABLE_WXGUI) diff --git a/gr-wxgui/grc/CMakeLists.txt b/gr-wxgui/grc/CMakeLists.txt new file mode 100644 index 000000000..c39b5cfbe --- /dev/null +++ b/gr-wxgui/grc/CMakeLists.txt @@ -0,0 +1,36 @@ +# Copyright 2011 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio 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 General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. + +######################################################################## +FILE(GLOB xml_files "*.xml") +INSTALL(FILES ${xml_files} DESTINATION ${GRC_BLOCKS_DIR} COMPONENT "wxgui") + +######################################################################## +#The wxgui module contains a top_block + wxgui frame. +######################################################################## +INCLUDE(GrPython) + +GR_PYTHON_INSTALL( + FILES + __init__.py + panel.py + top_block_gui.py + DESTINATION ${GR_PYTHON_DIR}/grc_gnuradio/wxgui + COMPONENT "wxgui" +) diff --git a/gr-wxgui/src/python/CMakeLists.txt b/gr-wxgui/src/python/CMakeLists.txt new file mode 100644 index 000000000..da86d4a81 --- /dev/null +++ b/gr-wxgui/src/python/CMakeLists.txt @@ -0,0 +1,88 @@ +# Copyright 2011 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio 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 General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. + +######################################################################## +INCLUDE(GrPython) + +######################################################################## +# Install python files into wxgui module +######################################################################## +GR_PYTHON_INSTALL( + FILES + __init__.py + common.py + constants.py + constsink_gl.py + const_window.py + form.py + fftsink2.py + fftsink_nongl.py + fftsink_gl.py + fft_window.py + gui.py + histosink_gl.py + histo_window.py + numbersink2.py + number_window.py + plot.py + powermate.py + pubsub.py + scopesink2.py + scopesink_nongl.py + scopesink_gl.py + scope_window.py + termsink.py + waterfallsink2.py + waterfallsink_nongl.py + waterfallsink_gl.py + waterfall_window.py + slider.py + stdgui2.py + DESTINATION ${GR_PYTHON_DIR}/gnuradio/wxgui + COMPONENT "wxgui" +) + +######################################################################## +# Install python files into wxgui forms sub-module +######################################################################## +GR_PYTHON_INSTALL( + FILES + forms/__init__.py + forms/forms.py + forms/converters.py + DESTINATION ${GR_PYTHON_DIR}/gnuradio/wxgui/forms + COMPONENT "wxgui" +) + +######################################################################## +# Install python files into wxgui plotter sub-module +######################################################################## +GR_PYTHON_INSTALL( + FILES + plotter/__init__.py + plotter/bar_plotter.py + plotter/channel_plotter.py + plotter/common.py + plotter/gltext.py + plotter/grid_plotter_base.py + plotter/plotter_base.py + plotter/waterfall_plotter.py + DESTINATION ${GR_PYTHON_DIR}/gnuradio/wxgui/plotter + COMPONENT "wxgui" +) diff --git a/grc/CMakeLists.txt b/grc/CMakeLists.txt new file mode 100644 index 000000000..ee422a4da --- /dev/null +++ b/grc/CMakeLists.txt @@ -0,0 +1,118 @@ +# Copyright 2011 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio 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 General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. + +######################################################################## +# Setup dependencies +######################################################################## +INCLUDE(GrPython) + +GR_PYTHON_CHECK_MODULE("python >= 2.5" sys "sys.version.split()[0] >= '2.5'" PYTHON_MIN_VER_FOUND) +GR_PYTHON_CHECK_MODULE("Cheetah >= 2.0.0" Cheetah "Cheetah.Version >= '2.0.0'" CHEETAH_FOUND) +GR_PYTHON_CHECK_MODULE("lxml >= 1.3.6" lxml.etree "lxml.etree.LXML_VERSION >= (1, 3, 6, 0)" LXML_FOUND) +GR_PYTHON_CHECK_MODULE("pygtk >= 2.10.0" gtk "gtk.pygtk_version >= (2, 10, 0)" PYGTK_FOUND) +GR_PYTHON_CHECK_MODULE("numpy" numpy True NUMPY_FOUND) + +######################################################################## +# Register component +######################################################################## +INCLUDE(GrComponent) +GR_REGISTER_COMPONENT("gnuradio-companion" ENABLE_GRC + ENABLE_GR_CORE_ + ENABLE_PYTHON_ + PYTHON_MIN_VER_FOUND + CHEETAH_FOUND + LXML_FOUND + PYGTK_FOUND + NUMPY_FOUND +) + +######################################################################## +# Begin conditional configuration +######################################################################## +IF(ENABLE_GRC) + +######################################################################## +# Setup CPack components +######################################################################## +INCLUDE(GrPackage) +CPACK_COMPONENT("grc" + DISPLAY_NAME "GNU Radio Companion" + DESCRIPTION "Graphical flow graph designer" + DEPENDS "core_python" +) + +######################################################################## +# Create and install the grc conf file +######################################################################## +FILE(TO_NATIVE_PATH ${CMAKE_INSTALL_PREFIX}/${GR_PKG_DOC_DIR} docdir) +FILE(TO_NATIVE_PATH ${CMAKE_INSTALL_PREFIX}/${GRC_BLOCKS_DIR} blocksdir) + +CONFIGURE_FILE( + ${CMAKE_CURRENT_SOURCE_DIR}/grc.conf.in + ${CMAKE_CURRENT_BINARY_DIR}/grc.conf +@ONLY) + +INSTALL( + FILES ${CMAKE_CURRENT_BINARY_DIR}/grc.conf + DESTINATION ${GR_PKG_CONF_DIR} + COMPONENT "grc" +) + +GR_PYTHON_INSTALL( + FILES __init__.py + DESTINATION ${GR_PYTHON_DIR}/gnuradio/grc + COMPONENT "grc" +) + +######################################################################## +# Appens NSIS commands to set environment variables +######################################################################## +FILE(TO_NATIVE_PATH ${GR_PKG_DOC_DIR} GR_DOC_DIR) +STRING(REPLACE "\\" "\\\\" GR_DOC_DIR ${GR_DOC_DIR}) + +FILE(TO_NATIVE_PATH ${GRC_BLOCKS_DIR} GRC_BLOCKS_PATH) +STRING(REPLACE "\\" "\\\\" GRC_BLOCKS_PATH ${GRC_BLOCKS_PATH}) + +FILE(TO_NATIVE_PATH ${GR_PYTHON_DIR} GR_PYTHON_POSTFIX) +STRING(REPLACE "\\" "\\\\" GR_PYTHON_POSTFIX ${GR_PYTHON_POSTFIX}) + +CPACK_SET(CPACK_NSIS_EXTRA_INSTALL_COMMANDS "${CPACK_NSIS_EXTRA_INSTALL_COMMANDS} + WriteRegStr HKLM ${HLKM_ENV} \\\"GR_DOC_DIR\\\" \\\"$INSTDIR\\\\${GR_DOC_DIR}\\\" + WriteRegStr HKLM ${HLKM_ENV} \\\"GRC_BLOCKS_PATH\\\" \\\"$INSTDIR\\\\${GRC_BLOCKS_PATH}\\\" + WriteRegStr HKLM \\\"SOFTWARE\\\\Python\\\\PythonCore\\\\2.7\\\\PythonPath\\\" \\\"gnuradio\\\" \\\"$INSTDIR\\\\${GR_PYTHON_POSTFIX}\\\" +") + +CPACK_SET(CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS "${CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS} + DeleteRegValue HKLM ${HLKM_ENV} \\\"GR_DOC_DIR\\\" + DeleteRegValue HKLM ${HLKM_ENV} \\\"GRC_BLOCKS_PATH\\\" + DeleteRegValue HKLM \\\"SOFTWARE\\\\Python\\\\PythonCore\\\\2.7\\\\PythonPath\\\" \\\"gnuradio\\\" +") + +######################################################################## +# Add subdirectories +######################################################################## +ADD_SUBDIRECTORY(base) +ADD_SUBDIRECTORY(blocks) +ADD_SUBDIRECTORY(freedesktop) +ADD_SUBDIRECTORY(grc_gnuradio) +ADD_SUBDIRECTORY(gui) +ADD_SUBDIRECTORY(python) +ADD_SUBDIRECTORY(scripts) + +ENDIF(ENABLE_GRC) diff --git a/grc/base/CMakeLists.txt b/grc/base/CMakeLists.txt new file mode 100644 index 000000000..81d39e69c --- /dev/null +++ b/grc/base/CMakeLists.txt @@ -0,0 +1,42 @@ +# Copyright 2011 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio 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 General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. + +######################################################################## +GR_PYTHON_INSTALL(FILES + odict.py + ParseXML.py + Block.py + Connection.py + Constants.py + Element.py + FlowGraph.py + Param.py + Platform.py + Port.py + __init__.py + DESTINATION ${GR_PYTHON_DIR}/gnuradio/grc/base + COMPONENT "grc" +) + +INSTALL(FILES + block_tree.dtd + flow_graph.dtd + DESTINATION ${GR_PYTHON_DIR}/gnuradio/grc/base + COMPONENT "grc" +) diff --git a/grc/blocks/CMakeLists.txt b/grc/blocks/CMakeLists.txt new file mode 100644 index 000000000..393a91b27 --- /dev/null +++ b/grc/blocks/CMakeLists.txt @@ -0,0 +1,22 @@ +# Copyright 2011 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio 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 General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. + +######################################################################## +FILE(GLOB xml_files "*.xml") +INSTALL(FILES ${xml_files} DESTINATION ${GRC_BLOCKS_DIR} COMPONENT "grc") diff --git a/grc/freedesktop/CMakeLists.txt b/grc/freedesktop/CMakeLists.txt new file mode 100644 index 000000000..2e74dd3be --- /dev/null +++ b/grc/freedesktop/CMakeLists.txt @@ -0,0 +1,47 @@ +# Copyright 2011 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio 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 General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. + +######################################################################## +SET(grc_freedesktop_path ${GR_PKG_DATA_DIR}/grc/freedesktop) + +INSTALL(FILES + grc-icon-256.png + grc-icon-128.png + grc-icon-64.png + grc-icon-48.png + grc-icon-32.png + gnuradio-grc.xml + gnuradio-grc.desktop + DESTINATION ${grc_freedesktop_path} + COMPONENT "grc" +) + +FIND_PROGRAM(HAVE_XDG_UTILS xdg-desktop-menu) + +IF(UNIX AND HAVE_XDG_UTILS) + SET(SRCDIR ${CMAKE_INSTALL_PREFIX}/${grc_freedesktop_path}) + CONFIGURE_FILE( + ${CMAKE_CURRENT_SOURCE_DIR}/grc_setup_freedesktop.in + ${CMAKE_CURRENT_BINARY_DIR}/grc_setup_freedesktop + @ONLY) + INSTALL( + FILES ${CMAKE_CURRENT_BINARY_DIR}/grc_setup_freedesktop + DESTINATION ${GR_PKG_LIBEXEC_DIR} COMPONENT "grc" + ) +ENDIF(UNIX AND HAVE_XDG_UTILS) diff --git a/grc/grc_gnuradio/CMakeLists.txt b/grc/grc_gnuradio/CMakeLists.txt new file mode 100644 index 000000000..e992a60a3 --- /dev/null +++ b/grc/grc_gnuradio/CMakeLists.txt @@ -0,0 +1,35 @@ +# Copyright 2011 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio 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 General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. + +######################################################################## +GR_PYTHON_INSTALL( + FILES __init__.py + DESTINATION ${GR_PYTHON_DIR}/grc_gnuradio + COMPONENT "grc" +) + +GR_PYTHON_INSTALL(FILES + blks2/__init__.py + blks2/error_rate.py + blks2/packet.py + blks2/selector.py + blks2/tcp.py + DESTINATION ${GR_PYTHON_DIR}/grc_gnuradio/blks2 + COMPONENT "grc" +) diff --git a/grc/gui/CMakeLists.txt b/grc/gui/CMakeLists.txt new file mode 100644 index 000000000..c2eb16e9f --- /dev/null +++ b/grc/gui/CMakeLists.txt @@ -0,0 +1,48 @@ +# Copyright 2011 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio 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 General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. + +######################################################################## +GR_PYTHON_INSTALL(FILES + Block.py + Colors.py + Constants.py + Connection.py + Element.py + FlowGraph.py + Param.py + Platform.py + Port.py + Utils.py + ActionHandler.py + Actions.py + Bars.py + BlockTreeWindow.py + Dialogs.py + DrawingArea.py + FileDialogs.py + MainWindow.py + Messages.py + NotebookPage.py + PropsDialog.py + Preferences.py + StateCache.py + __init__.py + DESTINATION ${GR_PYTHON_DIR}/gnuradio/grc/gui + COMPONENT "grc" +) diff --git a/grc/python/CMakeLists.txt b/grc/python/CMakeLists.txt new file mode 100644 index 000000000..50ec6d0ba --- /dev/null +++ b/grc/python/CMakeLists.txt @@ -0,0 +1,45 @@ +# Copyright 2011 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio 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 General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. + +######################################################################## +GR_PYTHON_INSTALL(FILES + convert_hier.py + expr_utils.py + extract_category.py + extract_docs.py + Block.py + Connection.py + Constants.py + FlowGraph.py + Generator.py + Param.py + Platform.py + Port.py + __init__.py + DESTINATION ${GR_PYTHON_DIR}/gnuradio/grc/python + COMPONENT "grc" +) + +INSTALL(FILES + block.dtd + default_flow_graph.grc + flow_graph.tmpl + DESTINATION ${GR_PYTHON_DIR}/gnuradio/grc/python + COMPONENT "grc" +) diff --git a/grc/scripts/CMakeLists.txt b/grc/scripts/CMakeLists.txt new file mode 100644 index 000000000..b8d5330f6 --- /dev/null +++ b/grc/scripts/CMakeLists.txt @@ -0,0 +1,25 @@ +# Copyright 2011 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio 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 General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. + +######################################################################## +GR_PYTHON_INSTALL( + PROGRAMS gnuradio-companion + DESTINATION ${GR_RUNTIME_DIR} + COMPONENT "grc" +) diff --git a/gruel/CMakeLists.txt b/gruel/CMakeLists.txt new file mode 100644 index 000000000..933e74b2f --- /dev/null +++ b/gruel/CMakeLists.txt @@ -0,0 +1,105 @@ +# Copyright 2010-2011 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio 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 General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. + +######################################################################## +# Setup dependencies +######################################################################## +INCLUDE(GrBoost) + +INCLUDE(GrPython) #used for code generation + +######################################################################## +# Register component +######################################################################## +INCLUDE(GrComponent) +GR_REGISTER_COMPONENT("gruel" ENABLE_GRUEL + Boost_FOUND + PYTHONINTERP_FOUND +) + +INCLUDE(GrMiscUtils) +GR_SET_GLOBAL(GRUEL_INCLUDE_DIRS + ${Boost_INCLUDE_DIRS} + ${CMAKE_CURRENT_SOURCE_DIR}/src/include + ${CMAKE_CURRENT_BINARY_DIR}/src/include +) + +######################################################################## +# Begin conditional configuration +######################################################################## +IF(ENABLE_GRUEL) + +######################################################################## +# Setup CPack components +######################################################################## +INCLUDE(GrPackage) +CPACK_SET(CPACK_COMPONENT_GROUP_GRUEL_DESCRIPTION "GNU Radio Utility Etcetera Library") + +CPACK_COMPONENT("gruel_runtime" + GROUP "Gruel" + DISPLAY_NAME "Runtime" + DESCRIPTION "Dynamic link libraries" +) + +CPACK_COMPONENT("gruel_devel" + GROUP "Gruel" + DISPLAY_NAME "Development" + DESCRIPTION "C++ headers, package config, import libraries" +) + +CPACK_COMPONENT("gruel_python" + GROUP "Gruel" + DISPLAY_NAME "Python" + DESCRIPTION "Python modules for runtime" + DEPENDS "gruel_runtime" +) + +CPACK_COMPONENT("gruel_swig" + GROUP "Gruel" + DISPLAY_NAME "SWIG" + DESCRIPTION "SWIG development .i files" + DEPENDS "gruel_python;gruel_devel" +) + +######################################################################## +# Add subdirectories +######################################################################## +ADD_SUBDIRECTORY(src/include/gruel) +ADD_SUBDIRECTORY(src/scheme/gnuradio) +ADD_SUBDIRECTORY(src/lib) +IF(ENABLE_PYTHON) + ADD_SUBDIRECTORY(src/swig) + ADD_SUBDIRECTORY(src/python) +ENDIF(ENABLE_PYTHON) + +######################################################################## +# Create Pkg Config File +######################################################################## +CONFIGURE_FILE( + ${CMAKE_CURRENT_SOURCE_DIR}/gruel.pc.in + ${CMAKE_CURRENT_BINARY_DIR}/gruel.pc +@ONLY) + +INSTALL( + FILES ${CMAKE_CURRENT_BINARY_DIR}/gruel.pc + DESTINATION ${GR_LIBRARY_DIR}/pkgconfig + COMPONENT "gruel_devel" +) + +ENDIF(ENABLE_GRUEL) diff --git a/gruel/src/include/gruel/CMakeLists.txt b/gruel/src/include/gruel/CMakeLists.txt new file mode 100644 index 000000000..2f80043a4 --- /dev/null +++ b/gruel/src/include/gruel/CMakeLists.txt @@ -0,0 +1,56 @@ +# Copyright 2010-2011 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio 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 General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. + +######################################################################## +# Generate inet.h header file +######################################################################## +INCLUDE(TestBigEndian) +ENABLE_LANGUAGE(C) +TEST_BIG_ENDIAN(GR_ARCH_BIGENDIAN) + +INCLUDE(CheckIncludeFileCXX) +CHECK_INCLUDE_FILE_CXX(byteswap.h GR_HAVE_BYTESWAP) +CHECK_INCLUDE_FILE_CXX(arpa/inet.h GR_HAVE_ARPA_INET) + +CONFIGURE_FILE( + ${CMAKE_CURRENT_SOURCE_DIR}/inet.h.in + ${CMAKE_CURRENT_BINARY_DIR}/inet.h +@ONLY) + +######################################################################## +# Install the headers +######################################################################## +INSTALL(FILES + api.h + attributes.h + high_res_timer.h + ${CMAKE_CURRENT_BINARY_DIR}/inet.h + msg_accepter.h + msg_accepter_msgq.h + msg_queue.h + msg_passing.h + pmt.h + pmt_pool.h + pmt_sugar.h + realtime.h + sys_pri.h + thread_body_wrapper.h + thread_group.h + thread.h +DESTINATION ${GR_INCLUDE_DIR}/gruel COMPONENT "gruel_devel") diff --git a/gruel/src/include/gruel/Makefile.am b/gruel/src/include/gruel/Makefile.am index 96aed326e..fce739f08 100644 --- a/gruel/src/include/gruel/Makefile.am +++ b/gruel/src/include/gruel/Makefile.am @@ -26,6 +26,7 @@ EXTRA_DIST += inet.h.in gruelincludedir = $(prefix)/include/gruel gruelinclude_HEADERS = \ + api.h \ attributes.h \ high_res_timer.h \ inet.h \ diff --git a/gruel/src/include/gruel/api.h b/gruel/src/include/gruel/api.h new file mode 100644 index 000000000..945814d43 --- /dev/null +++ b/gruel/src/include/gruel/api.h @@ -0,0 +1,33 @@ +/* + * Copyright 2010 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio 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 General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifndef INCLUDED_GRUEL_API_H +#define INCLUDED_GRUEL_API_H + +#include <gruel/attributes.h> + +#ifdef gruel_EXPORTS +# define GRUEL_API __GR_ATTR_EXPORT +#else +# define GRUEL_API __GR_ATTR_IMPORT +#endif + +#endif /* INCLUDED_GRUEL_API_H */ diff --git a/gruel/src/include/gruel/attributes.h b/gruel/src/include/gruel/attributes.h index fdf48c977..baa5521c8 100644 --- a/gruel/src/include/gruel/attributes.h +++ b/gruel/src/include/gruel/attributes.h @@ -53,4 +53,22 @@ # define __GR_ATTR_IMPORT #endif +//////////////////////////////////////////////////////////////////////// +// define inline when building C +//////////////////////////////////////////////////////////////////////// +#if defined(_MSC_VER) && !defined(__cplusplus) && !defined(inline) +# define inline __inline +#endif + +//////////////////////////////////////////////////////////////////////// +// suppress warnings +//////////////////////////////////////////////////////////////////////// +#ifdef _MSC_VER +# pragma warning(disable: 4251) // class 'A<T>' needs to have dll-interface to be used by clients of class 'B' +# pragma warning(disable: 4275) // non dll-interface class ... used as base for dll-interface class ... +# pragma warning(disable: 4244) // conversion from 'double' to 'float', possible loss of data +# pragma warning(disable: 4305) // 'initializing' : truncation from 'double' to 'float' +# pragma warning(disable: 4290) // C++ exception specification ignored except to indicate a function is not __declspec(nothrow) +#endif + #endif /* INCLUDED_GRUEL_ATTRIBUTES_H */ diff --git a/gruel/src/include/gruel/inet.h.in b/gruel/src/include/gruel/inet.h.in index 7ac01eb56..8545aeea9 100644 --- a/gruel/src/include/gruel/inet.h.in +++ b/gruel/src/include/gruel/inet.h.in @@ -19,6 +19,7 @@ #ifndef INCLUDED_INET_H #define INCLUDED_INET_H +#include <gruel/api.h> #include <stdint.h> #if 1 /* missing htonll or ntohll */ diff --git a/gruel/src/include/gruel/msg_accepter.h b/gruel/src/include/gruel/msg_accepter.h index 70ac846f5..3dfc8bcf8 100644 --- a/gruel/src/include/gruel/msg_accepter.h +++ b/gruel/src/include/gruel/msg_accepter.h @@ -21,6 +21,7 @@ #ifndef INCLUDED_GRUEL_MSG_ACCEPTER_H #define INCLUDED_GRUEL_MSG_ACCEPTER_H +#include <gruel/api.h> #include <gruel/pmt.h> #include <boost/shared_ptr.hpp> @@ -29,7 +30,7 @@ namespace gruel { /*! * \brief Virtual base class that accepts messages */ - class msg_accepter + class GRUEL_API msg_accepter { public: msg_accepter() {}; diff --git a/gruel/src/include/gruel/msg_accepter_msgq.h b/gruel/src/include/gruel/msg_accepter_msgq.h index bf1762e92..22a1855cf 100644 --- a/gruel/src/include/gruel/msg_accepter_msgq.h +++ b/gruel/src/include/gruel/msg_accepter_msgq.h @@ -22,6 +22,7 @@ #ifndef INCLUDED_MSG_ACCEPTER_MSGQ_H #define INCLUDED_MSG_ACCEPTER_MSGQ_H +#include <gruel/api.h> #include <gruel/msg_accepter.h> #include <gruel/msg_queue.h> @@ -30,7 +31,7 @@ namespace gruel { /*! * \brief Concrete class that accepts messages and inserts them into a message queue. */ - class msg_accepter_msgq : public msg_accepter + class GRUEL_API msg_accepter_msgq : public msg_accepter { protected: msg_queue_sptr d_msg_queue; diff --git a/gruel/src/include/gruel/msg_passing.h b/gruel/src/include/gruel/msg_passing.h index ebbeca815..51268967a 100644 --- a/gruel/src/include/gruel/msg_passing.h +++ b/gruel/src/include/gruel/msg_passing.h @@ -25,6 +25,7 @@ * \brief Include this header to use the message passing features */ +#include <gruel/api.h> #include <gruel/pmt.h> #include <gruel/msg_accepter.h> diff --git a/gruel/src/include/gruel/msg_queue.h b/gruel/src/include/gruel/msg_queue.h index c24313df6..8608842da 100644 --- a/gruel/src/include/gruel/msg_queue.h +++ b/gruel/src/include/gruel/msg_queue.h @@ -22,6 +22,7 @@ #ifndef INCLUDED_MSG_QUEUE_H #define INCLUDED_MSG_QUEUE_H +#include <gruel/api.h> #include <gruel/thread.h> #include <gruel/pmt.h> #include <deque> @@ -36,7 +37,7 @@ namespace gruel { /*! * \brief thread-safe message queue */ - class msg_queue { + class GRUEL_API msg_queue { gruel::mutex d_mutex; gruel::condition_variable d_not_empty; diff --git a/gruel/src/include/gruel/pmt.h b/gruel/src/include/gruel/pmt.h index 2948abb39..58533e54e 100644 --- a/gruel/src/include/gruel/pmt.h +++ b/gruel/src/include/gruel/pmt.h @@ -23,6 +23,7 @@ #ifndef INCLUDED_PMT_H #define INCLUDED_PMT_H +#include <gruel/api.h> #include <boost/intrusive_ptr.hpp> #include <boost/shared_ptr.hpp> #include <boost/any.hpp> @@ -57,28 +58,28 @@ class pmt_base; */ typedef boost::intrusive_ptr<pmt_base> pmt_t; -extern void intrusive_ptr_add_ref(pmt_base*); -extern void intrusive_ptr_release(pmt_base*); +extern GRUEL_API void intrusive_ptr_add_ref(pmt_base*); +extern GRUEL_API void intrusive_ptr_release(pmt_base*); -class pmt_exception : public std::logic_error +class GRUEL_API pmt_exception : public std::logic_error { public: pmt_exception(const std::string &msg, pmt_t obj); }; -class pmt_wrong_type : public pmt_exception +class GRUEL_API pmt_wrong_type : public pmt_exception { public: pmt_wrong_type(const std::string &msg, pmt_t obj); }; -class pmt_out_of_range : public pmt_exception +class GRUEL_API pmt_out_of_range : public pmt_exception { public: pmt_out_of_range(const std::string &msg, pmt_t obj); }; -class pmt_notimplemented : public pmt_exception +class GRUEL_API pmt_notimplemented : public pmt_exception { public: pmt_notimplemented(const std::string &msg, pmt_t obj); @@ -92,24 +93,24 @@ public: * I.e., there is a single false value, #f. * ------------------------------------------------------------------------ */ -extern const pmt_t PMT_T; //< \#t : boolean true constant -extern const pmt_t PMT_F; //< \#f : boolean false constant +extern GRUEL_API const pmt_t PMT_T; //< \#t : boolean true constant +extern GRUEL_API const pmt_t PMT_F; //< \#f : boolean false constant //! Return true if obj is \#t or \#f, else return false. -bool pmt_is_bool(pmt_t obj); +GRUEL_API bool pmt_is_bool(pmt_t obj); //! Return false if obj is \#f, else return true. -bool pmt_is_true(pmt_t obj); +GRUEL_API bool pmt_is_true(pmt_t obj); //! Return true if obj is \#f, else return true. -bool pmt_is_false(pmt_t obj); +GRUEL_API bool pmt_is_false(pmt_t obj); //! Return \#f is val is false, else return \#t. -pmt_t pmt_from_bool(bool val); +GRUEL_API pmt_t pmt_from_bool(bool val); //! Return true if val is PMT_T, return false when val is PMT_F, // else raise wrong_type exception. -bool pmt_to_bool(pmt_t val); +GRUEL_API bool pmt_to_bool(pmt_t val); /* * ------------------------------------------------------------------------ @@ -118,20 +119,20 @@ bool pmt_to_bool(pmt_t val); */ //! Return true if obj is a symbol, else false. -bool pmt_is_symbol(const pmt_t& obj); +GRUEL_API bool pmt_is_symbol(const pmt_t& obj); //! Return the symbol whose name is \p s. -pmt_t pmt_string_to_symbol(const std::string &s); +GRUEL_API pmt_t pmt_string_to_symbol(const std::string &s); //! Alias for pmt_string_to_symbol -pmt_t pmt_intern(const std::string &s); +GRUEL_API pmt_t pmt_intern(const std::string &s); /*! * If \p is a symbol, return the name of the symbol as a string. * Otherwise, raise the wrong_type exception. */ -const std::string pmt_symbol_to_string(const pmt_t& sym); +GRUEL_API const std::string pmt_symbol_to_string(const pmt_t& sym); /* * ------------------------------------------------------------------------ @@ -140,7 +141,7 @@ const std::string pmt_symbol_to_string(const pmt_t& sym); */ //! Return true if obj is any kind of number, else false. -bool pmt_is_number(pmt_t obj); +GRUEL_API bool pmt_is_number(pmt_t obj); /* * ------------------------------------------------------------------------ @@ -149,10 +150,10 @@ bool pmt_is_number(pmt_t obj); */ //! Return true if \p x is an integer number, else false -bool pmt_is_integer(pmt_t x); +GRUEL_API bool pmt_is_integer(pmt_t x); //! Return the pmt value that represents the integer \p x. -pmt_t pmt_from_long(long x); +GRUEL_API pmt_t pmt_from_long(long x); /*! * \brief Convert pmt to long if possible. @@ -161,7 +162,7 @@ pmt_t pmt_from_long(long x); * return that integer. Else raise an exception, either wrong_type * when x is not an exact integer, or out_of_range when it doesn't fit. */ -long pmt_to_long(pmt_t x); +GRUEL_API long pmt_to_long(pmt_t x); /* * ------------------------------------------------------------------------ @@ -170,10 +171,10 @@ long pmt_to_long(pmt_t x); */ //! Return true if \p x is an uint64 number, else false -bool pmt_is_uint64(pmt_t x); +GRUEL_API bool pmt_is_uint64(pmt_t x); //! Return the pmt value that represents the uint64 \p x. -pmt_t pmt_from_uint64(uint64_t x); +GRUEL_API pmt_t pmt_from_uint64(uint64_t x); /*! * \brief Convert pmt to uint64 if possible. @@ -182,7 +183,7 @@ pmt_t pmt_from_uint64(uint64_t x); * return that uint64. Else raise an exception, either wrong_type * when x is not an exact uint64, or out_of_range when it doesn't fit. */ -uint64_t pmt_to_uint64(pmt_t x); +GRUEL_API uint64_t pmt_to_uint64(pmt_t x); /* * ------------------------------------------------------------------------ @@ -193,10 +194,10 @@ uint64_t pmt_to_uint64(pmt_t x); /* * \brief Return true if \p obj is a real number, else false. */ -bool pmt_is_real(pmt_t obj); +GRUEL_API bool pmt_is_real(pmt_t obj); //! Return the pmt value that represents double \p x. -pmt_t pmt_from_double(double x); +GRUEL_API pmt_t pmt_from_double(double x); /*! * \brief Convert pmt to double if possible. @@ -205,7 +206,7 @@ pmt_t pmt_from_double(double x); * as a double. The argument \p val must be a real or integer, otherwise * a wrong_type exception is raised. */ -double pmt_to_double(pmt_t x); +GRUEL_API double pmt_to_double(pmt_t x); /* * ------------------------------------------------------------------------ @@ -216,16 +217,16 @@ double pmt_to_double(pmt_t x); /*! * \brief return true if \p obj is a complex number, false otherwise. */ -bool pmt_is_complex(pmt_t obj); +GRUEL_API bool pmt_is_complex(pmt_t obj); //! Return a complex number constructed of the given real and imaginary parts. -pmt_t pmt_make_rectangular(double re, double im); +GRUEL_API pmt_t pmt_make_rectangular(double re, double im); /*! * If \p z is complex, real or integer, return the closest complex<double>. * Otherwise, raise the wrong_type exception. */ -std::complex<double> pmt_to_complex(pmt_t z); +GRUEL_API std::complex<double> pmt_to_complex(pmt_t z); /* * ------------------------------------------------------------------------ @@ -233,35 +234,35 @@ std::complex<double> pmt_to_complex(pmt_t z); * ------------------------------------------------------------------------ */ -extern const pmt_t PMT_NIL; //< the empty list +extern GRUEL_API const pmt_t PMT_NIL; //< the empty list //! Return true if \p x is the empty list, otherwise return false. -bool pmt_is_null(const pmt_t& x); +GRUEL_API bool pmt_is_null(const pmt_t& x); //! Return true if \p obj is a pair, else false. -bool pmt_is_pair(const pmt_t& obj); +GRUEL_API bool pmt_is_pair(const pmt_t& obj); //! Return a newly allocated pair whose car is \p x and whose cdr is \p y. -pmt_t pmt_cons(const pmt_t& x, const pmt_t& y); +GRUEL_API pmt_t pmt_cons(const pmt_t& x, const pmt_t& y); //! If \p pair is a pair, return the car of the \p pair, otherwise raise wrong_type. -pmt_t pmt_car(const pmt_t& pair); +GRUEL_API pmt_t pmt_car(const pmt_t& pair); //! If \p pair is a pair, return the cdr of the \p pair, otherwise raise wrong_type. -pmt_t pmt_cdr(const pmt_t& pair); +GRUEL_API pmt_t pmt_cdr(const pmt_t& pair); //! Stores \p value in the car field of \p pair. -void pmt_set_car(pmt_t pair, pmt_t value); +GRUEL_API void pmt_set_car(pmt_t pair, pmt_t value); //! Stores \p value in the cdr field of \p pair. -void pmt_set_cdr(pmt_t pair, pmt_t value); +GRUEL_API void pmt_set_cdr(pmt_t pair, pmt_t value); -pmt_t pmt_caar(pmt_t pair); -pmt_t pmt_cadr(pmt_t pair); -pmt_t pmt_cdar(pmt_t pair); -pmt_t pmt_cddr(pmt_t pair); -pmt_t pmt_caddr(pmt_t pair); -pmt_t pmt_cadddr(pmt_t pair); +GRUEL_API pmt_t pmt_caar(pmt_t pair); +GRUEL_API pmt_t pmt_cadr(pmt_t pair); +GRUEL_API pmt_t pmt_cdar(pmt_t pair); +GRUEL_API pmt_t pmt_cddr(pmt_t pair); +GRUEL_API pmt_t pmt_caddr(pmt_t pair); +GRUEL_API pmt_t pmt_cadddr(pmt_t pair); /* * ------------------------------------------------------------------------ @@ -274,30 +275,30 @@ pmt_t pmt_cadddr(pmt_t pair); */ //! Return true if \p x is a tuple, othewise false. -bool pmt_is_tuple(pmt_t x); +GRUEL_API bool pmt_is_tuple(pmt_t x); -pmt_t pmt_make_tuple(); -pmt_t pmt_make_tuple(const pmt_t &e0); -pmt_t pmt_make_tuple(const pmt_t &e0, const pmt_t &e1); -pmt_t pmt_make_tuple(const pmt_t &e0, const pmt_t &e1, const pmt_t &e2); -pmt_t pmt_make_tuple(const pmt_t &e0, const pmt_t &e1, const pmt_t &e2, const pmt_t &e3); -pmt_t pmt_make_tuple(const pmt_t &e0, const pmt_t &e1, const pmt_t &e2, const pmt_t &e3, const pmt_t &e4); -pmt_t pmt_make_tuple(const pmt_t &e0, const pmt_t &e1, const pmt_t &e2, const pmt_t &e3, const pmt_t &e4, const pmt_t &e5); -pmt_t pmt_make_tuple(const pmt_t &e0, const pmt_t &e1, const pmt_t &e2, const pmt_t &e3, const pmt_t &e4, const pmt_t &e5, const pmt_t &e6); -pmt_t pmt_make_tuple(const pmt_t &e0, const pmt_t &e1, const pmt_t &e2, const pmt_t &e3, const pmt_t &e4, const pmt_t &e5, const pmt_t &e6, const pmt_t &e7); -pmt_t pmt_make_tuple(const pmt_t &e0, const pmt_t &e1, const pmt_t &e2, const pmt_t &e3, const pmt_t &e4, const pmt_t &e5, const pmt_t &e6, const pmt_t &e7, const pmt_t &e8); -pmt_t pmt_make_tuple(const pmt_t &e0, const pmt_t &e1, const pmt_t &e2, const pmt_t &e3, const pmt_t &e4, const pmt_t &e5, const pmt_t &e6, const pmt_t &e7, const pmt_t &e8, const pmt_t &e9); +GRUEL_API pmt_t pmt_make_tuple(); +GRUEL_API pmt_t pmt_make_tuple(const pmt_t &e0); +GRUEL_API pmt_t pmt_make_tuple(const pmt_t &e0, const pmt_t &e1); +GRUEL_API pmt_t pmt_make_tuple(const pmt_t &e0, const pmt_t &e1, const pmt_t &e2); +GRUEL_API pmt_t pmt_make_tuple(const pmt_t &e0, const pmt_t &e1, const pmt_t &e2, const pmt_t &e3); +GRUEL_API pmt_t pmt_make_tuple(const pmt_t &e0, const pmt_t &e1, const pmt_t &e2, const pmt_t &e3, const pmt_t &e4); +GRUEL_API pmt_t pmt_make_tuple(const pmt_t &e0, const pmt_t &e1, const pmt_t &e2, const pmt_t &e3, const pmt_t &e4, const pmt_t &e5); +GRUEL_API pmt_t pmt_make_tuple(const pmt_t &e0, const pmt_t &e1, const pmt_t &e2, const pmt_t &e3, const pmt_t &e4, const pmt_t &e5, const pmt_t &e6); +GRUEL_API pmt_t pmt_make_tuple(const pmt_t &e0, const pmt_t &e1, const pmt_t &e2, const pmt_t &e3, const pmt_t &e4, const pmt_t &e5, const pmt_t &e6, const pmt_t &e7); +GRUEL_API pmt_t pmt_make_tuple(const pmt_t &e0, const pmt_t &e1, const pmt_t &e2, const pmt_t &e3, const pmt_t &e4, const pmt_t &e5, const pmt_t &e6, const pmt_t &e7, const pmt_t &e8); +GRUEL_API pmt_t pmt_make_tuple(const pmt_t &e0, const pmt_t &e1, const pmt_t &e2, const pmt_t &e3, const pmt_t &e4, const pmt_t &e5, const pmt_t &e6, const pmt_t &e7, const pmt_t &e8, const pmt_t &e9); /*! * If \p x is a vector or proper list, return a tuple containing the elements of x */ -pmt_t pmt_to_tuple(const pmt_t &x); +GRUEL_API pmt_t pmt_to_tuple(const pmt_t &x); /*! * Return the contents of position \p k of \p tuple. * \p k must be a valid index of \p tuple. */ -pmt_t pmt_tuple_ref(const pmt_t &tuple, size_t k); +GRUEL_API pmt_t pmt_tuple_ref(const pmt_t &tuple, size_t k); /* * ------------------------------------------------------------------------ @@ -308,22 +309,22 @@ pmt_t pmt_tuple_ref(const pmt_t &tuple, size_t k); */ //! Return true if \p x is a vector, othewise false. -bool pmt_is_vector(pmt_t x); +GRUEL_API bool pmt_is_vector(pmt_t x); //! Make a vector of length \p k, with initial values set to \p fill -pmt_t pmt_make_vector(size_t k, pmt_t fill); +GRUEL_API pmt_t pmt_make_vector(size_t k, pmt_t fill); /*! * Return the contents of position \p k of \p vector. * \p k must be a valid index of \p vector. */ -pmt_t pmt_vector_ref(pmt_t vector, size_t k); +GRUEL_API pmt_t pmt_vector_ref(pmt_t vector, size_t k); //! Store \p obj in position \p k. -void pmt_vector_set(pmt_t vector, size_t k, pmt_t obj); +GRUEL_API void pmt_vector_set(pmt_t vector, size_t k, pmt_t obj); //! Store \p fill in every position of \p vector -void pmt_vector_fill(pmt_t vector, pmt_t fill); +GRUEL_API void pmt_vector_fill(pmt_t vector, pmt_t fill); /* * ------------------------------------------------------------------------ @@ -334,7 +335,7 @@ void pmt_vector_fill(pmt_t vector, pmt_t fill); */ //! Return true if \p x is a blob, othewise false. -bool pmt_is_blob(pmt_t x); +GRUEL_API bool pmt_is_blob(pmt_t x); /*! * \brief Make a blob given a pointer and length in bytes @@ -344,13 +345,13 @@ bool pmt_is_blob(pmt_t x); * * The data is copied into the blob. */ -pmt_t pmt_make_blob(const void *buf, size_t len); +GRUEL_API pmt_t pmt_make_blob(const void *buf, size_t len); //! Return a pointer to the blob's data -const void *pmt_blob_data(pmt_t blob); +GRUEL_API const void *pmt_blob_data(pmt_t blob); //! Return the blob's length in bytes -size_t pmt_blob_length(pmt_t blob); +GRUEL_API size_t pmt_blob_length(pmt_t blob); /*! * <pre> @@ -382,106 +383,106 @@ size_t pmt_blob_length(pmt_t blob); */ //! true if \p x is any kind of uniform numeric vector -bool pmt_is_uniform_vector(pmt_t x); - -bool pmt_is_u8vector(pmt_t x); -bool pmt_is_s8vector(pmt_t x); -bool pmt_is_u16vector(pmt_t x); -bool pmt_is_s16vector(pmt_t x); -bool pmt_is_u32vector(pmt_t x); -bool pmt_is_s32vector(pmt_t x); -bool pmt_is_u64vector(pmt_t x); -bool pmt_is_s64vector(pmt_t x); -bool pmt_is_f32vector(pmt_t x); -bool pmt_is_f64vector(pmt_t x); -bool pmt_is_c32vector(pmt_t x); -bool pmt_is_c64vector(pmt_t x); - -pmt_t pmt_make_u8vector(size_t k, uint8_t fill); -pmt_t pmt_make_s8vector(size_t k, int8_t fill); -pmt_t pmt_make_u16vector(size_t k, uint16_t fill); -pmt_t pmt_make_s16vector(size_t k, int16_t fill); -pmt_t pmt_make_u32vector(size_t k, uint32_t fill); -pmt_t pmt_make_s32vector(size_t k, int32_t fill); -pmt_t pmt_make_u64vector(size_t k, uint64_t fill); -pmt_t pmt_make_s64vector(size_t k, int64_t fill); -pmt_t pmt_make_f32vector(size_t k, float fill); -pmt_t pmt_make_f64vector(size_t k, double fill); -pmt_t pmt_make_c32vector(size_t k, std::complex<float> fill); -pmt_t pmt_make_c64vector(size_t k, std::complex<double> fill); - -pmt_t pmt_init_u8vector(size_t k, const uint8_t *data); -pmt_t pmt_init_s8vector(size_t k, const int8_t *data); -pmt_t pmt_init_u16vector(size_t k, const uint16_t *data); -pmt_t pmt_init_s16vector(size_t k, const int16_t *data); -pmt_t pmt_init_u32vector(size_t k, const uint32_t *data); -pmt_t pmt_init_s32vector(size_t k, const int32_t *data); -pmt_t pmt_init_u64vector(size_t k, const uint64_t *data); -pmt_t pmt_init_s64vector(size_t k, const int64_t *data); -pmt_t pmt_init_f32vector(size_t k, const float *data); -pmt_t pmt_init_f64vector(size_t k, const double *data); -pmt_t pmt_init_c32vector(size_t k, const std::complex<float> *data); -pmt_t pmt_init_c64vector(size_t k, const std::complex<double> *data); - -uint8_t pmt_u8vector_ref(pmt_t v, size_t k); -int8_t pmt_s8vector_ref(pmt_t v, size_t k); -uint16_t pmt_u16vector_ref(pmt_t v, size_t k); -int16_t pmt_s16vector_ref(pmt_t v, size_t k); -uint32_t pmt_u32vector_ref(pmt_t v, size_t k); -int32_t pmt_s32vector_ref(pmt_t v, size_t k); -uint64_t pmt_u64vector_ref(pmt_t v, size_t k); -int64_t pmt_s64vector_ref(pmt_t v, size_t k); -float pmt_f32vector_ref(pmt_t v, size_t k); -double pmt_f64vector_ref(pmt_t v, size_t k); -std::complex<float> pmt_c32vector_ref(pmt_t v, size_t k); -std::complex<double> pmt_c64vector_ref(pmt_t v, size_t k); - -void pmt_u8vector_set(pmt_t v, size_t k, uint8_t x); //< v[k] = x -void pmt_s8vector_set(pmt_t v, size_t k, int8_t x); -void pmt_u16vector_set(pmt_t v, size_t k, uint16_t x); -void pmt_s16vector_set(pmt_t v, size_t k, int16_t x); -void pmt_u32vector_set(pmt_t v, size_t k, uint32_t x); -void pmt_s32vector_set(pmt_t v, size_t k, int32_t x); -void pmt_u64vector_set(pmt_t v, size_t k, uint64_t x); -void pmt_s64vector_set(pmt_t v, size_t k, int64_t x); -void pmt_f32vector_set(pmt_t v, size_t k, float x); -void pmt_f64vector_set(pmt_t v, size_t k, double x); -void pmt_c32vector_set(pmt_t v, size_t k, std::complex<float> x); -void pmt_c64vector_set(pmt_t v, size_t k, std::complex<double> x); +GRUEL_API bool pmt_is_uniform_vector(pmt_t x); + +GRUEL_API bool pmt_is_u8vector(pmt_t x); +GRUEL_API bool pmt_is_s8vector(pmt_t x); +GRUEL_API bool pmt_is_u16vector(pmt_t x); +GRUEL_API bool pmt_is_s16vector(pmt_t x); +GRUEL_API bool pmt_is_u32vector(pmt_t x); +GRUEL_API bool pmt_is_s32vector(pmt_t x); +GRUEL_API bool pmt_is_u64vector(pmt_t x); +GRUEL_API bool pmt_is_s64vector(pmt_t x); +GRUEL_API bool pmt_is_f32vector(pmt_t x); +GRUEL_API bool pmt_is_f64vector(pmt_t x); +GRUEL_API bool pmt_is_c32vector(pmt_t x); +GRUEL_API bool pmt_is_c64vector(pmt_t x); + +GRUEL_API pmt_t pmt_make_u8vector(size_t k, uint8_t fill); +GRUEL_API pmt_t pmt_make_s8vector(size_t k, int8_t fill); +GRUEL_API pmt_t pmt_make_u16vector(size_t k, uint16_t fill); +GRUEL_API pmt_t pmt_make_s16vector(size_t k, int16_t fill); +GRUEL_API pmt_t pmt_make_u32vector(size_t k, uint32_t fill); +GRUEL_API pmt_t pmt_make_s32vector(size_t k, int32_t fill); +GRUEL_API pmt_t pmt_make_u64vector(size_t k, uint64_t fill); +GRUEL_API pmt_t pmt_make_s64vector(size_t k, int64_t fill); +GRUEL_API pmt_t pmt_make_f32vector(size_t k, float fill); +GRUEL_API pmt_t pmt_make_f64vector(size_t k, double fill); +GRUEL_API pmt_t pmt_make_c32vector(size_t k, std::complex<float> fill); +GRUEL_API pmt_t pmt_make_c64vector(size_t k, std::complex<double> fill); + +GRUEL_API pmt_t pmt_init_u8vector(size_t k, const uint8_t *data); +GRUEL_API pmt_t pmt_init_s8vector(size_t k, const int8_t *data); +GRUEL_API pmt_t pmt_init_u16vector(size_t k, const uint16_t *data); +GRUEL_API pmt_t pmt_init_s16vector(size_t k, const int16_t *data); +GRUEL_API pmt_t pmt_init_u32vector(size_t k, const uint32_t *data); +GRUEL_API pmt_t pmt_init_s32vector(size_t k, const int32_t *data); +GRUEL_API pmt_t pmt_init_u64vector(size_t k, const uint64_t *data); +GRUEL_API pmt_t pmt_init_s64vector(size_t k, const int64_t *data); +GRUEL_API pmt_t pmt_init_f32vector(size_t k, const float *data); +GRUEL_API pmt_t pmt_init_f64vector(size_t k, const double *data); +GRUEL_API pmt_t pmt_init_c32vector(size_t k, const std::complex<float> *data); +GRUEL_API pmt_t pmt_init_c64vector(size_t k, const std::complex<double> *data); + +GRUEL_API uint8_t pmt_u8vector_ref(pmt_t v, size_t k); +GRUEL_API int8_t pmt_s8vector_ref(pmt_t v, size_t k); +GRUEL_API uint16_t pmt_u16vector_ref(pmt_t v, size_t k); +GRUEL_API int16_t pmt_s16vector_ref(pmt_t v, size_t k); +GRUEL_API uint32_t pmt_u32vector_ref(pmt_t v, size_t k); +GRUEL_API int32_t pmt_s32vector_ref(pmt_t v, size_t k); +GRUEL_API uint64_t pmt_u64vector_ref(pmt_t v, size_t k); +GRUEL_API int64_t pmt_s64vector_ref(pmt_t v, size_t k); +GRUEL_API float pmt_f32vector_ref(pmt_t v, size_t k); +GRUEL_API double pmt_f64vector_ref(pmt_t v, size_t k); +GRUEL_API std::complex<float> pmt_c32vector_ref(pmt_t v, size_t k); +GRUEL_API std::complex<double> pmt_c64vector_ref(pmt_t v, size_t k); + +GRUEL_API void pmt_u8vector_set(pmt_t v, size_t k, uint8_t x); //< v[k] = x +GRUEL_API void pmt_s8vector_set(pmt_t v, size_t k, int8_t x); +GRUEL_API void pmt_u16vector_set(pmt_t v, size_t k, uint16_t x); +GRUEL_API void pmt_s16vector_set(pmt_t v, size_t k, int16_t x); +GRUEL_API void pmt_u32vector_set(pmt_t v, size_t k, uint32_t x); +GRUEL_API void pmt_s32vector_set(pmt_t v, size_t k, int32_t x); +GRUEL_API void pmt_u64vector_set(pmt_t v, size_t k, uint64_t x); +GRUEL_API void pmt_s64vector_set(pmt_t v, size_t k, int64_t x); +GRUEL_API void pmt_f32vector_set(pmt_t v, size_t k, float x); +GRUEL_API void pmt_f64vector_set(pmt_t v, size_t k, double x); +GRUEL_API void pmt_c32vector_set(pmt_t v, size_t k, std::complex<float> x); +GRUEL_API void pmt_c64vector_set(pmt_t v, size_t k, std::complex<double> x); // Return const pointers to the elements -const void *pmt_uniform_vector_elements(pmt_t v, size_t &len); //< works with any; len is in bytes - -const uint8_t *pmt_u8vector_elements(pmt_t v, size_t &len); //< len is in elements -const int8_t *pmt_s8vector_elements(pmt_t v, size_t &len); //< len is in elements -const uint16_t *pmt_u16vector_elements(pmt_t v, size_t &len); //< len is in elements -const int16_t *pmt_s16vector_elements(pmt_t v, size_t &len); //< len is in elements -const uint32_t *pmt_u32vector_elements(pmt_t v, size_t &len); //< len is in elements -const int32_t *pmt_s32vector_elements(pmt_t v, size_t &len); //< len is in elements -const uint64_t *pmt_u64vector_elements(pmt_t v, size_t &len); //< len is in elements -const int64_t *pmt_s64vector_elements(pmt_t v, size_t &len); //< len is in elements -const float *pmt_f32vector_elements(pmt_t v, size_t &len); //< len is in elements -const double *pmt_f64vector_elements(pmt_t v, size_t &len); //< len is in elements -const std::complex<float> *pmt_c32vector_elements(pmt_t v, size_t &len); //< len is in elements -const std::complex<double> *pmt_c64vector_elements(pmt_t v, size_t &len); //< len is in elements +GRUEL_API const void *pmt_uniform_vector_elements(pmt_t v, size_t &len); //< works with any; len is in bytes + +GRUEL_API const uint8_t *pmt_u8vector_elements(pmt_t v, size_t &len); //< len is in elements +GRUEL_API const int8_t *pmt_s8vector_elements(pmt_t v, size_t &len); //< len is in elements +GRUEL_API const uint16_t *pmt_u16vector_elements(pmt_t v, size_t &len); //< len is in elements +GRUEL_API const int16_t *pmt_s16vector_elements(pmt_t v, size_t &len); //< len is in elements +GRUEL_API const uint32_t *pmt_u32vector_elements(pmt_t v, size_t &len); //< len is in elements +GRUEL_API const int32_t *pmt_s32vector_elements(pmt_t v, size_t &len); //< len is in elements +GRUEL_API const uint64_t *pmt_u64vector_elements(pmt_t v, size_t &len); //< len is in elements +GRUEL_API const int64_t *pmt_s64vector_elements(pmt_t v, size_t &len); //< len is in elements +GRUEL_API const float *pmt_f32vector_elements(pmt_t v, size_t &len); //< len is in elements +GRUEL_API const double *pmt_f64vector_elements(pmt_t v, size_t &len); //< len is in elements +GRUEL_API const std::complex<float> *pmt_c32vector_elements(pmt_t v, size_t &len); //< len is in elements +GRUEL_API const std::complex<double> *pmt_c64vector_elements(pmt_t v, size_t &len); //< len is in elements // Return non-const pointers to the elements -void *pmt_uniform_vector_writable_elements(pmt_t v, size_t &len); //< works with any; len is in bytes - -uint8_t *pmt_u8vector_writable_elements(pmt_t v, size_t &len); //< len is in elements -int8_t *pmt_s8vector_writable_elements(pmt_t v, size_t &len); //< len is in elements -uint16_t *pmt_u16vector_writable_elements(pmt_t v, size_t &len); //< len is in elements -int16_t *pmt_s16vector_writable_elements(pmt_t v, size_t &len); //< len is in elements -uint32_t *pmt_u32vector_writable_elements(pmt_t v, size_t &len); //< len is in elements -int32_t *pmt_s32vector_writable_elements(pmt_t v, size_t &len); //< len is in elements -uint64_t *pmt_u64vector_writable_elements(pmt_t v, size_t &len); //< len is in elements -int64_t *pmt_s64vector_writable_elements(pmt_t v, size_t &len); //< len is in elements -float *pmt_f32vector_writable_elements(pmt_t v, size_t &len); //< len is in elements -double *pmt_f64vector_writable_elements(pmt_t v, size_t &len); //< len is in elements -std::complex<float> *pmt_c32vector_writable_elements(pmt_t v, size_t &len); //< len is in elements -std::complex<double> *pmt_c64vector_writable_elements(pmt_t v, size_t &len); //< len is in elements +GRUEL_API void *pmt_uniform_vector_writable_elements(pmt_t v, size_t &len); //< works with any; len is in bytes + +GRUEL_API uint8_t *pmt_u8vector_writable_elements(pmt_t v, size_t &len); //< len is in elements +GRUEL_API int8_t *pmt_s8vector_writable_elements(pmt_t v, size_t &len); //< len is in elements +GRUEL_API uint16_t *pmt_u16vector_writable_elements(pmt_t v, size_t &len); //< len is in elements +GRUEL_API int16_t *pmt_s16vector_writable_elements(pmt_t v, size_t &len); //< len is in elements +GRUEL_API uint32_t *pmt_u32vector_writable_elements(pmt_t v, size_t &len); //< len is in elements +GRUEL_API int32_t *pmt_s32vector_writable_elements(pmt_t v, size_t &len); //< len is in elements +GRUEL_API uint64_t *pmt_u64vector_writable_elements(pmt_t v, size_t &len); //< len is in elements +GRUEL_API int64_t *pmt_s64vector_writable_elements(pmt_t v, size_t &len); //< len is in elements +GRUEL_API float *pmt_f32vector_writable_elements(pmt_t v, size_t &len); //< len is in elements +GRUEL_API double *pmt_f64vector_writable_elements(pmt_t v, size_t &len); //< len is in elements +GRUEL_API std::complex<float> *pmt_c32vector_writable_elements(pmt_t v, size_t &len); //< len is in elements +GRUEL_API std::complex<double> *pmt_c64vector_writable_elements(pmt_t v, size_t &len); //< len is in elements /* * ------------------------------------------------------------------------ @@ -494,31 +495,31 @@ std::complex<double> *pmt_c64vector_writable_elements(pmt_t v, size_t &len); //< */ //! Return true if \p obj is a dictionary -bool pmt_is_dict(const pmt_t &obj); +GRUEL_API bool pmt_is_dict(const pmt_t &obj); //! Make an empty dictionary -pmt_t pmt_make_dict(); +GRUEL_API pmt_t pmt_make_dict(); //! Return a new dictionary with \p key associated with \p value. -pmt_t pmt_dict_add(const pmt_t &dict, const pmt_t &key, const pmt_t &value); +GRUEL_API pmt_t pmt_dict_add(const pmt_t &dict, const pmt_t &key, const pmt_t &value); //! Return a new dictionary with \p key removed. -pmt_t pmt_dict_delete(const pmt_t &dict, const pmt_t &key); +GRUEL_API pmt_t pmt_dict_delete(const pmt_t &dict, const pmt_t &key); //! Return true if \p key exists in \p dict -bool pmt_dict_has_key(const pmt_t &dict, const pmt_t &key); +GRUEL_API bool pmt_dict_has_key(const pmt_t &dict, const pmt_t &key); //! If \p key exists in \p dict, return associated value; otherwise return \p not_found. -pmt_t pmt_dict_ref(const pmt_t &dict, const pmt_t &key, const pmt_t ¬_found); +GRUEL_API pmt_t pmt_dict_ref(const pmt_t &dict, const pmt_t &key, const pmt_t ¬_found); //! Return list of (key . value) pairs -pmt_t pmt_dict_items(pmt_t dict); +GRUEL_API pmt_t pmt_dict_items(pmt_t dict); //! Return list of keys -pmt_t pmt_dict_keys(pmt_t dict); +GRUEL_API pmt_t pmt_dict_keys(pmt_t dict); //! Return list of values -pmt_t pmt_dict_values(pmt_t dict); +GRUEL_API pmt_t pmt_dict_values(pmt_t dict); /* * ------------------------------------------------------------------------ @@ -530,16 +531,16 @@ pmt_t pmt_dict_values(pmt_t dict); */ //! Return true if \p obj is an any -bool pmt_is_any(pmt_t obj); +GRUEL_API bool pmt_is_any(pmt_t obj); //! make an any -pmt_t pmt_make_any(const boost::any &any); +GRUEL_API pmt_t pmt_make_any(const boost::any &any); //! Return underlying boost::any -boost::any pmt_any_ref(pmt_t obj); +GRUEL_API boost::any pmt_any_ref(pmt_t obj); //! Store \p any in \p obj -void pmt_any_set(pmt_t obj, const boost::any &any); +GRUEL_API void pmt_any_set(pmt_t obj, const boost::any &any); /* @@ -548,13 +549,13 @@ void pmt_any_set(pmt_t obj, const boost::any &any); * ------------------------------------------------------------------------ */ //! Return true if \p obj is a msg_accepter -bool pmt_is_msg_accepter(const pmt_t &obj); +GRUEL_API bool pmt_is_msg_accepter(const pmt_t &obj); //! make a msg_accepter -pmt_t pmt_make_msg_accepter(boost::shared_ptr<gruel::msg_accepter> ma); +GRUEL_API pmt_t pmt_make_msg_accepter(boost::shared_ptr<gruel::msg_accepter> ma); //! Return underlying msg_accepter -boost::shared_ptr<gruel::msg_accepter> pmt_msg_accepter_ref(const pmt_t &obj); +GRUEL_API boost::shared_ptr<gruel::msg_accepter> pmt_msg_accepter_ref(const pmt_t &obj); /* * ------------------------------------------------------------------------ @@ -563,7 +564,7 @@ boost::shared_ptr<gruel::msg_accepter> pmt_msg_accepter_ref(const pmt_t &obj); */ //! Return true if x and y are the same object; otherwise return false. -bool pmt_eq(const pmt_t& x, const pmt_t& y); +GRUEL_API bool pmt_eq(const pmt_t& x, const pmt_t& y); /*! * \brief Return true if x and y should normally be regarded as the same object, else false. @@ -578,7 +579,7 @@ bool pmt_eq(const pmt_t& x, const pmt_t& y); * x and y are pairs or vectors that denote same location in store. * </pre> */ -bool pmt_eqv(const pmt_t& x, const pmt_t& y); +GRUEL_API bool pmt_eqv(const pmt_t& x, const pmt_t& y); /*! * pmt_equal recursively compares the contents of pairs and vectors, @@ -586,11 +587,11 @@ bool pmt_eqv(const pmt_t& x, const pmt_t& y); * pmt_equal may fail to terminate if its arguments are circular data * structures. */ -bool pmt_equal(const pmt_t& x, const pmt_t& y); +GRUEL_API bool pmt_equal(const pmt_t& x, const pmt_t& y); //! Return the number of elements in v -size_t pmt_length(const pmt_t& v); +GRUEL_API size_t pmt_length(const pmt_t& v); /*! * \brief Find the first pair in \p alist whose car field is \p obj @@ -600,7 +601,7 @@ size_t pmt_length(const pmt_t& v); * in \p alist has \p obj as its car then \#f is returned. * Uses pmt_eq to compare \p obj with car fields of the pairs in \p alist. */ -pmt_t pmt_assq(pmt_t obj, pmt_t alist); +GRUEL_API pmt_t pmt_assq(pmt_t obj, pmt_t alist); /*! * \brief Find the first pair in \p alist whose car field is \p obj @@ -610,7 +611,7 @@ pmt_t pmt_assq(pmt_t obj, pmt_t alist); * in \p alist has \p obj as its car then \#f is returned. * Uses pmt_eqv to compare \p obj with car fields of the pairs in \p alist. */ -pmt_t pmt_assv(pmt_t obj, pmt_t alist); +GRUEL_API pmt_t pmt_assv(pmt_t obj, pmt_t alist); /*! * \brief Find the first pair in \p alist whose car field is \p obj @@ -620,7 +621,7 @@ pmt_t pmt_assv(pmt_t obj, pmt_t alist); * in \p alist has \p obj as its car then \#f is returned. * Uses pmt_equal to compare \p obj with car fields of the pairs in \p alist. */ -pmt_t pmt_assoc(pmt_t obj, pmt_t alist); +GRUEL_API pmt_t pmt_assoc(pmt_t obj, pmt_t alist); /*! * \brief Apply \p proc element-wise to the elements of list and returns @@ -629,21 +630,21 @@ pmt_t pmt_assoc(pmt_t obj, pmt_t alist); * \p list must be a list. The dynamic order in which \p proc is * applied to the elements of \p list is unspecified. */ -pmt_t pmt_map(pmt_t proc(const pmt_t&), pmt_t list); +GRUEL_API pmt_t pmt_map(pmt_t proc(const pmt_t&), pmt_t list); /*! * \brief reverse \p list. * * \p list must be a proper list. */ -pmt_t pmt_reverse(pmt_t list); +GRUEL_API pmt_t pmt_reverse(pmt_t list); /*! * \brief destructively reverse \p list. * * \p list must be a proper list. */ -pmt_t pmt_reverse_x(pmt_t list); +GRUEL_API pmt_t pmt_reverse_x(pmt_t list); /*! * \brief (acons x y a) == (cons (cons x y) a) @@ -657,76 +658,76 @@ pmt_acons(pmt_t x, pmt_t y, pmt_t a) /*! * \brief locates \p nth element of \n list where the car is the 'zeroth' element. */ -pmt_t pmt_nth(size_t n, pmt_t list); +GRUEL_API pmt_t pmt_nth(size_t n, pmt_t list); /*! * \brief returns the tail of \p list that would be obtained by calling * cdr \p n times in succession. */ -pmt_t pmt_nthcdr(size_t n, pmt_t list); +GRUEL_API pmt_t pmt_nthcdr(size_t n, pmt_t list); /*! * \brief Return the first sublist of \p list whose car is \p obj. * If \p obj does not occur in \p list, then \#f is returned. * pmt_memq use pmt_eq to compare \p obj with the elements of \p list. */ -pmt_t pmt_memq(pmt_t obj, pmt_t list); +GRUEL_API pmt_t pmt_memq(pmt_t obj, pmt_t list); /*! * \brief Return the first sublist of \p list whose car is \p obj. * If \p obj does not occur in \p list, then \#f is returned. * pmt_memv use pmt_eqv to compare \p obj with the elements of \p list. */ -pmt_t pmt_memv(pmt_t obj, pmt_t list); +GRUEL_API pmt_t pmt_memv(pmt_t obj, pmt_t list); /*! * \brief Return the first sublist of \p list whose car is \p obj. * If \p obj does not occur in \p list, then \#f is returned. * pmt_member use pmt_equal to compare \p obj with the elements of \p list. */ -pmt_t pmt_member(pmt_t obj, pmt_t list); +GRUEL_API pmt_t pmt_member(pmt_t obj, pmt_t list); /*! * \brief Return true if every element of \p list1 appears in \p list2, and false otherwise. * Comparisons are done with pmt_eqv. */ -bool pmt_subsetp(pmt_t list1, pmt_t list2); +GRUEL_API bool pmt_subsetp(pmt_t list1, pmt_t list2); /*! * \brief Return a list of length 1 containing \p x1 */ -pmt_t pmt_list1(const pmt_t& x1); +GRUEL_API pmt_t pmt_list1(const pmt_t& x1); /*! * \brief Return a list of length 2 containing \p x1, \p x2 */ -pmt_t pmt_list2(const pmt_t& x1, const pmt_t& x2); +GRUEL_API pmt_t pmt_list2(const pmt_t& x1, const pmt_t& x2); /*! * \brief Return a list of length 3 containing \p x1, \p x2, \p x3 */ -pmt_t pmt_list3(const pmt_t& x1, const pmt_t& x2, const pmt_t& x3); +GRUEL_API pmt_t pmt_list3(const pmt_t& x1, const pmt_t& x2, const pmt_t& x3); /*! * \brief Return a list of length 4 containing \p x1, \p x2, \p x3, \p x4 */ -pmt_t pmt_list4(const pmt_t& x1, const pmt_t& x2, const pmt_t& x3, const pmt_t& x4); +GRUEL_API pmt_t pmt_list4(const pmt_t& x1, const pmt_t& x2, const pmt_t& x3, const pmt_t& x4); /*! * \brief Return a list of length 5 containing \p x1, \p x2, \p x3, \p x4, \p x5 */ -pmt_t pmt_list5(const pmt_t& x1, const pmt_t& x2, const pmt_t& x3, const pmt_t& x4, const pmt_t& x5); +GRUEL_API pmt_t pmt_list5(const pmt_t& x1, const pmt_t& x2, const pmt_t& x3, const pmt_t& x4, const pmt_t& x5); /*! * \brief Return a list of length 6 containing \p x1, \p x2, \p x3, \p x4, \p * x5, \p x6 */ -pmt_t pmt_list6(const pmt_t& x1, const pmt_t& x2, const pmt_t& x3, const pmt_t& x4, const pmt_t& x5, const pmt_t& x6); +GRUEL_API pmt_t pmt_list6(const pmt_t& x1, const pmt_t& x2, const pmt_t& x3, const pmt_t& x4, const pmt_t& x5, const pmt_t& x6); /*! * \brief Return \p list with \p item added to it. */ -pmt_t pmt_list_add(pmt_t list, const pmt_t& item); +GRUEL_API pmt_t pmt_list_add(pmt_t list, const pmt_t& item); /* @@ -734,10 +735,10 @@ pmt_t pmt_list_add(pmt_t list, const pmt_t& item); * read / write * ------------------------------------------------------------------------ */ -extern const pmt_t PMT_EOF; //< The end of file object +extern GRUEL_API const pmt_t PMT_EOF; //< The end of file object //! return true if obj is the EOF object, otherwise return false. -bool pmt_is_eof_object(pmt_t obj); +GRUEL_API bool pmt_is_eof_object(pmt_t obj); /*! * read converts external representations of pmt objects into the @@ -754,26 +755,26 @@ bool pmt_is_eof_object(pmt_t obj); * representation, but the external representation is incomplete and * therefore not parsable, an error is signaled. */ -pmt_t pmt_read(std::istream &port); +GRUEL_API pmt_t pmt_read(std::istream &port); /*! * Write a written representation of \p obj to the given \p port. */ -void pmt_write(pmt_t obj, std::ostream &port); +GRUEL_API void pmt_write(pmt_t obj, std::ostream &port); /*! * Return a string representation of \p obj. * This is the same output as would be generated by pmt_write. */ -std::string pmt_write_string(pmt_t obj); +GRUEL_API std::string pmt_write_string(pmt_t obj); -std::ostream& operator<<(std::ostream &os, pmt_t obj); +GRUEL_API std::ostream& operator<<(std::ostream &os, pmt_t obj); /*! * \brief Write pmt string representation to stdout. */ -void pmt_print(pmt_t v); +GRUEL_API void pmt_print(pmt_t v); /* @@ -784,25 +785,25 @@ void pmt_print(pmt_t v); /*! * \brief Write portable byte-serial representation of \p obj to \p sink */ -bool pmt_serialize(pmt_t obj, std::streambuf &sink); +GRUEL_API bool pmt_serialize(pmt_t obj, std::streambuf &sink); /*! * \brief Create obj from portable byte-serial representation */ -pmt_t pmt_deserialize(std::streambuf &source); +GRUEL_API pmt_t pmt_deserialize(std::streambuf &source); -void pmt_dump_sizeof(); // debugging +GRUEL_API void pmt_dump_sizeof(); // debugging /*! * \brief Provide a simple string generating interface to pmt's serialize function */ -std::string pmt_serialize_str(pmt_t obj); +GRUEL_API std::string pmt_serialize_str(pmt_t obj); /*! * \brief Provide a simple string generating interface to pmt's deserialize function */ -pmt_t pmt_deserialize_str(std::string str); +GRUEL_API pmt_t pmt_deserialize_str(std::string str); } /* namespace pmt */ diff --git a/gruel/src/include/gruel/pmt_pool.h b/gruel/src/include/gruel/pmt_pool.h index b792523e0..2b227ce6a 100644 --- a/gruel/src/include/gruel/pmt_pool.h +++ b/gruel/src/include/gruel/pmt_pool.h @@ -21,6 +21,7 @@ #ifndef INCLUDED_PMT_POOL_H #define INCLUDED_PMT_POOL_H +#include <gruel/api.h> #include <cstddef> #include <vector> #include <boost/thread.hpp> @@ -33,9 +34,9 @@ namespace pmt { * FIXME may want to go to global allocation with per-thread free list. * This would eliminate virtually all lock contention. */ -class pmt_pool { +class GRUEL_API pmt_pool { - struct item { + struct GRUEL_API item { struct item *d_next; }; diff --git a/gruel/src/include/gruel/realtime.h b/gruel/src/include/gruel/realtime.h index d110ec956..87f2b0f74 100644 --- a/gruel/src/include/gruel/realtime.h +++ b/gruel/src/include/gruel/realtime.h @@ -23,6 +23,7 @@ #ifndef INCLUDED_GRUEL_REALTIME_H #define INCLUDED_GRUEL_REALTIME_H +#include <gruel/api.h> #include <stdexcept> /*! @@ -58,7 +59,7 @@ namespace gruel { static inline int rt_priority_max() { return 15; } static inline int rt_priority_default() { return 1; } - struct rt_sched_param { + struct GRUEL_API rt_sched_param { int priority; rt_sched_policy policy; @@ -88,7 +89,7 @@ namespace gruel { // NOTE: If you change this, you need to change the code in // gnuradio-core/src/lib/runtime/gr_realtime.i, see note there. rt_status_t - enable_realtime_scheduling(rt_sched_param = rt_sched_param()); + GRUEL_API enable_realtime_scheduling(rt_sched_param = rt_sched_param()); } // namespace gruel diff --git a/gruel/src/include/gruel/sys_pri.h b/gruel/src/include/gruel/sys_pri.h index b0fd83654..a29b051bf 100644 --- a/gruel/src/include/gruel/sys_pri.h +++ b/gruel/src/include/gruel/sys_pri.h @@ -22,6 +22,7 @@ #ifndef INCLUDED_GRUEL_SYS_PRI_H #define INCLUDED_GRUEL_SYS_PRI_H +#include <gruel/api.h> #include <gruel/realtime.h> /* @@ -29,7 +30,7 @@ */ namespace gruel { - struct sys_pri { + struct GRUEL_API sys_pri { static rt_sched_param python(); // python code static rt_sched_param normal(); // normal blocks static rt_sched_param gcell_event_handler(); diff --git a/gruel/src/include/gruel/thread.h b/gruel/src/include/gruel/thread.h index 5a8ab1876..c6031d88d 100644 --- a/gruel/src/include/gruel/thread.h +++ b/gruel/src/include/gruel/thread.h @@ -21,6 +21,7 @@ #ifndef INCLUDED_THREAD_H #define INCLUDED_THREAD_H +#include <gruel/api.h> #include <boost/thread/thread.hpp> #include <boost/thread/mutex.hpp> #include <boost/thread/locks.hpp> diff --git a/gruel/src/include/gruel/thread_body_wrapper.h b/gruel/src/include/gruel/thread_body_wrapper.h index b024bfdaf..ae0feda08 100644 --- a/gruel/src/include/gruel/thread_body_wrapper.h +++ b/gruel/src/include/gruel/thread_body_wrapper.h @@ -21,6 +21,7 @@ #ifndef INCLUDED_THREAD_BODY_WRAPPER_H #define INCLUDED_THREAD_BODY_WRAPPER_H +#include <gruel/api.h> #include <gruel/thread.h> #include <exception> #include <iostream> @@ -28,7 +29,7 @@ namespace gruel { - void mask_signals(); + GRUEL_API void mask_signals(); template <class F> class thread_body_wrapper diff --git a/gruel/src/include/gruel/thread_group.h b/gruel/src/include/gruel/thread_group.h index 0270746e4..e1658dd1f 100644 --- a/gruel/src/include/gruel/thread_group.h +++ b/gruel/src/include/gruel/thread_group.h @@ -15,6 +15,7 @@ #ifndef INCLUDED_GRUEL_THREAD_GROUP_H #define INCLUDED_GRUEL_THREAD_GROUP_H +#include <gruel/api.h> #include <gruel/thread.h> #include <boost/utility.hpp> #include <boost/thread/shared_mutex.hpp> @@ -22,7 +23,7 @@ namespace gruel { - class thread_group : public boost::noncopyable + class GRUEL_API thread_group : public boost::noncopyable { public: thread_group(); diff --git a/gruel/src/lib/CMakeLists.txt b/gruel/src/lib/CMakeLists.txt new file mode 100644 index 000000000..d078e52f9 --- /dev/null +++ b/gruel/src/lib/CMakeLists.txt @@ -0,0 +1,110 @@ +# Copyright 2010-2011 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio 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 General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. + +######################################################################## +# Include subdirs rather to populate to the sources lists. +######################################################################## +INCLUDE(GrMiscUtils) +INCLUDE(CheckCXXSourceCompiles) + +GR_CHECK_HDR_N_DEF(signal.h HAVE_SIGNAL_H) +GR_CHECK_HDR_N_DEF(sched.h HAVE_SCHED_H) + +SET(CMAKE_REQUIRED_LIBRARIES -lpthread) +CHECK_CXX_SOURCE_COMPILES(" + #include <signal.h> + int main(){pthread_sigmask(0, 0, 0); return 0;} + " HAVE_PTHREAD_SIGMASK +) +GR_ADD_COND_DEF(HAVE_PTHREAD_SIGMASK) + +SET(CMAKE_REQUIRED_LIBRARIES -lpthread) +CHECK_CXX_SOURCE_COMPILES(" + #include <pthread.h> + int main(){ + pthread_t pthread; + pthread_setschedparam(pthread, 0, 0); + return 0; + } " HAVE_PTHREAD_SETSCHEDPARAM +) +GR_ADD_COND_DEF(HAVE_PTHREAD_SETSCHEDPARAM) + +CHECK_CXX_SOURCE_COMPILES(" + #include <sched.h> + int main(){ + pid_t pid; + sched_setscheduler(pid, 0, 0); + return 0; + } " HAVE_SCHED_SETSCHEDULER +) +GR_ADD_COND_DEF(HAVE_SCHED_SETSCHEDULER) + +######################################################################## +# Include subdirs rather to populate to the sources lists. +######################################################################## +GR_INCLUDE_SUBDIRECTORY(msg) +GR_INCLUDE_SUBDIRECTORY(pmt) + +######################################################################## +# Setup the include and linker paths +######################################################################## +INCLUDE_DIRECTORIES(${GRUEL_INCLUDE_DIRS}) +INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}) + +INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIRS}) +LINK_DIRECTORIES(${Boost_LIBRARY_DIRS}) + +######################################################################## +# Setup library +######################################################################## +LIST(APPEND gruel_sources + realtime.cc + sys_pri.cc + thread_body_wrapper.cc + thread_group.cc +) + +ADD_LIBRARY(gruel SHARED ${gruel_sources}) +TARGET_LINK_LIBRARIES(gruel ${Boost_LIBRARIES}) +SET_TARGET_PROPERTIES(gruel PROPERTIES DEFINE_SYMBOL "gruel_EXPORTS") +SET_TARGET_PROPERTIES(gruel PROPERTIES SOVERSION ${LIBVER}) + +INSTALL(TARGETS gruel + LIBRARY DESTINATION ${GR_LIBRARY_DIR} COMPONENT "gruel_runtime" # .so/.dylib file + ARCHIVE DESTINATION ${GR_LIBRARY_DIR} COMPONENT "gruel_devel" # .lib file + RUNTIME DESTINATION ${GR_RUNTIME_DIR} COMPONENT "gruel_runtime" # .dll file +) + +######################################################################## +# Setup tests +# Set the test environment so the build libs will be found under MSVC. +######################################################################## +IF(ENABLE_TESTING) + +INCLUDE_DIRECTORIES(${CPPUNIT_INCLUDE_DIRS}) +LINK_DIRECTORIES(${CPPUNIT_LIBRARY_DIRS}) + +INCLUDE(GrTest) +SET(GR_TEST_TARGET_DEPS gruel) +LIST(APPEND test_gruel_sources test_gruel.cc) +ADD_EXECUTABLE(test_gruel ${test_gruel_sources}) +TARGET_LINK_LIBRARIES(test_gruel gruel ${CPPUNIT_LIBRARIES}) +GR_ADD_TEST(gruel-test test_gruel) + +ENDIF(ENABLE_TESTING) diff --git a/gruel/src/lib/msg/CMakeLists.txt b/gruel/src/lib/msg/CMakeLists.txt new file mode 100644 index 000000000..877cc2909 --- /dev/null +++ b/gruel/src/lib/msg/CMakeLists.txt @@ -0,0 +1,28 @@ +# Copyright 2010 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio 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 General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. + +######################################################################## +# This file included, use CMake directory variables +######################################################################## + +LIST(APPEND gruel_sources + ${CMAKE_CURRENT_SOURCE_DIR}/msg_accepter.cc + ${CMAKE_CURRENT_SOURCE_DIR}/msg_accepter_msgq.cc + ${CMAKE_CURRENT_SOURCE_DIR}/msg_queue.cc +) diff --git a/gruel/src/lib/pmt/CMakeLists.txt b/gruel/src/lib/pmt/CMakeLists.txt new file mode 100644 index 000000000..797db475a --- /dev/null +++ b/gruel/src/lib/pmt/CMakeLists.txt @@ -0,0 +1,90 @@ +# Copyright 2010 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio 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 General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. + +######################################################################## +# This file included, use CMake directory variables +######################################################################## +INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}) +INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}) + +######################################################################## +# Generate serial tags header file +######################################################################## +GET_FILENAME_COMPONENT(SCHEME_DIR + ${CMAKE_CURRENT_SOURCE_DIR}/../../scheme/gnuradio ABSOLUTE +) + +GET_FILENAME_COMPONENT(PMT_SERIAL_TAGS_H + ${CMAKE_CURRENT_BINARY_DIR}/../../include/gruel/pmt_serial_tags.h ABSOLUTE +) + +ADD_CUSTOM_COMMAND( + OUTPUT ${PMT_SERIAL_TAGS_H} + DEPENDS ${SCHEME_DIR}/gen-serial-tags.py + DEPENDS ${SCHEME_DIR}/pmt-serial-tags.scm + COMMAND ${PYTHON_EXECUTABLE} + ${SCHEME_DIR}/gen-serial-tags.py + ${SCHEME_DIR}/pmt-serial-tags.scm + ${PMT_SERIAL_TAGS_H} +) + +INSTALL( + FILES ${PMT_SERIAL_TAGS_H} + DESTINATION ${GR_INCLUDE_DIR}/gruel + COMPONENT "gruel_devel" +) + +INCLUDE(AddFileDependencies) +ADD_FILE_DEPENDENCIES( + ${CMAKE_CURRENT_SOURCE_DIR}/pmt_serialize.cc + ${PMT_SERIAL_TAGS_H} +) + +######################################################################## +# Generate other pmt stuff +######################################################################## +ADD_CUSTOM_COMMAND( + OUTPUT + ${CMAKE_CURRENT_BINARY_DIR}/pmt_unv_int.h + ${CMAKE_CURRENT_BINARY_DIR}/qa_pmt_unv.h + ${CMAKE_CURRENT_BINARY_DIR}/pmt_unv.cc + ${CMAKE_CURRENT_BINARY_DIR}/qa_pmt_unv.cc + DEPENDS + ${CMAKE_CURRENT_SOURCE_DIR}/generate_unv.py + ${CMAKE_CURRENT_SOURCE_DIR}/unv_template.h.t + ${CMAKE_CURRENT_SOURCE_DIR}/unv_template.cc.t + ${CMAKE_CURRENT_SOURCE_DIR}/unv_qa_template.cc.t + COMMAND ${PYTHON_EXECUTABLE} -B -c + \"import os,sys\;srcdir='${CMAKE_CURRENT_SOURCE_DIR}'\;sys.path.append(srcdir)\;os.environ['srcdir']=srcdir\;from generate_unv import main\;main()\" + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} +) + +LIST(APPEND gruel_sources + ${CMAKE_CURRENT_BINARY_DIR}/pmt_unv.cc + ${CMAKE_CURRENT_SOURCE_DIR}/pmt.cc + ${CMAKE_CURRENT_SOURCE_DIR}/pmt_io.cc + ${CMAKE_CURRENT_SOURCE_DIR}/pmt_pool.cc + ${CMAKE_CURRENT_SOURCE_DIR}/pmt_serialize.cc +) + +LIST(APPEND test_gruel_sources + ${CMAKE_CURRENT_BINARY_DIR}/qa_pmt_unv.cc + ${CMAKE_CURRENT_SOURCE_DIR}/qa_pmt_prims.cc + ${CMAKE_CURRENT_SOURCE_DIR}/qa_pmt.cc +) diff --git a/gruel/src/lib/pmt/pmt_int.h b/gruel/src/lib/pmt/pmt_int.h index ea28e37b4..3a5cd382b 100644 --- a/gruel/src/lib/pmt/pmt_int.h +++ b/gruel/src/lib/pmt/pmt_int.h @@ -35,7 +35,7 @@ #define PMT_LOCAL_ALLOCATOR 0 // define to 0 or 1 namespace pmt { -class pmt_base : boost::noncopyable { +class GRUEL_API pmt_base : boost::noncopyable { mutable boost::detail::atomic_count count_; protected: diff --git a/gruel/src/lib/pmt/qa_pmt.h b/gruel/src/lib/pmt/qa_pmt.h index 43a6dbf67..424c1065b 100644 --- a/gruel/src/lib/pmt/qa_pmt.h +++ b/gruel/src/lib/pmt/qa_pmt.h @@ -23,11 +23,12 @@ #ifndef INCLUDED_QA_PMT_H #define INCLUDED_QA_PMT_H +#include <gruel/attributes.h> #include <cppunit/TestSuite.h> //! collect all the tests for pmt -class qa_pmt { +class __GR_ATTR_EXPORT qa_pmt { public: //! return suite of tests for all of pmt static CppUnit::TestSuite *suite (); diff --git a/gruel/src/lib/pmt/qa_pmt_prims.cc b/gruel/src/lib/pmt/qa_pmt_prims.cc index 985361f13..7dec30d56 100644 --- a/gruel/src/lib/pmt/qa_pmt_prims.cc +++ b/gruel/src/lib/pmt/qa_pmt_prims.cc @@ -23,6 +23,7 @@ #include <qa_pmt_prims.h> #include <cppunit/TestAssert.h> #include <gruel/msg_passing.h> +#include <boost/format.hpp> #include <cstdio> #include <cstring> #include <sstream> @@ -54,9 +55,8 @@ qa_pmt_prims::test_symbols() // generate a bunch of symbols for (int i = 0; i < N; i++){ - char buf[100]; - snprintf(buf, sizeof(buf), "test-%d", i); - v1[i] = mp(buf); + std::string buf = str(boost::format("test-%d") % i); + v1[i] = mp(buf.c_str()); } // confirm that they are all unique @@ -66,9 +66,8 @@ qa_pmt_prims::test_symbols() // generate the same symbols again for (int i = 0; i < N; i++){ - char buf[100]; - snprintf(buf, sizeof(buf), "test-%d", i); - v2[i] = mp(buf); + std::string buf = str(boost::format("test-%d") % i); + v2[i] = mp(buf.c_str()); } // confirm that we get the same ones back diff --git a/gruel/src/lib/pmt/qa_pmt_prims.h b/gruel/src/lib/pmt/qa_pmt_prims.h index efc5c6050..cc1409ee6 100644 --- a/gruel/src/lib/pmt/qa_pmt_prims.h +++ b/gruel/src/lib/pmt/qa_pmt_prims.h @@ -22,10 +22,12 @@ #ifndef INCLUDED_QA_PMT_PRIMS_H #define INCLUDED_QA_PMT_PRIMS_H +#include <gruel/attributes.h> +#include <gruel/api.h> //reason: suppress warnings #include <cppunit/extensions/HelperMacros.h> #include <cppunit/TestCase.h> -class qa_pmt_prims : public CppUnit::TestCase { +class __GR_ATTR_EXPORT qa_pmt_prims : public CppUnit::TestCase { CPPUNIT_TEST_SUITE(qa_pmt_prims); CPPUNIT_TEST(test_symbols); diff --git a/gruel/src/lib/realtime.cc b/gruel/src/lib/realtime.cc index 7397cf3d3..96351f812 100644 --- a/gruel/src/lib/realtime.cc +++ b/gruel/src/lib/realtime.cc @@ -132,6 +132,38 @@ namespace gruel { } // namespace gruel +#elif defined(_WIN32) || defined(__WIN32__) || defined(WIN32) + +#include <windows.h> + +namespace gruel { + + rt_status_t enable_realtime_scheduling(rt_sched_param p){ + + //set the priority class on the process + int pri_class = (true)? REALTIME_PRIORITY_CLASS : NORMAL_PRIORITY_CLASS; + if (SetPriorityClass(GetCurrentProcess(), pri_class) == 0) + return RT_OTHER_ERROR; + + //scale the priority value to the constants + int priorities[] = { + THREAD_PRIORITY_IDLE, THREAD_PRIORITY_LOWEST, THREAD_PRIORITY_BELOW_NORMAL, THREAD_PRIORITY_NORMAL, + THREAD_PRIORITY_ABOVE_NORMAL, THREAD_PRIORITY_HIGHEST, THREAD_PRIORITY_TIME_CRITICAL + }; + const double priority = double(p.priority)/(rt_priority_max() - rt_priority_min()); + size_t pri_index = size_t((priority+1.0)*6/2.0); // -1 -> 0, +1 -> 6 + pri_index %= sizeof(priorities)/sizeof(*priorities); //range check + + //set the thread priority on the thread + if (SetThreadPriority(GetCurrentThread(), priorities[pri_index]) == 0) + return RT_OTHER_ERROR; + + //printf("SetPriorityClass + SetThreadPriority\n"); + return RT_OK; + } + +} // namespace gruel + #else namespace gruel { diff --git a/gruel/src/python/CMakeLists.txt b/gruel/src/python/CMakeLists.txt new file mode 100644 index 000000000..491763cd7 --- /dev/null +++ b/gruel/src/python/CMakeLists.txt @@ -0,0 +1,52 @@ +# Copyright 2011 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio 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 General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. + +INCLUDE(GrPython) + +######################################################################## +# Install python files +######################################################################## +GR_PYTHON_INSTALL( + FILES __init__.py + DESTINATION ${GR_PYTHON_DIR}/gruel + COMPONENT "gruel_python" +) + +GR_PYTHON_INSTALL( + FILES pmt/__init__.py + DESTINATION ${GR_PYTHON_DIR}/gruel/pmt + COMPONENT "gruel_python" +) + +######################################################################## +# Setup unit tests +######################################################################## +IF(ENABLE_TESTING) +INCLUDE(GrTest) +FILE(GLOB py_qa_test_files "qa_*.py") +FOREACH(py_qa_test_file ${py_qa_test_files}) + GET_FILENAME_COMPONENT(py_qa_test_name ${py_qa_test_file} NAME_WE) + SET(GR_TEST_PYTHON_DIRS + ${CMAKE_BINARY_DIR}/gruel/src/python + ${CMAKE_BINARY_DIR}/gruel/src/swig + ) + SET(GR_TEST_TARGET_DEPS gruel gnuradio-core) + GR_ADD_TEST(${py_qa_test_name} ${PYTHON_EXECUTABLE} ${py_qa_test_file}) +ENDFOREACH(py_qa_test_file) +ENDIF(ENABLE_TESTING) diff --git a/gruel/src/scheme/gnuradio/CMakeLists.txt b/gruel/src/scheme/gnuradio/CMakeLists.txt new file mode 100644 index 000000000..bfa2a415f --- /dev/null +++ b/gruel/src/scheme/gnuradio/CMakeLists.txt @@ -0,0 +1,26 @@ +# Copyright 2010 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio 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 General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. + +######################################################################## + +INSTALL(FILES + pmt-serial-tags.scm + pmt-serialize.scm + macros-etc.scm +DESTINATION ${GR_PKG_DATA_DIR} COMPONENT "gruel_swig") diff --git a/gruel/src/swig/CMakeLists.txt b/gruel/src/swig/CMakeLists.txt new file mode 100644 index 000000000..05f875451 --- /dev/null +++ b/gruel/src/swig/CMakeLists.txt @@ -0,0 +1,41 @@ +# Copyright 2011 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio 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 General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. + +######################################################################## +# Setup swig generation +######################################################################## +INCLUDE(GrPython) +INCLUDE(GrSwig) + +SET(GR_SWIG_INCLUDE_DIRS ${GRUEL_INCLUDE_DIRS}) +SET(GR_SWIG_LIBRARIES gruel) + +GR_SWIG_MAKE(pmt_swig pmt_swig.i) + +GR_SWIG_INSTALL( + TARGETS pmt_swig + DESTINATION ${GR_PYTHON_DIR}/gruel/pmt + COMPONENT "gruel_python" +) + +INSTALL( + FILES gr_intrusive_ptr.i + DESTINATION ${GR_INCLUDE_DIR}/gnuradio/swig + COMPONENT "gruel_swig" +) diff --git a/volk/CMakeLists.txt b/volk/CMakeLists.txt index 22c09b3f8..743f07925 100644 --- a/volk/CMakeLists.txt +++ b/volk/CMakeLists.txt @@ -30,6 +30,9 @@ ENABLE_TESTING() SET(VERSION 0.1) SET(LIBVER 0.0.0) +SET(CMAKE_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}) #allows this to be a sub-project +SET(CMAKE_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}) #allows this to be a sub-project + ######################################################################## # Dependencies setup ######################################################################## @@ -55,6 +58,7 @@ CONFIGURE_FILE( INSTALL( FILES ${CMAKE_CURRENT_BINARY_DIR}/volk.pc DESTINATION lib${LIB_SUFFIX}/pkgconfig + COMPONENT "volk_devel" ) ######################################################################## @@ -62,7 +66,8 @@ INSTALL( ######################################################################## INSTALL( DIRECTORY ${CMAKE_SOURCE_DIR}/include/volk - DESTINATION include FILES_MATCHING PATTERN "*.h" + DESTINATION include COMPONENT "volk_devel" + FILES_MATCHING PATTERN "*.h" ) INSTALL(FILES @@ -70,7 +75,9 @@ INSTALL(FILES ${CMAKE_BINARY_DIR}/include/volk/volk_cpu.h ${CMAKE_BINARY_DIR}/include/volk/volk_config_fixed.h ${CMAKE_BINARY_DIR}/include/volk/volk_typedefs.h -DESTINATION include/volk) + DESTINATION include/volk + COMPONENT "volk_devel" +) ######################################################################## # Setup the library diff --git a/volk/apps/CMakeLists.txt b/volk/apps/CMakeLists.txt index a0bf7e900..b0b48360f 100644 --- a/volk/apps/CMakeLists.txt +++ b/volk/apps/CMakeLists.txt @@ -18,6 +18,10 @@ ######################################################################## # Setup profiler ######################################################################## +FIND_PACKAGE(Boost) + +IF(Boost_FOUND AND UNIX) #uses mkdir and $HOME + IF(MSVC) INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/msvc) ENDIF(MSVC) @@ -28,6 +32,7 @@ INCLUDE_DIRECTORIES( ${CMAKE_SOURCE_DIR}/lib ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} + ${Boost_INCLUDE_DIRS} ) ADD_EXECUTABLE(volk_profile @@ -36,3 +41,5 @@ ADD_EXECUTABLE(volk_profile ) TARGET_LINK_LIBRARIES(volk_profile volk ${Boost_LIBRARIES}) + +ENDIF(Boost_FOUND AND UNIX) diff --git a/volk/gen/archs.xml b/volk/gen/archs.xml index f6822871f..960558b7c 100644 --- a/volk/gen/archs.xml +++ b/volk/gen/archs.xml @@ -29,6 +29,7 @@ <val>1</val> <overrule>MD_SUBCPU</overrule> <overrule_val>x86</overrule_val> + <mutex>32</mutex> </arch> <arch name="3dnow" type="x86"> diff --git a/volk/gen/make_makefile_am.py b/volk/gen/make_makefile_am.py index d700626bb..f843b4413 100644 --- a/volk/gen/make_makefile_am.py +++ b/volk/gen/make_makefile_am.py @@ -77,9 +77,9 @@ noinst_LTLIBRARIES = if archflags_dict[arch] != "none": tempstring += "-" + archflags_dict[arch] + " " - tempstring += "\nnoinst_LTLIBRARIES += libvolk_" + machine_name + ".la " + tempstring += "\nnoinst_LTLIBRARIES += libvolk_" + machine_name + ".la " tempstring += "\nlibvolk_la_LIBADD += libvolk_" + machine_name + ".la\n" - tempstring += "libvolk_la_CPPFLAGS += -DLV_MACHINE_" + machine_name.swapcase() + " \n" + tempstring += "libvolk_la_CPPFLAGS += -DLV_MACHINE_" + machine_name.swapcase() + " \n" tempstring += "endif\n" diff --git a/volk/gen/volk_register.py b/volk/gen/volk_register.py index 75e5eeb87..f5854bbce 100644 --- a/volk/gen/volk_register.py +++ b/volk/gen/volk_register.py @@ -91,7 +91,7 @@ for arch in archs: if a_var: archs.remove(arch); - +#strip out mutex archs archflags_dict = {} for filearch in filearchs: diff --git a/volk/lib/CMakeLists.txt b/volk/lib/CMakeLists.txt index 33a478265..c8b9449a6 100644 --- a/volk/lib/CMakeLists.txt +++ b/volk/lib/CMakeLists.txt @@ -27,6 +27,14 @@ EXECUTE_PROCESS( OUTPUT_VARIABLE arch_lines OUTPUT_STRIP_TRAILING_WHITESPACE ) +#get any mutually exclusive archs so we can exclude them +#this is really for compilers which can do both 32- and 64-bit compilations. +EXECUTE_PROCESS( + COMMAND ${PYTHON_EXECUTABLE} -c + "from xml.dom import minidom; print ';'.join(map(lambda a: '%s %s'%(a.parentNode.attributes['name'].value,a.firstChild.data),minidom.parse('${CMAKE_SOURCE_DIR}/gen/archs.xml').getElementsByTagName('mutex')))" + OUTPUT_VARIABLE mutex_lines OUTPUT_STRIP_TRAILING_WHITESPACE +) + #This macro sets the ${arch}_flag variable, #and handles special cases for MSVC arch flags. MACRO(set_arch_flag name flag) @@ -59,12 +67,25 @@ MACRO(handle_arch name flag) ENDIF() ENDMACRO(handle_arch) +MACRO(remove_mutex name mutex) + IF(have_${name}) + UNSET(have_${mutex}) + ENDIF() + LIST(REMOVE_ITEM available_arches ${mutex}) +ENDMACRO(remove_mutex) + #create a list of available arches FOREACH(arch_line ${arch_lines}) SEPARATE_ARGUMENTS(args UNIX_COMMAND "${arch_line}") handle_arch(${args}) ENDFOREACH(arch_line) +#strip out mutex archs +FOREACH(mutex_line ${mutex_lines}) + SEPARATE_ARGUMENTS(args UNIX_COMMAND "${mutex_line}") + remove_mutex(${args}) +ENDFOREACH(mutex_line) + MESSAGE(STATUS "Available arches: ${available_arches}") ######################################################################## @@ -160,7 +181,7 @@ ADD_CUSTOM_COMMAND( ######################################################################## FIND_PACKAGE(PkgConfig) IF(PKG_CONFIG_FOUND) -PKG_CHECK_MODULES(ORC "orc-0.4") +PKG_CHECK_MODULES(ORC "orc-0.4 > 0.4.11") ENDIF(PKG_CONFIG_FOUND) FIND_PROGRAM(ORCC_EXECUTABLE orcc) @@ -231,9 +252,9 @@ SET_TARGET_PROPERTIES(volk PROPERTIES SOVERSION ${LIBVER}) SET_TARGET_PROPERTIES(volk PROPERTIES DEFINE_SYMBOL "volk_EXPORTS") INSTALL(TARGETS volk - LIBRARY DESTINATION lib${LIB_SUFFIX} # .so file - ARCHIVE DESTINATION lib${LIB_SUFFIX} # .lib file - RUNTIME DESTINATION bin # .dll file + LIBRARY DESTINATION lib${LIB_SUFFIX} COMPONENT "volk_runtime" # .so file + ARCHIVE DESTINATION lib${LIB_SUFFIX} COMPONENT "volk_devel" # .lib file + RUNTIME DESTINATION bin COMPONENT "volk_runtime" # .dll file ) ######################################################################## @@ -256,6 +277,6 @@ ADD_EXECUTABLE(test_all ${CMAKE_CURRENT_SOURCE_DIR}/qa_utils.cc ) TARGET_LINK_LIBRARIES(test_all volk ${Boost_LIBRARIES}) -ADD_TEST(qa_volk_test_all test_all) +#ADD_TEST(qa_volk_test_all test_all) ENDIF() diff --git a/volk/lib/volk_prefs.c b/volk/lib/volk_prefs.c index 9743c51d9..b29d5fd87 100644 --- a/volk/lib/volk_prefs.c +++ b/volk/lib/volk_prefs.c @@ -23,7 +23,7 @@ int load_preferences(struct volk_arch_pref **prefs) { //get the config path get_config_path(path); config_file = fopen(path, "r"); - if(!config_file) return; //no prefs found + if(!config_file) return n_arch_prefs; //no prefs found while(fgets(line, 512, config_file) != NULL) { if(sscanf(line, "%s %s", function, arch) == 2 && !strncmp(function, "volk_", 5)) { |