\section{Stream\_\-mixer Class Reference}
\label{classStream__mixer}\index{Stream_mixer@{Stream\_\-mixer}}
{\tt \#include $<$jmixer.h$>$}

Collaboration diagram for Stream\_\-mixer:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=310pt]{classStream__mixer__coll__graph}
\end{center}
\end{figure}


\subsection{Detailed Description}
the Multiple Streaming Engine class

Everything is connected to Stream\_\-mixer: the instance of this class controls all existent input and output channels attached to it, plus it holds the file descriptors for the soundcard and all the necessary private buffers of Mu\-SE.

The Stream\_\-mixer runs thru the {\bf cafudda()} function which should be always called from the main (parent) thread of your program.

Child threads are spawned by some of the public functions offered by this class, anyway you don't have to take care of those issues. 



Definition at line 57 of file jmixer.h.\subsection*{Public Member Functions}
\begin{CompactItemize}
\item 
{\bf Stream\_\-mixer} ()\label{classStream__mixer_a0}

\begin{CompactList}\small\item\em the Stream\_\-mixer class constructor\item\end{CompactList}\item 
{\bf $\sim$Stream\_\-mixer} ()\label{classStream__mixer_a1}

\begin{CompactList}\small\item\em the Stream\_\-mixer class destructor\item\end{CompactList}\item 
bool {\bf create\_\-channel} (int ch)
\begin{CompactList}\small\item\em create channel ch\item\end{CompactList}\item 
bool {\bf delete\_\-channel} (int ch)\label{classStream__mixer_a1}

\begin{CompactList}\small\item\em deletes the channel ch\item\end{CompactList}\item 
bool {\bf add\_\-to\_\-playlist} (int ch, const char $\ast$file)
\begin{CompactList}\small\item\em inserts a new entry at the bottom of a channel playlist\item\end{CompactList}\item 
void {\bf rem\_\-from\_\-playlist} (int ch, int pos)\label{classStream__mixer_a3}

\begin{CompactList}\small\item\em removes the entry at a certain position from a channel playlist\item\end{CompactList}\item 
bool {\bf set\_\-channel} (int ch, int playlist\_\-pos)\label{classStream__mixer_a4}

\begin{CompactList}\small\item\em selects the entry at a certain position of a channel playlist\item\end{CompactList}\item 
int {\bf play\_\-channel} (int ch)\label{classStream__mixer_a5}

\begin{CompactList}\small\item\em set the channel playing\item\end{CompactList}\item 
bool {\bf stop\_\-channel} (int ch)\label{classStream__mixer_a6}

\begin{CompactList}\small\item\em stop the channel\item\end{CompactList}\item 
bool {\bf pause\_\-channel} (int ch)\label{classStream__mixer_a7}

\begin{CompactList}\small\item\em switch channel pause state between true and false\item\end{CompactList}\item 
bool {\bf pause\_\-channel} (int ch, bool stat)\label{classStream__mixer_a8}

\begin{CompactList}\small\item\em set the channel pause state\item\end{CompactList}\item 
bool {\bf set\_\-volume} (int ch, float vol)\label{classStream__mixer_a9}

\begin{CompactList}\small\item\em set a channel volume\item\end{CompactList}\item 
void {\bf set\_\-all\_\-volumes} (float $\ast$vol)\label{classStream__mixer_a10}

\begin{CompactList}\small\item\em set all channel volumes at once\item\end{CompactList}\item 
void {\bf crossfade} (int ch1, float vol1, int ch2, float vol2)\label{classStream__mixer_a11}

\begin{CompactList}\small\item\em set the volumes of two channels at once\item\end{CompactList}\item 
bool {\bf set\_\-playmode} (int ch, int mode)\label{classStream__mixer_a12}

\begin{CompactList}\small\item\em set the playmode of a channel (LOOP,CONT,PLAY)\item\end{CompactList}\item 
void {\bf set\_\-speed} (int ch, int speed)\label{classStream__mixer_a13}

\begin{CompactList}\small\item\em this is VERY EXPERIMENTAL, but we might get there soon\item\end{CompactList}\item 
bool {\bf set\_\-position} (int ch, float pos)\label{classStream__mixer_a14}

\begin{CompactList}\small\item\em set the channel position (from 0.0 to 1.0)\item\end{CompactList}\item 
bool {\bf move\_\-song} (int ch, int pos, int nch, int npos)\label{classStream__mixer_a15}

\begin{CompactList}\small\item\em move a playlist entry of a channel from a position to the other\item\end{CompactList}\item 
bool {\bf set\_\-live} (bool stat)\label{classStream__mixer_a16}

\begin{CompactList}\small\item\em set the state of the live input from soundcard\item\end{CompactList}\item 
bool {\bf set\_\-lineout} (bool stat)\label{classStream__mixer_a17}

\begin{CompactList}\small\item\em set the state of the live output to soundcard\item\end{CompactList}\item 
int {\bf create\_\-enc} (enum {\bf codec} enc)
\begin{CompactList}\small\item\em Create a new {\bf Out\-Channel} encoder channel.\item\end{CompactList}\item 
void {\bf delete\_\-enc} (int id)
\begin{CompactList}\small\item\em Delete an {\bf Out\-Channel} encoder (discards ID).\item\end{CompactList}\item 
{\bf Out\-Channel} $\ast$ {\bf get\_\-enc} (int id)
\begin{CompactList}\small\item\em Returns the {\bf Out\-Channel} instance with the given ID.\item\end{CompactList}\item 
bool {\bf apply\_\-enc} (int id)
\begin{CompactList}\small\item\em apply the current {\bf Out\-Channel} configuration\item\end{CompactList}\item 
void {\bf register\_\-gui} (GUI $\ast$reg\_\-gui)
\begin{CompactList}\small\item\em tell the mixer there is an GUI\item\end{CompactList}\item 
bool {\bf open\_\-soundcard} (bool in, bool out)\label{classStream__mixer_a25}

\item 
void {\bf close\_\-soundcard} ()\label{classStream__mixer_a26}

\item 
void {\bf cafudda} ()
\begin{CompactList}\small\item\em THIS IS THE MAIN MIXING PROCEDURE: CAFUDDA!\item\end{CompactList}\item 
bool {\bf dsp\_\-ok} ()
\begin{CompactList}\small\item\em notice if we have a soundcard\item\end{CompactList}\item 
void {\bf cli\_\-vumeter\_\-set} (int val)\label{classStream__mixer_a29}

\begin{CompactList}\small\item\em so this is as well experimental\item\end{CompactList}\end{CompactItemize}
\subsection*{Public Attributes}
\begin{CompactItemize}
\item 
Channel $\ast$ {\bf chan} [MAX\_\-CHANNELS]
\item 
Live\-In {\bf livein}
\item 
Linklist {\bf outchans}
\item 
{\bf Out\-Channel} $\ast$ {\bf lame}\label{classStream__mixer_m3}

\item 
{\bf Out\-Channel} $\ast$ {\bf ogg}\label{classStream__mixer_m4}

\item 
bool {\bf cli\_\-vumeter}\label{classStream__mixer_m5}

\begin{CompactList}\small\item\em commandline vumeter is experimental\item\end{CompactList}\item 
bool {\bf dspout}\label{classStream__mixer_m6}

\begin{CompactList}\small\item\em is there output to the soundcard speakers?\item\end{CompactList}\item 
bool {\bf linein}\label{classStream__mixer_m7}

\begin{CompactList}\small\item\em is there some input from the microphone?\item\end{CompactList}\item 
bool {\bf fileout}\label{classStream__mixer_m8}

\begin{CompactList}\small\item\em is there a file dumping? (redundant!)\item\end{CompactList}\item 
bool {\bf quit}\label{classStream__mixer_m9}

\begin{CompactList}\small\item\em should we keep on running?\item\end{CompactList}\end{CompactItemize}


\subsection{Member Function Documentation}
\index{cafudda@{cafudda}!Stream_mixer@{Stream\_\-mixer}}\index{Stream_mixer@{Stream\_\-mixer}!cafudda@{cafudda}}\index{Stream_mixer@{Stream\_\-mixer}!cafudda@{cafudda}}
\index{cafudda@{cafudda}!Stream_mixer@{Stream\_\-mixer}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void Stream\_\-mixer::cafudda ()}\label{classStream__mixer_a27}


THIS IS THE MAIN MIXING PROCEDURE: CAFUDDA!

Cafudda should be repeatedly called by the main process. It doesn't fills up the CPU load so there is no need to wait or do any time syncronizing, it is just all done inside.

Call it repeatedly after launching all the GUI threads and setting up the engine to act as you like, then while running on the main process the mixer can still be used by interface threads.

see main.cpp for an example of its use. 

Definition at line 216 of file jmixer.cpp.\index{dsp_ok@{dsp\_\-ok}!Stream_mixer@{Stream\_\-mixer}}\index{Stream_mixer@{Stream\_\-mixer}!dsp_ok@{dsp\_\-ok}}\index{Stream_mixer@{Stream\_\-mixer}!dsp_ok@{dsp\_\-ok}}
\index{dsp_ok@{dsp\_\-ok}!Stream_mixer@{Stream\_\-mixer}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool Stream\_\-mixer::dsp\_\-ok ()\hspace{0.3cm}{\tt  [inline]}}\label{classStream__mixer_a28}


notice if we have a soundcard

\begin{Desc}
\item[Returns:]true if one was found \end{Desc}


Definition at line 276 of file jmixer.h.\index{register_gui@{register\_\-gui}!Stream_mixer@{Stream\_\-mixer}}\index{Stream_mixer@{Stream\_\-mixer}!register_gui@{register\_\-gui}}\index{Stream_mixer@{Stream\_\-mixer}!register_gui@{register\_\-gui}}
\index{register_gui@{register\_\-gui}!Stream_mixer@{Stream\_\-mixer}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void Stream\_\-mixer::register\_\-gui (GUI $\ast$ {\em reg\_\-gui})}\label{classStream__mixer_a24}


tell the mixer there is an GUI

Used to register a GUI instance to a Stream\_\-mixer

An example of using it is inside {\bf muse.cpp} {\bf main()}

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em reg\_\-gui}]GUI instance to register (see {\bf gui.h}) \end{description}
\end{Desc}


Definition at line 135 of file jmixer.cpp.

\subsection{Member Data Documentation}
\index{chan@{chan}!Stream_mixer@{Stream\_\-mixer}}\index{Stream_mixer@{Stream\_\-mixer}!chan@{chan}}\index{Stream_mixer@{Stream\_\-mixer}!chan@{chan}}
\index{chan@{chan}!Stream_mixer@{Stream\_\-mixer}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}Channel$\ast$ Stream\_\-mixer::chan[MAX\_\-CHANNELS]}\label{classStream__mixer_m0}


Array of Channels 

Definition at line 280 of file jmixer.h.\index{livein@{livein}!Stream_mixer@{Stream\_\-mixer}}\index{Stream_mixer@{Stream\_\-mixer}!livein@{livein}}\index{Stream_mixer@{Stream\_\-mixer}!livein@{livein}}
\index{livein@{livein}!Stream_mixer@{Stream\_\-mixer}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}Live\-In Stream\_\-mixer::livein}\label{classStream__mixer_m1}


live soundcard input 

Definition at line 283 of file jmixer.h.\index{outchans@{outchans}!Stream_mixer@{Stream\_\-mixer}}\index{Stream_mixer@{Stream\_\-mixer}!outchans@{outchans}}\index{Stream_mixer@{Stream\_\-mixer}!outchans@{outchans}}
\index{outchans@{outchans}!Stream_mixer@{Stream\_\-mixer}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}Linklist Stream\_\-mixer::outchans}\label{classStream__mixer_m2}


encoder outchannels 

Definition at line 286 of file jmixer.h.

The documentation for this class was generated from the following files:\begin{CompactItemize}
\item 
{\bf jmixer.h}\item 
jmixer.cpp\end{CompactItemize}
