Initial community commit

This commit is contained in:
Jef 2024-09-24 14:54:57 +02:00
parent 537bcbc862
commit fc06254474
16440 changed files with 4239995 additions and 2 deletions

View file

@ -0,0 +1,147 @@
#include "MP3Coder.h"
#include <malloc.h>
static const float const_1_div_128_ = 32768.0 / 128.0; /* 8 bit multiplier */
static const double const_1_div_2147483648_ = 32768.0 / 2147483648.0; /* 32 bit multiplier */
static void Int8_To_Float32(float *dest, void *sourceBuffer, signed int sourceStride, unsigned int count)
{
signed char *src = (signed char*)sourceBuffer;
while( count-- )
{
float samp = *src * const_1_div_128_;
*dest = samp;
src += sourceStride;
dest ++;
}
}
static void Int24_To_Float32(float *dest, void *sourceBuffer, signed int sourceStride, unsigned int count)
{
unsigned char *src = (unsigned char*)sourceBuffer;
while ( count-- )
{
signed long temp = (((long)src[0]) << 8);
temp = temp | (((long)src[1]) << 16);
temp = temp | (((long)src[2]) << 24);
*dest = (float) ((double)temp * const_1_div_2147483648_);
src += sourceStride * 3;
dest ++;
}
}
int AudioCoderMP3_24::Encode(int framepos, void *in, int in_avail, int *in_used, void *out, int out_avail)
{
if (m_err) return -1;
if (!hbeStream)
{
if (beInitStream(&beConfig, &ibuf_size_spls, &obuf_size, (PHBE_STREAM) &hbeStream) != BE_ERR_SUCCESSFUL)
{
m_err++;
return -1;
}
ibuf_size = ibuf_size_spls * bytesPerSample;
if (is_downmix) ibuf_size *= 2;
bs = (char*)malloc(ibuf_size);
bs_size = 0;
}
*in_used = 0;
int needbytes = ibuf_size - bs_size;
if (needbytes > 0 && in_avail > 0)
{
if (needbytes > in_avail)
needbytes = in_avail;
memcpy(bs + bs_size, in, needbytes);
bs_size += needbytes;
*in_used = needbytes;
}
if (!done)
{
if (bs_size < (int)ibuf_size) return 0;
}
if (out_avail < (int)obuf_size) return 0;
int feedBytes = min(bs_size, (int)ibuf_size);
int feedSamples = feedBytes / bytesPerSample;
bs_size -= feedBytes;
/*
if (is_downmix)
{
int x;
int l = feedBytes / 4;
short *b = (short*)bs;
for (x = 0; x < l; x ++)
{
b[x] = b[x * 2] / 2 + b[x * 2 + 1] / 2;
}
}
*/
DWORD dwo = 0;
if (feedSamples)
{
if (mono_input)
{
float *float_l = (float *)alloca(sizeof(float) * feedSamples);
switch(bytesPerSample)
{
case 8:
Int8_To_Float32(float_l, bs, 1, feedSamples);
break;
case 24:
Int24_To_Float32(float_l, bs, 1, feedSamples);
break;
}
if (beEncodeChunkFloatS16NI(hbeStream, feedSamples, float_l, float_l, (unsigned char *)out, &dwo) != BE_ERR_SUCCESSFUL)
{
m_err++;
return -1;
}
}
else
{
float *float_l = (float *)alloca(sizeof(float) * feedSamples / 2);
float *float_r = (float *)alloca(sizeof(float) * feedSamples / 2);
switch(bytesPerSample)
{
case 1: // 8 bit
Int8_To_Float32(float_l, bs, 2, feedSamples / 2);
Int8_To_Float32(float_r, bs + 1, 2, feedSamples / 2);
break;
case 3: // 24 bit
Int24_To_Float32(float_l, bs, 2, feedSamples / 2);
Int24_To_Float32(float_r, bs + 3, 2, feedSamples / 2);
break;
}
if (beEncodeChunkFloatS16NI(hbeStream, feedSamples / 2, float_l, float_r, (unsigned char *)out, &dwo) != BE_ERR_SUCCESSFUL)
{
m_err++;
return -1;
}
}
}
if (!dwo && done == 1)
{
if (beDeinitStream(hbeStream, (unsigned char *)out, &dwo) != BE_ERR_SUCCESSFUL)
{
m_err++;
return -1;
}
done++;
}
return dwo;
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,278 @@
/*
* Blade DLL Interface for LAME.
*
* Copyright (c) 1999 A.L. Faber
* Based on bladedll.h version 1.0 written by Jukka Poikolainen
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef ___BLADEDLL_H_INCLUDED___
#define ___BLADEDLL_H_INCLUDED___
#pragma pack(push)
#pragma pack(1)
#ifdef __cplusplus
extern "C" {
#endif
/* encoding formats */
#define BE_CONFIG_MP3 0
#define BE_CONFIG_LAME 256
/* type definitions */
typedef unsigned long HBE_STREAM;
typedef HBE_STREAM *PHBE_STREAM;
typedef unsigned long BE_ERR;
/* error codes */
#define BE_ERR_SUCCESSFUL 0x00000000
#define BE_ERR_INVALID_FORMAT 0x00000001
#define BE_ERR_INVALID_FORMAT_PARAMETERS 0x00000002
#define BE_ERR_NO_MORE_HANDLES 0x00000003
#define BE_ERR_INVALID_HANDLE 0x00000004
#define BE_ERR_BUFFER_TOO_SMALL 0x00000005
/* other constants */
#define BE_MAX_HOMEPAGE 128
/* format specific variables */
#define BE_MP3_MODE_STEREO 0
#define BE_MP3_MODE_JSTEREO 1
#define BE_MP3_MODE_DUALCHANNEL 2
#define BE_MP3_MODE_MONO 3
#define MPEG1 1
#define MPEG2 0
#ifdef _BLADEDLL
#undef FLOAT
#include <Windows.h>
#endif
#define CURRENT_STRUCT_VERSION 1
#define CURRENT_STRUCT_SIZE sizeof(BE_CONFIG) // is currently 331 bytes
/* OBSOLETE, VALUES STILL WORK
typedef enum
{
NORMAL_QUALITY=0,
LOW_QUALITY,
HIGH_QUALITY,
VOICE_QUALITY
} LAME_QUALTIY_PRESET;
*/
typedef enum
{
VBR_METHOD_NONE = -1,
VBR_METHOD_DEFAULT = 0,
VBR_METHOD_OLD = 1,
VBR_METHOD_NEW = 2,
VBR_METHOD_MTRH = 3,
VBR_METHOD_ABR = 4
} VBRMETHOD;
typedef enum
{
LQP_NOPRESET=-1,
// QUALITY PRESETS
LQP_NORMAL_QUALITY = 0,
LQP_LOW_QUALITY = 1,
LQP_HIGH_QUALITY = 2,
LQP_VOICE_QUALITY = 3,
LQP_R3MIX = 4,
LQP_VERYHIGH_QUALITY = 5,
LQP_STANDARD = 6,
LQP_FAST_STANDARD = 7,
LQP_EXTREME = 8,
LQP_FAST_EXTREME = 9,
LQP_INSANE = 10,
LQP_ABR = 11,
LQP_CBR = 12,
LQP_MEDIUM = 13,
LQP_FAST_MEDIUM = 14,
// NEW PRESET VALUES
LQP_PHONE =1000,
LQP_SW =2000,
LQP_AM =3000,
LQP_FM =4000,
LQP_VOICE =5000,
LQP_RADIO =6000,
LQP_TAPE =7000,
LQP_HIFI =8000,
LQP_CD =9000,
LQP_STUDIO =10000
} LAME_QUALTIY_PRESET;
typedef struct {
DWORD dwConfig; // BE_CONFIG_XXXXX
// Currently only BE_CONFIG_MP3 is supported
union {
struct {
DWORD dwSampleRate; // 48000, 44100 and 32000 allowed. RG note: also seems to support 16000, 22050, 24000.
BYTE byMode; // BE_MP3_MODE_STEREO, BE_MP3_MODE_DUALCHANNEL, BE_MP3_MODE_MONO
WORD wBitrate; // 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256 and 320 allowed. RG note: also seems to support 8,16,24.
BOOL bPrivate;
BOOL bCRC;
BOOL bCopyright;
BOOL bOriginal;
} mp3; // BE_CONFIG_MP3
struct
{
// STRUCTURE INFORMATION
DWORD dwStructVersion;
DWORD dwStructSize;
// BASIC ENCODER SETTINGS
DWORD dwSampleRate; // SAMPLERATE OF INPUT FILE
DWORD dwReSampleRate; // DOWNSAMPLERATE, 0=ENCODER DECIDES
LONG nMode; // BE_MP3_MODE_STEREO, BE_MP3_MODE_DUALCHANNEL, BE_MP3_MODE_MONO
DWORD dwBitrate; // CBR bitrate, VBR min bitrate
DWORD dwMaxBitrate; // CBR ignored, VBR Max bitrate
LONG nPreset; // Quality preset, use one of the settings of the LAME_QUALITY_PRESET enum
DWORD dwMpegVersion; // FUTURE USE, MPEG-1 OR MPEG-2
DWORD dwPsyModel; // FUTURE USE, SET TO 0
DWORD dwEmphasis; // FUTURE USE, SET TO 0
// BIT STREAM SETTINGS
BOOL bPrivate; // Set Private Bit (TRUE/FALSE)
BOOL bCRC; // Insert CRC (TRUE/FALSE)
BOOL bCopyright; // Set Copyright Bit (TRUE/FALSE)
BOOL bOriginal; // Set Original Bit (TRUE/FALSE)
// VBR STUFF
BOOL bWriteVBRHeader; // WRITE XING VBR HEADER (TRUE/FALSE)
BOOL bEnableVBR; // USE VBR ENCODING (TRUE/FALSE)
INT nVBRQuality; // VBR QUALITY 0..9
DWORD dwVbrAbr_bps; // Use ABR in stead of nVBRQuality
VBRMETHOD nVbrMethod;
BOOL bNoRes; // Disable Bit resorvoir
// MISC SETTINGS
BOOL bStrictIso; // Use strict ISO encoding rules (TRUE/FALSE)
WORD nQuality; // Quality Setting, HIGH BYTE should be NOT LOW byte, otherwhise quality=5
// FUTURE USE, SET TO 0, align strucutre to 331 bytes
BYTE btReserved[255-4*sizeof(DWORD) - sizeof( WORD )];
} LHV1; // LAME header version 1
struct {
DWORD dwSampleRate;
BYTE byMode;
WORD wBitrate;
BYTE byEncodingMethod;
} aac;
} format;
} BE_CONFIG, *PBE_CONFIG;
typedef struct {
// BladeEnc DLL Version number
BYTE byDLLMajorVersion;
BYTE byDLLMinorVersion;
// BladeEnc Engine Version Number
BYTE byMajorVersion;
BYTE byMinorVersion;
// DLL Release date
BYTE byDay;
BYTE byMonth;
WORD wYear;
// BladeEnc Homepage URL
CHAR zHomepage[BE_MAX_HOMEPAGE + 1];
BYTE byAlphaLevel;
BYTE byBetaLevel;
BYTE byMMXEnabled;
BYTE btReserved[125];
} BE_VERSION, *PBE_VERSION;
#ifndef _BLADEDLL
typedef BE_ERR (*BEINITSTREAM) (PBE_CONFIG, PDWORD, PDWORD, PHBE_STREAM);
typedef BE_ERR (*BEENCODECHUNK) (HBE_STREAM, DWORD, PSHORT, PBYTE, PDWORD);
// added for floating point audio -- DSPguru, jd
typedef BE_ERR (*BEENCODECHUNKFLOATS16NI) (HBE_STREAM, DWORD, PFLOAT, PFLOAT, PBYTE, PDWORD);
typedef BE_ERR (*BEDEINITSTREAM) (HBE_STREAM, PBYTE, PDWORD);
typedef BE_ERR (*BECLOSESTREAM) (HBE_STREAM);
typedef VOID (*BEVERSION) (PBE_VERSION);
typedef VOID (*BEWRITEVBRHEADER) (LPCSTR);
#define TEXT_BEINITSTREAM "beInitStream"
#define TEXT_BEENCODECHUNK "beEncodeChunk"
#define TEXT_BEENCODECHUNKFLOATS16NI "beEncodeChunkFloatS16NI"
#define TEXT_BEDEINITSTREAM "beDeinitStream"
#define TEXT_BECLOSESTREAM "beCloseStream"
#define TEXT_BEVERSION "beVersion"
#define TEXT_BEWRITEVBRHEADER "beWriteVBRHeader"
#else
__declspec(dllexport) BE_ERR beInitStream(PBE_CONFIG pbeConfig, PDWORD dwSamples, PDWORD dwBufferSize, PHBE_STREAM phbeStream);
__declspec(dllexport) BE_ERR beEncodeChunk(HBE_STREAM hbeStream, DWORD nSamples, PSHORT pSamples, PBYTE pOutput, PDWORD pdwOutput);
// added for floating point audio -- DSPguru, jd
__declspec(dllexport) BE_ERR beEncodeChunkFloatS16NI(HBE_STREAM hbeStream, DWORD nSamples, PFLOAT buffer_l, PFLOAT buffer_r, PBYTE pOutput, PDWORD pdwOutput);
__declspec(dllexport) BE_ERR beDeinitStream(HBE_STREAM hbeStream, PBYTE pOutput, PDWORD pdwOutput);
__declspec(dllexport) BE_ERR beCloseStream(HBE_STREAM hbeStream);
__declspec(dllexport) VOID beVersion(PBE_VERSION pbeVersion);
__declspec(dllexport) BE_ERR beWriteVBRHeader(LPCSTR lpszFileName);
__declspec(dllexport) BE_ERR beFlushNoGap(HBE_STREAM hbeStream, PBYTE pOutput, PDWORD pdwOutput);
__declspec(dllexport) BE_ERR beWriteInfoTag( HBE_STREAM hbeStream, LPCSTR lpszFileName);
#endif
#pragma pack(pop)
#ifdef __cplusplus
}
#endif
#endif

View file

@ -0,0 +1,196 @@
#include "MP3Coder.h"
AudioCoderMP3::~AudioCoderMP3()
{
if (hbeStream) beCloseStream(hbeStream); hbeStream = 0;
if (bs) free(bs); bs = 0;
}
int AudioCoderMP3::GetLastError() { return m_err; };
void AudioCoderMP3::setVbrFilename(char *filename)
{
if (hbeStream) beCloseStream(hbeStream);
hbeStream = 0;
if (filename)
{
beWriteVBRHeader(filename);
}
}
int AudioCoderMP3::Encode(int framepos, void *in, int in_avail, int *in_used, void *out, int out_avail)
{
if (m_err) return -1;
if (!hbeStream)
{
if (beInitStream(&beConfig, &ibuf_size_spls, &obuf_size, (PHBE_STREAM) &hbeStream) != BE_ERR_SUCCESSFUL)
{
m_err++;
return -1;
}
ibuf_size = ibuf_size_spls * bytesPerSample;
if (is_downmix) ibuf_size *= 2;
bs = (char*)malloc(ibuf_size);
bs_size = 0;
}
*in_used = 0;
int needbytes = ibuf_size - bs_size;
if (needbytes > 0 && in_avail > 0)
{
if (needbytes > in_avail)
needbytes = in_avail;
memcpy(bs + bs_size, in, needbytes);
bs_size += needbytes;
*in_used = needbytes;
}
if (!done)
{
if (bs_size < (int)ibuf_size) return 0;
}
if (out_avail < (int)obuf_size) return 0;
int feedBytes = min(bs_size, (int)ibuf_size);
int feedSamples = feedBytes / bytesPerSample;
bs_size -= feedBytes;
if (is_downmix)
{
int x;
int l = feedBytes / 4;
short *b = (short*)bs;
for (x = 0; x < l; x ++)
{
b[x] = b[x * 2] / 2 + b[x * 2 + 1] / 2;
}
feedSamples/=2;
}
DWORD dwo = 0;
if (feedSamples)
{
if (beEncodeChunk(hbeStream, feedSamples, (short*)bs, (unsigned char*)out, &dwo) != BE_ERR_SUCCESSFUL)
{
m_err++;
return -1;
}
}
if (!dwo && done==1)
{
if (beDeinitStream(hbeStream, (unsigned char *)out, &dwo) != BE_ERR_SUCCESSFUL)
{
m_err++;
return -1;
}
done++;
}
return dwo;
}
void AudioCoderMP3::PrepareToFinish()
{
done = 1;
}
AudioCoderMP3::AudioCoderMP3(int nch, int srate, int bps, configtype *cfg)
: obuf_size(0), ibuf_size(0), ibuf_size_spls(0), done(false), bs_size(0)
{
m_err = 0;
hbeStream = 0;
bs = 0;
is_downmix = 0;
mono_input=0;
memset(&beConfig, 0, sizeof(beConfig)); // clear all fields
if (srate != 32000
&& srate != 44100
&& srate != 48000
&& srate != 16000 /* MPEG 2 sample rates */
&& srate != 22050
&& srate != 24000
&& srate != 11025 /* MPEG 2.5 sample rates */
&& srate != 12000
&& srate != 8000)
{
//MessageBox(NULL, "The only valid audio sampling rates for the LAME mp3 encoder are:\r\t16000\r\t22050\r\t24000\r\t32000\r\t44100\r\t48000\r\rPlease modify the encoding profile to use one of these sampling rates, and then try again.", "Invalid sampling rate", MB_OK);
m_err++;
return ;
}
// use the LAME config structure
beConfig.dwConfig = BE_CONFIG_LAME;
// this are the default settings for testcase.wav
beConfig.format.LHV1.dwStructVersion = 1;
beConfig.format.LHV1.dwStructSize = sizeof(beConfig);
beConfig.format.LHV1.dwSampleRate = srate; // INPUT FREQUENCY
beConfig.format.LHV1.nMode = cfg->stereo_mode;
if (nch < 2)
{
beConfig.format.LHV1.nMode = BE_MP3_MODE_MONO;
mono_input=1;
}
else
{
if (beConfig.format.LHV1.nMode == BE_MP3_MODE_MONO)
is_downmix = 1;
// beConfig.format.LHV1.nMode = BE_MP3_MODE_STEREO;
}
beConfig.format.LHV1.dwBitrate = cfg->bitrate;
beConfig.format.LHV1.dwMaxBitrate = (cfg->vbr_method != -1 ? cfg->vbr_max_bitrate : cfg->bitrate);
beConfig.format.LHV1.dwReSampleRate = 0; // DOWNSAMPLERATE, 0=ENCODER DECIDES
if (beConfig.format.LHV1.dwMaxBitrate < 32) // less than 32, let's force mono
{
if (nch > 1)
{
beConfig.format.LHV1.nMode = BE_MP3_MODE_MONO;
is_downmix = 1;
}
}
/*int effective_nch = (beConfig.format.LHV1.nMode == BE_MP3_MODE_MONO) ? 1 : 2;
if (beConfig.format.LHV1.dwReSampleRate >= 32000 &&
beConfig.format.LHV1.dwMaxBitrate / effective_nch <= 32)
{
beConfig.format.LHV1.dwReSampleRate /= 2;
}*/
/*
if (beConfig.format.LHV1.dwReSampleRate < 32000)
beConfig.format.LHV1.dwMpegVersion = MPEG2; // MPEG VERSION (I or II)
else
beConfig.format.LHV1.dwMpegVersion = MPEG1; // MPEG VERSION (I or II)
*/
beConfig.format.LHV1.nPreset = cfg->quality;
beConfig.format.LHV1.dwPsyModel = 0; // USE DEFAULT PSYCHOACOUSTIC MODEL
beConfig.format.LHV1.dwEmphasis = 0; // NO EMPHASIS TURNED ON
beConfig.format.LHV1.bOriginal = 0; // SET ORIGINAL FLAG
beConfig.format.LHV1.bCRC = 0; // INSERT CRC
beConfig.format.LHV1.bCopyright = 0; // SET COPYRIGHT FLAG
beConfig.format.LHV1.bPrivate = 0; // SET PRIVATE FLAG
beConfig.format.LHV1.bNoRes = 0;
beConfig.format.LHV1.bWriteVBRHeader = 1;
beConfig.format.LHV1.bEnableVBR = cfg->vbr_method != VBR_METHOD_NONE;
beConfig.format.LHV1.nVBRQuality = cfg->vbr;
//beConfig.format.LHV1.dwVbrAbr_bps = (cfg->vbr_method != VBR_METHOD_NONE ? 1000 * cfg->abr_bitrate : 0);
beConfig.format.LHV1.dwVbrAbr_bps = (cfg->vbr_method == VBR_METHOD_ABR ? 1000 * cfg->abr_bitrate : 0);
beConfig.format.LHV1.nVbrMethod = (VBRMETHOD)cfg->vbr_method;
bytesPerSample = bps / 8;
}

View file

@ -0,0 +1,62 @@
#ifndef NULLSOFT_MP3_CODER_H
#define NULLSOFT_MP3_CODER_H
#include <windows.h>
#include "../nsv/enc_if.h"
#include "BladeMP3EncDLL.h"
#ifndef _BLADEDLL
extern BEINITSTREAM beInitStream;
extern BECLOSESTREAM beCloseStream;
extern BEENCODECHUNK beEncodeChunk;
extern BEDEINITSTREAM beDeinitStream;
extern BEWRITEVBRHEADER beWriteVBRHeader;
extern BEVERSION beVersion;
extern BEENCODECHUNKFLOATS16NI beEncodeChunkFloatS16NI;
#endif // !_BLADEDLL
typedef struct
{
int bitrate;
int vbr_max_bitrate;
int abr_bitrate;
int stereo_mode; //0=stereo,1=jstereo,2=mchannel,3=mono
int quality; //0=normal,1=low,2=high,3=voice,4=r3mix,5=vh
int vbr; // 0=high-9=low
int vbr_method; // -1=none, 0=default, 1=old, 2=new, 3=mtrh, 4=abr
}
configtype;
class AudioCoderMP3 : public AudioCoder
{
public:
AudioCoderMP3(int nch, int srate, int bps, configtype *cfg);
int Encode(int framepos, void *in, int in_avail, int *in_used, void *out, int out_avail);
virtual ~AudioCoderMP3();
int GetLastError();
void setVbrFilename(char *filename);
void PrepareToFinish();
protected:
int m_err;
DWORD obuf_size;
DWORD ibuf_size, ibuf_size_spls;
HBE_STREAM hbeStream;
BE_CONFIG beConfig;
int bytesPerSample;
int done;
char *bs;
int bs_size;
int is_downmix;
int mono_input;
};
class AudioCoderMP3_24 : public AudioCoderMP3
{
public:
AudioCoderMP3_24(int nch, int srate, int bps, configtype *cfg) : AudioCoderMP3(nch, srate, bps, cfg) {}
int Encode(int framepos, void *in, int in_avail, int *in_used, void *out, int out_avail);
};
#endif

View file

@ -0,0 +1,145 @@
// Microsoft Visual C++ generated resource script.
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "afxres.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// English (U.S.) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#endif //_WIN32
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE
BEGIN
"#include ""afxres.h""\r\n"
"\0"
END
3 TEXTINCLUDE
BEGIN
"#include ""version.rc2""\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//
IDD_MP3 DIALOGEX 0, 0, 256, 167
STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD
FONT 8, "MS Shell Dlg", 0, 0, 0x0
BEGIN
GROUPBOX "MP3 Encoder Options",IDC_STATIC,0,0,256,166
LTEXT "Mode:",IDC_STATIC,4,13,21,8
COMBOBOX IDC_VBRMETHOD,28,11,52,155,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
COMBOBOX IDC_STEREOMODE,87,11,66,184,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
LTEXT "Bitrate:",IDC_BITRATE_TEXT1,6,28,80,8
COMBOBOX IDC_BITRATE,87,25,38,98,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
LTEXT "kbps",IDC_BITRATE_TEXT2,129,28,16,8
LTEXT "VBR Maximum Bitrate:",IDC_MAXBITRATE_TEXT1,6,42,77,8
COMBOBOX IDC_MAXBITRATE,87,39,38,98,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
LTEXT "kbps",IDC_MAXBITRATE_TEXT2,129,42,16,8
LTEXT "Average Bitrate:",IDC_AVGBITRATE_TEXT1,6,56,77,8
COMBOBOX IDC_AVGBITRATE,87,53,38,98,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
LTEXT "kbps",IDC_AVGBITRATE_TEXT2,129,56,16,8
LTEXT "Quality:",IDC_STATIC,7,74,24,8
COMBOBOX IDC_QUALITY,33,72,98,110,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
LTEXT "VBR Q:",IDC_VBRQ_TEXT,136,74,25,8
COMBOBOX IDC_VBRQ,161,72,40,98,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
LTEXT "MPEG Layer-3 audio coding technology licensed from Fraunhofer IIS and Thomson.",IDC_STATIC,5,92,148,18,NOT WS_VISIBLE
LTEXT "MPEG Layer-3 encoding technology by Mp3dev.",IDC_STATIC,5,115,154,8
LTEXT "",IDC_LAMEVERSION,136,153,114,8,0,WS_EX_RIGHT
END
IDD_MP3_MISSING DIALOGEX 0, 0, 256, 167
STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD
FONT 8, "MS Shell Dlg", 0, 0, 0x0
BEGIN
GROUPBOX "MP3 Encoder Options",-1,0,0,256,166
LTEXT "MP3 encoding support is not available as ""lame_enc.dll"" is not present.\n\nYou will need to manually download ""lame_enc.dll"" to the Winamp\Shared folder to enable MP3 encoding support.",-1,12,14,231,34
LTEXT "Click here for information on where you can obtain ""lame_enc.dll"".",-1,12,54,231,10
CONTROL "here",IDC_URL1,"Button",BS_OWNERDRAW | WS_TABSTOP,27,54,15,8
END
/////////////////////////////////////////////////////////////////////////////
//
// String Table
//
STRINGTABLE
BEGIN
65535 "{F1534ECA-6E64-42c2-9781-812E61154515}"
END
STRINGTABLE
BEGIN
IDS_BITRATE "Bitrate:"
IDS_ABR_MIN_BITRATE "ABR Minimum Bitrate"
IDS_VBR_MIN_BITRATE "VBR Minimum Bitrate"
IDS_N_A "N/A"
IDS_ABR_MAX_BITRATE "ABR Maximum Bitrate"
IDS_VBR_MAX_BITRATE "VBR Maximum Bitrate"
IDS_AVERAGE_BITRATE "Average Bitrate"
IDS_STEREO "Stereo"
IDS_JOINT_STEREO "Joint Stereo"
IDS_MULTI_CHANNEL "Multi-Channel"
IDS_MONO "Mono"
IDS_NORMAL "Normal"
IDS_LOW "Low"
IDS_HIGH "High"
IDS_VOICE "Voice"
IDS_R3MIX "R3mix"
END
STRINGTABLE
BEGIN
IDS_VERY_HIGH "Very High"
IDS_HIGH_BRACKET "(High)"
IDS_LOW_BRACKET "(Low)"
IDS_ENC_LAME_DESC "MP3 Encoder %s"
IDS_ENC_LAME_DESC_MISSING "MP3 Encoder %s [NOT LOADED]"
END
#endif // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
#include "version.rc2"
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED

View file

@ -0,0 +1,30 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.29509.3
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "enc_lame", "enc_lame.vcxproj", "{861F24D8-9B22-42FA-B056-7A86D6B4500C}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Debug|x64 = Debug|x64
Release|Win32 = Release|Win32
Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{861F24D8-9B22-42FA-B056-7A86D6B4500C}.Debug|Win32.ActiveCfg = Debug|Win32
{861F24D8-9B22-42FA-B056-7A86D6B4500C}.Debug|Win32.Build.0 = Debug|Win32
{861F24D8-9B22-42FA-B056-7A86D6B4500C}.Debug|x64.ActiveCfg = Debug|x64
{861F24D8-9B22-42FA-B056-7A86D6B4500C}.Debug|x64.Build.0 = Debug|x64
{861F24D8-9B22-42FA-B056-7A86D6B4500C}.Release|Win32.ActiveCfg = Release|Win32
{861F24D8-9B22-42FA-B056-7A86D6B4500C}.Release|Win32.Build.0 = Release|Win32
{861F24D8-9B22-42FA-B056-7A86D6B4500C}.Release|x64.ActiveCfg = Release|x64
{861F24D8-9B22-42FA-B056-7A86D6B4500C}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {CC41ED85-6766-472A-9C3A-5E89A14D82B6}
EndGlobalSection
EndGlobal

View file

@ -0,0 +1,293 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{861F24D8-9B22-42FA-B056-7A86D6B4500C}</ProjectGuid>
<RootNamespace>enc_lame</RootNamespace>
<WindowsTargetPlatformVersion>10.0.19041.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<PlatformToolset>v142</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<PlatformToolset>v142</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<PlatformToolset>v142</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<PlatformToolset>v142</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>false</LinkIncremental>
<OutDir>$(PlatformShortName)_$(Configuration)\</OutDir>
<IntDir>$(PlatformShortName)_$(Configuration)\</IntDir>
<IncludePath>$(IncludePath)</IncludePath>
<LibraryPath>$(LibraryPath)</LibraryPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>false</LinkIncremental>
<OutDir>$(PlatformShortName)_$(Configuration)\</OutDir>
<IntDir>$(PlatformShortName)_$(Configuration)\</IntDir>
<IncludePath>$(IncludePath)</IncludePath>
<LibraryPath>$(LibraryPath)</LibraryPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
<OutDir>$(PlatformShortName)_$(Configuration)\</OutDir>
<IntDir>$(PlatformShortName)_$(Configuration)\</IntDir>
<IncludePath>$(IncludePath)</IncludePath>
<LibraryPath>$(LibraryPath)</LibraryPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
<OutDir>$(PlatformShortName)_$(Configuration)\</OutDir>
<IntDir>$(PlatformShortName)_$(Configuration)\</IntDir>
<IncludePath>$(IncludePath)</IncludePath>
<LibraryPath>$(LibraryPath)</LibraryPath>
</PropertyGroup>
<PropertyGroup Label="Vcpkg">
<VcpkgEnableManifest>false</VcpkgEnableManifest>
</PropertyGroup>
<PropertyGroup Label="Vcpkg" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<VcpkgUseStatic>false</VcpkgUseStatic>
<VcpkgInstalledDir>
</VcpkgInstalledDir>
<VcpkgConfiguration>Debug</VcpkgConfiguration>
<VcpkgTriplet>x86-windows-static-md</VcpkgTriplet>
</PropertyGroup>
<PropertyGroup Label="Vcpkg" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<VcpkgUseStatic>false</VcpkgUseStatic>
<VcpkgInstalledDir>
</VcpkgInstalledDir>
<VcpkgTriplet>x86-windows-static-md</VcpkgTriplet>
</PropertyGroup>
<PropertyGroup Label="Vcpkg" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<VcpkgUseStatic>false</VcpkgUseStatic>
<VcpkgInstalledDir>
</VcpkgInstalledDir>
<VcpkgTriplet>x86-windows-static-md</VcpkgTriplet>
<VcpkgConfiguration>Debug</VcpkgConfiguration>
</PropertyGroup>
<PropertyGroup Label="Vcpkg" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<VcpkgUseStatic>false</VcpkgUseStatic>
<VcpkgInstalledDir>
</VcpkgInstalledDir>
<VcpkgTriplet>x86-windows-static-md</VcpkgTriplet>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..\..\..\Wasabi;..\..\..\external_dependencies\vcpkg\$(PlatformShortName)-windows-static\include\lame</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_WINDOWS;_USRDLL;_BLADEDLL;NSV_CODER_MP3_EXPORTS;WINDOWS_IGNORE_PACKING_MISMATCH;WIN32;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>false</MinimalRebuild>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<StructMemberAlignment>Default</StructMemberAlignment>
<ProgramDataBaseFileName>$(IntDir)$(TargetName).pdb</ProgramDataBaseFileName>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<Culture>0x0409</Culture>
</ResourceCompile>
<Link>
<AdditionalDependencies>shlwapi.lib;libmp3lame-static.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ProgramDatabaseFile>$(IntDir)$(TargetName).pdb</ProgramDatabaseFile>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
<TargetMachine>MachineX86</TargetMachine>
<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
<AdditionalLibraryDirectories>..\..\..\external_dependencies\vcpkg\$(PlatformShortName)-windows-static\debug\lib\;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Link>
<PostBuildEvent>
<Command>xcopy /Y /D $(OutDir)$(TargetName)$(TargetExt) ..\..\..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\Plugins\
xcopy /Y /D $(IntDir)$(TargetName).pdb ..\..\..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\Plugins\
if exist ..\..\..\resources\libraries\lame_enc.dll xcopy /Y /D ..\..\..\resources\libraries\lame_enc.dll ..\..\..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\Plugins\</Command>
<Message>Post build event: 'xcopy /Y /D $(OutDir)$(TargetName)$(TargetExt) ..\..\..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\Plugins\ and if exist ..\..\..\resources\libraries\lame_enc.dll xcopy /Y /D ..\..\..\resources\libraries\lame_enc.dll ..\..\..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\Shared\'</Message>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..\..\..\Wasabi;..\..\..\external_dependencies\vcpkg\$(PlatformShortName)-windows-static\include\lame</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_DEBUG;_WINDOWS;_USRDLL;_BLADEDLL;NSV_CODER_MP3_EXPORTS;WIN64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>false</MinimalRebuild>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<ProgramDataBaseFileName>$(IntDir)$(TargetName).pdb</ProgramDataBaseFileName>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<Culture>0x0409</Culture>
</ResourceCompile>
<Link>
<AdditionalDependencies>shlwapi.lib;..\..\..\external_dependencies\vcpkg\$(PlatformShortName)-windows-static\debug\lib\libmp3lame-static.lib</AdditionalDependencies>
<OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ProgramDatabaseFile>$(IntDir)$(TargetName).pdb</ProgramDatabaseFile>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
<AdditionalLibraryDirectories>..\..\..\external_dependencies\vcpkg\$(PlatformShortName)-windows-static\debug\lib\;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Link>
<PostBuildEvent>
<Command>xcopy /Y /D $(OutDir)$(TargetName)$(TargetExt) ..\..\..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\Plugins\
xcopy /Y /D $(IntDir)$(TargetName).pdb ..\..\..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\Plugins\
if exist ..\..\..\resources\libraries\lame_enc.dll xcopy /Y /D ..\..\..\resources\libraries\lame_enc.dll ..\..\..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\Plugins\</Command>
<Message>Post build event: 'xcopy /Y /D $(OutDir)$(TargetName)$(TargetExt) ..\..\..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\Plugins\ and if exist ..\..\..\resources\libraries\lame_enc.dll xcopy /Y /D ..\..\..\resources\libraries\lame_enc.dll ..\..\..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\Shared\'</Message>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<Optimization>MinSpace</Optimization>
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
<FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
<AdditionalIncludeDirectories>..\..\..\Wasabi;..\..\..\external_dependencies\vcpkg\$(PlatformShortName)-windows-static\include\lame</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_WINDOWS;_USRDLL;_BLADEDLL;NSV_CODER_MP3_EXPORTS;WINDOWS_IGNORE_PACKING_MISMATCH;NDEBUG;WIN32;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<BufferSecurityCheck>true</BufferSecurityCheck>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>None</DebugInformationFormat>
<StructMemberAlignment>Default</StructMemberAlignment>
<ProgramDataBaseFileName>$(IntDir)$(TargetName).pdb</ProgramDataBaseFileName>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<Culture>0x0409</Culture>
</ResourceCompile>
<Link>
<AdditionalDependencies>shlwapi.lib;libmp3lame-static.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
<GenerateDebugInformation>false</GenerateDebugInformation>
<ProgramDatabaseFile>$(IntDir)$(TargetName).pdb</ProgramDatabaseFile>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
<TargetMachine>MachineX86</TargetMachine>
<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
<AdditionalLibraryDirectories>..\..\..\external_dependencies\vcpkg\$(PlatformShortName)-windows-static\lib\;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Link>
<PostBuildEvent>
<Command>xcopy /Y /D $(OutDir)$(TargetName)$(TargetExt) ..\..\..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\Plugins\
if exist ..\..\..\resources\libraries\lame_enc.dll xcopy /Y /D ..\..\..\resources\libraries\lame_enc.dll ..\..\..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\Plugins\</Command>
<Message>Post build event: 'xcopy /Y /D $(OutDir)$(TargetName)$(TargetExt) ..\..\..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\Plugins\ and if exist ..\..\..\resources\libraries\lame_enc.dll xcopy /Y /D ..\..\..\resources\libraries\lame_enc.dll ..\..\..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\Shared\'</Message>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<Optimization>MinSpace</Optimization>
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
<FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
<AdditionalIncludeDirectories>..\..\..\Wasabi;..\..\..\external_dependencies\vcpkg\$(PlatformShortName)-windows-static\include\lame</AdditionalIncludeDirectories>
<PreprocessorDefinitions>NDEBUG;_WINDOWS;_USRDLL;NSV_CODER_MP3_EXPORTS;WIN64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<BufferSecurityCheck>true</BufferSecurityCheck>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>None</DebugInformationFormat>
<ProgramDataBaseFileName>$(IntDir)$(TargetName).pdb</ProgramDataBaseFileName>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<Culture>0x0409</Culture>
</ResourceCompile>
<Link>
<AdditionalDependencies>shlwapi.lib;..\..\..\external_dependencies\vcpkg\$(PlatformShortName)-windows-static\lib\libmp3lame-static.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
<GenerateDebugInformation>false</GenerateDebugInformation>
<ProgramDatabaseFile>$(IntDir)$(TargetName).pdb</ProgramDatabaseFile>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
<AdditionalLibraryDirectories>..\..\..\external_dependencies\vcpkg\$(PlatformShortName)-windows-static\debug\lib\;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Link>
<PostBuildEvent>
<Command>xcopy /Y /D $(OutDir)$(TargetName)$(TargetExt) ..\..\..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\Plugins\
if exist ..\resources\libraries\lame_enc.dll xcopy /Y /D ..\..\..\resources\libraries\lame_enc.dll ..\..\..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\Plugins\</Command>
<Message>Post build event: 'xcopy /Y /D $(OutDir)$(TargetName)$(TargetExt) ..\..\..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\Plugins\ and if exist ..\..\..\resources\libraries\lame_enc.dll xcopy /Y /D ..\..\..\resources\libraries\lame_enc.dll ..\..\..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\Shared\'</Message>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="24bit.cpp" />
<ClCompile Include="BladeMP3EncDLL.c" />
<ClCompile Include="main.cpp">
<!--PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;NSV_CODER_MP3_EXPORTS</PreprocessorDefinitions>
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;NSV_CODER_MP3_EXPORTS</PreprocessorDefinitions>
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;NSV_CODER_MP3_EXPORTS</PreprocessorDefinitions>
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;NSV_CODER_MP3_EXPORTS</PreprocessorDefinitions-->
</ClCompile>
<ClCompile Include="MP3Coder.cpp" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="enc_lame.rc" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="BladeMP3EncDLL.h" />
<ClInclude Include="MP3Coder.h" />
<ClInclude Include="resource.h" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\Wasabi\Wasabi.vcxproj">
<Project>{3e0bfa8a-b86a-42e9-a33f-ec294f823f7f}</Project>
</ProjectReference>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View file

@ -0,0 +1,44 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<ClCompile Include="24bit.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="main.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="MP3Coder.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="BladeMP3EncDLL.c">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="resource.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="MP3Coder.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="BladeMP3EncDLL.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<Filter Include="Header Files">
<UniqueIdentifier>{dc9d6b9d-69d1-40a7-97c9-870cfa399631}</UniqueIdentifier>
</Filter>
<Filter Include="Ressource Files">
<UniqueIdentifier>{3e0eac86-0886-4e85-a300-8b6cb497e2a7}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files">
<UniqueIdentifier>{bf0f4053-1c32-4453-a394-6542b1301613}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="enc_lame.rc">
<Filter>Ressource Files</Filter>
</ResourceCompile>
</ItemGroup>
</Project>

View file

@ -0,0 +1,503 @@
/*
** nsv_coder_lame: main.cpp - LAME mp3 encoder plug-in
** (requires lame_enc.dll)
**
** Copyright (C) 2001-2006 Nullsoft, Inc.
**
** This software is provided 'as-is', without any express or implied warranty.
** In no event will the authors be held liable for any damages arising from the use of this software.
**
** Permission is granted to anyone to use this software for any purpose, including commercial
** applications, and to alter it and redistribute it freely, subject to the following restrictions:
** 1. The origin of this software must not be misrepresented; you must not claim that you wrote the
** original software. If you use this software in a product, an acknowledgment in the product
** documentation would be appreciated but is not required.
** 2. Altered source versions must be plainly marked as such, and must not be misrepresented as
** being the original software.
** 3. This notice may not be removed or altered from any source distribution.
*/
#define ENC_VERSION "v1.38"
#include <stdio.h>
#include "resource.h"
#include "BladeMP3EncDLL.h"
#include "MP3Coder.h"
#include <strsafe.h>
#include <shlwapi.h>
#include <lame/lame.h>
// wasabi based services for localisation support
#include <api/service/waServiceFactory.h>
#include "../Agave/Language/api_language.h"
#include "../winamp/wa_ipc.h"
HWND winampwnd = 0;
api_service *WASABI_API_SVC = 0;
api_language *WASABI_API_LNG = 0;
HINSTANCE WASABI_API_LNG_HINST = 0, WASABI_API_ORIG_HINST = 0;
int g_valid_bitrates[] = { 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, -1 };
static wchar_t lamedll[MAX_PATH]=L"";
HINSTANCE g_lamedll = 0;
//BEINITSTREAM beInitStream=0;
//BECLOSESTREAM beCloseStream=0;
//BEENCODECHUNK beEncodeChunk=0;
//BEDEINITSTREAM beDeinitStream=0;
//BEWRITEVBRHEADER beWriteVBRHeader=0;
//BEVERSION beVersion=0;
//BEENCODECHUNKFLOATS16NI beEncodeChunkFloatS16NI=0;
static HINSTANCE GetMyInstance()
{
MEMORY_BASIC_INFORMATION mbi = {0};
if(VirtualQuery(GetMyInstance, &mbi, sizeof(mbi)))
return (HINSTANCE)mbi.AllocationBase;
return NULL;
}
void GetLocalisationApiService(void)
{
if(!WASABI_API_LNG)
{
// loader so that we can get the localisation service api for use
if(!WASABI_API_SVC)
{
WASABI_API_SVC = (api_service*)SendMessage(winampwnd, WM_WA_IPC, 0, IPC_GET_API_SERVICE);
if (WASABI_API_SVC == (api_service*)1)
{
WASABI_API_SVC = NULL;
return;
}
}
if(!WASABI_API_LNG)
{
waServiceFactory *sf;
sf = WASABI_API_SVC->service_getServiceByGuid(languageApiGUID);
if (sf) WASABI_API_LNG = reinterpret_cast<api_language*>(sf->getInterface());
}
// need to have this initialised before we try to do anything with localisation features
WASABI_API_START_LANG(GetMyInstance(),EncLameLangGUID);
}
}
/*
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
{
return TRUE;
}*/
typedef struct
{
configtype cfg;
char configfile[MAX_PATH];
}
configwndrec;
void BuildVersionString(wchar_t version[128])
{
BE_VERSION ver;
beVersion(&ver);
if (ver.byBetaLevel)
StringCchPrintf(version, 128, L"%u.%ub%u", (unsigned int)ver.byMajorVersion, (unsigned int)ver.byMinorVersion, (unsigned int)ver.byBetaLevel);
else if (ver.byAlphaLevel)
StringCchPrintf(version, 128, L"%u.%ua%u", (unsigned int)ver.byMajorVersion, (unsigned int)ver.byMinorVersion, (unsigned int)ver.byAlphaLevel);
else
StringCchPrintf(version, 128, L"%u.%u", (unsigned int)ver.byMajorVersion, (unsigned int)ver.byMinorVersion);
}
void readconfig(char *configfile, configtype *cfg)
{
cfg->bitrate = 128;
cfg->vbr_max_bitrate = 320;
cfg->abr_bitrate = 128;
cfg->stereo_mode = 1;
cfg->quality = LQP_FAST_STANDARD;
cfg->vbr = 2;
cfg->vbr_method = VBR_METHOD_NEW;
if (configfile)
GetPrivateProfileStructA("audio_mp3l", "conf", cfg, sizeof(configtype), configfile);
}
void writeconfig(char* configfile, configtype *cfg)
{
if (configfile)
WritePrivateProfileStructA("audio_mp3l", "conf", cfg, sizeof(configtype), configfile);
}
extern "C"
{
unsigned int __declspec(dllexport) GetAudioTypes3(int idx, char *desc)
{
//if ((g_lamedll != NULL) && (beInitStream != NULL) && (beCloseStream != NULL) && (beEncodeChunk != NULL) && (beDeinitStream != NULL) && (beWriteVBRHeader != NULL) && (beVersion != NULL))
if (idx == 0)
{
GetLocalisationApiService();
StringCchPrintfA(desc, 1024, WASABI_API_LNGSTRING(IDS_ENC_LAME_DESC), ENC_VERSION);
return mmioFOURCC('M', 'P', '3', 'l');
}
return 0;
}
AudioCoder __declspec(dllexport) *CreateAudio3(int nch, int srate, int bps, unsigned int srct, unsigned int *outt, char *configfile)
{
if (nch > 2 || srate > 48000)
return NULL;
if (srct == mmioFOURCC('P', 'C', 'M', ' ') && *outt == mmioFOURCC('M', 'P', '3', 'l'))
{
configtype cfg;
readconfig(configfile, &cfg);
*outt = mmioFOURCC('M', 'P', '3', ' ');
AudioCoderMP3 *t=0;
if (bps != 16)
t = new AudioCoderMP3_24(nch, srate, bps, &cfg);
else
t = new AudioCoderMP3(nch, srate, bps, &cfg);
if (t->GetLastError())
{
delete t;
return NULL;
}
return t;
}
return NULL;
}
void __declspec(dllexport) FinishAudio3(const char *filename, AudioCoder *coder)
{
//beWriteVBRHeader(filename);
((AudioCoderMP3*)coder)->setVbrFilename((char *)filename); //apparently this needs to be called after beCloseStream
}
void __declspec(dllexport) PrepareToFinish(const char *filename, AudioCoder *coder)
{
((AudioCoderMP3*)coder)->PrepareToFinish();
}
static void setBitrates(HWND hwndDlg, int mi, int ma)
{
int i = 0;
while (g_valid_bitrates[i] > 0)
{
if (g_valid_bitrates[i] == mi) SendDlgItemMessage(hwndDlg, IDC_BITRATE, CB_SETCURSEL, i, 0);
if (g_valid_bitrates[i] == ma) SendDlgItemMessage(hwndDlg, IDC_MAXBITRATE, CB_SETCURSEL, i, 0);
i++;
}
}
BOOL CALLBACK DlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
if (uMsg == WM_USER + 666)
{
int vbr_meth = (int)SendDlgItemMessage(hwndDlg, IDC_VBRMETHOD, CB_GETCURSEL, 0, 0);
if (vbr_meth == CB_ERR) vbr_meth = 0;
vbr_meth--;
EnableWindow(GetDlgItem(hwndDlg, IDC_VBRQ), vbr_meth != -1 && vbr_meth != 4);
EnableWindow(GetDlgItem(hwndDlg, IDC_VBRQ_TEXT), vbr_meth != -1 && vbr_meth != 4);
SetDlgItemTextW(hwndDlg, IDC_BITRATE_TEXT1, WASABI_API_LNGSTRINGW((vbr_meth == -1 ? IDS_BITRATE : vbr_meth == 4 ? IDS_ABR_MIN_BITRATE : IDS_VBR_MIN_BITRATE)));
SetDlgItemTextW(hwndDlg, IDC_MAXBITRATE_TEXT1, WASABI_API_LNGSTRINGW((vbr_meth == -1 ? IDS_N_A : vbr_meth == 4 ? IDS_ABR_MAX_BITRATE : IDS_VBR_MAX_BITRATE)));
SetDlgItemTextW(hwndDlg, IDC_AVGBITRATE_TEXT1, WASABI_API_LNGSTRINGW((vbr_meth != 4 ? IDS_N_A : IDS_AVERAGE_BITRATE)));
EnableWindow(GetDlgItem(hwndDlg, IDC_MAXBITRATE_TEXT1), vbr_meth != -1);
EnableWindow(GetDlgItem(hwndDlg, IDC_MAXBITRATE_TEXT2), vbr_meth != -1);
EnableWindow(GetDlgItem(hwndDlg, IDC_MAXBITRATE), vbr_meth != -1);
EnableWindow(GetDlgItem(hwndDlg, IDC_AVGBITRATE_TEXT1), vbr_meth == 4);
EnableWindow(GetDlgItem(hwndDlg, IDC_AVGBITRATE_TEXT2), vbr_meth == 4);
EnableWindow(GetDlgItem(hwndDlg, IDC_AVGBITRATE), vbr_meth == 4);
int qual = (int)SendDlgItemMessage(hwndDlg, IDC_QUALITY, CB_GETCURSEL, 0, 0);
if (qual == CB_ERR) qual = 0;
switch (qual)
{
case LQP_R3MIX:
case LQP_STANDARD:
case LQP_FAST_STANDARD:
case LQP_EXTREME:
case LQP_FAST_EXTREME:
case LQP_INSANE:
case LQP_MEDIUM:
case LQP_FAST_MEDIUM:
case LQP_ABR:
case LQP_CBR:
EnableWindow(GetDlgItem(hwndDlg, IDC_STEREOMODE), 0);
EnableWindow(GetDlgItem(hwndDlg, IDC_VBRMETHOD), 0);
break;
default:
EnableWindow(GetDlgItem(hwndDlg, IDC_STEREOMODE), 1);
EnableWindow(GetDlgItem(hwndDlg, IDC_VBRMETHOD), 1);
break;
}
if (qual == 4) EnableWindow(GetDlgItem(hwndDlg, IDC_VBRQ), 0);
}
if (uMsg == WM_USER + 667)
{
int qual = (int)SendDlgItemMessage(hwndDlg, IDC_QUALITY, CB_GETCURSEL, 0, 0);
if (qual == CB_ERR) qual = 0;
switch (qual)
{
case LQP_R3MIX:
SendDlgItemMessage(hwndDlg, IDC_VBRMETHOD, CB_SETCURSEL, 3, 0);
setBitrates(hwndDlg, 96, 224);
SendDlgItemMessage(hwndDlg, IDC_STEREOMODE, CB_SETCURSEL, 1, 0);
SendDlgItemMessage(hwndDlg, IDC_VBRQ, CB_SETCURSEL, 1, 0);
break;
case LQP_STANDARD: /* check for alt-preset standard */
SendDlgItemMessage(hwndDlg, IDC_VBRMETHOD, CB_SETCURSEL, 2, 0);
setBitrates(hwndDlg, 32, 320);
SendDlgItemMessage(hwndDlg, IDC_STEREOMODE, CB_SETCURSEL, 1, 0);
SendDlgItemMessage(hwndDlg, IDC_VBRQ, CB_SETCURSEL, 2, 0);
break;
case LQP_FAST_STANDARD: /* check for alt-preset fast standard */
SendDlgItemMessage(hwndDlg, IDC_VBRMETHOD, CB_SETCURSEL, 3, 0);
setBitrates(hwndDlg, 32, 320);
SendDlgItemMessage(hwndDlg, IDC_STEREOMODE, CB_SETCURSEL, 1, 0);
SendDlgItemMessage(hwndDlg, IDC_VBRQ, CB_SETCURSEL, 2, 0);
break;
case LQP_MEDIUM: /* check for alt-preset medium */
SendDlgItemMessage(hwndDlg, IDC_VBRMETHOD, CB_SETCURSEL, 2, 0);
setBitrates(hwndDlg, 32, 320);
SendDlgItemMessage(hwndDlg, IDC_STEREOMODE, CB_SETCURSEL, 1, 0);
SendDlgItemMessage(hwndDlg, IDC_VBRQ, CB_SETCURSEL, 2, 0);
break;
case LQP_FAST_MEDIUM: /* check for alt-preset fast medium */
SendDlgItemMessage(hwndDlg, IDC_VBRMETHOD, CB_SETCURSEL, 3, 0);
setBitrates(hwndDlg, 32, 320);
SendDlgItemMessage(hwndDlg, IDC_STEREOMODE, CB_SETCURSEL, 1, 0);
SendDlgItemMessage(hwndDlg, IDC_VBRQ, CB_SETCURSEL, 2, 0);
break;
case LQP_EXTREME: /* check for alt-preset extreme */
SendDlgItemMessage(hwndDlg, IDC_VBRMETHOD, CB_SETCURSEL, 2, 0);
setBitrates(hwndDlg, 32, 320);
SendDlgItemMessage(hwndDlg, IDC_STEREOMODE, CB_SETCURSEL, 1, 0);
SendDlgItemMessage(hwndDlg, IDC_VBRQ, CB_SETCURSEL, 2, 0);
break;
case LQP_FAST_EXTREME: /* check for alt-preset fast extreme */
SendDlgItemMessage(hwndDlg, IDC_VBRMETHOD, CB_SETCURSEL, 3, 0);
setBitrates(hwndDlg, 32, 320);
SendDlgItemMessage(hwndDlg, IDC_STEREOMODE, CB_SETCURSEL, 1, 0);
SendDlgItemMessage(hwndDlg, IDC_VBRQ, CB_SETCURSEL, 2, 0);
break;
case LQP_INSANE: /* check for alt-preset fast insane */
SendDlgItemMessage(hwndDlg, IDC_VBRMETHOD, CB_SETCURSEL, 0, 0);
setBitrates(hwndDlg, 320, 320);
SendDlgItemMessage(hwndDlg, IDC_STEREOMODE, CB_SETCURSEL, 1, 0);
break;
case LQP_ABR: /* check for alt-preset fast insane */
SendDlgItemMessage(hwndDlg, IDC_VBRMETHOD, CB_SETCURSEL, 5, 0);
setBitrates(hwndDlg, 64, 320);
SendDlgItemMessage(hwndDlg, IDC_STEREOMODE, CB_SETCURSEL, 1, 0);
SendDlgItemMessage(hwndDlg, IDC_VBRQ, CB_SETCURSEL, 2, 0);
break;
case LQP_CBR: /* check for alt-preset fast insane */
SendDlgItemMessage(hwndDlg, IDC_VBRMETHOD, CB_SETCURSEL, 0, 0);
SendDlgItemMessage(hwndDlg, IDC_STEREOMODE, CB_SETCURSEL, 1, 0);
break;
}
SendMessage(hwndDlg, WM_USER + 666, 0, 0);
}
if (uMsg == WM_INITDIALOG)
{
#if defined (_WIN64)
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam);
#else
SetWindowLong(hwndDlg, GWL_USERDATA, lParam);
#endif
wchar_t versionText[128] = {0};
BuildVersionString(versionText);
SetDlgItemText(hwndDlg, IDC_LAMEVERSION, versionText);
if (lParam)
{
configwndrec *wc = (configwndrec*)lParam;
// -1=none, 0=default, 1=old, 2=new, 3=mtrh, 4=abr
SendDlgItemMessageW(hwndDlg, IDC_VBRMETHOD, CB_ADDSTRING, 0, (LPARAM)L"CBR");
SendDlgItemMessageW(hwndDlg, IDC_VBRMETHOD, CB_ADDSTRING, 0, (LPARAM)L"VBR default");
SendDlgItemMessageW(hwndDlg, IDC_VBRMETHOD, CB_ADDSTRING, 0, (LPARAM)L"VBR old");
SendDlgItemMessageW(hwndDlg, IDC_VBRMETHOD, CB_ADDSTRING, 0, (LPARAM)L"VBR new");
SendDlgItemMessageW(hwndDlg, IDC_VBRMETHOD, CB_ADDSTRING, 0, (LPARAM)L"VBR mtrh");
SendDlgItemMessageW(hwndDlg, IDC_VBRMETHOD, CB_ADDSTRING, 0, (LPARAM)L"ABR");
SendDlgItemMessageW(hwndDlg, IDC_VBRMETHOD, CB_SETCURSEL, wc->cfg.vbr_method + 1, 0);
//0=stereo,1=jstereo,2=mchannel,3=mono
SendDlgItemMessageW(hwndDlg, IDC_STEREOMODE, CB_ADDSTRING, 0, (LPARAM)WASABI_API_LNGSTRINGW(IDS_STEREO));
SendDlgItemMessageW(hwndDlg, IDC_STEREOMODE, CB_ADDSTRING, 0, (LPARAM)WASABI_API_LNGSTRINGW(IDS_JOINT_STEREO));
SendDlgItemMessageW(hwndDlg, IDC_STEREOMODE, CB_ADDSTRING, 0, (LPARAM)WASABI_API_LNGSTRINGW(IDS_MULTI_CHANNEL));
SendDlgItemMessageW(hwndDlg, IDC_STEREOMODE, CB_ADDSTRING, 0, (LPARAM)WASABI_API_LNGSTRINGW(IDS_MONO));
SendDlgItemMessageW(hwndDlg, IDC_STEREOMODE, CB_SETCURSEL, wc->cfg.stereo_mode, 0);
{
int i = 0;
while (g_valid_bitrates[i] > 0)
{
wchar_t buf[64] = {0};
StringCchPrintf(buf, 64, L"%d", g_valid_bitrates[i]);
SendDlgItemMessage(hwndDlg, IDC_BITRATE , CB_ADDSTRING, 0, (LPARAM)buf);
SendDlgItemMessage(hwndDlg, IDC_MAXBITRATE, CB_ADDSTRING, 0, (LPARAM)buf);
SendDlgItemMessage(hwndDlg, IDC_AVGBITRATE, CB_ADDSTRING, 0, (LPARAM)buf);
SendDlgItemMessage(hwndDlg, IDC_BITRATE , CB_SETITEMDATA, i, g_valid_bitrates[i]);
SendDlgItemMessage(hwndDlg, IDC_MAXBITRATE, CB_SETITEMDATA, i, g_valid_bitrates[i]);
SendDlgItemMessage(hwndDlg, IDC_AVGBITRATE, CB_SETITEMDATA, i, g_valid_bitrates[i]);
i++;
};
i = 0;
while (g_valid_bitrates[i] > 0)
{
if (g_valid_bitrates[i] == wc->cfg.bitrate ) SendDlgItemMessage(hwndDlg, IDC_BITRATE , CB_SETCURSEL, i, 0);
if (g_valid_bitrates[i] == wc->cfg.abr_bitrate ) SendDlgItemMessage(hwndDlg, IDC_AVGBITRATE, CB_SETCURSEL, i, 0);
if (g_valid_bitrates[i] == wc->cfg.vbr_max_bitrate) SendDlgItemMessage(hwndDlg, IDC_MAXBITRATE, CB_SETCURSEL, i, 0);
i++;
}
}
SendDlgItemMessageW(hwndDlg, IDC_QUALITY, CB_ADDSTRING, 0, (LPARAM)WASABI_API_LNGSTRINGW(IDS_NORMAL));
SendDlgItemMessageW(hwndDlg, IDC_QUALITY, CB_ADDSTRING, 0, (LPARAM)WASABI_API_LNGSTRINGW(IDS_LOW));
SendDlgItemMessageW(hwndDlg, IDC_QUALITY, CB_ADDSTRING, 0, (LPARAM)WASABI_API_LNGSTRINGW(IDS_HIGH));
SendDlgItemMessageW(hwndDlg, IDC_QUALITY, CB_ADDSTRING, 0, (LPARAM)WASABI_API_LNGSTRINGW(IDS_VOICE));
SendDlgItemMessageW(hwndDlg, IDC_QUALITY, CB_ADDSTRING, 0, (LPARAM)WASABI_API_LNGSTRINGW(IDS_R3MIX));
SendDlgItemMessageW(hwndDlg, IDC_QUALITY, CB_ADDSTRING, 0, (LPARAM)WASABI_API_LNGSTRINGW(IDS_VERY_HIGH));
SendDlgItemMessageW(hwndDlg, IDC_QUALITY, CB_ADDSTRING, 0, (LPARAM)L"--alt-preset standard");
SendDlgItemMessageW(hwndDlg, IDC_QUALITY, CB_ADDSTRING, 0, (LPARAM)L"--alt-preset fast standard");
SendDlgItemMessageW(hwndDlg, IDC_QUALITY, CB_ADDSTRING, 0, (LPARAM)L"--alt-preset extreme");
SendDlgItemMessageW(hwndDlg, IDC_QUALITY, CB_ADDSTRING, 0, (LPARAM)L"--alt-preset fast extreme");
SendDlgItemMessageW(hwndDlg, IDC_QUALITY, CB_ADDSTRING, 0, (LPARAM)L"--alt-preset insane");
SendDlgItemMessageW(hwndDlg, IDC_QUALITY, CB_ADDSTRING, 0, (LPARAM)L"--alt-preset abr");
SendDlgItemMessageW(hwndDlg, IDC_QUALITY, CB_ADDSTRING, 0, (LPARAM)L"--alt-preset cbr");
SendDlgItemMessageW(hwndDlg, IDC_QUALITY, CB_ADDSTRING, 0, (LPARAM)L"--alt-preset medium");
SendDlgItemMessageW(hwndDlg, IDC_QUALITY, CB_ADDSTRING, 0, (LPARAM)L"--alt-preset fast medium");
SendDlgItemMessageW(hwndDlg, IDC_QUALITY, CB_SETCURSEL, wc->cfg.quality, 0);
int x;
for (x = 0; x < 10; x ++)
{
wchar_t buf[123] = {0};
StringCchPrintfW(buf, 123, L"%d%s", x, x == 0 ? WASABI_API_LNGSTRINGW(IDS_HIGH_BRACKET) : x == 9 ? WASABI_API_LNGSTRINGW(IDS_LOW_BRACKET) : L"");
SendDlgItemMessageW(hwndDlg, IDC_VBRQ, CB_ADDSTRING, 0, (LPARAM)buf);
}
SendDlgItemMessage(hwndDlg, IDC_VBRQ, CB_SETCURSEL, wc->cfg.vbr, 0);
SendMessage(hwndDlg, WM_USER + 666, 0, 0);
}
}
if (uMsg == WM_COMMAND)
{
if (LOWORD(wParam) == IDC_VBRMETHOD && HIWORD(wParam) == CBN_SELCHANGE)
SendMessage(hwndDlg, WM_USER + 666, 0, 0);
if (LOWORD(wParam) == IDC_QUALITY && HIWORD(wParam) == CBN_SELCHANGE)
SendMessage(hwndDlg, WM_USER + 667, 0, 0);
}
if (uMsg == WM_DESTROY)
{
#if defined (_WIN64)
configwndrec *wc = (configwndrec*)SetWindowLongPtr(hwndDlg, GWLP_USERDATA, 0);
#else
configwndrec* wc = (configwndrec*)SetWindowLong(hwndDlg, GWL_USERDATA, 0);
#endif
if (wc)
{
wc->cfg.bitrate = (int)SendDlgItemMessage(hwndDlg, IDC_BITRATE , CB_GETITEMDATA, SendDlgItemMessage(hwndDlg, IDC_BITRATE , CB_GETCURSEL, 0, 0), 0);
wc->cfg.vbr_max_bitrate = (int)SendDlgItemMessage(hwndDlg, IDC_MAXBITRATE, CB_GETITEMDATA, SendDlgItemMessage(hwndDlg, IDC_MAXBITRATE, CB_GETCURSEL, 0, 0), 0);
wc->cfg.abr_bitrate = (int)SendDlgItemMessage(hwndDlg, IDC_AVGBITRATE, CB_GETITEMDATA, SendDlgItemMessage(hwndDlg, IDC_AVGBITRATE, CB_GETCURSEL, 0, 0), 0);
int vbr_meth = (int)SendDlgItemMessage(hwndDlg, IDC_VBRMETHOD, CB_GETCURSEL, 0, 0);
if (vbr_meth == CB_ERR) vbr_meth = 0;
wc->cfg.vbr_method = vbr_meth - 1;
wc->cfg.stereo_mode = (int)SendDlgItemMessage(hwndDlg, IDC_STEREOMODE, CB_GETCURSEL, 0, 0);
wc->cfg.quality = (int)SendDlgItemMessage(hwndDlg, IDC_QUALITY, CB_GETCURSEL, 0, 0);
wc->cfg.vbr = (int)SendDlgItemMessage(hwndDlg, IDC_VBRQ, CB_GETCURSEL, 0, 0);
writeconfig(wc->configfile, &wc->cfg);
free(wc);
}
}
return 0;
}
HWND __declspec(dllexport) ConfigAudio3(HWND hwndParent, HINSTANCE hinst, unsigned int outt, char*configfile)
{
if (outt == mmioFOURCC('M', 'P', '3', 'l'))
{
configwndrec *wr = (configwndrec*)malloc(sizeof(configwndrec));
if (configfile) lstrcpynA(wr->configfile, configfile, MAX_PATH);
else wr->configfile[0] = 0;
readconfig(configfile, &wr->cfg);
GetLocalisationApiService();
return WASABI_API_CREATEDIALOGPARAMW(IDD_MP3, hwndParent, DlgProc, (LPARAM)wr);
}
return NULL;
}
int __declspec(dllexport) SetConfigItem(unsigned int outt, wchar_t*item, char *data, char* configfile)
{
if (outt == mmioFOURCC('M', 'P', '3', 'l'))
{
configtype cfg;
readconfig(configfile, &cfg);
if (!lstrcmpi(item, L"bitrate")) // assume CBR bitrate
{
cfg.abr_bitrate = cfg.bitrate = atoi(data);
cfg.vbr_method = -1;
}
writeconfig(configfile, &cfg);
return 1;
}
return 0;
}
int __declspec(dllexport) GetConfigItem(unsigned int outt, wchar_t *item, wchar_t *data, int len, char* configfile)
{
if (outt == mmioFOURCC('M', 'P', '3', 'l'))
{
configtype cfg;
readconfig(configfile, &cfg);
if (!lstrcmpi(item, L"bitrate"))
{
int bitrate;
if(cfg.vbr_method == -1) bitrate = cfg.bitrate;
else if(cfg.vbr_method == 4) bitrate = cfg.abr_bitrate;
else bitrate = (cfg.bitrate + cfg.vbr_max_bitrate) / 2;
StringCchPrintf(data,len,L"%d",bitrate);
}
return 1;
}
return 0;
}
void __declspec(dllexport) SetWinampHWND(HWND hwnd)
{
winampwnd = hwnd;
// this is called when the encoder is needed (and is slightly better than the dllmain loading from before)
/*if (!g_lamedll)
{
if (!lamedll[0])
{
PathCombineW(lamedll, (wchar_t*)SendMessage(hwnd, WM_WA_IPC, 0, IPC_GETSHAREDDLLDIRECTORYW),L"lame_enc.dll");
}
g_lamedll = LoadLibraryW(lamedll);
}*/
/*if (g_lamedll)
{
beInitStream = (BEINITSTREAM) &beInitStream;
beCloseStream = (BECLOSESTREAM) GetProcAddress(g_lamedll, TEXT_BECLOSESTREAM);
beEncodeChunk = (BEENCODECHUNK) GetProcAddress(g_lamedll, TEXT_BEENCODECHUNK);
beDeinitStream = (BEDEINITSTREAM) GetProcAddress(g_lamedll, TEXT_BEDEINITSTREAM);
beWriteVBRHeader = (BEWRITEVBRHEADER) GetProcAddress(g_lamedll, TEXT_BEWRITEVBRHEADER);
beVersion = (BEVERSION) GetProcAddress(g_lamedll, TEXT_BEVERSION);
beEncodeChunkFloatS16NI = (BEENCODECHUNKFLOATS16NI)GetProcAddress(g_lamedll, TEXT_BEENCODECHUNKFLOATS16NI);
}*/
}
};

View file

@ -0,0 +1,57 @@
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by enc_lame.rc
//
#define IDS_BITRATE 0
#define IDS_ABR_MIN_BITRATE 1
#define IDS_VBR_MIN_BITRATE 2
#define IDS_N_A 3
#define IDS_ABR_MAX_BITRATE 4
#define IDS_VBR_MAX_BITRATE 5
#define IDS_AVERAGE_BITRATE 6
#define IDS_STEREO 7
#define IDS_JOINT_STEREO 8
#define IDS_MULTI_CHANNEL 9
#define IDS_MONO 10
#define IDS_NORMAL 11
#define IDS_LOW 12
#define IDS_HIGH 13
#define IDS_VOICE 14
#define IDS_R3MIX 15
#define IDS_VERY_HIGH 16
#define IDS_HIGH_BRACKET 17
#define IDS_LOW_BRACKET 18
#define IDS_ENC_LAME_DESC 19
#define IDS_ENC_LAME_DESC_MISSING 20
#define IDD_MP3 102
#define IDD_MP3_MISSING 105
#define IDC_BITRATE 1000
#define IDC_VBR 1001
#define IDC_QUALITY 1002
#define IDC_JSTEREO1 1003
#define IDC_JSTEREO2 1004
#define IDC_BITRATE_TEXT1 1004
#define IDC_MAXBITRATE 1005
#define IDC_BITRATE_TEXT2 1006
#define IDC_MAXBITRATE_TEXT1 1007
#define IDC_MAXBITRATE_TEXT2 1008
#define IDC_VBRMETHOD 1009
#define IDC_AVGBITRATE_TEXT1 1010
#define IDC_AVGBITRATE 1011
#define IDC_AVGBITRATE_TEXT2 1012
#define IDC_STEREOMODE 1013
#define IDC_VBRQ_TEXT 1014
#define IDC_VBRQ 1015
#define IDC_LAMEVERSION 1016
#define IDC_URL1 1026
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 106
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1017
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif

View file

@ -0,0 +1,39 @@
/////////////////////////////////////////////////////////////////////////////
//
// Version
//
#include "../../../Winamp/buildType.h"
VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,38,0,0
PRODUCTVERSION WINAMP_PRODUCTVER
FILEFLAGSMASK 0x17L
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x4L
FILETYPE 0x2L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904b0"
BEGIN
VALUE "CompanyName", "Winamp SA"
VALUE "FileDescription", "Winamp Encoder Plug-in"
VALUE "FileVersion", "1,38,0,0"
VALUE "InternalName", "Nullsoft MP3 Encoder"
VALUE "LegalCopyright", "Copyright © 2006-2023 Winamp SA"
VALUE "LegalTrademarks", "Nullsoft and Winamp are trademarks of Winamp SA"
VALUE "OriginalFilename", "enc_lame.dll"
VALUE "ProductName", "Winamp"
VALUE "ProductVersion", STR_WINAMP_PRODUCTVER
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END