Problem compiling external on Windows
Hello everybody,
I'm working with files that was written several years ago on other Windows versions. I have to compile an external in order to start my real work, but I'm not an expert in C programming.
I've tried to compile the DLL with both Visual C++ 2008 and MinGW. I'm not Trying to compile helloworld.c but another file (M2M~.c) that I have to work with. I have many header files (.h) associated with M2M~.c.
With Visual C++ 2008, I have done exactly the same thing than middlepedal but I cannot compile, I have an error message such as (this is in french) :
Édition des liens en cours...
LINK : error LNK2001: symbole externe non résolu M2M~_setup
C:\Users\Teaiki\Documents\Visual Studio 2008\Projects\M2M~\Debug\M2M~.lib : fatal error LNK1120: 1 externes non résolus
Is there a great différence between Visual C++ 2008 and Visual C++ 2005?
With MinGW, I have done exactly the same thing than AlbertoZ, and I have a lot of error message such as : "undefined reference to ..."
What should I do?
Can someone help me please?
Thank you in advance
Teaiki
Collaboration on a patch
I have been working on an audio to midi patch for a while and have kind of put it on hold for a bit since i have been working on some other stuff but i think a collaboration on this would be great just to get it working a bit better
im on a macbook 10.4.11
it works best with something plugged right into it rather than a mic but with the right threshold level a mic works just fine
you can test to make sure you have a good connection with 1 of the three synths collected
or just set the midi out right away and go for it
whammybar plus frequency synth in the patch = fun bendyness
whammybar plus midi output = not quite as awesome but still effective
this really makes me want to build my own synth in PD so i wouldn't have to use midi but maybe thats still to come
anyway the patch works for me so lets just go from there
this idea and a good stutter patch are the reason i got into pure data and now i have worked on both yay for these forums
Paul
Problem compiling external on Windows
Hey,
thanks to everyone who responded to my posts both here and in the mailing list. Since then, I've figured out how to compile externals written in C using Microsoft Visual C++ 2005. There's more to document, however, such as how to compile externals using some of the other Windows compilers (Borland, djgpp, etc.), and also how to compile externals written in C++ in Windows. But one thing at a time.
one little thing to note... steps 4 and 7 may seem a little roundabout, but they account for the fact that MSVC sometimes has trouble with spaces in directory names (eg. C://Program Files/). If anyone knows how to override this behavior, post a reply, and I'll try to simplify the steps accordingly.
Updated June 29, 2007:
use [b]C://Progra~1/[/b] instead of [b]C://Program Files/[/b],
use [b]C://Docume~1/[/b] instead of [b]C://Documents and Settings/[/b], etc.
So, without further ado...
How to compile a pd external written in C using Microsoft Visual C++ 2005:
Compared to Windows, linux offers a much more user-friendly environment for compiling pd externals. However, with a little patience, a usable environment can be set up in Windows, and the good news is that everything you need is available for free. There are several reputable Windows-compatible C/C++ compilers out there, but here I'll discuss compiling externals with Microsoft Visual C++ 2005 (MSVC for short).
1. Download and Install Microsoft Visual C++ 2005 Express Edition.
a. Click the link above, then click Go! in the Visual C++ box.
b. Run vcsetup.exe to install the program
(the setup wizard should guide you through the process).
2. Download [url=http://download.microsoft.com/download/7/7/3/7737290f-98e8-45bf-9075-85cc6ae34bf1/VS80sp1-KB9267
]Visual C++ 2005 Express Service Pack 1.
a. Click the link above to download the Service Pack.
b. Run VS80sp1-KB926748-X86-INTL.exe to install the program.
3. Create a new project:
a. Open Visual C++.
b. Open the New Project window (Ctrl+Shift+N).
c. In the Project Types pane, select Visual C++.
d. In the Templates pane, select emptyproj.
e. Enter object name (helloworld).
f. Leave Create directory for solution unchecked, and click OK.
4. Import the pd header file:
a. Get m_pd.h here, or, using pd-vanilla (not pd-extended):
1. Open Windows Explorer or My Computer.
2. Navigate to the pd/src/ directory on your system.
3. Open m_pd.h in a text editor (file type is: C/C++ header).
b. Select all (Ctrl+A).
c. Copy selection to the clipboard (Ctrl+C).
d. Back in Visual C++, open the New File window (Ctrl+N).
e. In the Categories pane, select General.
f. In the Templates pane, select Text File, and click Open.
g. Copy the contents of m_pd.h into the editor window (Ctrl+V).
h. Open the Save File As Window (Ctrl+S).
i. Save as m_pd.h.
j. From the File Menu, select Move m_pd.h into; select helloworld.
5. Write the source code for the external in C.
a. Open the New File window (Ctrl+N).
b. In the Categories pane, select General.
c. In the Templates pane, select Text File, and click Open.
d. Write your source code in the editor window.
The following example is taken from the tutorial by Johannes M. Zmoelnig.
#include "m_pd.h"
static t_class *helloworld_class;
typedef struct _helloworld {
t_object x_obj;
} t_helloworld;
void helloworld_bang(t_helloworld *x)
{
post("Hello world !!");
}
void *helloworld_new(void)
{
t_helloworld *x = (t_helloworld *)pd_new(helloworld_class);
return (void *)x;
}
void helloworld_setup(void) {
helloworld_class = class_new(gensym("helloworld"),
(t_newmethod)helloworld_new,
0, sizeof(t_helloworld),
CLASS_DEFAULT, 0);
class_addbang(helloworld_class, helloworld_bang);
}
6. Save and import the source code into the project:
a. Open the Save File As Window (Ctrl+S).
b. Save as helloworld.c.
c. From the File Menu, select Move helloworld.c into; select helloworld.
7. Access the pd library file:
a. Open Windows Explorer or My Computer.
b. Navigate to the pd/bin/ directory on your system.
c. Right-click on pd.lib (file type is: Object File Library) and select Copy.
d. Navigate to the C://TEMP/ directory on your system.
e. Paste the copy of pd.lib in the C://TEMP/ directory (right-click or Ctrl-V).
8. Set configuration properties:
a. Set configuration type to .dll:
1. Back in Visual C++, open the helloworld Property Pages window (Alt+F7).
2. In the left pane, select Configuration Properties >> General.
3. In the right pane, under Project Defaults, click on
Configuration Type, and select Dynamic Library (.dll)
(using the arrow on the right).
b. Add MSW to preprocessor definitions:
1. In the left pane, select
Configuration Properties >> C/C++ >> Preprocessor.
2. In the right pane, type MSW in the Preprocessor Definitions field.
c. Tell compiler which language to use:
1. In the left pane, select
Configuration Properties >> C/C++ >> Advanced.
2. In the right pane, select Compile As.
3. Select Compile as C Code (/TC) by clicking the arrow on the right.
d. Tell linker where to find pd.lib:
1. In the left pane, select Configuration Properties >> Linker >> Input.
2. In the right pane, select Additional Dependencies and enter
C://TEMP/pd.lib.
e. Tell linker to export the setup function:
1. In the left pane, select
Configuration Properties >> Linker >> Command Line.
2. In the right pane, type
/export:helloworld_setup in the Additional options field.
3. Click OK.
9. Compile and link:
a. Use the Build Solution command (F7).
10. Copy the new helloworld.dll file into pd.
a. Open Windows Explorer or My Computer.
b. Navigate to the
My Documents/Visual Studio 2005/Projects/helloworld/Debug/
directory on your system.
c. Right-click on helloworld.dll (file type is: Application Extension)
and select Copy.
d. Navigate to the pd/extra directory on your system.
e. Paste the copy of helloworld.dll in the pd/extra directory
(right-click or Ctrl-V).
11. Test the external in pd.
a. the external should now be a useable object in pd.
b. open a new pd patch and try to create a helloworld object.
c. add a bang to the left inlet and test it out.
d. if the main pd console window displays "Hello world !!",
the external has succeeded.
Hope this helps!
-- middlepedal
Reactivision simple fiducial marker patch
@cerupcat said:
I tried uncompressing the .gz but the dktable file inside didn't do anything.
It's just a standard tarball (tar file, that is gz compressed) you can open them in Windows with 7zip (freeware) or winrar. I thought Winzip did it, too. Either way, I just put it in a zip file and attached it.
@cerupcat said:
I understand throw~ and catch~ but aren't getting a visual how this is working to route from one thing to another.
sound_base (in the zip) is the code that does the audio-routing. There is one in every module, and it just connects the throw~ to whatever number you send to it (16-in in this case) each module also has a catch~ that can be routed.
@cerupcat said:
For example if you only have an osc~ it'll go to dac~ and if there's two filters it'd go osc~ -> filter1~ -> filter2~ -> dac~ for example. Not getting a visual of how you're doing that yet. I'll have to reread what you wrote. How many fiducials are you currently using or setup for?
Well, that's the problem. I'd like them to just check if the center is closest, or some other module, but this requires that all the modules be checked on every update (unless there is some magic that has escaped me, which I don't doubt) I started working on the actual TuioClient, because it runs really fast in C++. But right now, there is no routing other then connecting to dac~. The patches I made illustrate a sub-system that could be used for more advanced routing, once I get the TuioClient modified (I think I'm close to finished with this part)
@cerupcat said:
That looks helpful. I couldn't get it to work (looks like I'm missing some stuff) but it looks interesting. I couldn't find the forum, but I will look at the patches.
@cerupcat said:
I may end up using reactivision to do some things on a multitouch screen I'm building. I'm probably going to do the visuals in processing, flash, or vvvv though. Do you know what software they used for the reactable? I can't remember if they said if it was all done in C++ or not.
I'm not sure, either. I know that the visuals were done in C++, but I'm not sure about the sound part. For my project, I'd like to keep it in pd, as much as possible, as I think it's powerful enough to do most things I want to do, while being really easy to work with.
OPEN technologies workshop, Zaragoza, Spain, June 26th - July 1st
OPEN technologies workshop, Zaragoza, Spain, June 26th - July 1st
http://www.0j0.org/pmwiki/index.php/Events/GohanDevelopmentJun07
******* FREE WORKSHOP ANNOUNCEMENT *******
Arduino, Pd, and Processing are becoming more and more intertwined. Sensors controlling software synthesis, robots controlled by video tracking, custom musical instruments, and more. We are a collection of developers working with these free software tools. Join us to work on projects of these combinations, or help us create new possibilities by bringing these tools ever more intertwined.
This event is a combination of a hacklab and a barcamp. We are following the ad hoc, participant-driven nature of the barcamp in combination with the collaborative work studio environment of a hacklab. If you have not been to a hacklab, barcamp, and/or unconference before, here are a couple of good references to get an idea of the way it is done:
BarCamp on wikipedia: http://en.wikipedia.org/wiki/BarCamp
There will be workshops and talks, and plenty of time to work together. We will all be working together to create projects which will then be exhibited in Zaragoza. Bring one or more of the following: ideas, projects, a desire to learn, a desire to teach. Come everyday to pick up skills and finish your project. Come whenever you can to learn new bits and pieces, and help build compelling things to exhibit!
Dates & Location:
June 26th (Tuesday) - July 1st (Sunday)
Centro de Historia
Pl. San Agustín 2
50002 Zaragoza - Spain
http://www.zaragoza.es/centrodehistoria/
Team - Guest developers:
* Hans-Christoph Steiner, Pd, Polytechnic University, community management
* Emanuele Roman, Processing, visual representation[visio imaginorum sonus est]
* XÄ, Pd, electronic music
Team - Resident developers:
* David Cuartielles from Arduino
* Marcos Yarza from Libelium, physical interfaces
Join us! Just sign up on the register page!
http://www.0j0.org/pmwiki/index.php/Jun07/Register
If you live near Zaragoza and are willing to host people, please mark that on the registration page. If you want to come and need a place to stay, contact people on the registration page who marked themselves as hosts.
.hc
Fuck i love pd
hi brett, that track is still up on my site. for some reason the link comes out as a .pd file not an .mp3
http://www.m-pi.com/this-is-serious-mum.mp3
just cut and paste that and it will work.
also heaps of stuff here: http://www.m-pi.com/remixes
>It's weird that many ppl seem to be using pd but that the output~ page in the forum still has threads in it from 2004 in the top page!! <
it took me a few months of solid patching (a few hours every day) to get a workable setup for actually making tracks. it's certainly no small undertaking.
>I'm pretty new to pd and just working my way through tutorials at the moment, but do you have any tips with regard to actually going about customising your own setup?<
you are on the right track going through the tutorials. the way i did it was first to build stuff to cut up and effect samples, and then secondly make a system to control those processes live. mine was all based on the [key] command, and i just triggered everythign from my laptop's qwerty keyboard. this was nice when i was travellign as it meant i didn't need to cart any gear around. also good for playing live cos i could pick my computer up and jam on the dancefloor. there are a few options though, especially triggering stuff with sensors and such. but i'm sticking with the bare bones keyboard approach cos it works for me well enough.
> like whether to keep lots of separate instruments or try to keep everything under one roof...<
i try to keep my stuff in one patch as much as possible. a couple of reasons for that, but the main one for me was that i kept modifying abstractions and then other patches that relied on those abstractions would stop working. generally much easier just to have one or two or a few patches to do everythign you need. even if you incorporate everything you make into one patch it doesn't get too big. usually well under 1 meg.
>I think I will tend to mainly use samplers and control structures for controlling my external Midi gear, but in a live setup, not sure how to integrate it into Logic Pro?<
my thinking on this is that if you have a guitar it has 4 or 5 strings, and you manipulate those strings in a variety of ways to make most of the sounds you need. if you listen to my audio..all of that is just 2 or at most 3 channels! so i always have only 2 or 3 samples playing at once. my stuff from back then was a bit light..not really hard hitting on a dancefloor (which is what i'm interested in) ..but i think you do what to keep everythign as minimal as possible. as far as live performance goes, i wouldn't go anywhere near something like logic audio.
if you have midi gear, then def work on triggering that with pd. i'm working on synthesis within pd now, rather than the sample based stuff...but it's a constant battle to keep cpu usage to a minimum. triggering external devices will be no problem for pd and will leave you heaps of cpu for doing sample mashing.
can't stress enough though. KEEP IT AS SIMPLE AS POSSIBLE. for live music, traditional musicians only play one instrument at once. if you want to make whole songs live, then you are going to have to do the beats and bass and interesting stuff all at one time, so you want to keep it as simple as possible so that you can inject a lot of liveness into it. generally, the more channels of audio you have going at once, the less room there is for jamming out in an impromptu fashion....unless you have magic fingers.
>Look forward to hearing your stuff if possible.<
cool, thanks. quick background on my stuff..."this_is_serious_mum" is a live jam recorded in one take. just 2 channels of audio driving all the sounds from small sample loops being cut up in realtime by me pressing keys on the keyboard. it's a super simple setup, but i think the reason why it works ok is that i spent more time actually playing and practicing than i spent on coding the bastard. i toured across europe and japan and australia playing this stuff and it was generally well recieved. at really good gigs it was the biggest rush ever.
so yeah. good luck. grab the bull by the horns and just go for it.
Cheers,
matt
Announce: mmm-0.1.0-eden
hi forum.
we proudly announce the first public release of our compact composer
for pd, mmm.
grab it at http://netpd.org/mmm-0.1.0.zip
mmm is best described in it's faq, see below. don't expect too much
yet, there is still a lot to be done. comments, bugreports, cash, are
welcome.
have fun with it!
christopher charles & enrique erne
faq for mmm-0.1.0 - eden
what is mmm?
mmm is a pd patch collection aimed at providing a studiolike(?),
streamlined, dynamic interface for making synthetic music.
screenshots?
http://www.netpd.org/mmm.png
ymmv depending on your operating system. we put some effort in
detecting the operating system and setting the fontsize according to
it, but quirky xorg or dpi settings might screw things up again.
where can i get it?
we currently host the mmm at http://netpd.org/mmm-0.1.0.zip ,
alternatively, you can grab netpd, enter the chat, and if either of
the authors is online, download it directly through netpd and start
rocking.
what does "mmm" stand for?
mmm was originally just the working title, but we came to like it
somehow. the original meaning is "music making machine" but you can
substitute every m for whatever you want. so "massive multiplayer
music" is okay with us, too.
what is the inspiration?
having worked on/with the bagoftricks (lots inconsistently coloured
gop-patches to be connected freely) and netpd (lots of
inconsistent-looking windows to clutter up the screen), we came to
mock up an clean, dynamic interface in which modules don't bring their
own gop or open their own window, but log onto the interface that's
provided for them by the motherpatch. all modules sharing the same
interface made it easy for them to share the same sequencer and
arranger.
what are the dependencies?
mmm should work with pd-0.39 and zexy installed. iemlib is important
for many synth and effects patches, and there's even set of gem
modules you can chain if you want.
is it actually usable?
no. this 0.1.0 release is rather a tech demo and a taste of things to
potentially come. you can crunch some acid loops out of it already,
but don't sell your protools studio equipment to start working with
mmm on monday.
how does it work?
mmm's interface (mmmmain.pd) is divided into 3 parts: there is the
module/channel view, where you can chain up synths and effects on 8
different channels. select an empty field on a channel, and then use
the scrollbox on the left to select a patch and open it. when clicking
on a patch you loaded up in the module view, the 2nd view comes into
play: from there you control the patch's sliders on the left, right of
it is the stepsequencer for each of the slider (means everything is
sequencable!). yet you won't hear anything until you did the following
2 things: press play in the uppermost row of mmmmain, and set up the
arranger to play the stepsequence. the arranger is not module-based,
but controls all modules of a channel are grouped in the arranger. for
now, you can only select pattern 01 or nothing to play in the
arranger. so set up a loop for the first pattern (loopstart:0,
looplength:1) set the first field on the channel you got your patch on
in the arranger to p01 and start making some noise.
does it work online?
yes. mmm is compatible to netpd and will automatically log on to
netpd's server if you have the netpd chat open. you can also download
the whole mmm package through netpd. feel free to jam around the
world.
what's not working yet / what is planned?
as for now, there is no support for samples whatsoever, it isn't
planned to support them soon. further, there is no hard disk recorder
available yet, but it is planned. the arranger/sequencer combo is very
crippled at the moment, only supporting 1 16-step-pattern to choose
from and 1 page of 16 patterns in the arranger. this will change
rather soon. next there are plans for luxury editing functions,
especially in the sequencer like copy, paste, random pattern,
interpolation and so on. plans exist for full keyboard control, but
this will be worked on not too soon. the module roster is far from
being complete yet, more is to come.
can i save my stuff?
should be possible with the buttons above the channels. don't rely on
the result though, this is still 0.1.0
can i add my own modules?
modules are not to hard to write, but for now, the list of selectable
modules is hardcoded. look at all the 4m-* patches in the patches
folder to see how they are ticking. contact us for adding your patch
to the mmm or try to figure out yourself how it works
what's the license?
mmm is licensed under the gnu lgpl. if you think this is a too useful
product to be free of charge, please consider donating the amount of
money you would've paid for it (or the amount of money you got from
selling your protools equipment on monday) to a trust of your choice.
who are the authors?
mmm is developed by enrique erne (eni, swiss, pd{at}mild.ch) and
christopher charles (syntax_tn, germany, chr.m.charles{at}gmail.com).
we can be contacted via email, irc (#dataflow) or directly in the
netpd chat. several patches within mmm are based upon netpd versions
of them, check netpd for the original authors. mmm shares some of it's
netcode with netpd, by roman haefeli.
disclaimer.
we cannot give you any guarantees on using mmm, not even that you
have fun. it should be relatively harmless, but don't come crying to
us if mmm accidently hijacks your *mule and downloads david hasslehoff
recordings to your computer.
eofaq