| 1 |
# README for compiling LAME with Visual Studio 2019 |
| 2 |
|
| 3 |
This document describes how to compile the LAME projects using Visual Studio |
| 4 |
2019. Any edition will do, even the free Community edition. Be sure to install |
| 5 |
the "Desktop development with C++" workload. |
| 6 |
|
| 7 |
## Projects |
| 8 |
|
| 9 |
There are two solution files in the "lame/vc_solution" folder that can be |
| 10 |
opened. The solution "vs2019_lame.sln" contains the following projects: |
| 11 |
|
| 12 |
- lame: The lame.exe command line executable |
| 13 |
- libmp3lame: The dynamic library libmp3lame.dll |
| 14 |
- libmp3lame-static: The static library variant of the above |
| 15 |
- mp3rtp: command line tool to stream mp3 via RTP protocol |
| 16 |
- mp3x: mp3 frame analyzer tool using GTK1 (see below) |
| 17 |
|
| 18 |
The solution "vs2019_lame_clients.sln" contains several more projects: |
| 19 |
|
| 20 |
- ACM, ADbg, tinyxml: Ancient Windows "Audio Codec Manager" |
| 21 |
- lame_DirectShow: DirectShow filter |
| 22 |
- lame_test: Test program |
| 23 |
|
| 24 |
In the two solutions there are several configurations that can be used to |
| 25 |
compile different flavors of LAME libraries and executables: |
| 26 |
|
| 27 |
- Debug: Builds without optimization, but debugging support |
| 28 |
- Release: Optimization build, without SSE2 or NASM assembly |
| 29 |
- ReleaseNASM: Uses NASM (see below) to compile some routines using NASM |
| 30 |
- ReleaseSSE2: Uses SSE2 assembler instructions to optimize routines |
| 31 |
|
| 32 |
The vs2019_lame.sln solution has both Win32 and x64 platforms configured, in |
| 33 |
order to compile lame.exe and the libmp3lame.dll for 32-bit or 64-bit target |
| 34 |
platforms. The output folder also has separate folders for the two platforms. |
| 35 |
Note that mp3rtp and mp3x are not compiled in x64. Also note that all 64-bit |
| 36 |
processors have SSE2 instructions, so the /arch:SSE2 option is ignored for |
| 37 |
this platform. |
| 38 |
|
| 39 |
## External libraries and tools |
| 40 |
|
| 41 |
For some projects, external libraries or tools are necessary for successful |
| 42 |
compilation. These can be configured using .props files or the Property Manager |
| 43 |
window of Visual Studio (View > Other Windows > Property Manager). The props |
| 44 |
files have a "User Macros" page where the variable values can be changed. |
| 45 |
|
| 46 |
### NASM |
| 47 |
|
| 48 |
The Netwide Assembler is used to compile assembly routines contained in the |
| 49 |
.nas files. The most recent version of NASM can be downloaded here: |
| 50 |
https://nasm.us/ |
| 51 |
|
| 52 |
Extract the zip archive in any folder. Open the file |
| 53 |
"lame/vc_solution/vs2019_arch_nasm.props" and edit the `NasmPath` in the first |
| 54 |
few lines of the file, ending the path with a backslash. As described above, |
| 55 |
you can also use the Property Manager view to change the values. |
| 56 |
|
| 57 |
Note that NASM is only used when selecting the "ReleaseNASM" configuration. |
| 58 |
|
| 59 |
### libsndfile |
| 60 |
|
| 61 |
LAME can be compiled with the libsndfile library for audio input. Libsndfile |
| 62 |
can be downloaded here: |
| 63 |
http://mega-nerd.com/libsndfile/#Download |
| 64 |
|
| 65 |
Install the Win32 installer into any folder, or (if available) extract |
| 66 |
pre-release versions (e.g. libsndfile-1.0.29pre1-w32.zip) into any folder. |
| 67 |
|
| 68 |
Open the file "lame/vc_solution/vs2019_lame_config.props" and edit the |
| 69 |
following two user macro parameters: |
| 70 |
|
| 71 |
- The value of `HaveLibsndfile` can be set to false or true, and specifies if |
| 72 |
the libsndfile library is available and used in lame.exe |
| 73 |
- `LibsndfilePath` specifies the path to the root folder of libsndfile, ending |
| 74 |
the path with a backslash. The folder should contain the `include`, `lib` |
| 75 |
and `bin` folders. |
| 76 |
|
| 77 |
As described above, you can also use the Property Manager view to change the |
| 78 |
values. |
| 79 |
|
| 80 |
Note that when compiling for the x64 platform, you have to use the 64-bit |
| 81 |
version of libsndfile. Alternatively you can use the `HaveLibsndfile` as is |
| 82 |
(the default value is `.\libsndfile\$(Platform)\`) and extract the zip |
| 83 |
archives for 32-bit and 64-bit into the "vc_solution\libsndfile\Win32\" and |
| 84 |
"vc_solution\libsndfile\x64\" folders. |
| 85 |
|
| 86 |
### mpg123 |
| 87 |
|
| 88 |
From LAME version 3.100.1 on, LAME supports decoding using the external mpg123 |
| 89 |
library, which is a mature fork of the internally used mpglib library. The |
| 90 |
latest binaries for Win32 and x64 are available here: |
| 91 |
https://mpg123.de/ |
| 92 |
|
| 93 |
Open the file "lame/vc_solution/vs2019_libmpg123_config.props" and edit the |
| 94 |
following two user macro parameters: |
| 95 |
|
| 96 |
- The value of `HaveMpg123` can be set to false or true, and specifies if |
| 97 |
the libmpg123 library is available and used in lame.exe and libmp3lame.dll. |
| 98 |
When set to false, decoding is not available in LAME. This includes |
| 99 |
calculating accurate Replaygain by decoding the just encoded data on-the-fly. |
| 100 |
- `Mpg123Path` specifies the path to the root folder of mpg123, ending |
| 101 |
the path with a backslash. The folder should contain the `mpg123.h` and |
| 102 |
`libmpg123-0.dll` files, among others. |
| 103 |
|
| 104 |
As described above, you can also use the Property Manager view to change the |
| 105 |
values. |
| 106 |
|
| 107 |
Note that when compiling for the x64 platform, you have to use the 64-bit |
| 108 |
version of libmpg123. Alternatively you can use the `HaveMpg123` as is |
| 109 |
(the default value is `.\mpg123\$(Platform)\`) and extract the zip |
| 110 |
archives for 32-bit and 64-bit into the "vc_solution\mpg123\Win32\" and |
| 111 |
"vc_solution\mpg123\x64\" folders. |
| 112 |
|
| 113 |
### GTK1 |
| 114 |
|
| 115 |
The mp3x graphical frame analyzer uses GTK1 for the user interface. One of the |
| 116 |
few still available ports to Windows is "GTK1 for Windows", which can be used |
| 117 |
to compile mp3x. You can download version 1.4 here: |
| 118 |
https://sourceforge.net/projects/gtk1-win/ |
| 119 |
|
| 120 |
Extract the zip archive in any folder. Open the file |
| 121 |
"lame/vc_solution/vs2019_gtk_config.props" and edit the `WinGtkPath` in the |
| 122 |
first few lines of the file, ending the path with a backslash. |
| 123 |
|
| 124 |
As described above, you can also use the Property Manager view to change the |
| 125 |
values. |
| 126 |
|
| 127 |
Note that compiling mp3x for 64-bit platforms is currently not available. |
| 128 |
|
| 129 |
### Windows SDK 7.1 |
| 130 |
|
| 131 |
For the DirectShow filter, the Windows SDK 7.1 is needed, especially the |
| 132 |
samples folder where a multimedia base class library must be compiled before. |
| 133 |
|
| 134 |
Download the Windows SDK 7.1 installer from here: |
| 135 |
https://www.microsoft.com/en-us/download/details.aspx?id=8279 |
| 136 |
(or search for "Microsoft Windows SDK for Windows 7 and .NET Framework 4", |
| 137 |
version 7.1) |
| 138 |
|
| 139 |
When starting the web setup, you can choose the installation options. Only the |
| 140 |
"Samples" under "Windows Native Code Development" is actually necessary. |
| 141 |
|
| 142 |
Open the file "lame/vc_solution/vs2019_win71sdk_config.props" and edit the |
| 143 |
`Win71SdkPath` in the first few lines of the file, ending the path with a |
| 144 |
backslash. As described above, you can also use the Property Manager view to |
| 145 |
change the values. |
| 146 |
|
| 147 |
In the Win71SdkPath path, locate the solution file |
| 148 |
"Samples\multimedia\directshow\baseclasses\baseclasses.sln", convert it from |
| 149 |
the old Visual Studio project format and compile the "Debug_MBCS" and |
| 150 |
"Release_MBCS" configurations. The resulting files strmbasd.lib and |
| 151 |
strmbase.lib are used by the lame_DirectShow project for linking. |