HyperRadio 2.0
by phkb and Svengali

Overview
========
Trading goods between worlds is an extremely dangerous and hard job and a commander will need some relaxing moments. Listen to your radio station and enjoy Jazz, Folk, Rock or whatever you like. Use one station for all systems or expand it, so you will get different programs in different systems. You can even add your own music to the playlist. So rip your CDs, download songs, or install one or more of the available musicpacks. Everything is possible - and travelling will be much more fun - even 'milkruns' won't be boring business anymore. And with the capacity to be expanded by other users creating their own musicpacks it will always be the right investment. 

HyperRadio 2.0 is an update to the original, which now exclusively uses Library Music for playing music. Music packs loaded into Library music as "radio" stations will become available to HyperRadio 2.0 as selectable stations.

Operation
=========
The standard 60 day licence for HyperRadio can be purchased at any TL8 station for 1200cr. Renewing the licence for another 60 days costs just 800cr.

To operate the equipment, first prime it by using the "Shift-N" key combination. Once primed, it can be turned on and off using the "Activate" key (usually "n" on the keyboard). To change stations, used the "Mode" key (usually "b" on the keyboard). 

Compatibility
=============
HyperRadio 2.0 is *not* compatible with HyperRadio 1.x. If you have the previous version installed, you will need to remove it in order to install v2.0. However, if you had previously purchased a HyperRadio licence, it should transfer over to version 2.0 without any additional purchases.

HyperRadio 2.0 is compatible with event driven music packs (for example, the "Contextual Jukebox" mod). While playing a radio station, the event driven music will be suspended. Turning off the radio will re-engage the event driven music. In the event of a red alert, the radio will be turned off and the event driven music will be engaged. When the red alert condition is cleared, the radio will automatically restart.

Requirements
============
The only requirement for this OXP is Library OXP.

Music packs
===========
To create a music pack that can be included as one of the selectable radio stations, do the following:

1. Create an OXP folder structure. You will need a "Config" folder, and a "Music" folder in the OXP folder.

2. Copy all your music tracks into the "Music" folder.

3. Create a "script.js" file in the "Config" folder, and add the following code:

    "use strict";
    this.name = "hyperradioMYSTATION";

    this.startUpComplete = function () {
        worldScripts.Lib_Music._addChannel({
            name: "My Radio Station", // << change the name in this line
            radio: true, 
            sounds: [ 
                { snd: "hyperradio-exampleA.ogg", dur: 28 }, // for each track, enter the filename inside the quotes, and enter the duration (in seconds) of the track after "dur:"
                { snd: "hyperradio-exampleB.ogg", dur: 13 }
            ]
        });
    }

4. Create a "manifest.plist" file in the root folder of your OXP. Add text similar to the following:

    {
        identifier = "oolite.oxp.name.MyHyperRadioStation"; // change the name and OXP keyname
        required_oolite_version = "1.90";                   // leave this as is
        title = "HyperRadio TYPE - Sample Music";           // change the title as required
        version = "1.0";                                    // if this is the first version, leave this as is. Change this value if an update is released.
        category = "Ambience";                              // leave this as is
        description = "This is a sample music pack";        // change this as required
        author = "name";                                    // put your name/handle here
        information_url = "https://wiki.alioth.net/index.php/Hyperradio_Musicpacks"; // leave this as is
        license = "CC BY-NC-SA 4.0";                        // you can change the license if required, but in most cases this should be suitable
        requires_oxps = (                                   // leave this section as is.
            { identifier = "oolite.oxp.Svengali.Library"; }
        );
    }

When you've finished, you should have a folder structure that looks something like this:

    MyHyperRadioStation.oxp
    ├── manifest.plist
    ├── Config
    |   └── script.js
    └── Music
        ├── hyperradio-exampleA.ogg
        └── hyperradio-exampleB.ogg

You should now be able to select your radio station through Hyper Radio 2.0

Licence
=======
This OXP is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License. To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/3.0/ or send a letter to Creative Commons, 444 Castro Street, Suite 900, Mountain View, California, 94041, USA.

Version History
===============
2.1
- HyperRadio now turns off when docking.
- Added an MFD that will display track names with current track selected.
- Fixed issue with news items not displaying correctly in GNN.

2.0 
- Initial release
