Author Topic: Updated xmp-sid input plugin??? Where is Fraggie??  (Read 716 times)

Sebby75

  • Guest
Hi there...

Looking for updated xmp-sid plugin... or some alternative plugin that would use up to date libsidplayfp 2.2.0 (or at least 2.1.1).
With current plugin 37.1 (uses libsidplayfp 1.8.1) there is bit of sound crackle with certain tunes..

Which brings other question.. what happened with Fraggie?? He did not login here since 2019 and his website with plugins seem down...
are the sources of his plugins available anywhere so that they could be used to produce updated version??

Regards
Sebby75

Sebby75

  • Guest
Re: Updated xmp-sid input plugin??? Where is Fraggie??
« Reply #1 on: 13 Jun '21 - 13:08 »
Well..

I have switched in the end to use this input plugin https://csdb.dk/release/?id=181245 which even thought it's 2 years old it seems to be using more up to date libsidplay2 library.
All .sid files that did not play correctly or had any crackling noise in them are now plying just fine...

Regards
Sebby75

Dhry

  • Posts: 100
Re: Updated xmp-sid input plugin??? Where is Fraggie??
« Reply #2 on: 3 Jul '21 - 22:57 »
Thanks for posting about this alternative SID plugin. I too have been waiting for updates on Fraggie's plugin but it seems like development is dead on it.

Switching to using the plugin you recommend. I actually mostly use either jSidDevice with Acid64 player, or else foo_sid in foobar (by kode54), both of which have the most recent libsidplayfp code. I miss using XMplay for SID files, but that's the most common exotic filetype I play.

Dhry

Sebby75

  • Guest
Re: Updated xmp-sid input plugin??? Where is Fraggie??
« Reply #3 on: 8 Jul '21 - 13:40 »
Thanks for posting about this alternative SID plugin. I too have been waiting for updates on Fraggie's plugin but it seems like development is dead on it.

Switching to using the plugin you recommend. I actually mostly use either jSidDevice with Acid64 player, or else foo_sid in foobar (by kode54), both of which have the most recent libsidplayfp code. I miss using XMplay for SID files, but that's the most common exotic filetype I play.

Dhry

Well... must have been listening to SIDs without subsongs for the last month or so...  I have only just noticed today I cannot switch between subsongs with plugin that I have linked above... so I'm back to native plugin by Fraggie for now...

Dhry

  • Posts: 100
Re: Updated xmp-sid input plugin??? Where is Fraggie??
« Reply #4 on: 9 Jul '21 - 02:35 »
Arrrgh.. FFS. You're right. Switching back as well.  >:(

Keltic Danor

  • XMPlay Support
  • Posts: 810
Re: Updated xmp-sid input plugin??? Where is Fraggie??
« Reply #5 on: 10 Jul '21 - 11:27 »
If anyone can figure out how to build libsidplayfp as a library or add it to visual studio (2010/2019/etc) properly I can probably make a new plugin. Spent many hours on trying to build libsidplayfp myself with nothing significant to show, just not something I understand well enough I suppose. ???

I'm sure it is far easier than I think it is and I'm doing something silly but I don't know what that is,  :P
« Last Edit: 10 Jul '21 - 11:40 by Keltic Danor »

Dhry

  • Posts: 100
Re: Updated xmp-sid input plugin??? Where is Fraggie??
« Reply #6 on: 11 Jul '21 - 01:18 »
If anyone can figure out how to build libsidplayfp as a library or add it to visual studio (2010/2019/etc) properly I can probably make a new plugin. Spent many hours on trying to build libsidplayfp myself with nothing significant to show, just not something I understand well enough I suppose. ??? I'm sure it is far easier than I think it is and I'm doing something silly but I don't know what that is,  :P

I'll bet if you opened a discussion on the github (https://github.com/libsidplayfp/libsidplayfp/discussions) one of the devs would help you out. Kode54 is a real nice/responsive guy, when I pinged him on Twitter asking him to update his foo_sid plugin with the latest libsidplayfp code he had it done and released within 4 hours.

Dhry

Keltic Danor

  • XMPlay Support
  • Posts: 810
Re: Updated xmp-sid input plugin??? Where is Fraggie??
« Reply #7 on: 19 Jul '21 - 09:51 »
Plugin Progress

So just a little update and there is good news and bad news.

The good news is that I asked the libsidplayfp guys the question and while I didn't get the answer I was after they gave me a soultion nonetheless, so I am using MingW (via NetBeans) instead which appears to work just fine so far.
With that worked out after a week+ of solidly smacking my face against the wall, I knocked some bricks loose and have an almost functional new plugin with all the tag loading, sub song handling, some basic settings and so forth.

The bad news is the only thing left is, of course, the most important bit, actually getting the beeps and boops to XMPlay. Math is not my strong point, nor is audio or conversion thereof which at least to my brain makes this bit of a problem. I understand the concept I think but the execution is another story.


Current Problem

So! With all that in mind I'll slap the details of the problem here and maybe one of you clever chaps can tell me "Why Keltic you silly sausage, you just divide by the square root of pie!" and we can try this puppy out.

This is the XMPlay Process function that is used to get the audio samples from the plug in as follows.
Code: [Select]

// get some sample data, always floating-point
// count=number of floats to write (not bytes or samples)
// return number of floats written. if it's less than requested, playback is ended...
// so wait for more if there is more to come (use CheckCancel function to check if user wants to cancel)

DWORD WINAPI SIDex_Process(float *buffer, DWORD count) {}


To get the goods we need to use the following function from libsidplayfp.
Code: [Select]

// Run the emulation and produce samples to play if a buffer is given.
// Parameter:   buffer pointer to the buffer to fill with samples.
// Parameter:   count the size of the buffer measured in 16 bit samples or 0 if no output is needed (e.g. Hardsid)
// Returns:   the number of produced samples. If less than requested and #isPlaying() is true an error occurred, use #error() to get a detailed message.

uint_least32_t Player::play(short *buffer, uint_least32_t count) {}



Thoughts So Far

So from start to finish with this whole thing I've had a very poor track record of thinking something is 10,000 more complicated than it actually is, or just plain over complicating things when I don't need to. *cough*Sorry for the silly emails Ian  :-X*cough*

Despite that I was thinking it would work something like the following.
Code: [Select]

DWORD WINAPI SIDex_Process(float *buffer, DWORD count){
     // I figure count can just be used in the play command since it is the same thing right?
     // I'll pop the result into a temporary buffer since XMPlay wants floats
     // sidDone is just to pass back how many we actually got
     short * sidBuffer;
     int sidDone=0;

     // Then we'll do the command to get some samples
     sidDone = sidEngine.m_engine->play(sidBuffer, count);

     // Next we'll do some fancy conversion of the sidBuffer from short to float and populate the buffer provided by XMPlay
     // I either have no idea how to do this, or my conversion was fine and the above is not actually correct.
     // I tested with memcpy(&buffer,&sidBuffer,std::min(sizeof(buffer),sizeof(sidBuffer))); just to get something through and it plays nonsense
     // Despite playing nonsense it does play which suggests the sidDone number is correct and it returned the count as requested
     // So my theory is if I can convert he short properly it will presumably work?

     // Let XMPlay know how many we got if it needs to stop
     return sidDone;
}


For reference though I have tried to figure it out by looking at foobars foo_sid, winamps in_sidplay2, hippoplayer sid plugin, the sid support in another xmplay plugin (zxtune) and the sidplayfp app. Over the development I have also looked at probably every single plug in for XMPlay that has source available, so quite the adventure. All of which has been very useful in the general building of the plug in but not for this bit in particularly.

Any thoughts are welcome.  ;D

Dhry

  • Posts: 100
Re: Updated xmp-sid input plugin??? Where is Fraggie??
« Reply #8 on: 19 Jul '21 - 17:37 »
Outstanding work!! Anxiously awaiting anything you produce - happy to beta test.

DRS

drfiemost

  • Guest
Re: Updated xmp-sid input plugin??? Where is Fraggie??
« Reply #9 on: 19 Jul '21 - 20:18 »
Float samples are usually in the range [-1,1] while short are in [-32768,32767] so you need to loop on each sample, cast it to float and dividing it by 32768.
Something along the lines of:

Code: [Select]
for (i=0;i<sidDone;i++)
    buffer[i] = (float)(sidBuffer[i])/32768.f

Keltic Danor

  • XMPlay Support
  • Posts: 810
Re: Updated xmp-sid input plugin??? Where is Fraggie??
« Reply #10 on: 20 Jul '21 - 09:56 »
Float samples are usually in the range [-1,1] while short are in [-32768,32767] so you need to loop on each sample, cast it to float and dividing it by 32768.
Something along the lines of:

Code: [Select]
for (i=0;i<sidDone;i++)
    buffer[i] = (float)(sidBuffer[i])/32768.f

Oh hello again! ;D

No luck with that one unfortunately, it just crashes out. I've since gone through the whole thing checking the engine is working proper, that config is being applied okay and that isplaying returns true and as far as I can tell everything is working properly on that side of things. I also checked all the error() functions and all returned NA or N/A so I guess there are no sneaky errors on the sidplay side.

Edit 1:
That said whenever I refer to
Code: [Select]
sidBuffer[i] at all things crash and writing sidBuffer to a file without an index it is always 0, so maybe that's where my problem is.

Edit 2:
I figure since it was giving me 0 maybe it was the library somehow, I tried a different approach and built libsidplayfp via command line in MSYS2 (just ./configure && make so I didn't mess with it), I then made a brand spanking new project and included that libsidplayfp in the project instead of the one I built in netbeans to see if maybe I had made a mistake when building it myself. But after all that it produced the same result unfortunately. So must be something else! Back to the drawing board.


« Last Edit: 21 Jul '21 - 10:21 by Keltic Danor »

drfiemost

  • Guest
Re: Updated xmp-sid input plugin??? Where is Fraggie??
« Reply #11 on: 20 Jul '21 - 19:55 »
Oh, yes! You should obviously allocate sdiBuffer before using it. Player::play just fills it with samples and won't do it for you.

Keltic Danor

  • XMPlay Support
  • Posts: 810
Re: Updated xmp-sid input plugin??? Where is Fraggie??
« Reply #12 on: 21 Jul '21 - 09:21 »
Oh, yes! You should obviously allocate sdiBuffer before using it. Player::play just fills it with samples and won't do it for you.

It works! :o Thank you for all the help! ;D

I've attached a version for testing Dhry, I don't think it has any DLL dependency issues that I can see and also be aware of the following:
- Config settings may not save properly, it should work just... you know.
- Seeking is disabled - I don't think I'll do that bit + I don't know how to.
- Separating SID files in the play list and playing them individually doesn't work, not sure why but will look into it another time.
- Only the ReSIDfp core is available at this time, I may or may not add ReSID later, not sure it is necessary.
- Only full paths work for the songlength.md5 database for the moment.
« Last Edit: 22 Jul '21 - 10:55 by Keltic Danor »

Dhry

  • Posts: 100
Re: Updated xmp-sid input plugin??? Where is Fraggie??
« Reply #13 on: 21 Jul '21 - 16:13 »
On it! Just woke up - will report back later.
THANK YOU!!!!!!!!!!

PS: Seeking's a must, for me anyway - there are quite a few SIDs where I skip them to parts that I like, but that's low pri as it's early days. I'm just glad for development to be active on SOMETHING that plays my favourite music format.

DRS

Dhry

  • Posts: 100
Re: Updated xmp-sid input plugin??? Where is Fraggie??
« Reply #14 on: 21 Jul '21 - 16:24 »
Oops. Looks like there are missing dependencies - the plugin doesn't load or show in xmplay's list at all.

Dependency Walker shows the following, along with a list (attaching) of missing dependencies.

Error: At least one required implicit or forwarded dependency was not found.
Error: Modules with different CPU types were found.
Warning: At least one delay-load dependency module was not found.


All files in the attached list are marked: Error opening file. The system cannot find the file specified (2).

saga

  • Posts: 2514
Re: Updated xmp-sid input plugin??? Where is Fraggie??
« Reply #15 on: 21 Jul '21 - 16:48 »
I hope you'll put this plugin on GitHub / GitLab / etc. so that others can finish the parts you mentioned you don't want to implement, and so that this whole situation is not going to happen a second time. :)

Dhry

  • Posts: 100
Re: Updated xmp-sid input plugin??? Where is Fraggie??
« Reply #16 on: 21 Jul '21 - 16:58 »
I hope you'll put this plugin on GitHub / GitLab / etc. so that others can finish the parts you mentioned you don't want to implement, and so that this whole situation is not going to happen a second time. :)

Totally agreed!

BTW I tried installing both the Visual Studio 2015, 2017 and 2019 files (vc_redist.x86.exe and vc_redist.x64.exe) runtimes from https://support.microsoft.com/en-us/topic/the-latest-supported-visual-c-downloads-2647da03-1eea-4433-9aff-95f26a218cc0 and rebooted, and still the plugin does not load when starting xmplay. Googling the error I see something about statically linking libraries during compile time?

DRS

Sebby75

  • Posts: 7
Re: Updated xmp-sid input plugin??? Where is Fraggie??
« Reply #17 on: 21 Jul '21 - 17:33 »

It works! :o Thank you for all the help! ;D

I've attached a version for testing Dhry, I don't think it has any DLL dependency issues that I can see and also be aware of the following:


Bloody marvelous.. thanks for this... but at the moment it doesn't seem to show up in plugin list... seem to require libstdc++-6.dll and libgcc_s_dw2-1.dll to run..
I think you need to link these during compilation??



Regards
Sebby75

drfiemost

  • Guest
Re: Updated xmp-sid input plugin??? Where is Fraggie??
« Reply #18 on: 21 Jul '21 - 18:05 »
Guess the "-static-libgcc -static-libstdc++" flags are needed for linking

Keltic Danor

  • XMPlay Support
  • Posts: 810
Re: Updated xmp-sid input plugin??? Where is Fraggie??
« Reply #19 on: 22 Jul '21 - 07:01 »
Hmmm... well poo. :(

Okay, added static linking for the MingW libraries which seems to make it work in my tests on another machine. It makes the .dll massive though which I'm not happy about... but it's okay *deep breath* just need to make sure it works before worrying about that I hope Scratch that, Dr. Fiemost to the rescue again, it makes it bigger but not too bad, you can UPX it to 400KB~ if you are hurting for space for portability reasons. I swear I've spent about a day and a half writing the plugin and 2 weeks fighting with IDE's and that nonsense.  ::)

Anyway here we are for now, too big to attach on the forum.

Downloads
xmp-sidex0.4.zip
xmp-sidex0.4source.zip

I don't know much about Github to be honest but I've added it here for the moment: https://github.com/KelticDanor/xmp-SIDex

Updates
v0.4
- Seeking sort of enabled, it is probably a bit janky
v0.3
- Separating SID files in the play list and playing them individually works now
- Config saving seems to work okay now

Notes
- Only the ReSIDfp core is available at this time, I may or may not add ReSID later, not sure it is necessary.
- Only full paths work for the songlength.md5 database for the moment.
- Unicode characters arn't handled so Mr Chris Hülsbeck is causing me mischief, still works just names are cut off.
« Last Edit: 22 Jul '21 - 11:22 by Keltic Danor »

Dr. Fiemost

  • Posts: 15
Re: Updated xmp-sid input plugin??? Where is Fraggie??
« Reply #20 on: 22 Jul '21 - 08:56 »
Maybe it's just debugging symbols, you can try strip the DLLs or using the -s linking flag.

Keltic Danor

  • XMPlay Support
  • Posts: 810
Re: Updated xmp-sid input plugin??? Where is Fraggie??
« Reply #21 on: 22 Jul '21 - 09:23 »
Maybe it's just debugging symbols, you can try strip the DLLs or using the -s linking flag.
Oh... you're good at this stuff. ;D

That took it from 11MB+ to 1.4MB, I'm happier with that, thanks again!

Dhry

  • Posts: 100
Re: Updated xmp-sid input plugin??? Where is Fraggie??
« Reply #22 on: 22 Jul '21 - 16:21 »
It works!!! Great job!

Seeking also works here as well, as do subtunes. And you're right, unicode-style characters are cut off but honestly that's super low pri for me since I don't look at that particular section of xmplay (it's always been totally irrelevant for me) - I prefer the separate library/playlist window and display in there looks perfectly fine to me.

Just woke up and am madly playing with this like it's christmas morning. I'll keep messing with it throughout the day and let you know what I find. Thank you again!

DRS

Dhry

  • Posts: 100
Re: Updated xmp-sid input plugin??? Where is Fraggie??
« Reply #23 on: 22 Jul '21 - 16:27 »
Oops. First defect: plays songs too fast.

Try:
\HVSC\MUSICIANS\H\Hubbard_Rob\Lightforce.sid
\HVSC\MUSICIANS\H\Hubbard_Rob\Master_of_Magic.sid

Both tracks play at something like double speed versus the original speed.

Just figured out what it was. I had changed the frequency from 44100 to 48000. This appears to increase playback speed where it should not.

Cheers
DRS

Dhry

  • Posts: 100
Re: Updated xmp-sid input plugin??? Where is Fraggie??
« Reply #24 on: 22 Jul '21 - 18:25 »
Question: What SID filter settings are you defaulting to for playback?
Have a listen to Subtune 3 for Rob's Life (http://deepsid.chordian.net/?file=/MUSICIANS/H/Hubbard_Rob/Robs_Life.sid&subtune=3) - in particular the "snare drum" sound.

In your plugin's playback it sounds a bit muted. Sounds brighter in the Deepsid playback.
I know that the SID filter affects this particular sound significantly as I've messed around with it using the jSIDPlay device output and Acid64.

Just wondering if there are any modes that you can select in the libsidplay library for filter so that the user can choose 1) to use it or not, and/or 2) to either choose from preset default strengths (as with Acid64), or else (as with Fraggie's plugin) have a slider controlling the strength as a percentage for either 6581 or 8580. The implementation right now doesn't sound horrible, but that snare should sound a bit brighter IMO.

I know it's super early days right now so just curious.

Cheers
DRS