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)
VANet
Commits
7b3da7e4
Commit
7b3da7e4
authored
Apr 07, 2017
by
Dipl.-Ing. Jonas Stienen
Browse files
Progress on net audio stream server side
parent
62491c92
Changes
3
Hide whitespace changes
Inline
Side-by-side
CMakeLists.txt
View file @
7b3da7e4
...
...
@@ -55,6 +55,7 @@ endif( )
vista_use_package
(
VistaCoreLibs REQUIRED COMPONENTS VistaBase VistaInterProcComm FIND_DEPENDENCIES
)
vista_use_package
(
VABase REQUIRED
)
vista_find_package
(
ITADataSources QUIET FIND_DEPENDENCIES
)
# Including the source files of all source subfolders recursively
include
(
"include/_SourceFiles.cmake"
)
...
...
include/VANetAudioStreamSender.h
deleted
100644 → 0
View file @
62491c92
/*
* --------------------------------------------------------------------------------------------
*
* VVV VVV A
* VVV VVV AAA Virtual Acoustics (VA)
* VVV VVV AAA Real-time auralisation for virtual reality
* VVV VVV AAA
* VVVVVV AAA (c) Copyright Institute of Technical Acoustics (ITA), 2015-2017
* VVVV AAA RWTH Aachen University (http://www.akustik.rwth-aachen.de)
*
* --------------------------------------------------------------------------------------------
*/
#ifndef IW_VANET_AUDIO_STREAM_SERVER
#define IW_VANET_AUDIO_STREAM_SERVER
#include <VANetDefinitions.h>
#include <string>
class
CVAAudiostreamProperties
;
class
CVAAudiostreamState
;
//! Server-side implementation of a network audio stream
/**
* Sender-side implementation of a network audio stream,
* which transfers samples over TCP network to a audio stream receiver
* Sender and receiver are in an 1:1 relation.
*/
class
VANET_API
CVANetAudioStreamServer
{
public:
//! Return types / errors
enum
ErrorType
{
VA_NASS_NO_ERROR
=
0
,
//!< No error / success
VA_NASS_SERVER_CONNECTION_FAILED
,
//!< Verbindung zum Server fehlgeschlagen - Falsche Addresse, oder Server luft nicht
VA_NASS_SERVER_NOT_RESPONDING
,
//!< Verbindung zum Server wurde aufgebaut, aber keine Antwort erhalten
VA_NASS_SERVICE_IN_USE
,
//!< Netzwerkdienst wird bereits von anderem Client benutzt
VA_NASS_CONNECTION_ERROR
,
//!< Ein unbekannter netzwerkfehler ist aufgetreten
VA_NASS_PROTOCOL_INCOMPATIBLE
,
//!< Das Netzwerkprotokoll von Client und Server ist inkompatibel
VA_NASS_UNKNOWN_ERROR
,
};
CVANetAudioStreamServer
();
virtual
~
CVANetAudioStreamServer
();
// Gibt die Adresse des verbundenen Servers zurck
// (Rckgabe: leerer String, falls nicht verbunden)
virtual
std
::
string
GetServerAddress
()
const
=
0
;
// Client initialisieren und mit einem Server verbinden
// (Rckgabe: Statuscode)
virtual
int
Initialize
(
const
std
::
string
&
sBindAddress
,
int
iPort
)
=
0
;
void
Finalize
();
class
VANET_API
IHandler
{
public:
inline
virtual
~
IHandler
()
{};
// Handle that the connection to a receiver is established
// Thereby the sender it told the expected stream properties (sampling rate, buffersize)
// and designated signal source name on the receiver-side (VA).
// Returns: Status code (0=Connection accepted, 1=Connection refused)
virtual
int
HandleReceiverConnect
(
const
CVAAudiostreamProperties
&
oStreamProps
,
const
std
::
string
&
sSignalSourceName
)
=
0
;
// Informs that the connection to the receiver is closed
virtual
void
HandleReceiverDisconnect
()
=
0
;
// Receiver-side requests new samples from the sender
// Thereby the sender is informed about the current status of the audiostream
virtual
void
HandleReceiverRequestSamples
(
const
CVAAudiostreamState
&
oStreamState
)
=
0
;
};
// Sets the handler for sender events
void
SetEventHandler
(
IHandler
*
pHandler
);
// Pushes a block of samples into the sender buffer and transfers them to the client
// Return: Status information (still connected, etc.)
int
SendSamples
(
const
float
*
pfSamples
,
int
iNumSamples
);
};
#endif // IW_VANET_AUDIO_STREAM_SERVER
include/VANetAudioStream
Recei
ver.h
→
include/VANetAudioStream
Ser
ver.h
View file @
7b3da7e4
...
...
@@ -11,44 +11,42 @@
* --------------------------------------------------------------------------------------------
*/
#ifndef
_
_VANET_AUDIOSTREAM_
RECEIVER_H__
#define
_
_VANET_AUDIOSTREAM_
RECEIVER_H__
#ifndef
IW
_VANET_AUDIO
_
STREAM_
SERVER
#define
IW
_VANET_AUDIO
_
STREAM_
SERVER
#include <VANetDefinitions.h>
#include <string>
class
CVAAudiostreamProperties
;
class
CVAAudiostreamState
;
#include <VASamples.h>
//! Receiver-side implementation of a network audio stream
class
CVANetAudioStreamServerImpl
;
//! Stream server framework for providing samples for a network stream
/**
* Sender-side implementation of a network audio stream,
* which transfers samples over TCP network to a audiostream receiver
* Sender and receiver are in an 1:1 relation.
* This class helps to set up a network audio streaming server
* to be connected with a VA network stream. Process() method
* needs to be implemented by user and is called by the network
* server implementation occasionally if more samples are requested.
* Timing can be observed with the stream status, i.e. a time stamp and
* sample count. The timing is most probably not as acurate as an
* audio stream that is driven by a sound card, because network
* transmission deviates stream process call timings.
*
*/
class
VANET_API
CVANetAudioStream
Recei
ver
public
VANET_API
CVANetAudioStream
Ser
ver
{
public:
//! Return types / errors
enum
ErrorType
{
VA_NO_ERROR
=
0
,
//!< No error
VA_CONNECTION_LOST
,
//!< Connection to sender unexpectedly lost
VA_BUFFER_UNDERRUN
//!< Not enough samples in the receive buffer
};
//! Creates an audio stream
CVANetAudioStreamReceiver
(
const
std
::
string
sSenderAddress
,
int
iSenderPort
,
const
std
::
string
&
sTargetName
,
const
CVAAudiostreamProperties
&
oStreamProps
,
int
iFlags
);
virtual
~
CVANetAudioStreamReceiver
();
//! Returns sender address / IP
/**
* @return Empty, if not connected
*/
virtual
std
::
string
GetSenderAddress
()
const
=
0
;
//! Receives a block of samples from the sender buffer
int
ReceiveSamples
(
const
float
*
pfSamples
,
int
iNumSamples
);
};
#endif // __VANET_AUDIOSTREAM_RECEIVER_H__
//! Create a network audio stream
CVANetAudioStreamServer
();
virtual
~
CVANetAudioStreamServer
();
//! Initialize server and start listening on network port
bool
Initialize
(
const
std
::
string
&
sBindAddress
,
const
int
iBindPort
);
//! Provide a frame of samples on request (overload this method)
virtual
void
Process
(
CVASamples
&
oFrame
,
CVAStreamInfo
)
=
0
;
private:
CVANetAudioStreamServerImpl
*
m_pImpl
;
}
#endif // IW_VANET_AUDIO_STREAM_SERVER
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