Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Institute of Technical Acoustics (ITA)
VACore
Commits
c13a6a1f
Commit
c13a6a1f
authored
Dec 15, 2016
by
Dipl.-Ing. Jonas Stienen
Browse files
Activating netstream audio signal source implementation, also style fixes
parent
bb4ec509
Changes
4
Hide whitespace changes
Inline
Side-by-side
src/Audiosignals/VAAudioSignalSourceManager.cpp
View file @
c13a6a1f
...
...
@@ -227,20 +227,15 @@ std::string CVAAudioSignalSourceManager::CreateAudiofileSignalSource(const std::
std
::
string
CVAAudioSignalSourceManager
::
CreateSequencerSignalSource
(
const
std
::
string
&
sName
)
{
// Sampler-Quellen sind immer managed und dynamisch
CVASequencerSignalSource
*
pSource
=
new
CVASequencerSignalSource
(
m_dSamplerate
,
m_iBlocklength
,
m_pParentCore
->
GetSamplePool
());
return
RegisterSignalSource
(
pSource
,
sName
,
true
,
true
);
CVASequencerSignalSource
*
pSource
=
new
CVASequencerSignalSource
(
m_dSamplerate
,
m_iBlocklength
,
m_pParentCore
->
GetSamplePool
()
);
return
RegisterSignalSource
(
pSource
,
sName
,
true
,
true
);
}
std
::
string
CVAAudioSignalSourceManager
::
CreateNetstreamSignalSource
(
const
std
::
string
&
sBindAddress
,
int
iRecvPort
,
const
std
::
string
&
sName
)
std
::
string
CVAAudioSignalSourceManager
::
CreateNetstreamSignalSource
(
const
std
::
string
&
sBindAddress
,
int
iRecvPort
,
const
std
::
string
&
sName
)
{
/*
// Datei-Quellen sind immer managed und dynamisch
CVANetstreamSignalSource* pSource = new CVANetstreamSignalSource(m_dSamplerate, m_iBlocklength, sBindAddress, iRecvPort);
return RegisterSignalSource(pSource, sName, true, true);
*/
return
""
;
CVANetstreamSignalSource
*
pSource
=
new
CVANetstreamSignalSource
(
m_dSamplerate
,
m_iBlocklength
,
sBindAddress
,
iRecvPort
);
return
RegisterSignalSource
(
pSource
,
sName
,
true
,
true
);
}
std
::
string
CVAAudioSignalSourceManager
::
CreateEngineSignalSource
(
const
std
::
string
&
sName
)
...
...
src/Audiosignals/VANetstreamSignalSource.cpp
View file @
c13a6a1f
#include
"VANetstreamSignalSource.h"
#include
<ITAException.h>
#include
<ITABufferDataSource.h>
#include
<ITANetAudioStream.h>
#include
<sstream>
CVANetstreamSignalSource
::
CVANetstreamSignalSource
(
double
dDestinationSamplerate
,
int
iBlocklength
,
const
std
::
string
&
sBindAddress
,
int
iRecvPort
)
:
m_pAssociatedCore
(
NULL
)
CVANetstreamSignalSource
::
CVANetstreamSignalSource
(
double
dDestinationSamplerate
,
int
iBlocklength
,
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
()
{
// TODO: ...
CVANetstreamSignalSource
::~
CVANetstreamSignalSource
()
{
if
(
m_pSourceStream
->
IsConnected
()
)
m_pSourceStream
->
Disconnect
();
delete
m_pSourceStream
;
}
std
::
string
CVANetstreamSignalSource
::
GetBindAddress
()
const
{
// TODO: ...
return
""
;
std
::
string
CVANetstreamSignalSource
::
GetBindAddress
()
const
{
return
m_pSourceStream
->
GetNetworkAddess
()
;
}
int
CVANetstreamSignalSource
::
GetRecvPort
()
const
{
// TODO: ...
return
0
;
int
CVANetstreamSignalSource
::
GetRecvPort
()
const
{
return
m_pSourceStream
->
GetNetworkPort
()
;
}
std
::
string
CVANetstreamSignalSource
::
GetTypeString
()
const
{
std
::
string
CVANetstreamSignalSource
::
GetTypeString
()
const
{
return
"Network stream"
;
}
std
::
string
CVANetstreamSignalSource
::
GetTypeMnemonic
()
const
{
std
::
string
CVANetstreamSignalSource
::
GetTypeMnemonic
()
const
{
return
"ns"
;
}
std
::
string
CVANetstreamSignalSource
::
GetDesc
()
const
{
std
::
string
CVANetstreamSignalSource
::
GetDesc
()
const
{
std
::
stringstream
ss
;
ss
<<
"Plays the network audio stream received on "
<<
GetBindAddress
()
<<
":"
<<
GetRecvPort
();
ss
<<
"Plays the network audio stream received on "
<<
GetBindAddress
()
<<
":"
<<
GetRecvPort
();
return
ss
.
str
();
}
std
::
string
CVANetstreamSignalSource
::
GetStateString
()
const
{
std
::
string
CVANetstreamSignalSource
::
GetStateString
()
const
{
return
"<TODO: State string>"
;
}
IVACore
*
CVANetstreamSignalSource
::
GetAssociatedCore
()
const
{
IVACore
*
CVANetstreamSignalSource
::
GetAssociatedCore
()
const
{
return
m_pAssociatedCore
;
}
ITADatasource
*
CVANetstreamSignalSource
::
GetStreamingDatasource
()
const
{
// TODO: ...
return
NULL
;
ITADatasource
*
CVANetstreamSignalSource
::
GetStreamingDatasource
()
const
{
return
m_pSourceStream
;
}
void
CVANetstreamSignalSource
::
HandleRegistration
(
IVACore
*
pParentCore
)
{
void
CVANetstreamSignalSource
::
HandleRegistration
(
IVACore
*
pParentCore
)
{
m_pAssociatedCore
=
pParentCore
;
}
void
CVANetstreamSignalSource
::
HandleUnregistration
(
IVACore
*
pParentCore
)
{
void
CVANetstreamSignalSource
::
HandleUnregistration
(
IVACore
*
pParentCore
)
{
m_pAssociatedCore
=
NULL
;
}
\ No newline at end of file
}
src/Audiosignals/VANetstreamSignalSource.h
View file @
c13a6a1f
...
...
@@ -4,19 +4,15 @@
#include
"VAAudioSignalSource.h"
#include
<string>
class
ITABufferDatasource
;
class
ITADatasource
;
/**
* 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).
class
IVACore
;
class
ITANetAudioStream
;
/** Network audio stream class
*
*
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:
/**
* \param dDestinationSamplerate Abtastrate die vorrausgesetzt wird
...
...
@@ -24,10 +20,7 @@ public:
* \param sBindAddress Netzwerk-Adresse an den gebunden wird
* \param iRecvPort Eingangsport auf dem gelauscht wird.
*/
CVANetstreamSignalSource
(
double
dDestinationSamplerate
,
int
iBlocklength
,
const
std
::
string
&
sBindAddress
,
int
iRecvPort
);
CVANetstreamSignalSource
(
double
dDestinationSamplerate
,
int
iBlocklength
,
const
std
::
string
&
sBindAddress
,
int
iRecvPort
);
virtual
~
CVANetstreamSignalSource
();
...
...
@@ -47,11 +40,11 @@ public:
ITADatasource
*
GetStreamingDatasource
()
const
;
private:
IVACore
*
m_pAssociatedCore
;
ITA
BufferDatasource
*
m_pFileDatasource
;
IVACore
*
m_pAssociatedCore
;
//!< TODO needed?
ITA
NetAudioStream
*
m_pSourceStream
;
void
HandleRegistration
(
IVACore
*
pParentCore
);
void
HandleUnregistration
(
IVACore
*
pParentCore
);
void
HandleRegistration
(
IVACore
*
pParentCore
);
void
HandleUnregistration
(
IVACore
*
pParentCore
);
};
#endif // __VA_NETSTREAMSIGNALSOURCE_H__
src/VACoreImpl.cpp
View file @
c13a6a1f
...
...
@@ -1147,14 +1147,15 @@ std::string CVACoreImpl::CreateSequencerSignalSource(const std::string& sName) {
}
VA_RETHROW
;
}
std
::
string
CVACoreImpl
::
CreateNetworkStreamSignalSource
(
const
std
::
string
&
sInterface
,
int
iPort
,
const
std
::
string
&
sName
)
{
std
::
string
CVACoreImpl
::
CreateNetworkStreamSignalSource
(
const
std
::
string
&
sInterface
,
int
iPort
,
const
std
::
string
&
sName
)
{
VA_NO_REENTRANCE
;
VA_CHECK_INITIALIZED
;
VA_TRY
{
std
::
string
sID
=
m_pSignalSourceMan
->
CreateNetstreamSignalSource
(
sInterface
,
iPort
,
sName
);
VA_TRY
{
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
()
);
// Ereignis generieren, wenn Operation erfolgreich
...
...
@@ -1164,10 +1165,11 @@ std::string CVACoreImpl::CreateNetworkStreamSignalSource(const std::string& sInt
ev
.
sObjectID
=
sID
;
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
;
}
VA_RETHROW
;
}
VA_RETHROW
;
}
std
::
string
CVACoreImpl
::
CreateEngineSignalSource
(
const
std
::
string
&
sName
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment