Skip to Content

Building 0.9.4 release on Win32 - how to properly compile with Portaudio?

17 replies [Last post]
Joined: 04/17/2010

I am attempting to build the 2009 Sep 14 - Hydrogen 0.9.4 RELEASED build (hydrogen-0.9.4.tar.gz) on Windows XP. I have been able to compile and run the main Hydrogen.exe program, but I haven't figured out how to properly compile Portaudio support.

I understand that Windows isn't supported at all (except for the 20060309 experimental build), so perhaps the 2009 Sep 14 - Hydrogen 0.9.4 RELEASED doesn't have the necessary code to compile with Portaudio support in Win32. That said, I would still like to try to work it out, if it is possible.

Does anyone have any ideas on properly compiling with Portaudio support?

In the old guide it says the following:

"For portaudio: Get and put the "portaudio" folder in your hydrogen folder."

I wasn't sure where to put this folder. I tried several locations without success. Does this mean put the extracted "portaudio" folder in the main hydrogen-0.9.4 folder (containing Sconstruct and Or is it supposed to be in another location.

I attempting to use the with qmake and mingw32-make.

In the next post, I will detail the steps I am following to get a running build with no sound. Please let me know if you have any suggestions to get Portaudio working.

Joined: 04/17/2010

I started out from the guide and made a few changes along the way.

1. I used the 2009 Sep 14 sources from the main download page:

2. I installed the QTCreator bundle and added QT and mingw32 to my path.

3. Installed pthreads as described and linked on the following page. Probably redundant, but I also installed duplicate copies of the files in the /mingw32 subfolders as well as /mingw.

4. Installed libarchive to:

C:\Program Files\GnuWin32\

I did have to edit C:\Program Files\GnuWin32\include\archive_entry.h Line 325:


LIBARCHIVE_DLL_IMPEXP struct archive_entry_linkresolver;


struct archive_entry_linkresolver;

5. Install libsndfile to:

C:\Program Files\Mega-Nerd\libsndfile

6. I wasn't able to find Linux version.cpp and config.h files, so I attempted to create them manually copying from Sconstruct.

(Note that my Qt path in on D: rather than the default C:. Change your file to match your own installation path, if you're following along.)

*This may be where I left out something to include Portaudio. Please let me know if there is a line I can add to this file for Portaudio. I would also appreciate if someone could post a link or copy of their Linux version.cpp and config.h files.


#ifndef HYD_CONFIG_H
#define HYD_CONFIG_H



#define CONFIG_PREFIX "D:\Qt\hydrogen-0.9.4"
#define DATA_PATH "D:\Qt\hydrogen-0.9.4\data"



#include "version.h"
#include "config.h"

static const std::string VERSION = "0.9.4";
std::string get_version() { return VERSION; }

7a. Following the guide, I did disable portaudio the first time through. After that, I made the following edits in an attempt to get portaudio working: win32 section, near line 30:

INCLUDEPATH += ../portaudio

near line 35:

LIBS += "D:\Qt\2010.02.1\mingw\bin\portaudio_x86.dll"

features.pri win32 section, line 51:


7b.Downloaded rev 2552 06/20/08 and put it in:


I also use this portaudio_x86.dll file in the final running hydrogen.exe folder.

7c. Downloaded portaudio and put the extracted \portaudio folder into the main hydrogen-0.9.4 folder

7d. from the extracted folder I copied portaudio\include\portaudio.h as well as the other "win" files to the mingw\include and mingw32\include folders.

* Did I put the portaudio folder in the wrong location? Should it be in another subfolder?

* Will using the rev2552 portaudio_x86.dll in the mingw folder as well as the final hydrogen.exe running folder cause a conflict with the 20071207 source?

8. I edited gui\src\PlaylistEditor\PlaylistDialog.cpp to comment out lines 163 -173 (addSongBTN to clearPlBTN), to avoid "not declared in this scope" errors.

9. around line 33 updated to reflect my paths to .dlls

LIBS += "C:\Program Files\GnuWin32\lib\libarchive.lib"
LIBS += "D:\Qt\2010.02.1\mingw\lib\libpthread.a"
LIBS += "D:\Qt\2010.02.1\mingw\bin\libsndfile-1.dll"

10. manually edited in patches from patches\portaudio.patch to:


11. In QTCreator I opened the did "Run qmake"

12. from the command prompt in the hydrogen directory I entered:


Alternatively, I also tried Build All in QTCreator with the same result.

13a. I copied the resulting folders and file to a new program folder:


13b. I added various dlls from the previously downloaded files and packages

from C:\Program Files\Mega-Nerd\libsndfile


from C:\Program Files\GnuWin32\bin


from D:\Qt\2010.02.1\qt\bin

downloaded from
(I also tried renaming it to just portaudio.dll without success.)

downloaded from via the link
(I wondered if this might need to be renamed or if I should use an older version, since the old 2006 build comes with pthreadGC1.dll)

14. THAT'S IT. Running Hydrogen.exe launches the program and it seems to run, but there is no sound. Going into Preferences, Audio System and selecting PortAudio shows a "Not Compiled" message.

Any suggestions on where to go from here to get portaudio compiling and working right? What's the correct path for the extracted \portaudio folder? Which files do I need in \mingw and/or \mingw32? What changes do I need in config.h?

Thanks for your help.

Almost forgot to mention, I do get this warning during the compile:

src\hydrogen.cpp: In function 'void H2Core::audioEngine_seek(long long int, bool)':
src\hydrogen.cpp:590: warning: unknown conversion type character 'l' in format
src\hydrogen.cpp:590: warning: format '%d' expects type 'int', but argument 3 has type 'long long int'
src\hydrogen.cpp:590: warning: too many arguments for format

Joined: 03/30/2010

Hi Marney!!

I build hydrogen with portaudio support some weeks ago, but portaudio couldn't find a device and refused to work.
I can send you more instruction when i'm at my windows pc, but that is not before tuesday evening.
First of all, you have to enable the portaudio support by defining "PORTAUDIO_SUPPORT" in the qmake files. Just look for JACK_SUPPORT or other related defines to get that done..
I think you have already done the other steps (adding the portaudio folder to the includes and link against portaudio.dll)

Joined: 04/17/2010

Thanks for your reply, mauser. From your results, it sounds like portaudio support may not work at all with the 0.9.4 Release build on Windows.

I would still appreciate your specific advice and details on properly compiling hydrogen with portaudio. I look forward to hearing from you next week when you can access your Windows PC.

* Is this what you mean by defining PORTAUDIO_SUPPORT or do I need to edit defines in other files?

features.pri win32 section, line 51:


(uncommented, by removing #)

I also tried moving the \portaudio folder (full extracted contents of pa_stable_v19_20071207.tar.gz) to the following folder:


in I added these lines:

INCLUDEPATH += ../libs/hydrogen/include/portaudio

LIBS += "D:\Qt\2010.02.1\mingw\bin\portaudio_x86.dll"

* Is that the correct location? If not, what is the correct path?

* Do I have to run qmake and mingw32-make in the \portaudio folder first, before running qmake and mingw32-make in the main hydrogen directory?

I also added the same \portaudio folder to (although this is probably wrong):


As before I have copied the following files to my Qt folder (also to mingw32):


Even with these changes, the PortAudio Driver still does not work and says "Not Compiled".

I look forward to hearing exactly the process you used to include Portaudio, such as your exact file edits, full path for the extracted \portaudio folder and the placement of all portaudio files in the \qt and \mingw folders.

Thank you.

Joined: 04/17/2010

>> "I can send you more instruction when i'm at my windows pc, but that is not before tuesday evening. "

Sebastian, please let me know if you had a chance to look at your Windows project files.

I would appreciate as much detail as possible on all filenames and edits you made to the hydrogen files, as well as the exact paths for placing all the portaudio related paths in the hydrogen folder as well as mingw and Qt folders.

Any notes you might have on properly including FLAC support in the compile would also be a big help.

Joined: 04/17/2010

Hi marney

are you building the windows version for your own needs, or do you plan to take it a step further by also posting your windows binary here (or even better : place it on the hydrogen site) ?

i know that there have been questions from windows users asking when a new build would be available, so i think you would make a lot of people happy :-)

and probably even more so if you would build a 0.9.5 windows binary (not for every time a fix is checked in of course, but just as a snapshot now and then)

i'll keep an eye on this thread !


Joined: 04/17/2010

I definitely intend to share what I come up with, if it works at all. That's why I already posted a detailed guide, so those inclined can duplicate the steps I followed without all the trial-and-error pitfalls.

I can get by with the 2006 build with all its quirks, but I thought it would be nice to see if the Release build would be a bit more stable and resolve some of the other issues with the older build.

Don't get your hopes up though. mauser seems to be the expert and if he hasn't had any luck, I'm not sure I have much chance of making it work.

Right now, I'm just thinking about trying to get somewhat functional, if that's even possible. I haven't even considered looking at 0.9.5 yet.

Joined: 03/30/2010

Hey Marney!

Can you drop me your mailadress? My adress: I'm going to mail the qmake files to you, the upload here is a little bit buggy.

Joined: 04/17/2010

Thanks, Sebastian. I sent you an email.

Please also send any other files you had to edit for proper portaudio support. Also let me know the exact paths you used for the portaudio source folder, .dll and related .h header files.

Joined: 03/30/2010


good luck with those files!! I'm not an expert at all on windows. I'm not using it a lot..
You could also try to build it with jack support on windows. My problem was that jack did not run on windows - it had problems with my soundsystem...

Joined: 04/17/2010

Thanks very much for sending the details of your Windows build and your project files.

I will start looking through them and see if I can make any progress towards a partially working 0.9.4(.1) Release build on Windows.

I will post updates when and if I have any success. Of course, I will also share the program files if I manage to build anything worthwhile.

Joined: 04/17/2010

Thanks again, Sebastian. Working from your files, I was able to successfully compile Release with Portaudio support. It does play sound with .wav only drum kits. I didn't test much but the basic functions seem to work, edit patterns, songs, load and save, etc.

Now, I've been trying to enable FLAC support without any luck.

I am seeing compile errors such as these:


../libs/liblibhydrogen.a(flac_file.o): In function `FLACFile_real':
D:\Qt\hydrogen-\libs\hydrogen/src/flac_file.cpp:71: undefined reference t
o `FLAC::Decoder::File::File()'


le_realE[vtable for H2Core::FLACFile_real]+0x10): undefined reference to `FLAC::
Decoder::Stream::is_valid() const'


le_realE[vtable for H2Core::FLACFile_real]+0xb0): undefined reference to `FLAC::
Decoder::File::init_ogg(std::string const&)'


I have enabled FLAC support in the features.pri

win32 {

I'm using which contains:

.h headers in:


.dll, .lib and _static.lib in:


I put this /flac-1.2.1-win folder in my /hydrogen project root folder and tried to duplicate the includes that made Portaudio work.

I've tried variations of absolute and relative links with includes. I've tried including .lib, _static.lib and .dll individually and in combination, but nothing seems to work.

in and I have tried various combinations like these:

INCLUDEPATH += ../../flac-1.2.1-devel-win/include
INCLUDEPATH += ../../flac-1.2.1-devel-win/lib
INCLUDEPATH += ../../flac-1.2.1-devel-win

win32 {
LIBS += "D:\Qt\hydrogen-\flac-1.2.1-devel-win\lib\libFLAC.dll"
LIBS += "D:\Qt\hydrogen-\flac-1.2.1-devel-win\lib\libFLAC++.dll"
LIBS += "D:\Qt\hydrogen-\flac-1.2.1-devel-win\lib\libFLAC.lib"
LIBS += "D:\Qt\hydrogen-\flac-1.2.1-devel-win\lib\libFLAC++.lib"
LIBS += "D:\Qt\hydrogen-\flac-1.2.1-devel-win\lib\libFLAC_static.lib"
LIBS += "D:\Qt\hydrogen-\flac-1.2.1-devel-win\lib\libFLAC++_static.lib"
LIBS += "D:\Qt\hydrogen-\flac-1.2.1-devel-win\lib\ogg_static.lib

I also tried variations on the includes in flac_file.cpp, such as:

#include "FLAC/all.h"
#include "FLAC++/all.h"
#include "ogg/ogg.h"



I didn't try any of these, but I see the commented out section in

#old windows libs..
#LIBS += ../libflac++.lib ../libflac++_dynamic.lib ../libflac++_static.lib ../libflac.lib winmm.lib
#LIBS += ../libflac++_static.lib ../libflac_static.lib winmm.lib
#LIBS += ../optarg.lib
#LIBS += ../ogg_static.lib

The old 20060309 build does have FLAC support and it seems to be static, since there are no FLAC .dlls with the installed Hydrogen.exe.

Does anyone have any ideas about including these FLAC .dll and/or .lib files?

Joined: 04/17/2010

After many hours and trying many different approaches, I finally have basic FLAC support working. I spent most of my time trying to get Flac 1.2.1 working without success, but I tried an older version 1.1.3 and that seems to work for basic playback. I'm not sure if there will be any compatibility problems with files created with a newer FLAC version.

I welcome any suggestions on getting FLAC 1.2.1 to work. Right now I'm stuck on the following error:

Qt\2010.02.1\mingw\lib\libFLAC.a(bitreader.o): In function `bitreader_read_fr
c:\flac-1.2.1\src\libFLAC/bitreader.c:274: undefined reference to `ntohl@4'

This may be solved by "-lws2_32" in the .pro, Makefile or qmake.conf, but I haven't been able to get it working yet.

wolke's picture
Joined: 03/30/2010

witch libsndfile do you use.
all versions >=1.0.18 have flac file support.

i/you can rewrite the sample.cpp, that hydrogen use libsndfile to read flac samples.
this will remove all direct dependences to libflac.

what ever, its a tip.

Joined: 04/17/2010

I'm using libsndfile-1.0.21-w32.

>all versions >=1.0.18 have flac file support.

> i/you can rewrite the sample.cpp, that hydrogen use libsndfile to
> read flac samples.
> this will remove all direct dependences to libflac.

Thanks for the suggestion. I do have FLAC 1.1.3 working now without re-writing code. So, I will probably keep using that, rather than attempting to re-write code unless it starts to cause playback problems. I'm just learning Qt and C++, so my skills are very basic.

Joined: 04/17/2010

I have FLAC 1.2.1 support now working after patching a number of the FLAC source files to compile with MinGW.

Joined: 04/17/2010


would you please post this patch? I'll go insane here with the same problem.



wolke's picture
Joined: 03/30/2010

hehe, try this...
h2 0.9.5 win32 bin
*ladspa support (experimental, only a few plugins work as expected)
*compiled with portaudio 18 (no delay as in the 19 build)
*flac and ogg support (import / export)

export also allow to export each instrument which is in use, as his own audio file.

enjoy all new 0.9.5 features including undo/redo for pattern- and songe-editor.

no installation required. just decompress the zip file and double click the hydrogen.exe.

happy windows drumming