arduino-audio-tools
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
AudioWAVServer Class Reference

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

#include <AudioServer.h>

Inheritance diagram for AudioWAVServer:
AudioEncoderServer AudioServerT< Client, Server >

Public Member Functions

 AudioWAVServer (const char *network, const char *password, int port=80)
 Construct a new Audio WAV Server object. More...
 
 AudioWAVServer (int port=80)
 Construct a new Audio WAV Server object We assume that the WiFi is already connected.
 
 ~AudioWAVServer ()
 Destructor: release the allocated encoder.
 
AudioEncoderaudioEncoder ()
 
bool begin (AudioServerDataCallback cb, const char *contentType)
 Start the server. The data must be provided by a callback method. More...
 
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. More...
 
bool begin (AudioStream &in, BaseConverter *converter=nullptr)
 Start the server. You need to be connected to WiFI before calling this method. More...
 
bool begin (Stream &in, AudioInfo info, BaseConverter *converter=nullptr)
 Start the server. You need to be connected to WiFI before calling this method. More...
 
bool begin (Stream &in, const char *contentType)
 Start the server. You need to be connected to WiFI before calling this method. More...
 
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. More...
 
bool copy ()
 Add this method to your loop Returns true while the client is connected. (The same functionality like doLoop()) More...
 
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.
 
WAVEncoderwavEncoder ()
 

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 char * content_type = nullptr
 
BaseConverterconverter_ptr = nullptr
 
StreamCopy copier
 
EncodedAudioOutput encoded_stream
 
AudioEncoderencoder = nullptr
 
Streamin = nullptr
 
char * network = nullptr
 
char * password = nullptr
 
Server server
 

Detailed Description

A simple Arduino Webserver which streams the audio as WAV data. This class is based on the AudioEncodedServer 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

◆ AudioWAVServer()

AudioWAVServer ( const char *  network,
const char *  password,
int  port = 80 
)
inline

Construct a new Audio WAV Server object.

Parameters
network
password

Member Function Documentation

◆ begin() [1/6]

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]

bool begin ( AudioServerDataCallback  cb,
int  sample_rate,
int  channels,
int  bits_per_sample = 16 
)
inlineinherited

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

Parameters
cb
sample_rate
channels

◆ begin() [3/6]

bool begin ( AudioStream in,
BaseConverter converter = nullptr 
)
inlineinherited

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

Parameters
in
converter

◆ begin() [4/6]

bool begin ( Stream in,
AudioInfo  info,
BaseConverter converter = nullptr 
)
inlineinherited

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

Parameters
in
info
converter

◆ begin() [5/6]

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]

bool begin ( Stream in,
int  sample_rate,
int  channels,
int  bits_per_sample = 16,
BaseConverter converter = nullptr 
)
inlineinherited

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

Parameters
in
sample_rate
channels

◆ copy()

bool copy ( )
inlineinherited

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

Returns
true
false

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