Code: Select all
#include <pspkernel.h>
#include <pspctrl.h>
#include <psphprm.h>
#include <pspdebug.h>
#include <pspaudio.h>
#include <pspaudiolib.h>
#include <psppower.h>
#include <time.h>
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <pspsdk.h>
#include "opendir.h"
#include "id3.h"
#include "oggplayer.h"
#include "pspaudiolib.h"
#include "player.h"
//Colori:
#define RGB(r, g, b) ((b << 16) | (g << 8) | r)
#define YELLOW RGB(255, 2550, 0)
#define BLACK RGB(0, 0, 0)
#define WHITE RGB(255, 255, 255)
#define RED RGB(255, 0, 0)
#define DEEPSKYBLUE RGB(0, 178, 238)
;
PSP_MODULE_INFO("OGG Sample", 0, 1, 0);
PSP_MAIN_THREAD_ATTR(THREAD_ATTR_USER);
PSP_HEAP_SIZE_KB(21000);
#define mp3_directory_1 "ms0:/MUSIC"
#define mp3_directory_2 "ms0:/PSP/MUSIC"
/*void sceDisplay_driver_9E3C6DC6(int a0,int a1);//a0 0-100,a1 = 0/1 (set to 0)
#define sceDisplaySetBrightness sceDisplay_driver_9E3C6DC6
void sceDisplay_driver_31C4BAA8(int *a0,int *a1);
#define sceDisplayGetBrightness sceDisplay_driver_31C4BAA8*/
char version[10] = "1.0.0";
int oldBrightness = 0;
// TWILIGHT ZONE!
/* Exit callback */
int exit_callback(int arg1, int arg2, void *common) {
sceKernelExitGame();
return 0;
}
/* Callback thread */
int CallbackThread(SceSize args, void *argp) {
int cbid;
cbid = sceKernelCreateCallback("Exit Callback", exit_callback, NULL);
sceKernelRegisterExitCallback(cbid);
sceKernelSleepThreadCB();
return 0;
}
/* Sets up the callback thread and returns its thread id */
int SetupCallbacks(void) {
int thid = 0;
thid = sceKernelCreateThread("update_thread", CallbackThread, 0x11, 0xFA0, 0, 0);
if(thid >= 0) {
sceKernelStartThread(thid, 0, 0);
}
return thid;
}
// END OF TWILIGHT ZONE!
//Memoria libera totale:
typedef struct
{
void *buffer;
void *next;
} _LINK;
int freemem()
{
int size = 4096, total = 0;
_LINK *first = NULL, *current = NULL, *lnk;
while (1)
{
lnk = (_LINK*)malloc(sizeof(_LINK));
if (!lnk)
break;
total += sizeof(_LINK);
lnk->buffer = malloc(size);
if (!lnk->buffer)
{
free(lnk);
break;
}
total += size;
lnk->next = NULL;
if (current)
{
current->next = (void*)lnk;
current = lnk;
}
else
{
current = first = lnk;
}
}
lnk = first;
while (lnk)
{
free(lnk->buffer);
current = lnk->next;
free(lnk);
lnk = current;
}
return total;
}
//Ordinamento dei file di una directory:
void sortDirectory(struct opendir_struct directory)
{
int n = directory.number_of_directory_entries;
int i = 0;
while (i < n) {
if (i == 0 || strcmp(directory.directory_entry[i-1].d_name, directory.directory_entry[i].d_name) <= 0) i++;
else {SceIoDirent tmp = directory.directory_entry[i]; directory.directory_entry[i] = directory.directory_entry[i-1]; directory.directory_entry[--i] = tmp;}
}
}
//Prendo solo il nome del file:
void getFileName(char *fileName, char *onlyName){
int slash = -1;
int retCount;
strcpy(onlyName, fileName);
//Cerco l'ultimo slash:
int i = 0;
for (i = strlen(fileName) - 1; i >= 0; i--){
if ((fileName[i] == '/') & (i != strlen(fileName))){
slash = i;
break;
}
}
if (slash){
retCount = 0;
for (i = slash + 1; i < strlen(fileName); i++){
onlyName[retCount] = fileName[i];
retCount++;
}
onlyName[retCount] = '\0';
}
}
//Calcolo livello superiore:
void directoryUp(char *dirName)
{
if (dirName != "ms0:/"){
//Cerco l'ultimo slash:
int i = 0;
for (i = strlen(dirName) - 1; i >= 0; i--){
if ((dirName[i] == '/') & (i != strlen(dirName))){
if (i > 4){
dirName[i] = '\0';
}else{
dirName[i+1] = '\0';
}
break;
}
}
}
return;
}
//Spezzo autore e titolo nel nome di una directory:
void rtrim(char *toTrim)
{
int i = 0;
for (i = strlen(toTrim) - 1; i >= 0; i--){
if (isspace(toTrim[i])){
toTrim[i] = '\0';
}else{
break;
}
}
}
int splitAuthorTitle(char *dirName, char *author, char *title)
{
if (strstr(dirName, "-") != 0){
int i = 0;
int posSep = -1;
int countAuthor = 0;
int countTitle = 0;
for (i = 0; i < strlen(dirName); i++){
if (dirName[i] == '-'){
posSep = i;
}
else if (posSep == -1){
if ((countAuthor != 0) | (dirName[i] != ' ')){
author[countAuthor] = dirName[i];
countAuthor++;
}
}else{
if ((countTitle != 0) | (dirName[i] != ' ')){
title[countTitle] = dirName[i];
countTitle++;
}
}
author[countAuthor] = '\0';
title[countTitle] = '\0';
}
rtrim(author);
rtrim(title);
return(1);
}
return(0);
}
//Costruisco la barra della percentuale:
void buildProgressBar(char *pBar, int percentage){
int i;
pBar[0] = '[';
for (i = 1; i < 22; i++){
if (percentage >= (i-1) * 5){
pBar[i] = '*';
}else{
pBar[i] = ' ';
}
}
pBar[21] = ']';
pBar[22] = '\0';
}
// Inizializzazione schermo:
void screen_sysinfo()
{
pspDebugScreenSetTextColor(0xeeff00);
printf("¡OGG SAMPLE");
if (scePowerIsBatteryExist()) {
int batteryLifeTime = scePowerGetBatteryLifeTime();
printf("\n Battery: %d%% (%02dh%02dm)", scePowerGetBatteryLifePercent(), batteryLifeTime/60, batteryLifeTime-(batteryLifeTime/60*60));
}
}
void screen_init()
{
if (scePowerIsBatteryExist()) {
int batteryLifeTime = scePowerGetBatteryLifeTime();
printf("\n Battery: %d%% (%02dh%02dm)", scePowerGetBatteryLifePercent(), batteryLifeTime/60, batteryLifeTime-(batteryLifeTime/60*60));
pspDebugScreenSetTextColor(WHITE);
pspDebugScreenSetBackColor(BLACK);
pspDebugScreenInit();
pspDebugScreenSetTextColor(WHITE);
pspDebugScreenSetBackColor(BLACK);
pspDebugScreenSetXY(0, 1);
pspDebugScreenPrintf("OGG SAMPLE");
pspDebugScreenSetXY(0, 33);
}
}
//Schermo per menu
void screen_menu_init()
{
pspDebugScreenSetTextColor(WHITE);
pspDebugScreenSetXY(0, 27);
pspDebugScreenPrintf("Press X to enter directory/play file");
pspDebugScreenPrintf("\n");
pspDebugScreenPrintf("Press SQUARE to play directory");
pspDebugScreenPrintf("\n");
pspDebugScreenPrintf("Press O to go up one level");
pspDebugScreenPrintf("\n");
pspDebugScreenPrintf("Press TRIANGLE to exit");
}
//Schermo per player
void screen_player_init(char *filename, struct ID3Tag ID3, int nextPrevious, char *numbers)
{
char file[256];
pspDebugScreenSetTextColor(WHITE);
pspDebugScreenSetBackColor(BLACK);
if (nextPrevious == 1){
pspDebugScreenSetXY(0, 7);
pspDebugScreenPrintf("File Number: %s", numbers);
}
pspDebugScreenSetXY(0, 8);
getFileName(filename, file);
pspDebugScreenPrintf("File Name : %s", file);
pspDebugScreenPrintf("\n");
pspDebugScreenPrintf("Time :");
pspDebugScreenSetTextColor(YELLOW);
pspDebugScreenSetXY(0, 11);
pspDebugScreenPrintf("Album : %s", ID3.ID3Album);
pspDebugScreenPrintf("\n");
pspDebugScreenPrintf("Title : %s", ID3.ID3Title);
pspDebugScreenPrintf("\n");
pspDebugScreenPrintf("Artist : %s", ID3.ID3Artist);
pspDebugScreenPrintf("\n");
pspDebugScreenPrintf("Year : %s", ID3.ID3Year);
pspDebugScreenPrintf("\n");
pspDebugScreenPrintf("Genre : %s", ID3.ID3GenreText);
pspDebugScreenSetTextColor(DEEPSKYBLUE);
pspDebugScreenSetXY(0, 16);
pspDebugScreenPrintf("Layer :");
pspDebugScreenPrintf("\n");
pspDebugScreenPrintf("Bitrate :");
pspDebugScreenPrintf("\n");
pspDebugScreenPrintf("Sample rate:");
pspDebugScreenPrintf("\n");
pspDebugScreenPrintf("Mode :");
pspDebugScreenPrintf("\n");
pspDebugScreenPrintf("Emphasis :");
pspDebugScreenSetTextColor(WHITE);
pspDebugScreenSetXY(0, 27);
pspDebugScreenPrintf("Press X to pause");
pspDebugScreenPrintf("\n");
pspDebugScreenPrintf("Press O to stop");
if (nextPrevious == 1)
{
pspDebugScreenPrintf("\n");
pspDebugScreenPrintf("Press L/R to change song");
}
pspDebugScreenPrintf("\n");
pspDebugScreenPrintf("Press UP/DOWN to change cpu clock");
pspDebugScreenPrintf("\n");
pspDebugScreenPrintf("Press LEFT/RIGHT to change bus clock");
pspDebugScreenPrintf("\n");
pspDebugScreenPrintf("Press SELECT toggle mute");
}
void screen_fileinfo(struct fileInfo info){
pspDebugScreenSetXY(0, 16);
pspDebugScreenSetTextColor(DEEPSKYBLUE);
pspDebugScreenPrintf("Layer : %s", info.layer);
pspDebugScreenPrintf("\n");
pspDebugScreenPrintf("Bitrate : %i [%3.3i] kbit", info.kbit, info.kbit);
pspDebugScreenPrintf("\n");
pspDebugScreenPrintf("Sample rate: %li Hz", info.hz);
pspDebugScreenPrintf("\n");
pspDebugScreenPrintf("Mode : %s", info.mode);
pspDebugScreenPrintf("\n");
pspDebugScreenPrintf("Emphasis : %s", info.emphasis);
}
//Play OGG file:
int play(char *filename, int nextPrevious, char *numbers)
{
/* Play a single file.
Returns 1 if user pressed NEXT
0 if song ended
-1 if user pressed PREVIOUS
2 if user pressed STOP
*/
u32 remoteButtons;
int retVal = 0;
SceCtrlData pad;
int clock;
int bus;
struct fileInfo info;
int action = 0; //-1=pause 0=stop 1=playing
char timestring[20];
int updateInfo = 0;
struct ID3Tag ID3;
int brightness = 0;
char pBar[22];
int muted = 0;
info.kbit = 0;
info.hz = 0;
clock = scePowerGetCpuClockFrequency();
bus = scePowerGetBusClockFrequency();
//Leggo le informazioni ID3:
ID3 = ParseID3(filename);
screen_init();
screen_player_init(filename, ID3, nextPrevious, numbers);
OGG_Init(1);
pspAudioSetVolume(1, 0x8000, 0x8000);
pspDebugScreenSetXY(0, 21);
pspDebugScreenPrintf("Opening...");
//Apro il file:
OGG_Load(filename);
screen_fileinfo(info);
OGG_Play();
action = 1;
while(1){
//Aggiorno info a video:
if (updateInfo == 0){
screen_sysinfo();
OGG_GetTimeString(timestring);
pspDebugScreenSetTextColor(WHITE);
pspDebugScreenSetBackColor(BLACK);
pspDebugScreenSetXY(0, 9);
pspDebugScreenPrintf("Time : %s / %s", timestring, info.strLength);
buildProgressBar(pBar, OGG_GetPercentace());
pspDebugScreenSetXY(13, 10);
pspDebugScreenPrintf(pBar);
//Testo dell'azione corrente:
pspDebugScreenSetXY(0, 21);
if (action == 1){
pspDebugScreenPrintf("Playing...");
}else if (action == -1){
pspDebugScreenPrintf("Paused ");
}
//Testo mute:
pspDebugScreenSetXY(0, 22);
if (muted == 1){
pspDebugScreenSetTextColor(RED);
pspDebugScreenPrintf("Mute ON");
} else {
pspDebugScreenPrintf(" ");
}
}
updateInfo++;
if (updateInfo == 10){
updateInfo = 0;
}
sceCtrlReadBufferPositive(&pad, 1);
sceHprmPeekCurrentKey(&remoteButtons);
if(pad.Buttons & PSP_CTRL_CIRCLE) {
OGG_End();
action = 0;
retVal = 2;
break;
} else if((pad.Buttons & PSP_CTRL_CROSS) | (remoteButtons & PSP_HPRM_PLAYPAUSE)) {
OGG_Pause();
if (action != -1){
action = -1;
}else{
action = 1;
}
updateInfo = 0;
sceKernelDelayThread(400000);
} else if((pad.Buttons & PSP_CTRL_DOWN) | (pad.Ly > 158)) {
if (clock > 33){
clock--;
scePowerSetCpuClockFrequency(clock);
screen_sysinfo();
sceKernelDelayThread(100000);
}
} else if((pad.Buttons & PSP_CTRL_UP) | (pad.Ly < 98)) {
if (clock < 333){
clock++;
scePowerSetCpuClockFrequency(clock);
screen_sysinfo();
sceKernelDelayThread(100000);
}
} else if((pad.Buttons & PSP_CTRL_LEFT) | (pad.Lx < 98)) {
if (bus > 54){
bus--;
scePowerSetBusClockFrequency(bus);
screen_sysinfo();
sceKernelDelayThread(100000);
}
} else if((pad.Buttons & PSP_CTRL_RIGHT) | (pad.Lx > 158)) {
if (clock < 166){
bus++;
scePowerSetBusClockFrequency(bus);
screen_sysinfo();
sceKernelDelayThread(100000);
}
} else if(pad.Buttons & PSP_CTRL_LTRIGGER || remoteButtons & PSP_HPRM_BACK) {
if (nextPrevious == 1){
OGG_End();
retVal = -1;
break;
}
} else if(pad.Buttons & PSP_CTRL_RTRIGGER || remoteButtons & PSP_HPRM_FORWARD) {
if (nextPrevious == 1){
OGG_End();
retVal = 1;
break;
} else if(pad.Buttons & PSP_CTRL_START) {
//sceDisplayGetBrightness(&brightness, 0);
if (brightness != 0){
//Spengo il display:
oldBrightness = brightness;
//sceDisplaySetBrightness(0, 0);
} else {
//Accendo il display:
//sceDisplaySetBrightness(oldBrightness, 0);
}
sceKernelDelayThread(100000);
} else if(pad.Buttons & PSP_CTRL_SELECT) {
//Mute solo se sono in play:
if (action == 1){
if (muted == 0){
pspAudioSetVolume(1, 0x1600, 0x1600);
muted = 1;
}else{
pspAudioSetVolume(1, 0x8000, 0x8000);
muted = 0;
}
updateInfo = 0;
sceKernelDelayThread(400000);
}
}
//Controllo se l'mp3 è finito:
if (OGG_EndOfStream() == 1) {
OGG_End();
retVal = 0;
break;
}
}
return(retVal);
}
}
//Play directory:
void playDirectory(char *dirName){
struct opendir_struct dirToPlay;
char *result = opendir_open(&dirToPlay, dirName);
sortDirectory(dirToPlay);
char testo[10];
char fileToPlay[256];
if (result == 0){
int playerReturn = 0;
int i = 0;
while (1){
snprintf(testo, sizeof(testo), "%i/%i", i + 1, dirToPlay.number_of_directory_entries);
strcpy(fileToPlay, dirName);
if (dirName[strlen(dirName)-1] != '/'){
strcat(fileToPlay, "/");
}
strcat(fileToPlay, dirToPlay.directory_entry[i].d_name);
playerReturn = play(fileToPlay, 1, testo);
if (playerReturn == 2){
break;
}else if ((playerReturn == 1) | (playerReturn == 0)){
//Controllo se è finita la directory:
if ((playerReturn == 0) & (i == dirToPlay.number_of_directory_entries - 1)){
break;
}
//Altrimenti passo al file successivo:
i++;
if (i > dirToPlay.number_of_directory_entries - 1){
i = 0;
}
}else if (playerReturn == -1){
i--;
if (i < 0){
i = dirToPlay.number_of_directory_entries - 1;
}
}
}
}
opendir_close(&dirToPlay);
return;
}
//Menu:
void main_menu()
{
struct opendir_struct directory;
char curDir[256];
char dirToPlay[256];
char fileToPlay[256];
//Provo prima directory:
strcpy(curDir, mp3_directory_1);
char *result = opendir_open(&directory, curDir);
if (result != 0){
//Provo seconda directory:
strcpy(curDir, mp3_directory_2);
result = opendir_open(&directory, curDir);
if (result != 0){
pspDebugScreenSetXY(0, 4);
pspDebugScreenPrintf("\"%s\" not found or empty", curDir);
pspDebugScreenSetXY(0, 8);
return;
}
}
sortDirectory(directory);
int selected_entry = 0;
int top_entry = 0;
int maximum_number_of_rows = 20;
int starting_row = 4;
int updateInfo = 10;
char author[50];
char title[100];
while (1)
{
SceCtrlData controller;
screen_init();
screen_menu_init();
pspDebugScreenSetXY(0, 3);
pspDebugScreenPrintf(curDir);
while (1)
{
if (updateInfo >= 10)
{
screen_sysinfo();
updateInfo = 0;
}
updateInfo++;
sceCtrlReadBufferPositive(&controller, 1);
if ((controller.Buttons & PSP_CTRL_DOWN) | (controller.Ly > 158)){
if (selected_entry + 1 < directory.number_of_directory_entries){
selected_entry++;
if (selected_entry == top_entry + maximum_number_of_rows){
top_entry++;
}
}
} else if ((controller.Buttons & PSP_CTRL_UP) | (controller.Ly < 98)){
if (selected_entry != 0){
selected_entry--;
if (selected_entry == top_entry - 1){
top_entry--;
}
}
} else if ((controller.Buttons & PSP_CTRL_RIGHT) | (controller.Lx > 158)){
//Pagina giù:
if (top_entry + maximum_number_of_rows < directory.number_of_directory_entries){
top_entry = top_entry + maximum_number_of_rows;
selected_entry += maximum_number_of_rows;
if (selected_entry > directory.number_of_directory_entries - 1){
selected_entry = directory.number_of_directory_entries - 1;
}
} else {
selected_entry = directory.number_of_directory_entries - 1;
}
sceKernelDelayThread(100000);
} else if ((controller.Buttons & PSP_CTRL_LEFT) | (controller.Lx < 98)){
//Pagina su:
if (top_entry - maximum_number_of_rows >= 0){
top_entry = top_entry - maximum_number_of_rows;
selected_entry -= maximum_number_of_rows;
} else {
top_entry = 0;
selected_entry = 0;
}
sceKernelDelayThread(100000);
}
pspDebugScreenSetXY(1, starting_row);
pspDebugScreenSetTextColor(WHITE);
pspDebugScreenSetBackColor(0xaa4400);
//Segno precedente:
if (top_entry > 0){
pspDebugScreenPrintf("%-66.66s", "...");
} else{
pspDebugScreenPrintf("%-66.66s", "");
}
int i = 0;
for (; i < maximum_number_of_rows; i++){
int current_entry = top_entry + i;
pspDebugScreenSetXY(1, starting_row + i + 1);
if (current_entry < directory.number_of_directory_entries){
if (current_entry == selected_entry){
pspDebugScreenSetBackColor(0x882200);
} else {
pspDebugScreenSetBackColor(0xcc6600);
}
//Controllo se è una directory o un file:
if (directory.directory_entry[current_entry].d_stat.st_attr == 32){
pspDebugScreenSetTextColor(YELLOW);
pspDebugScreenPrintf("%-66.66s", directory.directory_entry[current_entry].d_name);
} else {
//Spezzo autore e titolo:
if (splitAuthorTitle(directory.directory_entry[current_entry].d_name, author, title) != 0){
char format[10];
pspDebugScreenSetTextColor(YELLOW);
pspDebugScreenPrintf("%s", author);
pspDebugScreenPrintf(" ");
pspDebugScreenSetTextColor(WHITE);
snprintf(format, sizeof(format), "%%-%i.%is", 66 - strlen(author) - 1, 66 - strlen(author) - 1);
pspDebugScreenPrintf(format, title);
} else {
pspDebugScreenSetTextColor(0xcccccc);
pspDebugScreenPrintf("%-66.66s", directory.directory_entry[current_entry].d_name);
}
}
} else {
pspDebugScreenSetTextColor(WHITE);
pspDebugScreenSetBackColor(0xaa4400);
pspDebugScreenPrintf("%-66.66s", "");
}
}
pspDebugScreenSetXY(1, starting_row + maximum_number_of_rows + 1);
pspDebugScreenSetTextColor(WHITE);
pspDebugScreenSetBackColor(0xaa4400);
//Segno successivo:
if (top_entry + maximum_number_of_rows < directory.number_of_directory_entries){
pspDebugScreenPrintf("%-66.66s", "...");
}
else{
pspDebugScreenPrintf("%-66.66s", "");
}
if (controller.Buttons & PSP_CTRL_CROSS || controller.Buttons & PSP_CTRL_CIRCLE || controller.Buttons & PSP_CTRL_TRIANGLE || controller.Buttons & PSP_CTRL_SQUARE)
{
break;
}
sceKernelDelayThread(100000);
}
if (controller.Buttons & PSP_CTRL_TRIANGLE)
{
break;
} else if (controller.Buttons & PSP_CTRL_CROSS)
{
//Controllo se è un file o una directory:
if (directory.directory_entry[selected_entry].d_stat.st_attr == 32)
{
if (strstr(directory.directory_entry[selected_entry].d_name, ".ogg") != 0 || strstr(directory.directory_entry[selected_entry].d_name, ".OGG") != 0){
strcpy(fileToPlay, curDir);
if (curDir[strlen(curDir)-1] != '/'){
strcat(fileToPlay, "/");
}
strcat(fileToPlay, directory.directory_entry[selected_entry].d_name);
play(fileToPlay, 0, "");
sceKernelDelayThread(200000);
}
} else if (directory.directory_entry[selected_entry].d_stat.st_attr == 16)
{
if (curDir[strlen(curDir)-1] != '/'){
strcat(curDir, "/");
}
strcat(curDir, directory.directory_entry[selected_entry].d_name);
opendir_close(&directory);
selected_entry = 0;
top_entry = 0;
result = opendir_open(&directory, curDir);
sortDirectory(directory);
sceKernelDelayThread(200000);
}
} else if (controller.Buttons & PSP_CTRL_CIRCLE)
{
opendir_close(&directory);
directoryUp(curDir);
selected_entry = 0;
top_entry = 0;
result = opendir_open(&directory, curDir);
sortDirectory(directory);
sceKernelDelayThread(200000);
} else if (controller.Buttons & PSP_CTRL_SQUARE)
{
//Controllo se è una directory:
if (directory.directory_entry[selected_entry].d_stat.st_attr == 16){
strcpy(dirToPlay, curDir);
if (dirToPlay[strlen(dirToPlay)-1] != '/'){
strcat(dirToPlay, "/");
}
strcat(dirToPlay, directory.directory_entry[selected_entry].d_name);
playDirectory(dirToPlay);
sceKernelDelayThread(200000);
}
}
}
opendir_close(&directory);
}
//Main
int main() {
scePowerSetClockFrequency(222, 222, 111);
scePowerSetCpuClockFrequency(80);
scePowerSetBusClockFrequency(60);
sceCtrlSetSamplingMode(PSP_CTRL_MODE_ANALOG);
SetupCallbacks();
tzset();
pspAudioInit();
pspAudioSetVolume(1, 0x8000, 0x8000);
main_menu();
pspAudioEnd();
sceKernelExitGame();
return(0);
}
Code: Select all
extern int OGG_defaultCPUClock;
//private functions
void OGG_Init(int channel);
int OGG_Play();
void OGG_Pause();
int OGG_Stop();
void OGG_End();
void OGG_FreeTune();
int OGG_Load(char *filename);
void OGG_GetTimeString(char *dest);
int OGG_EndOfStream();
struct fileInfo OGG_GetInfo();
struct fileInfo OGG_GetTagInfoOnly(char *filename);
int OGG_GetStatus();
int OGG_GetPercentage();
void OGG_setVolumeBoostType(char *boostType);
void OGG_setVolumeBoost(int boost);
int OGG_getVolumeBoost();
int OGG_getPlayingSpeed();
int OGG_setPlayingSpeed(int playingSpeed);
int OGG_setMute(int onOff);
void OGG_fadeOut(float seconds);
//Functions for filter (equalizer):
int OGG_setFilter(double tFilter[32], int copyFilter);
void OGG_enableFilter();
void OGG_disableFilter();
int OGG_isFilterEnabled();
int OGG_isFilterSupported();
//Manage suspend:
int OGG_suspend();
int OGG_resume();
Code: Select all
TARGET = ogg
OBJS = log.o id3.o main.o mem64.o opendir.o
#To build for custom firmware:
BUILD_PRX = 1
#PSP_LARGE_MEMORY = 1
PSP_FW_VERSION=371
CFLAGS = -O3 -fomit-frame-pointer -ffast-math -frename-registers -G0 -Wall
CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti
ASFLAGS = $(CFLAGS)
LIBDIR =
LIBS = -lmad -lvorbisidec -lm \
-lpspgu -lpspgum -lpsppower \
-lpsphprm -lpspusb -lpspusbstor -lpspaudio -lpspaudiocodec -lpspaudiolib -logg
LDFLAGS =
EXTRA_TARGETS = EBOOT.PBP
PSP_EBOOT_TITLE = OGG Sample
PSP_EBOOT_ICON = ICON0.PNG
PSPSDK=$(shell psp-config --pspsdk-path)
include $(PSPSDK)/lib/build.mak
Code: Select all
psp-gcc -I. -IC:/PSPDev/psp/sdk/include -O3 -fomit-frame-pointer -ffast-math -fr
ename-registers -G0 -Wall -D_PSP_FW_VERSION=371 -c -o main.o main.c
main.c: In function 'play':
main.c:446: warning: implicit declaration of function 'OGG_GetPercentace'
main.c:567: warning: control reaches end of non-void function
psp-gcc -I. -IC:/PSPDev/psp/sdk/include -O3 -fomit-frame-pointer -ffast-math -fr
ename-registers -G0 -Wall -D_PSP_FW_VERSION=371 -c -o mem64.o mem64.c
psp-gcc -I. -IC:/PSPDev/psp/sdk/include -O3 -fomit-frame-pointer -ffast-math -fr
ename-registers -G0 -Wall -D_PSP_FW_VERSION=371 -c -o opendir.o opendir.c
psp-gcc -I. -IC:/PSPDev/psp/sdk/include -O3 -fomit-frame-pointer -ffast-math -fr
ename-registers -G0 -Wall -D_PSP_FW_VERSION=371 -L. -LC:/PSPDev/psp/sdk/lib -sp
ecs=C:/PSPDev/psp/sdk/lib/prxspecs -Wl,-q,-TC:/PSPDev/psp/sdk/lib/linkfile.prx
log.o id3.o main.o mem64.o opendir.o C:/PSPDev/psp/sdk/lib/prxexports.o -lmad -
lvorbisidec -lm -lpspgu -lpspgum -lpsppower -lpsphprm -lpspusb -lpspusbstor -lps
paudio -lpspaudiocodec -lpspaudiolib -logg -lpspdebug -lpspdisplay -lpspge -lps
pctrl -lpspsdk -lc -lpspnet -lpspnet_inet -lpspnet_apctl -lpspnet_resolver -lpsp
utility -lpspuser -lpspkernel -o mp3.elf
main.o: In function `play':
main.c:(.text+0xe4c): undefined reference to `OGG_Init'
main.c:(.text+0xe7c): undefined reference to `OGG_Load'
main.c:(.text+0xe90): undefined reference to `OGG_Play'
main.c:(.text+0xea0): undefined reference to `OGG_GetTimeString'
main.c:(.text+0xedc): undefined reference to `OGG_GetPercentace'
main.c:(.text+0x1000): undefined reference to `OGG_Pause'
main.c:(.text+0x108c): undefined reference to `OGG_EndOfStream'
main.c:(.text+0x10a0): undefined reference to `OGG_End'
main.c:(.text+0x116c): undefined reference to `OGG_End'
C:/PSPDev/psp/sdk/lib\libpspaudiolib.a(pspaudiolib.o): In function `pspAudioEnd'
:
: undefined reference to `sceAudioChRelease'
C:/PSPDev/psp/sdk/lib\libpspaudiolib.a(pspaudiolib.o): In function `pspAudioInit
':
: undefined reference to `sceAudioChReserve'
C:/PSPDev/psp/sdk/lib\libpspaudiolib.a(pspaudiolib.o): In function `pspAudioInit
':
: undefined reference to `sceAudioChRelease'
C:/PSPDev/psp/sdk/lib\libpspaudiolib.a(pspaudiolib.o): In function `pspAudioOutB
locking':
: undefined reference to `sceAudioOutputPannedBlocking'
collect2: ld returned 1 exit status
make: *** [mp3.elf] Error 1