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

Activating netstream audio signal source implementation, also style fixes

parent bb4ec509
...@@ -227,20 +227,15 @@ std::string CVAAudioSignalSourceManager::CreateAudiofileSignalSource(const std:: ...@@ -227,20 +227,15 @@ std::string CVAAudioSignalSourceManager::CreateAudiofileSignalSource(const std::
std::string CVAAudioSignalSourceManager::CreateSequencerSignalSource(const std::string& sName) std::string CVAAudioSignalSourceManager::CreateSequencerSignalSource(const std::string& sName)
{ {
// Sampler-Quellen sind immer managed und dynamisch // Sampler-Quellen sind immer managed und dynamisch
CVASequencerSignalSource* pSource = new CVASequencerSignalSource(m_dSamplerate, m_iBlocklength, m_pParentCore->GetSamplePool()); CVASequencerSignalSource* pSource = new CVASequencerSignalSource( m_dSamplerate, m_iBlocklength, m_pParentCore->GetSamplePool() );
return RegisterSignalSource(pSource, sName, true, true); return RegisterSignalSource( pSource, sName, true, true );
} }
std::string CVAAudioSignalSourceManager::CreateNetstreamSignalSource(const std::string& sBindAddress, std::string CVAAudioSignalSourceManager::CreateNetstreamSignalSource( const std::string& sBindAddress, int iRecvPort, const std::string& sName )
int iRecvPort,
const std::string& sName)
{ {
/*
// Datei-Quellen sind immer managed und dynamisch // Datei-Quellen sind immer managed und dynamisch
CVANetstreamSignalSource* pSource = new CVANetstreamSignalSource(m_dSamplerate, m_iBlocklength, sBindAddress, iRecvPort); CVANetstreamSignalSource* pSource = new CVANetstreamSignalSource( m_dSamplerate, m_iBlocklength, sBindAddress, iRecvPort );
return RegisterSignalSource(pSource, sName, true, true); return RegisterSignalSource( pSource, sName, true, true );
*/
return "";
} }
std::string CVAAudioSignalSourceManager::CreateEngineSignalSource( const std::string& sName ) std::string CVAAudioSignalSourceManager::CreateEngineSignalSource( const std::string& sName )
......
#include "VANetstreamSignalSource.h" #include "VANetstreamSignalSource.h"
#include <ITAException.h> #include <ITAException.h>
#include <ITABufferDataSource.h> #include <ITANetAudioStream.h>
#include <sstream> #include <sstream>
CVANetstreamSignalSource::CVANetstreamSignalSource(double dDestinationSamplerate, CVANetstreamSignalSource::CVANetstreamSignalSource( double dDestinationSamplerate, int iBlocklength, const std::string& sBindAddress, int iRecvPort )
int iBlocklength, : m_pAssociatedCore( NULL )
const std::string& sBindAddress,
int iRecvPort)
: m_pAssociatedCore(NULL)
{ {
// TODO: ... m_pSourceStream = new CITANetAudioStream( dDestinationSamplerate, iBlocklength );
if( !m_pSourceStream->Connect( sBindAddress, iRecvPort ) )
VA_EXCEPT2( INVALID_PARAMETER, "Could not connect to network audio streaming server" );
} }
CVANetstreamSignalSource::~CVANetstreamSignalSource() { CVANetstreamSignalSource::~CVANetstreamSignalSource()
// TODO: ... {
if( m_pSourceStream->IsConnected() )
m_pSourceStream->Disconnect();
delete m_pSourceStream;
} }
std::string CVANetstreamSignalSource::GetBindAddress() const { std::string CVANetstreamSignalSource::GetBindAddress() const
// TODO: ... {
return ""; return m_pSourceStream->GetNetworkAddess();
} }
int CVANetstreamSignalSource::GetRecvPort() const { int CVANetstreamSignalSource::GetRecvPort() const
// TODO: ... {
return 0; return m_pSourceStream->GetNetworkPort();
} }
std::string CVANetstreamSignalSource::GetTypeString() const { std::string CVANetstreamSignalSource::GetTypeString() const
{
return "Network stream"; return "Network stream";
} }
std::string CVANetstreamSignalSource::GetTypeMnemonic() const { std::string CVANetstreamSignalSource::GetTypeMnemonic() const
{
return "ns"; return "ns";
} }
std::string CVANetstreamSignalSource::GetDesc() const { std::string CVANetstreamSignalSource::GetDesc() const
{
std::stringstream ss; std::stringstream ss;
ss << "Plays the network audio stream received on " ss << "Plays the network audio stream received on " << GetBindAddress() << ":" << GetRecvPort();
<< GetBindAddress() << ":" << GetRecvPort();
return ss.str(); return ss.str();
} }
std::string CVANetstreamSignalSource::GetStateString() const { std::string CVANetstreamSignalSource::GetStateString() const
{
return "<TODO: State string>"; return "<TODO: State string>";
} }
IVACore* CVANetstreamSignalSource::GetAssociatedCore() const { IVACore* CVANetstreamSignalSource::GetAssociatedCore() const
{
return m_pAssociatedCore; return m_pAssociatedCore;
} }
ITADatasource* CVANetstreamSignalSource::GetStreamingDatasource() const { ITADatasource* CVANetstreamSignalSource::GetStreamingDatasource() const
// TODO: ... {
return NULL; return m_pSourceStream;
} }
void CVANetstreamSignalSource::HandleRegistration(IVACore* pParentCore) { void CVANetstreamSignalSource::HandleRegistration( IVACore* pParentCore )
{
m_pAssociatedCore = pParentCore; m_pAssociatedCore = pParentCore;
} }
void CVANetstreamSignalSource::HandleUnregistration(IVACore* pParentCore) { void CVANetstreamSignalSource::HandleUnregistration( IVACore* pParentCore )
{
m_pAssociatedCore = NULL; m_pAssociatedCore = NULL;
} }
\ No newline at end of file
...@@ -4,19 +4,15 @@ ...@@ -4,19 +4,15 @@
#include "VAAudioSignalSource.h" #include "VAAudioSignalSource.h"
#include <string> #include <string>
class ITABufferDatasource; class IVACore;
class ITADatasource; class ITANetAudioStream;
/** /** Network audio stream class
* Diese Klasse realisiert Audiosignalquellen, welche Audiodaten
* per Netzwerk-Stream empfangen und diese dann freisetzen.
* Mit solchen Quellen knnen in VA Audiosignale von externen Rechnern
* eingespielt werden (z.B. fr Klangsynthese).
* *
* TODO: Momentan ist die Klasse nur ein Stub. Sie muss noch implementiert werden. * Can be used i.e. for complex physical sound synthesis on another processing unit.
*/ */
class CVANetstreamSignalSource : public IVAAudioSignalSource
class CVANetstreamSignalSource : public IVAAudioSignalSource { {
public: public:
/** /**
* \param dDestinationSamplerate Abtastrate die vorrausgesetzt wird * \param dDestinationSamplerate Abtastrate die vorrausgesetzt wird
...@@ -24,10 +20,7 @@ public: ...@@ -24,10 +20,7 @@ public:
* \param sBindAddress Netzwerk-Adresse an den gebunden wird * \param sBindAddress Netzwerk-Adresse an den gebunden wird
* \param iRecvPort Eingangsport auf dem gelauscht wird. * \param iRecvPort Eingangsport auf dem gelauscht wird.
*/ */
CVANetstreamSignalSource(double dDestinationSamplerate, CVANetstreamSignalSource( double dDestinationSamplerate, int iBlocklength, const std::string& sBindAddress, int iRecvPort );
int iBlocklength,
const std::string& sBindAddress,
int iRecvPort);
virtual ~CVANetstreamSignalSource(); virtual ~CVANetstreamSignalSource();
...@@ -47,11 +40,11 @@ public: ...@@ -47,11 +40,11 @@ public:
ITADatasource* GetStreamingDatasource() const; ITADatasource* GetStreamingDatasource() const;
private: private:
IVACore* m_pAssociatedCore; IVACore* m_pAssociatedCore; //!< TODO needed?
ITABufferDatasource* m_pFileDatasource; ITANetAudioStream* m_pSourceStream;
void HandleRegistration(IVACore* pParentCore); void HandleRegistration( IVACore* pParentCore );
void HandleUnregistration(IVACore* pParentCore); void HandleUnregistration( IVACore* pParentCore );
}; };
#endif // __VA_NETSTREAMSIGNALSOURCE_H__ #endif // __VA_NETSTREAMSIGNALSOURCE_H__
...@@ -1147,14 +1147,15 @@ std::string CVACoreImpl::CreateSequencerSignalSource(const std::string& sName) { ...@@ -1147,14 +1147,15 @@ std::string CVACoreImpl::CreateSequencerSignalSource(const std::string& sName) {
} VA_RETHROW; } VA_RETHROW;
} }
std::string CVACoreImpl::CreateNetworkStreamSignalSource(const std::string& sInterface, std::string CVACoreImpl::CreateNetworkStreamSignalSource( const std::string& sInterface, int iPort, const std::string& sName )
int iPort, {
const std::string& sName) {
VA_NO_REENTRANCE; VA_NO_REENTRANCE;
VA_CHECK_INITIALIZED; VA_CHECK_INITIALIZED;
VA_TRY { VA_TRY
std::string sID = m_pSignalSourceMan->CreateNetstreamSignalSource(sInterface, iPort, sName); {
VA_TRACE( "VACore", "Attempting to connect to a netstream signal source on " << sInterface << " with port " << iPort );
std::string sID = m_pSignalSourceMan->CreateNetstreamSignalSource( sInterface, iPort, sName );
assert( !sID.empty() ); assert( !sID.empty() );
// Ereignis generieren, wenn Operation erfolgreich // Ereignis generieren, wenn Operation erfolgreich
...@@ -1164,10 +1165,11 @@ std::string CVACoreImpl::CreateNetworkStreamSignalSource(const std::string& sInt ...@@ -1164,10 +1165,11 @@ std::string CVACoreImpl::CreateNetworkStreamSignalSource(const std::string& sInt
ev.sObjectID = sID; ev.sObjectID = sID;
m_pCoreEventMan->BroadcastEvent(ev); m_pCoreEventMan->BroadcastEvent(ev);
VA_INFO("Core", "Created network stream signal source (ID=" << sID << ", Name=\"" << sName << "\", Interface=" << sInterface << ":" << iPort << ")"); VA_INFO( "Core", "Created network stream signal source (ID=" << sID << ", Name='" << sName << "', Interface=" << sInterface << ":" << iPort << ")" );
return sID; return sID;
} VA_RETHROW; }
VA_RETHROW;
} }
std::string CVACoreImpl::CreateEngineSignalSource( const std::string& sName ) std::string CVACoreImpl::CreateEngineSignalSource( const std::string& sName )
......
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