Difference between revisions of "User:Scanff/Libwiiradio"

From WiiBrew
Jump to: navigation, search
(Quickstart)
Line 102: Line 102:
  
 
</source>
 
</source>
 +
 +
== Linking ==
 +
 +
An example of linking Libwiiradio in your make file.
 +
 +
LIBS := -lwiiradio -lmad -lasnd -lbte -logc -lm
 +
  
 
== Bugs & Suggestions ==
 
== Bugs & Suggestions ==
Soon
+
Please report to the main WiiRadio repository - http://code.google.com/p/wiiradio/issues/list
  
 
== Update History ==
 
== Update History ==
 
=== 1.00 - Coming very soon ===
 
=== 1.00 - Coming very soon ===
 
* Initial release
 
* Initial release

Revision as of 05:00, 16 February 2010

libwiiradio
Wiiradio img.png
General
Author(s)Scanff
TypeLibrary
Version1.00

Libwiiradio is a simple and easy to implement library you can add to your game or homebrew app that gives you the ability to playback internet radio.


Quickstart

There is an example of how to use LibWiiRadio included in the download.

Here's a list of the functions.

// play a stream
int LWR_Play(char*);

// stop playback
int LWR_Stop();

// return the current URL
char* LWR_GetUrl();

// return what's playing
char* LWR_GetCurrentTrack();

// return bitrate
int LWR_GetCurrentBitRate();

// return the volume
int LWR_GetVolume();

// set the volume
void LWR_SetVolume(int);



Here's a quick example.

char* tests[] = {   "http://205.188.215.225:8002",
                    "http://scfire-dtc-aa07.stream.aol.com:80/stream/1040",
                    "http://208.76.152.74:8000"
				};



int test_lib()
{
    printf("\n\n\n\nTest libWiiRadio, will test three streams!\n");

    for(int i = 0; i < 3;i++)
    {
        printf("Connecting to %s\n", tests[i]);


	LWR_SetVolume(40*(i+1));
        printf("setting volume %d\n", 40*(i+1));
		

        if(LWR_Play(tests[i]) < 0)
        {
            printf("ERROR!\n");
            LWR_Stop();
			continue;
        }

        usleep(2000000); // wait till the info is grabbed

        char *title = LWR_GetCurrentTrack();
        if (title) printf("current track = %s\n", title);

        int br = LWR_GetCurrentBitRate();
        if (br != -1) printf("current bitrate = %d\n", br);
		
	char* url = LWR_GetUrl();
	if (url) printf("current url = %s\n", url);
		
	int vol = LWR_GetVolume();
        if (vol != -1) printf("current volume = %d\n", vol);
		
        
	usleep(30000000); // play for a while
		

	printf("Stop Playback!\n");

        LWR_Stop();
    }

    printf("Test Done!\n");

    return 0;
}

Linking

An example of linking Libwiiradio in your make file.

LIBS := -lwiiradio -lmad -lasnd -lbte -logc -lm


Bugs & Suggestions

Please report to the main WiiRadio repository - http://code.google.com/p/wiiradio/issues/list

Update History

1.00 - Coming very soon

  • Initial release