Sign in to follow this  
AlexC

MusicBox

Recommended Posts

Dear all.

Since I'm not really master of C++ or any other languages, I want to introduce my idea.

Basically the idea is taken off from Garry's Mod, An in-game musicbox, as you mention, yes, it allows the players to listen music which stored a server, or even an internet radio. The menu should need an external gsc or gsx script to control the plugin.

Requirements:

  1. HTTP stream or local database to stream the music.
  2. GSC or GSX Plugin to control the plugin.

Some mods are really boring when the player is waiting to the respawn, so basically allows to search his favourite sounds when the player is died, and makes it interesting, like myself, if I'm listening my favs, just keep me exited :D

Good luck, I really hope some coders interested about it, we will see! ;)

Share this post


Link to post
Share on other sites

I have always wanted to see such functionality but I have no time for this plugin :(

Unfortunately, you will need exactly a plugin which will cover this sound playing (it's much easier than use built-in game functionality IMO) and adds script functions to be able change radiostation/volume/etc.

  • Like 1

Share this post


Link to post
Share on other sites

I used this in mohaa for dm maps ( Free-For-All.mus) but everyone had to have the mp3 in their files to hear it, worked good exec from map script but maybe you can exec from dm.gsx maybe add more songs by check the time the song plays and adding a "wait" time between songs .

	path sound/amb
	normal Free-For-All.mp3 // Plays over entire level <---Name of file
	!normal volume 100
!normal loop
	//Music Recommendation
//mus_09a_action.mp3
	//Just in case we can get multiple ambiences working...
//normal Amb_M5_BridgeInt.mp3 // Player Start
//!normal volume 1
//!normal loop
	

Share this post


Link to post
Share on other sites

I don't know how is the gmod version working exactly, but if it's possible the plugin side doing basically the stream, and we can just basically control the plugin through an in-game menu, like the shouts working.

Share this post


Link to post
Share on other sites

well I know this isn't what you want, but, I renamed Ted Nugent's Free-For-All.mp3 to the player spawn sounds (HGW_mp_spawn_usa.mp3) and stuck in a z_sound. iwd, put it on my gun game server so now when you spawn you hear the song until it ends. Was kind of cool, but the bad part is you have to listen to it every time you spawn xD .

  • Like 1

Share this post


Link to post
Share on other sites

Streaming music is not possible to do with a plugin. It would require client side support. There is voice chat built in. But that quality is too poor for music playback.

Share this post


Link to post
Share on other sites

I found a mod to play music haven't tried it yet

MUSIC MOD 1.0 by Waffles
xfire: basheduwithaflopus

This mod is a client/server music player,
has a setting to let all players hear the same music
from the server, much like a radio, or a setting where the players
hold F for 1.5 seconds to bring up a menu with music for them to choose from
There are 9 songs from them to choose from, that the server owner, you chooses
you don't need to use all 9, any song spots u don't use will appear blank on the menu
as if they don't exist. The songs names are dvar controlled, with music1, music2 and so on...

There are 3 versions of this:

Modwarfare, This is the classic modwarfare, but slightly changed; the client now ranks up,
can complete challenges, and has a button to select what camo he would like on his gun.

Non-Modwarfare, This is the old-skool ranked server, without the normal game server ranks,
the client will start at rank 1, and progress up, unlocking things on his way, much like the AWE mod

Rawfiles, This is not technicly a version, but merely the files in the mod.ff so that if you are
wanting to add this to your own mod, just add the lines in that mod.csv to your mod.csv, the ui_mp
folder to your fs_game folder, and the soundaliases to your raw folder.

INSTALLATION:
TO install, choose which setting you would like, modwarfare, non-modwarfare, or adding it
with your own mod using the rawfiles.
To put the music on, find the number of songs you would like, make sure they are in .mp3 format
then rename each to b music1.mp3, music2.mp3 and so on until you have named them all.
add these lines to ur server config, Replacing the music1.mp3 with the name of the song:

set music1 "1. Your Music1.mp3"
set music2 "2. Your Music2.mp3"
set music3 "3. Your Music3.mp3"
set music4 "4. Your Music4.mp3"
set music5 "5. Your Music5.mp3"
set music6 "6. Your Music6.mp3"
set music7 "7. Your Music7.mp3"
set music8 "8. Your Music8.mp3"
set music9 "9. Your Music9.mp3"
set music_songs "9"
set music_radio 0

you can set the radio function to 1 for the server to play the songs globablly
instead of the client chooseing it. When using the radio function, you must go into the iwd
using pacscape or winrar, or, change the extension to .zip and extract, either way, navigate to _battlechatter.gsc
and open it up, scroll down to line 385, and change the settings for all the songs to however long your songs are.
If you have any issues, feel free to contact me through xfire.

Legallity Issues:
I would strongly recamend getting the permission of the song writer before playing any song,
and at least making sure you OWN the song, and have not cheaply limewired it.
******
I bear no responsibillity for any issues you find with this mod, legal or not.
Any legal issues caused by the songs you choose to put on are your responsibility,
not mine.
******

Adding this mod to your own:
This mod was made for adding to another mod
feel free to add thisto your own,
just please give me some credit where credit is due.


If you find any problems with this mod, such as an error, feel free to contact me:
xfire: basheduwithaflopus

Share this post


Link to post
Share on other sites

Yeah but I wanted to add on the non-modded stock servers. And @Fraggy said just the voicechat we can use, but it's really poor quality..

Share this post


Link to post
Share on other sites

maybe we could just hijack the ingame voicechat to stream music?

  • Like 1

Share this post


Link to post
Share on other sites
1 hour ago, D4edalus said:

maybe we could just hijack the ingame voicechat to stream music?

THis is an interesting approach for sure 

Share this post


Link to post
Share on other sites

I know there was an external plugin used for GoldSource and source based games which allowed you to stream anything you wanted over your microphone, cant remember the name sadly

Share this post


Link to post
Share on other sites
On 26/02/2017 at 0:24 PM, D4edalus said:

maybe we could just hijack the ingame voicechat to stream music?

If we can improve the quality, should be all right.

Share this post


Link to post
Share on other sites

Streaming sound by voicechat feature means quality as-is and it's a good idea, actually.

Share this post


Link to post
Share on other sites

i've looked into it a few days ago, but couldn't find out yet how to encode it correctly and at what bitrate its playing

if anyone wants to try his luck:
at the end of SV_SendClientMessages

	#if 0
        // send some voice
        msg_t msg;
        byte buff[0x20000];
        int datalen;
        int j;
	        /*if ( client->state < CS_ACTIVE || client->unsentVoiceData == 0)
        {
            return;
        }*/
        MSG_Init(&msg, buff, sizeof(buff));
        MSG_WriteString(&msg, "v");
        
        MSG_WriteByte(&msg, 20); // frames
	        // fill in some data
        datalen = 100;
        for(j = 0; j < datalen; ++j)
        {
            buff[j] = (char)(255 * sin(2.0 * 3.1415 / 5.0 * j));
        }
	        for(i = 0; i < 20; i++)
        {
            MSG_WriteByte( &msg, 0 ); // hijack client 0
            MSG_WriteByte( &msg, datalen ); // 0 to 255
            MSG_WriteData( &msg, buff, datalen );
        }
	        /*if ( msg.overflowed )
        {
            Com_PrintWarning( "WARNING: voice msg overflowed for %s\n", client->name);
            return;
        }
        NET_OutOfBandData(NS_SERVER, &client->netchan.remoteAddress, msg.data, msg.cursize);
        client->unsentVoiceData = 0;*/
#endif
        // SV_SendClientVoiceData( c );
	

Share this post


Link to post
Share on other sites

CoD4 ingame voice chat uses Speex. And believe me it is not suitable to send music.

Share this post


Link to post
Share on other sites

its for sure not optimal, but probably the least painful way to stream music. 

Share this post


Link to post
Share on other sites

If you have any free time, can you connect to the smv HC TDM server ( 139.59.15.22:28960 )  and check its in-game sounds. Seems they are using custom sounds for their server, but don't know how.

Share this post


Link to post
Share on other sites

idk about too much scripting but if this is like promod then why dont use tom music player.....he have made 1 which after some tweaks will work with promod.... idk if i can add link..hope so i wont brake any rules... if admin agree i will post the link then..or google it ur self

Share this post


Link to post
Share on other sites

There are some mods which have a build in music menu (it's not much work tbh) but that just increases the iwd size.

But why not turning on music/radio on your pc instead of making it a global sound on the server?

Personally i hate it when a mod/map forces me to listen to some crap and prefer it to listen to my own music.

Share this post


Link to post
Share on other sites

That wasn't this thread point. The fact is streaming music from the server. It does not require any additional download. 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this