Commit eface0d7 authored by Yun Liu's avatar Yun Liu
Browse files

Remove warnings continued

parent cb083acd
......@@ -23,10 +23,8 @@
#include <string>
Account::Account(const AccountID& accountID) : _accountID(accountID)
Account::Account(const AccountID& accountID) : _accountID(accountID), _link(NULL), _enabled(false)
{
_link = NULL;
_enabled = false;
}
Account::~Account()
......
......@@ -76,17 +76,6 @@ class Account{
*/
virtual ~Account();
// copy constructor
Account(const Account& rh):_accountID(rh._accountID), _link(rh._link), _enabled(rh._enabled){
_debug("Account copy constructor hasn't been implemented yet. Quit! ");
exit(0);
}
// assignment operator
Account& operator=(const Account& rh){
_debug("Account assignment operator hasn't been implemented yet. Quit! ");
exit(0);
}
/**
* Load the settings for this account.
......@@ -147,6 +136,12 @@ class Account{
private:
// copy constructor
Account(const Account& rh);
// assignment operator
Account& operator=(const Account& rh);
protected:
/**
* Account ID are assign in constructor and shall not changed
......
......@@ -24,11 +24,17 @@
// Constructor
AlsaLayer::AlsaLayer( ManagerImpl* manager )
: AudioLayer( manager , ALSA )
, _PlaybackHandle(NULL)
, _CaptureHandle(NULL)
, _PlaybackHandle(NULL)
, _CaptureHandle(NULL)
, _periodSize()
, _AsyncHandler(NULL)
, _audioPlugin()
, _inChannel()
, _outChannel()
, _defaultVolume(100)
, IDSoundCards()
{
_debug(" Constructor of AlsaLayer called\n");
_defaultVolume = 100;
}
// Destructor
......@@ -99,7 +105,7 @@ AlsaLayer::startStream(void)
snd_pcm_start( _CaptureHandle ) ;
snd_pcm_prepare( _PlaybackHandle );
if( err = snd_pcm_start( _PlaybackHandle) < 0 ) _debugAlsa(" Cannot start (%s)\n", snd_strerror(err));
if( (err = snd_pcm_start( _PlaybackHandle)) < 0 ) _debugAlsa(" Cannot start (%s)\n", snd_strerror(err));
}
}
......@@ -132,7 +138,7 @@ AlsaLayer::fillHWBuffer( void)
short s1, s2;
int periodSize = 128 ;
int frames = periodSize >> 2 ;
_debug("frames = %d\n");
_debug("frames = %d\n", frames);
data = (unsigned char*)malloc(periodSize);
for(l1 = 0; l1 < 100; l1++) {
......@@ -286,7 +292,7 @@ AlsaLayer::open_device(std::string pcm_p, std::string pcm_c, int flag)
int dir = 0;
snd_pcm_uframes_t period_size_in = getFrameSize() * getSampleRate() / 1000 * 2 ;
snd_pcm_uframes_t buffer_size_in = period_size_in * 4 ;
snd_pcm_uframes_t threshold = 1024 ;
//snd_pcm_uframes_t threshold = 1024 ;
snd_pcm_uframes_t period_size_out = getFrameSize() * getSampleRate() / 1000 * 2;//1024 ;
snd_pcm_uframes_t buffer_size_out = period_size_out * 4 ;
......@@ -296,41 +302,41 @@ AlsaLayer::open_device(std::string pcm_p, std::string pcm_c, int flag)
if(flag == SFL_PCM_BOTH || flag == SFL_PCM_CAPTURE)
{
_debugAlsa("Opening capture device %s\n", pcm_c.c_str());
if(err = snd_pcm_open(&_CaptureHandle, pcm_c.c_str(), SND_PCM_STREAM_CAPTURE, 0) < 0){
if( (err = snd_pcm_open(&_CaptureHandle, pcm_c.c_str(), SND_PCM_STREAM_CAPTURE, 0)) < 0){
_debugAlsa("Error while opening capture device %s\n", pcm_c.c_str());
setErrorMessage( ALSA_CAPTURE_DEVICE );
return false;
}
if( err = snd_pcm_hw_params_malloc( &hwParams ) < 0 ) {
if( (err = snd_pcm_hw_params_malloc( &hwParams )) < 0 ) {
_debugAlsa(" Cannot allocate hardware parameter structure (%s)\n", snd_strerror(err));
return false;
}
if( err = snd_pcm_hw_params_any(_CaptureHandle, hwParams) < 0) _debugAlsa(" Cannot initialize hardware parameter structure (%s)\n", snd_strerror(err));
if( err = snd_pcm_hw_params_set_access( _CaptureHandle, hwParams, SND_PCM_ACCESS_MMAP_INTERLEAVED) < 0) _debugAlsa(" Cannot set access type (%s)\n", snd_strerror(err));
if( err = snd_pcm_hw_params_set_format( _CaptureHandle, hwParams, SND_PCM_FORMAT_S16_LE) < 0) _debugAlsa(" Cannot set sample format (%s)\n", snd_strerror(err));
if( err = snd_pcm_hw_params_set_rate_near( _CaptureHandle, hwParams, &rate_in, &dir) < 0) _debugAlsa(" Cannot set sample rate (%s)\n", snd_strerror(err));
if( err = snd_pcm_hw_params_set_channels( _CaptureHandle, hwParams, 1) < 0) _debugAlsa(" Cannot set channel count (%s)\n", snd_strerror(err));
if( err = snd_pcm_hw_params_set_period_time_near( _CaptureHandle, hwParams, &period_time , &dir) < 0) _debugAlsa(" Cannot set period time (%s)\n", snd_strerror(err));
if( err = snd_pcm_hw_params_set_buffer_time_near( _CaptureHandle, hwParams, &buffer_time , &dir) < 0) _debugAlsa(" Cannot set buffer time (%s)\n", snd_strerror(err));
if( err = snd_pcm_hw_params_get_period_size( hwParams, &period_size_in , &dir) < 0) _debugAlsa(" Cannot get period size (%s)\n", snd_strerror(err));
if( err = snd_pcm_hw_params_get_buffer_size( hwParams, &buffer_size_in ) < 0) _debugAlsa(" Cannot get buffer size (%s)\n", snd_strerror(err));
if( err = snd_pcm_hw_params( _CaptureHandle, hwParams ) < 0) _debugAlsa(" Cannot set hw parameters (%s)\n", snd_strerror(err));
_debug("buffer size = %d\n" , period_size_in);
_debug("period size = %d\n" , buffer_size_in);
if( (err = snd_pcm_hw_params_any(_CaptureHandle, hwParams)) < 0) _debugAlsa(" Cannot initialize hardware parameter structure (%s)\n", snd_strerror(err));
if( (err = snd_pcm_hw_params_set_access( _CaptureHandle, hwParams, SND_PCM_ACCESS_MMAP_INTERLEAVED)) < 0) _debugAlsa(" Cannot set access type (%s)\n", snd_strerror(err));
if( (err = snd_pcm_hw_params_set_format( _CaptureHandle, hwParams, SND_PCM_FORMAT_S16_LE)) < 0) _debugAlsa(" Cannot set sample format (%s)\n", snd_strerror(err));
if( (err = snd_pcm_hw_params_set_rate_near( _CaptureHandle, hwParams, &rate_in, &dir) < 0)) _debugAlsa(" Cannot set sample rate (%s)\n", snd_strerror(err));
if( (err = snd_pcm_hw_params_set_channels( _CaptureHandle, hwParams, 1)) < 0) _debugAlsa(" Cannot set channel count (%s)\n", snd_strerror(err));
if( (err = snd_pcm_hw_params_set_period_time_near( _CaptureHandle, hwParams, &period_time , &dir)) < 0) _debugAlsa(" Cannot set period time (%s)\n", snd_strerror(err));
if( (err = snd_pcm_hw_params_set_buffer_time_near( _CaptureHandle, hwParams, &buffer_time , &dir)) < 0) _debugAlsa(" Cannot set buffer time (%s)\n", snd_strerror(err));
if( (err = snd_pcm_hw_params_get_period_size( hwParams, &period_size_in , &dir) < 0)) _debugAlsa(" Cannot get period size (%s)\n", snd_strerror(err));
if( (err = snd_pcm_hw_params_get_buffer_size( hwParams, &buffer_size_in ) < 0)) _debugAlsa(" Cannot get buffer size (%s)\n", snd_strerror(err));
if( (err = snd_pcm_hw_params( _CaptureHandle, hwParams ) < 0)) _debugAlsa(" Cannot set hw parameters (%s)\n", snd_strerror(err));
_debug("buffer size = %d\n" , (int) period_size_in);
_debug("period size = %d\n" , (int) buffer_size_in);
snd_pcm_hw_params_free( hwParams );
snd_pcm_uframes_t val ;
snd_pcm_sw_params_malloc( &swparams );
snd_pcm_sw_params_current( _CaptureHandle, swparams );
if( err = snd_pcm_sw_params_set_start_threshold( _CaptureHandle, swparams, period_size_out) < 0 ) _debugAlsa(" Cannot set start threshold (%s)\n", snd_strerror(err));
if( (err = snd_pcm_sw_params_set_start_threshold( _CaptureHandle, swparams, period_size_out)) < 0 ) _debugAlsa(" Cannot set start threshold (%s)\n", snd_strerror(err));
snd_pcm_sw_params_get_start_threshold( swparams , &val);
_debug("Start threshold = %d\n" ,val);
if( err = snd_pcm_sw_params_set_avail_min( _CaptureHandle, swparams, period_size_out) < 0) _debugAlsa(" Cannot set min avail (%s)\n" , snd_strerror(err));
_debug("Start threshold = %d\n" ,(int)val);
if( (err = snd_pcm_sw_params_set_avail_min( _CaptureHandle, swparams, period_size_out)) < 0) _debugAlsa(" Cannot set min avail (%s)\n" , snd_strerror(err));
snd_pcm_sw_params_get_avail_min( swparams , &val);
_debug("Min available = %d\n" ,val);
if( err = snd_pcm_sw_params( _CaptureHandle, swparams ) < 0 ) _debugAlsa(" Cannot set sw parameters (%s)\n", snd_strerror(err));
_debug("Min available = %d\n" ,(int)val);
if( (err = snd_pcm_sw_params( _CaptureHandle, swparams )) < 0 ) _debugAlsa(" Cannot set sw parameters (%s)\n", snd_strerror(err));
snd_pcm_sw_params_free( swparams );
deviceClosed = false;
}
......@@ -339,26 +345,26 @@ AlsaLayer::open_device(std::string pcm_p, std::string pcm_c, int flag)
{
_debugAlsa(" Opening playback device %s\n", pcm_p.c_str());
if(err = snd_pcm_open(&_PlaybackHandle, pcm_p.c_str(), SND_PCM_STREAM_PLAYBACK, SND_PCM_NONBLOCK ) < 0){
if((err = snd_pcm_open(&_PlaybackHandle, pcm_p.c_str(), SND_PCM_STREAM_PLAYBACK, SND_PCM_NONBLOCK )) < 0){
_debugAlsa("Error while opening playback device %s\n", pcm_p.c_str());
setErrorMessage( ALSA_PLAYBACK_DEVICE );
return false;
}
if( err = snd_pcm_hw_params_malloc( &hwParams ) < 0 ) {
if( (err = snd_pcm_hw_params_malloc( &hwParams )) < 0 ) {
_debugAlsa(" Cannot allocate hardware parameter structure (%s)\n", snd_strerror(err));
return false;
}
if( err = snd_pcm_hw_params_any( _PlaybackHandle,hwParams) < 0) _debugAlsa(" Cannot initialize hardware parameter structure (%s)\n", snd_strerror(err));
if( err = snd_pcm_hw_params_set_access( _PlaybackHandle, hwParams, SND_PCM_ACCESS_MMAP_INTERLEAVED) < 0) _debugAlsa(" Cannot set access type (%s)\n", snd_strerror(err));
if(( err = snd_pcm_hw_params_any( _PlaybackHandle,hwParams)) < 0) _debugAlsa(" Cannot initialize hardware parameter structure (%s)\n", snd_strerror(err));
if(( err = snd_pcm_hw_params_set_access( _PlaybackHandle, hwParams, SND_PCM_ACCESS_MMAP_INTERLEAVED)) < 0) _debugAlsa(" Cannot set access type (%s)\n", snd_strerror(err));
//if( err = snd_pcm_hw_params_set_access( _PlaybackHandle, hwParams, SND_PCM_ACCESS_RW_INTERLEAVED) < 0) _debugAlsa(" Cannot set access type (%s)\n", snd_strerror(err));
if( err = snd_pcm_hw_params_set_format( _PlaybackHandle, hwParams, SND_PCM_FORMAT_S16_LE) < 0) _debugAlsa(" Cannot set sample format (%s)\n", snd_strerror(err));
if( err = snd_pcm_hw_params_set_rate( _PlaybackHandle, hwParams, rate_out, dir) < 0) _debugAlsa(" Cannot set sample rate (%s)\n", snd_strerror(err));
if( err = snd_pcm_hw_params_set_channels( _PlaybackHandle, hwParams, 1) < 0) _debugAlsa(" Cannot set channel count (%s)\n", snd_strerror(err));
if( err = snd_pcm_hw_params_set_buffer_time_near( _PlaybackHandle, hwParams, &buffer_time , &dir) < 0) _debugAlsa(" Cannot set buffer time (%s)\n", snd_strerror(err));
if( err = snd_pcm_hw_params_set_period_time_near( _PlaybackHandle, hwParams, &period_time , &dir) < 0) _debugAlsa(" Cannot set period time (%s)\n", snd_strerror(err));
if( err = snd_pcm_hw_params_get_period_size( hwParams, &_periodSize , &dir) < 0) _debugAlsa(" Cannot get period size (%s)\n", snd_strerror(err));
if( err = snd_pcm_hw_params_get_buffer_size( hwParams, &buffer_size_out ) < 0) _debugAlsa(" Cannot get buffer size (%s)\n", snd_strerror(err));
if( err = snd_pcm_hw_params( _PlaybackHandle, hwParams ) < 0) _debugAlsa(" Cannot set hw parameters (%s)\n", snd_strerror(err));
if( (err = snd_pcm_hw_params_set_format( _PlaybackHandle, hwParams, SND_PCM_FORMAT_S16_LE)) < 0) _debugAlsa(" Cannot set sample format (%s)\n", snd_strerror(err));
if( (err = snd_pcm_hw_params_set_rate( _PlaybackHandle, hwParams, rate_out, dir)) < 0) _debugAlsa(" Cannot set sample rate (%s)\n", snd_strerror(err));
if( (err = snd_pcm_hw_params_set_channels( _PlaybackHandle, hwParams, 1)) < 0) _debugAlsa(" Cannot set channel count (%s)\n", snd_strerror(err));
if( (err = snd_pcm_hw_params_set_buffer_time_near( _PlaybackHandle, hwParams, &buffer_time , &dir)) < 0) _debugAlsa(" Cannot set buffer time (%s)\n", snd_strerror(err));
if( (err = snd_pcm_hw_params_set_period_time_near( _PlaybackHandle, hwParams, &period_time , &dir)) < 0) _debugAlsa(" Cannot set period time (%s)\n", snd_strerror(err));
if( (err = snd_pcm_hw_params_get_period_size( hwParams, &_periodSize , &dir)) < 0) _debugAlsa(" Cannot get period size (%s)\n", snd_strerror(err));
if( (err = snd_pcm_hw_params_get_buffer_size( hwParams, &buffer_size_out )) < 0) _debugAlsa(" Cannot get buffer size (%s)\n", snd_strerror(err));
if( (err = snd_pcm_hw_params( _PlaybackHandle, hwParams )) < 0) _debugAlsa(" Cannot set hw parameters (%s)\n", snd_strerror(err));
snd_pcm_hw_params_free( hwParams );
......@@ -367,23 +373,23 @@ AlsaLayer::open_device(std::string pcm_p, std::string pcm_c, int flag)
snd_pcm_sw_params_malloc( &swparams );
snd_pcm_sw_params_current( _PlaybackHandle, swparams );
if( err = snd_pcm_sw_params_set_start_threshold( _PlaybackHandle, swparams, period_size_out) < 0 ) _debugAlsa(" Cannot set start threshold (%s)\n", snd_strerror(err));
if((err = snd_pcm_sw_params_set_start_threshold( _PlaybackHandle, swparams, period_size_out)) < 0 ) _debugAlsa(" Cannot set start threshold (%s)\n", snd_strerror(err));
snd_pcm_sw_params_get_start_threshold( swparams , &val);
_debug("Start threshold = %d\n" ,val);
_debug("Start threshold = %d\n" ,(int)val);
//if( err = snd_pcm_sw_params_set_stop_threshold( _PlaybackHandle, swparams, buffer_size_out ) < 0 ) _debugAlsa(" Cannot set stop threshold (%s)\n", snd_strerror(err));
//snd_pcm_sw_params_get_stop_threshold( swparams , &val);
//_debug("Stop threshold = %d\n" ,val);
if( err = snd_pcm_sw_params_set_avail_min( _PlaybackHandle, swparams, period_size_out) < 0) _debugAlsa(" Cannot set min avail (%s)\n" , snd_strerror(err));
if( err = snd_pcm_sw_params_set_xfer_align( _PlaybackHandle, swparams, 1) < 0) _debugAlsa(" Cannot set xfer align (%s)\n" , snd_strerror(err));
if((err = snd_pcm_sw_params_set_avail_min( _PlaybackHandle, swparams, period_size_out)) < 0) _debugAlsa(" Cannot set min avail (%s)\n" , snd_strerror(err));
if((err = snd_pcm_sw_params_set_xfer_align( _PlaybackHandle, swparams, 1)) < 0) _debugAlsa(" Cannot set xfer align (%s)\n" , snd_strerror(err));
snd_pcm_sw_params_get_avail_min( swparams , &val);
_debug("Min available = %d\n" ,val);
_debug("Min available = %d\n" ,(int)val);
//if( err = snd_pcm_sw_params_set_silence_threshold( _PlaybackHandle, swparams, period_size_out) < 0) _debugAlsa(" Cannot set silence threshold (%s)\n" , snd_strerror(err));
//snd_pcm_sw_params_get_silence_threshold( swparams , &val);
// _debug("Silence threshold = %d\n" ,val);
if( err = snd_pcm_sw_params( _PlaybackHandle, swparams ) < 0 ) _debugAlsa(" Cannot set sw parameters (%s)\n", snd_strerror(err));
if(( err = snd_pcm_sw_params( _PlaybackHandle, swparams )) < 0 ) _debugAlsa(" Cannot set sw parameters (%s)\n", snd_strerror(err));
snd_pcm_sw_params_free( swparams );
if ( err = snd_async_add_pcm_handler( &_AsyncHandler, _PlaybackHandle , AlsaCallBack, this ) < 0) _debugAlsa(" Unable to install the async callback handler (%s)\n", snd_strerror(err));
if (( err = snd_async_add_pcm_handler( &_AsyncHandler, _PlaybackHandle , AlsaCallBack, this ) < 0)) _debugAlsa(" Unable to install the async callback handler (%s)\n", snd_strerror(err));
deviceClosed = false;
}
//fillHWBuffer();
......@@ -421,8 +427,8 @@ AlsaLayer::write(void* buffer, int length)
break;
}
if( err >=0 && err < frames )
_debugAlsa("Short write : %d out of %d\n", err , frames);
if( ( err >=0 ) && ( err < (int)frames ) )
_debugAlsa("Short write : %d out of %d\n", err , (int)frames);
return ( err > 0 )? err : 0 ;
}
......@@ -439,7 +445,7 @@ AlsaLayer::read( void* buffer, int toCopy)
snd_pcm_start( _CaptureHandle );
}
snd_pcm_uframes_t frames = snd_pcm_bytes_to_frames( _CaptureHandle, toCopy );
if( err = snd_pcm_mmap_readi( _CaptureHandle, buffer, frames) < 0 ) {
if(( err = snd_pcm_mmap_readi( _CaptureHandle, buffer, frames)) < 0 ) {
switch(err){
case EPERM:
_debugAlsa(" Capture EPERM (%s)\n", snd_strerror(err));
......@@ -470,7 +476,9 @@ AlsaLayer::read( void* buffer, int toCopy)
int
AlsaLayer::putInCache( char code, void *buffer, int toCopy )
{}
{
return 1;
}
void
AlsaLayer::handle_xrun_capture( void )
......@@ -497,7 +505,7 @@ AlsaLayer::handle_xrun_playback( void )
snd_pcm_status_t* status;
snd_pcm_status_alloca( &status );
if( state = snd_pcm_status( _PlaybackHandle, status ) < 0 ) _debugAlsa(" Error: Cannot get playback handle status (%s)\n" , snd_strerror( state ) );
if( (state = snd_pcm_status( _PlaybackHandle, status )) < 0 ) _debugAlsa(" Error: Cannot get playback handle status (%s)\n" , snd_strerror( state ) );
else
{
state = snd_pcm_status_get_state( status );
......@@ -541,7 +549,6 @@ AlsaLayer::getSoundCardsInfo( int stream )
snd_pcm_info_alloca( &pcminfo );
int numCard = -1 ;
int err;
std::string description;
if(snd_card_next( &numCard ) < 0 || numCard < 0)
......@@ -624,7 +631,7 @@ AlsaLayer::soundCardIndexExist( int card , int stream )
int
AlsaLayer::soundCardGetIndex( std::string description )
{
int i;
unsigned int i;
for( i = 0 ; i < IDSoundCards.size() ; i++ )
{
HwIDPair p = IDSoundCards[i];
......
......@@ -203,6 +203,12 @@ class AlsaLayer : public AudioLayer {
void setPlaybackVolume( double volume );
private:
// Copy Constructor
AlsaLayer(const AlsaLayer& rh);
// Assignment Operator
AlsaLayer& operator=( const AlsaLayer& rh);
/**
* Drop the pending frames and close the capture device
......
......@@ -23,7 +23,7 @@
const double AudioDevice::DEFAULT_RATE = 8000.0;
AudioDevice::AudioDevice(int id, const std::string& name) :
_id(id), _name(name)
_id(id), _name(name), _rate(DEFAULT_RATE)
{
_rate = DEFAULT_RATE;
}
......
......@@ -45,17 +45,6 @@ public:
*/
~AudioFile();
// Copy Constructor
AudioFile(const AudioFile& rh):_filename(rh._filename), _codec(rh._codec), _start(rh._start) {
_debug("AudioFilie copy constructor hasn't been implemented yet. Quit!");
exit(0);
}
// Assignment Operator
AudioFile& operator=( const AudioFile& rh){
_debug("AudioFilie assignment operator hasn't been implemented yet. Quit!");
exit(0);
}
/**
* Load a sound file in memory
......@@ -84,6 +73,12 @@ public:
bool isStarted() { return _start; }
private:
// Copy Constructor
AudioFile(const AudioFile& rh);
// Assignment Operator
AudioFile& operator=( const AudioFile& rh);
/** The absolute path to the sound file */
std::string _filename;
......
......@@ -46,6 +46,15 @@
*/
class AudioLayer {
private:
//copy constructor
AudioLayer(const AudioLayer& rh);
// assignment operator
AudioLayer& operator=(const AudioLayer& rh);
public:
/**
* Constructor
......@@ -69,37 +78,11 @@ class AudioLayer {
}
//copy constructor
AudioLayer(const AudioLayer& rh)
: _layerType( rh._layerType )
, _manager(rh._manager)
, _urgentBuffer( rh._urgentBuffer )
, _talk ( rh._talk )
, deviceClosed ( rh.deviceClosed )
, _indexIn ( rh._indexIn )
, _indexOut ( rh._indexOut )
, _sampleRate ( rh._sampleRate )
, _frameSize ( rh._frameSize )
, _inChannel( rh._inChannel )
, _outChannel ( rh._outChannel )
, _errorMessage ( rh._errorMessage )
, _mutex (rh._mutex)
{
_debug("AudioLayer copy constructor hasn't been implemented yet. Quit!");
exit(0);
}
// assignment operator
AudioLayer& operator=(const AudioLayer& rh)
{
_debug("AudioLayer assignment operator hasn't been implemented yet. Quit!");
exit(0);
}
/**
* Destructor
*/
~AudioLayer(void){}
virtual ~AudioLayer(void){}
virtual void closeLayer( void ) = 0;
......
......@@ -42,18 +42,6 @@ public:
*/
virtual ~AudioLoop();
// Copy Constructor
AudioLoop(const AudioLoop& rh):_buffer(rh._buffer),_size(rh._size), _pos(rh._pos), _sampleRate(rh._sampleRate) {
_debug("AudioLoop copy constructor hasn't been implemented yet. Quit!");
exit(0);
}
// Assignment Operator
AudioLoop& operator=( const AudioLoop& rh){
_debug("AudioLoop assignment operator hasn't been implemented yet. Quit!");
exit(0);
}
/**
* Get the next fragment of the tone
* the function change the intern position, and will loop
......@@ -76,7 +64,6 @@ public:
unsigned int getSize() { return _size; }
protected:
/** The data buffer */
SFLDataFormat* _buffer;
......@@ -88,7 +75,15 @@ protected:
int _pos;
/** Sample rate */
int _sampleRate;
int _sampleRate;
private:
// Copy Constructor
AudioLoop(const AudioLoop& rh);
// Assignment Operator
AudioLoop& operator=( const AudioLoop& rh);
};
#endif // __AUDIOLOOP_H__
......
......@@ -42,9 +42,8 @@
////////////////////////////////////////////////////////////////////////////////
// AudioRtp
////////////////////////////////////////////////////////////////////////////////
AudioRtp::AudioRtp ()
AudioRtp::AudioRtp() :_RTXThread(0), _symmetric(), _threadMutex()
{
_RTXThread = 0;
}
AudioRtp::~AudioRtp (void) {
......@@ -94,12 +93,11 @@ AudioRtp::closeRtpSession () {
////////////////////////////////////////////////////////////////////////////////
// AudioRtpRTX Class //
////////////////////////////////////////////////////////////////////////////////
AudioRtpRTX::AudioRtpRTX (SIPCall *sipcall, bool sym)
AudioRtpRTX::AudioRtpRTX (SIPCall *sipcall, bool sym) : time(new ost::Time()), _ca(sipcall), _sessionSend(NULL), _sessionRecv(NULL), _session(NULL), _start(),
_sym(sym), micData(NULL), micDataConverted(NULL), micDataEncoded(NULL), spkrDataDecoded(NULL), spkrDataConverted(NULL),
converter(NULL), _layerSampleRate(),_codecSampleRate(), _layerFrameSize(), _audiocodec(NULL)
{
setCancel(cancelDeferred);
time = new ost::Time();
_ca = sipcall;
_sym = sym;
// AudioRtpRTX should be close if we change sample rate
// TODO: Change bind address according to user settings.
// TODO: this should be the local ip not the external (router) IP
......@@ -324,7 +322,7 @@ AudioRtpRTX::receiveSessionForSpkr (int& countTime)
//buffer _receiveDataDecoded ----> short int or int16, coded on 2 bytes
int nbInt16 = expandedSize / sizeof(int16);
//nbInt16 represents the number of samples we just decoded
if (nbInt16 > max) {
if ((unsigned int)nbInt16 > max) {
_debug("We have decoded an RTP packet larger than expected: %d VS %d. Cropping.\n", nbInt16, max);
nbInt16=max;
}
......
......@@ -65,6 +65,13 @@ class AudioRtpRTX : public ost::Thread, public ost::TimerPort {
virtual void run ();
private:
// copy constructor
AudioRtpRTX(const AudioRtpRTX& rh);
// assignment operator
AudioRtpRTX& operator=(const AudioRtpRTX& rh);
/** A SIP call */
SIPCall* _ca;
......@@ -169,6 +176,12 @@ class AudioRtp {
void closeRtpSession( void );
private:
// copy constructor
AudioRtp(const AudioRtp& rh);
// assignment operator
AudioRtp& operator=(const AudioRtp& rh);
/** The RTP thread */
AudioRtpRTX* _RTXThread;
......
......@@ -22,17 +22,15 @@
static pa_channel_map channel_map ;
AudioStream::AudioStream( pa_context* context, int type, std::string desc, double vol )
: _audiostream (createStream( context )), _streamType(type), _streamDescription(desc), flag(PA_STREAM_AUTO_TIMING_UPDATE), sample_spec(), _volume()
{
_streamType = type;
_streamDescription = desc;
sample_spec.format = PA_SAMPLE_S16LE;
sample_spec.rate = 44100;
sample_spec.channels = 1;
channel_map.channels = 1;
flag = PA_STREAM_AUTO_TIMING_UPDATE ;
pa_cvolume_set( &_volume , 1 , PA_VOLUME_MUTED ) ; // * vol / 100 ;
_audiostream = createStream( context );
//_audiostream = createStream( context );
}
AudioStream::~AudioStream()
......@@ -76,7 +74,7 @@ AudioStream::stream_state_callback( pa_stream* s, void* user_data )
AudioStream::createStream( pa_context* c )
{
pa_stream* s;
pa_cvolume cv;
//pa_cvolume cv;
assert(pa_sample_spec_valid(&sample_spec));
assert(pa_channel_map_valid(&channel_map));
......
......@@ -95,6 +95,13 @@ class AudioStream {
pa_cvolume getVolume( void ) { return _volume; }
private:
// Copy Constructor
AudioStream(const AudioStream& rh);
// Assignment Operator
AudioStream& operator=( const AudioStream& rh);
/**
* Create the audio stream into the given context
* @param c The pulseaudio context
......
......@@ -24,7 +24,7 @@
#include "codecDescriptor.h"
CodecDescriptor::CodecDescriptor()
CodecDescriptor::CodecDescriptor() : _CodecsMap(), _codecOrder(), _Cache(), _nbCodecs(), _CodecInMemory()
{
}
......@@ -36,7 +36,7 @@ CodecDescriptor::~CodecDescriptor()
CodecDescriptor::deleteHandlePointer( void )
{
int i;
for( i = 0 ; i < _CodecInMemory.size() ; i++)
for( i = 0 ; (unsigned int)i < _CodecInMemory.size() ; i++)
{
unloadCodec( _CodecInMemory[i] );
}
......@@ -97,7 +97,7 @@ CodecDescriptor::getCodec(AudioCodecType payload)
CodecDescriptor::isActive(AudioCodecType payload)
{
int i;
for(i=0 ; i < _codecOrder.size() ; i++)
for(i=0 ; (unsigned int)i < _codecOrder.size() ; i++)
{
if(_codecOrder[i] == payload)
return true;
......@@ -164,7 +164,7 @@ CodecDescriptor::saveActiveCodecs(const std::vector<std::string>& list)
int i=0;
int payload;
size_t size = list.size();
while( i < size )
while( (unsigned int)i < size )
{
payload = std::atoi(list[i].data());
if( isCodecLoaded( payload ) ) {
......@@ -188,7 +188,7 @@ CodecDescriptor::scanCodecDirectory( void )
dirToScan.push_back(homeDir);
dirToScan.push_back(libDir);
for( i = 0 ; i < dirToScan.size() ; i++ )
for( i = 0 ; (unsigned int)i < dirToScan.size() ; i++ )
{
std::string dirStr = dirToScan[i];
_debug("Scanning %s to find audio codecs....\n", dirStr.c_str());
......@@ -196,7 +196,7 @@ CodecDescriptor::scanCodecDirectory( void )
AudioCodec* audioCodec;
if( dir ){
dirent *dirStruct;
while( dirStruct = readdir( dir )) {
while( (dirStruct = readdir( dir )) ) {
tmp = dirStruct -> d_name ;
if( tmp == CURRENT_DIR || tmp == PARENT_DIR){}
else{
......@@ -241,7 +241,6 @@ CodecDescriptor::unloadCodec( CodecHandlePointer p )
{
// _debug("Unload codec %s\n", p.first->getCodecName().c_str());
using std::cerr;
int i;
destroy_t* destroyCodec = (destroy_t*)dlsym( p.second , "destroy");
if(dlerror())
cerr << dlerror() << '\n';
......@@ -311,7 +310,7 @@ CodecDescriptor::seemsValid( std::string lib)