Skip to content
Snippets Groups Projects
Commit 322793af authored by Emmanuel Milou's avatar Emmanuel Milou
Browse files

cache samples

parent 9e46baec
No related branches found
No related tags found
No related merge requests found
......@@ -130,6 +130,7 @@ class AudioLayer {
virtual int putUrgent(void* buffer, int toCopy) = 0;
virtual int putMain( void* buffer, int toCopy) = 0;
virtual int putInCache(char code, void* buffer, int toCopy) = 0;
/**
* Query the capture device for number of bytes available in the hardware ring buffer
......
......@@ -75,14 +75,12 @@ AudioStream::createStream( pa_context* c )
if( _streamType == PLAYBACK_STREAM ){
pa_stream_connect_playback( s , NULL , NULL , flag , NULL, NULL );
//pa_stream_set_write_callback( s , audioCallback, this);
}
else if( _streamType == CAPTURE_STREAM ){
pa_stream_connect_record( s , NULL , NULL , flag );
//pa_stream_set_read_callback( s , audioCallback, this);
}
else if( _streamType == UPLOAD_STREAM ){
//pa_stream_connect_upload( s , 1024 );
pa_stream_connect_upload( s , 1024 );
}
else{
_debug( "Stream type unknown \n");
......
......@@ -20,7 +20,7 @@
#include "pulselayer.h"
int framesPerBuffer = 1024;
int framesPerBuffer = 4096;
PulseLayer::PulseLayer(ManagerImpl* manager)
: AudioLayer( manager , PULSEAUDIO )
......@@ -98,7 +98,7 @@ PulseLayer::createStreams( pa_context* c )
pa_stream_set_write_callback( playback->pulseStream() , audioCallback, this);
record = new AudioStream(c, CAPTURE_STREAM, "SFLphone in");
pa_stream_set_read_callback( record->pulseStream() , audioCallback, this);
//cache = new AudioStream(c, UPLOAD_STREAM, "Cache samples");
cache = new AudioStream(c, UPLOAD_STREAM, "Cache samples");
pa_threaded_mainloop_signal(m , 0);
}
......@@ -263,3 +263,12 @@ PulseLayer::write( void )
}
pa_stream_write( playback->pulseStream() , out , toGet , pa_xfree, 0 , PA_SEEK_RELATIVE);
}
int
PulseLayer::putInCache( char code, void *buffer, int toCopy )
{
_debug("Put the DTMF in cache\n");
//pa_stream_write( cache->pulseStream() , buffer , toCopy , pa_xfree, 0 , PA_SEEK_RELATIVE);
//pa_stream_finish_upload( cache->pulseStream() );
}
......@@ -61,6 +61,7 @@ class PulseLayer : public AudioLayer {
void flushMain();
int putMain(void* buffer, int toCopy);
int putUrgent(void* buffer, int toCopy);
int putInCache( char code, void* buffer , int toCopy );
int canGetMic();
int getMic(void *, int);
void flushMic();
......@@ -115,8 +116,7 @@ class PulseLayer : public AudioLayer {
* @return std::string The name of the audio plugin
*/
std::string getAudioPlugin( void ) { return "default"; }
//pa_stream* getCacheStream( void ) { return caching; }
private:
/**
......
......@@ -507,7 +507,11 @@ ManagerImpl::playDtmf(char code, bool isTalking)
}
returnValue = true;
// TODO: add caching
#if CHECK_INTERFACE( layer , PULSEAUDIO )
// Cache the samples on the sound server
(PulseLayer*)audiolayer->putInCache( code, _buf , size * sizeof(SFLDataFormat) );
#endif
delete[] _buf; _buf = 0;
return returnValue;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment