// copyright (C) 2003 david griffiths // // 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 2 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, write to the free software // foundation, inc., 59 temple place - suite 330, boston, MA 02111-1307, USA. #include #include #include "portaudio_client.h" bool portaudio_client::m_attached = false; long unsigned int portaudio_client::m_buffer_size = 0; long unsigned int portaudio_client::m_sample_rate = 44100; void (*portaudio_client::run_callback)(void*, unsigned int buf_size)=NULL; void *portaudio_client::run_context = NULL; const float *portaudio_client::m_right_data=NULL; const float *portaudio_client::m_left_data=NULL; float *portaudio_client::m_right_in_data=NULL; float *portaudio_client::m_left_in_data=NULL; /////////////////////////////////////////////////////// portaudio_client::portaudio_client() { } ///////////////////////////////////////////////////////////////////////////////////////////// portaudio_client::~portaudio_client() { detach(); } ///////////////////////////////////////////////////////////////////////////////////////////// bool portaudio_client::attach(const string &client_name, const device_options &dopt) { if (m_attached) return true; PaError err; err = Pa_Initialize(); if( err != paNoError ) { cerr<<"could not init portaudio_client"<defaultLowOutputLatency; output_parameters.hostApiSpecificStreamInfo = NULL; cerr<<"Connecting to "<name<<" for output"<defaultLowInputLatency; input_parameters.hostApiSpecificStreamInfo = NULL; cerr<<"Connecting to "<name<<" for input"<