Topic: NSISBASS Resurrected!  (Read 7426 times)

0 Members and 1 Guest are viewing this topic.

Offline Bonk

  • Commodore
  • *
  • Posts: 13298
  • You don't have to live like a refugee.
NSISBASS Resurrected!
« on: January 27, 2008, 08:22:51 am »
Quote
NSISBASS is a frontend to the BASS Sound System which allows you to play MPEG (all layers), OGG, MOD (all types) in your NSIS installers. It consists of a NSIS Header file (.NSH) wich defines several macros to do the actual work.


This is something I was working on last week. It's still not finished (but more complete than the starting product). I decided to do this after I discovered mo3 files and remembered I had this old set of NSIS includes, so I updated it to work with the latest BASS release (2.3). It needs more functionality filled in to fully utilise BASS (3d etc. and the callback functions need to be implemented properly first), but it seems to play mo3, mp3 and XM files just fine. I had intended to finish this and then start a 3d model display plugin, but I've got some other stuff to work on first so I thought I'd post this in it's current state in case anyone finds it useful. I Intend to come back to this and complete it. Extract the attached files to \Contrib\nsisbass in your NSIS installation. See the readme.html and examples for usage.

It really is quite impressive. The first example produces a 324KB exe that contains 5m47s of 48000Hz 16bit music. Pretty cool! (zipped exe attached)

EDIT: Updated Feb 13, 2008 (v2.4 - internet radio support + tags - example attached)
EDIT: Updated Feb 22, 2008 (v2.5 - Added volume control and cpu usage monitor - example 5 updated)
EDIT: Updated Feb 26, 2008 (v2.6 - Added error code return, channel flags, documented pause/resume - new MUI example)
EDIT: Updated Feb 27, 2008 (v2.7 - Cleaned up syntax, polished MUI example, noted upx effecting a decreased load time!)
« Last Edit: February 27, 2008, 01:08:02 pm by Bonk »

Offline Tus-XC

  • Capt
  • XenoCorp® Member
  • Commander
  • *
  • Posts: 2789
  • Gender: Male
Re: NSISBASS Resurrected!
« Reply #1 on: January 28, 2008, 12:43:47 am »
interestin... might have to look at this just to look at it ;).   ooo... and what is this 3d model display plugin you speak of... you have created some curiosity in me ;)
Rob

"Elige Sortem Tuam"

Offline Bonk

  • Commodore
  • *
  • Posts: 13298
  • You don't have to live like a refugee.
Re: NSISBASS Resurrected!
« Reply #2 on: January 28, 2008, 08:12:27 am »
I had this baked idea of making 3D software installers (almost all machines have 3d hardware now). So instead of 2d menus and lists, you could fly a ship (or whatever) around and shoot at objects that do things like display the docs in a frame in the 3d environment, launch an updater "subspace link" interface... etc. Kinda silly, and definitely not needed but could be fun and make for flashy installers, that feature components of the mods themselves. I don't recall seeing anything like that anywhere and I do wonder if it is a good idea to blab the concept, but there it is. I intend to use meshes in .x format and call the directx dlls from NSIS. Initial efforts will just be for display of a model, if I can get that done then I'll add the functionality I described above. But I have to shelf the idea for now as there is something else to work on right now.

Offline Bonk

  • Commodore
  • *
  • Posts: 13298
  • You don't have to live like a refugee.
Re: NSISBASS Resurrected!
« Reply #3 on: February 10, 2008, 11:45:48 pm »
Updated the attachment above with the latest version which now supports internet radio. (low bandwidth sample also attached)

I added a macro:
Code: [Select]
!macro NSISBASS_PLAYNET URL OFFSET FLAGS BUFFER USER Example usage:
Code: [Select]
!insertmacro NSISBASS_PLAYNET "http://radioparadise.steadyhost.com:8032" 0 0 0 0
I can't get it to do playlists yet, just a single stream url, I expect because I still have not implemented callback functions for this project properly. I'm having a little difficulty wrapping my head around the parts of the documentation that read like this:

Quote
After you've processed the callback call, you should use Call, passing it the value returned by Get - the callback. This tells System to return from the callback. Destination of the return "parameter" must be cleared prior to calling a function, to avoid false detection of a callback call. If you've specified a source for the return "parameter" when the callback was created, you should fill that source with the appropriate return value.


 :help:

I almost had it figured out tonight, one more smoke would get me there, but it's bedtime. Hopefully I can pick up where I left off tonight another time.

EDIT: Attachment above updated, I forgot to clean up the stack at the end of the PlayNet macro.  :-[
« Last Edit: February 11, 2008, 07:49:32 am by Bonk »

Offline Bonk

  • Commodore
  • *
  • Posts: 13298
  • You don't have to live like a refugee.
Re: NSISBASS Resurrected!
« Reply #4 on: February 13, 2008, 09:12:31 am »
Channel tags support added. Only tested on mp3 file and shoutcast stream so far. Attachments above updated.

Offline Bonk

  • Commodore
  • *
  • Posts: 13298
  • You don't have to live like a refugee.
Re: NSISBASS Resurrected!
« Reply #5 on: February 22, 2008, 06:45:23 am »
Added volume control and readout, as well as cpu usage macros. Attachments above updated.

I want to get this as complete as possible to work out all the quirks of System::Call in NSIS before attempting to write a set of Directx/OpenGL/SDL includes or plugin.

I looked at redoing NSISBASS as a plugin, but the BASS.dll license makes that tricky, so a set of includes that call bass.dll is better even though a plugin built against bass.lib would make more sense. It's kind of 6 of one 1/2 a dozen of the other I guess, except for the licensing issue. (not a problem with includes, as you can just get the free bass.dll binary separately if needed)

I'm looking at effects next and I have a better handle on the usage of callback functions with System::Call but have no implementation of them in NSISBASS yet.
« Last Edit: February 22, 2008, 06:56:39 am by Bonk »

Offline Bonk

  • Commodore
  • *
  • Posts: 13298
  • You don't have to live like a refugee.
Re: NSISBASS Resurrected!
« Reply #6 on: February 26, 2008, 09:28:56 pm »
Added channel tags, last bass error macros. Updated and documented the pause and resume macros. Added a considerably more sophisticated example using the modern interface v2 and the dialogs plugin to facilitate further development and testing.  (the empty parts of the new example show where the work is needed... though I'm tempted to move right to recording instead of parsing all the file tags types - yawn...)

Offline Bonk

  • Commodore
  • *
  • Posts: 13298
  • You don't have to live like a refugee.
Re: NSISBASS Resurrected!
« Reply #7 on: February 27, 2008, 01:16:15 pm »
Updated again. Cleaned up syntax in nsisbass.nsh and added defines to allow for the ${} macro insertion syntax used in other include files.

Added polish to the MUI example.

Made the significant observation that use of upx to pack the header reduced the final exe by ~10KB and decreased load time with the "-9" (max std compression) option, and slowed down more with "--lzma" compression on the header. The "-9" produces a smaller exe as well. Happy accident!

Working on ChannelGetLevel now for use with a vu meter, once I get that done then its on to the directx plugin and models display.

Looking at this after a while I also found masm examples for BASS and got to thinking about that demo I was looking at the other day.

NSIS is rather assembly like, and not at all unlike MASM. I'm thinking of combining the works... or doing my directx plugin in MASM and calling it from NSIS.

I get the feeling that lots of the folks in the "demo scene" would fit right in at Dynaverse.net and could be valuable assets to the community. I'd like to produce something like that demo with NSIS, MASM, directx (sdl/opengl?) and SFC models and sound effects to see if it generates any interest.

Oh I guess I need to work on adding channel effects, Oh I think I know how now though as I just grokked the "structs section at the end of the system readme.
« Last Edit: February 27, 2008, 01:28:07 pm by Bonk »

Offline Bonk

  • Commodore
  • *
  • Posts: 13298
  • You don't have to live like a refugee.
Re: NSISBASS Resurrected!
« Reply #8 on: March 01, 2008, 10:02:10 am »
Caution: Leaking memory like a sieve! I'm not surprised.

At this point I'm not sure if its just my mui example script, the nsisbass.nsh macros or bass.dll itself.

I'm in the process of redoing the whole thing as a plugin written in C now anyway, so I'm going over the whole works very carefully. Also setting it up so that it can still be called from the macros same as before. But also as "nsisbass::Function" calls that match bass.lib functions one-to-one. I can see why the original author just used a set of "System::Call" macros as most of the basic functionality of the library requires no more, but once you get into more complicated functions of the library then the System::Call macro approach turns into way too much work.

I'm going to leave the old system call macros in the package but develop them no further (beware mem leak). All the work will be on the C plugin version now where I will fix all the memory leaks and finally get to some of the more interesting functions.

I've decided to bundle upx with the package as well as it improves performance so much. I'm pretty sure its all license kosher if I include the readmes and all my source and keep it non-commercial.

P.S. I just tested to confirm that upx is not the source of the memory leaks, it actually seems to improve them considerably. I'm pretty sure the memory leaks are bad stack management in the macros. Shouldn't be too hard to fix. I like manual memory management, you have to know exactly what is going on, so before any of you java people pipe up....  :D

Offline Bonk

  • Commodore
  • *
  • Posts: 13298
  • You don't have to live like a refugee.
Re: NSISBASS Resurrected!
« Reply #9 on: March 13, 2008, 09:22:49 pm »
Check this out... sometimes I impress even myself!  ;)

Many improvements, working playlists, skins, (no asx yet), plays CD, midi ... (no memory leakage)

This screenshot and attached demo use a Skincrafter skin (using a modified version of their dll). I have another working skin method (wansis) but it has focus issues with use of a banner in the .oninit callback and is less complete in general (though much smaller and more compatible with winamp window emulation for plugins).

I intend to try and get asx files working but may just abandon it (whoever came up with XML should be shot and pissed on).

The big deal on this one for me today is the volume slider, took a bit of work to figure out.

This may be going way too far with NSIS, but it is amazing how far you can go, it is fun to work on and has taught me a bunch of stuff.

So here's the new example for now, I'll post the new sources and package above soon (it will take a bunch of work to assemble and document, and I want to add VST plugins as well and I might have a working 3d model display solution... all of that will take more tinkering though... I want to sort out all the types of tags too, which is incomplete..)

Offline Bonk

  • Commodore
  • *
  • Posts: 13298
  • You don't have to live like a refugee.
Re: NSISBASS Resurrected!
« Reply #10 on: March 14, 2008, 07:44:48 am »
It is somewhat ironic to use Nullsoft tools with a superior audio library to create an app that can rival(exceed) winamp in functionality. If they hadn't sold out to AOL I'd almost feel bad...  ;)

I'm rather curious why this Saivert fellow abandoned this train: http://www.kverka.no/~saivert/nsisidle.html (and how did he end up banned(?)/Self-unregistered(?) at the over at the Winamp forums?) I may shoot him a line to let him know what I've done with his work and get the scoop on what happened. Hopefully he's just moved on to bigger and better things.

I'm going to try and get the windows media network streaming working, as there is also broadcast capability with this library, and considering the input and DSP capabilities one could write a pretty cool custom windows media server. I was even thinking of writing a teamspeak plugin for BASS, so that it could listen to, process and rebroadcast teamspeak channels as streaming windows media. There are some very interesting possibilites. (Though the teamspeak API is extremely sparse and only has a single Delphi example...)

Down the road, with source projects for SFC, I'd seriously consider replacing the Miles audio libraries currently used in SFC with BASS, though I have not really done a comparison, but I expect BASS will come out on top in capbilities and performance. (Think sophisticated custom surround sound effects capabilities in mods, or even connecting to TS from in game and integrating it with game audio in the surround mix....)

Offline Bonk

  • Commodore
  • *
  • Posts: 13298
  • You don't have to live like a refugee.
Re: NSISBASS Resurrected!
« Reply #11 on: March 14, 2008, 08:05:32 am »
Here's the "wansis" skin version. (I skinned the spectrum analyser to match it)

Though it has focus issues with the use of the banner on startup, it does not grab focus properly.  I haven't figured out a solution for that, though the simplest would be to not use the banner to describe initialisation on startup. I updated the wansis code in a few places to get it working, and the biggest single known issue is the wonky link control, currently I've just worked around it and this all works best on custom NSIS pages with no link controls. Eventually I could work that out I suppose, but its not a huge issue.

It has a neat opacity effect on the system menu. (skincrafter skins also support opacity)


(oh yeah, I must figure out a way to run a callback on the meta info on net streams to get song titles without having to manually push that "update" button... though the event handling is limited with NSIS and nsDialogs, the trick is that the plugins I'm writing in C can do it easily enough, but how to send that to NSIS in a scriptable way?... hmmm... I expect I could just pass the handle of the control for output to the plugin function... yeah that's it... callbacks give me headaches, I sill haven't completely figured it all out... )

NOTE: opening a windows media network stream with either of these demos will leave some temp files behind (in the same folder as the exe), as the windows media stuff is not quite finished yet...

P.S. Can any vista users give this a whirl for me and see if it works OK?

P.P.S. Stadard software discaimers apply of course. I dont expect any big issues but if you should happen to develop warts from the use of NSISBASS Radio, I cannot assume any responsibility whatsoever.  ;)
« Last Edit: March 14, 2008, 08:26:51 am by Bonk »

Offline Bonk

  • Commodore
  • *
  • Posts: 13298
  • You don't have to live like a refugee.
Re: NSISBASS Resurrected!
« Reply #12 on: March 14, 2008, 08:55:49 am »
Down the road, with source projects for SFC, I'd seriously consider replacing the Miles audio libraries currently used in SFC with BASS, though I have not really done a comparison, but I expect BASS will come out on top in capbilities and performance. (Think sophisticated custom surround sound effects capabilities in mods, or even connecting to TS from in game and integrating it with game audio in the surround mix....)

I have the best discussions with myself...  :D  Especially off-topic, my train of thought is like a switching yard at a busy port.

That is a cool idea,  8)  picture your wing's TS voice channel playing from the left when he's on your left, right when he's on the right... etc.. kinda silly but would be a nice touch, it would also give you audio cues to your wing's locations so that you don't necessarily need to keep track of them on camera...

Offline drb

  • Lt. Junior Grade
  • *
  • Posts: 331
  • Gender: Male
Re: NSISBASS Resurrected!
« Reply #13 on: March 17, 2008, 05:28:29 pm »
Hoi Bonk,

 Holy smokes! I thought you were talking about something else altogether. Not the first time that this has happened, and shore to happen again.

 Oh, on a side note, I was talking to a guy at work who saw Humphrey and the Dump Trucks live in Regina. You have come a long way in developing your expertise since cleaning up "Six Days of Paper Ladies"  As usual I will offer any help I can testing stuff; but I have to say skimming this thread gave me more than a few ideas for applications, maybe a 3d visual fax interface for ordering pizza/fish and chips while in mission, you know target and fire at toppings, or sides. Well, that maybe taking it too far.

Take care

drb

Offline Bonk

  • Commodore
  • *
  • Posts: 13298
  • You don't have to live like a refugee.
Re: NSISBASS Resurrected!
« Reply #14 on: March 18, 2008, 03:51:20 pm »
Oh, on a side note, I was talking to a guy at work who saw Humphrey and the Dump Trucks live in Regina. You have come a long way in developing your expertise since cleaning up "Six Days of Paper Ladies"

Awesome tunes, I'd love to have seen those guys.

skimming this thread gave me more than a few ideas for applications, maybe a 3d visual fax interface for ordering pizza/fish and chips while in mission, you know target and fire at toppings, or sides. Well, that maybe taking it too far.

 :laugh:  Perfect! In-game "Rescue 811"!

Actually I made some good progress on this yesterday, the developer most generously lent a hand to figure out why wma internet streams were not working in my setup - I just missed something dumb. I was really impressed with the free support, a rare thing.

Next I'm going to add VST plugins, then back to getting the 3d stuff running.


Offline Bonk

  • Commodore
  • *
  • Posts: 13298
  • You don't have to live like a refugee.
Re: NSISBASS Resurrected!
« Reply #15 on: November 17, 2008, 07:32:53 pm »
Bumporama - reminder to self - get back on this!  :whip: