|
|||
Hi everybody, I have some trouble with CFileSelector in vstSDK 2.4.
What I want to do : - Open windows selector - Select a file - Return path to the file. - Display path in my plugins Here is my code : //-- File Selector---------------------------------------------------- -- //---------------------------------------------------------- --------- VstFileType waveType ("Wave File", "WAVE", "wav", "wav", "audio/wav", "audio/x-wav"); VstFileType types[] = {waveType}; //only One type for now. VstFileSelect vstFileSelect; memset (&vstFileSelect, 0, sizeof (VstFileSelect)); vstFileSelect.command = kVstFileLoad; vstFileSelect.type = kVstFileType; strcpy (vstFileSelect.title, "Test for open file selector"); vstFileSelect.nbFileTypes = 1; vstFileSelect.fileTypes = (VstFileType*)&types; vstFileSelect.returnPath = new char[1024]; vstFileSelect.initialPath = 0; selector = new CFileSelector (ptr); // I am in SDEditor::open (void *ptr) function fileSelectorDisplay = new CTextLabel (size, 0, 0,0); // size is my CRect display if (selector->run (&vstFileSelect)) { if (fileSelectorDisplay) fileSelectorDisplay->setText (vstFileSelect.returnPath); } else { if (fileSelectorDisplay) fileSelectorDisplay->setText ("OpenFileSelector: canceled!!!!"); } lFrame->addView (fileSelectorDisplay); delete selector; delete []vstFileSelect.returnPath; if (vstFileSelect.initialPath) delete []vstFileSelect.initialPath; When I launch myplugin.dll in Reaper it crash => Reaper_host32.exe stop. In my header : CFileSelector* selector; CTextLabel* fileSelectorDisplay; Do you have any clues ? (or code that working ? Thanks a lot, Thomas.[/u] |
|||
| ^ | Joined: 26 Mar 2012 Member: #277611 Location: Liège,Belgique | ||
|
|||
Have you tried checking with the host to see if it supports opening a file selector? I'm not too familiar with Reaper, but you can check by calling canHostDo(). i.e.
if (canHostDo("openFileSelector")) /*report result to a text file maybe? */ |
|||
| ^ | Joined: 15 Apr 2012 Member: #278696 Location: Toronto, ON | ||
|
|||
Totovai wrote: When I launch myplugin.dll in Reaper it crash => Reaper_host32.exe stop.
Do you use the bit bridge of reaper? If yes then this might be the problem. |
|||
| ^ | Joined: 23 Jan 2008 Member: #171645 Location: Hamburg, Germany | ||
|
|||
Hi thank you for answer.
I put this in my processReplacing function : if(canHostDo("openFileSelector")) { monFlux<< "YES"<<endl; } else monFlux<< "No"<<endl; And the answer is No... Do you have an alternative ? How can I select file in myPlugin ? Quote: Do you use the bit bridge of reaper? If yes then this might be the problem.
Yes I use it, if I set "disable" it say "The following effect plug-in could not be loaded. What is this setting "bridge" do ? Thomas. |
|||
| ^ | Joined: 26 Mar 2012 Member: #277611 Location: Liège,Belgique | ||
|
|||
Totovai wrote: Hi thank you for answer.
I put this in my processReplacing function : if(canHostDo("openFileSelector")) { monFlux<< "YES"<<endl; } else monFlux<< "No"<<endl; And the answer is No... Are you trying to open the file selector in the audio processing function of your plugin? That's a massively bad idea! There's basically no chance that would ever work. However, if you already have or will solve that mess...I don't think the VST spec in any way requires the host to implement the file dialog functionality. I bet most plugins just open the dialog on their own, using OS specific API calls directly or via a wrapper in their programming framework. |
|||
| ^ | Joined: 09 Sep 2005 Member: #80666 Location: Oulu, Finland | ||
|
|||
Xenakios wrote: I don't think the VST spec in any way requires the host to implement the file dialog functionality.
CFileSelector already takes care of that, the problem must lie somewhere else. OK, so let's look at the code as presented in the original posting... // ... selector = new CFileSelector (ptr); // I am in SDEditor::open (void *ptr) function fileSelectorDisplay = new CTextLabel (size, 0, 0,0); // size is my CRect display if (selector->run (&vstFileSelect)) { if (fileSelectorDisplay) fileSelectorDisplay->setText (vstFileSelect.returnPath); } else { if (fileSelectorDisplay) fileSelectorDisplay->setText ("OpenFileSelector: canceled!!!!"); } lFrame->addView (fileSelectorDisplay); delete selector; // ... There's a massive error in there. The pointer passed to CFileSelector's constructor should be a pointer to the effect, not to the editor's parent window. So, to keep the OP's coding style, selector = new CFileSelector (effect); should work better. |
|||
| ^ | Joined: 16 Aug 2004 Member: #37236 Location: Vienna, Austria | ||
|
|||
Which VSTGUI version are you using?
3.6 is incomplete for Windows I seem to remember, and you have back-port the VSTGUI 4.0 stuff for it to work properly. *joy* |
|||
| ^ | Joined: 07 Jan 2009 Member: #197745 Location: Gloucestershire | ||
|
|||
Quote: There's a massive error in there. The pointer passed to CFileSelector's constructor should be a pointer to the effect, not to the editor's parent window.
So, to keep the OP's coding style, selector = new CFileSelector (effect); should work better. Wowowow can I kiss you master genious it works, thanks a lot every body |
|||
| ^ | Joined: 26 Mar 2012 Member: #277611 Location: Liège,Belgique | ||
|
|||
| ^ | Joined: 16 Aug 2004 Member: #37236 Location: Vienna, Austria |
| KVR Forum Index » DSP and Plug-in Development | All times are GMT - 8 Hours |
|
Printable version |
Disclaimer: All communications made available as part of this forum and any opinions, advice, statements, views or other information expressed in this forum are solely provided by, and the responsibility of, the person posting such communication and not of kvraudio.com (unless kvraudio.com is specifically identified as the author of the communication).
Powered by phpBB © phpBB Group







