* BIG FAT WARNING:
* this code based on "The Winamp Transcoder" plugin (http://www.srcf.ucam.org/~wdhf2/transcoder/)
*
* Copyright (c) 2005 Dmirty Alexandrov aka dimzon aka dimzon541 (dimzon541@gmail.com)
* Copyright (c) 2004 Will Fisher (will.fisher@gmail.com)
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
*    notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
*    notice, this list of conditions and the following disclaimer in the
*    documentation and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products
*    derived from this software without specific prior permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*
*
* This version is based on the aacPlusCLI project as published here: http://aacpluscli.codeplex.com/
* AACPlus v2 Encoder (using Winamp 5.57 or above enc_aacplus.dll and nscrt.dll) 
* Coding Technologies encoder 8.0.3 
* Build Feb  6 2010, 11:07:34
*
* The following enhancements have been made to allow this encoder to be used with BASS (www.un4seen.com):
* 1) "--silent" option added
* 2) "-" for STDOUT added
* 3) corrected wave chunk reading
*


*************************************************************************
* AACPlus v2 Encoder (using Winamp 5.357 enc_aacplus.dll and nscrt.dll)
* Coding Technologies encoder 8.0.3
* Build Feb  6 2010, 11:07:34
* NOTE! enc_aacplus.dll & nscrt.dll must be in executable directory
*       get it from Winamp 5.x and plugins directory.
*************************************************************************
* Copyright (c)2005 Dmirty Alexandrov (dimzon541@gmail.com)
* Copyright (c)2004 Will Fisher (will.fisher@gmail.com)
* Modified by Bernd Niedergesaess to work with BASS (www.un4seen.com)
*************************************************************************

Usage:
        enc_aacPlus.exe <inputfile> <outputfile> [options]

Input/Output:
        <inputfile>      : WAV input file (use - to read from STDIN)
                           (must be 8 or 16 bit PCM, 32000, 44100 or 48000 Hz)
        <outputfile>     : Bitstream output file (use - to write to STDOUT)
                           To write MPEG4 ISO compilant .mp4/.m4a:
                             libmp4v2.dll [from Winamp folder] must be in the same directory
                             (mp4/m4a not possible, if STDOUT is selected)

Options:
        --br <bitrate>   : Set bitrate (CBR) in bps. Default is 128000
        --ps             : Enable Parametric Stereo
                           (bitrates up to 56000, only with HE-AAC)
        --is             : Prefer Independed Stereo
                           (disables Joint Stereo M/S coding)
        --dc             : Prefer Dual Channel
        --mono           : Encode as Mono
        --lc             : Encode as LC-AAC (default)
                           (mono:8-16, stereo: 16-320, 6ch: 160-320 kbps)
        --he             : Encode as HE-AAC
                           (mono:8-64, stereo: 16-128, 6ch: 96-213 kbps)
        --high           : Encode as HE-AAC+ with hight bitrates
                           (mono:8-160, stereo: 96-256, 6ch: 8-256 kbps)
        --speech         : Tune for Speech
        --pns            : Enable Perceptual Noise Subsitution (PNS)
        --mpeg2aac       : Force MPEG2 AAC
                           (instead of let the encoder choose)
        --mpeg4aac       : Force MPEG4 AAC
                           (instead of let the encoder choose)
        --silent         : Set silent mode, no progress and other output
        --rawpcm <r c b> : Signal RAW PCM input intead of WAV
                 <r>     : Samplerate in Hz (32000, 44100 or 48000)
                 <c>     : Channels count (1 or 2 or 6)
                 <b>     : Bit's per sample (8 or 16, little-endian)

Examples:
        enc_aacPlus.exe input.wav out.aac --br 56000
        enc_aacPlus.exe input.wav out.m4a --br 32000 --he --mp4box
        enc_aacPlus.exe - - --br 128000 --high --silent --rawpcm 44100 2 16
