Old 8th March 2010, 09:01   #41
DrO
 
Join Date: Sep 2003
Posts: 27,873
i've got to get authorisation that it's ok to release the required source file but it's massively easier to use than manually reading the xml playlists file but from what has gone before i was under the impression you'd already implemented the xml reading.

-daz
DrO is offline   Reply With Quote
Old 15th March 2010, 16:50   #42
-ex-
Junior Member
 
-ex-'s Avatar
 
Join Date: Nov 2009
Location: Malaysia
Posts: 45
I haven't implemented xml reading yet.. I've read about it though, but i don't think that was the one to be implemented in visual c++..

Quote:
Originally posted by DrO
IPC_ENQUEUEFILE and specifying the full playlist path with the calling of it. with that api, the inprocess (non-WM_COPYDATA version) can be used.

btw, haven't had a chance to sort out a working example yet.

-daz
Anyway, have you come out with a working example of querying media library yet? I still can't do a query yet..
-ex- is offline   Reply With Quote
Old 18th March 2010, 03:39   #43
-ex-
Junior Member
 
-ex-'s Avatar
 
Join Date: Nov 2009
Location: Malaysia
Posts: 45
I've hosted my project files, please help me to troubleshoot it.. Once the query is successful, I can go to implement speech recognition..Only four more weeks to the submission date.. XD
-ex- is offline   Reply With Quote
Old 18th March 2010, 17:49   #44
Benski
Ben Allison
Former Winamp Developer
 
Benski's Avatar
 
Join Date: Jan 2005
Location: Brooklyn, NY
Posts: 1,057
Quote:
Originally Posted by DrO View Post
i've got to get authorisation that it's ok to release the required source file but it's massively easier to use than manually reading the xml playlists file but from what has gone before i was under the impression you'd already implemented the xml reading.

-daz

yeah no worries. It should be easy to get through api_playlists
Benski is offline   Reply With Quote
Old 18th March 2010, 19:17   #45
DrO
 
Join Date: Sep 2003
Posts: 27,873
benski: thanks for that

-ex-: will sort out all of the examples, etc required tomorrow (as a bit snowed under with other projects tonight).

-daz
DrO is offline   Reply With Quote
Old 19th March 2010, 03:58   #46
-ex-
Junior Member
 
-ex-'s Avatar
 
Join Date: Nov 2009
Location: Malaysia
Posts: 45
Quote:
Originally Posted by DrO View Post
benski: thanks for that

-ex-: will sort out all of the examples, etc required tomorrow (as a bit snowed under with other projects tonight).

-daz
thanks benski for the authorization.. and thanks dro, looking forward to that..
-ex- is offline   Reply With Quote
Old 22nd March 2010, 22:07   #47
DrO
 
Join Date: Sep 2003
Posts: 27,873
http://stashbox.org/831934/api_playl...ery_example.7z

this is designed to be built with VS2008 and to be placed in the 'sdk' folder as detailed on the gen_langugage_example page as i've just modified the plug-in from http://daz.ne1.net/gen_lang_example as a quick base to work from. best option is to extract the 2 folders into the sdk folder so everything will be in place correctly otherwise manually copy api_playlists.h into the sdk\playlist folder.

i've also included a pre-built version of the plug-in which should work ok with a 5.57x install. the ml query is activated from the 'about' button on the config dialog and will show upto 10 files (uses playcount = 0 | playcount isempty which is the never been played smart view. the media library playlists should be reported just after Winamp has started though the example is very basic but the rest of the interfaces are present in the api_playlists.h to do whatever is required.

-daz
DrO is offline   Reply With Quote
Old 25th March 2010, 07:55   #48
-ex-
Junior Member
 
-ex-'s Avatar
 
Join Date: Nov 2009
Location: Malaysia
Posts: 45
Thanks a lot, DrO! It's working..

Now I'm going to study your example and apply it to my plugin..
If I encounter any problem, I will post it here again..

Thank you so much...
-ex- is offline   Reply With Quote
Old 3rd April 2010, 15:13   #49
-ex-
Junior Member
 
-ex-'s Avatar
 
Join Date: Nov 2009
Location: Malaysia
Posts: 45
Hi,

I've been working on the speech recognition based on the Microsoft SDK 5.1 tutorials.
But it seems that doing it on the plugin is not as simple as building a stand-alone application.

Any suggestions?
Should I create different header and source files for the SAPI?

Last edited by -ex-; 3rd April 2010 at 15:28.
-ex- is offline   Reply With Quote
Old 5th April 2010, 17:21   #50
-ex-
Junior Member
 
-ex-'s Avatar
 
Join Date: Nov 2009
Location: Malaysia
Posts: 45
Hey.. Don't mind my previous post.. I've solved it..

Quote:
// only go into this if we had success
for(int i = 0; i < ico->Size && i < 10; i++)
Is there any way to increase the size of ico?
I tried changing "i < 10" to "i < 20", but there was no change..
-ex- is offline   Reply With Quote
Old 5th April 2010, 18:16   #51
DrO
 
Join Date: Sep 2003
Posts: 27,873
ico->Size all depends on the number of results returned & doesn't determine the number of results wanted.

-daz
DrO is offline   Reply With Quote
Old 6th April 2010, 09:38   #52
-ex-
Junior Member
 
-ex-'s Avatar
 
Join Date: Nov 2009
Location: Malaysia
Posts: 45
Then how to change the number of results to be returned?
-ex- is offline   Reply With Quote
Old 6th April 2010, 09:52   #53
-ex-
Junior Member
 
-ex-'s Avatar
 
Join Date: Nov 2009
Location: Malaysia
Posts: 45
Oh I get it now..

For the speech recognition,
Now I am unable to complete the SAPI initialization.
Some of the first steps are okay, but when it failed in loading command from resource...
code:
hr = g_cpCmdGrammar->LoadCmdFromResource(NULL, MAKEINTRESOURCEW(IDR_ABC),
L"SRGRAMMAR", MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL),SPLO_DYNAMIC);



and setting rules to active
code:
hr = g_cpCmdGrammar->SetRuleIdState(999, SPRS_ACTIVE);


By the way, I'm using Microsoft Speech SDK 5.1 for that.

Is there any possibility that the SDK is not compatible with Winamp?
Or are there any things I left out to do for making it compatible?
-ex- is offline   Reply With Quote
Old 6th April 2010, 10:16   #54
DrO
 
Join Date: Sep 2003
Posts: 27,873
Quote:
Then how to change the number of results to be returned?
not something you're able to do other than including more files in the library to allow for them to be found by the query.

Quote:
For the speech recognition...
i've never used the library so i'd be guessing that you've not included the required resources in the plugin if the LoadCmdFromResource(..) code is anything to go by. though i'd have expected that to be taking plugin.hDllInstance as the module to load the resource from and not from how i'm reading it, winamp.exe in this case with the null module paramter.

i would have thought that there shouldn't be an issue with using their SDK within winamp/plug-in setup (especially with v5.3 of the api being part of the Windows SDK) as long as all of the aspects of their api are implemented correctly in the plug-in (which is the case when using any library).

-daz
DrO is offline   Reply With Quote
Old 6th April 2010, 11:55   #55
-ex-
Junior Member
 
-ex-'s Avatar
 
Join Date: Nov 2009
Location: Malaysia
Posts: 45
Hmm.. Can u tell me more about plugin.hDllInstance?
Thank you..
-ex- is offline   Reply With Quote
Old 6th April 2010, 13:19   #56
DrO
 
Join Date: Sep 2003
Posts: 27,873
plugin.hDllInstance (or what you've named the winampGeneralPurposePlugin structure as so it could be bob.hDllInstance) is the handle (HINSTANCE) of the plug-in dll so you can load resources from it without having to do some quirky hacks to get that handle.

-daz
DrO is offline   Reply With Quote
Old 7th April 2010, 11:01   #57
-ex-
Junior Member
 
-ex-'s Avatar
 
Join Date: Nov 2009
Location: Malaysia
Posts: 45
Quote:
... plugin.hDllInstance as the module to load the resource from and not from how i'm reading it, winamp.exe in this case with the null module parameter.
I learned that the NULL parameter passes back the path for the file containing the current process. Every speech recognition programs I referred used this NULL parameter.

The resource intended to be loaded is actually an xml file that has been compiled to a binary file (.cfg).

I have added the binary file into my project, but it seems that in run-time, the program still cannot find the binary file.

All other programs I referred to has the following statement in their .rc file....
code:
IDR_CFG_CMD SRGRAMMAR DISCARDABLE "binaryfile.cfg"


But my .rc file does not have that statement.
So I hardcoded the statement into it.
But it still does not work. I think the .rc file is not something suposed to be hardcoded, is it?

Maybe you find something from my explaination?
-ex- is offline   Reply With Quote
Old 7th April 2010, 11:50   #58
DrO
 
Join Date: Sep 2003
Posts: 27,873
from how i've read the api, passing NULL is going to try to load the resource from winamp.exe as that is the calling process which will be used if no handle is passed (as you're trying to do). you need to use the plug-in's handle hence the need to use the hDllInstance member of your winampGeneralPurposePlugin structure.

-daz
DrO is offline   Reply With Quote
Old 7th April 2010, 11:50   #59
DrO
 
Join Date: Sep 2003
Posts: 27,873
from how i've read the api, passing NULL is going to try to load the resource from winamp.exe as that is the calling process which will be used if no handle is passed (as you're trying to do). you need to use the plug-in's handle hence the need to use the hDllInstance member of your winampGeneralPurposePlugin structure.

-daz
DrO is offline   Reply With Quote
Old 8th April 2010, 09:19   #60
-ex-
Junior Member
 
-ex-'s Avatar
 
Join Date: Nov 2009
Location: Malaysia
Posts: 45
Oh right, it's working!!!
I don't understand..
I'm pretty sure I tried passing the hDllInstance and it still did not work..
And now there is no error..
But still I am not able to make it recognize speech yet..

Can you explain to me about LRESULT CALLBACK WndProc(..) and how is it called?
I read that it is a function that processes messages sent to a window, but i don't quite understand.
I designed the plug-in so that if I click a "Speak" button, it will call the InitSAPI(..)..
But it seems at this point that all my plug-in does is initializing the SAPI.
Is SetNotifyWindowMessage( hWnd, WM_RECOEVENT, 0, 0) going to call the WndProc?


Thanks!

Last edited by -ex-; 8th April 2010 at 09:49.
-ex- is offline   Reply With Quote
Old 9th April 2010, 12:50   #61
DrO
 
Join Date: Sep 2003
Posts: 27,873
the WndProc(..) proc is called depending on how it's being used.

if you subclass Winamp (SetWindowLongPtr(GWLP_WNDPROC) then it would be called before Winamp's window proc & requires you to use CallWindowProc(original_proc_from_SetWindowLongPtr) ).

otherwise it's the original proc for a dialog/window that you've created & have specified it as the dialog/window proc to be used with it.

-daz
DrO is offline   Reply With Quote
Old 9th April 2010, 13:09   #62
-ex-
Junior Member
 
-ex-'s Avatar
 
Join Date: Nov 2009
Location: Malaysia
Posts: 45
Whoa I don't understand at all.
I think I don't subclass Winamp as you said, cause I don't have SetWindowLongPtr() in my program.
Can you please check my program and help me? I will send it to your inbox.
I don't understand at all how to use it.
The SetNotifyWindowMessage() is in my Primary.h, it's supposed to call the callback function WndProc().
-ex- is offline   Reply With Quote
Old 9th April 2010, 16:18   #63
DrO
 
Join Date: Sep 2003
Posts: 27,873
i've had a look but as i'm a complete noob with anything to do with .net i'm only going to be able to guess at things. from how i understand it, you ideally want to have the form as the window to receive any callback notifications so i think you may need to implement IMessageFilter handling (http://msdn.microsoft.com/en-us/libr...agefilter.aspx) but i'm not 100% but that's the only thing i can find from the documentation which seems to allow for what would be just a simple case switch in plain win32 code to get the WM_RECOEVENT message (as your wndproc is setup).

other than that i'm not too sure as i'm not able to get the project to compile (probably need to install more parts of the .net framework) & .net stuff is a bit alien to me (though it seems to be the way to go if wanting to code things it seems).

-daz
DrO is offline   Reply With Quote
Old 9th April 2010, 16:57   #64
-ex-
Junior Member
 
-ex-'s Avatar
 
Join Date: Nov 2009
Location: Malaysia
Posts: 45
Thanks for having a look. I think to compile it, you just need to install the Speech SDK.
However, using IMessageFilter I still cannot have it working. I don't know how to implement it, as I get a lot of compile errors after copying the codes from the link you gave.

There is another alternative to the SetNotifyWindowMessage(..), which is SetNotifyCallbackFunction(..).
This function supposed to allow me to specify which callback function to be called.
I tried using it, but there was a compile error saying:
Quote:
error C3374: can't take address of 'gen_myplugin::Primary::WndProc' unless creating delegate instance
What does it mean?

Anyway, do you happen to know someone who you think can solve the problems I encounter?
-ex- is offline   Reply With Quote
Old 9th April 2010, 17:17   #65
DrO
 
Join Date: Sep 2003
Posts: 27,873
i've already got the speech api present due to it being in the SDK i believe, it's only having the c++ aspects of VS2008 installed that causes the issues as there's none of the .net linker, etc present.

with the example i think it was meant to be a guide on how to do things & not a direct copy+paste into an existing setup.

from the error, it appears to be from not using the correct callback function as the WndProc is not compatible (based on the definition of SPNOTIFYCALLBACK which is meant to be void __stdcall SPNOTIFYCALLBACK(WPARAM wParam, LPARAM lParam);

Quote:
Anyway, do you happen to know someone who you think can solve the problems I encounter?
other than someone who knows .NET & SAPI usage it looks like you're stuck with me in what little means i have available at the moment.

-daz
DrO is offline   Reply With Quote
Old 9th April 2010, 17:46   #66
-ex-
Junior Member
 
-ex-'s Avatar
 
Join Date: Nov 2009
Location: Malaysia
Posts: 45
Yeah I know it was meant to be a guide. However I don't know how am I supposed to follow it. I guess I am such a noob who is confused right now.

Anyway, about the error, I have declared the callback function in one of the header files.
typedef void __stdcall SPNOTIFYCALLBACK(WPARAM wParam, LPARAM lParam);

Then I changed my WndProc function to SPNOTIFYCALLBACK WndProc(WPARAM wParam, LPARAM lParam)
Now the errors are:
error C2091: function returns function
error C2664: 'ISpNotifySource::SetNotifyCallbackFunction' : cannot convert parameter 1 from 'SPNOTIFYCALLBACK (__stdcall *(__clrcall gen_myplugin::Primary::* )(WPARAM,LPARAM))' to 'SPNOTIFYCALLBACK (__stdcall *)'

Haih..
-ex- is offline   Reply With Quote
Old 9th April 2010, 18:47   #67
DrO
 
Join Date: Sep 2003
Posts: 27,873
the callback function just needs to be void __stdcall SPNOTIFYCALLBACK(WPARAM wParam, LPARAM lParam); with SPNOTIFYCALLBACK passed as the parameter in the function call (is like filling the winamp plugin structure). then you need to ensure that the SPNOTIFYCALLBACK function has a valid body created for it otherwise you'll get more issues.

-daz
DrO is offline   Reply With Quote
Old 9th April 2010, 19:51   #68
-ex-
Junior Member
 
-ex-'s Avatar
 
Join Date: Nov 2009
Location: Malaysia
Posts: 45
Okay, that is clear enough.

Here is the body of the function:
code:
void __stdcall SPNOTIFYCALLBACK (WPARAM wParam, LPARAM lParam)
{
ProcessRecoEvent(mlWnd);
return;
}



and the function call:
code:
SetNotifyCallbackFunction( SPNOTIFYCALLBACK, 0, 0 )


Is that what you meant?

Because there is a compile error of "function call missing argument list; use '&gen_myplugin::Primary::SPNOTIFYCALLBACK' to create a pointer to member"
Then I modified my function call to:
code:
SetNotifyCallbackFunction( &gen_myplugin::Primary::SPNOTIFYCALLBACK, 0, 0 )


And it led to the previous error: "can't take address of 'gen_myplugin::Primary::SPNOTIFYCALLBACK' unless creating delegate instance"
-ex- is offline   Reply With Quote
Old 9th April 2010, 20:04   #69
DrO
 
Join Date: Sep 2003
Posts: 27,873
from a quick search i'd possibly go with what is described in http://stackoverflow.com/questions/1...lback-in-c-cli though i'm really not too certain (and i was under the impression that managed languages are meant to be better *shrugs* )

-daz
DrO is offline   Reply With Quote
Old 9th April 2010, 20:35   #70
-ex-
Junior Member
 
-ex-'s Avatar
 
Join Date: Nov 2009
Location: Malaysia
Posts: 45
I still can't get it working!
Oh gosh, I'm afraid I can't finish this thing.
-ex- is offline   Reply With Quote
Old 9th April 2010, 21:34   #71
DrO
 
Join Date: Sep 2003
Posts: 27,873
personally i'd drop the .net side of things and just do basic win32 with com as needed but that's just me.

the delegate things appears to be due to a function pointer but under managed code it needs to be handled differently. all i can suggest with the current codebase is to use the error reported and see if you can find a better example from someone's issue & see if their way of fixing it will work for you.

-daz
DrO is offline   Reply With Quote
Old 10th April 2010, 07:33   #72
-ex-
Junior Member
 
-ex-'s Avatar
 
Join Date: Nov 2009
Location: Malaysia
Posts: 45
i can't tell which is the .net side and the win32 side.
sorry if i seem stupid, this is my first time doing this kind of programming.
-ex- is offline   Reply With Quote
Old 10th April 2010, 07:38   #73
-ex-
Junior Member
 
-ex-'s Avatar
 
Join Date: Nov 2009
Location: Malaysia
Posts: 45
i'm sorry if i sound stupid, but i can't tell which is the .net and win32 side.
this is my first time doing this kind of programming, cause previously i just doing simple and very basic c++ programs without using visual studio.
-ex- is offline   Reply With Quote
Old 11th April 2010, 18:26   #74
-ex-
Junior Member
 
-ex-'s Avatar
 
Join Date: Nov 2009
Location: Malaysia
Posts: 45
By the way, there is one thing that I need to do. It's to make my plugin interface window always-on-top. So wherever I am, whatever active window is running, I will be able to see it and click it. How to do this?
-ex- is offline   Reply With Quote
Old 20th April 2010, 18:21   #75
-ex-
Junior Member
 
-ex-'s Avatar
 
Join Date: Nov 2009
Location: Malaysia
Posts: 45
DrO, do you know how to convert normal string to wchar_t*?
I need to be able to do it in order to convert a string input from textbox to a query string like "artist = dido".
-ex- is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > Winamp Development

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump