Commit d5e7dd60 authored by jcacerec's avatar jcacerec
Browse files

More on classes structure

parent 3d47e0f1
......@@ -114,14 +114,6 @@ public:
/// \brief The class destructor
virtual ~DataProtocol();
/** \brief Set the pointer to the RingBuffer that'll be use to read
* or write
*/
/*
void setRingBuffer(std::tr1::shared_ptr<RingBuffer> RingBuffer)
{ mRingBuffer = RingBuffer; };
*/
/** \brief Implements the thread loop
*
* Depending on the runmode, with will run a DataProtocol::SENDER thread or
......@@ -160,9 +152,6 @@ protected:
*/
runModeT getRunMode() const { return mRunMode; };
/// Smart Pointer to RingBuffer to read (for SENDER) or write (for RECEIVER)
//std::tr1::shared_ptr<RingBuffer> mRingBuffer;
/// Boolean stop the execution of the thread
volatile bool mStopped;
/// Boolean to indicate if the RECEIVER is waiting to obtain peer address
......
......@@ -71,7 +71,9 @@ JackTrip::JackTrip(jacktripModeT JacktripMode,
mDataProtocolReceiver(NULL),
mJackAudio(NULL),
mPacketHeader(NULL),
mUnderRunMode(UnderRunMode)
mUnderRunMode(UnderRunMode),
mSendRingBuffer(NULL),
mReceiveRingBuffer(NULL)
{
setupJackAudio();
/// \todo CHECK THIS AND PUT IT IN A BETTER PLACE, also, get header type from options
......@@ -86,6 +88,8 @@ JackTrip::~JackTrip()
delete mDataProtocolReceiver;
delete mJackAudio;
delete mPacketHeader;
delete mSendRingBuffer;
delete mReceiveRingBuffer;
}
......@@ -150,16 +154,29 @@ void JackTrip::setupRingBuffers()
/// \todo Make all this operations cleaner
switch (mUnderRunMode) {
case WAVETABLE:
/*
mSendRingBuffer.reset( new RingBufferWavetable(mJackAudio->getSizeInBytesPerChannel() * mNumChans,
gDefaultOutputQueueLength) );
mReceiveRingBuffer.reset( new RingBufferWavetable(mJackAudio->getSizeInBytesPerChannel() * mNumChans,
mBufferQueueLength) );
*/
mSendRingBuffer = new RingBufferWavetable(mJackAudio->getSizeInBytesPerChannel() * mNumChans,
gDefaultOutputQueueLength);
mReceiveRingBuffer = new RingBufferWavetable(mJackAudio->getSizeInBytesPerChannel() * mNumChans,
mBufferQueueLength);
break;
case ZEROS:
/*
mSendRingBuffer.reset( new RingBuffer(mJackAudio->getSizeInBytesPerChannel() * mNumChans,
gDefaultOutputQueueLength) );
mReceiveRingBuffer.reset( new RingBuffer(mJackAudio->getSizeInBytesPerChannel() * mNumChans,
mBufferQueueLength) );
*/
mSendRingBuffer = new RingBuffer(mJackAudio->getSizeInBytesPerChannel() * mNumChans,
gDefaultOutputQueueLength);
mReceiveRingBuffer = new RingBuffer(mJackAudio->getSizeInBytesPerChannel() * mNumChans,
mBufferQueueLength);
break;
default:
std::cerr << "ERROR: Underrun Mode not defined" << std::endl;
......
......@@ -203,9 +203,11 @@ private:
underrunModeT mUnderRunMode; ///< underrunModeT Mode
/// Shared (smart) Pointer for the Send RingBuffer
std::tr1::shared_ptr<RingBuffer> mSendRingBuffer;
//std::tr1::shared_ptr<RingBuffer> mSendRingBuffer;
RingBuffer* mSendRingBuffer;
/// Shared (smart) Pointer for the Receive RingBuffer
std::tr1::shared_ptr<RingBuffer> mReceiveRingBuffer;
//std::tr1::shared_ptr<RingBuffer> mReceiveRingBuffer;
RingBuffer* mReceiveRingBuffer;
//JackTripMediator mJackTripMediator;
};
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment