--- /dev/null
+# libcodec2.la - a libtool library file
+# Generated by ltmain.sh (GNU libtool) 2.2.6 Debian-2.2.6a-4
+#
+# Please DO NOT delete this file!
+# It is necessary for linking the library.
+
+# The name that we can dlopen(3).
+dlname=''
+
+# Names of this library.
+library_names=''
+
+# The name of the static archive.
+old_library='libcodec2.a'
+
+# Linker flags that can not go in dependency_libs.
+inherited_linker_flags=''
+
+# Libraries that this one depends upon.
+dependency_libs=''
+
+# Names of additional weak libraries provided by this library
+weak_library_names=''
+
+# Version information for libcodec2.
+current=0
+age=0
+revision=0
+
+# Is this an already installed library?
+installed=yes
+
+# Should we warn about portability when linking against -modules?
+shouldnotlink=no
+
+# Files to dlopen/dlpreopen
+dlopen=''
+dlpreopen=''
+
+# Directory that this library needs to be installed in:
+libdir='/usr/local/lib'
--- /dev/null
+# libportaudiocpp.la - a libtool library file
+# Generated by libtool (GNU libtool) 2.4 Debian-2.4-2ubuntu1
+#
+# Please DO NOT delete this file!
+# It is necessary for linking the library.
+
+# The name that we can dlopen(3).
+dlname=''
+
+# Names of this library.
+library_names=''
+
+# The name of the static archive.
+old_library='libportaudiocpp.a'
+
+# Linker flags that can not go in dependency_libs.
+inherited_linker_flags=''
+
+# Libraries that this one depends upon.
+dependency_libs=' /usr/local/lib/libportaudio.la -lwinmm -lole32 -luuid'
+
+# Names of additional weak libraries provided by this library
+weak_library_names=''
+
+# Version information for libportaudiocpp.
+current=0
+age=0
+revision=12
+
+# Is this an already installed library?
+installed=yes
+
+# Should we warn about portability when linking against -modules?
+shouldnotlink=no
+
+# Files to dlopen/dlpreopen
+dlopen=''
+dlpreopen=''
+
+# Directory that this library needs to be installed in:
+libdir='/usr/local/lib'
--- /dev/null
+# libsamplerate.la - a libtool library file
+# Generated by libtool (GNU libtool) 2.4 Debian-2.4-3
+#
+# Please DO NOT delete this file!
+# It is necessary for linking the library.
+
+# The name that we can dlopen(3).
+dlname='../bin/libsamplerate-0.dll'
+
+# Names of this library.
+library_names='libsamplerate.dll.a'
+
+# The name of the static archive.
+old_library='libsamplerate.a'
+
+# Linker flags that can not go in dependency_libs.
+inherited_linker_flags=''
+
+# Libraries that this one depends upon.
+dependency_libs=''
+
+# Names of additional weak libraries provided by this library
+weak_library_names=''
+
+# Version information for libsamplerate.
+current=1
+age=1
+revision=8
+
+# Is this an already installed library?
+installed=yes
+
+# Should we warn about portability when linking against -modules?
+shouldnotlink=no
+
+# Files to dlopen/dlpreopen
+dlopen=''
+dlpreopen=''
+
+# Directory that this library needs to be installed in:
+libdir='/usr/local/lib'
--- /dev/null
+#include <iostream>
+#include "portaudiocpp/PortAudioCpp.hxx"
+
+#ifdef WIN32
+#include "portaudiocpp/AsioDeviceAdapter.hxx"
+#endif
+
+// ---------------------------------------------------------------------------------------
+
+void printSupportedStandardSampleRates(
+ const portaudio::DirectionSpecificStreamParameters &inputParameters,
+ const portaudio::DirectionSpecificStreamParameters &outputParameters)
+{
+ static double STANDARD_SAMPLE_RATES[] = {
+ 8000.0, 9600.0, 11025.0, 12000.0, 16000.0, 22050.0, 24000.0, 32000.0,
+ 44100.0, 48000.0, 88200.0, 96000.0, -1 }; // negative terminated list
+
+ int printCount = 0;
+
+ for (int i = 0; STANDARD_SAMPLE_RATES[i] > 0; ++i)
+ {
+ portaudio::StreamParameters tmp = portaudio::StreamParameters(inputParameters, outputParameters, STANDARD_SAMPLE_RATES[i], 0, paNoFlag);
+
+ if (tmp.isSupported())
+ {
+ if (printCount == 0)
+ {
+ std::cout << " " << STANDARD_SAMPLE_RATES[i]; // 8.2
+ printCount = 1;
+ }
+ else if (printCount == 4)
+ {
+ std::cout << "," << std::endl;
+ std::cout << " " << STANDARD_SAMPLE_RATES[i]; // 8.2
+ printCount = 1;
+ }
+ else
+ {
+ std::cout << ", " << STANDARD_SAMPLE_RATES[i]; // 8.2
+ ++printCount;
+ }
+ }
+ }
+
+ if (printCount == 0)
+ std::cout << "None" << std::endl;
+ else
+ std::cout << std::endl;
+}
+
+// ---------------------------------------------------------------------------------------
+
+int main(int, char*[]);
+int main(int, char*[])
+{
+ try
+ {
+ portaudio::AutoSystem autoSys;
+
+ portaudio::System &sys = portaudio::System::instance();
+
+ std::cout << "PortAudio version number = " << sys.version() << std::endl;
+ std::cout << "PortAudio version text = '" << sys.versionText() << "'" << std::endl;
+
+ int numDevices = sys.deviceCount();
+ std::cout << "Number of devices = " << numDevices << std::endl;
+
+ for (portaudio::System::DeviceIterator i = sys.devicesBegin(); i != sys.devicesEnd(); ++i)
+ {
+ std::cout << "--------------------------------------- device #" << (*i).index() << std::endl;
+
+ // Mark global and API specific default devices:
+ bool defaultDisplayed = false;
+
+ if ((*i).isSystemDefaultInputDevice())
+ {
+ std::cout << "[ Default Input";
+ defaultDisplayed = true;
+ }
+ else if ((*i).isHostApiDefaultInputDevice())
+ {
+ std::cout << "[ Default " << (*i).hostApi().name() << " Input";
+ defaultDisplayed = true;
+ }
+
+ if ((*i).isSystemDefaultOutputDevice())
+ {
+ std::cout << (defaultDisplayed ? "," : "[");
+ std::cout << " Default Output";
+ defaultDisplayed = true;
+ }
+ else if ((*i).isHostApiDefaultOutputDevice())
+ {
+ std::cout << (defaultDisplayed ? "," : "[");
+ std::cout << " Default " << (*i).hostApi().name() << " Output";
+ defaultDisplayed = true;
+ }
+
+ if (defaultDisplayed)
+ std::cout << " ]" << std::endl;
+
+ // Print device info:
+ std::cout << "Name = " << (*i).name() << std::endl;
+ std::cout << "Host API = " << (*i).hostApi().name() << std::endl;
+ std::cout << "Max inputs = " << (*i).maxInputChannels() << ", Max outputs = " << (*i).maxOutputChannels() << std::endl;
+
+ std::cout << "Default low input latency = " << (*i).defaultLowInputLatency() << std::endl; // 8.3
+ std::cout << "Default low output latency = " << (*i).defaultLowOutputLatency() << std::endl; // 8.3
+ std::cout << "Default high input latency = " << (*i).defaultHighInputLatency() << std::endl; // 8.3
+ std::cout << "Default high output latency = " << (*i).defaultHighOutputLatency() << std::endl; // 8.3
+
+#ifdef WIN32
+ // ASIO specific latency information:
+ if ((*i).hostApi().typeId() == paASIO)
+ {
+ portaudio::AsioDeviceAdapter asioDevice((*i));
+
+ std::cout << "ASIO minimum buffer size = " << asioDevice.minBufferSize() << std::endl;
+ std::cout << "ASIO maximum buffer size = " << asioDevice.maxBufferSize() << std::endl;
+ std::cout << "ASIO preferred buffer size = " << asioDevice.preferredBufferSize() << std::endl;
+
+ if (asioDevice.granularity() == -1)
+ std::cout << "ASIO buffer granularity = power of 2" << std::endl;
+ else
+ std::cout << "ASIO buffer granularity = " << asioDevice.granularity() << std::endl;
+ }
+#endif // WIN32
+
+ std::cout << "Default sample rate = " << (*i).defaultSampleRate() << std::endl; // 8.2
+
+ // Poll for standard sample rates:
+ portaudio::DirectionSpecificStreamParameters inputParameters((*i), (*i).maxInputChannels(), portaudio::INT16, true, 0.0, NULL);
+ portaudio::DirectionSpecificStreamParameters outputParameters((*i), (*i).maxOutputChannels(), portaudio::INT16, true, 0.0, NULL);
+
+ if (inputParameters.numChannels() > 0)
+ {
+ std::cout << "Supported standard sample rates" << std::endl;
+ std::cout << " for half-duplex 16 bit " << inputParameters.numChannels() << " channel input = " << std::endl;
+ printSupportedStandardSampleRates(inputParameters, portaudio::DirectionSpecificStreamParameters::null());
+ }
+
+ if (outputParameters.numChannels() > 0)
+ {
+ std::cout << "Supported standard sample rates" << std::endl;
+ std::cout << " for half-duplex 16 bit " << outputParameters.numChannels() << " channel output = " << std::endl;
+ printSupportedStandardSampleRates(portaudio::DirectionSpecificStreamParameters::null(), outputParameters);
+ }
+
+ if (inputParameters.numChannels() > 0 && outputParameters.numChannels() > 0)
+ {
+ std::cout << "Supported standard sample rates" << std::endl;
+ std::cout << " for full-duplex 16 bit " << inputParameters.numChannels() << " channel input, " << outputParameters.numChannels() << " channel output = " << std::endl;
+ printSupportedStandardSampleRates(inputParameters, outputParameters);
+ }
+ }
+
+ std::cout << "----------------------------------------------" << std::endl;
+ }
+ catch (const portaudio::PaException &e)
+ {
+ std::cout << "A PortAudio error occured: " << e.paErrorText() << std::endl;
+ }
+ catch (const portaudio::PaCppException &e)
+ {
+ std::cout << "A PortAudioCpp error occured: " << e.what() << std::endl;
+ }
+ catch (const std::exception &e)
+ {
+ std::cout << "A generic exception occured: " << e.what() << std::endl;
+ }
+ catch (...)
+ {
+ std::cout << "An unknown exception occured." << std::endl;
+ }
+
+ return 0;
+}
--- /dev/null
+#include <stdio.h>
+#include <math.h>
+#include "portaudio.h"
+\r
+// Note that many of the older ISA sound cards on PCs do NOT support
+// full duplex audio (simultaneous record and playback).
+// And some only support full duplex at lower sample rates.
+#define SAMPLE_RATE (44100)
+#define PA_SAMPLE_TYPE paFloat32
+#define FRAMES_PER_BUFFER (64)
+
+typedef float SAMPLE;
+
+float CubicAmplifier(float input);
+
+class PortAudioWrap\r
+{\r
+ public:\r
+ PortAudioWrap();\r
+ ~PortAudioWrap();\r
+\r
+ private:\r
+ PaStream *stream;\r
+ PaStreamParameters inputBuffer;
+ PaStreamParameters outputBuffer;
+ void *userData;\r
+ int samplerate;\r
+ unsigned long framesPerBuffer;
+ PaStreamCallbackFlags statusFlags;\r
+ PaStreamCallback *streamCallback;\r
+ PaStreamFinishedCallback *streamFinishedCallback;\r
+ const PaStreamCallbackTimeInfo* timeInfo;
+ PaDeviceIndex inputDevice;
+ PaDeviceIndex outputDevice;
+\r
+ public:\r
+
+ PaError streamOpen();\r
+\r
+ PaDeviceIndex getDefaultInputDevice();
+ PaDeviceIndex getDefaultOutputDevice();\r
+\r
+ PaStreamParameters *getDeviceInfo(PaDeviceIndex idx);\r
+ PaError setFramesPerBuffer(unsigned long size);\r
+ PaError setSampleRate(unsigned long size);\r
+ PaError setStreamFlags(PaStreamFlags flags);\r
+ PaError setCallback(PaStreamCallback *streamCallback);\r
+ PaError setStreamCallback(PaStream *stream, PaStreamCallback* callback ) { streamCallback = callback; return 0;}
+ PaError setStreamFinishedCallback(PaStream *stream, PaStreamFinishedCallback* streamFinishedCallback );
+
+ PaError setInputDevice(PaDeviceIndex dev);\r
+ PaError setInputChannelCount(int count);
+ PaError setInputSampleFormat(PaSampleFormat format);
+ PaError setInputSampleRate(PaSampleFormat format);
+ PaError setInputLatency(PaTime latency);\r
+ void setInputHostApiStreamInfo(void *info = NULL);\r
+ PaTime getInputDefaultLowLatency();
+
+ PaError setOutputDevice(PaDeviceIndex dev);\r
+ PaError setOutputChannelCount(int count);
+ PaError setOutputSampleFormat(PaSampleFormat format);
+ PaError setOutputLatency(PaTime latency);
+ void setOutputHostApiStreamInfo(void *info = NULL);
+ PaTime getOutputDefaultLowLatency();
+\r
+ PaError init();\r
+ PaError streamStart();\r
+ PaError streamClose();\r
+ void terminate();\r
+ bool isOpen() const;\r
+ void stop();
+ void abort();
+ bool isStopped() const;
+ bool isActive() const;
+};\r
--- /dev/null
+// ---------------------------------------------------------------------------------------\r
+\r
+#include <iostream>\r
+#include <cmath>\r
+#include <cassert>\r
+#include <cstddef>\r
+#include "portaudiocpp/PortAudioCpp.hxx"\r
+\r
+// ---------------------------------------------------------------------------------------\r
+\r
+// Some constants:\r
+const int NUM_SECONDS = 5;\r
+const double SAMPLE_RATE = 44100.0;\r
+const int FRAMES_PER_BUFFER = 64;\r
+const int TABLE_SIZE = 200;\r
+\r
+// ---------------------------------------------------------------------------------------\r
+\r
+// SineGenerator class:\r
+class SineGenerator\r
+{\r
+public:\r
+ SineGenerator(int tableSize) : tableSize_(tableSize), leftPhase_(0), rightPhase_(0)\r
+ {\r
+ const double PI = 3.14159265;\r
+ table_ = new float[tableSize];\r
+ for (int i = 0; i < tableSize; ++i)\r
+ {\r
+ table_[i] = 0.125f * (float)sin(((double)i/(double)tableSize)*PI*2.);\r
+ }\r
+ }\r
+\r
+ ~SineGenerator()\r
+ {\r
+ delete[] table_;\r
+ }\r
+\r
+ int generate(const void *inputBuffer, void *outputBuffer, unsigned long framesPerBuffer, \r
+ const PaStreamCallbackTimeInfo *timeInfo, PaStreamCallbackFlags statusFlags)\r
+ {\r
+ assert(outputBuffer != NULL);\r
+\r
+ float **out = static_cast<float **>(outputBuffer);\r
+\r
+ for (unsigned int i = 0; i < framesPerBuffer; ++i)\r
+ {\r
+ out[0][i] = table_[leftPhase_];\r
+ out[1][i] = table_[rightPhase_];\r
+\r
+ leftPhase_ += 1;\r
+ if (leftPhase_ >= tableSize_)\r
+ leftPhase_ -= tableSize_;\r
+\r
+ rightPhase_ += 3;\r
+ if (rightPhase_ >= tableSize_)\r
+ rightPhase_ -= tableSize_;\r
+ }\r
+\r
+ return paContinue;\r
+ }\r
+\r
+private:\r
+ float *table_;\r
+ int tableSize_;\r
+ int leftPhase_;\r
+ int rightPhase_;\r
+};\r
+\r
+// ---------------------------------------------------------------------------------------\r
+\r
+// main:\r
+int main(int, char *[]);\r
+int main(int, char *[])\r
+{\r
+ try\r
+ {\r
+ // Create a SineGenerator object:\r
+ SineGenerator sineGenerator(TABLE_SIZE);\r
+\r
+ std::cout << "Setting up PortAudio..." << std::endl;\r
+\r
+ // Set up the System:\r
+ portaudio::AutoSystem autoSys;\r
+ portaudio::System &sys = portaudio::System::instance();\r
+\r
+ // Set up the parameters required to open a (Callback)Stream:\r
+ portaudio::DirectionSpecificStreamParameters outParams(sys.defaultOutputDevice(), 2, portaudio::FLOAT32, false, sys.defaultOutputDevice().defaultLowOutputLatency(), NULL);\r
+ portaudio::StreamParameters params(portaudio::DirectionSpecificStreamParameters::null(), outParams, SAMPLE_RATE, FRAMES_PER_BUFFER, paClipOff);\r
+\r
+ std::cout << "Opening stereo output stream..." << std::endl;\r
+\r
+ // Create (and open) a new Stream, using the SineGenerator::generate function as a callback:\r
+ portaudio::MemFunCallbackStream<SineGenerator> stream(params, sineGenerator, &SineGenerator::generate);\r
+\r
+ std::cout << "Starting playback for " << NUM_SECONDS << " seconds." << std::endl;\r
+\r
+ // Start the Stream (audio playback starts):\r
+ stream.start();\r
+\r
+ // Wait for 5 seconds:\r
+ sys.sleep(NUM_SECONDS * 1000);\r
+\r
+ std::cout << "Closing stream..." <<std::endl;\r
+\r
+ // Stop the Stream (not strictly needed as termintating the System will also stop all open Streams):\r
+ stream.stop();\r
+\r
+ // Close the Stream (not strictly needed as terminating the System will also close all open Streams):\r
+ stream.close();\r
+\r
+ // Terminate the System (not strictly needed as the AutoSystem will also take care of this when it \r
+ // goes out of scope):\r
+ sys.terminate();\r
+\r
+ std::cout << "Test finished." << std::endl;\r
+ }\r
+ catch (const portaudio::PaException &e)\r
+ {\r
+ std::cout << "A PortAudio error occured: " << e.paErrorText() << std::endl;\r
+ }\r
+ catch (const portaudio::PaCppException &e)\r
+ {\r
+ std::cout << "A PortAudioCpp error occured: " << e.what() << std::endl;\r
+ }\r
+ catch (const std::exception &e)\r
+ {\r
+ std::cout << "A generic exception occured: " << e.what() << std::endl;\r
+ }\r
+ catch (...)\r
+ {\r
+ std::cout << "An unknown exception occured." << std::endl;\r
+ }\r
+\r
+ return 0;\r
+}\r
+\r
+\r