README.vs2019.txt
1# README for compiling LAME with Visual Studio 2019
2
3This document describes how to compile the LAME projects using Visual Studio
42019. Any edition will do, even the free Community edition. Be sure to install
5the "Desktop development with C++" workload.
6
7## Projects
8
9There are two solution files in the "lame/vc_solution" folder that can be
10opened. 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
18The 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
24In the two solutions there are several configurations that can be used to
25compile 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
32The vs2019_lame.sln solution has both Win32 and x64 platforms configured, in
33order to compile lame.exe and the libmp3lame.dll for 32-bit or 64-bit target
34platforms. The output folder also has separate folders for the two platforms.
35Note that mp3rtp and mp3x are not compiled in x64. Also note that all 64-bit
36processors have SSE2 instructions, so the /arch:SSE2 option is ignored for
37this platform.
38
39## External libraries and tools
40
41For some projects, external libraries or tools are necessary for successful
42compilation. These can be configured using .props files or the Property Manager
43window of Visual Studio (View > Other Windows > Property Manager). The props
44files have a "User Macros" page where the variable values can be changed.
45
46### NASM
47
48The Netwide Assembler is used to compile assembly routines contained in the
49.nas files. The most recent version of NASM can be downloaded here:
50https://nasm.us/
51
52Extract the zip archive in any folder. Open the file
53"lame/vc_solution/vs2019_arch_nasm.props" and edit the `NasmPath` in the first
54few lines of the file, ending the path with a backslash. As described above,
55you can also use the Property Manager view to change the values.
56
57Note that NASM is only used when selecting the "ReleaseNASM" configuration.
58
59### libsndfile
60
61LAME can be compiled with the libsndfile library for audio input. Libsndfile
62can be downloaded here:
63http://mega-nerd.com/libsndfile/#Download
64
65Install the Win32 installer into any folder, or (if available) extract
66pre-release versions (e.g. libsndfile-1.0.29pre1-w32.zip) into any folder.
67
68Open the file "lame/vc_solution/vs2019_lame_config.props" and edit the
69following 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
77As described above, you can also use the Property Manager view to change the
78values.
79
80Note that when compiling for the x64 platform, you have to use the 64-bit
81version of libsndfile. Alternatively you can use the `HaveLibsndfile` as is
82(the default value is `.\libsndfile\$(Platform)\`) and extract the zip
83archives for 32-bit and 64-bit into the "vc_solution\libsndfile\Win32\" and
84"vc_solution\libsndfile\x64\" folders.
85
86### mpg123
87
88From LAME version 3.100.1 on, LAME supports decoding using the external mpg123
89library, which is a mature fork of the internally used mpglib library. The
90latest binaries for Win32 and x64 are available here:
91https://mpg123.de/
92
93Open the file "lame/vc_solution/vs2019_libmpg123_config.props" and edit the
94following 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
104As described above, you can also use the Property Manager view to change the
105values.
106
107Note that when compiling for the x64 platform, you have to use the 64-bit
108version of libmpg123. Alternatively you can use the `HaveMpg123` as is
109(the default value is `.\mpg123\$(Platform)\`) and extract the zip
110archives for 32-bit and 64-bit into the "vc_solution\mpg123\Win32\" and
111"vc_solution\mpg123\x64\" folders.
112
113### GTK1
114
115The mp3x graphical frame analyzer uses GTK1 for the user interface. One of the
116few still available ports to Windows is "GTK1 for Windows", which can be used
117to compile mp3x. You can download version 1.4 here:
118https://sourceforge.net/projects/gtk1-win/
119
120Extract the zip archive in any folder. Open the file
121"lame/vc_solution/vs2019_gtk_config.props" and edit the `WinGtkPath` in the
122first few lines of the file, ending the path with a backslash.
123
124As described above, you can also use the Property Manager view to change the
125values.
126
127Note that compiling mp3x for 64-bit platforms is currently not available.
128
129### Windows SDK 7.1
130
131For the DirectShow filter, the Windows SDK 7.1 is needed, especially the
132samples folder where a multimedia base class library must be compiled before.
133
134Download the Windows SDK 7.1 installer from here:
135https://www.microsoft.com/en-us/download/details.aspx?id=8279
136(or search for "Microsoft Windows SDK for Windows 7 and .NET Framework 4",
137version 7.1)
138
139When starting the web setup, you can choose the installation options. Only the
140"Samples" under "Windows Native Code Development" is actually necessary.
141
142Open 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
144backslash. As described above, you can also use the Property Manager view to
145change the values.
146
147In the Win71SdkPath path, locate the solution file
148"Samples\multimedia\directshow\baseclasses\baseclasses.sln", convert it from
149the old Visual Studio project format and compile the "Debug_MBCS" and
150"Release_MBCS" configurations. The resulting files strmbasd.lib and
151strmbase.lib are used by the lame_DirectShow project for linking.
152