Skip to content

Commit

Permalink
* Adjusted a few streams
Browse files Browse the repository at this point in the history
* Widened interface to show more streams
* Added volumeDelta to adjust volume
  • Loading branch information
Koenvh1 committed Oct 29, 2016
1 parent f0d7e6f commit 138f987
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 19 deletions.
6 changes: 4 additions & 2 deletions config.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
" radius: What the radius in SCS coordinates is for a city to be in range",
" treshold: What value in SCS coordinates to switch to the new country's radio station",
" whitenoise: Play static when a station is far away",
" peerJSkey: The key for WebRTC pairing (the remote control). Key can be obtained for free by registering at http://peerjs.com "
" peerJSkey: The key for WebRTC pairing (the remote control). Key can be obtained for free by registering at http://peerjs.com",
" deltaVolume: Decrease the volume by this amount (0.2 = 20%) "
],

"config": {
Expand All @@ -23,7 +24,8 @@
"radius": 7500,
"treshold": 300,
"whitenoise": true,
"peerJSkey": "damhc79361fhto6r"
"peerJSkey": "damhc79361fhto6r",
"deltaVolume": 0.2
}

}
6 changes: 6 additions & 0 deletions dashboard.css
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ body {
.station-image-container {
height: 70px;
width: 100%;
vertical-align: middle;
}

.station-image-container > img {
Expand All @@ -72,4 +73,9 @@ body {
position: absolute;
top: 0;
right: 15px;
}
.station-title {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
6 changes: 3 additions & 3 deletions dashboard.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<audio id="player" src="about:blank" autoplay></audio>
<audio id="whitenoise" src="/skins/local-radio/content/whitestatic.mp3" loop></audio>
<nav class="navbar navbar-inverse navbar-static-top" role="navigation">
<div class="container">
<div class="col-xs-12">
<!-- Brand and toggle get grouped for better mobile display -->
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
<span class="sr-only">Toggle navigation</span>
Expand All @@ -20,6 +20,7 @@
<li><a href="javascript:void(0)" data-toggle="modal" data-target="#connectModal">Connect to other device</a></li>
</ul>
<ul class="nav navbar-nav navbar-right">
<!--li class="disabled"><a>Currently playing: <span class="current-station"></span></a></li-->
<li><a href="#" onclick="setRadioStation('', 'none', 0)">Stop playback</a></li>
</ul>
</div>
Expand All @@ -29,10 +30,9 @@
</nav>

<!-- Page Content -->
<div class="container">
<div class="col-xs-12">
<div class="row">
<div class="col-lg-12">
<h1 class="page-header">Radio stations: <span class="nearestCountry"></span></h1>
<div class="alert alert-info update">An update is available! <a class="btn btn-xs btn-primary" href="https://github.com/Koenvh1/ets2-local-radio/releases">Update now</a> </div>
<div class="alert alert-warning statusMessage"></div>
<div class="alert alert-success remote">This player is being controlled remotely</div>
Expand Down
12 changes: 7 additions & 5 deletions dashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ Funbit.Ets.Telemetry.Dashboard.prototype.render = function (data, utils) {

function setRadioStation(url, country, volume) {
//Set current listening country for when crossing the border

g_current_country = country;
if(controlRemote){
if(!conn.open){
Expand All @@ -207,6 +208,7 @@ function setRadioStation(url, country, volume) {
});
} else {
document.getElementById("player").src = url;
document.getElementById("player").play();
}
$("#player").animate({volume: 1}, 750, function () {
g_whitenoise = g_skinConfig.whitenoise;
Expand All @@ -223,16 +225,16 @@ function setWhitenoise(volume) {
//Make new volume work exponentially:
var newVolume = Math.pow(volume, 2) - 0.15;
if(newVolume < 0) newVolume = 0;
if(newVolume > 1) newVolume = 1;
var playerVolume = 1;
if(newVolume > (1 - g_skinConfig.deltaVolume)) newVolume = 1 - g_skinConfig.deltaVolume;
var playerVolume = 1 - g_skinConfig.deltaVolume;
if(newVolume > 0.5){
//Create a distorted sound effect, with the sound sometimes dropping (no signal)
playerVolume = document.getElementById("player").volume + parseFloat(((Math.floor(Math.random() * 19) / 100) - 0.09) / 1.2);
if(playerVolume > 1) playerVolume = 1;
if(playerVolume > (1 - g_skinConfig.deltaVolume)) playerVolume = 1 - g_skinConfig.deltaVolume;
if(playerVolume < 0.1) playerVolume = 0.1;
document.getElementById("player").volume = playerVolume;
} else {
document.getElementById("player").volume = 1;
document.getElementById("player").volume = 1 - g_skinConfig.deltaVolume;
}
$(".whitenoise-volume").html(newVolume + "; " + playerVolume);
document.getElementById("whitenoise").volume = parseFloat(newVolume);
Expand Down Expand Up @@ -275,7 +277,7 @@ function refreshStations() {
if(typeof stations[key][j]["relative_radius"] === "undefined" || g_countries[key]["distance"] / stations[key][j]["relative_radius"] < g_skinConfig.radius) {
//TODO: Stop playback when station is out of reach
content +=
'<div class="col-lg-3 col-md-4 col-xs-6 thumb">' +
'<div class="col-lg-2 col-md-3 col-sm-4 col-xs-6 thumb">' +
'<a class="thumbnail" href="#" onclick="setRadioStation(\'' + stations[key][j]['url'] + '\',' +
' \'' + key + '\',' +
' \'' + volume + '\')">' +
Expand Down
18 changes: 9 additions & 9 deletions stations/stations-europe.js
Original file line number Diff line number Diff line change
Expand Up @@ -274,11 +274,6 @@ var stations = {
logo: "https://img.static.lagardere.cz/evropa2/logo-evropa2.png",
url: "http://icecast3.play.cz:80/evropa2-128.mp3"
},
{
name: "Evropa 2",
logo: "https://img.static.lagardere.cz/evropa2/logo-evropa2.png",
url: "http://icecast3.play.cz:80/evropa2-128.mp3"
},
{
name: "Frekvence 1",
logo: "https://i.lagardere.cz/frekvence1/u/logo-f1-new.png",
Expand Down Expand Up @@ -684,15 +679,20 @@ var stations = {
logo: "http://3.bp.blogspot.com/-qB5zX9ejtwI/UTxbPSbxlMI/AAAAAAAABkM/i-qyq3Xnn_E/s1600/radio-moldova-tineret.jpg",
url: "http://radiolive.trm.md:8000/RM-tineret-128"
},
{
name: "Kiss FM",
logo: "http://kissfm.md.md/img/kissfm-logo-300.png",
url: "http://89.28.66.205:8000/;"
},
],
"netherlands": [
{
name: "Radio 1",
name: "NPO Radio 1",
logo: "https://www.mp3streams.nl/images/zenderlogo/radio1.png",
url: "http://icecast.omroep.nl/radio1-bb-mp3"
},
{
name: "Radio 2",
name: "NPO Radio 2",
logo: "https://www.mp3streams.nl/images/zenderlogo/radio2.png",
url: "http://icecast.omroep.nl/radio2-bb-mp3"
},
Expand Down Expand Up @@ -813,12 +813,12 @@ var stations = {
},
{
name: "Rádio Devin",
logo: "https://www.radia.sk/_radia/loga/nadpis/devin.png?1458809153",
logo: "https://www.rtvs.sk/media/images/radiostations/radio_devin.png",
url: "http://live.slovakradio.sk:8000/Devin_256.mp3"
},
{
name: "Rádio_FM",
logo: "https://thumbnailer.mixcloud.com/unsafe/600x600/profile/c/0/e/0/5bf7-bc8c-4b84-89f5-03ebf6d05daf.jpg",
logo: "https://www.rtvs.sk/media/images/radiostations/radio_fm.png",
url: "http://live.slovakradio.sk:8000/FM_256.mp3"
},
{
Expand Down

0 comments on commit 138f987

Please sign in to comment.