programsarechunks flag working
This commit is contained in:
		
							parent
							
								
									ba3b030e41
								
							
						
					
					
						commit
						e523032c0e
					
				@ -25,6 +25,11 @@ DEBUG = TRUE
 | 
			
		||||
# ***OBSOLETE, use [declare] inside patch instead*** 
 | 
			
		||||
#LIB = 
 | 
			
		||||
 | 
			
		||||
# Save and Get Pd lists in .fxp file via ([s svstdata] and [r rvstdata])
 | 
			
		||||
# Some hosts don't work correctly with this.
 | 
			
		||||
# If in doubt just use FALSE.
 | 
			
		||||
PROGRAMSARECHUNKS = TRUE
 | 
			
		||||
 | 
			
		||||
# Number of VST parameters (up to 128)
 | 
			
		||||
PARAMETERS = 1
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -294,8 +294,6 @@ void sendPdVstChunk(t_vstChunkReceiver *x, t_symbol *s, int argc, t_atom *argv)
 | 
			
		||||
    t_atom at;
 | 
			
		||||
    t_binbuf*bbuf = binbuf_new();  
 | 
			
		||||
  
 | 
			
		||||
    memset(&pdvstData->datachunk.value.stringData, '\0', MAXSTRINGSIZE);  
 | 
			
		||||
  
 | 
			
		||||
    SETSYMBOL(&at, s);
 | 
			
		||||
    binbuf_add(bbuf, 1, &at);
 | 
			
		||||
    binbuf_add(bbuf, argc, argv);
 | 
			
		||||
@ -303,11 +301,12 @@ void sendPdVstChunk(t_vstChunkReceiver *x, t_symbol *s, int argc, t_atom *argv)
 | 
			
		||||
    binbuf_free(bbuf);
 | 
			
		||||
  
 | 
			
		||||
    WaitForSingleObject(pdvstTransferMutex, INFINITE);
 | 
			
		||||
    memset(&pdvstData->datachunk.value.stringData, '\0', MAXSTRINGSIZE);
 | 
			
		||||
    pdvstData->datachunk.type = STRING_TYPE;
 | 
			
		||||
    pdvstData->datachunk.direction = PD_SEND;
 | 
			
		||||
    pdvstData->datachunk.updated = 1;
 | 
			
		||||
    strcpy(pdvstData->datachunk.value.stringData,buf);
 | 
			
		||||
    //memcpy(pdvstData->datachunk.value.stringData, buf, length);
 | 
			
		||||
    //strcpy(pdvstData->datachunk.value.stringData,buf);
 | 
			
		||||
    memcpy(pdvstData->datachunk.value.stringData, buf, length);
 | 
			
		||||
    ReleaseMutex(pdvstTransferMutex);
 | 
			
		||||
    
 | 
			
		||||
    freebytes(buf, length+1);
 | 
			
		||||
@ -492,7 +491,7 @@ int scheduler()
 | 
			
		||||
                pdvstData->plugName.updated=0;
 | 
			
		||||
        }
 | 
			
		||||
        
 | 
			
		||||
                // lucarda get data chunk from file
 | 
			
		||||
        // get data chunk from file
 | 
			
		||||
        if (pdvstData->datachunk.direction == PD_RECEIVE && \
 | 
			
		||||
            pdvstData->datachunk.updated)
 | 
			
		||||
        {
 | 
			
		||||
 | 
			
		||||
@ -56,6 +56,7 @@ extern char globalHostPdvstPath[MAXFILENAMELEN];
 | 
			
		||||
extern bool globalCustomGui;
 | 
			
		||||
extern int globalCustomGuiWidth;
 | 
			
		||||
extern int globalCustomGuiHeight;
 | 
			
		||||
extern bool globalProgramsAreChunks;
 | 
			
		||||
 | 
			
		||||
extern bool globalIsASynth;
 | 
			
		||||
extern pdvstProgram globalProgram[MAXPROGRAMS];
 | 
			
		||||
@ -226,7 +227,7 @@ pdvst::pdvst(audioMasterCallback audioMaster)
 | 
			
		||||
     //  {JYG   see pdvst::setProgram below for explanation
 | 
			
		||||
    timeFromStartup=GetTickCount();
 | 
			
		||||
    //  JYG  }
 | 
			
		||||
    programsAreChunks(false);
 | 
			
		||||
    programsAreChunks(globalProgramsAreChunks);
 | 
			
		||||
    sendPlugName(globalPluginName);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -604,29 +605,36 @@ bool pdvst::getOutputProperties(VstInt32 index, VstPinProperties* properties)
 | 
			
		||||
 | 
			
		||||
VstInt32 pdvst::getChunk (void** data, bool isPreset)
 | 
			
		||||
{
 | 
			
		||||
    //MessageBox(NULL,"debug","getchunk",MB_OK);
 | 
			
		||||
    WaitForSingleObject(pdvstTransferMutex, 10);
 | 
			
		||||
    VstInt32 len;
 | 
			
		||||
    if(*data)
 | 
			
		||||
    {
 | 
			
		||||
        if(*data) 
 | 
			
		||||
        strcpy ((char *)*data, pdvstData->datachunk.value.stringData);
 | 
			
		||||
        ReleaseMutex(pdvstTransferMutex);
 | 
			
		||||
        WaitForSingleObject(pdvstTransferMutex, 10);
 | 
			
		||||
        {
 | 
			
		||||
            strcpy ((char *)*data, pdvstData->datachunk.value.stringData);
 | 
			
		||||
            len = (VstInt32)strlen(pdvstData->datachunk.value.stringData);
 | 
			
		||||
            ReleaseMutex(pdvstTransferMutex);
 | 
			
		||||
        }
 | 
			
		||||
        return len;
 | 
			
		||||
    }
 | 
			
		||||
    return strlen(pdvstData->datachunk.value.stringData);
 | 
			
		||||
    else
 | 
			
		||||
    return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
VstInt32 pdvst::setChunk (void* data, VstInt32 byteSize, bool isPreset)
 | 
			
		||||
{    
 | 
			
		||||
    MessageBox(NULL,"debug","setchunk",MB_OK);
 | 
			
		||||
    WaitForSingleObject(pdvstTransferMutex, 10);
 | 
			
		||||
    if(byteSize)
 | 
			
		||||
    {
 | 
			
		||||
        pdvstData->datachunk.direction = PD_RECEIVE;
 | 
			
		||||
        pdvstData->datachunk.type = STRING_TYPE;
 | 
			
		||||
        memset(&pdvstData->datachunk.value.stringData, '\0', MAXSTRINGSIZE);
 | 
			
		||||
        strncpy(pdvstData->datachunk.value.stringData,(char *)data, (size_t)byteSize);
 | 
			
		||||
        pdvstData->datachunk.updated = 1;
 | 
			
		||||
        ReleaseMutex(pdvstTransferMutex);
 | 
			
		||||
        WaitForSingleObject(pdvstTransferMutex, 10);
 | 
			
		||||
        {
 | 
			
		||||
            pdvstData->datachunk.direction = PD_RECEIVE;
 | 
			
		||||
            pdvstData->datachunk.type = STRING_TYPE;
 | 
			
		||||
            memset(&pdvstData->datachunk.value.stringData, '\0', MAXSTRINGSIZE);
 | 
			
		||||
            strncpy(pdvstData->datachunk.value.stringData,(char *)data, (size_t)byteSize);
 | 
			
		||||
            pdvstData->datachunk.updated = 1;
 | 
			
		||||
            ReleaseMutex(pdvstTransferMutex);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    return 1;
 | 
			
		||||
    return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
VstInt32 pdvst::canDo(char* text)
 | 
			
		||||
@ -1124,7 +1132,7 @@ void pdvst::updatePdvstParameters()
 | 
			
		||||
        if (pdvstData->datachunk.direction == PD_SEND && \
 | 
			
		||||
            pdvstData->datachunk.updated)
 | 
			
		||||
        {
 | 
			
		||||
            if (pdvstData->datachunk.type = STRING_TYPE)
 | 
			
		||||
            if (pdvstData->datachunk.type == STRING_TYPE)
 | 
			
		||||
            {
 | 
			
		||||
                pdvstData->datachunk.updated=0;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
@ -173,7 +173,6 @@ protected:
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    // JYG  }
 | 
			
		||||
    //void programsAreChunks (bool)       {}
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
@ -44,6 +44,7 @@ bool globalCustomGui = false;
 | 
			
		||||
int globalCustomGuiWidth= 320;
 | 
			
		||||
int globalCustomGuiHeight= 150;
 | 
			
		||||
pdvstProgram globalProgram[MAXPROGRAMS];
 | 
			
		||||
bool globalProgramsAreChunks = false;
 | 
			
		||||
 | 
			
		||||
char *trimWhitespace(char *str);
 | 
			
		||||
void parseSetupFile();
 | 
			
		||||
@ -376,6 +377,18 @@ void parseSetupFile()
 | 
			
		||||
                        globalProgram[progNum].paramValue[paramNum] = \
 | 
			
		||||
                                                             (float)atof(value);
 | 
			
		||||
                }
 | 
			
		||||
                // programsarechunks (save custom data in .fxb file)
 | 
			
		||||
				if (strcmp(param, "programsarechunks") == 0)
 | 
			
		||||
                {
 | 
			
		||||
                    if (strcmp(strlwr(value), "true") == 0)
 | 
			
		||||
                    {
 | 
			
		||||
                        globalProgramsAreChunks = true;
 | 
			
		||||
                    }
 | 
			
		||||
                    else if (strcmp(strlwr(value), "false") == 0)
 | 
			
		||||
                    {
 | 
			
		||||
                        globalProgramsAreChunks = false;
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user