arduino-audio-tools
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
AudioEncoderServerT< Client, Server > Class Template Reference

A simple Arduino Webserver which streams the audio using the indicated encoder.. This class is based on the WiFiServer class. All you need to do is to provide the data with a callback method or from a Stream. More...

#include <AudioEncodedServerT.h>

Inheritance diagram for AudioEncoderServerT< Client, Server >:
AudioServerT< Client, Server > AudioWAVServerT< Client, Server >

Public Member Functions

 AudioEncoderServerT (AudioEncoder *encoder, const char *network, const char *password, int port=80)
 Construct a new Audio Server object.
 
 AudioEncoderServerT (AudioEncoder *encoder, int port=80)
 Construct a new Audio Server object that supports an AudioEncoder We assume that the WiFi is already connected.
 
virtual ~AudioEncoderServerT ()=default
 Destructor release the memory.
 
AudioEncoderaudioEncoder ()
 
bool begin (AudioServerDataCallback cb, const char *contentType)
 Start the server. The data must be provided by a callback method.
 
bool begin (AudioServerDataCallback cb, int sample_rate, int channels, int bits_per_sample=16)
 Start the server. The data must be provided by a callback method.
 
bool begin (AudioStream &in, BaseConverter *converter=nullptr)
 Start the server. You need to be connected to WiFI before calling this method.
 
bool begin (Stream &in, AudioInfo info, BaseConverter *converter=nullptr)
 Start the server. You need to be connected to WiFI before calling this method.
 
bool begin (Stream &in, const char *contentType)
 Start the server. You need to be connected to WiFI before calling this method.
 
bool begin (Stream &in, int sample_rate, int channels, int bits_per_sample=16, BaseConverter *converter=nullptr)
 Start the server. You need to be connected to WiFI before calling this method.
 
bool copy ()
 Add this method to your loop Returns true while the client is connected. (The same functionality like doLoop())
 
bool doLoop ()
 Add this method to your loop Returns true while the client is connected.
 
bool isClientConnected ()
 Checks if any clinent has connnected.
 
Streamout ()
 Provides the output stream.
 
Clientout_ptr ()
 Provides a pointer to the WiFiClient.
 
void setConverter (BaseConverter *c)
 defines a converter that will be used when the audio is rendered
 
void setCopyBufferSize (int size)
 Changes the copy buffer size.
 

Protected Member Functions

void connectWiFi ()
 
void processClient ()
 
void sendReplyContent () override
 
void sendReplyHeader () override
 
void setupServer (int port)
 

Protected Attributes

AudioInfo audio_info
 
AudioServerDataCallback callback = nullptr
 
Client client_obj
 
const charcontent_type = nullptr
 
BaseConverterconverter_ptr = nullptr
 
StreamCopy copier
 
EncodedAudioOutput encoded_stream
 
AudioEncoderencoder = nullptr
 
Streamin = nullptr
 
size_t max_bytes = 0
 
charnetwork = nullptr
 
charpassword = nullptr
 
size_t sent = 0
 
Server server
 

Detailed Description

template<class Client, class Server>
class audio_tools::AudioEncoderServerT< Client, Server >

A simple Arduino Webserver which streams the audio using the indicated encoder.. This class is based on the WiFiServer class. All you need to do is to provide the data with a callback method or from a Stream.

Author
Phil Schatzmann

Constructor & Destructor Documentation

◆ AudioEncoderServerT() [1/2]

template<class Client , class Server >
AudioEncoderServerT ( AudioEncoder encoder,
int  port = 80 
)
inline

Construct a new Audio Server object that supports an AudioEncoder We assume that the WiFi is already connected.

◆ AudioEncoderServerT() [2/2]

template<class Client , class Server >
AudioEncoderServerT ( AudioEncoder encoder,
const char network,
const char password,
int  port = 80 
)
inline

Construct a new Audio Server object.

Parameters
network
password

◆ ~AudioEncoderServerT()

template<class Client , class Server >
virtual ~AudioEncoderServerT ( )
virtualdefault

Destructor release the memory.

Member Function Documentation

◆ audioEncoder()

template<class Client , class Server >
AudioEncoder * audioEncoder ( )
inline

◆ begin() [1/6]

template<class Client , class Server >
bool begin ( AudioServerDataCallback  cb,
const char contentType 
)
inlineinherited

Start the server. The data must be provided by a callback method.

Parameters
cb
contentTypeMime Type of result

◆ begin() [2/6]

template<class Client , class Server >
bool begin ( AudioServerDataCallback  cb,
int  sample_rate,
int  channels,
int  bits_per_sample = 16 
)
inline

Start the server. The data must be provided by a callback method.

Parameters
cb
sample_rate
channels

◆ begin() [3/6]

template<class Client , class Server >
bool begin ( AudioStream in,
BaseConverter converter = nullptr 
)
inline

Start the server. You need to be connected to WiFI before calling this method.

Parameters
in
converter

◆ begin() [4/6]

template<class Client , class Server >
bool begin ( Stream in,
AudioInfo  info,
BaseConverter converter = nullptr 
)
inline

Start the server. You need to be connected to WiFI before calling this method.

Parameters
in
info
converter

◆ begin() [5/6]

template<class Client , class Server >
bool begin ( Stream in,
const char contentType 
)
inlineinherited

Start the server. You need to be connected to WiFI before calling this method.

Parameters
in
contentTypeMime Type of result

◆ begin() [6/6]

template<class Client , class Server >
bool begin ( Stream in,
int  sample_rate,
int  channels,
int  bits_per_sample = 16,
BaseConverter converter = nullptr 
)
inline

Start the server. You need to be connected to WiFI before calling this method.

Parameters
in
sample_rate
channels

◆ connectWiFi()

template<class Client , class Server >
void connectWiFi ( )
inlineprotectedinherited

◆ copy()

template<class Client , class Server >
bool copy ( )
inlineinherited

Add this method to your loop Returns true while the client is connected. (The same functionality like doLoop())

Returns
true
false

◆ doLoop()

template<class Client , class Server >
bool doLoop ( )
inlineinherited

Add this method to your loop Returns true while the client is connected.

◆ isClientConnected()

template<class Client , class Server >
bool isClientConnected ( )
inlineinherited

Checks if any clinent has connnected.

◆ out()

template<class Client , class Server >
Stream & out ( )
inlineinherited

Provides the output stream.

◆ out_ptr()

template<class Client , class Server >
Client * out_ptr ( )
inlineinherited

Provides a pointer to the WiFiClient.

◆ processClient()

template<class Client , class Server >
void processClient ( )
inlineprotectedinherited

◆ sendReplyContent()

template<class Client , class Server >
void sendReplyContent ( )
inlineoverrideprotectedvirtual

Reimplemented from AudioServerT< Client, Server >.

◆ sendReplyHeader()

template<class Client , class Server >
void sendReplyHeader ( )
inlineoverrideprotectedvirtual

Reimplemented from AudioServerT< Client, Server >.

◆ setConverter()

template<class Client , class Server >
void setConverter ( BaseConverter c)
inlineinherited

defines a converter that will be used when the audio is rendered

◆ setCopyBufferSize()

template<class Client , class Server >
void setCopyBufferSize ( int  size)
inlineinherited

Changes the copy buffer size.

◆ setupServer()

template<class Client , class Server >
void setupServer ( int  port)
inlineprotectedinherited

Member Data Documentation

◆ audio_info

template<class Client , class Server >
AudioInfo audio_info
protected

◆ callback

template<class Client , class Server >
AudioServerDataCallback callback = nullptr
protectedinherited

◆ client_obj

template<class Client , class Server >
Client client_obj
protectedinherited

◆ content_type

template<class Client , class Server >
const char* content_type = nullptr
protectedinherited

◆ converter_ptr

template<class Client , class Server >
BaseConverter* converter_ptr = nullptr
protectedinherited

◆ copier

template<class Client , class Server >
StreamCopy copier
protectedinherited

◆ encoded_stream

template<class Client , class Server >
EncodedAudioOutput encoded_stream
protected

◆ encoder

template<class Client , class Server >
AudioEncoder* encoder = nullptr
protected

◆ in

template<class Client , class Server >
Stream* in = nullptr
protectedinherited

◆ max_bytes

template<class Client , class Server >
size_t max_bytes = 0
protectedinherited

◆ network

template<class Client , class Server >
char* network = nullptr
protectedinherited

◆ password

template<class Client , class Server >
char* password = nullptr
protectedinherited

◆ sent

template<class Client , class Server >
size_t sent = 0
protectedinherited

◆ server

template<class Client , class Server >
Server server
protectedinherited

The documentation for this class was generated from the following file: