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.dll on Windows for MP3 encoding and decoding.
27 #ifndef _LAMEENCDEC_H_
28 #define _LAMEENCDEC_H_
31 #include "wdlstring.h"
35 #define USE_LAME_BLADE_API
39 #ifndef USE_LAME_BLADE_API
45 #include <lame/lame.h>
55 LameEncoder(int srate
, int nch
, int bitrate
, int stereomode
= 1, int quality
= 0, int vbrmethod
= -1, int vbrquality
= 2, int vbrmax
= 320, int abr
= 128);
58 int Status() { return errorstat
; } // 1=no dll, 2=error
60 void Encode(float *in
, int in_spls
, int spacing
=1);
66 spltmp
[0].Advance(spltmp
[0].Available());
68 spltmp
[1].Advance(spltmp
[1].Available());
72 static bool CheckDLL(); // returns true if dll is present
73 static void InitDLL(const char *extrapath
=NULL
); // call with extrapath != NULL if you want to try loading from another path
75 void SetVBRFilename(const char *fn
)
80 int GetNumChannels() { return m_encoder_nch
; }
83 int m_nch
,m_encoder_nch
;
89 #ifdef USE_LAME_BLADE_API
102 int GetSampleRate() { return m_srate
?m_srate
:48000; }
103 int GetNumChannels() { return m_nch
?m_nch
:1; }
105 WDL_HeapBuf m_samples
; // we let the size get as big as it needs to, so we don't worry about tons of mallocs/etc
108 void *DecodeGetSrcBuffer(int srclen
)
110 if (srctmp
.GetSize() < srclen
) srctmp
.Resize(srclen
);
113 void DecodeWrote(int srclen
);
115 int GetError() { return errorstat
; }
125 int m_samples_remove
;
127 #ifdef USE_LAME_BLADE_API