The NEW Build Your Own Arcade Controls

Main => Audio/Jukebox/MP3 Forum => Topic started by: headkaze on January 11, 2008, 05:11:19 pm

Title: Plugins: JPS SDK 1.02 Download (Plugin & Host examples)
Post by: headkaze on January 11, 2008, 05:11:19 pm
Okay thought this would make it easier by starting a new topic where I can update the first post with changes to the SDK archive for download.

If you need changes to be made please post a request here with changes necessary. I can't possibly keep up with the other threads ;) Also if you have made a new example source to include in the SDK please attach it to a post and I will inlcude it in a new release.

Also I will try to keep the document (ReadMe.txt) up to date with the commands thread each time I post a new version.
Title: Re: Plugins: JPS SDK 1.0b5 Download (Plugin & Host examples)
Post by: Space Fractal on January 11, 2008, 05:34:37 pm
Did you get my sound plug from the other thread to work? It the first real plugin and succesfully tested with BlitzMax without crashes (tested all used commands directly from there).

Soon I which you take the dll wrapper I made when I created some document. You might include the sound example to your SDK as well, if you wich.
Title: Re: Plugins: JPS SDK 1.0b5 Download (Plugin & Host examples)
Post by: Barry Barcrest on January 11, 2008, 05:34:49 pm
Cheers Buddy
Title: Re: Plugins: JPS SDK 1.0b5 Download (Plugin & Host examples)
Post by: Space Fractal on January 11, 2008, 06:58:15 pm
It seen you forgot to close the library with my sound plugin?

My plugin works fine with ALL functions used, but just crash when exit (Shutdown does also called fine)...

Alsowice nice work  :D
Title: Re: Plugins: JPS SDK 1.0b5 Download (Plugin & Host examples)
Post by: headkaze on January 11, 2008, 07:17:55 pm
It seen you forgot to close the library with my sound plugin?

My plugin works fine with ALL functions used, but just crash when exit (Shutdown does also called fine)...

Alsowice nice work  :D

I dont think so, like I said in the other thread it works fine in two other languages so how can you say it's not working? There is something wrong in your plugin code.
Title: Re: Plugins: JPS SDK 1.0b5 Download (Plugin & Host examples)
Post by: unclet on January 11, 2008, 09:10:45 pm
In your Initialize() routine I think you should check whether hDll != 0 before you use it ... correct?
Title: Re: Plugins: JPS SDK 1.0b5 Download (Plugin & Host examples)
Post by: headkaze on January 11, 2008, 09:22:07 pm
In your Initialize() routine I think you should check whether hDll != 0 before you use it ... correct?

Yeah good point updated to check if hDll is null first.

Also updated to match 1.0b6 command set.
Title: Re: Plugins: JPS SDK 1.0b6 Download (Plugin & Host examples)
Post by: Space Fractal on January 11, 2008, 09:45:14 pm
If it works fine in all BlitzMax, Pure Basic and Delpth (and sure, also in C++), but Crash under VB6, there is of course a bug in somewhere runtime files in that language, since it only crash on that language?

But what it really happens, I dont know, and why it diddent like the sound libary (Pure Basic using dx7 for sound) under VB6?

I pretty sure it dosent crash in VB.Net where they got the bug fixed...

There is a 1.0n7 (it going fast), but only some document errors and addations, no command addation.

But I do think I using BASS.dll or Windows Media Player (I dosent know PureBasic use that?) for the sound libray for the little plugin (hence it good idea to rename dll's to jps) to get it combatible with Visual Basic 6...

Trying that another day. Godnight.
Title: Re: Plugins: JPS SDK 1.0b6 Download (Plugin & Host examples)
Post by: unclet on January 11, 2008, 09:51:25 pm
thanks for the hard work
Title: Re: Plugins: JPS SDK 1.0b6 Download (Plugin & Host examples)
Post by: loadman on January 11, 2008, 10:04:11 pm
Oh It seems Space Fractal Sound PlugIn (that crashes on exit) is in the current SDK.  Is that intentional?  ;)
Title: Re: Plugins: JPS SDK 1.0b6 Download (Plugin & Host examples)
Post by: headkaze on January 11, 2008, 10:39:14 pm
There is a 1.0n7 (it going fast), but only some document errors and addations, no command addation.

Okay updated to match 1.0b7 ReadMe.txt. Also added your Pure Basic example

Oh It seems Space Fractal Sound PlugIn (that crashes on exit) is in the current SDK.  Is that intentional?  ;)

Oops :) Yes that was me doing some testing. I've put back the old plugin for testing.
Title: Re: Plugins: JPS SDK 1.0b7 Download (Plugin & Host examples)
Post by: headkaze on January 12, 2008, 01:59:14 am
Updated VB6 Host example to only read files with .jps extension.
Title: Re: Plugins: JPS SDK 1.0b7 Download (Plugin & Host examples)
Post by: loadman on January 12, 2008, 03:33:18 am
Updated VB6 Host example to only read files with .jps extension.

Sweet. 

Is this your dad building your new Jukebox?  Can he help me with mine?
(http://members.iinet.net.au/~freeaxs/arcade/images/IMG_0809%20(Custom).jpg)
Title: Re: Plugins: JPS SDK 1.0b7 Download (Plugin & Host examples)
Post by: headkaze on January 12, 2008, 03:56:18 am
I notice you don't have a picture of yourself on your own website for me to post. Now you have to post us a picture of your own noggin loadman, that's only fair.
Title: Re: Plugins: JPS SDK 1.0b7 Download (Plugin & Host examples)
Post by: loadman on January 12, 2008, 04:27:51 am
I notice you don't have a picture of yourself on your own website for me to post. Now you have to post us a picture of your own noggin loadman, that's only fair.

Wow, Just did a search, First I was trying to find a picture of me with my cab and then it came down to just finding a pic of me. I have heaps of my wife and kids. It's obvious to me now that they never pick up the camera. Anyway here I am.
Title: Re: Plugins: JPS SDK 1.0b7 Download (Plugin & Host examples)
Post by: headkaze on January 12, 2008, 04:33:38 am
Wow, Just did a search, First I was trying to find a picture of me with my cab and then it came down to just finding a pic of me. I have heaps of my wife and kids. It's obvious to me now that they never pick up the camera. Anyway here I am.

I meant a recent photo of your loadman, not the one your wife took 10 years ago lol j/k
Title: Re: Plugins: JPS SDK 1.0b7 Download (Plugin & Host examples)
Post by: loadman on January 12, 2008, 04:35:15 am
Wow, Just did a search, First I was trying to find a picture of me with my cab and then it came down to just finding a pic of me. I have heaps of my wife and kids. It's obvious to me now that they never pick up the camera. Anyway here I am.

I meant a recent photo of your loadman, not the one your wife took 10 years ago lol j/k

Ohh you mean a recent one of me with your woman  :laugh2:

OK Better stop now as the thread Police will be waking up soon   ;D

Better get back to work on the 'JukeStub' Plug-in tester
Title: Re: Plugins: JPS SDK 1.0b7 Download (Plugin & Host examples)
Post by: headkaze on January 12, 2008, 04:56:19 am
Ohh you mean a recent one of me with your woman  :laugh2:

OK Better stop now as the thread Police will be waking up soon   ;D

Better get back to work on the 'JukeStub' Plug-in tester

Yeah the one you took when I was out banging your wife  :laugh2:

Okay I think this thread has been derailed enough.. back to the serious world of coding  :angel:
Title: Re: Plugins: JPS SDK 1.0b7 Download (Plugin & Host examples)
Post by: unclet on January 12, 2008, 08:27:33 am
Do I need to place all the files from in the "C++\Release\" directory into my"\plugins\" directory or do I just use the "VB6 Host\plugins\JukePlugin.jps" file only?
Title: Re: Plugins: JPS SDK 1.0b7 Download (Plugin & Host examples)
Post by: headkaze on January 12, 2008, 05:07:13 pm
Do I need to place all the files from in the "C++\Release\" directory into my"\plugins\" directory or do I just use the "VB6 Host\plugins\JukePlugin.jps" file only?

All you need is the the one dll (jps file)
Title: Re: Plugins: JPS SDK 1.0b7 Download (Plugin & Host examples)
Post by: Space Fractal on January 12, 2008, 05:26:06 pm
Supported Jukeboxe Software in the readme: Should you not state coming too? None are released as I note, but it of course these tree we see first.

You should add the updated SoundEvent Plugin that finally works with your VB6 host without crash (I created a seperate threads for sound playing, so I could kill that thread before exit) (and maybe credits me for the pure basic code).

Your TestPlugin works fine from BLitzMax  to :D.
Title: Re: Plugins: JPS SDK 1.0b7 Download (Plugin & Host examples)
Post by: headkaze on January 12, 2008, 05:32:01 pm
Supported Jukeboxe Software in the readme: Should you not state coming too? None are released as I note, but it of course these tree we see first.

You should add the updated SoundEvent Plugin that finally works with your VB6 host without crash (I created a seperate threads for sound playing, so I could kill that thread before exit) (and maybe credits me for the pure basic code).

Your TestPlugin works fine from BLitzMax  to :D.

Update to archive..

- Added a "COMING SOON" to supported Jukebox software
- SoundEvent example updated (You were already credited for Pure Basic code)
- Changed C++ and Delphi examples to out a JukePlugin.jps file (instead of dll)
Title: Re: Plugins: JPS SDK 1.0b7 Download (Plugin & Host examples)
Post by: unclet on January 12, 2008, 05:51:54 pm
Also, you might want to change the name of your JPS file you generate.

Instead of JukePlugin.jps ... how about something more descriptive such as "JukePluginTest.jps"     ;D
Title: Re: Plugins: JPS SDK 1.0b10 Download (Plugin & Host examples)
Post by: headkaze on January 13, 2008, 06:53:39 am
Updated to 1.0b10
Title: Re: Plugins: JPS SDK 1.0b10 Download (Plugin & Host examples)
Post by: Space Fractal on January 13, 2008, 07:37:35 am
 :D, but please update the readme.txt again.

For some reason the text description from Juke_Command("JUKE_SONGLIST_MOVE_SONG", "oldPosition|newPosition") got deleted.

I guess along this is a beta, would it not been better just to point to the thread for the readme until it got finalized for the readme.txt (I sometimes correct one destription minor error without update the number).

Title: Re: Plugins: JPS SDK 1.0b10 Download (Plugin & Host examples)
Post by: headkaze on January 13, 2008, 04:33:17 pm
:D, but please update the readme.txt again.

For some reason the text description from Juke_Command("JUKE_SONGLIST_MOVE_SONG", "oldPosition|newPosition") got deleted.

I guess along this is a beta, would it not been better just to point to the thread for the readme until it got finalized for the readme.txt (I sometimes correct one destription minor error without update the number).

It's easy enough for me to copy and paste it each time I do a release. I just hope there isn't going to be a 100 of them ;)
Title: Re: Plugins: JPS SDK 1.0b13 Download (Plugin & Host examples)
Post by: headkaze on January 13, 2008, 07:58:42 pm
Updated to 1.0b13
Title: Re: Plugins: JPS SDK 1.0b13 Download (Plugin & Host examples)
Post by: Barry Barcrest on January 13, 2008, 08:39:36 pm
Each time i think your done you guys keep changing it. I make releases of my software almost daily so i think i will hang back on this until you have finalised it all.
Title: Re: Plugins: JPS SDK 1.0b13 Download (Plugin & Host examples)
Post by: unclet on January 13, 2008, 08:45:18 pm
headkaze

1) I get a type mismatch error on the following RED line.  You can reproduce this by running your VB6 Host "Project.vbp".  Just run it, click on the TEST button and then click OK to close the popup-window

Quote
Private Function ParamsToString(ParamArray Params() As Variant) As String
    Dim sParams As String
    Dim I As Integer
   
    For I = 0 To UBound(Params)
        sParams = sParams & Params(I)
        If I < UBound(Params) Then
            sParams = sParams & "|"
        End If
    Next
   
    ParamsToString = sParams
End Function

2) Space Fractal had two SONG_REPEAT commands defined and I think you grabbed the wrong one to put in your code.  The other one I believe will be removed since it has been replaced by "JUKE_FEATURE_REPEAT_MODE" command.   Anyway, I think you want the "SONG_REPEAT" command which is listed below:
Quote
JukeCommand(JUKE_SONG_REPEAT, "")
this is sent when a song HAS finished playing and the song will immediately be played again.


3) You have a "LoopType" parameter defined for the "SONG_RESTART" command although Space Fractal has it defined like this now:
Quote
JukeCommand(JUKE_SONG_RESTART, "")
this is sent when a song HAS NOT finished playing and is requested to start playing from the beginning again


4) You have the "JUKE_VOLUME_SET" command defined, but Space Fractal defines it like this now:
Quote
Juke_Command("JUKE_VOLUME_CHANGE", "system|curVolumeLevel|minVolumeLevel|maxVolumeLevel")
A new value volume have been changed or set....
Title: Re: Plugins: JPS SDK 1.0b13 Download (Plugin & Host examples)
Post by: headkaze on January 13, 2008, 11:55:36 pm
headkaze

Bah! Stupid VB6 hehe okay fixed :)
Title: Re: Plugins: JPS SDK 1.0b13 Download (Plugin & Host examples)
Post by: Space Fractal on January 14, 2008, 02:18:47 am
Barcrest, hehe. That way it was in beta on some time.

I dedicated first release my software on sunday (to make sure all commands is correct and not changed), to make sure it finally done.

So, Barcrest, can you wait to release your software on that day, so we got a simulate release with UncleT Jukebox, Freebox and MultiJuke?

I want to have a news to the arcadecontrols mainpage about it.

Any betas should been internal goes to these plugin writers that want them (Like LoadMan and HeadKaze).

There is beta 14, but it just small spotted errors, no others.

I do update my sound plug in soon to sync with beta 13+.
Title: Re: Plugins: JPS SDK 1.0b13 Download (Plugin & Host examples)
Post by: loadman on January 14, 2008, 04:32:30 am
C'mon Headkaze  b14 b14!!!  Don't make me come over there!!!!   :o    ;)

You are only 3291.63 kms  (Miles: 2045.38) away you know   :)
Title: Re: Plugins: JPS SDK 1.0b13 Download (Plugin & Host examples)
Post by: unclet on January 14, 2008, 07:18:47 am
I believe headkaze's current b13 version is actually now b14 ..... he just did not change the name of the file.
Title: Re: Plugins: JPS SDK 1.0b16 Download (Plugin & Host examples)
Post by: headkaze on January 14, 2008, 10:24:33 pm
Okay hopefully synced with 10b16 now. Let me know if I've missed anything.
Title: Re: Plugins: JPS SDK 1.0b17 Download (Plugin & Host examples)
Post by: Space Fractal on January 15, 2008, 05:36:52 am
I found a page how to convert UTF8 to 16 bit strings and back. It look like VB6 can use unicode to support various alphabet out here, not just Latin:

http://www.nonhostile.com/howto-convert-byte-array-utf8-string-vb6.asp

I think that should include that into the SDK.

They actuelly might only needed by songinfo and sending and retrive Letters trouch

I should maybe add a return value at JUKE_APP_UNICODE() to tell if the plugin itself support unicode or not (so the jukebox application just send ASCII string as it are, even char>128 is used)?
Title: Re: Plugins: JPS SDK 1.0b17 Download (Plugin & Host examples)
Post by: headkaze on January 15, 2008, 06:32:54 am
Space Fractal: You seem to be the only person concerned with Unicode. What if the plugin author codes his plugin using UTF8? Do you expect them to have to deal with Unicode?

Since the return values are PCHAR you could infact have them return a PWCHAR since they are both pointers. But I doubt Loadman or anyone else will want to support both UTF8 and Unicode.

BTW This is all you need to do it in VB6...

StrConv(Bytes, vbUnicode)
Title: Re: Plugins: JPS SDK 1.0b17 Download (Plugin & Host examples)
Post by: Space Fractal on January 15, 2008, 06:45:53 am
etc danish Æ Ø Å use unicode, and example Russia, when used in a english OS. Japanse example require unicode.

The problem is unicode through the wrapper do NOT use 16 bit at all and need to been ASCII (Char) for compatible. Yes I know some plugins might not support unicode, hence I want to been UTF8, because its compatible with ASCII.

UTF8 is backward compatible with 8 bit ASCII, because it use a 8 bit encode string with any WCHARS over 128. Hence it use a special encode system to convert from WCHAR to CHAR and the other way.

This is make sure Jukebox application without unicode works with plugins only using CHAR.

That is why I added JUKE_APP_UNICODE() to tell about it. I guess it's should also return a value back, if the plug-in use 16 bit strings or not (ETC the plugins is NOT unicode aware)?


Title: Re: Plugins: JPS SDK 1.0b17 Download (Plugin & Host examples)
Post by: headkaze on January 15, 2008, 08:19:55 pm
Version 1.0 Released!

- Synced with 1.0 Command list (let me know of any errors)
- Added a Timer to the VB6 Host example to show two way communication. Press a key when running the VB6 Host example and it will trigger a PLUGIN_EVENT_KEYDOWN event and output the ASCII character.

NOTE: The PLUGIN_EVENT_KEYDOWN does not seem to trigger inside the VB6 IDE so to see the example run just double click the Project1.exe.
Title: Re: Plugins: JPS SDK 1.0 Download (Plugin & Host examples)
Post by: unclet on January 15, 2008, 11:08:31 pm
uughh ...... I just spent an hour trying to figure what the heck was crashing my application and finally figured out it was your new plugin code   :banghead:   again  :angry:

Starting your new VB6Host/Project1.vbp makes it come up fine although when I click the "X" button on the top/right of the window to exit the application, then VB crashes.

How about creating a new version  ::)

off to bed ......  :)
Title: Re: Plugins: JPS SDK 1.0 Download (Plugin & Host examples)
Post by: headkaze on January 15, 2008, 11:52:07 pm
uughh ...... I just spent an hour trying to figure what the heck was crashing my application and finally figured out it was your new plugin code   :banghead:   again  :angry:

Starting your new VB6Host/Project1.vbp makes it come up fine although when I click the "X" button on the top/right of the window to exit the application, then VB crashes.

How about creating a new version  ::)

off to bed ......  :)

How about you go jump in the lake?  :angry:
Title: Re: Plugins: JPS SDK 1.0 Download (Plugin & Host examples)
Post by: loadman on January 16, 2008, 02:13:03 am
uughh ...... I just spent an hour trying to figure what the heck was crashing my application and finally figured out it was your new plugin code   :banghead:   again  :angry:
Starting your new VB6Host/Project1.vbp makes it come up fine although when I click the "X" button on the top/right of the window to exit the application, then VB crashes.
How about creating a new version  ::)
off to bed ......  :)
How about you go jump in the lake?  :angry:

 :'(   I'm sure UncleT didn't mean top be rude.  Probably just tired   :dunno

As always guys love your efforts!!!  :notworthy:

Should I be worried about this HeadKaze? (see attached pic)  :dunno
Title: Re: Plugins: JPS SDK 1.0 Download (Plugin & Host examples)
Post by: headkaze on January 16, 2008, 06:34:24 am
uughh ...... I just spent an hour trying to figure what the heck was crashing my application and finally figured out it was your new plugin code   :banghead:   again  :angry:
Starting your new VB6Host/Project1.vbp makes it come up fine although when I click the "X" button on the top/right of the window to exit the application, then VB crashes.
How about creating a new version  ::)
off to bed ......  :)
How about you go jump in the lake?  :angry:

 :'(   I'm sure UncleT didn't mean top be rude.  Probably just tired   :dunno

As always guys love your efforts!!!  :notworthy:

Should I be worried about this HeadKaze? (see attached pic)  :dunno

loadman: I would say that's a false positive ;)

Well UncleT posted that when I was tired too (still am) so not the sort of thing you want to read when your tired. I dont think I should have to remind anyone that I'm doing this to help out at the request of Loadman. I have no interest in Jukebox software but the subject of plugins does interest me so I thought I'd help out. I don't think UncleT was meaning to sound ungrateful/pushy/rude so I'll just forget about it and put it down to hard work and lack of sleep.

Now the problem with the VB6 program is a mystery to me and it seem to crash randomly for me too (I knew about it when I posted and was going to wait for the cry's for help). Maybe I'm having the same problem Space Fractal had with his plugin? I tried a few different things but it still seems to crash randomly.

UncleT: Instead of bitching and moaning about my plugin code crashing your application again, how about you do a little problem solving of your own? VB6 is a ---steaming pile of meadow muffin--- language and I hate coding in it, and were using a hand full of hacks to get it loading dynamic dll's. I'm doing my best to write bug free code but I'm beginning to think it's just VB6 being the ---smurfette--- it always has been. Why do you think I left VB6 several years ago?
Title: Re: Plugins: JPS SDK 1.0 Download (Plugin & Host examples)
Post by: unclet on January 16, 2008, 07:10:34 am
I was not trying to tick anyone off ...... sorry .... not really who I am.  I went and reread my post and I can easily see how that can be interpreted that way ..... sorry again.  Obviously just came out wrong, just trying to play around with you a bit ..... and probably just caught you at a bad time.   Just not a good idea by me  :P  Your work is appreciated of course.

As forthe problem, I can look into the problem when I get home tonight.  This is the first time any of your plugin code has crashed for me.  I believe it is a result of something corrupting memory which occurs during ShutDown.   Have you changed anything between this v1.0 update in the "main" routines (Initialize, ShutDown and Command routines)?  I do not use any of the other routines so I know the problem lies within these three.



(EDIT)
I just looked at verified nothing changed in those three routines since your last release of them.   This crash must be a hidden bug which has existed for a while now.   
Title: Re: Plugins: JPS SDK 1.0 Download (Plugin & Host examples)
Post by: headkaze on January 16, 2008, 08:57:16 am
(EDIT)
I just looked at verified nothing changed in those three routines since your last release of them.   This crash must be a hidden bug which has existed for a while now.   

The crash is most definately caused by NEW code added in Version 1.0 ie. The Timer code that is calling the plugin every 200 milliseconds. It's all new stuff so it's this new code that is causing the crashing, that much I know.

What I do in the plugin now is add a thread which continually reads key input. When it detects a keypress it is returned when PLUGIN_EVENT_GET is called in the Timer. Now in the Form_Unload() routine I turn off the Timer then I call the Plugin_Shutdown function of the plugin. The thread that reads input is then killed.

Code: [Select]
Private Sub Form_Unload(Cancel As Integer)
    Timer1.Enabled = False
   
    If (Not PluginArray) = True Then
        Exit Sub
    End If
   
    Dim I As Integer
   
    For I = 0 To UBound(PluginArray, 1) - 1
        Dim RetVal As Long
        RetVal = PluginArray(I).Shutdown
    Next
End Sub

Code: [Select]
Private Sub Timer1_Timer()
    If (Not PluginArray) = True Then
        Exit Sub
    End If
   
    Dim I As Integer
   
    For I = 0 To UBound(PluginArray, 1) - 1
        Dim RetVal() As String
        RetVal = PluginArray(I).PluginEventGet()
       
        If UBound(RetVal, 1) + 1 = 2 Then
            Select Case RetVal(0)
                Case "PLUGIN_EVENT_KEYDOWN"
                    Text1.Text = Text1.Text & "PLUGIN_EVENT_KEYDOWN:" & RetVal(1) & vbNewLine
                    Text1.SelStart = Len(Text1.Text)
            End Select
        End If
    Next
End Sub

I tried a couple of things thinking first "maybe the thread isn't getting enough time to close?". So first I tried adding WaitForSingleObject().

Code: [Select]
JUKEPLUGIN_API int __stdcall Juke_Shutdown(int Value)
{
// MessageBox(NULL, NULL, "Juke_Shutdown", MB_OK);

if(hThread != NULL)
CloseHandle(hThread);

WaitForSingleObject(hThread, 100);

return 1;
}

I thought that fixed it but it didn't. It still randomly crashed. Right now I'm too tired to even think about it, so I might have another look tomorrow. Your welcome to help narrow down the issue. I have a feeling removing the FreeLibrary() call might solve it like it did with Space Fractal's plugin. So maybe he was right in blaming VB6 for the issue? Or maybe having all this code in the Form_Unload() function is a bad idea. What happens when we have the shutdown and Timer.Enabled = false in a button before closing the form?

EDIT: Okay did a couple of quick tests removing FreeLibrary() and that does seem to stop it from crashing on exit  :dunno
Title: Re: Plugins: JPS SDK 1.0 Download (Plugin & Host examples)
Post by: unclet on January 16, 2008, 10:05:07 am
The only code I am using of yours is the "DynamicDLL module file" and the "JukePlugin class module" file...... and I am only interacting with the following routines within your JukePluin class module file:

1) Initialze()
2) Configure()  <-- I have logic in my code to call this routine, but it is not being called during this crash
3) Shutdown()
4) Command()
5) routines to "get" plugin name, author, version and description

What this means is that I did not use any of the routines in the "Project1.vbp" project located in the "Form1" logic at all and I am not calling any of the individual event routines you have defined in the "JukePlugin class module"  When I want to send a command, I simply call the "Command" routine directly.    Anyway, in my code, it still crashes when y application exits, so it must be related to either Initialize, Shutdown or Commands routines somehow.  I am not even using a 200ms timer in my code to get information from the plugin either, so I really doubt it has anything to do with a Timer stuff.

I also verified the Initialize(), Shutdown() and Command() routines from the "JukePlugin class module" v10b14 matched exactly with the latest "JukePlugin class module" v1.0 ...... so this is why I believe this problem existed earlier than v1.0   Basically, it seems the code I am "currently" using from your "JukePlugin class module" v1.0 release is the same code I tested with successfully from your v10b14 release.


I then decided to play around with your "Project1.vbp" project:

I tried to comment out the "FreeLibrary hDll" line in the ShutDown routine but that did not solve the problem ... it still crashed.   I tried commenting out the call to CallFuncPtr in the ShutDown routine and it still crashed.

Here is the weird part ........ I commented out every line of the Shutdown routine and the crash stopped.   I then uncommented selected lines of the ShutDown routine back in one at a time and tested whether it crashed each time and it never did crash any more.  I got to the point of "uncommenting" all lines within the ShutDown routine and the crash can not be reproduced anymore.   This just means the routine is now overwriting memory somewhere else and it is just not crashing the "Project1.vbp" code anymore.   Bad thing is, I can not reproduce the problem either using "Project1.vbp".

** I am at work now and can not do anything until later tonight ......  :'(
Title: Re: Plugins: JPS SDK 1.0 Download (Plugin & Host examples)
Post by: Space Fractal on January 16, 2008, 11:54:46 am
SoundEvent plugin updated to v1.0 Api....



The version in the plugin still set at b14 under getinfo(), which is fixed.

PLEASE NOTE: SMALL BUGS IS FIXED.

(4) CRASH BUG WHEN LOADING "MOVIE" WHEN SENT BACK.
(3) PLAY BUTTON DIDDENT WORK.
(2) GETINFO() SENT BACK A WRONG INFO.
Title: Re: Plugins: JPS SDK 1.0 Download (Plugin & Host examples)
Post by: headkaze on January 16, 2008, 10:05:30 pm
The only code I am using of yours is the "DynamicDLL module file" and the "JukePlugin class module" file...... and I am only interacting with the following routines within your JukePluin class module file:

1) Initialze()
2) Configure()  <-- I have logic in my code to call this routine, but it is not being called during this crash
3) Shutdown()
4) Command()
5) routines to "get" plugin name, author, version and description

What this means is that I did not use any of the routines in the "Project1.vbp" project located in the "Form1" logic at all and I am not calling any of the individual event routines you have defined in the "JukePlugin class module"  When I want to send a command, I simply call the "Command" routine directly.    Anyway, in my code, it still crashes when y application exits, so it must be related to either Initialize, Shutdown or Commands routines somehow.  I am not even using a 200ms timer in my code to get information from the plugin either, so I really doubt it has anything to do with a Timer stuff.

I also verified the Initialize(), Shutdown() and Command() routines from the "JukePlugin class module" v10b14 matched exactly with the latest "JukePlugin class module" v1.0 ...... so this is why I believe this problem existed earlier than v1.0   Basically, it seems the code I am "currently" using from your "JukePlugin class module" v1.0 release is the same code I tested with successfully from your v10b14 release.

Why the hell arn't you using the wrapper functions instead of calling Juke_Command directly?  :dizzy:

Makes me feel like I've been wasting my time  :banghead:

The reason why the example is crashing for you is because YOU ARE RUNNING IT INSIDE THE IDE. VB6 is notorious for crashing when doing things like we are doing. Eg. Subclassing, threading or using API functions like LoadLibrary etc. One of the reasons for that is because the VB6 IDE is not thread-safe.

So the easy thing to do is RUN IT OUTSIDE THE IDE ie. By double clicking the exe. That is the only way we can do it, and that is why you keep getting my code crashing because I'm running the exe and your not. So I'm releasing code thinking it's working while for you (in understandable frustration) it keeps crashing! If you've ever tried to do any low level stuff in VB6 you soon find out that alot of stuff crashes running inside the IDE so in many ways I'm used to testing VB6 apps by running the exe. Just another reason to ditch VB6 for a better non-obsolete language ;)

Now that your up to speed, the new example still crashes occationally when using the new Timer code. But I'll wait until you actually get to implementing that in your software.

(And here I was thinking we were on the same page)  ::)
Title: Re: Plugins: JPS SDK 1.0 Download (Plugin & Host examples)
Post by: unclet on January 16, 2008, 10:24:01 pm
headkaze

I have not found the main crash but decided to use your old 10b14 "JukePlugin.jps" file and everything works fine.

I did find an error though.   After calling the ShutDown routine for all the plugins, I was calling the Command() routine one more time.   The CallFuncPtr() routine did not get called since you make sure the pCommand > 0 .... which is good.  The thing which causes my error was that "sArray" was being returned from the Command() function but it was uninitialized.   Now, the real problem was that I was calling Command() function after a Shutdown, but I just wanted to let you know that an error could occur if this happens still since sArray is not initialized.  I would try to do a UBound() check on the return value String() but it was error out.

As for the main crash which we can not find, how about streamlining your code a bit.  The only code I need from your JukePlugin class module are the following, since it is easier for me to simply call the Command() routine directly:

Quote
Private Type PluginInfoType
    Name As String
    Author As String
    Version As String
    Description As String
End Type


Private pDC As Long
Private hDll As Long

Private pInitialize As Long
Private pShutdown As Long
Private pGetPluginInfo As Long
Private pConfigure As Long
Private pCommand As Long

Private PluginInfo As PluginInfoType

Public Function Initialize(hDC As Long, PluginName As String) As Long
    Dim RetVal As Long
   
    pDC = hDC
    hDll = LoadLibrary(PluginName)
   
    If hDll = 0 Then
        Initialize = 0
        Exit Function
    End If
       
    pGetPluginInfo = GetProcAddress(hDll, "Juke_GetPluginInfo")
   
    If IsPlugin Then
        pInitialize = GetProcAddress(hDll, "Juke_Initialize")
        pShutdown = GetProcAddress(hDll, "Juke_Shutdown")
        pConfigure = GetProcAddress(hDll, "Juke_Configure")
        pCommand = GetProcAddress(hDll, "Juke_Command")
       
        If pGetPluginInfo <> 0 Then
            Dim sPluginInfo As String
            Dim sArray() As String
           
            sPluginInfo = PtrToVBString(CallFuncPtr(pDC, pGetPluginInfo, vbNullString))
                       
            sArray = Split(sPluginInfo, "|")
                 
            If UBound(sArray, 1) + 1 = 4 Then
                PluginInfo.Name = sArray(0)
                PluginInfo.Author = sArray(1)
                PluginInfo.Version = sArray(2)
                PluginInfo.Description = sArray(3)
            End If
        End If
       
        If pInitialize <> 0 Then
            RetVal = CallFuncPtr(pDC, pInitialize, vbNullString)
        End If
    Else
        RetVal = 0
        Shutdown
    End If
   
    Initialize = RetVal
End Function

Public Function Shutdown() As Long
    Dim RetVal As Long
       
    If pShutdown <> 0 Then
        RetVal = CallFuncPtr(pDC, pShutdown, vbNullString)
    End If
   
    If hDll <> 0 Then
        FreeLibrary hDll
    End If
   
    pGetPluginInfo = 0
    pInitialize = 0
    pShutdown = 0
    pConfigure = 0
    pCommand = 0
   
    Shutdown = RetVal
End Function

Public Function Configure(hWnd As Long) As Long
    Dim RetVal As Long
    If pConfigure <> 0 Then
        RetVal = CallFuncPtr(pDC, pConfigure, hWnd)
    End If
    Configure = RetVal
End Function

Public Function Command(Name As String, ParamArray Params() As Variant) As String()
    Dim sCommand As String
    Dim sArray() As String
    Dim sParams As String
    Dim I As Integer

    For I = 0 To UBound(Params)
        sParams = sParams & Params(I)
        If I < UBound(Params) Then
            sParams = sParams & "|"
        End If
    Next
   
    If pCommand <> 0 Then
        sCommand = PtrToVBString(CallFuncPtr(pDC, pCommand, Name, sParams))
        sArray = Split(sCommand, "|")
    End If
    Command = sArray
End Function


Public Property Get IsPlugin() As Boolean
    IsPlugin = (pGetPluginInfo <> 0)
End Property

Public Property Get Name() As String
   Name = PluginInfo.Name
End Property

Public Property Get Author() As String
   Author = PluginInfo.Author
End Property

Public Property Get Version() As String
   Version = PluginInfo.Version
End Property

Public Property Get Description() As String
   Description = PluginInfo.Description
End Property

Recommendations to be make easy:

1) Only include the above code in your JukePlugin class module

2) I would love it if you changed the Command() routine to take two "String" values as input instead of the second parameter being a "String()".  It is very easy to pass a formatted string to the Command() routine so this can reduce the effort applied in this command.   

3) It would be nice to have a return value of type "String" instead of "String()" from the Command() routine as well.   The return value will only have one "|" in it, so we can do our own parsing for this .....

4) I do not see why your code need to do a bunch of timer stuff you said you added, so why not just remove all of this as well.   Lets just get down to a small subset of what you have and see if this works better.  Using older versions which did not have all of this code in it (and did not pass back String() types worked a lot better.



Title: Re: Plugins: JPS SDK 1.0 Download (Plugin & Host examples)
Post by: unclet on January 16, 2008, 10:25:04 pm
I posted my last post without knowing you responded ....

I do not use your wrapper functions because it is not convenient for me.  I already had a lot of base code in place to use my own method before you started generating all this extra code so I was not going to rip all this stuff out.   Also I could not simply call "GetPluginArray()" routine and such because I have additional logic regarding enabling/disabling plugins which is not included in your code.  It is specific to my code and this type of logic surrounds the Initialize() routine call.  You use to only supply the Initialize(), Configure(), Command() and ShutDown() routines mostly which is exactly what I wanted.  I did not mention anything since I thought perhaps Barcrest was using the wrapper stuff .... sorry.   All of my command calls go through my local routine which then loops through all plugins and then simply calls Command() routine directly.

Just to let you know all of your older plugin files have worked fine for me within the IDE.  No crashes at all.  With the new version it crashes all the time.  I can not build an EXE everytime I want to simply test stuff .... that would be a pain ... I need to stay in the IDE where I can manipulate stuff quickly.  My program is too large to create an EXE everytime and debugging code would no longer be easy if I did that either.

I hope you still do my suggestions in the thread above ... probably will resolve the crash issue as well if you just remove this stuff and just create a slimmed down "JukePlugin.jps" file to use.   Remember the Juke_Command format only has two strings now separated by only one "|" character so there is no real need to keep all the "String()" logic in place.  I would much prefer to pass in "String" values and get a "String" values returned.
Title: Re: Plugins: JPS SDK 1.0 Download (Plugin & Host examples)
Post by: headkaze on January 16, 2008, 10:57:51 pm
Just to let you know all of your older plugin files have worked fine for me within the IDE.  No crashes at all.  With the new version it crashes all the time.  I can not build an EXE everytime I want to simply test stuff .... that would be a pain ... I need to stay in the IDE where I can manipulate stuff quickly.  My program is too large to create an EXE everytime and debugging code would no longer be easy if I did that either.

I hope you still do my suggestions in the thread above ... probably will resolve the crash issue as well if you just remove this stuff and just create a slimmed down "JukePlugin.jps" file to use.   Remember the Juke_Command format only has two strings now separated by only one "|" character so there is no real need to keep all the "String()" logic in place.  I would much prefer to pass in "String" values and get a "String" values returned.

It's the new plugin (JukePlugin.jps) that is crashing the IDE not the new JukePlugin.cls file. I added a thread in there to check for key presses. When people write plugins they are going to want to use threading. So just use the old JukePlugin.jps from beta 14 as that doesn't have the threading code.

This is the code causing the IDE to crash...

Code: [Select]
JUKEPLUGIN_API int __stdcall Juke_Initialize(int Value)
{
// MessageBox(NULL, NULL, "Juke_Initialize", MB_OK);

DWORD dwThreadId= NULL, dwThrdParam = 1;

hThread = CreateThread(NULL, 0, ReadInput, &dwThrdParam, 0, &dwThreadId);

if (hThread == NULL)
return 0;

return 1;
}

Code: [Select]
DWORD WINAPI ReadInput(LPVOID lpParam)
{
while(1)
{
for(int i=0; i<256; i++)
m_keys[i] = (UCHAR) (GetAsyncKeyState(i) >> 8);

Sleep(100);
}

return 1;
}

All it does is start a thread to read input to demonstrate sending data back to the plugin.

Also I don't think I'll remove those wrapper functions as they should not effect your custom functions but may be useful to other people. Personally I think they take away alot of the hastle in knowing how certain commands need to be formatted by only allowing parameters that are required. So lets just keep that code in for now.

Sorry if I've been a bit grumpy lately I havn't been sleeping well! :badmood:

(the weather over here is hot hot hot)!   :blowup:
Title: Re: Plugins: JPS SDK 1.0 Download (Plugin & Host examples)
Post by: unclet on January 16, 2008, 11:04:28 pm
Quote
Also I don't think I'll remove those wrapper functions as they should not effect your custom functions but may be useful to other people.

This is why I never mentioned it before .... since I thought others might fine them useful.

Anyway, no problem, I will just use the JPS file without the threading .......
Title: Re: Plugins: JPS SDK 1.0 Download (Plugin & Host examples)
Post by: Space Fractal on January 17, 2008, 03:34:33 am
parsing commands in a thread should not been needed.

Make sure to copy the strings from the pointers got to a local string before parsing and changing it. Otherwice it might crash.

That is what I did with the SoundEvent plugin to avoid these hated memory unhandled when return back to BlitzMax. The sound player was do still needed to beeen a thread it self.

Otherwice there was no crashes in Project1.exe at all when I tested it (tried about 10-15 times), both plugins worked. So it mightbe it just a IDE problem when quit?

Even Keypresses worked as it should, the only problem it a bit slow and it diddent catch all keypresses. But I think small problem, but fine for a demo.

Please update the soundevent plugin to your SDK and remember to REMOVE soundevent.ini

EDIT: It project1.exe crashed when tried to load a MOVIE in the FileReqester in its SoundEvent config, that bug is fixed (forget to load the new sample in the thread).



 
Title: Re: Plugins: JPS SDK 1.0 Download (Plugin & Host examples)
Post by: loadman on January 17, 2008, 04:04:48 am
Quote
Also I don't think I'll remove those wrapper functions as they should not effect your custom functions but may be useful to other people.

This is why I never mentioned it before .... since I thought others might fine them useful.

Anyway, no problem, I will just use the JPS file without the threading .......

D'oh!   I was using it for testing  :applaud:
Title: Re: Plugins: JPS SDK 1.0 Download (Plugin & Host examples)
Post by: headkaze on January 17, 2008, 04:35:31 am
parsing commands in a thread should not been needed.

Make sure to copy the strings from the pointers got to a local string before parsing and changing it. Otherwice it might crash.

That is what I did with the SoundEvent plugin to avoid these hated memory unhandled when return back to BlitzMax. The sound player was do still needed to beeen a thread it self.

Otherwice there was no crashes in Project1.exe at all when I tested it (tried about 10-15 times), both plugins worked. So it mightbe it just a IDE problem when quit?

Even Keypresses worked as it should, the only problem it a bit slow and it diddent catch all keypresses. But I think small problem, but fine for a demo.

Please update the soundevent plugin to your SDK and remember to REMOVE soundevent.ini

EDIT: It project1.exe crashed when tried to load a MOVIE in the FileReqester in its SoundEvent config, that bug is fixed (forget to load the new sample in the thread).

Who said I was parsing commands in a thread? Do you guys actually look at the code I write? lol I dont think you do!The threading was for polling the keyboard for input to demonstrate sending data back to the host app. I thought I already said that.. oh well I guess I'll repeat myself until it sinks in  ;D

I have a buffer that I use to copy all strings into so there are no pointers to temporary memory being returned. So there should be no "hated memory unhandled" there. Check out the source I think it speaks for itself.

I removed all the threading code and turned off the timer. I think we can look at that later when everyone is ready for that. Right now it's a little troublesome although I think removing FreeLibrary solves that. As for crashing in the IDE I wouldn't even bother trying to avoid that when using threading (Again VB6 IDE is not thread-safe).

Updated source to include latest Pure Basic example :)
Title: Re: Plugins: JPS SDK 1.0 Download (Plugin & Host examples)
Post by: Space Fractal on January 17, 2008, 07:22:21 am
ok. I might misforstod it, sorry.

I do not need threading for polling keyinputs (because BlitzMax dosent support threads at all), since I just do that in each Screen Update (flip()), which is set to 30FPS (in Jukebox GUI can been set at 60FPS). MultiJuke works like BlitzMax games would do.

So a 200 millsecs timer (5FPS) for testing for inputs is to slow, since some of my input never sent back....

If the threads for keyinput polling was in the last SDK, it actuelly works fine here and did the job without crash. The crash I got was nothing with due with Project1.exe, but in SoundEvent, which was fixed in v1 (4).

Can you not in the beginning in the code tell if it run in a IDE or not, so FreeLibrary does not use under codning, if it crash the IDE (but also works fine without IDE)?


Title: Re: Plugins: JPS SDK 1.0 Download (Plugin & Host examples)
Post by: loadman on January 17, 2008, 05:39:45 pm
Quote
So lets just keep that code in for now.
:applaud:

(the weather over here is hot hot hot)!   :blowup:

Just make sure that India don't win the Cricket  ;)
Title: Re: Plugins: JPS SDK 1.0 Download (Plugin & Host examples)
Post by: unclet on January 21, 2008, 10:35:57 am
Quote
So lets just keep that code in for now.
:applaud:

loadman
Just thought I would mention that my software still does not use the threading stuff.   I believe headkaze kept that logic in his code (available in this thread) but I am not using that logic in my software.
Title: Re: Plugins: JPS SDK 1.0 Download (Plugin & Host examples)
Post by: loadman on January 21, 2008, 04:23:16 pm
Quote
So lets just keep that code in for now.
:applaud:

loadman
Just thought I would mention that my software still does not use the threading stuff.   I believe headkaze kept that logic in his code (available in this thread) but I am not using that logic in my software.


Do you forsee any issues?
Title: Re: Plugins: JPS SDK 1.0 Download (Plugin & Host examples)
Post by: unclet on January 21, 2008, 04:39:57 pm
No issues for me .... I just read a previous post from you in this thread indicating ...

Quote
D'oh!   I was using it for testing

.... and was not sure if you wanted thread logic embedded in the jukebox software.  Anyway, I just thought I would mention that the threading stuff headkaze put in the plugin logic was crashing my application since I use the IDE for development, so I decided not to use that piece.

Again ... no problem for me..... just wanted to mention that the threading stuff was not in there in case it matter to you ... for some reason 
Title: Re: Plugins: JPS SDK 1.0 Download (Plugin & Host examples)
Post by: Space Fractal on January 21, 2008, 06:22:32 pm
I also not not threading at all in MultiJuke (no support for that in BlitzMax), some of my Pure Basic plugins might use threading through when I release them (I guess I release a new one tommorow, a Remote Event plugin).

I guess he did a test how it would works with the keyevent functions works and can been used. Not to been used in a real API.

Title: Re: Plugins: JPS SDK 1.0 Download (Plugin & Host examples)
Post by: loadman on January 21, 2008, 08:22:56 pm
Yeah, But it cool to use the Host example in the API for testing... :-)
Title: Re: Plugins: JPS SDK 1.0 Download (Plugin & Host examples)
Post by: headkaze on January 22, 2008, 11:06:12 am
I've removed the threading from the latest download so there should be no problem for testing. The only trouble is if you decide to use threading in your plugin then you will need to test the plugin outside the VB6 IDE.

I don't know about you loadman but I use threading alot in my LED/LCD/Speech/Sample based plugins.

EDIT: Okay updated to 1.02 and now includes a rtf (Rich Text Format) version of the readme so it's easier to read. Loadman (or anyone) if you want you can upload this to jukeplugsys.com ;)
Title: Re: Plugins: JPS SDK 1.02 Download (Plugin & Host examples)
Post by: headkaze on January 26, 2008, 05:51:40 am
I noticed the SDK is still not on the website?  :dunno Space Fractal can you upload the archive?
Title: Re: Plugins: JPS SDK 1.02 Download (Plugin & Host examples)
Post by: Space Fractal on January 26, 2008, 05:53:47 am
Please register a new user on the site, and I set you as a EDITOR status  :D.

That SDK is your work.

I have uploaded the file now.
Title: Re: Plugins: JPS SDK 1.02 Download (Plugin & Host examples)
Post by: loadman on January 27, 2008, 05:11:34 am
I noticed the SDK is still not on the website?  :dunno Space Fractal can you upload the archive?

Sorry   :banghead:
Title: Re: Plugins: JPS SDK 1.02 Download (Plugin & Host examples)
Post by: Space Fractal on January 28, 2008, 03:31:39 pm
hehe, Loadman could also upload the file, since I gave him editor status.

If you want, headKaze, I give that one to you also, so you can update thet SDK page for new releases.