Main Restorations Software Audio/Jukebox/MP3 Everything Else Buy/Sell/Trade
Project Announcements Monitor/Video GroovyMAME Merit/JVL Touchscreen Meet Up Retail Vendors
Driving & Racing Woodworking Software Support Forums Consoles Project Arcade Reviews
Automated Projects Artwork Frontend Support Forums Pinball Forum Discussion Old Boards
Raspberry Pi & Dev Board controls.dat Linux Miscellaneous Arcade Wiki Discussion Old Archives
Lightguns Arcade1Up Try the site in https mode Site News

Unread posts | New Replies | Recent posts | Rules | Chatroom | Wiki | File Repository | RSS | Submit news

  

Author Topic: Plugins: Sound Event test plugin.  (Read 4089 times)

0 Members and 1 Guest are viewing this topic.

Space Fractal

  • Wiki Master
  • Trade Count: (+1)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 1888
  • Last login:September 26, 2023, 11:32:13 am
  • Space Fractal
    • Space Fractal
Plugins: Sound Event test plugin.
« on: January 10, 2008, 03:35:13 pm »
To been eiaser to find (hopefully) working plugins to been tested by Jukebox authors instead using the very long thread.



I starting here with a little test sound event plugin to the authors to test with with full config and all.

5 plugin commands is used and all source is included (but there is by now nearly no comments in the Pure Basic Source).

I do havent test with a host software, but did internal tested it. Hope fully it works with Visual Basic.


Updated to sync with the sperated shutdown, config and init commands()... Find the file some posts below.


« Last Edit: January 11, 2008, 08:01:43 am by Space Fractal »
Decade Old Work: MultiFE, ArcadeMusicBox
Today Works: Various Spectrum Next games from Rusty Pixels and html5 games.

Barry Barcrest

  • I'm only in it for the lack of money
  • Trade Count: (+2)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1620
  • Last login:November 09, 2021, 09:54:17 am
  • Simple Plan
    • E-Touch Jukebox
Re: Plugins: Real test plugins from developers
« Reply #1 on: January 10, 2008, 07:37:51 pm »
This plugin crashes Visual Basic for me when i try to initialise it using the latest source Headkaze posted. However i renamed headkaze's DLL to JPS and used that fine.

Have you added the return strings for when i intialise it? That might be the problem

Space Fractal

  • Wiki Master
  • Trade Count: (+1)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 1888
  • Last login:September 26, 2023, 11:32:13 am
  • Space Fractal
    • Space Fractal
Re: Plugins: Real test plugins from developers
« Reply #2 on: January 11, 2008, 12:10:09 am »
I need your visual basic host, so I can see what it does. Iguess it some thing a memory invaild things? Can mightbe be a wrong call thing.
Decade Old Work: MultiFE, ArcadeMusicBox
Today Works: Various Spectrum Next games from Rusty Pixels and html5 games.

Barry Barcrest

  • I'm only in it for the lack of money
  • Trade Count: (+2)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1620
  • Last login:November 09, 2021, 09:54:17 am
  • Simple Plan
    • E-Touch Jukebox
Re: Plugins: Real test plugins from developers
« Reply #3 on: January 11, 2008, 12:45:39 am »
I used headkraze's code. If you get that and try and use it with your plugin you should see what is happening. I can't even initialise you plugin without it crashing VB

Space Fractal

  • Wiki Master
  • Trade Count: (+1)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 1888
  • Last login:September 26, 2023, 11:32:13 am
  • Space Fractal
    • Space Fractal
Re: Plugins: Real test plugins from developers
« Reply #4 on: January 11, 2008, 01:16:41 am »
It missing some added functions, hence it crash. I update it when I went home to sync with his functions.

Im are going out now to work.
Decade Old Work: MultiFE, ArcadeMusicBox
Today Works: Various Spectrum Next games from Rusty Pixels and html5 games.

Space Fractal

  • Wiki Master
  • Trade Count: (+1)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 1888
  • Last login:September 26, 2023, 11:32:13 am
  • Space Fractal
    • Space Fractal
Re: Plugins: Real test plugins from developers
« Reply #5 on: January 11, 2008, 07:55:28 am »
I cannot get this to work and some init commands is also wrong.

HeadKaze can you try if you can get this plugin to work?

Config button did also nothing to the Sound Event plugin?

 I can init and getinfo to work (but for somereason, it diddent parsed correct).



Here is a new version of plugin that using these standard functions:

ProcedureDLL.l Juke_Command(Command.l, value.l)
ProcedureDLL.l Juke_Configure(winID.l)
ProcedureDLL.l Juke_GetPluginInfo(value.l)
ProcedureDLL.l Juke_Initialize(value.l)
ProcedureDLL.l Juke_Shutdown(value.l)

the commands used is on the readme file.

Only the last one seen to work without crash, so a least one function worked. There are messeqe requester to all functions if they can invoke to make sure it work.
« Last Edit: January 11, 2008, 06:38:58 pm by Space Fractal »
Decade Old Work: MultiFE, ArcadeMusicBox
Today Works: Various Spectrum Next games from Rusty Pixels and html5 games.

headkaze

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 2943
  • Last login:August 14, 2023, 02:00:48 am
  • 0x2b|~0x2b?
Re: Plugins: Real test plugins from developers
« Reply #6 on: January 11, 2008, 05:55:01 pm »
I cannot get this to work and some init commands is also wrong.

HeadKaze can you try if you can get this plugin to work?

Config button did also nothing to the Sound Event plugin?

 I can init and getinfo to work (but for somereason, it diddent parsed correct).



Here is a new version of plugin that using these standard functions:

ProcedureDLL.l Juke_Command(Command.l, value.l)
ProcedureDLL.l Juke_Configure(winID.l)
ProcedureDLL.l Juke_GetPluginInfo(value.l)
ProcedureDLL.l Juke_Initialize(value.l)
ProcedureDLL.l Juke_Shutdown(value.l)

the commands used is on the readme file.

Only the last one seen to work without crash, so a least one function worked. There are messeqe requester to all functions if they can invoke to make sure it work.

Juke_Initialize() returns a 32 bit integer and takes a 32 bit integer as a parameter. You should return 1 for success and 0 for failure.

GetPluginInfo returns a PCHAR. It works like how you return a string from PeekMemory.dll. Have a look at the C++ plugin example I posted and use that as a guide.

Make sure you export your functions as stdcall.

We currently have a C++ and Delphi examples working so there must be something going wrong in your code.

Why not just try a basic plugin that outputs a message first?
« Last Edit: January 11, 2008, 05:59:41 pm by headkaze »

Space Fractal

  • Wiki Master
  • Trade Count: (+1)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 1888
  • Last login:September 26, 2023, 11:32:13 am
  • Space Fractal
    • Space Fractal
Re: Plugins: Sound Event test plugin.
« Reply #7 on: January 11, 2008, 06:38:15 pm »
I forgot the update, that worked 100% with blitzmax, but still some issues with the VB_HOST, but some calls DOES work (yes I used messages first, but removed them later).

init and getinfo, shutdown seen works, but crash when exit and config does nothing.

I have no idea where it crash since I have no Visual Basic 6 and where I should fix, so I asume the commandlist is not 100% correct in the HOST?



All functions does calls correct, but just crash when your host (got a crash message twice) close (did you close the library?).

Otherwice it works now fine.

I Look what happens.




« Last Edit: January 11, 2008, 06:53:40 pm by Space Fractal »
Decade Old Work: MultiFE, ArcadeMusicBox
Today Works: Various Spectrum Next games from Rusty Pixels and html5 games.

loadman

  • Wiki Contributor
  • Trade Count: (+3)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 4306
  • Last login:May 26, 2024, 05:14:32 am
  • Cocktail Cab owner and MaLa FE developer
    • MaLa
Re: Plugins: Sound Event test plugin.
« Reply #8 on: January 11, 2008, 06:55:05 pm »
I have no idea where it crash since I have no Visual Basic 6 and where I should fix, so I asume the commandlist is not 100% correct in the HOST?

I have found no problems yet using Delphi.

We might give HedKaze a rest here and to help you and Barcrest I will expand on HeadKaze's VB6 example to help you find the problem. Hang on and I will post it here when done
« Last Edit: January 11, 2008, 06:56:55 pm by loadman »

headkaze

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 2943
  • Last login:August 14, 2023, 02:00:48 am
  • 0x2b|~0x2b?
Re: Plugins: Sound Event test plugin.
« Reply #9 on: January 11, 2008, 07:01:24 pm »
There is no problem in the VB6 Host AFAIK because it's already tested as working with two different types of languages. Do you think maybe it's something wrong in your code?

The Configuration shows up for me but it does crash when it exits. In the VB6 Host example I only open up the config for the first plugin in the list. So try to remove the Plugins\JukePlugin.dll example so it will open your config.

We might give HedKaze a rest here and to help you and Barcrest I will expand on HeadKaze's VB6 example to help you find the problem. Hang on and I will post it here when done

I don't think there is anything wrong with the VB6 Host example. I suspect it's a problem in Space Fractals code otherwise the other two example plugins would crash on exit too right?
« Last Edit: January 11, 2008, 07:04:30 pm by headkaze »

Space Fractal

  • Wiki Master
  • Trade Count: (+1)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 1888
  • Last login:September 26, 2023, 11:32:13 am
  • Space Fractal
    • Space Fractal
Re: Plugins: Sound Event test plugin.
« Reply #10 on: January 11, 2008, 07:07:47 pm »
They might unload the library automatic?

Pure Basic might used code, that require that, but cant see you doing that in your VB6 code?

In my wrapper I make sure the library is closed before exit and I have no problem in BlitzMax too (but did have many memory issues).

What does the debugger say, since I assume Visual Basic 6 debugger should catch the crash?

I tried Shutdown message to the bottom of the code, and it does show correct.


« Last Edit: January 11, 2008, 07:17:27 pm by Space Fractal »
Decade Old Work: MultiFE, ArcadeMusicBox
Today Works: Various Spectrum Next games from Rusty Pixels and html5 games.

headkaze

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 2943
  • Last login:August 14, 2023, 02:00:48 am
  • 0x2b|~0x2b?
Re: Plugins: Sound Event test plugin.
« Reply #11 on: January 11, 2008, 07:19:36 pm »
They might unload the library automatic?

Pure Basic might used code, that require that, but cant see you doing that in your VB6 code?

In my wrapper I make sure the library is closed before exit and I have no problem in BlitzMax too (but did have many memory issues).

What does the debugger say, since I assume Visual Basic 6 debugger should catch the crash?

I tried Shutdown message to the bottom of the code, and it does show correct.

All you have to do is take a look at the JukePlugin.cls file in the VB6 Host example and you will see I do unload the library!

Code: [Select]
Public Function Shutdown() As Long
    Dim RetVal As Long
       
    If pShutdown <> 0 Then
        RetVal = CallFuncPtr(pDC, pShutdown, vbNullString)
    End If
    FreeLibrary hDll ' <------------------ Unload the library
   
    pGetPluginInfo = 0
    pInitialize = 0
    pShutdown = 0
    pConfigure = 0
    pCommand = 0
   
    Shutdown = RetVal
End Function

There is a bug in your Juke_Shutdown() function!

BTW You forgot the include the source code in SoundEvent_v3.zip so I can't help find the bug ;)
« Last Edit: January 11, 2008, 07:31:29 pm by headkaze »

Space Fractal

  • Wiki Master
  • Trade Count: (+1)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 1888
  • Last login:September 26, 2023, 11:32:13 am
  • Space Fractal
    • Space Fractal
Re: Plugins: Sound Event test plugin.
« Reply #12 on: January 11, 2008, 07:31:19 pm »
Look like it a Bug in Visual Basic 6 itself under unload  ???

I dosent have any unload code, since Pure Basic normally do that code itself. Suddently it works both in Delphi and BlitzMax (using a dll wrapper), but not Visual Basic 6....

What happens is you do NOT unload the dll?

« Last Edit: January 11, 2008, 07:34:25 pm by Space Fractal »
Decade Old Work: MultiFE, ArcadeMusicBox
Today Works: Various Spectrum Next games from Rusty Pixels and html5 games.

headkaze

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 2943
  • Last login:August 14, 2023, 02:00:48 am
  • 0x2b|~0x2b?
Re: Plugins: Sound Event test plugin.
« Reply #13 on: January 11, 2008, 07:35:49 pm »

Look like it a Bug in Visual Basic 6 itself under unload  ???

I dosent have any unload code, since Pure Basic normally do that code itself. Suddently it works both in Delphi and BlitzMax (using a dll wrapper), but not Visual Basic 6....

What happens is you do NOT unload the dll?

Removing FreeLibrary() from the VB6 Host Shutdown method does stop the crashing. But unloading a dll using FreeLibrary should not do that. It works in the two other examples so it must be something wrong with your plugin!!

Okay looked at your Juke_Shutdown() method and it is pretty much empty! So maybe you are not freeing other resources your using in the dll?

Do you need to call FreeSound() and DeleteElement() in Plugin_Shutdown() perhaps?
« Last Edit: January 11, 2008, 07:39:43 pm by headkaze »

Space Fractal

  • Wiki Master
  • Trade Count: (+1)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 1888
  • Last login:September 26, 2023, 11:32:13 am
  • Space Fractal
    • Space Fractal
Re: Plugins: Sound Event test plugin.
« Reply #14 on: January 11, 2008, 08:18:04 pm »
InitSound() caused the bug, and for some reason it did not unload correct. It can been a Pure Basic, Vusial Basic 6 and or a DirectX issue. I guess it a bug in Visual Basic 6 it self with that command?

Without using that pure basic command (and no other sound), it did works fine and closed correctly.

By why did only Visual Basic 6 crash?

To make sure, we might need to add a another argument to plug-in info to make sure Visual Basic 6 does NOT close down the library, when a Plugin use such of libraris to avoid that issues?

« Last Edit: January 11, 2008, 08:27:01 pm by Space Fractal »
Decade Old Work: MultiFE, ArcadeMusicBox
Today Works: Various Spectrum Next games from Rusty Pixels and html5 games.

loadman

  • Wiki Contributor
  • Trade Count: (+3)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 4306
  • Last login:May 26, 2024, 05:14:32 am
  • Cocktail Cab owner and MaLa FE developer
    • MaLa
Re: Plugins: Sound Event test plugin.
« Reply #15 on: January 11, 2008, 08:35:49 pm »
The Configuration shows up for me but it does crash when it exits. In the VB6 Host example I only open up the config for the first plugin in the list. So try to remove the Plugins\JukePlugin.dll example so it will open your config.
I don't think there is anything wrong with the VB6 Host example. I suspect it's a problem in Space Fractals code otherwise the other two example plugins would crash on exit too right?

I had it crash on me on exit earlier. That is because I did something wrong it Delphi.

Apon Juke box exit I needed to

function Juke_Shutdown(Value: Integer):Integer; stdcall;
begin
  Showmessage('DLL has recieved Juke_Shutdown message');
  Form1.Close;  // In case the config window is still open
   Form1.Free;  // Or the program will crash
  Result := 1
end;
« Last Edit: January 11, 2008, 09:04:47 pm by loadman »

headkaze

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 2943
  • Last login:August 14, 2023, 02:00:48 am
  • 0x2b|~0x2b?
Re: Plugins: Sound Event test plugin.
« Reply #16 on: January 11, 2008, 08:43:09 pm »
Space Fractal: Yes I think that some resources your using in your plugin are not being cleared up in the Juke_Shutdown() function and that is causing the crash. Maybe try UnLoadAllSounds(). It is not VB6 causing this it's your plugin. Removing FreeLibrary works but it still does not fix the bug in your plugin. You have outstanding handles or resources still open.

loadman

  • Wiki Contributor
  • Trade Count: (+3)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 4306
  • Last login:May 26, 2024, 05:14:32 am
  • Cocktail Cab owner and MaLa FE developer
    • MaLa
Re: Plugins: Sound Event test plugin.
« Reply #17 on: January 11, 2008, 09:20:15 pm »
We might give HedKaze a rest here and to help you and Barcrest I will expand on HeadKaze's VB6 example to help you find the problem. Hang on and I will post it here when done

I don't think there is anything wrong with the VB6 Host example. I suspect it's a problem in Space Fractals code otherwise the other two example plugins would crash on exit too right?

I wasn't suggesting there was  ;)

I meant I was going to make a VB6 tool to help him identify the bug in his code  ;D

Space Fractal: Yep your Plug-In Crashes on Exit for me. 
« Last Edit: January 11, 2008, 10:01:48 pm by loadman »

Barry Barcrest

  • I'm only in it for the lack of money
  • Trade Count: (+2)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1620
  • Last login:November 09, 2021, 09:54:17 am
  • Simple Plan
    • E-Touch Jukebox
Re: Plugins: Sound Event test plugin.
« Reply #18 on: January 12, 2008, 12:29:36 am »
I'm using headkraze's code.. I think the plugin has issues personally.

Space Fractal

  • Wiki Master
  • Trade Count: (+1)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 1888
  • Last login:September 26, 2023, 11:32:13 am
  • Space Fractal
    • Space Fractal
Re: Plugins: Sound Event test plugin.
« Reply #19 on: January 12, 2008, 07:25:55 am »
Visual Basic 6 diddent like any Movie or Sound commands used in Pure Basic without using a thread.

I tried to separate all movie commands (can also play sound only commands) them using a Thread, and let shutdown() kill that thread when done.

That seen fixed that problem for Visual Basic 6....

I remember also I did have similar problems with BlitzBasic with the same issue when I created a little Bass.dll Wrapper in Pure Basic for the Arcade Music Box.

Some bass.dll crashed same way when went back to the host, unless created a thread to all playing commands. I simply got "Unhandled Memory" message every time....

The Pure Basic source is included.

HeadKaze, you can include this new version to SDK. A comment the source better later.

I also want have your little host to read dll extension as well jps, so I can testing it with that without renaming dll file every time. But for all real hosts use jps extenison only.






« Last Edit: January 12, 2008, 08:25:19 am by Space Fractal »
Decade Old Work: MultiFE, ArcadeMusicBox
Today Works: Various Spectrum Next games from Rusty Pixels and html5 games.

loadman

  • Wiki Contributor
  • Trade Count: (+3)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 4306
  • Last login:May 26, 2024, 05:14:32 am
  • Cocktail Cab owner and MaLa FE developer
    • MaLa
Re: Plugins: Sound Event test plugin.
« Reply #20 on: January 12, 2008, 04:41:53 pm »

I also want have your little host to read dll extension as well jps, so I can testing it with that without renaming dll file every time. But for all real hosts use jps extenison only.


Can you not save dll's as .jps (or wahtever)?  You can set the extension in the Delphi IDE

Space Fractal

  • Wiki Master
  • Trade Count: (+1)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 1888
  • Last login:September 26, 2023, 11:32:13 am
  • Space Fractal
    • Space Fractal
Re: Plugins: Sound Event test plugin.
« Reply #21 on: January 12, 2008, 04:52:01 pm »
Not in Purebasic, it just save as SoundEvent.jps.dll instead if I try. I need to rename that manual. I do still prefer JPS extension for any released plugins (Hence MultiJuke use JPS as well).
Decade Old Work: MultiFE, ArcadeMusicBox
Today Works: Various Spectrum Next games from Rusty Pixels and html5 games.

loadman

  • Wiki Contributor
  • Trade Count: (+3)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 4306
  • Last login:May 26, 2024, 05:14:32 am
  • Cocktail Cab owner and MaLa FE developer
    • MaLa
Re: Plugins: Sound Event test plugin.
« Reply #22 on: January 12, 2008, 05:38:11 pm »
Not in Purebasic, it just save as SoundEvent.jps.dll instead if I try. I need to rename that manual. I do still prefer JPS extension for any released plugins (Hence MultiJuke use JPS as well).

Agreed  :)

OK well for the JukeStub Program I am working on (slowly as I'm not used to VB)  I will have it recognise DLL or JPS as that will speed up testing.

headkaze

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 2943
  • Last login:August 14, 2023, 02:00:48 am
  • 0x2b|~0x2b?
Re: Plugins: Sound Event test plugin.
« Reply #23 on: January 12, 2008, 05:56:19 pm »
Space Fractal: Glad you got the SoundEvent program working in VB6. It's strange you had to put that sound code in a separate thread. It doesn't make sense to me why you would have to do that.

Space Fractal

  • Wiki Master
  • Trade Count: (+1)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 1888
  • Last login:September 26, 2023, 11:32:13 am
  • Space Fractal
    • Space Fractal
Re: Plugins: Sound Event test plugin.
« Reply #24 on: January 13, 2008, 06:18:00 am »
Yep, Strange but works. Look like some external resouce Pure Basic used could not release correct.

Otherwice here is a new update to sync with beta 10 of the SDK (but combatible with the old KEY_EVENT commands, that got renamed)....

The version number is changed to sync with the SDK version number, since the plugin is a example.
« Last Edit: January 13, 2008, 06:31:19 am by Space Fractal »
Decade Old Work: MultiFE, ArcadeMusicBox
Today Works: Various Spectrum Next games from Rusty Pixels and html5 games.