VAAudioSignalSource.h 5.02 KB
Newer Older
Jonas Stienen's avatar
Jonas Stienen committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164
/*
 *
 *    VVV        VVV A
 *     VVV      VVV AAA        Virtual Acoustics
 *      VVV    VVV   AAA       Real-time auralisation for virtual reality    
 *       VVV  VVV     AAA
 *        VVVVVV       AAA     (c) Copyright Institute of Technical Acoustics (ITA)
 *         VVVV         AAA        RWTH Aachen University (http://www.akustik.rwth-aachen.de)
 *
 *  ---------------------------------------------------------------------------------
 *
 *    File:				VAAudioSignalSource.h   
 *
 *    Purspose:			Definitions for audio signal sources
 *
 *    Author(s):		Frank Wefers (Frank.Wefers@akustik.rwth-aachen.de)
 *
 *  ---------------------------------------------------------------------------------
 */

// $Id: VAAudioSignalSource.h 4260 2015-11-03 09:04:42Z stienen $


#ifndef __VABASE_AUDIOSIGNALSOURCE_H__
#define __VABASE_AUDIOSIGNALSOURCE_H__

#include <VABaseDefinitions.h>
#include <VAStruct.h>

#include <string>

// Forward declarations
class IVACore;
class ITAStreamInfo;

//! Interface class for audio signal sources
/**
  * This purely abstract class defines an interface for
  * data source objects that provide audio-streams. It
  * is intended to acoustically represent sound emitting 
  * objects in a virtual scene.
  *
  * A data source is always monaural (single channel)
  * and can only be connected to a single instance of a
  * #IVACore during runtime.
  */
class IVAAudioSignalSource
{
public:
	//! Type literals
	/**
	  * The type literals describe the type of the audio signal source.
	  */
	enum
	{
		VA_SS_AUDIOFILE=0,	//!< Sound source is an audio file (from secondary storage)
		VA_SS_SEQUENCER,	//!< Sound source is a music sequencer (MIDI, DAWs, ...)
		VA_SS_DEVICE_INPUT, //!< Sound source is fed through audio device input channel(s)
		VA_SS_NETSTREAM,	//!< Sound source is a network stream receiver socket
		VA_SS_ENGINE,		//!< Sound source is an engine
		VA_SS_MACHINE,		//!< Sound source is a machine
	} SoundSourceTypes;

	//! Destructor.
	virtual ~IVAAudioSignalSource() {};

	//! Type ID getter
	/**
	  * \return Returns the ID (one out of #SoundSourceTypes)
	  */
	virtual int GetType() const=0;
	
	//! Type getter (human readable string)
	/**
	  * \return Returns the type (one out of #SoundSourceTypes as a human readable string)
	  */
	virtual std::string GetTypeString() const=0;

	//! Description getter
	/**
	  * The description formulates a human readable string that describes the
	  * sound source, i.e. 'Network stream on port 2344'
	  *
	  * \return Returns a human readable sound source description
	  */
	virtual std::string GetDesc() const=0;

	//! State getter
	/**
	  * The sound state is for example the percentage of progess
	  * in an audio file sound source, i.e. 'Playback (10%)'
	  *
	  * \return Returns a human readable status of the sound source
	  */
	virtual std::string GetStateString() const=0;

	//! Associated core getter
	/**
	  * Returns the pointer to the associated core (#IVACore) that is
	  * registered with the sound source. Will return NULL if the source
	  * has not been associated to a core yet.
	  * This method is used by the core to assuure that the sound source
	  * object has not been associated to another core (not allowed).
	  *
	  * \return Pointer to the associated #IVACore, NULL if non present
	  */
	virtual IVACore* GetAssociatedCore() const=0;

	//! Gibt die ID zurück (z.B. "adi1")
	//virtual std::string GetID() const=0;
	
	//! Gibt zurück ob der Audio-Datenstrom pausiert werden kann
	//virtual bool IsStartStoppable() const=0;

	//! Gibt zurück ob der Audio-Datenstrom zurückgespult werden werden kann
	//virtual bool IsPausable() const=0;

	//! Stream block getter
	/** 
      * Returns the data pointer to the next audio block of the sound source.
	  *
	  * \param oStreamState Information on stream state
	  *
	  * \return Pointer to the audio data array containing data for next block (NULL if no data available)
	  *
	  * \note This method is called by the core to fetch data. If the core 
	  *       receives a NULL pointer it will be interpreted as silence.
	  */
	virtual const float* GetStreamBlock(const CVAAudiostreamState* pStreamInfo)=0;

	//! Parameter getter interaction hook
	 virtual CVAStruct GetParameters( const CVAStruct&) const=0;

	//! Parameter setter interaction hook
	virtual void SetParameters( const CVAStruct& )=0;


private:
	//! Register sound source at a core instance
	/**
	  * Calls the audio signal source manager to register this sound source a the given core.
	  *
	  * \param pParentCore Pointer to the associated core.
	  *
	  * \see #CVAAudioSignalSourceManager
	  */
	virtual void HandleRegistration(IVACore* pParentCore)=0;

	//! Unregister sound source at a core instance
	/**
	  * Calls the audio signal source manager to unregister this sound source a the given core.
	  * Will inform the core about a new signal source.
	  *
	  * \param pParentCore Pointer to the associated core.
	  *
	  * \see #CVAAudioSignalSourceManager
	  */
	virtual void HandleUnregistration(IVACore* pParentCore)=0;

	friend class CVAAudioSignalSourceManager;
};

#endif // __VABASE_AUDIOSIGNALSOURCE_H__