[Media_api] Portmidi installation problems

Peter Castine pcastine at gmx.net
Fri Apr 20 13:38:18 PDT 2007


Hi Fran,

I've only just been going through the Windows stuff. Whenever the  
list archive for April is available you'll be able to see the  
correspondence.-

> First thing. I don't have MS Visual Studio 6, I've got the .Net  
> edition (7.1). Windows XP.

OK, my experience is w/VS 2005 Express, Net 2, yadayada. I think I  
had to install the Windows SDK on top of the std Express install to  
access the W Multimedia stuff.

 From there my experience was like yours with following differences:

> 2)  unzip portmidi.zip into directory: <...>\portmidi
>
> Ok.

Make sure you have mm.vcproj (or mm.dsp & mm.dsw or mm.something...).  
If they aren't in the .zip archive you'll have to ask Roger to send  
them to you (or I suppose I can send the copies he sent me). I  
believe the plan was to update the .zip to include the mm.* files  
that were inadverdently omitted.

> 4)  start or click on the portmidi.dsw workspace
>
> ERRORS!

With VS 2005 I was able to open the .dsw file, and VS generated  
new .sln & .vcproj versions of these documents. It was only after the  
conversion that I got compaints about the .dsp being corrupted, so my  
suspicion is the Visual Studio did the corrupting. Anyway, once I got  
my portmidi.sln and *.vcproj files, I trashed the *.dsp's since  
they're not needed anymore.

But I did have .dsp's in the download. I think.

> After this it loads the project. Well, I don't need the examples so  
> let's try to go with portmidi, portaudio and pm_dll which are the  
> things I'm interested in.

I would build the test programs just to make sure that the project is  
working.

You need to build the pm_dll first, because the other projects rely  
on it (they need pm_dll.lib to link and pm_dll.dll to run).

> 5)  the following projects exist within this workspace:
>     - portmidi (the PortMidi library)
>     - pm_dll (the dll library used to close midi ports on program  
> exit)
>     - porttime (a small portable library implementing timer  
> facilities)
>     - test (simple midi I/O testing)
>     - multithread (an example illustrating low-latency MIDI processing
>             using a dedicated low-latency thread)
>     - sysex (simple sysex message I/O testing)
>     - latency (uses porttime to measure system latency)
>
> Well, the first three exists and the rest are unavailable...

Dunno, I got all eight.

> 6)  verify that all project settings are for Win32 Debug release:
>     - type Alt-F7
>     - highlight all three projects in left part of Project Settings
                       ~~~~~

The docs need to be updated: there are eight projects.

> window;
>     - "Settings For" should say "Win32 Debug"
>
> Ok.

On VS 2005 these are actually two separate popups, one for the Debug/ 
Release config, one for the Win32 architecture. Not a biggy.

> 7)  use Build->Batch Build ... to build everything in the project

Again, the menu structure has changed. I just hit F7 to build the  
entire "solution", which is easy enough.

> Some warnings and a couple of these errors:
>
> c:\msys\1.0\etc\portmidi17Jan07\portmidi\pm_common\portmidi.c 
> (1002): error C2039: 'queue' : is not a member of 'pm_internal_struct'
>         c:\msys\1.0\etc\portmidi17Jan07\portmidi\pm_common 
> \pminternal.h(98) : see declaration of 'pm_internal_struct'

You must #define NEWBUFFER.

I did: select portmidi in Solution Explorer; Properties; Expand  
Configuration Properties, Expand C/C++; edit Preprocessor Definitions  
to add NEWBUFFER (and _CRT_SECURE_NO_DEPRECATE and  
USE_DLL_FOR_CLEANUP while you're at it). They don't need explicit  
values, they just need to be defined.

The alternative would be to surround all the flagged error lines in

#ifdef NEWBUFFER
	...
#endif

blocks, but who knows what would happen?

> Probably I'm missing some documentation somewhere or some forum

The above is the first documentation in the forum that I'm aware of.  
I had promised a few days ago to post my experiences when I got PM  
running on Windows, so here they are.

I would also add that I have now have PM working inside my own .NET  
2.0 Forms application. (Yes, Aaron, somehow it does work!).

The main things:

0) It's tempting to assume that because there is this this pm_dll  
thing you'll have all of PortMIDI available through the DLL. Ain't  
so. The pm_dll is *only* to provide a backup mechanism releasing  
system resources in the (un?)likely event that your app crashes.  
Nothing more!  So you still have to add all the pm_*.* and pt*.*  
files to your project.

1) Make sure "Configuration: All Configurations" is selected in all  
of the following Properties modifications!

2) In my case the project defaulted to compiling all .c files with  
the C++ compiler, which was disastrous. I had to go to set Properties  
for each file, to wit: Expand Configuration Properties, Expand C/C++,  
Select Advanced, set the Compile As popup to Compile as C Code (/TC).  
(For better or worse, the project I inherited has a bunch of .c files  
that rely on C++ features, so I couldn't reliably set this the  
project properties level.)

3) While you're there, make sure that the C/C++ -> General ->  
"Compile with Common Language Runtime support" is set to "No Common  
Language Runtime support" (the C compiler *can't* support CLR, but VS  
won't do anything useful like automatically set the two options to  
match)-.

4) I never got VS precompiled header thing to work sensibly, so I  
took the path of least resistance and turned PCH's off for all my  
files. Properties -> Configuration Properties -> C/C++ -> Precompiled  
Headers -> Create/Use Precompiled Header popup set to "Not Using  
Precompiled Headers". The compiler is reasonably fast even if it has  
to parse all the header files, so unless someone wants to explain  
VS's PCHs to me, the hell with it, I say.

I think that was it.

Please let us know how it works with QuickTime.

Buena suerte!
--Peter

--------------    http://www.bek.no/~pcastine/Litter/    -------------
Peter Castine             +--> Litter Power & Litter Bundle for Jitter
                                Universal Binaries on the way
iCE:  Sequencing,  Recording &
       Interface  Building  for                   |home    | chez nous|
       Max/MSP   Extremely cool                   |bei uns |  i nostri|
       http://www.dspaudio.com/                   http://www.castine.de




More information about the media_api mailing list