From: wittend99 Date: Fri, 17 Aug 2012 20:18:24 +0000 (+0000) Subject: git-svn-id: https://svn.code.sf.net/p/freetel/code@618 01035d8c-6547-0410-b346-abe4f9... X-Git-Url: http://git.whiteaudio.com/gitweb/?a=commitdiff_plain;h=cb8b38719b3773807d0b157d6b579389579262d4;p=freetel-svn-tracking.git git-svn-id: https://svn.code.sf.net/p/freetel/code@618 01035d8c-6547-0410-b346-abe4f91aad63 --- diff --git a/fdmdv2/hamlib-3.0/test_hamlib/Release/.gitignore b/fdmdv2/hamlib-3.0/test_hamlib/Release/.gitignore new file mode 100644 index 00000000..e69de29b diff --git a/fdmdv2/pa_test/Debug/pa_test.exe b/fdmdv2/pa_test/Debug/pa_test.exe deleted file mode 100644 index 70ca4075..00000000 Binary files a/fdmdv2/pa_test/Debug/pa_test.exe and /dev/null differ diff --git a/fdmdv2/pa_test/Debug/portaudio.dll b/fdmdv2/pa_test/Debug/portaudio.dll deleted file mode 100644 index 9b292864..00000000 Binary files a/fdmdv2/pa_test/Debug/portaudio.dll and /dev/null differ diff --git a/fdmdv2/pa_test/Release/portaudio.dll b/fdmdv2/pa_test/Release/portaudio.dll deleted file mode 100644 index 9b292864..00000000 Binary files a/fdmdv2/pa_test/Release/portaudio.dll and /dev/null differ diff --git a/fdmdv2/pa_test/devs.cxx b/fdmdv2/pa_test/devs.cxx deleted file mode 100644 index 31a560f8..00000000 --- a/fdmdv2/pa_test/devs.cxx +++ /dev/null @@ -1,177 +0,0 @@ -#include -#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; -} diff --git a/fdmdv2/pa_test/pa_class.cpp b/fdmdv2/pa_test/pa_class.cpp deleted file mode 100644 index 1a815869..00000000 --- a/fdmdv2/pa_test/pa_class.cpp +++ /dev/null @@ -1,370 +0,0 @@ -#include "pa_class.h" - -PortAudioWrap::PortAudioWrap() -{ - stream = NULL; -// inputBuffer = 0; -// outputBuffer = NULL; - inputDevice = paNoDevice; - outputDevice = paNoDevice; - userData = NULL; - samplerate = 0; - framesPerBuffer = 0; - statusFlags = 0; - streamCallback = NULL; - streamFinishedCallback = NULL; - timeInfo = 0; -} - -PortAudioWrap::~PortAudioWrap() -{ -} - -PaError PortAudioWrap::init() -{ - return Pa_Initialize(); -} - -PaError PortAudioWrap::streamOpen() -{ - return Pa_OpenStream( - &stream, - &inputBuffer, - &outputBuffer, - samplerate, - framesPerBuffer, - statusFlags, - *streamCallback, - userData - ); -} - -PaError PortAudioWrap::streamStart() -{ - return Pa_StartStream(this->stream); -} - -PaError PortAudioWrap::streamClose() -{ - if (isOpen()) - { - return Pa_CloseStream(this->stream); - } - else - { - return 1; - } -} - -void PortAudioWrap::terminate() -{ - Pa_Terminate(); -} - -void PortAudioWrap::stop() -{ - Pa_StopStream(stream); -} - -void PortAudioWrap::abort() -{ - Pa_AbortStream(stream); -} - -bool PortAudioWrap::isStopped() const -{ - PaError ret = Pa_IsStreamStopped(stream); - return ret; -} - -bool PortAudioWrap::isActive() const -{ - PaError ret = Pa_IsStreamActive(stream); - return ret; -} - -bool PortAudioWrap::isOpen() const -{ - return (stream != NULL); -} - -PaDeviceIndex PortAudioWrap::getDefaultInputDevice() -{ - return Pa_GetDefaultInputDevice(); -} - -PaDeviceIndex PortAudioWrap::getDefaultOutputDevice() -{ - return Pa_GetDefaultOutputDevice(); -} - -PaError PortAudioWrap::setInputChannelCount(int count) -{ -// if(!isActive()) -// { - inputBuffer.channelCount = count; - return paNoError; -// } -// return paStreamIsNotStopped; -} - -PaError PortAudioWrap::setInputSampleFormat(PaSampleFormat format) -{ -// if(!isActive()) -// { - inputBuffer.sampleFormat = format; - return paNoError; -// } -// return paStreamIsNotStopped; -} - -PaError PortAudioWrap::setInputLatency(PaTime latency) -{ -// if(!isActive()) -// { - inputBuffer.suggestedLatency = latency; - return paNoError; -// } -// return paStreamIsNotStopped; -} - -void PortAudioWrap::setInputHostApiStreamInfo(void *info) -{ - inputBuffer.hostApiSpecificStreamInfo = info; -} - -PaTime PortAudioWrap::getInputDefaultLowLatency() -{ - return Pa_GetDeviceInfo(inputBuffer.device)->defaultLowInputLatency; -} - -PaError PortAudioWrap::setOutputChannelCount(int count) -{ -// if(!isActive()) -// { - outputBuffer.channelCount = count; - return paNoError; -// } -// return paStreamIsNotStopped; -} - -PaError PortAudioWrap::setOutputSampleFormat(PaSampleFormat format) -{ -// if(!isActive()) -// { - outputBuffer.sampleFormat = format; - return paNoError; -// } -// return paStreamIsNotStopped; -} - -PaError PortAudioWrap::setOutputLatency(PaTime latency) -{ -// if(!isOpen()) -// { - outputBuffer.suggestedLatency = latency; - return paNoError; -// } -// return paStreamIsNotStopped; -} - -void PortAudioWrap::setOutputHostApiStreamInfo(void *info) -{ - outputBuffer.hostApiSpecificStreamInfo = info; -} - -PaTime PortAudioWrap::getOutputDefaultLowLatency() -{ - return Pa_GetDeviceInfo(inputBuffer.device)->defaultLowInputLatency; -} - -PaError PortAudioWrap::setFramesPerBuffer(unsigned long size) -{ -// if(!isOpen()) -// { - framesPerBuffer = size; - return paNoError; -// } -// return paStreamIsNotStopped; -} - -PaError PortAudioWrap::setSampleRate(unsigned long rate) -{ -// if(!isOpen()) -// { - samplerate = rate; - return paNoError; -// } -// return paStreamIsNotStopped; -} - -PaError PortAudioWrap::setStreamFlags(PaStreamFlags flags) -{ -// if(!isOpen()) -// { - statusFlags = flags; - return paNoError; -// } -// return paStreamIsNotStopped; -} - -PaError PortAudioWrap::setInputDevice(PaDeviceIndex flags) -{ -// if(!isOpen()) -// { - inputDevice = flags; - return paNoError; -// } -// return paStreamIsNotStopped; -} - -PaError PortAudioWrap::setOutputDevice(PaDeviceIndex flags) -{ -// if(!isOpen()) -// { - outputDevice = flags; - return paNoError; -// } -// return paStreamIsNotStopped; -} - -PaError PortAudioWrap::setCallback(PaStreamCallback *callback) -{ -// if(!isOpen()) -// { - streamCallback = callback; - return paNoError; -// } -// return paStreamIsNotStopped; -} - - - -// Non-linear amplifier with soft distortion curve. -float CubicAmplifier(float input) -{ - float output, temp; - if(input < 0.0) - { - temp = input + 1.0f; - output = (temp * temp * temp) - 1.0f; - } - else - { - temp = input - 1.0f; - output = (temp * temp * temp) + 1.0f; - } - return output; -} - -#define FUZZ(x) CubicAmplifier(CubicAmplifier(CubicAmplifier(CubicAmplifier(x)))) - -static int gNumNoInputs = 0; - -static int fuzzCallback(const void *inputBuffer, - void *outputBuffer, - unsigned long framesPerBuffer, - const PaStreamCallbackTimeInfo* timeInfo, - PaStreamCallbackFlags statusFlags, - void *userData) -{ - SAMPLE *out = (SAMPLE*)outputBuffer; - const SAMPLE *in = (const SAMPLE*)inputBuffer; - unsigned int i; - (void) timeInfo; // Prevent unused variable warnings. - (void) statusFlags; - (void) userData; - - if(inputBuffer == NULL) - { - for(i = 0; i < framesPerBuffer; i++) - { - *out++ = 0; // left - silent - *out++ = 0; // right - silent - } - gNumNoInputs += 1; - } - else - { - for(i = 0; i < framesPerBuffer; i++) - { - *out++ = FUZZ(*in++); // left - distorted - *out++ = *in++; // right - clean - } - } - return paContinue; -} - - -#if 1 -int main(void) -{ - PaError err; - PaDeviceIndex inputDevice; - PaDeviceIndex outputDevice; - - PortAudioWrap pa = PortAudioWrap(); - err = pa.init(); - - inputDevice = pa.getDefaultInputDevice(); // default input device - if(inputDevice == paNoDevice) - { - fprintf(stderr, "Error: No default input device.\n"); - goto error; - } - err = pa.setInputDevice(inputDevice); - err = pa.setInputChannelCount(2); // stereo input - err = pa.setInputSampleFormat(PA_SAMPLE_TYPE); - err = pa.setInputLatency(pa.getInputDefaultLowLatency()); - pa.setInputHostApiStreamInfo(NULL); - - outputDevice = pa.getDefaultOutputDevice(); // default output device - if (outputDevice == paNoDevice) - { - fprintf(stderr,"Error: No default output device.\n"); - goto error; - } - err = pa.setOutputDevice(inputDevice); - err = pa.setOutputChannelCount(2); // stereo input - err = pa.setOutputSampleFormat(PA_SAMPLE_TYPE); - err = pa.setOutputLatency(pa.getOutputDefaultLowLatency()); - pa.setOutputHostApiStreamInfo(NULL); - - err = pa.setFramesPerBuffer(FRAMES_PER_BUFFER); - err = pa.setSampleRate(SAMPLE_RATE); - err = pa.setStreamFlags(0); - err = pa.setCallback(fuzzCallback); - err = pa.streamOpen(); - - if(err != paNoError) - { - goto error; - } - err = pa.streamStart(); - if(err != paNoError) - { - goto error; - } - - printf("Hit ENTER to stop program.\n"); - getchar(); - err = pa.streamClose(); - if( err != paNoError ) - { - goto error; - } - printf("Finished. gNumNoInputs = %d\n", gNumNoInputs ); - pa.terminate(); - return 0; - -error: - Pa_Terminate(); - fprintf( stderr, "An error occured while using the portaudio stream\n" ); - fprintf( stderr, "Error number: %d\n", err ); - fprintf( stderr, "Error message: %s\n", Pa_GetErrorText( err ) ); - return -1; - -} - -#endif - diff --git a/fdmdv2/pa_test/pa_class.h b/fdmdv2/pa_test/pa_class.h deleted file mode 100644 index e565e9dd..00000000 --- a/fdmdv2/pa_test/pa_class.h +++ /dev/null @@ -1,75 +0,0 @@ -#include -#include -#include "portaudio.h" - -// 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 -{ - public: - PortAudioWrap(); - ~PortAudioWrap(); - - private: - PaStream *stream; - PaStreamParameters inputBuffer; - PaStreamParameters outputBuffer; - void *userData; - int samplerate; - unsigned long framesPerBuffer; - PaStreamCallbackFlags statusFlags; - PaStreamCallback *streamCallback; - PaStreamFinishedCallback *streamFinishedCallback; - const PaStreamCallbackTimeInfo *timeInfo; - PaDeviceIndex inputDevice; - PaDeviceIndex outputDevice; - - public: - - PaError streamOpen(); - - PaDeviceIndex getDefaultInputDevice(); - PaDeviceIndex getDefaultOutputDevice(); - - PaStreamParameters *getDeviceInfo(PaDeviceIndex idx); - PaError setFramesPerBuffer(unsigned long size); - PaError setSampleRate(unsigned long size); - PaError setStreamFlags(PaStreamFlags flags); - PaError setCallback(PaStreamCallback *streamCallback); - PaError setStreamCallback(PaStream *stream, PaStreamCallback* callback ) { streamCallback = callback; return 0;} - PaError setStreamFinishedCallback(PaStream *stream, PaStreamFinishedCallback* streamFinishedCallback ); - - PaError setInputDevice(PaDeviceIndex dev); - PaError setInputChannelCount(int count); - PaError setInputSampleFormat(PaSampleFormat format); - PaError setInputSampleRate(PaSampleFormat format); - PaError setInputLatency(PaTime latency); - void setInputHostApiStreamInfo(void *info = NULL); - PaTime getInputDefaultLowLatency(); - - PaError setOutputDevice(PaDeviceIndex dev); - PaError setOutputChannelCount(int count); - PaError setOutputSampleFormat(PaSampleFormat format); - PaError setOutputLatency(PaTime latency); - void setOutputHostApiStreamInfo(void *info = NULL); - PaTime getOutputDefaultLowLatency(); - - PaError init(); - PaError streamStart(); - PaError streamClose(); - void terminate(); - bool isOpen() const; - void stop(); - void abort(); - bool isStopped() const; - bool isActive() const; -}; diff --git a/fdmdv2/pa_test/pa_test.mk b/fdmdv2/pa_test/pa_test.mk deleted file mode 100644 index 710712d4..00000000 --- a/fdmdv2/pa_test/pa_test.mk +++ /dev/null @@ -1,103 +0,0 @@ -## -## Auto Generated makefile by CodeLite IDE -## any manual changes will be erased -## -## Release -ProjectName :=pa_test -ConfigurationName :=Release -IntermediateDirectory :=./Release -OutDir := $(IntermediateDirectory) -WorkspacePath := "C:\Users\wittend\Projects\Radio\fdmdv2" -ProjectPath := "C:\Users\wittend\Projects\Radio\fdmdv2\pa_test" -CurrentFileName := -CurrentFilePath := -CurrentFileFullPath := -User :=wittend -Date :=6/18/2012 -CodeLitePath :="C:\Program Files\CodeLite" -LinkerName :=g++ -ArchiveTool :=ar rcus -SharedObjectLinkerName :=g++ -shared -fPIC -ObjectSuffix :=.o -DependSuffix :=.o.d -PreprocessSuffix :=.o.i -DebugSwitch :=-gstab -IncludeSwitch :=-I -LibrarySwitch :=-l -OutputSwitch :=-o -LibraryPathSwitch :=-L -PreprocessorSwitch :=-D -SourceSwitch :=-c -CompilerName :=g++ -C_CompilerName :=gcc -OutputFile :=$(IntermediateDirectory)/$(ProjectName) -Preprocessors := -ObjectSwitch :=-o -ArchiveOutputSwitch := -PreprocessOnlySwitch :=-E -ObjectsFileList :="C:\Users\wittend\Projects\Radio\fdmdv2\pa_test\pa_test.txt" -PCHCompileFlags := -MakeDirCommand :=makedir -CmpOptions := -O2 -Wall $(Preprocessors) -C_CmpOptions := -O2 -Wall $(Preprocessors) -LinkOptions := -IncludePath := $(IncludeSwitch). $(IncludeSwitch). $(IncludeSwitch)extern/include -IncludePCH := -RcIncludePath := -Libs := $(LibrarySwitch)portaudio -LibPath := $(LibraryPathSwitch). - - -## -## User defined environment variables -## -CodeLiteDir:=C:\Program Files\CodeLite -WXWIN:=C:\bin\wxWidgets-2.9.4 -PATH:=$(WXWIN)\lib\gcc_dll;$(PATH) -WXCFG:=gcc_dll\mswu -UNIT_TEST_PP_SRC_DIR:=C:\bin\UnitTest++-1.3 -Objects=$(IntermediateDirectory)/pa_class$(ObjectSuffix) - -## -## Main Build Targets -## -.PHONY: all clean PreBuild PrePreBuild PostBuild -all: $(OutputFile) - -$(OutputFile): $(IntermediateDirectory)/.d $(Objects) - @$(MakeDirCommand) $(@D) - @echo "" > $(IntermediateDirectory)/.d - @echo $(Objects) > $(ObjectsFileList) - $(LinkerName) $(OutputSwitch)$(OutputFile) @$(ObjectsFileList) $(LibPath) $(Libs) $(LinkOptions) - -$(IntermediateDirectory)/.d: - @$(MakeDirCommand) "./Release" - -PreBuild: - - -## -## Objects -## -$(IntermediateDirectory)/pa_class$(ObjectSuffix): pa_class.cpp $(IntermediateDirectory)/pa_class$(DependSuffix) - $(CompilerName) $(IncludePCH) $(SourceSwitch) "C:/Users/wittend/Projects/Radio/fdmdv2/pa_test/pa_class.cpp" $(CmpOptions) $(ObjectSwitch)$(IntermediateDirectory)/pa_class$(ObjectSuffix) $(IncludePath) -$(IntermediateDirectory)/pa_class$(DependSuffix): pa_class.cpp - @$(CompilerName) $(CmpOptions) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/pa_class$(ObjectSuffix) -MF$(IntermediateDirectory)/pa_class$(DependSuffix) -MM "C:/Users/wittend/Projects/Radio/fdmdv2/pa_test/pa_class.cpp" - -$(IntermediateDirectory)/pa_class$(PreprocessSuffix): pa_class.cpp - @$(CompilerName) $(CmpOptions) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/pa_class$(PreprocessSuffix) "C:/Users/wittend/Projects/Radio/fdmdv2/pa_test/pa_class.cpp" - - --include $(IntermediateDirectory)/*$(DependSuffix) -## -## Clean -## -clean: - $(RM) $(IntermediateDirectory)/pa_class$(ObjectSuffix) - $(RM) $(IntermediateDirectory)/pa_class$(DependSuffix) - $(RM) $(IntermediateDirectory)/pa_class$(PreprocessSuffix) - $(RM) $(OutputFile) - $(RM) $(OutputFile).exe - $(RM) "C:\Users\wittend\Projects\Radio\fdmdv2\.build-release\pa_test" - - diff --git a/fdmdv2/pa_test/pa_test.project b/fdmdv2/pa_test/pa_test.project deleted file mode 100644 index c479d7dd..00000000 --- a/fdmdv2/pa_test/pa_test.project +++ /dev/null @@ -1,108 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - None - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - None - - - - - - - - - - - - - - - - diff --git a/fdmdv2/pa_test/pa_test.txt b/fdmdv2/pa_test/pa_test.txt deleted file mode 100644 index 7a5e00db..00000000 --- a/fdmdv2/pa_test/pa_test.txt +++ /dev/null @@ -1 +0,0 @@ -./Debug/pa_class.o diff --git a/fdmdv2/pa_test/portaudio.dll b/fdmdv2/pa_test/portaudio.dll deleted file mode 100644 index 9b292864..00000000 Binary files a/fdmdv2/pa_test/portaudio.dll and /dev/null differ diff --git a/fdmdv2/pa_test/sine.cxx b/fdmdv2/pa_test/sine.cxx deleted file mode 100644 index 577a2472..00000000 --- a/fdmdv2/pa_test/sine.cxx +++ /dev/null @@ -1,137 +0,0 @@ -// --------------------------------------------------------------------------------------- - -#include -#include -#include -#include -#include "portaudiocpp/PortAudioCpp.hxx" - -// --------------------------------------------------------------------------------------- - -// Some constants: -const int NUM_SECONDS = 5; -const double SAMPLE_RATE = 44100.0; -const int FRAMES_PER_BUFFER = 64; -const int TABLE_SIZE = 200; - -// --------------------------------------------------------------------------------------- - -// SineGenerator class: -class SineGenerator -{ -public: - SineGenerator(int tableSize) : tableSize_(tableSize), leftPhase_(0), rightPhase_(0) - { - const double PI = 3.14159265; - table_ = new float[tableSize]; - for (int i = 0; i < tableSize; ++i) - { - table_[i] = 0.125f * (float)sin(((double)i/(double)tableSize)*PI*2.); - } - } - - ~SineGenerator() - { - delete[] table_; - } - - int generate(const void *inputBuffer, void *outputBuffer, unsigned long framesPerBuffer, - const PaStreamCallbackTimeInfo *timeInfo, PaStreamCallbackFlags statusFlags) - { - assert(outputBuffer != NULL); - - float **out = static_cast(outputBuffer); - - for (unsigned int i = 0; i < framesPerBuffer; ++i) - { - out[0][i] = table_[leftPhase_]; - out[1][i] = table_[rightPhase_]; - - leftPhase_ += 1; - if (leftPhase_ >= tableSize_) - leftPhase_ -= tableSize_; - - rightPhase_ += 3; - if (rightPhase_ >= tableSize_) - rightPhase_ -= tableSize_; - } - - return paContinue; - } - -private: - float *table_; - int tableSize_; - int leftPhase_; - int rightPhase_; -}; - -// --------------------------------------------------------------------------------------- - -// main: -int main(int, char *[]); -int main(int, char *[]) -{ - try - { - // Create a SineGenerator object: - SineGenerator sineGenerator(TABLE_SIZE); - - std::cout << "Setting up PortAudio..." << std::endl; - - // Set up the System: - portaudio::AutoSystem autoSys; - portaudio::System &sys = portaudio::System::instance(); - - // Set up the parameters required to open a (Callback)Stream: - portaudio::DirectionSpecificStreamParameters outParams(sys.defaultOutputDevice(), 2, portaudio::FLOAT32, false, sys.defaultOutputDevice().defaultLowOutputLatency(), NULL); - portaudio::StreamParameters params(portaudio::DirectionSpecificStreamParameters::null(), outParams, SAMPLE_RATE, FRAMES_PER_BUFFER, paClipOff); - - std::cout << "Opening stereo output stream..." << std::endl; - - // Create (and open) a new Stream, using the SineGenerator::generate function as a callback: - portaudio::MemFunCallbackStream stream(params, sineGenerator, &SineGenerator::generate); - - std::cout << "Starting playback for " << NUM_SECONDS << " seconds." << std::endl; - - // Start the Stream (audio playback starts): - stream.start(); - - // Wait for 5 seconds: - sys.sleep(NUM_SECONDS * 1000); - - std::cout << "Closing stream..." <