Commit e09426c6 authored by Dipl.-Ing. Jonas Stienen's avatar Dipl.-Ing. Jonas Stienen
Browse files

Cleanup of NetAudio interface, some more comments in code

parent c80e1b78
...@@ -24,11 +24,23 @@ ...@@ -24,11 +24,23 @@
#include <ITADataSourceRealization.h> #include <ITADataSourceRealization.h>
//! Sample-generation callback function pointer class //! Sample-generation class with abstract method for providing samples
class CITASampleProcessor : public ITADatasourceRealization /*
* This ready-to-use class helps to provide samples for a NetAudio streaming server with
* a single method for processing that has to be implemented ...
* ... just derive and implement Process() method. Have a look at Zero() method
* for exemplary usage of sample buffer.
*/
class ITA_DATA_SOURCES_API CITASampleProcessor : public ITADatasourceRealization
{ {
public: public:
inline CITASampleProcessor( const double dSampleRate, const int iNumChannels, const int iBlockLength ) //! Create a sample processor with streaming parameters
/*
* @param[in] iNumChannels Channels provided
* @param[in] dSampleRate Audio processing sampling rate
* @param[in] iBlockLength Audio processing block length / buffer size
*/
inline CITASampleProcessor( const int iNumChannels, const double dSampleRate, const int iBlockLength )
: ITADatasourceRealization( ( unsigned int ) ( iNumChannels ), dSampleRate, ( unsigned int ) ( iBlockLength ) ) : ITADatasourceRealization( ( unsigned int ) ( iNumChannels ), dSampleRate, ( unsigned int ) ( iBlockLength ) )
{ {
m_vvfSampleBuffer.resize( iNumChannels ); m_vvfSampleBuffer.resize( iNumChannels );
...@@ -38,7 +50,6 @@ public: ...@@ -38,7 +50,6 @@ public:
Zero(); Zero();
}; };
//! Sets all channels and samples to zero //! Sets all channels and samples to zero
inline void Zero() inline void Zero()
{ {
...@@ -66,6 +77,7 @@ public: ...@@ -66,6 +77,7 @@ public:
* to produce or copy audio samples into the internal buffer m_vvfSampleBuffer * to produce or copy audio samples into the internal buffer m_vvfSampleBuffer
* *
* @param[in] pStreamInfo Information over streaming status, i.e. sample count and time stamp * @param[in] pStreamInfo Information over streaming status, i.e. sample count and time stamp
*
*/ */
virtual void Process( const ITAStreamInfo* pStreamInfo ) =0; virtual void Process( const ITAStreamInfo* pStreamInfo ) =0;
...@@ -73,7 +85,7 @@ protected: ...@@ -73,7 +85,7 @@ protected:
std::vector< std::vector< float > > m_vvfSampleBuffer; //!< Multi-channel sample buffer to be filled std::vector< std::vector< float > > m_vvfSampleBuffer; //!< Multi-channel sample buffer to be filled
private: private:
//! Delegate internal buffer to audio stream //! Delegate internal buffer to audio stream (ITADatasource)
inline void ProcessStream( const ITAStreamInfo* pInfo ) inline void ProcessStream( const ITAStreamInfo* pInfo )
{ {
Process( pInfo ); Process( pInfo );
...@@ -89,11 +101,11 @@ private: ...@@ -89,11 +101,11 @@ private:
}; };
}; };
//! Network audio sample server (for providing samples via individual callback) //! Network audio sample server (for providing samples via derived generator class)
/** /**
* Audio sample transmitter for a networked sample callback function that can connect via TCP/IP. * Audio sample transmitter for a networked sample callback function that can connect via TCP/IP.
* *
* @sa CITANetAudioStream CITANetAudioStreamingServer * @sa CITANetAudioStream CITANetAudioStreamingServer CITASampleProcessor
* @note not thread-safe * @note not thread-safe
*/ */
class ITA_DATA_SOURCES_API CITANetAudioSampleServer : public CITANetAudioStreamingServer class ITA_DATA_SOURCES_API CITANetAudioSampleServer : public CITANetAudioStreamingServer
...@@ -124,5 +136,4 @@ private: ...@@ -124,5 +136,4 @@ private:
CITASampleProcessor* m_pSampleProcessor; //!< Callback / sample processor CITASampleProcessor* m_pSampleProcessor; //!< Callback / sample processor
}; };
#endif // INCLUDE_WATCHER_ITA_NET_AUDIO_SAMPLE_SERVER #endif // INCLUDE_WATCHER_ITA_NET_AUDIO_SAMPLE_SERVER
Markdown is supported
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