My Project
Public Member Functions | Static Public Member Functions | List of all members
AudioServer Class Reference

#include <server.hpp>

Public Member Functions

 AudioServer (Db *db)
 
Song getCurrentSong (void)
 
bool isPlaying (void)
 
void playSong (Song s)
 
void upvoteCurrentSong (void)
 
void downvoteCurrentSong (void)
 
void playNext (void)
 
void addSong (Song s)
 
void addSong (std::string user, std::string url)
 
void run (void)
 
void run (std::string fname)
 

Static Public Member Functions

static void playVideo (std::string url)
 

Detailed Description

Class used play songs from a sorted queue and take commmands over FIFO

Constructor & Destructor Documentation

◆ AudioServer()

AudioServer::AudioServer ( Db db)

Creates an audioserver with a database used to get/modify data for songs

Parameters
dbreference to a Db object for modifying/querying tastes

James Cassell (jcc384) jcc38.nosp@m.4@co.nosp@m.rnell.nosp@m..edu Creation date: 06/11/17 Description: This class is meant to be the application class for the web application.

Member Function Documentation

◆ addSong() [1/2]

void AudioServer::addSong ( Song  s)
inline

Adds a Song to the queue of songs to play

Parameters
sThe Song to add

◆ addSong() [2/2]

void AudioServer::addSong ( std::string  user,
std::string  url 
)

Creates and adds a Song to the queue

Parameters
userThe person who submitted the song
urlThe URL of the song

◆ downvoteCurrentSong()

void AudioServer::downvoteCurrentSong ( void  )

Decrements the taste value of the user who submitted the current song in the database

◆ getCurrentSong()

Song AudioServer::getCurrentSong ( void  )
inline

Returns a copy of the Song object currently playing

◆ isPlaying()

bool AudioServer::isPlaying ( void  )

Checks if there is an instance of VLC playing a song

Returns
true if there is a song playing, false otherwise

◆ playNext()

void AudioServer::playNext ( void  )

Plays the audio of the next Song in the queue

◆ playSong()

void AudioServer::playSong ( Song  s)

Plays the URL contained in the given Song

Parameters
sSong to play audio from

◆ playVideo()

void AudioServer::playVideo ( std::string  url)
static
Parameters
urlthe URL to stream audio from

◆ run() [1/2]

void AudioServer::run ( void  )

This starts the server up and does not return until there is nothing in the song queue. It asssumes that a number of songs has already been added to the queue.

◆ run() [2/2]

void AudioServer::run ( std::string  fname)

This starts the server which then runs until told to stop. Commands for adding songs, voting, and quiting are sent via the fifo, which its name is passed as an argument to this function.

Parameters
fnamethe name of the FIFO to read commands from

◆ upvoteCurrentSong()

void AudioServer::upvoteCurrentSong ( void  )

Increments the taste value of the user who submitted the current song in the database


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