Update of /cvsroot/pure-data/pd/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17715
Modified Files:
Tag: impd_0_37
m_pd.h m_sched.c s_audio.c s_entry.c s_main.c
Added Files:
Tag: impd_0_37
makefile.vstwin s_audio_vst.c
Log Message:
impdvst available on windows (-DVST) use makefile.vstwin
Index: m_pd.h
===================================================================
RCS file: /cvsroot/pure-data/pd/src/m_pd.h,v
retrieving revision 1.1.1.4.2.10.2.3
retrieving revision 1.1.1.4.2.10.2.4
diff -C2 -d -r1.1.1.4.2.10.2.3 -r1.1.1.4.2.10.2.4
*** m_pd.h 12 Apr 2004 04:46:45 -0000 1.1.1.4.2.10.2.3
--- m_pd.h 17 Apr 2004 21:17:30 -0000 1.1.1.4.2.10.2.4
***************
*** 597,600 ****
--- 597,640 ----
EXTERN void c_addmess(t_method fn, t_symbol *sel, t_atomtype arg1, ...);
+ #ifdef VST
+ /* jsarlo { */
+ EXTERN double sys_time;
+ EXTERN double sys_time_per_dsp_tick;
+ EXTERN int sys_externalschedlib;
+
+ EXTERN t_sample* get_sys_soundout();
+ EXTERN t_sample* get_sys_soundin();
+ EXTERN int* get_sys_main_advance();
+ EXTERN double* get_sys_time_per_dsp_tick();
+ EXTERN int* get_sys_schedblocksize();
+ EXTERN double* get_sys_time();
+ EXTERN float* get_sys_dacsr();
+ EXTERN int* get_sys_sleepgrain();
+ EXTERN int* get_sys_schedadvance();
+
+ EXTERN void sys_clearhist();
+ EXTERN void sys_initmidiqueue();
+ EXTERN int sys_addhist(int phase);
+ EXTERN void sys_setmiditimediff(double inbuftime, double outbuftime);
+ EXTERN void sched_tick(double next_sys_time);
+ EXTERN void sys_pollmidiqueue();
+ EXTERN int sys_pollgui();
+ EXTERN void sys_setchsr(int chin, int chout, int sr);
+
+ EXTERN void inmidi_noteon(int portno, int channel, int pitch, int velo);
+ EXTERN void inmidi_controlchange(int portno,
+ int channel,
+ int ctlnumber,
+ int value);
+ EXTERN void inmidi_programchange(int portno, int channel, int value);
+ EXTERN void inmidi_pitchbend(int portno, int channel, int value);
+ EXTERN void inmidi_aftertouch(int portno, int channel, int value);
+ EXTERN void inmidi_polyaftertouch(int portno,
+ int channel,
+ int pitch,
+ int value);
+ /* } jsarlo */
+ #endif
+
#define t_getbytes getbytes
#define t_freebytes freebytes
--- NEW FILE: s_audio_vst.c ---
/* PdVst v0.0.2 - VST - Pd bridging plugin
** Copyright (C) 2004 Joseph A. Sarlo
**
** This program is free software; you can redistribute it and/orsig
** modify it under the terms of the GNU General Public License
** as published by the Free Software Foundation; either version 2
** of the License, or (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** jsarlo(a)ucsd.edu
*/
#define _WIN32_WINDOWS 0x410
#include <windows.h>
#include <io.h>
#include <stdio.h>
#include "m_pd.h"
#include "../../source/pdvst/pdvstTransfer.h"
#define MAXARGS 1024
#define MAXSTRLEN 1024
#define TIMEUNITPERSEC (32.*441000.)
typedef struct _vstParameterReceiver
{
t_object x_obj;
t_symbol *x_sym;
}t_vstParameterReceiver;
t_vstParameterReceiver *vstParameterReceivers[MAXPARAMETERS];
t_class *vstParameterReceiver_class;
char *pdvstTransferMutexName,
*pdvstTransferFileMapName,
*vstProcEventName,
*pdProcEventName;
pdvstTransferData *pdvstData;
HANDLE vstHostProcess,
pdvstTransferMutex,
pdvstTransferFileMap,
vstProcEvent,
pdProcEvent;
int tokenizeCommandLineString(char *clString, char **tokens)
{
int i, charCount = 0;
int tokCount= 0;
int quoteOpen = 0;
for (i = 0; i < (signed int)strlen(clString); i++)
{
if (clString[i] == '"')
{
quoteOpen = !quoteOpen;
}
else if (clString[i] == ' ' && !quoteOpen)
{
tokens[tokCount][charCount] = 0;
tokCount++;
charCount = 0;
}
else
{
tokens[tokCount][charCount] = clString[i];
charCount++;
}
}
tokens[tokCount][charCount] = 0;
tokCount++;
return tokCount;
}
void parseArgs(int argc, char **argv)
{
int vstHostProcessId;
while ((argc > 0) && (**argv == '-'))
{
if (strcmp(*argv, "-vsthostid") == 0)
{
vstHostProcessId = atoi(argv[1]);
vstHostProcess = OpenProcess(PROCESS_ALL_ACCESS,
FALSE,
vstHostProcessId);
if (vstHostProcess == NULL)
{
exit(1);
}
argc -= 2;
argv += 2;
}
if (strcmp(*argv, "-mutexname") == 0)
{
pdvstTransferMutexName = argv[1];
argc -= 2;
argv += 2;
}
if (strcmp(*argv, "-filemapname") == 0)
{
pdvstTransferFileMapName = argv[1];
argc -= 2;
argv += 2;
}
if (strcmp(*argv, "-vstproceventname") == 0)
{
vstProcEventName = argv[1];
argc -= 2;
argv += 2;
}
if (strcmp(*argv, "-pdproceventname") == 0)
{
pdProcEventName = argv[1];
argc -= 2;
argv += 2;
}
else
{
argc--;
argv++;
}
}
}
void setPdvstGuiState(int state)
{
t_symbol *tempSym;
tempSym = gensym("rvstopengui");
if (tempSym->s_thing)
{
pd_float(tempSym->s_thing, (float)state);
}
}
int setPdvstFloatParameter(int index, float value)
{
t_symbol *tempSym;
char string[1024];
sprintf(string, "rvstparameter%d", index);
tempSym = gensym(string);
if (tempSym->s_thing)
{
pd_float(tempSym->s_thing, value);
return 1;
}
else
{
return 0;
}
}
void sendPdVstFloatParameter(t_vstParameterReceiver *x, t_float floatValue)
{
int index;
index = atoi(x->x_sym->s_name + strlen("svstParameter"));
WaitForSingleObject(pdvstTransferMutex, INFINITE);
pdvstData->vstParameters[index].type = FLOAT_TYPE;
pdvstData->vstParameters[index].direction = PD_SEND;
pdvstData->vstParameters[index].updated = 1;
pdvstData->vstParameters[index].value.floatData = floatValue;
ReleaseMutex(pdvstTransferMutex);
}
void makePdvstParameterReceivers()
{
int i;
char string[1024];
for (i = 0; i < MAXPARAMETERS; i++)
{
vstParameterReceivers[i] = (t_vstParameterReceiver *)pd_new(vstParameterReceiver_class);
sprintf(string, "svstparameter%d", i);
vstParameterReceivers[i]->x_sym = gensym(string);
pd_bind(&vstParameterReceivers[i]->x_obj.ob_pd, gensym(string));
}
}
void send_dacs(void)
{
int i, j, sampleCount, nChannels, blockSize;
t_sample *soundin, *soundout;
soundin = get_sys_soundin();
soundout = get_sys_soundout();
nChannels = pdvstData->nChannels;
blockSize = pdvstData->blockSize;
if (blockSize == *(get_sys_schedblocksize()))
{
sampleCount = 0;
for (i = 0; i < nChannels; i++)
{
for (j = 0; j < blockSize; j++)
{
soundin[sampleCount] = pdvstData->samples[i][j];
pdvstData->samples[i][j] = soundout[sampleCount];
soundout[sampleCount] = 0;
sampleCount++;
}
}
}
}
void scheduler_tick( void)
{
sys_addhist(0);
send_dacs();
sys_setmiditimediff(0, 1e-6 * *(get_sys_schedadvance()));
sys_addhist(1);
sched_tick(*(get_sys_time()) + *(get_sys_time_per_dsp_tick()));
sys_addhist(2);
sys_pollmidiqueue();
sys_pollgui();
sys_addhist(3);
}
int HFClock()
{
LARGE_INTEGER freq, now;
QueryPerformanceFrequency(&freq);
QueryPerformanceCounter(&now);
return (int)((now.QuadPart * 1000) / freq.QuadPart);
}
int scheduler()
{
int i,
blockTime,
vstHostProcessStatus = 0,
active = 1;
vstParameterReceiver_class = class_new(gensym("vstParameterReceiver"),
0,
0,
sizeof(t_vstParameterReceiver),
0,
0);
class_addfloat(vstParameterReceiver_class, (t_method)sendPdVstFloatParameter);
makePdvstParameterReceivers();
*(get_sys_time_per_dsp_tick()) = (TIMEUNITPERSEC) * \
((double)*(get_sys_schedblocksize())) / \
*(get_sys_dacsr());
sys_clearhist();
if (*(get_sys_sleepgrain()) < 1000)
{
*(get_sys_sleepgrain()) = *(get_sys_schedadvance()) / 4;
}
if (*(get_sys_sleepgrain()) < 100)
{
*(get_sys_sleepgrain()) = 100;
}
else if (*(get_sys_sleepgrain()) > 5000)
{
*(get_sys_sleepgrain()) = 5000;
}
sys_initmidiqueue();
while (active)
{
WaitForSingleObject(pdvstTransferMutex, INFINITE);
active = pdvstData->active;
// check sample rate
if (pdvstData->sampleRate != (int)sys_getsr())
{
sys_setchsr(pdvstData->nChannels,
pdvstData->nChannels,
pdvstData->sampleRate);
}
// check for vstParameter changed
if (pdvstData->guiState.direction == PD_RECEIVE && \
pdvstData->guiState.updated)
{
setPdvstGuiState((int)pdvstData->guiState.value.floatData);
pdvstData->guiState.updated = 0;
}
for (i = 0; i < pdvstData->nParameters; i++)
{
if (pdvstData->vstParameters[i].direction == PD_RECEIVE && \
pdvstData->vstParameters[i].updated)
{
if (pdvstData->vstParameters[i].type == FLOAT_TYPE)
{
if (setPdvstFloatParameter(i,
pdvstData->vstParameters[i].value.floatData))
{
pdvstData->vstParameters[i].updated = 0;
}
}
}
}
// check for new midi message (VSTi)
if (pdvstData->midiQueueUpdated)
{
for (i = 0; i < pdvstData->midiQueueSize; i++)
{
if (pdvstData->midiQueue[i].messageType == NOTE_ON)
{
inmidi_noteon(0,
pdvstData->midiQueue[i].channelNumber,
pdvstData->midiQueue[i].dataByte1,
pdvstData->midiQueue[i].dataByte2);
}
else if (pdvstData->midiQueue[i].messageType == NOTE_OFF)
{
inmidi_noteon(0,
pdvstData->midiQueue[i].channelNumber,
pdvstData->midiQueue[i].dataByte1,
0);
}
else if (pdvstData->midiQueue[i].messageType == CONTROLLER_CHANGE)
{
inmidi_controlchange(0,
pdvstData->midiQueue[i].channelNumber,
pdvstData->midiQueue[i].dataByte1,
pdvstData->midiQueue[i].dataByte2);
}
else if (pdvstData->midiQueue[i].messageType == PROGRAM_CHANGE)
{
inmidi_programchange(0,
pdvstData->midiQueue[i].channelNumber,
pdvstData->midiQueue[i].dataByte1);
}
else if (pdvstData->midiQueue[i].messageType == PITCH_BEND)
{
int value = (((int)pdvstData->midiQueue[i].dataByte2) * 16) + \
(int)pdvstData->midiQueue[i].dataByte1;
inmidi_pitchbend(0,
pdvstData->midiQueue[i].channelNumber,
value);
}
else if (pdvstData->midiQueue[i].messageType == CHANNEL_PRESSURE)
{
inmidi_aftertouch(0,
pdvstData->midiQueue[i].channelNumber,
pdvstData->midiQueue[i].dataByte1);
}
else if (pdvstData->midiQueue[i].messageType == KEY_PRESSURE)
{
inmidi_polyaftertouch(0,
pdvstData->midiQueue[i].channelNumber,
pdvstData->midiQueue[i].dataByte1,
pdvstData->midiQueue[i].dataByte2);
}
else if (pdvstData->midiQueue[i].messageType == OTHER)
{
// FIXME: what to do?
}
else
{
// FIXME: error?
}
}
pdvstData->midiQueueSize = 0;
pdvstData->midiQueueUpdated = 0;
}
// run at approx. real-time
blockTime = (int)((float)(pdvstData->blockSize) / \
(float)pdvstData->sampleRate * 1000.0);
if (blockTime < 1)
{
blockTime = 1;
}
if (pdvstData->syncToVst)
{
ReleaseMutex(pdvstTransferMutex);
if (WaitForSingleObject(vstProcEvent, 1000) == WAIT_TIMEOUT)
{
// we have probably lost sync by now (1 sec)
WaitForSingleObject(pdvstTransferMutex, 100);
pdvstData->syncToVst = 0;
ReleaseMutex(pdvstTransferMutex);
}
ResetEvent(vstProcEvent);
scheduler_tick();
SetEvent(pdProcEvent);
}
else
{
ReleaseMutex(pdvstTransferMutex);
scheduler_tick();
Sleep(blockTime);
}
GetExitCodeProcess(vstHostProcess, &vstHostProcessStatus);
if (vstHostProcessStatus != STILL_ACTIVE)
{
active = 0;
}
}
return 1;
}
int main(char *flags)
{
int i, argc;
char *argv[MAXARGS];
for (i = 0; i < MAXARGS; i++)
{
argv[i] = (char *)malloc(MAXSTRLEN * sizeof(char));
}
argc = tokenizeCommandLineString(flags, argv);
parseArgs(argc, argv);
pdvstTransferMutex = OpenMutex(MUTEX_ALL_ACCESS, 0, pdvstTransferMutexName);
vstProcEvent = OpenEvent(EVENT_ALL_ACCESS, 0, vstProcEventName);
pdProcEvent = OpenEvent(EVENT_ALL_ACCESS, 0, pdProcEventName);
pdvstTransferFileMap = OpenFileMapping(FILE_MAP_ALL_ACCESS,
0,
pdvstTransferFileMapName);
pdvstData = (pdvstTransferData *)MapViewOfFile(pdvstTransferFileMap,
FILE_MAP_ALL_ACCESS,
0,
0,
sizeof(pdvstTransferData));
WaitForSingleObject(pdvstTransferMutex, INFINITE);
*(get_sys_schedadvance()) = *(get_sys_main_advance()) * 1000;
sys_setchsr(pdvstData->nChannels,
pdvstData->nChannels,
pdvstData->sampleRate);
ReleaseMutex(pdvstTransferMutex);
timeBeginPeriod(1);
scheduler();
UnmapViewOfFile(pdvstData);
CloseHandle(pdvstTransferFileMap);
CloseHandle(pdvstTransferMutex);
for (i = 0; i < MAXARGS; i++)
{
free(argv[i]);
}
return (0);
}
Index: s_main.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/s_main.c,v
retrieving revision 1.1.1.4.2.8.4.9
retrieving revision 1.1.1.4.2.8.4.10
diff -C2 -d -r1.1.1.4.2.8.4.9 -r1.1.1.4.2.8.4.10
*** s_main.c 4 Apr 2004 19:17:57 -0000 1.1.1.4.2.8.4.9
--- s_main.c 17 Apr 2004 21:17:31 -0000 1.1.1.4.2.8.4.10
***************
*** 5,9 ****
/* IOhannes :
* hacked the code to add advanced multidevice-support
! * 1311:forum::für::umläute:2001
*/
--- 5,9 ----
/* IOhannes :
* hacked the code to add advanced multidevice-support
! * 1311:forum::für::umläute:2001
*/
***************
*** 66,69 ****
--- 66,76 ----
static int sys_main_advance = DEFAULTADVANCE;
+ #ifdef VST
+ int sys_externalschedlib;
+ char sys_externalschedlibname[MAXPDSTRING];
+ int sys_extraflags;
+ char sys_extraflagsstring[MAXPDSTRING];
+ #endif
+
/* IOhannes { */
***************
*** 82,85 ****
--- 89,106 ----
/* } IOhannes */
+ #ifdef VST
+ /* jsarlo { */
+ t_sample* get_sys_soundout() { return sys_soundout; }
+ t_sample* get_sys_soundin() { return sys_soundin; }
+ int* get_sys_main_advance() { return &sys_main_advance; }
+ double* get_sys_time_per_dsp_tick() { return &sys_time_per_dsp_tick; }
+ int* get_sys_schedblocksize() { return &sys_schedblocksize; }
+ double* get_sys_time() { return &sys_time; }
+ float* get_sys_dacsr() { return &sys_dacsr; }
+ int* get_sys_sleepgrain() { return &sys_sleepgrain; }
+ int* get_sys_schedadvance() { return &sys_schedadvance; }
+ /* } jsarlo */
+ #endif
+
/* Matju { */
int console_scrollback = 0;
***************
*** 229,232 ****
--- 250,258 ----
{
int ret;
+
+ #ifdef VST
+ sys_externalschedlib = 0;
+ sys_extraflags = 0;
+ #endif
#ifdef PD_DEBUG
fprintf(stderr, "Pd: COMPILED FOR DEBUGGING\n");
***************
*** 262,266 ****
"make_console\n",
console_scrollback,option_look,option_statusbar,rcfilename?rcfilename:"");
!
/* open audio and MIDI */
sys_open_midi(sys_nmidiin, sys_midiindevlist,
--- 288,307 ----
"make_console\n",
console_scrollback,option_look,option_statusbar,rcfilename?rcfilename:"");
! #ifdef VST
! typedef int (*t_externalschedlibmain)(char *);
! t_externalschedlibmain externalmainfunc;
! HINSTANCE ntdll;
! char filename[MAXPDSTRING];
! sprintf(filename, "%s.dll", sys_externalschedlibname);
! sys_bashfilename(filename, filename);
! ntdll = LoadLibrary(filename);
! if (!ntdll)
! {
! post("%s: couldn't load external scheduler lib ", filename);
! return (0);
! }
! externalmainfunc = (t_externalschedlibmain)GetProcAddress(ntdll,"main");
! ret = (*externalmainfunc)(sys_extraflagsstring);
! #else
/* open audio and MIDI */
sys_open_midi(sys_nmidiin, sys_midiindevlist,
***************
*** 276,280 ****
sys_close_audio();
sys_close_midi();
!
return ret;
}
--- 317,321 ----
sys_close_audio();
sys_close_midi();
! #endif
return ret;
}
***************
*** 748,751 ****
--- 789,808 ----
argc--; argv++;
}
+ #ifdef VST
+ else if (!strcmp(*argv, "-schedlib"))
+ {
+ sys_externalschedlib = 1;
+ strcpy(sys_externalschedlibname, argv[1]);
+ argv += 2;
+ argc -= 2;
+ }
+ else if (!strcmp(*argv, "-extraflags"))
+ {
+ sys_extraflags = 1;
+ strcpy(sys_extraflagsstring, argv[1]);
+ argv += 2;
+ argc -= 2;
+ }
+ #endif
#ifdef UNIX
else if (!strcmp(*argv, "-rt") || !strcmp(*argv, "-realtime"))
Index: m_sched.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/m_sched.c,v
retrieving revision 1.1.1.2.2.7.2.3
retrieving revision 1.1.1.2.2.7.2.4
diff -C2 -d -r1.1.1.2.2.7.2.3 -r1.1.1.2.2.7.2.4
*** m_sched.c 12 Apr 2004 00:45:38 -0000 1.1.1.2.2.7.2.3
--- m_sched.c 17 Apr 2004 21:17:31 -0000 1.1.1.2.2.7.2.4
***************
*** 24,28 ****
static int sys_quit;
! static double sys_time;
static double sys_time_per_msec = TIMEUNITPERSEC / 1000.;
--- 24,28 ----
static int sys_quit;
! double sys_time;
static double sys_time_per_msec = TIMEUNITPERSEC / 1000.;
***************
*** 140,144 ****
static int sched_diddsp, sched_didpoll, sched_didnothing;
! static void sys_clearhist( void)
{
unsigned int i, j;
--- 140,144 ----
static int sched_diddsp, sched_didpoll, sched_didnothing;
! void sys_clearhist( void)
{
unsigned int i, j;
***************
*** 334,338 ****
static int sched_usedacs = 1;
static double sched_referencerealtime, sched_referencelogicaltime;
! static double sys_time_per_dsp_tick;
void sched_set_using_dacs(int flag)
--- 334,338 ----
static int sched_usedacs = 1;
static double sched_referencerealtime, sched_referencelogicaltime;
! double sys_time_per_dsp_tick;
void sched_set_using_dacs(int flag)
***************
*** 349,353 ****
/* take the scheduler forward one DSP tick, also handling clock timeouts */
! static void sched_tick(double next_sys_time)
{
int countdown = 5000;
--- 349,353 ----
/* take the scheduler forward one DSP tick, also handling clock timeouts */
! void sched_tick(double next_sys_time)
{
int countdown = 5000;
Index: s_entry.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/s_entry.c,v
retrieving revision 1.1.1.2.4.1
retrieving revision 1.1.1.2.4.2
diff -C2 -d -r1.1.1.2.4.1 -r1.1.1.2.4.2
*** s_entry.c 28 Mar 2004 15:07:12 -0000 1.1.1.2.4.1
--- s_entry.c 17 Apr 2004 21:17:31 -0000 1.1.1.2.4.2
***************
*** 6,9 ****
--- 6,68 ----
int sys_main(int argc, char **argv);
+ #ifdef VST
+ #include <windows.h>
+ #include <stdio.h>
+ #include <malloc.h>
+ #define MAXARGS 1024
+ #define MAXARGLEN 1024
+
+ /* jsarlo { */
+ int tokenizeCommandLineString(char *clString, char **tokens)
+ {
+ int i, charCount = 0;
+ int tokCount= 0;
+ int quoteOpen = 0;
+
+ for (i = 0; i < strlen(clString); i++)
+ {
+ if (clString[i] == '"')
+ {
+ quoteOpen = !quoteOpen;
+ }
+ else if (clString[i] == ' ' && !quoteOpen)
+ {
+ tokens[tokCount][charCount] = 0;
+ tokCount++;
+ charCount = 0;
+ }
+ else
+ {
+ tokens[tokCount][charCount] = clString[i];
+ charCount++;
+ }
+ }
+ tokens[tokCount][charCount] = 0;
+ tokCount++;
+ return tokCount;
+ }
+
+ int WINAPI WinMain(HINSTANCE hInstance,
+ HINSTANCE hPrevInstance,
+ LPSTR lpCmdLine,
+ int nCmdShow)
+ {
+ int i, argc;
+ char *argv[MAXARGS];
+
+ for (i = 0; i < MAXARGS; i++)
+ {
+ argv[i] = (char *)malloc(MAXARGLEN * sizeof(char));
+ }
+ GetModuleFileName(NULL, argv[0], MAXARGLEN);
+ argc = tokenizeCommandLineString(lpCmdLine, argv + 1) + 1;
+ sys_main(argc, argv);
+ for (i = 0; i < MAXARGS; i++)
+ {
+ free(argv[i]);
+ }
+ }
+ #else
+
int main(int argc, char **argv)
{
***************
*** 11,12 ****
--- 70,72 ----
}
+ #endif
--- NEW FILE: makefile.vstwin ---
VPATH = ../obj:./
INSTDIR = ..
OBJ_DIR = $(INSTDIR)/obj
BIN_DIR = $(INSTDIR)/bin
PDEXEC = pd.exe
GUINAME= pdtcl.dll
DLLWRAP= dllwrap
GFLAGS = -DINSTALL_PREFIX=\"$(INSTDIR)\"
MORECFLAGS =
INCLUDE =
GINCLUDE = $(INCLUDE) -I../tcl/include
LDFLAGS = -lpthreadGC -lwsock32 -lwinmm /lib/tcl85.lib /lib/tk85.lib
LIB = -lm
OPT_CFLAGS =
WARN_CFLAGS = -Wall -W -Wstrict-prototypes \
-Wno-unused-parameter -Wno-parentheses -Wno-switch
ARCH_CFLAGS = -DPD -DVST -DMSW -DDONTUSESIMD \
CFLAGS += $(ARCH_CFLAGS) $(WARN_CFLAGS) $(OPT_CFLAGS) $(MORECFLAGS)
# the sources
SYSSRC += s_audio_mmio.c s_midi_mmio.c
SRSRC = u_pdsend.c u_pdreceive.c
GSRC = t_main.c t_tkcmd.c
VSRC = s_audio_vst.c
SRC = g_canvas.c g_graph.c g_text.c g_rtext.c g_array.c g_template.c g_io.c \
g_scalar.c g_traversal.c g_guiconnect.c g_readwrite.c g_editor.c \
g_all_guis.c g_bang.c g_hdial.c g_hslider.c g_mycanvas.c g_numbox.c \
g_toggle.c g_vumeter.c m_pd.c m_class.c m_obj.c m_atom.c m_memory.c \
m_binbuf.c m_conf.c m_glob.c m_sched.c s_main.c s_inter.c s_file.c \
s_print.c s_loader.c s_path.c s_entry.c s_audio.c s_midi.c \
d_ugen.c d_ctl.c d_arithmetic.c d_osc.c d_filter.c d_dac.c d_misc.c \
d_math.c d_fft.c d_mayer_fft.c d_fftroutine.c d_array.c d_global.c \
d_delay.c d_resample.c x_arithmetic.c x_connective.c x_interface.c \
x_midi.c x_misc.c x_time.c x_acoustics.c x_net.c x_qlist.c x_gui.c \
d_soundfile.c m_simd_sse_vc.c m_simd_sse_gcc.c m_simd_ve_gcc.c \
$(SYSSRC)
OBJ = $(SRC:.c=.o)
GOBJ = $(GSRC:.c=.o)
VOBJ = $(VSRC:.c=.o)
SROBJ = $(SRSRC:.c=.o)
OBJC = $(OBJ)
#
# ------------------ targets ------------------------------------
#
.PHONY: all
all: $(OBJ_DIR)/$(GUINAME) $(OBJ_DIR)/$(PDDLL) $(OBJ_DIR)/$(PDEXEC) \
$(OBJ_DIR)/pdsend.exe $(OBJ_DIR)/pdreceive.exe \
$(OBJ_DIR)/vstschedlib.dll $(OBJ_DIR)/pd.tk
$(OBJ) : %.o : %.c
$(CC) $(CFLAGS) $(GFLAGS) $(INCLUDE) -c -o $(OBJ_DIR)/$*.o $*.c
$(GOBJ) : %.o : %.c
$(CC) $(CFLAGS) $(GFLAGS) $(GINCLUDE) -c -o $(OBJ_DIR)/$*.o $*.c
$(SROBJ) : %.o : %.c
$(CC) $(CFLAGS) $(GFLAGS) $(INCLUDE) -c -o $(OBJ_DIR)/$*.o $*.c
$(VOBJ) : %.o : %.c
$(CC) $(CFLAGS) $(GFLAGS) $(INCLUDE) -c -o $(OBJ_DIR)/$*.o $*.c
$(OBJ_DIR)/pdsend.exe: u_pdsend.o
cd $(OBJ_DIR); $(CC) $(CFLAGS) $(STRIPFLAG) -o pdsend.exe u_pdsend.o $(LDFLAGS)
$(OBJ_DIR)/pdreceive.exe: u_pdreceive.o
cd $(OBJ_DIR); $(CC) $(CFLAGS) $(STRIPFLAG) -o pdreceive.exe u_pdreceive.o $(LDFLAGS)
$(OBJ_DIR)/$(PDEXEC): s_entry.o
cd $(OBJ_DIR); $(CC) -o $(PDEXEC) s_entry.o $(LIB) pd.a $(LDFLAGS) -mwindows
$(OBJ_DIR)/$(PDDLL): $(OBJC)
cd $(OBJ_DIR); $(DLLWRAP) --export-all-symbols --output-def pd.def \
--output-lib=pd.a --dllname=pd.dll $(OBJC) pdtcl.a $(LDFLAGS)
$(OBJ_DIR)/$(GUINAME): t_tkcmd.o
cd $(OBJ_DIR); $(DLLWRAP) --export-all-symbols --output-def pdtcl.def \
--output-lib=pdtcl.a --dllname=$(GUINAME) t_tkcmd.o $(LDFLAGS)
$(OBJ_DIR)/vstschedlib.dll: s_audio_vst.o
cd $(OBJ_DIR); $(DLLWRAP) --export-all-symbols --output-def vst.def \
--output-lib=vst.a --dllname=vstschedlib.dll s_audio_vst.o pd.a $(LDFLAGS)
$(OBJ_DIR)/pd.tk: u_main.tk
echo set pd_nt 1 > $(OBJ_DIR)/pd.tk
grep -v "set pd_nt" < u_main.tk >> $(OBJ_DIR)/pd.tk
install: all
install -d $(INSTDIR)/bin
install $(OBJ_DIR)/*.exe $(BIN_DIR)
install $(OBJ_DIR)/*.dll $(BIN_DIR)
install -m644 $(OBJ_DIR)/pd.tk $(BIN_DIR)/pd.tk
install -m644 u_object.tk $(BIN_DIR)/u_object.tk
clean:
-rm -f $(OBJ_DIR)/*.o $(OBJ_DIR)/*.a $(OBJ_DIR)/*.def
-rm -f $(OBJ_DIR)/*.exe $(OBJ_DIR)/*.dll $(OBJ_DIR)/*.tk
-rm -f $(PADIR)/pablio/*.o $(PADIR)/pa_common/*.o
-rm -f makefile.dependencies
touch makefile.dependencies
chmod 666 makefile.dependencies
distclean: clean
rm -rf config.cache config.log config.status makefile tags \
autom4te-*.cache
echo all: > makefile
echo -e "\t./configure" >> makefile
echo -e "\tmake" >> makefile
tags: $(SRC) $(GSRC); ctags *.[ch]
depend:
$(CC) $(INCLUDE) $(CFLAGS) -M $(SRC) > makefile.dependencies
uninstall:
-rm $(INSTDIR)/bin/pd*.exe
-rm $(INSTDIR)/bin/pd*.dll
-rm $(INSTDIR)/bin/*.tk
include makefile.dependencies
Index: s_audio.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/s_audio.c,v
retrieving revision 1.1.1.1.2.7
retrieving revision 1.1.1.1.2.7.2.1
diff -C2 -d -r1.1.1.1.2.7 -r1.1.1.1.2.7.2.1
*** s_audio.c 14 Jan 2004 15:50:28 -0000 1.1.1.1.2.7
--- s_audio.c 17 Apr 2004 21:17:31 -0000 1.1.1.1.2.7.2.1
***************
*** 124,128 ****
/* set channels and sample rate. */
! static void sys_setchsr(int chin, int chout, int sr)
{
int nblk;
--- 124,128 ----
/* set channels and sample rate. */
! void sys_setchsr(int chin, int chout, int sr)
{
int nblk;
***************
*** 167,170 ****
--- 167,176 ----
int defaultchannels = SYS_DEFAULTCH;
int inchans, outchans;
+ #ifdef VST
+ if (sys_externalschedlib)
+ {
+ return;
+ }
+ #endif
if (rate < 1)
rate = SYS_DEFAULTSRATE;
***************
*** 338,341 ****
--- 344,353 ----
void sys_close_audio(void)
{
+ #ifdef VST
+ if (sys_externalschedlib)
+ {
+ return;
+ }
+ #endif
if (!audio_isopen())
return;