#include <crossfader.h>
Inheritance diagram for izsound::CrossFader:


It mixes 2 sound streams together. The crossfader lets you specify how much each stream must contribute to the output. This unit has two input slots and one output slot.
Some buffering is performed because IzSound does not work with fixed size data chuncks. Each slot data first gets inside its buffer. If an input slot does not have any incoming data, then the buffer will be filled with silence. This can happen in case of a buffer underrun or when a unit does not have more sound to produce.
Definition at line 60 of file crossfader.h.
Public Member Functions | |
| CrossFader (const double &pos=0.0, const unsigned int &sampleRate=44100) | |
| The constructor. | |
| virtual | ~CrossFader () |
| The destructor. | |
| double | getPosition () const |
| Gets the crossfader position. | |
| void | setPosition (const double &pos) |
| Sets the crossfader position. | |
| unsigned int | getSampleRate () const |
| Returns the audio chain sample rate. | |
| unsigned int | getMaxInSlots () const |
| Returns the maximum number of in-slots. | |
| unsigned int | getMaxOutSlots () const |
| Returns the maximum number of out-slots. | |
| void | connect (DspUnit *dspUnit, const unsigned int &mySlot, const unsigned int &itsSlot) |
| Connects the DSP unit with another one. | |
| void | disconnect (const unsigned int &mySlot) |
| Disconnects the DSP unit from another one. | |
| void | run () |
| Runs the DSP unit in the chain. | |
| void | bindInput (DspUnit *dsp, const unsigned int &mySlot, const unsigned int itsSlot) |
| Binds an input slot of the unit to another DspUnit input slot. | |
| void | bindOutput (SlotData *data, const unsigned int &slot) |
Binds an output slot of the unit to a SlotData instance. | |
| virtual void | reset () |
| Resets the DSP unit. | |
Protected Member Functions | |
| virtual void | performDsp () |
| Mixes the two streams together. | |
Protected Attributes | |
| unsigned int | m_sampleRate |
| The audio chain sample rate. | |
| unsigned int | m_maxInSlots |
| The maximum number of in-slots. | |
| unsigned int | m_maxOutSlots |
| The maximum number of out-slots. | |
| vector< SlotData * > | m_inSlots |
| The in-slots data. | |
| vector< SlotData * > | m_outSlots |
| The out-slots data. | |
| bit_vector | m_bindedSlots |
| The binded slots tracker. | |
| vector< DspUnit * > | m_outDspUnits |
| The output dsp units. | |
| unsigned int | m_receptionCounter |
| Data reception counter. | |
| unsigned int | m_receptionTrigger |
| Data reception trigger. | |
|
||||||||||||
|
The constructor.
Definition at line 56 of file crossfader.cpp. References setPosition(). |
|
||||||||||||||||
|
Binds an input slot of the unit to another DspUnit input slot. Use with extreme care, this can be dangerous and is only recommended when building a DSP chain inside a DSP unit. There is no checking performed.
Definition at line 122 of file dspunit.cpp. References izsound::DspUnit::m_bindedSlots, and izsound::DspUnit::m_inSlots. |
|
||||||||||||
|
Binds an output slot of the unit to a Use with extreme care, this can be dangerous and is only recommended when building a DSP chain inside a DSP unit. There is no checking performed.
Definition at line 130 of file dspunit.cpp. References izsound::DspUnit::m_outSlots. |
|
||||||||||||||||
|
Connects the DSP unit with another one. The DSP unit will precede the unit it is connected to. If the provided slots numbers are not in the valid ranges, then nothing is done.
Definition at line 77 of file dspunit.cpp. References izsound::DspUnit::disconnect(), izsound::DspUnit::m_inSlots, izsound::DspUnit::m_maxInSlots, izsound::DspUnit::m_maxOutSlots, izsound::DspUnit::m_outDspUnits, izsound::DspUnit::m_outSlots, and izsound::DspUnit::m_receptionTrigger. |
|
|
Disconnects the DSP unit from another one. The connected DSP unit slot data is cleared.
Definition at line 90 of file dspunit.cpp. References izsound::DspUnit::m_maxOutSlots, izsound::DspUnit::m_outDspUnits, and izsound::DspUnit::m_outSlots. Referenced by izsound::DspUnit::connect(). |
|
|
Returns the maximum number of in-slots.
Definition at line 150 of file dspunit.h. References izsound::DspUnit::m_maxInSlots. |
|
|
Returns the maximum number of out-slots.
Definition at line 157 of file dspunit.h. References izsound::DspUnit::m_maxOutSlots. |
|
|
Gets the crossfader position.
Definition at line 107 of file crossfader.h. |
|
|
Returns the audio chain sample rate.
Definition at line 143 of file dspunit.h. References izsound::DspUnit::m_sampleRate. |
|
|
Resets the DSP unit. By default, it will not do anything. However, some units can have some kind of state associated with them. For instance, it can have some internal buffer containing work-in-progress data. If the unit is disconnected and connected again latter, it will start working again with some older (and maybe inconsistant) data. That's why a reset makes sense. As a consequence, redefine this method if the DSP unit that you are developping could be affected by beeing used at discontinuous times because it maintains some kind of state. As a DSP units user, call this method on DSP units that redefine it whenever you take them out of a chain, but might put them back in later. Reimplemented in izsound::DataPicker, and izsound::Flanger. |
|
|
Runs the DSP unit in the chain.
It calls the Definition at line 101 of file dspunit.cpp. References izsound::DspUnit::m_outDspUnits, izsound::DspUnit::m_receptionCounter, izsound::DspUnit::m_receptionTrigger, and izsound::DspUnit::performDsp(). |
|
|
Sets the crossfader position. A value of -1.0 means 100% to the first stream while a value of 1.0 means 100% to the second one. The value 0.0 stands for the middle position (50% / 50%).
Definition at line 69 of file crossfader.cpp. Referenced by CrossFader(). |
1.3.5