SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Plugin Development

Reply
 
Thread Tools Display Modes
Old 22/06/2012, 02:48 PM   #41
WillyP
High-roller
 
WillyP's Avatar
 
Join Date: Jul 2010
Location: Durham, England
Posts: 2,232
Reputation: 63
Default Re: SA:MP Internet Radio Station

Quote:
Originally Posted by leong124 View Post
It works fine if I stream the mp3 file on my local computer using PlaySoundFileToStream. If I stream the same file on network using PlaySoundUrlToStream, the music messed up.
Could you show me how you got the mp3 file to play using that function?
WillyP is offline   Reply With Quote
Old 22/06/2012, 04:56 PM   #42
leong124
High-roller
 
leong124's Avatar
 
Join Date: Jun 2008
Location: Hong Kong, China
Posts: 1,738
Reputation: 134
Default Re: SA:MP Internet Radio Station

I didn't use YouTube-mp3's API as my script is still in feature testing stage.
First of all go to http://www.youtube-mp3.org/, paste the video URL (http://www. youtube.com/watch?v=PKdzdXNy4Y4) into the interface and convert it. The link in the download button is the testing sound file.

Then I use the filterscript in the plugin package, and change the PlaySoundUrlToStream code into
pawn Code:
PlaySoundUrlToStream(testing_sound_file_URL);//The link is user-dependent so I'm not giving it here
See if you can reproduce the problem, thanks.
__________________
[KDT_MS]hk_shade

Sorry for my bad English and my weakness in expressing myself.
leong124 is offline   Reply With Quote
Old 22/06/2012, 05:01 PM   #43
WillyP
High-roller
 
WillyP's Avatar
 
Join Date: Jul 2010
Location: Durham, England
Posts: 2,232
Reputation: 63
Default Re: SA:MP Internet Radio Station

Quote:
Originally Posted by leong124 View Post
I didn't use YouTube-mp3's API as my script is still in feature testing stage.
First of all go to http://www.youtube-mp3.org/, paste the video URL (http://www. youtube.com/watch?v=PKdzdXNy4Y4) into the interface and convert it. The link in the download button is the testing sound file.

Then I use the filterscript in the plugin package, and change the PlaySoundUrlToStream code into
pawn Code:
PlaySoundUrlToStream(testing_sound_file_URL);//The link is user-dependent so I'm not giving it here
See if you can reproduce the problem, thanks.
I was on about the server directory music playing.
WillyP is offline   Reply With Quote
Old 22/06/2012, 05:40 PM   #44
leong124
High-roller
 
leong124's Avatar
 
Join Date: Jun 2008
Location: Hong Kong, China
Posts: 1,738
Reputation: 134
Default Re: SA:MP Internet Radio Station

Directly download the converted audio file and save it to anywhere in your computer (I've just tested it on the server's directory), and then use PlaySoundFileToStream(absolute_path_to_your_audio_ file).
__________________
[KDT_MS]hk_shade

Sorry for my bad English and my weakness in expressing myself.
leong124 is offline   Reply With Quote
Old 22/06/2012, 06:15 PM   #45
WillyP
High-roller
 
WillyP's Avatar
 
Join Date: Jul 2010
Location: Durham, England
Posts: 2,232
Reputation: 63
Default Re: SA:MP Internet Radio Station

Quote:
Originally Posted by leong124 View Post
Directly download the converted audio file and save it to anywhere in your computer (I've just tested it on the server's directory), and then use PlaySoundFileToStream(absolute_path_to_your_audio_ file).
So something like PlaySoundFileToStream(dekstop/yourserver/mp3file) ?
WillyP is offline   Reply With Quote
Old 22/06/2012, 06:42 PM   #46
leong124
High-roller
 
leong124's Avatar
 
Join Date: Jun 2008
Location: Hong Kong, China
Posts: 1,738
Reputation: 134
Default Re: SA:MP Internet Radio Station

Quote:
Originally Posted by [FU]Victious View Post
So something like PlaySoundFileToStream(dekstop/yourserver/mp3file) ?
Yes.
__________________
[KDT_MS]hk_shade

Sorry for my bad English and my weakness in expressing myself.
leong124 is offline   Reply With Quote
Old 22/06/2012, 07:07 PM   #47
WillyP
High-roller
 
WillyP's Avatar
 
Join Date: Jul 2010
Location: Durham, England
Posts: 2,232
Reputation: 63
Default Re: SA:MP Internet Radio Station

I don't understand on how I would write it..
WillyP is offline   Reply With Quote
Old 23/06/2012, 03:41 AM   #48
jhonyxakep
Gangsta
 
jhonyxakep's Avatar
 
Join Date: May 2011
Location: Russia, Vladivostok
Posts: 785
Reputation: 43
Default Re: SA:MP Internet Radio Station

╬ŕ. I got to reproduce the problem. The problem occurs when the CPU loaded highly. And only with URL's.

Not Enough CPU resources for encoder. It's flush previously recived data. Sorry, but i can't fix it. But I can add additional buffering function. It may help.
jhonyxakep is offline   Reply With Quote
Old 23/06/2012, 06:26 AM   #49
leong124
High-roller
 
leong124's Avatar
 
Join Date: Jun 2008
Location: Hong Kong, China
Posts: 1,738
Reputation: 134
Default Re: SA:MP Internet Radio Station

Quote:
Originally Posted by [FU]Victious View Post
I don't understand on how I would write it..
Download the filterscript in the plugin pack, and change all
pawn Code:
PlaySoundUrlToStream("http://greenleader.streams.bassdrive.com:8080");
into
pawn Code:
PlaySoundFileToStream("D:/Program Files (x86)/Rockstar Games/GTA San Andreas/scriptfiles/Bad Apple.mp3");//example only
If you want to add more song, you have to store all the file locations into an array, and load them one by one.

Modified from the example script:
pawn Code:
/*
Server's Radio Plugin
by jhonyxakep

Mail:jhonyxakep@qip.ru
ICQ:354794596
Jabber:jhonyxakep@qip.ru
 */


#include <a_samp>
#include "radio"

new bool:a = true,x = 0;
new radiofiles[10][128] =
{
    "D:/Program Files (x86)/Rockstar Games/GTA San Andreas/scriptfiles/1.mp3",
    "D:/Program Files (x86)/Rockstar Games/GTA San Andreas/scriptfiles/2.mp3",
    "D:/Program Files (x86)/Rockstar Games/GTA San Andreas/scriptfiles/3.mp3",
    "D:/Program Files (x86)/Rockstar Games/GTA San Andreas/scriptfiles/4.mp3",
    "D:/Program Files (x86)/Rockstar Games/GTA San Andreas/scriptfiles/5.mp3",
    "D:/Program Files (x86)/Rockstar Games/GTA San Andreas/scriptfiles/6.mp3",
    "D:/Program Files (x86)/Rockstar Games/GTA San Andreas/scriptfiles/7.mp3",
    "D:/Program Files (x86)/Rockstar Games/GTA San Andreas/scriptfiles/8.mp3",
    "D:/Program Files (x86)/Rockstar Games/GTA San Andreas/scriptfiles/9.mp3",
    "D:/Program Files (x86)/Rockstar Games/GTA San Andreas/scriptfiles/any_name.mp3",
};

public OnFilterScriptInit()
{
    x = 0;
    SetStationNameURL("My server side radio station","http://sa-mp.com");
    if(SoundServerStart("lame -r -s 44100 -b 128 -","8000") == 0)
    {
        PlaySoundFileToStream(radiofiles[x]);
    }
    a = false;
    return 1;
}

public OnFilterScriptExit()
{
    SoundServerStop();
    return 1;
}

public OnSoundFileEnd()
{
    if (a==false)
    {
        x++;
        PlaySoundFileToStream(radiofiles[x]);
    }
    return 1;
}

//The rest of the script are the same.

Quote:
Originally Posted by jhonyxakep View Post
╬ŕ. I got to reproduce the problem. The problem occurs when the CPU loaded highly. And only with URL's.

Not Enough CPU resources for encoder. It's flush previously recived data. Sorry, but i can't fix it. But I can add additional buffering function. It may help.
That was strange because I uses Intel 2500K and overclocked it, so it should have enough processing power for this.
Anyway, I'll have a try when you update it.
__________________
[KDT_MS]hk_shade

Sorry for my bad English and my weakness in expressing myself.
leong124 is offline   Reply With Quote
Old 23/06/2012, 09:16 PM   #50
Georgi166
Gangsta
 
Georgi166's Avatar
 
Join Date: Jun 2011
Location: Varna, Bulgaria
Posts: 537
Reputation: 44
Default Re: SA:MP Internet Radio Station

Damn nice!
__________________
ok
Georgi166 is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
San Andreas Radio Station audio not working Diego_Martinz Client Support 4 13/06/2012 01:55 PM
How do i play this radio station? emokidx Scripting Help 3 19/02/2012 01:27 PM
Create connection to radio station vection Help Archive 0 31/08/2010 11:47 AM
[HELP PL0X] Radio station. tehroxor Client Support 7 11/02/2010 04:44 PM


All times are GMT. The time now is 02:31 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.