Sony PSP User Manual

Page 1
PSP™ (PlayStation®Portable)
Internet Radio Player
Development Guide
Document Version 1.1(E)
System Software Version 5.00
© 2008 Sony Computer Entertainment Inc.
All Rights Reserved.
Page 2
[Trademarks]
"PlayStation" and PSP™ are registered trademarks of Sony Computer Entertainment, Inc.
"Memory Stick" and "Memory Stick Duo" are trademarks of Sony Corporation.
"XMB" is a trademark of Sony Corporation and Sony Computer Entertainment, Inc. "PSP (PlayStation Portable)" Internet features include of ACCESS CO., LTD.
ACCESS and NetFront are trademarks or registered trademarks of ACCESS CO., LTD. in Japan and other countries.
Java and JavaScript are trademarks or registered trademarks of Sun Microsystems, Inc. in the
United States and other countries.
Flash, Macromedia, and Macromedia Flash are trademarks or registered trademarks of Adobe
Systems Incorporated in the United States and other countries.
SHOUTcast and Winamp™ are trademarks or registered trademarks of AOL.
SHOUTCAST is a trademark of AOL LLC. Winamp is a trademark of AOL LLC.
Macintosh is a trademark of Apple Inc.
Windows is a registered trademark of Microsoft Corporation in the United States and other
countries.
All other product and company names mentioned herein are generally trademarks and/or registered
trademarks of their respective owners.
[Terms and Conditions] All rights (including, but not limited to, copyright) pertaining to all the materials and information that are made available from this Guideline are managed, owned, or used with permission by, SCEI. All materials in this Guideline are protected by copyright laws, and other applicable laws. Except for personal, non-commercial, internal use, you are prohibited from using (including, without limitation, copying, modifying, reproducing in whole or in part, uploading, transmitting, distributing, licensing, selling and publishing) any of the materials, without obtaining SCEI's prior written permission. The contents of this Guideline are not guaranteed to be valid for future versions of system software.
SCEI OR ANY OF ITS AFFILIATES SHALL NOT BE LIABLE FOR ANY DAMAGES ARISING
OUT OF ANY CHANGE OF THE SYSTEM SOFTWARE SPECIFICATIONS.
©SCEI PSP™ Internet Radio Player Development Guide
- 2 -
Page 3
Table of Contents
1 About This Document................................................................................ 6
Overview ........................................................................................................................6
Who Should Read This Document? ..............................................................................6
What Specifically gets Created when an Internet Radio Player is Developed?........7
Related Documents .....................................................................................................10
2 PSP™ Internet Radio Structure and Operation..................................... 11
PSP™ Internal ............................................................................................................12
PSP™ External............................................................................................................13
3 Creating the Internet Radio Player .........................................................20
List of JavaScript Extended Methods........................................................................22
JavaScript Extended Method Reference Details.......................................................26
sysRadioPlayStream ...................................................................................................27
sysRadioPlayPls ..........................................................................................................30
sysRadioPlayM3u........................................................................................................33
sysRadioStop ...............................................................................................................36
sysRadioSetMasterVolume .........................................................................................40
sysRadioSetSubVolume...............................................................................................43
sysRadioGetLeftAudioPeakLevel...............................................................................46
sysRadioGetRightAudioPeakLevel ............................................................................50
sysRadioGetLeftAudioAverageLevel..........................................................................54
sysRadioGetRightAudioAverageLevel .......................................................................58
sysRadioSetSineWaveOscillatorFrequencyAndVolume............................................62
sysRadioSetWhiteNoiseOscillatorVolume .................................................................65
sysRadioSetAudioShiftWidth .....................................................................................68
sysRadioSetAudioCutOffWidth..................................................................................73
sysRadioSetAudioPitchShiftWidth ............................................................................77
sysRadioPlayEffectSound ...........................................................................................81
sysRadioPrepareForHttpGet......................................................................................84
sysRadioGetHttpGetStatus ........................................................................................88
sysRadioGetHttpGetResult ........................................................................................91
©SCEI PSP™ Internet Radio Player Development Guide
- 3 -
Page 4
sysRadioHttpGetTerminate........................................................................................94
sysRadioGetPlayerStatus ...........................................................................................97
sysRadioGetNetworkBandQuality...........................................................................100
sysRadioGetAudioSoundDistortionRate..................................................................103
sysRadioGetContentMetaInfo ..................................................................................106
sysRadioGetBitRate ..................................................................................................109
sysRadioGetSamplingRate .......................................................................................112
sysRadioGetStreamUrl .............................................................................................115
sysRadioGetStreamTitle...........................................................................................118
sysRadioGetRelatedPageUrl ....................................................................................121
sysRadioGetStreamIpAddress..................................................................................124
sysRadioGetStreamPort ...........................................................................................127
sysRadioGetStreamBufferLevel ...............................................................................130
sysRadioPrepareForScanDir ....................................................................................133
sysRadioScanDir .......................................................................................................136
sysRadioGetMediaInOutStatus ...............................................................................139
sysRadioPrepareForStrOperation............................................................................142
sysRadioStrLength....................................................................................................145
sysRadioStrIndexOf ..................................................................................................148
sysRadioStrSlice........................................................................................................152
sysRadioStrCharCodeAt ...........................................................................................156
sysRadioStrOperationTerminate..............................................................................159
sysRadioCharacterEntityConvert ............................................................................162
sysRadioCharacterCodeConvert ..............................................................................165
sysRadioGetAnalogStickXValue...............................................................................168
sysRadioGetAnalogStickYValue...............................................................................170
sysRadioGetAnalogStickAngleValue........................................................................172
sysRadioGetAnalogStickRadiusValue......................................................................174
sysRadioSetDebugMode............................................................................................177
sysRadioDebugLog ....................................................................................................179
sysRadioSetDebugLogTextStyle...............................................................................182
sysRadioClearDebugLog...........................................................................................188
sysRadioGetPlayerCoreVersionInfo .........................................................................190
sysRadioCapabilityCheck .........................................................................................192
sysRadioGetStartButtonToggleStatus .....................................................................195
sysRadioBackLightAlwaysOn ..................................................................................197
sysRadioBusyIndicator .............................................................................................200
©SCEI PSP™ Internet Radio Player Development Guide
- 4 -
Page 5
sysRadioCaptureScreenShot ....................................................................................202
sysRadioSleep............................................................................................................205
sysRadioGetSystemStatus........................................................................................207
4 Procedure for Developing an Internet Radio Player...........................209
Overview ....................................................................................................................209
1. Create an image of the completed form ...............................................................211
2. Create graphic elements .......................................................................................212
3. Create directories on the Memory Stick Duo™ and copy image files................214
4. Create html, css, and JavaScript files and copy them to the Memory Stick
Duo™..........................................................................................................................216
5. Copy the test Internet radio player icon file to the Memory Stick Duo™ .........219
6. Unmount the PSP™ system from the PC and then cancel the PSP™ system’s
USB mode ..................................................................................................................219
7. Try starting up the Internet radio player from the test Internet player icon...220
8. Create JavaScript code .........................................................................................222
9. Change css and image files to create another Internet radio player .................230
10. Create an Internet radio player with completely different functions and design233
11. Supplement..........................................................................................................233
5 Creating the Internet Radio Player Icon............................................... 234
What is an Internet Radio Player Icon? ..................................................................234
What is the Internet Radio Player Icon Generation Tool?......................................236
How Do you Start Up the Internet Radio Player Icon Generation Tool?...............237
How Do You Make the Internet Radio Player Icon That You Created Publicly
Available? ...................................................................................................................241
6 Appendix ................................................................................................242
Terms and Phrases That are Often Used ................................................................242
7 Update History
©SCEI PSP™ Internet Radio Player Development Guide
.......................................................................................244
- 5 -
Page 6

1 About This Document

Overview

This document contains information that is needed to develop a PSP™ Internet radio player.
The procedure is explained through the use of sample programs and data.
Specifically, this document contains the following information.
z Overview of the structure and operation of an Internet radio player
z Procedure for developing an Internet radio player
z Extended JavaScript method reference
z Overview of Internet radio player icons and how to create them

Who Should Read This Document?

This document is intended for anyone who is interested in developing a PSP™ Internet radio
player.
For example, a broadcaster who provides an existing Internet radio service can develop a
special-purpose Internet radio player that receives their local broadcasts. Users who obtain
that Internet radio player will be able to listen to those broadcasts on the PSP™ Internet
radio.
In addition, a normal user who is not a broadcaster can create and release an Internet radio
player that has a unique user interface, is easier to use, or has features not found in the player
released by SCE.
The difference between the two types of Internet radio player software developers mentioned
above is that one type has broadcast station information from which the audio data stream is
transmitted and the other does not. Although the essential part of the Internet radio player
implementation will be exactly the same, the two implementations can result in different
amounts of JavaScript program code that must be written.
A person who is not a broadcaster (i.e. someone who is not personally broadcasting) must
©SCEI PSP™ Internet Radio Player Development Guide
- 6 -
Page 7
somehow obtain broadcast station information. Both "Internet Radio Player I" and "Internet
Radio Player II" provided by SCE rely on the SHOUTcast and icecast.org protocols to
dynamically obtain this information. When a person who is not a broadcaster develops an
Internet radio player, that person must use this same process to obtain this information
dynamically.
Since broadcast station information by nature is constantly changing over time, having the
Internet radio player save this information either internally or externally is not recommended
because of the long-term maintenance and software stability problems it can create.
One method of addressing this problem is to have the JavaScript program code that forms the
Internet radio player dynamically collect the information. Another method would be to
perform this processing on a regular basis using a service such as cron, or to have it done at
some specific time using a cgi program running on the Web server where the Internet radio
player is located.
The second half of this document describes an example implementation in JavaScript for
performing this processing, similar to the method used by "Internet Radio Player I" and
"Internet Radio Player II".
A broadcaster should remove the JavaScript code that accesses the broadcast station database
from this example implementation.
Specific details concerning the implementation of a cgi program or cron job running on a Web
server have been omitted from this document.
This document assumes that readers have a basic knowledge of HTML, XML, JavaScript, Web
servers, and Internet radio.

What Specifically gets Created when an Internet Radio Player is Developed?

Developing an Internet radio player means creating the following two items.
z The Internet radio player itself
z An Internet radio player icon
©SCEI PSP™ Internet Radio Player Development Guide
- 7 -
Page 8
The "Internet radio player" is made up of HTML, JavaScript, and image data. These comprise
the Internet radio GUI, which acts in conjunction with PSP™ system software to govern the
behavior of the Internet radio player.
Example of an Internet Radio Player GUI
©SCEI PSP™ Internet Radio Player Development Guide
- 8 -
Page 9
The Internet radio player icon is used to launch the Internet radio player. It is displayed on
the XMB™ under the "Network" category, in the layer below "Internet radio".
The Internet radio player icon is created using a tool that is bundled with the SDK. This
document is also included in the SDK.
There is a 1-to-1 correspondence between an Internet radio player and an Internet radio
player icon.
Example of an Internet Radio Player Icon
©SCEI PSP™ Internet Radio Player Development Guide
- 9 -
Page 10

Related Documents

For details concerning Internet browser specifications and related information, refer to the
following documents.
Internet Browser Specifications
Content Creation Guidelines for the PSP™ (PlayStation®Portable) Internet Browser
Protocols
[RFC2616] Hypertext Transfer Protocol – HTTP/1.1
PERSISTENT CLIENT STATE HTTP COOKIES
http://wp.netscape.com/newsref/std/cookie_spec.html
Markup Languages
HTML 4.01 Specification http://www.w3.org/TR/html401/
XHTMLTM 1.1 – Module-Based XHTML http://www.w3.org/TR/xhtml11/
XHTMLTM Basic http://www.w3.org/TR/xhtml-basic/
CSS
Cascading Style Sheets, level1 http://www.w3.org/TR/REC-CSS1
Cascading Style Sheets, level2 http://www.w3.org/TR/REC-CSS2/
JavaScript
Standard ECMA-262
http://www.ecma-international.org/publications/standards/Ecma-262.htm
icecast
http://www.icecast.org/docs.php
SHOUTcast
http://www.shoutcast.com/support/docs/
©SCEI PSP™ Internet Radio Player Development Guide
- 10 -
Page 11

2 PSP™ Internet Radio Structure and Operation

The PSP™ Internet radio system is conceptually divided into the following three main
components.
1. An Internet radio player icon, which is displayed on the XMB™ as explained in the
previous chapter.
2. An Internet radio player, which appears as a GUI in the PSP™ Internet browser.
3. The SHOUTcast/icecast2 protocol handler, which receives SHOUTcast or icecast2
protocol audio data streams for playback.
The following figure shows the position of these three components within the entire Internet
radio player system.
©SCEI PSP™ Internet Radio Player Development Guide
- 11 -
Page 12

PSP™ Internal

Ⓐ PSP system (hardware)
The PSP™ (PlayStation®Portable) system.
Ⓑ PSP system software
Includes the operating system, device drivers, audio decoders, network access libraries,
graphics libraries, and other basic software.
Ⓒ XMB
Xross media bar.
The XMB™ displays the Internet radio player icon under the "Network" category, in the
layer below "Internet radio". The XMB™ also displays information associated with the
Internet radio player icon and is responsible for launching the Internet radio player.
Ⓓ Internet browser
PSP™ Internet browser.
The functionality of the PSP™ Internet browser has been extended so that it works with
the SHOUTcast/icecast2 protocol handler. The Internet radio player can use
JavaScript methods to access this additional functionality for controlling the incoming
audio data stream and for obtaining additional information.
Ⓔ SHOUTcast/icecast2 protocol handler
The SHOUTcast/icecast2 protocol handler connects to the broadcast server, receives an
audio data stream that contains content meta information, then passes that stream to an
audio decoder to decode and output audio. The SHOUTcast/icecast2 protocol handler
has functions for parsing Playlist (PLS) data, and for creating a JavaScript String object
representing the response from an HTTP GET sent to an arbitrary URL.
In addition, the Internet radio player can interface with the JavaScript extended
methods provided by the Internet browser to obtain content meta information extracted
by the SHOUTcast/icecast2 protocol handler in the form of a JavaScript String object.
The complete system comprising these components to is referred to as the “PSP™
Internet radio player core system.”
©SCEI PSP™ Internet Radio Player Development Guide
- 12 -
Page 13

PSP™ External

Ⓕ Internet radio player icon
A file containing data that is used for displaying the Internet radio player icon on the
XMB™.
The file is located in the "/PSP/RADIOPLAYER" directory on a Memory Stick Duo™. The
file extension is ".prs".
The data contains the following information (details described later).
z Name of Internet radio player (required)
z URL of Internet radio player (required)
z Icon image (optional)
z Icon focus image (optional)
z Comment about the Internet radio player (optional)
z URL of author's website (optional)
z Author's name (optional)
z Copyright information (optional)
The above information can be displayed from the XMB™.
The Internet radio player's author is responsible for creating the Internet radio player icon.
The Internet Radio Player SDK comes with a tool that can be used to create the icon. This
document is also included in the SDK.
Ⓖ Internet radio player
GUI of the PSP™ Internet radio player.
The GUI consists of HTML, JavaScript, and image files.
The Internet browser can control functions provided by the SHOUTcast/icecast2
protocol handler by invoking JavaScript methods defined in the Internet radio player.
These functions can be used to control the connection to a broadcast server. Information
obtained from the SHOUTcast/icecast2 protocol handler is displayed on-screen via the
Internet browser.
The Internet radio player is placed on a Web server provided by the Internet radio
player's author. The Internet radio player is a client-side application that runs on the
Internet browser. It is not a server-side application. Therefore, server-side scripts are
not necessary.
©SCEI PSP™ Internet Radio Player Development Guide
- 13 -
Page 14
HINT
As described in Chapter 1, part of the processing of an Internet radio player can also be
implemented by a server-side cgi program or service such as cron.
Ⓗ Broadcast server
Distributes the SHOUTcast or icecast2 protocol audio data stream.
To receive an audio stream, the Internet radio player connects to the broadcast
server either by directly specifying its URL, or from information contained in playlist or
M3U data that points to the desired server.
Broadcast server URL information or playlist (PLS or M3U) information can be obtained
from the Stream Directory page administered by icecast.org or the SHOUTcast
SHOWCASE page administered by AOL.
©SCEI PSP™ Internet Radio Player Development Guide
- 14 -
Page 15
The PSP™ Internet radio can also be implemented in JavaScript that describes the
information collection processing related to the broadcast server, using the Internet
browser and SHOUTcast/icecast2 protocol handler functions.
The following figure shows this type of implementation.
"Internet Radio Player I," which is an Internet radio player that SCE made publicly
available, uses SHOUTcast SHOWCASE information. Similarly, "Internet Radio Player II"
uses the Stream Directory of icecast.org.
The second half of this document describes a sample Internet radio player that uses the
Stream Directory of icecast.org.
《Ⓘ Broadcast station information database》
Database system containing broadcast station information used for distributing audio data
streams via the SHOUTcast or icecast2 protocols.
Specifically, this database system corresponds to the SHOUTcast SHOWCASE administered
by AOL and the Stream Directory administered by icecast.org.
Each database system has its own proprietary set of Web APIs. For details related to these,
refer to the documentation for the database system in use.
©SCEI PSP™ Internet Radio Player Development Guide
- 15 -
Page 16
The Internet radio player uses these Web APIs to find specific broadcast stations such as
those offering a particular music genre. This information can be used to create a broadcast
station list.
This processing is performed by the part in the figure marked as "database accessor". However,
the database accessor is not a real entity, but rather an abstract entity defined in JavaScript.
It is a set of components that provide functions such as HTTP GET processing, string parsing,
and processing for generating an information array.
When the URL of the broadcast server is fixed such as when a broadcaster develops software
for a local station-specific Internet radio player, the database accessor and the broadcast
station information database are unnecessary.
©SCEI PSP™ Internet Radio Player Development Guide
- 16 -
Page 17
The explanation below divides the interrelationships among resources related to PSP™
Internet radio into three main scenarios.
The PSP™ Internet radio can support all three of these scenarios.
Scenario 1: The broadcast content provider and the broadcast server provider create a
dedicated Internet radio player for receiving their own broadcasts
The scenario shown in this figure applies when a broadcaster creates a local station-specific
Internet radio player.
Since the broadcaster (= player author) knows the information required for the connection
such as the URL and port number of the broadcast server, the broadcast station information
database is unnecessary.
This information (which are default values) can be hardcoded into the Internet radio player.
The Internet radio player can also be implemented so that default information related to the
broadcast server is dynamically read by the Internet radio player from a separate file apart
from the html or JavaScript. In this case, the format of this file is arbitrary.
The Internet radio player can be implemented in this way without requiring any non-local
station resources.
©SCEI PSP™ Internet Radio Player Development Guide
- 17 -
Page 18
Scenario 2: The broadcast station information database provider and the broadcast server
provider are the same
The scenario shown in this figure applies when the broadcast content provider is separate
from the broadcast server provider and the broadcast station information database provider.
Scenario 2 can has the same form as Scenario 3 where the broadcast station information
database provider, the broadcast server provider, the broadcast content provider, and the
Internet radio player provider are separate entities.
The "Broadcast client" in this figure refers to music player software such as Winamp and
plugin software for connecting to the broadcast server.
©SCEI PSP™ Internet Radio Player Development Guide
- 18 -
Page 19
Scenario 3: The broadcast station information database provider, the broadcast server
provider, the broadcast content provider, and the Internet radio player provider are separate
entities
"Internet Radio Player I" and "Internet Radio Player II," which are provided by SCE, are
implementations based on this format.
©SCEI PSP™ Internet Radio Player Development Guide
- 19 -
Page 20

3 Creating the Internet Radio Player

This chapter explains how to create the PSP™ Internet radio player, which was briefly
mentioned in Chapter 1.
As explained in the previous chapters, the PSP™ Internet radio player consists of HTML and
JavaScript. Some css and image files are also added as components to create the external
appearance of the Internet radio player and to increase maintainability. Since the Internet
radio player is created by the same process as creating an ordinary Web page, the effort
required is also the same.
However, an ordinary Web page alone cannot function as an Internet radio player.
Mechanisms for producing sound and for finding broadcast stations are required for it to
function as an Internet radio player.
To implement these capabilities on an ordinary Web page, 59 JavaScript extended methods
are provided as part of the PSP™ Internet radio system. These extended methods will give the
Web page the additional capabilities needed to function as an Internet radio player.
When the Internet browser is launched as a PSP™ Internet radio player from the Internet
radio icon under the "Network" category of the XMB™, this group of 52 extended methods is
added to the PSP™ Internet browser. When the browser is started up as a normal PSP™
Internet browser, this group of methods cannot be used.
Some of the principal extended methods include sysRadioPlayPls, which accesses a playlist file
to play audio, sysRadioPlayStream for directly connecting to a broadcast server, and
sysRadioPrepareForHttpGet, which accesses an arbitrary URL to perform an HTTP GET
operation.
By combining these extended methods, you can perform a series of functions such as: obtaining
broadcast station information from the Stream Directory page of icecast.org, parsing the
HTML or XML string that is obtained, constructing the URL for accessing the broadcast
station's playlist file, using the playlist's URL to connect to the broadcast server (audio data
stream server), and finally receiving the audio data stream.
The PSP™ Internet radio player is the entity that performs this processing, interacts with the
user, and displays information on-screen such as the broadcast station's name and the content
being played.
©SCEI PSP™ Internet Radio Player Development Guide
- 20 -
Page 21
HINT
It is technically possible to receive a live audio data stream by invoking the action script
"Sound.loadSound()" on the Flash player within the PSP™ Internet browser, however,
proper operation is not currently guaranteed. This is because the Flash player that is
currently implemented in system software will continuously accumulate a received audio
data stream in the PSP™ system's internal memory. Therefore, playing (receiving) audio
using the Flash player's "Sound.loadSound()" will eventually cause an "Insufficient
memory" alert dialog to appear.
©SCEI PSP™ Internet Radio Player Development Guide
- 21 -
Page 22

List of JavaScript Extended Methods

A list of extended JavaScript methods for the PSP™ Internet radio player is given below.
Methods for starting and stopping playback
Method Name Function
sysRadioPlayStream Start playback by specifying URL of audio data
stream sysRadioPlayPls Start playback by specifying URL of PLS file sysRadioPlayM3u Start playback by specifying URL of M3U file sysRadioStop Stop playback
Methods for controlling output volume
Method Name Function
sysRadioSetMasterVolume Set master volume level sysRadioSetSubVolume Set sub volume level
Methods for getting audio output level
Method Name Function
sysRadioGetLeftAudioPeakLevel Get peak audio level being output from audio left
channel.
Used for displaying audio level meter, etc. sysRadioGetRightAudioPeakLevel Get peak audio level being output from audio
right channel.
Used for displaying audio level meter, etc. sysRadioGetLeftAudioAverageLevel Get average audio level being output from audio
left channel.
Used for displaying audio level meter, etc. sysRadioGetRightAudioAverageLevel Get average audio level being output from audio
right channel.
Used for displaying audio level meter, etc.
Methods for controlling sound effects
Method Name Function
sysRadioSetSineWaveOscillatorFrequencyAndVolume Set oscillation frequency and
volume level of sine wave oscillator
sysRadioSetWhiteNoiseOscillatorVolume Set volume level of pseudo white
noise oscillator sysRadioSetAudioShiftWidth Set shift width of audio frequency component sysRadioSetAudioCutOffWidth Set cut-off width of audio frequency component sysRadioSetAudioPitchShiftWidth Set pitch shift width of audio frequency
component
sysRadioPlayEffectSound Play sound effect
©SCEI PSP™ Internet Radio Player Development Guide
- 22 -
Page 23
Methods related to "HTTP GET" processing
Method Name Function
sysRadioPrepareForHttpGet Prepare to perform HTTP GET for specified URL sysRadioGetHttpGetStatus Report status of sysRadioPrepareForHttpGet
processing
sysRadioGetHttpGetResult Return sysRadioPrepareForHttpGet processing
result as string
sysRadioHttpGetTerminate Perform sysRadioPrepareForHttpGet
housekeeping
Method for getting internal status
Method Name Function
sysRadioGetPlayerStatus Get internal status of player system
Methods for getting playback quality numeric values and playback information strings
Method Name Function
sysRadioGetNetworkBandQuality Get communication circuit band quality
evaluation value sysRadioGetAudioSoundDistortionRa te
Get audio distortion rate (upper and lower limit
saturation frequency of sound) sysRadioGetContentMetaInfo Get content meta information related to audio
data stream being played sysRadioGetBitRate Get bit rate of audio data stream being played sysRadioGetSamplingRate Get sampling rate value of audio data stream
being played
Methods for getting information related to audio data stream being played
Method Name Function
sysRadioGetStreamUrl Get URL of audio data stream being played sysRadioGetStreamTitle Get title information of audio data stream being
played sysRadioGetRelatedPageUrl Get related Web page URL string of audio data
stream being played sysRadioGetStreamIpAddress Get IP address of broadcast server of audio data
stream being played sysRadioGetStreamPort Get connection port number of broadcast server of
audio data stream being played sysRadioGetStreamBufferLevel Get level indicating residual amount of audio data
stream buffer being played
©SCEI PSP™ Internet Radio Player Development Guide
- 23 -
Page 24
Methods for finding files on the Memory Stick Duo™
Method Name Function
sysRadioPrepareForScanDir Prepare for directory entry scan on the
sysRadioScanDir Scan directory and return file entry (filename)
sysRadioGetMediaInOutStatus Detect whether a Memory Stick Duo™ was
String search processing methods
Method Name Function
sysRadioPrepareForStrOperation Prepare for string search or string extraction
sysRadioStrLength Nearly equivalent to JavaScript standard method
sysRadioStrIndexOf Nearly equivalent to JavaScript standard method
sysRadioStrSlice Nearly equivalent to JavaScript standard method
sysRadioStrCharCodeAt Nearly equivalent to JavaScript standard method
sysRadioStrOperationTerminate Terminate string search processing.
Memory Stick Duo™
that was found first.
For the second and subsequent calls, return the
file entry (filename) that was found next.
inserted or removed following previous
sysRadioPrepareForScanDir
processing
"length."
Returns string length as value in terms of bytes.
"indexOf."
Searches for string pattern.
"slice."
Extracts substring.
"charCodeAt."
Returns character code of specific position in
string.
String conversion processing methods
Method Name Function
sysRadioCharacterEntityConvert Convert characters that contain a character entity
name to an actual character sysRadioCharacterCodeConvert Convert UTF-8 string to SJIS or EUC-KR string.
Methods for getting analog pad values
Method Name Function
sysRadioGetAnalogStickXValue Get analog stick's X value sysRadioGetAnalogStickYValue Get analog stick's Y value sysRadioGetAnalogStickAngleValue Get analog stick's angle value sysRadioGetAnalogStickRadiusValue Get analog stick's radius value
©SCEI PSP™ Internet Radio Player Development Guide
- 24 -
Page 25
Methods related to debug log console
Method Name Function
sysRadioSetDebugMode Set debug mode sysRadioDebugLog Display string on debug log console sysRadioSetDebugLogTextStyle Set debug log console's text style (typeface,
sysRadioClearDebugLog Clear strings displayed on debug log console
Miscellaneous
Method Name Function
sysRadioGetPlayerCoreVersionInfo Get Internet radio player system core version
sysRadioCapabilityCheck Get support information related to a specific
sysRadioGetStartButtonToggleStatus Get PSP™ system's START button toggle status sysRadioBackLightAlwaysOn Control backlight's always on state when powered
sysRadioBusyIndicator Control busy indicator display at bottom left of
sysRadioCaptureScreenShot Capture screenshot sysRadioSleep Set PSP™ system sleep mode sysRadioGetSystemStatus Inquire about internal status of PSP™ system.
character color, background color, existence of
shadow, character align attribute)
information
function
by external power supply
screen
©SCEI PSP™ Internet Radio Player Development Guide
- 25 -
Page 26

JavaScript Extended Method Reference Details

Descriptions of the individual extended JavaScript methods for the PSP™ Internet radio
player are presented below.
The description of each method contains a simple sample program that runs independently.
Programs that are almost identical to these sample programs are also provided on SCE's Web
server.
You can access this page and run these programs by using the special Internet radio player
icon sysRadio_method_sample.prs, which is included in the SDK that contains this document.
This icon was created to allow you to run the sample code.
©SCEI PSP™ Internet Radio Player Development Guide
- 26 -
Page 27

sysRadioPlayStream

Start playback by specifying URL of audio data stream
Syntax
result = psp.sysRadioPlayStream (url, userAgentName)
Arguments
url userAgentName
URL of playlist User agent name used when performing HTTP GET for getting playlist information
Return Value
0
-1
Description
This extended method connects to the broadcast server specified by url to play audio.
The user agent name specification argument is used for controlling the behavior of the
broadcast server.
If there is no free space in the JavaScript extended method processing queue, -1 is returned.
At this time, the processing request is ignored (discarded). As long as method calls of types
that are queued are not continuously issued (such as in an endless loop), this state does not
normally occur.
The following methods are types that are queued.
Method Names of Types That are Queued
sysRadioPlayStream Starts playback by specifying URL of audio data stream sysRadioPlayPls Starts playback by specifying URL of PLS file sysRadioPlayM3u Starts playback by specifying URL of M3U file sysRadioPrepareForHttpGet Prepares for performing HTTP GET for specified URL sysRadioCaptureScreenShot Captures screenshot
Normal Error
Overview
©SCEI PSP™ Internet Radio Player Development Guide
- 27 -
Page 28
Example
HINT
If the broadcast server is accessed by the Internet browser using an ordinary user
agent name such as "Mozilla/4.0 (PSP (PlayStation Portable); 2.00)," the audio data
stream may not be able to be received. When the broadcast server is accessed from the
Internet browser in this manner, it may just output a Web page for management.
var result = psp.sysRadioPlayStream ("http://radio.psp.dl.playstation.net:80" +"/psp/radio/sample/pseudo_stream/teststream_a.stream.mp3", "pspRadioPlayer");
This statement accesses the broadcast server "http://radio.psp.dl.playstation.net:80/psp/radio/sample/pseudo_stream/teststream_a.strea m.mp3" to play audio.
Sample
<html><head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>sysRadioPlayStream</title>
</head>
<body>
<h1>sysRadioPlayStream</h1>
<script language="JavaScript">
<!--
window.onload = function () { setTimeout ('initProc ()', 500); }
function initProc () {
psp.sysRadioSetMasterVolume (255);
}
function test () {
psp.sysRadioPlayStream
("http://radio.psp.dl.playstation.net:80"
+"/psp/radio/sample/pseudo_stream/teststream_a.stream.mp3",
"pspRadioPlayer");
psp.sysRadioSetSubVolume (255);
©SCEI PSP™ Internet Radio Player Development Guide
- 28 -
Page 29
}
// -->
</script>
<button onclick='test();'>TEST</button>
<object name="psp" type="application/x-psp-extplugin"></object>
</body></html>
Note) The URL in the sample code accesses a "pseudo broadcast server" that was created
to run this sample code.
Since it is not a genuine SHOUTcast or icecast2 broadcast server, its behavior will differ
from an actual server in that playback always begins from the same timecode position
immediately after connection, for example.
See Also
sysRadioPlayPls, sysRadioPlayM3u, sysRadioStop,
sysRadioSetMasterVolume, sysRadioSetSubVolume,
sysRadioPrepareForHttpGet, sysRadioCaptureScreenShot
©SCEI PSP™ Internet Radio Player Development Guide
- 29 -
Page 30

sysRadioPlayPls

Syntax
result = psp.sysRadioPlayPls (url, userAgentName0, userAgentName1)
Arguments
url userAgentName0
userAgentName1
URL of playlist User agent name used when performing HTTP GET for getting playlist information User agent name used when connecting to broadcast server
Start playback by specifying URL of playlist
Return Value
0
-1
Description
This extended method connects to the HTTP server specified by url to get playlist
information and connects to the broadcast server described in this playlist information to
play audio.
The two user agent name specification arguments are used to control the behavior of the
HTTP server and broadcast server.
A playlist that is handled by a PSP™ internet radio has the following format.
[playlist] numberofentries=2 File1=http://radio.psp.dl.playstation.net/psp/radio/sample/pseudo_stream/teststream_a.stream.mp3 Title1=(#1 - 1/100) PSP Internet Radio Test Audio Stream [RADIO PSP] Length1=-1 Browser1= File2=http://radio.psp.dl.playstation.net/psp/radio/sample/pseudo_stream/teststream_b.stream.mp3 Title2=(#2 - 1/100) PSP Internet Radio Test Audio Stream [RADIO PSP] Length2=-1 Browser2= Version=2
Normal Error
If there is no free space in the JavaScript extended method processing queue, -1 is returned.
©SCEI PSP™ Internet Radio Player Development Guide
- 30 -
Page 31
At this time, the processing request is ignored (discarded). As long as method calls of types
that are queued are not continuously issued (such as in an endless loop), this state does not
normally occur.
The following methods are types that are queued.
Method Names of Types That
Overview are Queued
sysRadioPlayStream Starts playback by specifying URL of audio data stream sysRadioPlayPls Starts playback by specifying URL of PLS file sysRadioPlayM3u Starts playback by specifying URL of M3U file sysRadioPrepareForHttpGet Prepares for performing HTTP GET for specified URL sysRadioCaptureScreenShot Captures screenshot
HINT
If the broadcast server is accessed by the Internet browser using an ordinary user
Example
Sample
agent name such as "Mozilla/4.0 (PSP (PlayStation Portable); 2.00)," the audio data
stream may not be able to be received. When the broadcast server is accessed from the
Internet browser in this manner, it may just output a Web page for management.
var result = psp.sysRadioPlayPls ("http://radio.psp.dl.playstation.net"
+"/psp/radio/sample/pseudo_stream/teststream0.pls",
"pspRadioPlayer",
"pspRadioPlayer");
This statement accesses the playlist
"http://radio.psp.dl.playstation.net/psp/radio/sample/pseudo_stream/teststream0.pls" and
connects to the broadcast server according to information in the playlist.
<html><head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>sysRadioPlayPls</title>
</head>
<body>
<h1>sysRadioPlayPls</h1>
©SCEI PSP™ Internet Radio Player Development Guide
- 31 -
Page 32
<script language="JavaScript">
<!--
window.onload = function () { setTimeout ('initProc ()', 500); }
function initProc () {
psp.sysRadioSetMasterVolume (255);
}
function test () {
psp.sysRadioPlayPls
("http://radio.psp.dl.playstation.net"
+"/psp/radio/sample/pseudo_stream/teststream0.pls",
"pspRadioPlayer",
"pspRadioPlayer");
psp.sysRadioSetSubVolume (255);
}
See Also
// -->
</script>
<button onclick='test();'>TEST</button>
<object name="psp" type="application/x-psp-extplugin"></object>
</body></html>
Note) The URL in the sample code accesses a "pseudo broadcast server" that was created
to run this sample code.
Since it is not a genuine SHOUTcast or icecast2 broadcast server, its behavior will differ
from an actual server in that playback always begins from the same timecode position
immediately after connection, for example.
sysRadioPlayStream, sysRadioPlayM3u, sysRadioStop,
sysRadioSetMasterVolume, sysRadioSetSubVolume,
sysRadioPrepareForHttpGet, sysRadioCaptureScreenShot
©SCEI PSP™ Internet Radio Player Development Guide
- 32 -
Page 33

sysRadioPlayM3u

Syntax
result = psp.sysRadioPlayM3u (url, userAgentName0, userAgentName1)
Arguments
url userAgentName0
userAgentName1
URL of playlist User agent name used when performing HTTP GET for getting M3U file User agent name used when connecting to broadcast server
Start playback by specifying URL of M3U file
Return Value
0 Normal
-1 Error
Description
This extended method connects to the HTTP server specified by url to get M3U data and
connects to the broadcast server described in this M3U data to play audio.
The two user agent name specification arguments are used to control the behavior of the
HTTP server and broadcast server.
M3U data that is handled by a PSP™ internet radio has the following format. (The
contents described in this example are fictional or provisional.)
# PSP Internet Radio Test Audio Stream [RADIO PSP] # STREAM 0 (MAIN STREAM) http://radio.psp.dl.playstation.net/psp/radio/sample/pseudo_stream/teststream_a.stream.mp3 # STREAM 1 (SUB STREAM) http://radio.psp.dl.playstation.net/psp/radio/sample/pseudo_stream/teststream_b.stream.mp3
If there is no free space in the JavaScript extended method processing queue, -1 is returned.
At this time, the processing request is ignored (discarded). As long as method calls of types
that are queued are not continuously issued (such as in an endless loop), this state does not
©SCEI PSP™ Internet Radio Player Development Guide
- 33 -
Page 34
normally occur.
The following methods are types that are queued.
Method Names of Types That
Overview are Queued
sysRadioPlayStream Starts playback by specifying URL of audio data stream sysRadioPlayPls Starts playback by specifying URL of PLS file sysRadioPlayM3u Starts playback by specifying URL of M3U file sysRadioPrepareForHttpGet Prepares for performing HTTP GET for specified URL sysRadioCaptureScreenShot Captures screenshot
HINT
If the broadcast server is accessed by the Internet browser using an ordinary user
agent name such as "Mozilla/4.0 (PSP (PlayStation Portable); 2.00)," the audio data
stream may not be able to be received. When the broadcast server is accessed from the
Example
Sample
Internet browser in this manner, it may just output a Web page for management.
var result = psp.sysRadioPlayM3u ("http://radio.psp.dl.playstation.net"
+"/psp/radio/sample/pseudo_stream/teststream0.m3u",
"pspRadioPlayer",
"pspRadioPlayer");
This statement accesses M3U data
"http://radio.psp.dl.playstation.net/psp/radio/sample/pseudo_stream/teststream0.m3u " and
connects to the broadcast server according to information in the M3U data.
<html><head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>sysRadioPlayM3u</title>
</head>
<body>
<h1>sysRadioPlayM3u</h1>
<script language="JavaScript">
<!--
©SCEI PSP™ Internet Radio Player Development Guide
- 34 -
Page 35
window.onload = function () { setTimeout ('initProc ()', 500); }
function initProc () {
psp.sysRadioSetMasterVolume (255);
}
function test () {
psp.sysRadioPlayM3u
("http://radio.psp.dl.playstation.net"
+"/psp/radio/sample/pseudo_stream/teststream0.m3u",
"pspRadioPlayer",
"pspRadioPlayer");
psp.sysRadioSetSubVolume (255);
}
// -->
</script>
See Also
<button onclick='test();'>TEST</button>
<object name="psp" type="application/x-psp-extplugin"></object>
</body></html>
Note) The URL in the sample code accesses a "pseudo broadcast server" that was created
to run this sample code.
Since it is not a genuine SHOUTcast or icecast2 broadcast server, its behavior will differ
from an actual server in that playback always begins from the same timecode position
immediately after connection, for example.
sysRadioPlayStream, sysRadioPlayPls, sysRadioStop,
sysRadioSetMasterVolume, sysRadioSetSubVolume,
sysRadioPrepareForHttpGet, sysRadioCaptureScreenShot
©SCEI PSP™ Internet Radio Player Development Guide
- 35 -
Page 36

sysRadioStop

Syntax
psp.sysRadioStop ([mode])
Arguments
mode
Identifier of audio data stream to be stopped (optional) 0: Main audio data stream 1: Sub audio data stream
Stop receiving and playing audio data stream
Return Value
Always 0.
Description
If no argument is specified or 0 is assigned for the argument, this extended method stops
playback of the main audio data stream.
If 1 is assigned for the argument, this extended method stops playback of the sub audio
data stream.
The PSP™ Internet radio system has an internal structure that enables two data streams
to be handled simultaneously. This enables it to provide seamless play when the broadcast
station is switched.
When switching reception (switching the connection) from a certain broadcast server B to
another broadcast server A, the PSP™ Internet radio system starts the connection to
broadcast server A while maintaining the connection to broadcast server B and continuing
to play its audio.
It subsequently starts reception of the audio stream from broadcast server A and when
sufficient buffering has been completed and preparations for audio playback are finished, it
disconnects from broadcast server B while switching the audio using the fader.
Although this processing is automatically performed internally by the PSP™ Internet radio
©SCEI PSP™ Internet Radio Player Development Guide
- 36 -
Page 37
system, it can also be forcibly performed by a sysRadioStop method call.
In this example, broadcast server A (server that is being faded in) is the main audio data
stream, and broadcast server B (server that is being faded out) is the sub audio data
stream.
The area in the figure above that indicates the processing for switching the two audio data
streams by using the fader has been simplified. It is represented in this document as shown
in the following figure.
©SCEI PSP™ Internet Radio Player Development Guide
- 37 -
Page 38
Example
Sample
psp.sysRadioStop ();
This statement stops playback.
<html><head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>sysRadioStop</title>
</head>
<body>
<h1>sysRadioStop</h1>
<script language="JavaScript">
<!--
window.onload = function () { setTimeout ('initProc ()', 500); }
function initProc () {
psp.sysRadioSetMasterVolume (255);
}
function start () {
psp.sysRadioPlayStream
("http://radio.psp.dl.playstation.net:80"
©SCEI PSP™ Internet Radio Player Development Guide
- 38 -
Page 39
+"/psp/radio/sample/pseudo_stream/teststream_a.stream.mp3",
"pspRadioPlayer");
psp.sysRadioSetSubVolume (255);
}
function stop () {
psp.sysRadioStop ();
}
// -->
</script>
<button onclick='start();'>START</button>
<button onclick='stop();'>STOP</button>
<object name="psp" type="application/x-psp-extplugin"></object>
</body></html>
See Also
Note) The URL in the sample code accesses a "pseudo broadcast server" that was created
to run this sample code.
Since it is not a genuine SHOUTcast or icecast2 broadcast server, its behavior will differ
from an actual server in that playback always begins from the same timecode position
immediately after connection, for example.
sysRadioPlayStream, sysRadioPlayPls, sysRadioPlayM3u,
©SCEI PSP™ Internet Radio Player Development Guide
- 39 -
Page 40

sysRadioSetMasterVolume

Syntax
psp.sysRadioSetMasterVolume (vol)
Arguments
vol
Volume value (0≦vol255)
Set master volume level
Return Value
Always 0.
Description
This extended method controls the playback volume.
0 is the lowest volume (silence) and 255 is the highest volume. The default is 0.
The volume of sound that is output from the audio stream received from the broadcast
server is determined by the product of the value set by sysRadioSetMasterVolume and the
value set by sysRadioSetSubVolume.
The following figure shows the relationship between the sound sources for the PSP™
Internet radio and the volume controls.
©SCEI PSP™ Internet Radio Player Development Guide
- 40 -
Page 41
Example
Sample
psp.sysRadioSetMasterVolume (255);
This statement sets the master volume value to 255 (maximum value).
<html><head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>sysRadioSetMasterVolume</title>
</head>
<body>
<h1>sysRadioSetMasterVolume</h1>
<script language="JavaScript">
<!--
window.onload = function () { setTimeout ('initProc ()', 500); }
function initProc () {
©SCEI PSP™ Internet Radio Player Development Guide
- 41 -
Page 42
psp.sysRadioSetMasterVolume (255);
}
function test () {
psp.sysRadioPlayStream
("http://radio.psp.dl.playstation.net:80"
+"/psp/radio/sample/pseudo_stream/teststream_a.stream.mp3",
"pspRadioPlayer");
psp.sysRadioSetSubVolume (255);
}
// -->
</script>
<button onclick='test();'>TEST</button>
<object name="psp" type="application/x-psp-extplugin"></object>
</body></html>
See Also
Note) The URL in the sample code accesses a "pseudo broadcast server" that was created
to run this sample code.
Since it is not a genuine SHOUTcast or icecast2 broadcast server, its behavior will differ
from an actual server in that playback always begins from the same timecode position
immediately after connection, for example.
sysRadioPlayStream, sysRadioPlayPls, sysRadioPlayM3u, sysRadioStop,
sysRadioSetSubVolume
©SCEI PSP™ Internet Radio Player Development Guide
- 42 -
Page 43

sysRadioSetSubVolume

Syntax
psp.sysRadioSetSubVolume (vol)
Arguments
vol
Volume value (0≦vol255)
Set sub volume level
Return Value
Always 0.
Description
This extended method controls the playback volume.
0 is the lowest volume (silence) and 255 is the highest volume. The default is 0.
The volume of sound that is output from the audio stream received from the broadcast
server is determined by the product of the value set by sysRadioSetMasterVolume and the
value set by sysRadioSetSubVolume.
©SCEI PSP™ Internet Radio Player Development Guide
- 43 -
Page 44
Example
Sample
psp.sysRadioSetSubVolume (255);
This statement sets the sub value to 255 (maximum value).
<html><head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>sysRadioSetSubVolume</title>
</head>
<body>
<h1>sysRadioSetSubVolume</h1>
<script language="JavaScript">
<!--
window.onload = function () { setTimeout ('initProc ()', 500); }
function initProc () {
©SCEI PSP™ Internet Radio Player Development Guide
- 44 -
Page 45
psp.sysRadioSetMasterVolume (255);
}
function test () {
psp.sysRadioPlayStream
("http://radio.psp.dl.playstation.net:80"
+"/psp/radio/sample/pseudo_stream/teststream_a.stream.mp3",
"pspRadioPlayer");
psp.sysRadioSetSubVolume (255);
}
// -->
</script>
<button onclick='test();'>TEST</button>
<object name="psp" type="application/x-psp-extplugin"></object>
</body></html>
See Also
Note) The URL in the sample code accesses a "pseudo broadcast server" that was created
to run this sample code.
Since it is not a genuine SHOUTcast or icecast2 broadcast server, its behavior will differ
from an actual server in that playback always begins from the same timecode position
immediately after connection, for example.
sysRadioPlayStream, sysRadioPlayPls, sysRadioPlayM3u, sysRadioStop,
sysRadioSetMasterVolume
©SCEI PSP™ Internet Radio Player Development Guide
- 45 -
Page 46

sysRadioGetLeftAudioPeakLevel

Get peak audio level being output from audio left channel
Syntax
System software prior to version 5.00
result = psp.sysRadioGetLeftAudioPeakLevel ()
System software version 5.00 or later
result = psp.sysRadioGetLeftAudioPeakLevel ( [mode] )
Arguments
mode
Return Value
When mode is not specified or when 0 is specified for mode
When 1 is specified for mode When 2 is specified for mode
Description
This extended method gets the peak audio output level of the left channel.
If
figure below is returned as a value in the range 0 to 255.
If 1 is specified for
Identifier for specifying the range of the return value (see below)
Integer value in the range 0 result 255
Integer value in the range 0 result 32767 Integer value in the range 0 result 90
mode
is not specified or if it is specified as 0, the peak absolute value at point Ⓐ in the
mode
, the peak absolute value at the same point in the figure is returned
as a value in the range 0 to 32767.
If 2 is specified for
logarithmically transformed and returned as a value in the range 0 to 90. Specifically,
processing equivalent to evaluating the following expression is performed internally by the
PSP™.
©SCEI PSP™ Internet Radio Player Development Guide
mode
, the peak absolute value at the same point in the figure is
- 46 -
Page 47
result = Math.floor
(20 * Math.log (psp.sysRadioGetLeftAudioPeakLevel (1) + 1) / Math.log (10));
Example
Sample
var leftAudioLevel = psp.sysRadioGetLeftAudioPeakLevel ();
This statement gets the peak audio output level of the left channel at point in the above
figure and sets it for leftAudioLevel.
<html><head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>sysRadioGetLeftAudioPeakLevel</title>
</head>
<body>
<h1>sysRadioGetLeftAudioPeakLevel</h1>
<script language="JavaScript">
©SCEI PSP™ Internet Radio Player Development Guide
- 47 -
Page 48
<!--
window.onload = function () { setTimeout ('initProc ()', 500); }
function initProc () {
psp.sysRadioSetDebugMode (1);
psp.sysRadioSetDebugLogTextStyle
(224,224,224,255, 255,255,255,255, 30,30,40,96, 1, 2);
psp.sysRadioSetMasterVolume (255);
}
var tid = 0;
function intervalProc () {
var leftAudioLevel = psp.sysRadioGetLeftAudioPeakLevel ();
psp.sysRadioDebugLog ("left=" + leftAudioLevel + "\n");
}
function test () {
psp.sysRadioPlayStream
("http://radio.psp.dl.playstation.net:80"
+"/psp/radio/sample/pseudo_stream/teststream_a.stream.mp3",
"pspRadioPlayer");
psp.sysRadioSetSubVolume (255);
if ( tid == 0 ) tid = setInterval ('intervalProc ()', 500);
}
// -->
</script>
<button onclick='test();'>TEST</button>
<object name="psp" type="application/x-psp-extplugin"></object>
</body></html>
Note) The URL in the sample code accesses a "pseudo broadcast server" that was created
to run this sample code.
Since it is not a genuine SHOUTcast or icecast2 broadcast server, its behavior will differ
from an actual server in that playback always begins from the same timecode position
immediately after connection, for example.
See Also
sysRadioSetSubVolume, sysRadioGetRightAudioPeakLevel,
©SCEI PSP™ Internet Radio Player Development Guide
- 48 -
Page 49
sysRadioGetLeftAudioAverageLevel, sysRadioGetRightAudioAverageLevel
©SCEI PSP™ Internet Radio Player Development Guide
- 49 -
Page 50

sysRadioGetRightAudioPeakLevel

Get peak audio level being output from audio right channel
Syntax
System software prior to version 5.00
result = psp.sysRadioGetRightAudioPeakLevel ()
System software version 5.00 or later
result = psp.sysRadioGetRightAudioPeakLevel ( [mode] )
Arguments
mode
Return Value
When mode is not specified or when 0 is specified for mode
When 1 is specified for mode When 2 is specified for mode
Description
This extended method gets the peak audio output level of the right channel.
If
Identifier for specifying the range of the return value (see below)
Integer value in the range 0 result 255
Integer value in the range 0 result 32767 Integer value in the range 0 result 90
mode
is not specified or if it is specified as 0, the peak absolute value at point Ⓐ in the
figure below is returned as a value in the range 0 to 255.
If 1 is specified for
as a value in the range 0 to 32767.
mode
, the peak absolute value at the same point in the figure is returned
If 2 is specified for
©SCEI PSP™ Internet Radio Player Development Guide
mode
, the peak absolute value at the same point in the figure is
- 50 -
Page 51
logarithmically transformed and returned as a value in the range 0 to 90. Specifically,
processing equivalent to evaluating the following expression is performed internally by the
PSP™.
result = Math.floor
(20 * Math.log (psp.sysRadioGetRightAudioPeakLevel (1) + 1) / Math.log (10));
Example
var rightAudioLevel = psp.sysRadioGetRightAudioPeakLevel ();
This statement gets the peak audio output level of the right channel at point in the
above figure and sets it for rightAudioLevel.
Sample
<html><head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>sysRadioGetRightAudioPeakLevel</title>
</head>
<body>
©SCEI PSP™ Internet Radio Player Development Guide
- 51 -
Page 52
<h1>sysRadioGetRightAudioPeakLevel</h1>
<script language="JavaScript">
<!--
window.onload = function () { setTimeout ('initProc ()', 500); }
function initProc () {
psp.sysRadioSetDebugMode (1);
psp.sysRadioSetDebugLogTextStyle
(224,224,224,255, 255,255,255,255, 30,30,40,96, 1, 2);
psp.sysRadioSetMasterVolume (255);
}
var tid = 0;
function intervalProc () {
var rightAudioLevel = psp.sysRadioGetRightAudioPeakLevel ();
psp.sysRadioDebugLog ("right=" + rightAudioLevel + "\n");
}
function test () {
psp.sysRadioPlayStream
("http://radio.psp.dl.playstation.net:80"
+"/psp/radio/sample/pseudo_stream/teststream_a.stream.mp3",
"pspRadioPlayer");
psp.sysRadioSetSubVolume (255);
if ( tid == 0 ) tid = setInterval ('intervalProc ()', 500);
}
// -->
</script>
<button onclick='test();'>TEST</button>
<object name="psp" type="application/x-psp-extplugin"></object>
</body></html>
Note) The URL in the sample code accesses a "pseudo broadcast server" that was created
to run this sample code.
Since it is not a genuine SHOUTcast or icecast2 broadcast server, its behavior will differ
from an actual server in that playback always begins from the same timecode position
immediately after connection, for example.
©SCEI PSP™ Internet Radio Player Development Guide
- 52 -
Page 53
See Also
sysRadioSetSubVolume, sysRadioGetLeftAudioPeakLevel,
sysRadioGetLeftAudioAverageLevel, sysRadioGetRightAudioAverageLevel
©SCEI PSP™ Internet Radio Player Development Guide
- 53 -
Page 54

sysRadioGetLeftAudioAverageLevel

Get average audio level being output from audio left channel
Syntax
result = psp.sysRadioGetLeftAudioAverageLevel ( [mode] )
Arguments
mode
Return Value
When mode is not specified or when 0 is specified for mode
When 1 is specified for mode When 2 is specified for mode
Description
This extended method gets the average audio output level of the left channel.
If
the figure below is returned as a value in the range 0 to 255.
If 1 is specified for
Identifier for specifying the range of the return value (see below)
Integer value in the range 0 result 255
Integer value in the range 0 result 32767 Integer value in the range 0 result 90
mode
is not specified or if it is specified as 0, the average absolute value at point in
mode
, the average absolute value at the same point in the figure is
returned as a value in the range 0 to 32767.
If 2 is specified for
logarithmically transformed and returned as a value in the range 0 to 90. Specifically,
processing equivalent to evaluating the following expression is performed internally by the
PSP™.
result = Math.floor
(20 * Math.log (psp.sysRadioGetLeftAudioAverageLevel (1) + 1) / Math.log (10));
©SCEI PSP™ Internet Radio Player Development Guide
mode
, the average absolute value at the same point in the figure is
- 54 -
Page 55
This method can be used with system software version 5.00 or later.
Example
Sample
var leftAudioLevel = psp.sysRadioGetLeftAudioAverageLevel ();
This statement gets the average audio output level of the left channel at point in the
above figure and sets it for leftAudioLevel.
<html><head>
<meta http-equiv=”content-type” content=”text/html; charset=utf-8”>
<title>sysRadioGetLeftAudioAverageLevel</title>
</head>
<body>
<h1>sysRadioGetLeftAudioPeakLevel</h1>
<script language=”JavaScript”>
©SCEI PSP™ Internet Radio Player Development Guide
- 55 -
Page 56
<!—
window.onload = function () { setTimeout (‘initProc ()’, 500); }
function initProc () {
psp.sysRadioSetDebugMode (1);
psp.sysRadioSetDebugLogTextStyle
(224,224,224,255, 255,255,255,255, 30,30,40,96, 1, 2);
psp.sysRadioSetMasterVolume (255);
}
var tid = 0;
function intervalProc () {
var leftAudioLevel = psp.sysRadioGetLeftAudioAverageLevel ();
psp.sysRadioDebugLog (“left=” + leftAudioLevel + “\n”);
}
function test () {
psp.sysRadioPlayStream
(“http://radio.psp.dl.playstation.net:80”
+”/psp/radio/sample/pseudo_stream/teststream_a.stream.mp3”,
“pspRadioPlayer”);
psp.sysRadioSetSubVolume (255);
if ( tid == 0 ) tid = setInterval (‘intervalProc ()’, 500);
}
// -->
</script>
<button onclick=’test();’>TEST</button>
<object name=”psp” type=”application/x-psp-extplugin”></object>
</body></html>
Note) The URL in the sample code accesses a "pseudo broadcast server" that was created
to run this sample code.
Since it is not a genuine SHOUTcast or icecast2 broadcast server, its behavior will differ
from an actual server in that playback always begins from the same timecode position
immediately after connection, for example.
See Also
sysRadioCapabilityCheck, sysRadioSetSubVolume, sysRadioGetLeftAudioPeakLevel ,
©SCEI PSP™ Internet Radio Player Development Guide
- 56 -
Page 57
sysRadioGetRightAudioPeakLevel, sysRadioGetRightAudioAverageLevel
©SCEI PSP™ Internet Radio Player Development Guide
- 57 -
Page 58

sysRadioGetRightAudioAverageLevel

Get average audio level being output from audio right channel
Syntax
result = psp.sysRadioGetRightAudioAverageLevel ( [mode] )
Arguments
mode
Return Value
When mode is not specified or when 0 is specified for mode
When 1 is specified for mode When 2 is specified for mode
Description
This extended method gets the average audio output level of the right channel.
If
the figure below is returned as a value in the range 0 to 255.
If 1 is specified for
Identifier for specifying the range of the return value (see below)
Integer value in the range 0 result 255
Integer value in the range 0 result 32767 Integer value in the range 0 result 90
mode
is not specified or if it is specified as 0, the average absolute value at point in
mode
, the average absolute value at the same point in the figure is
returned as a value in the range 0 to 32767.
If 2 is specified for
logarithmically transformed and returned as a value in the range 0 to 90. Specifically,
processing equivalent to evaluating the following expression is performed internally by the
PSP™.
result = Math.floor
(20 * Math.log (psp.sysRadioGetRightAudioAverageLevel (1) + 1) / Math.log (10));
©SCEI PSP™ Internet Radio Player Development Guide
mode
, the average absolute value at the same point in the figure is
- 58 -
Page 59
This method can be used with system software version 5.00 or later.
Example
Sample
var rightAudioLevel = psp.sysRadioGetRightAudioAverageLevel ();
This statement gets the average audio output level of the right channel at point in the
above figure and sets it for rightAudioLevel.
<html><head>
<meta http-equiv=”content-type” content=”text/html; charset=utf-8”>
<title>sysRadioGetLeftAudioAverageLevel</title>
</head>
<body>
<h1>sysRadioGetLeftAudioPeakLevel</h1>
<script language=”JavaScript”>
©SCEI PSP™ Internet Radio Player Development Guide
- 59 -
Page 60
<!—
window.onload = function () { setTimeout (‘initProc ()’, 500); }
function initProc () {
psp.sysRadioSetDebugMode (1);
psp.sysRadioSetDebugLogTextStyle
(224,224,224,255, 255,255,255,255, 30,30,40,96, 1, 2);
psp.sysRadioSetMasterVolume (255);
}
var tid = 0;
function intervalProc () {
var leftAudioLevel = psp.sysRadioGetRightAudioAverageLevel ();
psp.sysRadioDebugLog (“left=” + leftAudioLevel + “\n”);
}
function test () {
psp.sysRadioPlayStream
(“http://radio.psp.dl.playstation.net:80”
+”/psp/radio/sample/pseudo_stream/teststream_a.stream.mp3”,
“pspRadioPlayer”);
psp.sysRadioSetSubVolume (255);
if ( tid == 0 ) tid = setInterval (‘intervalProc ()’, 500);
}
// -->
</script>
<button onclick=’test();’>TEST</button>
<object name=”psp” type=”application/x-psp-extplugin”></object>
</body></html>
Note) The URL in the sample code accesses a "pseudo broadcast server" that was created
to run this sample code.
Since it is not a genuine SHOUTcast or icecast2 broadcast server, its behavior will differ
from an actual server in that playback always begins from the same timecode position
immediately after connection, for example.
See Also
sysRadioCapabilityCheck, sysRadioSetSubVolume, sysRadioGetLeftAudioPeakLevel ,
©SCEI PSP™ Internet Radio Player Development Guide
- 60 -
Page 61
sysRadioGetRightAudioPeakLevel, sysRadioGetLeftAudioAverageLevel
©SCEI PSP™ Internet Radio Player Development Guide
- 61 -
Page 62
sysRadioSetSineWaveOscillatorFrequen
cyAndVolume
Set oscillation frequency and volume level of sine wave oscillator
Syntax

psp.sysRadioSetSineWaveOscillatorFrequencyAndVolume

(freq [, vol [, tension [, cwtext [, keyingspeed ] ] ] ])
Arguments
freq vol tension cwtext keyingspeed
Oscillation frequency (0freq22500; units: Hz) Volume (0vol255; optional) Rate of frequency change (0tension255; optional) Morse code text (optional) Morse code keying speed (0keyingspeed32; optional)
Return Value
Always 0.
Description
This is a function for producing a "retro analog radio atmosphere."
This extended method sets parameters for the sign wave oscillator such as the oscillation
frequency and amplitude (size of the sound).
The rate that the frequency changes can be assigned by using
value of
A sign wave can be output as Morse code by assigning a string for
between characters, keying is connected. The keying speed is controlled by using
keyingspeed
tension
, the faster the frequency changes.
. The smaller the value of
keyingspeed
tension
, the faster the keying speed.
. The smaller the
cwtext
. If "~" is inserted
The volume of sound that is output is determined by the product of the value set by
sysRadioSetMasterVolume and the value set by
sysRadioSetSineWaveOscillatorFrequencyAndVolume.
©SCEI PSP™ Internet Radio Player Development Guide
- 62 -
Page 63
Example
Sample
psp.sysRadioSetSineWaveOscillatorFrequencyAndVolume
(880, 80, 100, "CQ CQ CQ DE P~S~P P~S~P P~S~P PSE K ", 3);
This statement oscillates an 880 Hz sine wave and modulates it by the intermittent pattern
of Morse code.
<html><head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>sysRadioSetSineWaveOscillatorFrequencyAndVolume</title>
</head>
<body>
<h1>sysRadioSetSineWaveOscillatorFrequencyAndVolume</h1>
<script language="JavaScript">
<!--
©SCEI PSP™ Internet Radio Player Development Guide
- 63 -
Page 64
window.onload = function () { setTimeout ('initProc ()', 500); }
function initProc () {
psp.sysRadioSetMasterVolume (255);
}
var tid = 0;
function intervalProc () {
var freq = 220 + 4000 * Math.random ();
psp.sysRadioSetSineWaveOscillatorFrequencyAndVolume (freq)
}
function test () {
psp.sysRadioSetSineWaveOscillatorFrequencyAndVolume
(880, 80, 100, "CQ CQ CQ DE P~S~P P~S~P P~S~P PSE K ", 3);
if ( tid == 0 ) tid = setInterval ('intervalProc ()', 500);
}
See Also
// -->
</script>
<button onclick='test();'>TEST</button>
<object name="psp" type"application/x-psp-extplugin"></object>
</body></html>
sysRadioSetMasterVolume
©SCEI PSP™ Internet Radio Player Development Guide
- 64 -
Page 65
sysRadioSetWhiteNoiseOscillatorVolum
e
Set volume level of pseudo white noise oscillator
Syntax

psp.sysRadioSetWhiteNoiseOscillatorVolume (vol [, lowF [, highF [, tension ] ] ])

Arguments
vol lowF highF
tension
Volume (0vol≦255) Lower limit of generated frequencies (0lowF255; optional) Upper limit of generated frequencies (0highF255, where lowF highF; optional) Rate of frequency change (0tension255; optional)
Return Value
Always 0.
Description
This is a function for producing a "retro analog radio atmosphere."
This extended method sets parameters for the pseudo white noise oscillator such as the
noise frequency band and amplitude (size of the sound).
The noise frequency band that is generated is controlled by lowF and highF.
The rate that the frequency band changes can be assigned by using
the value of
The volume of sound that is output is determined by the product of the value set by
sysRadioSetMasterVolume and the value set by sysRadioSetWhiteNoiseOscillatorVolume.
tension
, the faster the frequency band changes.
tension
. The smaller
©SCEI PSP™ Internet Radio Player Development Guide
- 65 -
Page 66
Example
Sample
psp.sysRadioSetWhiteNoiseOscillatorVolume (80, 0, 255, 10);
This statement generates pseudo white noise.
<html><head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>sysRadioSetWhiteNoiseOscillatorVolume</title>
</head>
<body>
<h1>sysRadioSetWhiteNoiseOscillatorVolume</h1>
<script language="JavaScript">
<!--
window.onload = function () { setTimeout ('initProc ()', 500); }
©SCEI PSP™ Internet Radio Player Development Guide
- 66 -
Page 67
function initProc () {
psp.sysRadioSetMasterVolume (255);
}
var tid = 0;
function intervalProc () {
var highF = 15 + 240 * Math.random ();
psp.sysRadioSetWhiteNoiseOscillatorVolume (80, 0, highF);
}
function test () {
psp.sysRadioSetWhiteNoiseOscillatorVolume (80, 0, 255, 10);
if ( tid == 0 ) tid = setInterval ('intervalProc ()', 1000);
}
// -->
</script>
See Also
<button onclick='test();'>TEST</button>
<object name="psp" type="application/x-psp-extplugin"></object>
</body></html>
sysRadioSetMasterVolume
©SCEI PSP™ Internet Radio Player Development Guide
- 67 -
Page 68

sysRadioSetAudioShiftWidth

Set shift width of audio frequency component
Syntax
psp.sysRadioSetAudioShiftWidth (val)
Arguments
val
Shift width (-256val≦256) Note) The meaning of this numeric value is an internally defined independent entity. The units of this value are not Hz.
Return Value
Always 0.
Description
This is a simple function for producing a "retro analog radio atmosphere." The sound
quality of the playback sound is significantly degraded by this processing.
This function shifts the audio frequency spectrum after the signal that was received from
the broadcast server is decoded.
When val 0, the playback sound is monaural.
The following figure shows the original audio frequency spectrum. When
processing is performed by this method.
val
= 0, no
©SCEI PSP™ Internet Radio Player Development Guide
- 68 -
Page 69
When val > 0, the sound becomes lower. However, the lower limit of the spectrum's
frequencies is clipped near 0 Hz (DC).
When val < 0, the sound becomes higher. However, the upper limit of the spectrum's
frequencies is clipped near 22.05 kHz.
The following figure shows the order in which processing is performed for the frequency
shift (sysRadioSetAudioShiftWidth), frequency cut off (sysRadioSetAudioCutOffWidth), and
pitch conversion (sysRadioSetAudioPitchShiftWidth).
Note that you should avoid applying multiple effects at the same time since each one
creates a relatively heavy processing load.
©SCEI PSP™ Internet Radio Player Development Guide
- 69 -
Page 70
Example
Sample
psp.sysRadioSetAudioShiftWidth (50);
This statement shifts the frequency spectrum towards higher frequencies.
<html><head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>sysRadioSetAudioShiftWidth</title>
</head>
<body>
<h1>sysRadioSetAudioShiftWidth</h1>
<script language="JavaScript">
<!--
window.onload = function () { setTimeout ('initProc ()', 500); }
function initProc () {
psp.sysRadioSetMasterVolume (255);
}
©SCEI PSP™ Internet Radio Player Development Guide
- 70 -
Page 71
var tid = 0;
var s = 0;
function intervalProc () {
var shiftWidth;
if ( s ) {
s = 0 ;
shiftWidth = -50;
}
else {
s = 1 ;
shiftWidth = 15;
}
psp.sysRadioSetAudioShiftWidth (shiftWidth);
}
function test () {
psp.sysRadioPlayStream
("http://radio.psp.dl.playstation.net:80"
+"/psp/radio/sample/pseudo_stream/teststream_a.stream.mp3",
"pspRadioPlayer");
psp.sysRadioSetSubVolume (100);
if ( tid == 0 ) tid = setInterval ('intervalProc ()', 3000);
}
// -->
</script>
<button onclick='test();'>TEST</button>
<object name="psp" type="application/x-psp-extplugin"></object>
</body></html>
Note) The URL in the sample code accesses a "pseudo broadcast server" that was created to
run this sample code.
Since it is not a genuine SHOUTcast or icecast2 broadcast server, its behavior will differ
from an actual server in that playback always begins from the same timecode position
immediately after connection, for example.
©SCEI PSP™ Internet Radio Player Development Guide
- 71 -
Page 72
See Also
sysRadioSetAudioCutOffWidth, sysRadioSetAudioPitchShiftWidth
©SCEI PSP™ Internet Radio Player Development Guide
- 72 -
Page 73

sysRadioSetAudioCutOffWidth

Set cut-off width of audio frequency component
Syntax
psp.sysRadioSetAudioCutOffWidth (val)
Arguments
val
Cut-off width (-256val256) Note) The meaning of this numeric value is an internally defined independent entity. The units of this value are not Hz.
Return Value
Always 0.
Description
This is a simple function for producing a "retro analog radio atmosphere." The sound
quality of the playback sound is significantly degraded by this processing.
This function performs processing that narrows the band of the audio frequency spectrum
after the signal that was received from the broadcast server is decoded.
When val 0, the playback sound is monaural.
The following figure shows the original audio frequency spectrum. When
processing is performed by this method.
val
= 0, no
©SCEI PSP™ Internet Radio Player Development Guide
- 73 -
Page 74
When val > 0, the high area is cut off.
When val < 0, the low area is cut off.
The following figure shows the order in which processing is performed for the frequency
shift (sysRadioSetAudioShiftWidth), frequency cut off (sysRadioSetAudioCutOffWidth), and
pitch conversion (sysRadioSetAudioPitchShiftWidth).
Note that you should avoid applying multiple effects at the same time since each one
creates a relatively heavy processing load.
©SCEI PSP™ Internet Radio Player Development Guide
- 74 -
Page 75
Example
Sample
psp.sysRadioSetAudioCutOffWidth (33);
This statement cuts off the high area.
<html><head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>sysRadioSetAudioCutOffWidth</title>
</head>
<body>
<h1>sysRadioSetAudioCutOffWidth</h1>
<script language="JavaScript">
<!--
window.onload = function () { setTimeout ('initProc ()', 500); }
function initProc () {
psp.sysRadioSetMasterVolume (255);
}
var tid = 0;
var s = 0;
function intervalProc () {
var cutOffWidth;
if ( s ) {
s = 0 ;
cutOffWidth = -60;
}
else {
s = 1 ;
cutOffWidth = 33;
}
psp.sysRadioSetAudioCutOffWidth (cutOffWidth);
}
function test () {
psp.sysRadioPlayStream
("http://radio.psp.dl.playstation.net:80"
©SCEI PSP™ Internet Radio Player Development Guide
- 75 -
Page 76
+"/psp/radio/sample/pseudo_stream/teststream_a.stream.mp3",
"pspRadioPlayer");
psp.sysRadioSetSubVolume (100);
if ( tid == 0 ) tid = setInterval ('intervalProc ()', 3000);
}
// -->
</script>
<button onclick='test();'>TEST</button>
<object name="psp" type="application/x-psp-extplugin"></object>
</body></html>
Note) The URL in the sample code accesses a "pseudo broadcast server" that was created to
run this sample code.
Since it is not a genuine SHOUTcast or icecast2 broadcast server, its behavior will differ
See Also
from an actual server in that playback always begins from the same timecode position
immediately after connection, for example.
sysRadioSetAudioShiftWidth, sysRadioSetAudioPitchShiftWidth
©SCEI PSP™ Internet Radio Player Development Guide
- 76 -
Page 77

sysRadioSetAudioPitchShiftWidth

Set pitch shift width of audio frequency component
Syntax
psp.sysRadioSetAudioPitchShiftWidth (val)
Arguments
val
Pitch shift width (-256val≦256) Note) The meaning of this numeric value is an internally defined independent entity. The units of this value are not Hz.
Return Value
Always 0.
Description
This is a simple function for producing a "retro analog radio atmosphere." The sound
quality of the playback sound is significantly degraded by this processing.
This function changes the audio pitch after the signal that was received from the broadcast
server is decoded.
When val 0, the playback sound is monaural.
The following figure shows the original audio frequency spectrum. When
processing is performed by this method.
val
= 0, no
©SCEI PSP™ Internet Radio Player Development Guide
- 77 -
Page 78
When val > 0, the sound becomes higher. However, the upper limit of the spectrum's
frequencies is clipped near 22.05 kHz.
When val < 0, the sound becomes lower.
The following figure shows the order in which processing is performed for the frequency
shift (sysRadioSetAudioShiftWidth), frequency cut off (sysRadioSetAudioCutOffWidth), and
pitch conversion (sysRadioSetAudioPitchShiftWidth).
Note that you should avoid applying multiple effects at the same time since each one
creates a relatively heavy processing load.
©SCEI PSP™ Internet Radio Player Development Guide
- 78 -
Page 79
Example
Sample
psp.sysRadioSetAudioPitchShiftWidth (50);
This statement shifts the frequency spectrum towards higher frequencies.
<html><head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>sysRadioSetAudioPitchShiftWidth</title>
</head>
<body>
<h1>sysRadioSetAudioPitchShiftWidth</h1>
<script language="JavaScript">
<!--
window.onload = function () { setTimeout ('initProc ()', 500); }
function initProc () {
psp.sysRadioSetMasterVolume (255);
}
var tid = 0;
©SCEI PSP™ Internet Radio Player Development Guide
- 79 -
Page 80
var s = 0;
function intervalProc () {
var pitchShiftWidth;
if ( s ) {
s = 0 ;
pitchShiftWidth = -20;
}
else {
s = 1 ;
pitchShiftWidth = 20;
}
psp.sysRadioSetAudioPitchShiftWidth (pitchShiftWidth);
}
function test () {
psp.sysRadioPlayStream
("http://radio.psp.dl.playstation.net:80"
+"/psp/radio/sample/pseudo_stream/teststream_a.stream.mp3",
"pspRadioPlayer");
psp.sysRadioSetSubVolume (100);
if ( tid == 0 ) tid = setInterval ('intervalProc ()', 3000);
}
// -->
</script>
<button onclick='test();'>TEST</button>
<object name="psp" type="application/x-psp-extplugin"></object>
</body></html>
Note) The URL in the sample code accesses a "pseudo broadcast server" that was created to
run this sample code.
Since it is not a genuine SHOUTcast or icecast2 broadcast server, its behavior will differ
from an actual server in that playback always begins from the same timecode position
immediately after connection, for example.
See Also
sysRadioSetAudioShiftWidth, sysRadioSetAudioCutOffWidth
©SCEI PSP™ Internet Radio Player Development Guide
- 80 -
Page 81

sysRadioPlayEffectSound

Syntax
psp.sysRadioPlayEffectSound ()
Arguments
None.
Play sound effect
Return Value
Always 0.
Description
This extended method plays a clicking sound (like a shutter sound).
Although the current system software version has only this one type of sound, the number
of sound variations is expected to increase in future versions.
©SCEI PSP™ Internet Radio Player Development Guide
- 81 -
Page 82
Example
Sample
psp.sysRadioPlayEffectSound ();
This statement plays a sound effect.
<html><head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>sysRadioPlayEffectSound</title>
</head>
<body>
<h1>sysRadioPlayEffectSound</h1>
<script language="JavaScript">
<!--
function test () {
psp.sysRadioPlayEffectSound ();
©SCEI PSP™ Internet Radio Player Development Guide
- 82 -
Page 83
See Also
}
// -->
</script>
<button onclick='test();'>TEST</button>
<object name="psp" type="application/x-psp-extplugin"></object>
</body></html>
None.
©SCEI PSP™ Internet Radio Player Development Guide
- 83 -
Page 84

sysRadioPrepareForHttpGet

Make preparations for performing HTTP GET for specified URL
Syntax
result = psp.sysRadioPrepareForHttpGet
(url [, userAgentName [, length [, charCodeConvertOption ] ] ] )
Arguments
url userAgentName
length
charCodeConvertOption
Target URL User agent name (optional) Note) If this is omitted, the default value is "Mozilla/4.0 (PSP (PlayStation Portable); 2.00)." Maximum size Note) The maximum value of 49152 cannot be exceeded. If the specification is omitted, the default value will be used for the maximum value. Character code conversion specification identifier 0: No conversion processing 1: Treated as SJIS (CP932) and converted to UTF-8. 2: Treated as EUC-KR (CP949) and converted to UTF-8.
Return Value
0 Normal
-1 Error
Description
This extended method is used for making preparations to access
GET operation and run GET processing in the background.
The background processing status can be detected by using the sysRadioGetHttpGetStatus
method.
Multiple HTTP GET operations cannot be run at the same time. If a new
sysRadioPrepareForHttpGet method is called when HTTP GET processing is not completed,
the previous HTTP GET processing is canceled.
©SCEI PSP™ Internet Radio Player Development Guide
- 84 -
url
to perform an HTTP
Page 85
If there is no free space in the JavaScript extended method processing queue, -1 is returned.
At this time, the processing request is ignored (discarded). As long as method calls of types
that are queued are not continuously issued (such as in an endless loop), this state does not
normally occur.
The following methods are types that are queued.
Method Names of Types That
Overview are Queued
sysRadioPlayStream Starts playback by specifying URL of audio data stream sysRadioPlayPls Starts playback by specifying URL of PLS file sysRadioPlayM3u Starts playback by specifying URL of M3U file sysRadioPrepareForHttpGet Prepares for performing HTTP GET for specified URL sysRadioCaptureScreenShot Captures screenshot
When the related sysRadioGetHttpGetStatus method returns 1, it means that GET
Example
processing is still in progress and when it returns 0, it means that GET processing finished.
The GET result can be obtained by invoking the sysRadioGetHttpGetResult method.
To release resources that were allocated by internal processing when a sequence of
processing operations is finished, call the sysRadioHttpGetTerminate method.
It is assumed that the target data of the HTTP GET operation is a text string and that the
character encoding of this text string is SJIS. The charCodeConvertOption option is
provided for converting the character code to UTF-8. This option also supports EUC-KR
character encoding. The current version does not support any text encoding other than SJIS
or EUC-KR.
var result = psp.sysRadioPrepareForHttpGet
("http://radio.psp.dl.playstation.net"
+"/psp/radio/sample/pseudo_stream/testdata0.txt");
This statement makes preparations for performing an HTTP GET operation for
"http://radio.psp.dl.playstation.net/psp/radio/sample/pseudo_stream/testdata0.txt" and
begins processing in the background.
©SCEI PSP™ Internet Radio Player Development Guide
- 85 -
Page 86
Sample
<html><head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>sysRadioPrepareForHttpGet</title>
</head>
<body>
<h1>sysRadioPrepareForHttpGet</h1>
<script language="JavaScript">
<!--
var tid = 0;
function timeoutProc () {
clearTimeout (tid);
tid = 0;
var status = psp.sysRadioGetHttpGetStatus ();
switch ( status ) {
case 0:
var result = psp.sysRadioGetHttpGetResult ();
psp.sysRadioHttpGetTerminate ();
alert ("result=" + result);
break;
case 1:
tid = setTimeout ('timeoutProc ()', 500);
break;
default: // error
psp.sysRadioHttpGetTerminate ();
break;
}
}
function test () {
psp.sysRadioPrepareForHttpGet
("http://radio.psp.dl.playstation.net"
+"/psp/radio/sample/pseudo_stream/testdata0.txt");
if (tid == 0 ) tid = setTimeout ('timeoutProc ()', 500);
}
// -->
</script>
©SCEI PSP™ Internet Radio Player Development Guide
- 86 -
Page 87
See Also
<button onclick='test();'>TEST</button>
<object name="psp" type="application/x-psp-extplugin"></object>
</body></html>
sysRadioGetHttpGetStatus, sysRadioGetHttpGetResult, sysRadioHttpGetTerminate,
sysRadioPlayStream, sysRadioPlayPls, sysRadioPlayM3u,
sysRadioCaptureScreenShot
©SCEI PSP™ Internet Radio Player Development Guide
- 87 -
Page 88

sysRadioGetHttpGetStatus

Get status of sysRadioPrepareForHttpGet processing
Syntax
result = psp.sysRadioGetHttpGetStatus ()
Arguments
None.
Return Value
0 HTTP GET processing is completed. 1 HTTP GET processing is in progress.
-1 HTTP GET processing failed.
Description
This extended method gets the status of HTTP GET processing that was started by
sysRadioPrepareForHttpGet.
Since multiple HTTP GET operations cannot be run at the same time, use this
sysRadioGetHttpGetStatus method to monitor the processing status to detect that
processing is completed.
Since processing may fail, you also need to provide suitable error processing as necessary.
This extended method is not implemented with an event-style mechanism (like the
generation of a callback when a sequence of HTTP GET processing operations is finished).
Therefore, the implementation requires that the sysRadioGetHttpGetStatus method be
called (polled) at appropriate time intervals to check the status.
Example
var status = psp.sysRadioGetHttpGetStatus ();
This statement gets the status of background HTTP GET processing and sets it in the
©SCEI PSP™ Internet Radio Player Development Guide
- 88 -
Page 89
Sample
variable status.
<html><head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>sysRadioGetHttpGetStatus</title>
</head>
<body>
<h1>sysRadioGetHttpGetStatus</h1>
<script language="JavaScript">
<!--
window.onload = function () { setTimeout ('initProc ()', 500); }
function initProc () {
psp.sysRadioSetDebugMode (1);
psp.sysRadioSetDebugLogTextStyle
(224,224,224,255, 255,255,255,255, 30,30,40,96, 1, 2);
}
var tid = 0;
function timeoutProc () {
clearTimeout (tid);
tid = 0;
var status = psp.sysRadioGetHttpGetStatus ();
psp.sysRadioDebugLog ("status=" + status + "\n");
switch ( status ) {
case 0:
var result = psp.sysRadioGetHttpGetResult ();
psp.sysRadioHttpGetTerminate ();
psp.sysRadioDebugLog ("result=" + result + "\n");
break;
case 1:
tid = setTimeout ('timeoutProc ()', 500);
break;
default: // error
psp.sysRadioHttpGetTerminate ();
break;
}
©SCEI PSP™ Internet Radio Player Development Guide
- 89 -
Page 90
}
function test () {
psp.sysRadioPrepareForHttpGet
("http://radio.psp.dl.playstation.net"
+"/psp/radio/sample/pseudo_stream/testdata0.txt");
if (tid == 0 ) tid = setTimeout ('timeoutProc ()', 10);
}
// -->
</script>
<button onclick='test();'>TEST</button>
<object name="psp" type="application/x-psp-extplugin"></object>
</body></html>
See Also
sysRadioPrepareForHttpGet, sysRadioGetHttpGetResult, sysRadioHttpGetTerminate,
sysRadioPlayStream, sysRadioPlayPls, sysRadioPlayM3u,
sysRadioCaptureScreenShot
©SCEI PSP™ Internet Radio Player Development Guide
- 90 -
Page 91

sysRadioGetHttpGetResult

Get sysRadioPrepareForHttpGet processing result as string
Syntax
result = psp.sysRadioGetHttpGetResult ()
Arguments
None.
Return Value
The HTTP GET processing result (string) is returned.
Description
This extended method gets a string indicating the result of HTTP GET processing, which
was started by sysRadioPrepareForHttpGet.
If the character code conversion option had been specified by the option
charCodeConvertOption of sysRadioPrepareForHttpGet, this extended method will get the
character code-converted string.
This extended method is not implemented with an event-style mechanism (like the
generation of a callback when a sequence of HTTP GET processing operations is finished).
Therefore, the implementation requires that the sysRadioGetHttpGetStatus method be
called (polled) at appropriate time intervals to check the status and the
sysRadioGetHttpGetResult method be called when processing is completed.
Example
var result = psp.sysRadioGetHttpGetResult ();
©SCEI PSP™ Internet Radio Player Development Guide
- 91 -
Page 92
Sample
This statement gets the result of background HTTP GET processing as a string and sets it
in the variable result.
<html><head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>sysRadioGetHttpGetResult</title>
</head>
<body>
<h1>sysRadioGetHttpGetResult</h1>
<script language="JavaScript">
<!--
var tid = 0;
function timeoutProc () {
clearTimeout (tid);
tid = 0;
var status = psp.sysRadioGetHttpGetStatus ();
switch ( status ) {
case 0:
var result = psp.sysRadioGetHttpGetResult ();
psp.sysRadioHttpGetTerminate ();
alert ("result=" + result);
break;
case 1:
tid = setTimeout ('timeoutProc ()', 500);
break;
default: // error
psp.sysRadioHttpGetTerminate ();
break;
}
}
function test () {
psp.sysRadioPrepareForHttpGet
("http://radio.psp.dl.playstation.net"
+"/psp/radio/sample/pseudo_stream/testdata0.txt");
©SCEI PSP™ Internet Radio Player Development Guide
- 92 -
Page 93
See Also
if (tid == 0 ) tid = setTimeout ('timeoutProc ()', 500);
}
// -->
</script>
<button onclick='test();'>TEST</button>
<object name="psp" type="application/x-psp-extplugin"></object>
</body></html>
sysRadioPrepareForHttpGet, sysRadioPrepareForHttpGet, sysRadioHttpGetTerminate,
sysRadioPlayStream, sysRadioPlayPls, sysRadioPlayM3u,
sysRadioCaptureScreenShot
©SCEI PSP™ Internet Radio Player Development Guide
- 93 -
Page 94

sysRadioHttpGetTerminate

Perform sysRadioPrepareForHttpGet housekeeping
Syntax
psp.sysRadioHttpGetTerminate ()
Arguments
None.
Return Value
None.
Description
This extended method completes HTTP GET processing, which was started by
sysRadioPrepareForHttpGet.
To release resources that were allocated by internal processing after a sequence of
operations that began with sysRadioPrepareForHttpGet is finished (after the result was
obtained by sysRadioGetHttpGetResult), call the sysRadioHttpGetTerminate method to
complete the processing.
Example
psp.sysRadioHttpGetTerminate ();
This statement completes background HTTP GET processing, and releases internal
resources.
Sample
<html><head>
©SCEI PSP™ Internet Radio Player Development Guide
- 94 -
Page 95
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>sysRadioHttpGetTerminate</title>
</head>
<body>
<h1>sysRadioHttpGetTerminate</h1>
<script language="JavaScript">
<!--
var tid = 0;
function timeoutProc () {
clearTimeout (tid);
tid = 0;
var status = psp.sysRadioGetHttpGetStatus ();
switch ( status ) {
case 0:
var result = psp.sysRadioGetHttpGetResult ();
psp.sysRadioHttpGetTerminate ();
alert ("result = " + result);
break;
case 1:
tid = setTimeout ('timeoutProc ()', 500);
break;
default: // error
psp.sysRadioHttpGetTerminate ();
break;
}
}
function test () {
psp.sysRadioPrepareForHttpGet
("http://radio.psp.dl.playstation.net"
+"/psp/radio/sample/pseudo_stream/testdata0.txt");
if (tid == 0 ) tid = setTimeout ('timeoutProc ()', 500);
}
// -->
</script>
<button onclick='test();'>TEST</button>
<object name="psp" type="application/x-psp-extplugin"></object>
</body></html>
©SCEI PSP™ Internet Radio Player Development Guide
- 95 -
Page 96
See Also
sysRadioPrepareForHttpGet, sysRadioGetHttpGetStatus, sysRadioGetHttpGetResult,
sysRadioPlayStream, sysRadioPlayPls, sysRadioPlayM3u,
sysRadioCaptureScreenShot
©SCEI PSP™ Internet Radio Player Development Guide
- 96 -
Page 97

sysRadioGetPlayerStatus

Get internal status of player system
Syntax
result = psp.sysRadioGetPlayerStatus ()
Arguments
None.
Return Value
0 No processing is being performed. 1 Audio data stream is being played. 2 PLS or M3U data is being obtained. 3 PLS or M3U data is being parsed. 4 Connecting to the broadcast server.
-1 Some kind of error occurred.
Description
This extended method gets the internal status of the PSP™ Internet radio player core
system while an audio stream is being received.
The value returned by this method can be used to switch the GUI display to display the
radio status for the user, to reconnect when an error occurs during internal processing of
the Internet radio player, or to attempt to connect to a different broadcast station.
The PSP™ Internet radio system has a processing structure that performs low-level
automatic error recovery and reconnection processing. Part of the operation status of this
processing is reflected in the return value of sysRadioGetPlayerStatus.
Example
var status = psp.sysRadioGetPlayerStatus ();
©SCEI PSP™ Internet Radio Player Development Guide
- 97 -
Page 98
Sample
This statement gets the internal status of the player system and sets it in the variable
status.
<html><head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>sysRadioGetPlayerStatus</title>
</head>
<body>
<h1>sysRadioGetPlayerStatus</h1>
<script language="JavaScript">
<!--
window.onload = function () { setTimeout ('initProc ()', 500); }
function initProc () {
psp.sysRadioSetDebugMode (1);
psp.sysRadioSetDebugLogTextStyle
(224,224,224,255, 255,255,255,255, 30,30,40,96, 1, 2);
psp.sysRadioSetMasterVolume (255);
}
var tid = 0;
function intervalProc () {
var status = psp.sysRadioGetPlayerStatus ();
psp.sysRadioDebugLog ("status=" + status + "\n");
}
function test () {
psp.sysRadioPlayPls
("http://radio.psp.dl.playstation.net"
+"/psp/radio/sample/pseudo_stream/teststream0.pls",
"pspRadioPlayer",
"pspRadioPlayer");
psp.sysRadioSetSubVolume (255);
if ( tid == 0 ) tid = setInterval ('intervalProc ()', 250);
}
// -->
</script>
<button onclick='test();'>TEST</button>
©SCEI PSP™ Internet Radio Player Development Guide
- 98 -
Page 99
See Also
<object name="psp" type="application/x-psp-extplugin"></object>
</body></html>
sysRadioPlayStream, sysRadioPlayPls, sysRadioPlayM3u, sysRadioStop
©SCEI PSP™ Internet Radio Player Development Guide
- 99 -
Page 100

sysRadioGetNetworkBandQuality

Get communication circuit band quality evaluation value
Syntax
result = psp.sysRadioGetNetworkBandQuality ()
Arguments
None.
Return Value
An integer value in the range 0result255 is returned.
Description
This extended method returns an integer value that is 255 times the ratio of the measured
value or, more specifically, the measured band of the network's transmission quality and
the assumed band.
Generally, if the Internet radio audio data stream fills the assumed band on average, its
playback sound will not be interrupted. However, if the transmission band becomes
narrower as the accumulated data in the internal buffer runs out, intermittent sound may
occur even if the bandwidth had been filled on average.
The value returned by sysRadioGetNetworkBandQuality is an indicator of the status in
which this intermittent sound occurs.
Normally, the status of the broadcast server and status of the network channel are
influenced by similar factors, and fluctuations occur in the actual transmission band. As a
result, there are also moments when the band is wider than the assumed band.
Even when the band had been wider than the assumed band, the comparison of the
measured band and assumed band is returned as a value that is clipped by a value
corresponding to the upper limit 1.0 or, in other words, clipped by 255.
©SCEI PSP™ Internet Radio Player Development Guide
- 100 -
Loading...