programsarechunks flag working
This commit is contained in:
		
							parent
							
								
									ba3b030e41
								
							
						
					
					
						commit
						e523032c0e
					
				@ -25,6 +25,11 @@ DEBUG = TRUE
 | 
				
			|||||||
# ***OBSOLETE, use [declare] inside patch instead*** 
 | 
					# ***OBSOLETE, use [declare] inside patch instead*** 
 | 
				
			||||||
#LIB = 
 | 
					#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)
 | 
					# Number of VST parameters (up to 128)
 | 
				
			||||||
PARAMETERS = 1
 | 
					PARAMETERS = 1
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -23,7 +23,7 @@ DEBUG = FALSE
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
# External libraries (comma delimited list, relative to pdvst/)
 | 
					# External libraries (comma delimited list, relative to pdvst/)
 | 
				
			||||||
# ***OBSOLETE, use [declare] inside patch instead*** 
 | 
					# ***OBSOLETE, use [declare] inside patch instead*** 
 | 
				
			||||||
#LIB = 
 | 
					#LIB =
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Number of VST parameters (up to 128)
 | 
					# Number of VST parameters (up to 128)
 | 
				
			||||||
PARAMETERS = 1
 | 
					PARAMETERS = 1
 | 
				
			||||||
 | 
				
			|||||||
@ -292,9 +292,7 @@ void sendPdVstChunk(t_vstChunkReceiver *x, t_symbol *s, int argc, t_atom *argv)
 | 
				
			|||||||
    char *buf;
 | 
					    char *buf;
 | 
				
			||||||
    int length;
 | 
					    int length;
 | 
				
			||||||
    t_atom at;
 | 
					    t_atom at;
 | 
				
			||||||
    t_binbuf*bbuf = binbuf_new();
 | 
					    t_binbuf*bbuf = binbuf_new();  
 | 
				
			||||||
    
 | 
					 | 
				
			||||||
    memset(&pdvstData->datachunk.value.stringData, '\0', MAXSTRINGSIZE);  
 | 
					 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
    SETSYMBOL(&at, s);
 | 
					    SETSYMBOL(&at, s);
 | 
				
			||||||
    binbuf_add(bbuf, 1, &at);
 | 
					    binbuf_add(bbuf, 1, &at);
 | 
				
			||||||
@ -303,11 +301,12 @@ void sendPdVstChunk(t_vstChunkReceiver *x, t_symbol *s, int argc, t_atom *argv)
 | 
				
			|||||||
    binbuf_free(bbuf);
 | 
					    binbuf_free(bbuf);
 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
    WaitForSingleObject(pdvstTransferMutex, INFINITE);
 | 
					    WaitForSingleObject(pdvstTransferMutex, INFINITE);
 | 
				
			||||||
 | 
					    memset(&pdvstData->datachunk.value.stringData, '\0', MAXSTRINGSIZE);
 | 
				
			||||||
    pdvstData->datachunk.type = STRING_TYPE;
 | 
					    pdvstData->datachunk.type = STRING_TYPE;
 | 
				
			||||||
    pdvstData->datachunk.direction = PD_SEND;
 | 
					    pdvstData->datachunk.direction = PD_SEND;
 | 
				
			||||||
    pdvstData->datachunk.updated = 1;
 | 
					    pdvstData->datachunk.updated = 1;
 | 
				
			||||||
    strcpy(pdvstData->datachunk.value.stringData,buf);
 | 
					    //strcpy(pdvstData->datachunk.value.stringData,buf);
 | 
				
			||||||
    //memcpy(pdvstData->datachunk.value.stringData, buf, length);
 | 
					    memcpy(pdvstData->datachunk.value.stringData, buf, length);
 | 
				
			||||||
    ReleaseMutex(pdvstTransferMutex);
 | 
					    ReleaseMutex(pdvstTransferMutex);
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    freebytes(buf, length+1);
 | 
					    freebytes(buf, length+1);
 | 
				
			||||||
@ -492,7 +491,7 @@ int scheduler()
 | 
				
			|||||||
                pdvstData->plugName.updated=0;
 | 
					                pdvstData->plugName.updated=0;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
                // lucarda get data chunk from file
 | 
					        // get data chunk from file
 | 
				
			||||||
        if (pdvstData->datachunk.direction == PD_RECEIVE && \
 | 
					        if (pdvstData->datachunk.direction == PD_RECEIVE && \
 | 
				
			||||||
            pdvstData->datachunk.updated)
 | 
					            pdvstData->datachunk.updated)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
 | 
				
			|||||||
@ -56,6 +56,7 @@ extern char globalHostPdvstPath[MAXFILENAMELEN];
 | 
				
			|||||||
extern bool globalCustomGui;
 | 
					extern bool globalCustomGui;
 | 
				
			||||||
extern int globalCustomGuiWidth;
 | 
					extern int globalCustomGuiWidth;
 | 
				
			||||||
extern int globalCustomGuiHeight;
 | 
					extern int globalCustomGuiHeight;
 | 
				
			||||||
 | 
					extern bool globalProgramsAreChunks;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
extern bool globalIsASynth;
 | 
					extern bool globalIsASynth;
 | 
				
			||||||
extern pdvstProgram globalProgram[MAXPROGRAMS];
 | 
					extern pdvstProgram globalProgram[MAXPROGRAMS];
 | 
				
			||||||
@ -226,7 +227,7 @@ pdvst::pdvst(audioMasterCallback audioMaster)
 | 
				
			|||||||
     //  {JYG   see pdvst::setProgram below for explanation
 | 
					     //  {JYG   see pdvst::setProgram below for explanation
 | 
				
			||||||
    timeFromStartup=GetTickCount();
 | 
					    timeFromStartup=GetTickCount();
 | 
				
			||||||
    //  JYG  }
 | 
					    //  JYG  }
 | 
				
			||||||
    programsAreChunks(false);
 | 
					    programsAreChunks(globalProgramsAreChunks);
 | 
				
			||||||
    sendPlugName(globalPluginName);
 | 
					    sendPlugName(globalPluginName);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -604,29 +605,36 @@ bool pdvst::getOutputProperties(VstInt32 index, VstPinProperties* properties)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
VstInt32 pdvst::getChunk (void** data, bool isPreset)
 | 
					VstInt32 pdvst::getChunk (void** data, bool isPreset)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    //MessageBox(NULL,"debug","getchunk",MB_OK);
 | 
					    VstInt32 len;
 | 
				
			||||||
    WaitForSingleObject(pdvstTransferMutex, 10);
 | 
					    if(*data)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        if(*data) 
 | 
					        WaitForSingleObject(pdvstTransferMutex, 10);
 | 
				
			||||||
        strcpy ((char *)*data, pdvstData->datachunk.value.stringData);
 | 
					        {
 | 
				
			||||||
        ReleaseMutex(pdvstTransferMutex);
 | 
					            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)
 | 
					VstInt32 pdvst::setChunk (void* data, VstInt32 byteSize, bool isPreset)
 | 
				
			||||||
{    
 | 
					{    
 | 
				
			||||||
    MessageBox(NULL,"debug","setchunk",MB_OK);
 | 
					    if(byteSize)
 | 
				
			||||||
    WaitForSingleObject(pdvstTransferMutex, 10);
 | 
					 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        pdvstData->datachunk.direction = PD_RECEIVE;
 | 
					        WaitForSingleObject(pdvstTransferMutex, 10);
 | 
				
			||||||
        pdvstData->datachunk.type = STRING_TYPE;
 | 
					        {
 | 
				
			||||||
        memset(&pdvstData->datachunk.value.stringData, '\0', MAXSTRINGSIZE);
 | 
					            pdvstData->datachunk.direction = PD_RECEIVE;
 | 
				
			||||||
        strncpy(pdvstData->datachunk.value.stringData,(char *)data, (size_t)byteSize);
 | 
					            pdvstData->datachunk.type = STRING_TYPE;
 | 
				
			||||||
        pdvstData->datachunk.updated = 1;
 | 
					            memset(&pdvstData->datachunk.value.stringData, '\0', MAXSTRINGSIZE);
 | 
				
			||||||
        ReleaseMutex(pdvstTransferMutex);
 | 
					            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)
 | 
					VstInt32 pdvst::canDo(char* text)
 | 
				
			||||||
@ -1124,7 +1132,7 @@ void pdvst::updatePdvstParameters()
 | 
				
			|||||||
        if (pdvstData->datachunk.direction == PD_SEND && \
 | 
					        if (pdvstData->datachunk.direction == PD_SEND && \
 | 
				
			||||||
            pdvstData->datachunk.updated)
 | 
					            pdvstData->datachunk.updated)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            if (pdvstData->datachunk.type = STRING_TYPE)
 | 
					            if (pdvstData->datachunk.type == STRING_TYPE)
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                pdvstData->datachunk.updated=0;
 | 
					                pdvstData->datachunk.updated=0;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
				
			|||||||
@ -173,7 +173,6 @@ protected:
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // JYG  }
 | 
					    // JYG  }
 | 
				
			||||||
    //void programsAreChunks (bool)       {}
 | 
					 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
				
			|||||||
@ -44,6 +44,7 @@ bool globalCustomGui = false;
 | 
				
			|||||||
int globalCustomGuiWidth= 320;
 | 
					int globalCustomGuiWidth= 320;
 | 
				
			||||||
int globalCustomGuiHeight= 150;
 | 
					int globalCustomGuiHeight= 150;
 | 
				
			||||||
pdvstProgram globalProgram[MAXPROGRAMS];
 | 
					pdvstProgram globalProgram[MAXPROGRAMS];
 | 
				
			||||||
 | 
					bool globalProgramsAreChunks = false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
char *trimWhitespace(char *str);
 | 
					char *trimWhitespace(char *str);
 | 
				
			||||||
void parseSetupFile();
 | 
					void parseSetupFile();
 | 
				
			||||||
@ -376,6 +377,18 @@ void parseSetupFile()
 | 
				
			|||||||
                        globalProgram[progNum].paramValue[paramNum] = \
 | 
					                        globalProgram[progNum].paramValue[paramNum] = \
 | 
				
			||||||
                                                             (float)atof(value);
 | 
					                                                             (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