GM_BASS 3D Stream Radio

[release]

http://img684.imageshack.us/img684/2634/radiobanner.png

About:
The 3D Stream Radio is an spawn able scripted entity that allows you to play streams from the Internet in 3D world sound using gm_bass.

**Features:
**- Server side playlists.

  • Playlist browser built into entity.
  • Supports *.pls-playlists.
  • Stream tags support. (It shows you some informations about the playing song.)
  • Wire support. (inputs and outputs)
  • GM_BASS’ 3D world sound.
  • And of course it plays music. :wink:

**Video:
**

Images:
http://img511.imageshack.us/img511/5288/coldradio.th.jpghttp://img8.imageshack.us/img8/6206/warmradio.th.jpghttp://img268.imageshack.us/img268/5610/radioskins.th.jpg

NOTES TO GM_BASS:
This addon uses a new version of GM_BASS, it’s called GM_BASS_EDIT.
I edited it, because the original can not be used shared.
The original could cause conflicts with the new one, because it uses an outdated library.
But you can install the edited version with it’s updated libraries (bass.dll and tags.dll) you can still use it like the original version,
that means no addons will brake (You would to have to change the module requisition to the new name, though). This and its source are included in the SVN.

You can read it’s documentation here: http://svn.xp-dev.com/svn/2d3d_Browser/gm_bass_documentation.txt
And the changes are listed here: http://svn.xp-dev.com/svn/2d3d_Browser/lua/includes/modules/gm_bass_edit_readme.txt

Download and Install:
You install this addon via SVN.
You create a new folder in you addons folder and then you checkout this link to the new folder: http://svn.xp-dev.com/svn/2d3d_Browser
After your download is finished you have to run the Install_Bass_Modules.bat to get this addon to work.
You will find it in the just downloaded addon, it puts the libraries (bass.dll and tag.dll) in the bass folder near the hl2.exe for you.

You can put *.pls-playlists to data\StreamRadio\Playlists, but you have to rename them from *.pls to *_pls.txt, so if you got a “music.pls” file then you rename it to “music_pls.txt”.

If you have problems please post or PM me a condump with your problem description.

If you just want the modified dll and/or source code you can get it here: http://svn.xp-dev.com/svn/2d3d_Browser/lua/includes/modules

Convars and Concommands:
[TABLE=“class: grid, width: 844”]

*Convars/Concommand
*
Description

sv_bass_max_spectrums
Sets the maximum count of radios that can have advanced wire outputs. Default: 5

Bass_PrintVersion
Print’s the version and checks for updates.

Bass_reload_script
Reloads all autorun scripts in lua/bass. Listenserver and admin only!

Bass_reload_radio
Reload the radio entity, it removes all radios on the map. Listenserver and admin only!

Bass_show_functions
Prints _G.BASS and _R.BASSChannel.

[/TABLE]

Wire:
[TABLE=“class: grid, width: 1085”]

Input
**Type
**
Description

Play
normal/number
Plays the Wire Channel when on 1 or greater else stop playing.

Volume
normal/number
And set the Volume. Takes 0-1.

Stream URL
string
Set’s the Wire Channel, press the Wire Icon it or use the play input to play it.

Output
Type
*Description
*

Stream Name
string
Returns the name of the stream.

Stream URL
string
Returns the URL of the stream.

Advanced Outputs
normal/number
If you can use the outputs below (called “Advanced Outputs”) it returns 1 else it returns 0.

Playing
normal/number
Returns 1 when playing or 0 when not.

Play Time
normal/number
Returns the time of playing in seconds.

Stream Length
normal/number
Returns the length time of the stream in seconds. An endless stream has a length of 0.

Stream Tag
array
Returns an array of 5 strings. These strings are the stream tags.

Stream Codec
array
Returns an array of 2 numbers and a string. The first number is the sample rate, second is the sample size and the string is the format.

Spectrum
array
Returns an array of 128 numbers, these go from 0 to 1. This is the sound spectrum.

Sound level
normal/number
Returns the sound level, this number goes from 0 to 32768 and has no decimal places.

Stream Error
normal/number
Returns the error code. See at Error Codes below.

[/TABLE]

Error Codes:
[TABLE=“class: outer_border, width: 350”]

-1 = Unkown Error
0 = OK
1 = Memory Error
2 = Can’t open the file
3 = Can’t find a free/valid driver
4 = The sample buffer was lost
5 = Invalid handle
6 = Unsupported sample format
7 = Invalid position
8 = BASS_Init has not been successfully called
9 = BASS_Start has not been successfully called
14 = Already initialized/paused/whatever
18 = Can’t get a free channel
19 = An illegal type was specified
20 = An illegal parameter was specified
21 = No 3D support
22 = No EAX support
23 = Illegal device number
24 = Not playing
25 = Illegal sample rate
27 = The stream is not a file stream
29 = No hardware voices available
31 = The MOD music has no sequence data
32 = No internet connection could be opened
33 = Couldn’t create the file
34 = Effects are not available
37 = Requested data is not available
38 = The channel is a ‘decoding channel’
39 = A sufficient DirectX version is not installed
40 = Connection timedout
41 = Unsupported file format
42 = Unavailable speaker
43 = Invalid BASS version (used by add-ons)
44 = Codec is not available/supported
45 = The channel/file has ended

[/TABLE]

Credits:

  • Grocel - For making the radio.
  • AzuiSleet - For writing the binary module GM_BASS.
  • Asholibus - For testing.
  • Razor2143 - For testing.
    [/release]

That looks really awesome, I might replace my default perp radio with something like that radio. Good job!

The contrast is kinda low, I gonna send you something about that later.

I assume this* doesn’t *mean the client need the dlls, or am I mistaken?

I’d assume that it just means that the server is now also able to access the data from the songs (length etc).

Yes that’s right.

The original gm_bass can be used on a listen server, but not on a dedicated server because of some unneeded gmod-window checking. The second problem was that you can use it only on one lua state. :suicide:

Should be better now. :smile:

Fixed that radio was not playing after playing it’s first channel. Sorry guys.

Offtopic: Why do you have dozens of videos on your youtube channel about destroying chairs?

Destroying chairs is hella fun dude, you should try it.

Do i need Wire for this to work?
Also how do i use this?

Press use on it, if it isn’t not working then read the Download and Install part of the OP (again).
You can use it with Wiremod, but you don’t have to.

Nice!

OT: garry Please put gm_bass.dll into a garrysmod update!!
it would be Fking awesome!!
PLEASEEEE!

can’t, commercial distribution is a ton

I just added a new tool for changing the colors of a radio GUI.

ya this is awesome

A update new is out. It add a previewer to the theme tool. It also adds some example presets to the tool.
This presets called “Cold”:
http://img511.imageshack.us/img511/5288/coldradio.th.jpg
And this is called “Warm”
http://img8.imageshack.us/img8/6206/warmradio.th.jpg
There also one called “gray”, thats a gray scale one.

And do you have suggestions for more skins?

Pink skin!

Done, I also fixed some bugs. :smiley:
http://img268.imageshack.us/img268/5610/radioskins.th.jpg

sweet!! I’m trying to make it work with radio live streams, but I’m bad at e2, can you give me an example script for this?? let me get an example livestream
http://radio.disney.go.com/music/player/listen_live.html

You can’t put this url in the radio because it’s brings you to a flash, you need the url to a mp3 file/stream, and as I have seen you can’t get a mp3-stream url nor a *.pls-playlist file with urls from it. If you just want to use a single custom url you will just have to use the wire value tool. I think you can see it in the video in the OP how to use it. If the url isn’t working he radio will say you what’s wrong with it.

Btw: All preinstalled playlists are leading to live streams. Also you kidding me with your Disney stuff?