Create FUNDING.yml
[wdl/wdl-ol.git] / WDL / lameencdec.h
blob50e10dfdd0e6859e999e172936ce5442e68f245c
1 /*
2 WDL - lameencdec.h
3 Copyright (C) 2005 and later Cockos Incorporated
5 This software is provided 'as-is', without any express or implied
6 warranty. In no event will the authors be held liable for any damages
7 arising from the use of this software.
9 Permission is granted to anyone to use this software for any purpose,
10 including commercial applications, and to alter it and redistribute it
11 freely, subject to the following restrictions:
13 1. The origin of this software must not be misrepresented; you must not
14 claim that you wrote the original software. If you use this software
15 in a product, an acknowledgment in the product documentation would be
16 appreciated but is not required.
17 2. Altered source versions must be plainly marked as such, and must not be
18 misrepresented as being the original software.
19 3. This notice may not be removed or altered from any source distribution.
22 This file provides a simple interface for using lame_enc/libmp3lame MP3 encoding
27 #ifndef _LAMEENCDEC_H_
28 #define _LAMEENCDEC_H_
30 #include "queue.h"
31 #include "wdlstring.h"
33 class LameEncoder
35 public:
37 LameEncoder(int srate, int nch, int bitrate, int stereomode = 1, int quality = 2, int vbrmethod = -1, int vbrquality = 2, int vbrmax = 320, int abr = 128);
38 ~LameEncoder();
40 int Status() { return errorstat; } // 1=no dll, 2=error
42 void Encode(float *in, int in_spls, int spacing=1);
44 WDL_Queue outqueue;
46 void reinit()
48 spltmp[0].Advance(spltmp[0].Available());
49 spltmp[0].Compact();
50 spltmp[1].Advance(spltmp[1].Available());
51 spltmp[1].Compact();
54 static const char *GetInfo();
55 static const char *GetLibName();
56 static int CheckDLL(); // returns >0 if DLL present, 1 for lame, 2 for old bladeenc
57 static void InitDLL(const char *extrapath=NULL, bool forceRetry=false); // call with extrapath != NULL if you want to try loading from another path
59 void SetVBRFilename(const char *fn)
61 m_vbrfile.Set(fn);
64 int GetNumChannels() { return m_encoder_nch; }
66 private:
67 void *m_lamestate;
68 WDL_Queue spltmp[2];
69 WDL_HeapBuf outtmp;
70 WDL_String m_vbrfile;
71 int errorstat;
72 int in_size_samples;
73 int m_nch,m_encoder_nch;
77 #endif