Source: audioconverter.h


Annotated List
Files
Globals
Hierarchy
Index
// ##########################################################################
// ####                                                                  ####
// ####                      RTP Audio Server Project                    ####
// ####                    ============================                  ####
// ####                                                                  ####
// #### Audio Converter                                                  ####
// ####                                                                  ####
// #### Version 1.00  --  February 23, 2001                              ####
// ####                                                                  ####
// #### Copyright (C) 1999  Thomas Dreibholz                             ####
// ####               2000  Universität Bonn, Abt. IV                    ####
// ####               2001  EMail: Dreibholz@bigfoot.com                 ####
// ####                     WWW:   http://www.bigfoot.com/~dreibholz     ####
// ####                                                                  ####
// ##########################################################################


#ifndef AUDIOCONVERTER_H
#define AUDIOCONVERTER_H


#include "system.h"
#include "audioquality.h"


namespace Coral {


/**
  * Audio quality converter. Convert quality from a given value to a given
  * value. Note: The "from" value must be greater than or equal to the "to"
  * value, that is from-sampling rate >= to-sampling rate, from-bits >= to-bits,
  * from-channels >= to-channels.
  *
  * @param from Quality to convert from.
  * @param to Quality to convert to.
  * @param inputBuffer Input buffer.
  * @param outputBuffer Output buffer.
  * @param inputLength Length of the audio data in input buffer.
  * @param outputLength Length of the output buffer.
  * @return Length after conversion.
  */
cardinal AudioConverter(const AudioQualityInterface& from,
                        const AudioQualityInterface& to,
                        const card8*                 inputBuffer,
                        card8*                       outputBuffer,
                        const cardinal               inputLength,
                        const cardinal               outputLength);


/**
  * Get aligned output length for a conversion from given input quality and
  * input length to output quality.
  * Example: 12 Bit/Stereo has a 6-byte alignment: L1L1R1R2 = 48 bits = 6 Bytes.
  *
  * @param inputQuality Input quality.
  * @param outputQuality Output quality.
  * @param inputLength Input length.
  * @return Aligned length.
  */
cardinal getAlignedLength(const AudioQualityInterface& inputQuality,
                          const AudioQualityInterface& outputQuality,
                          const cardinal               inputLength);


/**
  * Get parameters for audio conversion.
  * New sampling rate = (a * OldSamplingRate) / b;
  *
  * @param in Old sampling rate.
  * @param out New sampling rate.
  * @param a Reference to store a.
  * @param b Reference to store b.
  * @param c Reference to store float in / out.
  * @return true, if a and b have been found; false, if there are no such numbers for b out of the set {1,2,...,20}
  */
bool getConvParams(const     cardinal in,
                   const     cardinal out,
                   cardinal& a,
                   cardinal& b,
                   float&    c);


}


#endif
                      

Generated by: viper@odin on Fri Feb 23 12:41:26 2001, using kdoc 2.0a36.