Error compiling OGG Sample

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Post Reply
nikocronaldo
Posts: 31
Joined: Sun Feb 24, 2008 7:19 am

Error compiling OGG Sample

Post by nikocronaldo »

I have done a program based on the LiGht MP3 that simply reproduces OGG, but it gives some mistakes to compile. Here the code of the MAIN is:

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&#58;
#define RGB&#40;r, g, b&#41; &#40;&#40;b << 16&#41; | &#40;g << 8&#41; | r&#41;
#define YELLOW RGB&#40;255, 2550, 0&#41;
#define BLACK RGB&#40;0, 0, 0&#41;
#define WHITE RGB&#40;255, 255, 255&#41;
#define RED RGB&#40;255, 0, 0&#41;
#define DEEPSKYBLUE RGB&#40;0, 178, 238&#41;

;
PSP_MODULE_INFO&#40;"OGG Sample", 0, 1, 0&#41;;
PSP_MAIN_THREAD_ATTR&#40;THREAD_ATTR_USER&#41;;
PSP_HEAP_SIZE_KB&#40;21000&#41;;

#define mp3_directory_1 "ms0&#58;/MUSIC"
#define mp3_directory_2 "ms0&#58;/PSP/MUSIC"

/*void sceDisplay_driver_9E3C6DC6&#40;int a0,int a1&#41;;//a0 0-100,a1 = 0/1 &#40;set to 0&#41;
#define sceDisplaySetBrightness sceDisplay_driver_9E3C6DC6
void sceDisplay_driver_31C4BAA8&#40;int *a0,int *a1&#41;;
#define sceDisplayGetBrightness sceDisplay_driver_31C4BAA8*/

char version&#91;10&#93; = "1.0.0";
int oldBrightness = 0;

// TWILIGHT ZONE!
/* Exit callback */
int exit_callback&#40;int arg1, int arg2, void *common&#41; &#123;
          sceKernelExitGame&#40;&#41;;
          return 0;
&#125;



/* Callback thread */
int CallbackThread&#40;SceSize args, void *argp&#41; &#123;
          int cbid;

          cbid = sceKernelCreateCallback&#40;"Exit Callback", exit_callback, NULL&#41;;
          sceKernelRegisterExitCallback&#40;cbid&#41;;

          sceKernelSleepThreadCB&#40;&#41;;

          return 0;
&#125;

/* Sets up the callback thread and returns its thread id */
int SetupCallbacks&#40;void&#41; &#123;
          int thid = 0;

          thid = sceKernelCreateThread&#40;"update_thread", CallbackThread, 0x11, 0xFA0, 0, 0&#41;;
          if&#40;thid >= 0&#41; &#123;
                    sceKernelStartThread&#40;thid, 0, 0&#41;;
          &#125;

          return thid;
&#125;
// END OF TWILIGHT ZONE!

//Memoria libera totale&#58;
typedef struct
&#123;
      void *buffer;
      void *next;
&#125; _LINK;

int freemem&#40;&#41;
&#123;
   int size = 4096, total = 0;
    _LINK *first = NULL, *current = NULL, *lnk;

    while &#40;1&#41;
    &#123;
       lnk = &#40;_LINK*&#41;malloc&#40;sizeof&#40;_LINK&#41;&#41;;
       if &#40;!lnk&#41;
          break;

       total += sizeof&#40;_LINK&#41;;

       lnk->buffer = malloc&#40;size&#41;;
       if &#40;!lnk->buffer&#41;
       &#123;
          free&#40;lnk&#41;;
          break;
       &#125;

       total += size;
       lnk->next = NULL;

       if &#40;current&#41;
       &#123;
          current->next = &#40;void*&#41;lnk;
          current = lnk;
       &#125;
       else
       &#123;
          current = first = lnk;
       &#125;
    &#125;

    lnk = first;
    while &#40;lnk&#41;
    &#123;
       free&#40;lnk->buffer&#41;;
       current = lnk->next;
       free&#40;lnk&#41;;
       lnk = current;
    &#125;

    return total;
&#125;

//Ordinamento dei file di una directory&#58;
void sortDirectory&#40;struct opendir_struct directory&#41;
&#123;
	int n = directory.number_of_directory_entries;
	int i = 0;
	
	while &#40;i < n&#41; &#123;
		if &#40;i == 0 || strcmp&#40;directory.directory_entry&#91;i-1&#93;.d_name, directory.directory_entry&#91;i&#93;.d_name&#41; <= 0&#41; i++;
		else &#123;SceIoDirent tmp = directory.directory_entry&#91;i&#93;; directory.directory_entry&#91;i&#93; = directory.directory_entry&#91;i-1&#93;; directory.directory_entry&#91;--i&#93; = tmp;&#125;
	&#125;
&#125;

//Prendo solo il nome del file&#58;
void getFileName&#40;char *fileName, char *onlyName&#41;&#123;
	int slash = -1;
	int retCount;

	strcpy&#40;onlyName, fileName&#41;;
	//Cerco l'ultimo slash&#58;
	int i = 0;
	for &#40;i = strlen&#40;fileName&#41; - 1; i >= 0; i--&#41;&#123;
		if &#40;&#40;fileName&#91;i&#93; == '/'&#41; & &#40;i != strlen&#40;fileName&#41;&#41;&#41;&#123;
			slash = i;
			break;
		&#125;
	&#125;
	if &#40;slash&#41;&#123;
		retCount = 0;
		for &#40;i = slash + 1; i < strlen&#40;fileName&#41;; i++&#41;&#123;
			onlyName&#91;retCount&#93; = fileName&#91;i&#93;;
			retCount++;
		&#125;
		onlyName&#91;retCount&#93; = '\0';
	&#125;
&#125;

//Calcolo livello superiore&#58;
void directoryUp&#40;char *dirName&#41;
&#123;
	if &#40;dirName != "ms0&#58;/"&#41;&#123;
		//Cerco l'ultimo slash&#58;
		int i = 0;
		for &#40;i = strlen&#40;dirName&#41; - 1; i >= 0; i--&#41;&#123;
			if &#40;&#40;dirName&#91;i&#93; == '/'&#41; & &#40;i != strlen&#40;dirName&#41;&#41;&#41;&#123;
				if &#40;i > 4&#41;&#123;
					dirName&#91;i&#93; = '\0';
				&#125;else&#123;
					dirName&#91;i+1&#93; = '\0';
				&#125;
				break;
			&#125;
		&#125;
	&#125;
	return;
&#125;

//Spezzo autore e titolo nel nome di una directory&#58;
void rtrim&#40;char *toTrim&#41;
&#123;
	int i = 0;
	for &#40;i = strlen&#40;toTrim&#41; - 1; i >= 0; i--&#41;&#123;
		if &#40;isspace&#40;toTrim&#91;i&#93;&#41;&#41;&#123;
			toTrim&#91;i&#93; = '\0';
		&#125;else&#123;
			break;
		&#125;
	&#125;
&#125;

int splitAuthorTitle&#40;char *dirName, char *author, char *title&#41;
&#123;
	if &#40;strstr&#40;dirName, "-"&#41; != 0&#41;&#123;
		int i = 0;
		int posSep = -1;
		int countAuthor = 0;
		int countTitle = 0;

		for &#40;i = 0; i < strlen&#40;dirName&#41;; i++&#41;&#123;
			if &#40;dirName&#91;i&#93; == '-'&#41;&#123;
				posSep = i;
			&#125;
			else if &#40;posSep == -1&#41;&#123;
				if &#40;&#40;countAuthor != 0&#41; | &#40;dirName&#91;i&#93; != ' '&#41;&#41;&#123;
					author&#91;countAuthor&#93; = dirName&#91;i&#93;;
					countAuthor++;
				&#125;
			&#125;else&#123;
				if &#40;&#40;countTitle != 0&#41; | &#40;dirName&#91;i&#93; != ' '&#41;&#41;&#123;
					title&#91;countTitle&#93; = dirName&#91;i&#93;;
					countTitle++;
				&#125;
			&#125;
			author&#91;countAuthor&#93; = '\0';
			title&#91;countTitle&#93; = '\0';
		&#125;
		rtrim&#40;author&#41;;
		rtrim&#40;title&#41;;
		return&#40;1&#41;;
	&#125;
	return&#40;0&#41;;
&#125;

//Costruisco la barra della percentuale&#58;
void buildProgressBar&#40;char *pBar, int percentage&#41;&#123;
	int i;

	pBar&#91;0&#93; = '&#91;';
	for &#40;i = 1; i < 22; i++&#41;&#123;
		if &#40;percentage >= &#40;i-1&#41; * 5&#41;&#123;
			pBar&#91;i&#93; = '*';
		&#125;else&#123;
			pBar&#91;i&#93; = ' ';
		&#125;
	&#125;
	pBar&#91;21&#93; = '&#93;';
	pBar&#91;22&#93; = '\0';
&#125;

// Inizializzazione schermo&#58;
void screen_sysinfo&#40;&#41;
&#123;
pspDebugScreenSetTextColor&#40;0xeeff00&#41;;
	printf&#40;"¡OGG SAMPLE"&#41;;
	
	if &#40;scePowerIsBatteryExist&#40;&#41;&#41; &#123;
		int batteryLifeTime = scePowerGetBatteryLifeTime&#40;&#41;;
		printf&#40;"\n   Battery&#58; %d%%  &#40;%02dh%02dm&#41;", scePowerGetBatteryLifePercent&#40;&#41;, batteryLifeTime/60, batteryLifeTime-&#40;batteryLifeTime/60*60&#41;&#41;;
&#125;
&#125;

void screen_init&#40;&#41;
	&#123;
	
		
	if &#40;scePowerIsBatteryExist&#40;&#41;&#41; &#123;
		int batteryLifeTime = scePowerGetBatteryLifeTime&#40;&#41;;
		printf&#40;"\n   Battery&#58; %d%%  &#40;%02dh%02dm&#41;", scePowerGetBatteryLifePercent&#40;&#41;, batteryLifeTime/60, batteryLifeTime-&#40;batteryLifeTime/60*60&#41;&#41;;

	pspDebugScreenSetTextColor&#40;WHITE&#41;;
	pspDebugScreenSetBackColor&#40;BLACK&#41;;
	pspDebugScreenInit&#40;&#41;;
	pspDebugScreenSetTextColor&#40;WHITE&#41;;
	pspDebugScreenSetBackColor&#40;BLACK&#41;;
	pspDebugScreenSetXY&#40;0, 1&#41;;
	pspDebugScreenPrintf&#40;"OGG SAMPLE"&#41;;
	pspDebugScreenSetXY&#40;0, 33&#41;;
&#125;
&#125;


//Schermo per menu
void screen_menu_init&#40;&#41;
&#123;
	pspDebugScreenSetTextColor&#40;WHITE&#41;;
	pspDebugScreenSetXY&#40;0, 27&#41;;
	pspDebugScreenPrintf&#40;"Press X to enter directory/play file"&#41;;
	pspDebugScreenPrintf&#40;"\n"&#41;;
	pspDebugScreenPrintf&#40;"Press SQUARE to play directory"&#41;;
	pspDebugScreenPrintf&#40;"\n"&#41;;
	pspDebugScreenPrintf&#40;"Press O to go up one level"&#41;;
	pspDebugScreenPrintf&#40;"\n"&#41;;
	pspDebugScreenPrintf&#40;"Press TRIANGLE to exit"&#41;;
&#125;

//Schermo per player
void screen_player_init&#40;char *filename, struct ID3Tag ID3, int nextPrevious, char *numbers&#41;
&#123;
	char file&#91;256&#93;;
	pspDebugScreenSetTextColor&#40;WHITE&#41;;
	pspDebugScreenSetBackColor&#40;BLACK&#41;;
	if &#40;nextPrevious == 1&#41;&#123;
	    pspDebugScreenSetXY&#40;0, 7&#41;;
		pspDebugScreenPrintf&#40;"File Number&#58; %s", numbers&#41;;
	&#125;
    pspDebugScreenSetXY&#40;0, 8&#41;;
	getFileName&#40;filename, file&#41;;
	pspDebugScreenPrintf&#40;"File Name  &#58; %s", file&#41;;
	pspDebugScreenPrintf&#40;"\n"&#41;;
	pspDebugScreenPrintf&#40;"Time       &#58;"&#41;;
	pspDebugScreenSetTextColor&#40;YELLOW&#41;;
    pspDebugScreenSetXY&#40;0, 11&#41;;
    pspDebugScreenPrintf&#40;"Album      &#58; %s", ID3.ID3Album&#41;;
	pspDebugScreenPrintf&#40;"\n"&#41;;
	pspDebugScreenPrintf&#40;"Title      &#58; %s", ID3.ID3Title&#41;;
	pspDebugScreenPrintf&#40;"\n"&#41;;
    pspDebugScreenPrintf&#40;"Artist     &#58; %s", ID3.ID3Artist&#41;;
	pspDebugScreenPrintf&#40;"\n"&#41;;
    pspDebugScreenPrintf&#40;"Year       &#58; %s", ID3.ID3Year&#41;;
	pspDebugScreenPrintf&#40;"\n"&#41;;
	pspDebugScreenPrintf&#40;"Genre      &#58; %s", ID3.ID3GenreText&#41;;

	pspDebugScreenSetTextColor&#40;DEEPSKYBLUE&#41;;
	pspDebugScreenSetXY&#40;0, 16&#41;;
    pspDebugScreenPrintf&#40;"Layer      &#58;"&#41;;
	pspDebugScreenPrintf&#40;"\n"&#41;;
    pspDebugScreenPrintf&#40;"Bitrate    &#58;"&#41;;
	pspDebugScreenPrintf&#40;"\n"&#41;;
    pspDebugScreenPrintf&#40;"Sample rate&#58;"&#41;;
	pspDebugScreenPrintf&#40;"\n"&#41;;
    pspDebugScreenPrintf&#40;"Mode       &#58;"&#41;;
	pspDebugScreenPrintf&#40;"\n"&#41;;
    pspDebugScreenPrintf&#40;"Emphasis   &#58;"&#41;;

	pspDebugScreenSetTextColor&#40;WHITE&#41;;
	pspDebugScreenSetXY&#40;0, 27&#41;;
	pspDebugScreenPrintf&#40;"Press X to pause"&#41;;
	pspDebugScreenPrintf&#40;"\n"&#41;;
	pspDebugScreenPrintf&#40;"Press O to stop"&#41;;
	if &#40;nextPrevious == 1&#41;
	&#123;
		pspDebugScreenPrintf&#40;"\n"&#41;;
		pspDebugScreenPrintf&#40;"Press L/R to change song"&#41;;
	&#125;
	pspDebugScreenPrintf&#40;"\n"&#41;;
	pspDebugScreenPrintf&#40;"Press UP/DOWN to change cpu clock"&#41;;
	pspDebugScreenPrintf&#40;"\n"&#41;;
	pspDebugScreenPrintf&#40;"Press LEFT/RIGHT to change bus clock"&#41;;
	pspDebugScreenPrintf&#40;"\n"&#41;;
	pspDebugScreenPrintf&#40;"Press SELECT toggle mute"&#41;;
&#125;

void screen_fileinfo&#40;struct fileInfo info&#41;&#123;
    pspDebugScreenSetXY&#40;0, 16&#41;;
	pspDebugScreenSetTextColor&#40;DEEPSKYBLUE&#41;;
    pspDebugScreenPrintf&#40;"Layer      &#58; %s", info.layer&#41;;
	pspDebugScreenPrintf&#40;"\n"&#41;;
    pspDebugScreenPrintf&#40;"Bitrate    &#58; %i &#91;%3.3i&#93; kbit", info.kbit, info.kbit&#41;;
	pspDebugScreenPrintf&#40;"\n"&#41;;
    pspDebugScreenPrintf&#40;"Sample rate&#58; %li Hz", info.hz&#41;;
	pspDebugScreenPrintf&#40;"\n"&#41;;
    pspDebugScreenPrintf&#40;"Mode       &#58; %s", info.mode&#41;;
	pspDebugScreenPrintf&#40;"\n"&#41;;
    pspDebugScreenPrintf&#40;"Emphasis   &#58; %s", info.emphasis&#41;;
&#125;

	

//Play OGG file&#58;
int play&#40;char *filename, int nextPrevious, char *numbers&#41;

 &#123;
 
	  /* 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&#91;20&#93;;
	  int updateInfo = 0;
	  struct ID3Tag ID3;
	  
	  int brightness = 0;
	  char pBar&#91;22&#93;;
	  int muted = 0;

info.kbit = 0;
	  info.hz = 0;
	  
	   
	  clock = scePowerGetCpuClockFrequency&#40;&#41;;
	  bus = scePowerGetBusClockFrequency&#40;&#41;;
	  //Leggo le informazioni ID3&#58;
	  ID3 = ParseID3&#40;filename&#41;;

	  screen_init&#40;&#41;;
	  screen_player_init&#40;filename, ID3, nextPrevious, numbers&#41;;

	   OGG_Init&#40;1&#41;;
	  	
	  pspAudioSetVolume&#40;1, 0x8000, 0x8000&#41;;
	  pspDebugScreenSetXY&#40;0, 21&#41;;
	  pspDebugScreenPrintf&#40;"Opening..."&#41;;
	  //Apro il file&#58;
	  OGG_Load&#40;filename&#41;;
	  screen_fileinfo&#40;info&#41;;
	  	  
	   OGG_Play&#40;&#41;;
	  
	  action = 1;

	  while&#40;1&#41;&#123;
		    //Aggiorno info a video&#58;
			if &#40;updateInfo == 0&#41;&#123;
				screen_sysinfo&#40;&#41;;
				OGG_GetTimeString&#40;timestring&#41;;
				pspDebugScreenSetTextColor&#40;WHITE&#41;;
				pspDebugScreenSetBackColor&#40;BLACK&#41;;
				pspDebugScreenSetXY&#40;0, 9&#41;;
								pspDebugScreenPrintf&#40;"Time       &#58; %s / %s", timestring, info.strLength&#41;;
				buildProgressBar&#40;pBar, OGG_GetPercentace&#40;&#41;&#41;;
				pspDebugScreenSetXY&#40;13, 10&#41;;
				pspDebugScreenPrintf&#40;pBar&#41;;
				//Testo dell'azione corrente&#58;
				pspDebugScreenSetXY&#40;0, 21&#41;;
				if &#40;action == 1&#41;&#123;
					pspDebugScreenPrintf&#40;"Playing..."&#41;;
				&#125;else if &#40;action == -1&#41;&#123;
					pspDebugScreenPrintf&#40;"Paused    "&#41;;
				&#125;
				//Testo mute&#58;
				pspDebugScreenSetXY&#40;0, 22&#41;;
				if &#40;muted == 1&#41;&#123;
					pspDebugScreenSetTextColor&#40;RED&#41;;
					pspDebugScreenPrintf&#40;"Mute ON"&#41;;
				&#125; else &#123;
					pspDebugScreenPrintf&#40;"       "&#41;;
				&#125;
			&#125;
			updateInfo++;
			if &#40;updateInfo == 10&#41;&#123;
				updateInfo = 0;
			&#125;
			sceCtrlReadBufferPositive&#40;&pad, 1&#41;;
			sceHprmPeekCurrentKey&#40;&remoteButtons&#41;; 

			if&#40;pad.Buttons & PSP_CTRL_CIRCLE&#41; &#123;
					  OGG_End&#40;&#41;;
					  
					  action = 0;
					  retVal = 2;
					  break;
			&#125; else if&#40;&#40;pad.Buttons & PSP_CTRL_CROSS&#41; | &#40;remoteButtons & PSP_HPRM_PLAYPAUSE&#41;&#41; &#123;
					  OGG_Pause&#40;&#41;;
					  
					  if &#40;action != -1&#41;&#123;
						action = -1;
					  &#125;else&#123;
						action = 1;
					  &#125;
					  updateInfo = 0;
					  sceKernelDelayThread&#40;400000&#41;;
			&#125; else if&#40;&#40;pad.Buttons & PSP_CTRL_DOWN&#41; | &#40;pad.Ly > 158&#41;&#41; &#123;
				if &#40;clock > 33&#41;&#123;
					clock--;
					scePowerSetCpuClockFrequency&#40;clock&#41;;
					screen_sysinfo&#40;&#41;;
					sceKernelDelayThread&#40;100000&#41;;
				&#125;
			&#125; else if&#40;&#40;pad.Buttons & PSP_CTRL_UP&#41; | &#40;pad.Ly < 98&#41;&#41; &#123;
				if &#40;clock < 333&#41;&#123;
					clock++;
					scePowerSetCpuClockFrequency&#40;clock&#41;;
					screen_sysinfo&#40;&#41;;
					sceKernelDelayThread&#40;100000&#41;;
				&#125;
			&#125; else if&#40;&#40;pad.Buttons & PSP_CTRL_LEFT&#41; | &#40;pad.Lx < 98&#41;&#41; &#123;
				if &#40;bus > 54&#41;&#123;
					bus--;
					scePowerSetBusClockFrequency&#40;bus&#41;;
					screen_sysinfo&#40;&#41;;
					sceKernelDelayThread&#40;100000&#41;;
				&#125;
			&#125; else if&#40;&#40;pad.Buttons & PSP_CTRL_RIGHT&#41; | &#40;pad.Lx > 158&#41;&#41; &#123;
				if &#40;clock < 166&#41;&#123;
					bus++;
					scePowerSetBusClockFrequency&#40;bus&#41;;
					screen_sysinfo&#40;&#41;;
					sceKernelDelayThread&#40;100000&#41;;
				&#125;
			&#125; else if&#40;pad.Buttons & PSP_CTRL_LTRIGGER || remoteButtons & PSP_HPRM_BACK&#41; &#123;
				if &#40;nextPrevious == 1&#41;&#123;
					OGG_End&#40;&#41;;
					retVal = -1;
					break;
				&#125;
		
				
			&#125; else if&#40;pad.Buttons & PSP_CTRL_RTRIGGER || remoteButtons & PSP_HPRM_FORWARD&#41; &#123;
				if &#40;nextPrevious == 1&#41;&#123;
					OGG_End&#40;&#41;;
					retVal = 1;
					break;

				
			&#125; else if&#40;pad.Buttons & PSP_CTRL_START&#41; &#123;
				//sceDisplayGetBrightness&#40;&brightness, 0&#41;;
				if &#40;brightness != 0&#41;&#123;
					//Spengo il display&#58;
					oldBrightness = brightness;
					//sceDisplaySetBrightness&#40;0, 0&#41;;
				&#125; else &#123;
					//Accendo il display&#58;	
					//sceDisplaySetBrightness&#40;oldBrightness, 0&#41;;
				&#125;
				sceKernelDelayThread&#40;100000&#41;;
			&#125; else if&#40;pad.Buttons & PSP_CTRL_SELECT&#41; &#123;
				//Mute solo se sono in play&#58;
				if &#40;action == 1&#41;&#123;
					if &#40;muted == 0&#41;&#123;
						pspAudioSetVolume&#40;1, 0x1600, 0x1600&#41;;
						muted = 1;
					&#125;else&#123;
						pspAudioSetVolume&#40;1, 0x8000, 0x8000&#41;;
						muted = 0;
					&#125;
					updateInfo = 0;
					sceKernelDelayThread&#40;400000&#41;;
				&#125;
			&#125;

			//Controllo se l'mp3 è finito&#58;
			if &#40;OGG_EndOfStream&#40;&#41; == 1&#41; &#123;
				OGG_End&#40;&#41;;
				retVal = 0;
				break;
			&#125;

	  &#125;
	  return&#40;retVal&#41;;
&#125;
&#125;

//Play directory&#58;
void playDirectory&#40;char *dirName&#41;&#123;	
	struct opendir_struct dirToPlay;
	char *result = opendir_open&#40;&dirToPlay, dirName&#41;;
	sortDirectory&#40;dirToPlay&#41;;
	char testo&#91;10&#93;;
	char fileToPlay&#91;256&#93;;

	if &#40;result == 0&#41;&#123;
		int playerReturn = 0;
		int i = 0;

		while &#40;1&#41;&#123;
			snprintf&#40;testo, sizeof&#40;testo&#41;, "%i/%i", i + 1, dirToPlay.number_of_directory_entries&#41;;
			strcpy&#40;fileToPlay, dirName&#41;;
			if &#40;dirName&#91;strlen&#40;dirName&#41;-1&#93; != '/'&#41;&#123;
				strcat&#40;fileToPlay, "/"&#41;;
			&#125;
			strcat&#40;fileToPlay, dirToPlay.directory_entry&#91;i&#93;.d_name&#41;;
			playerReturn = play&#40;fileToPlay, 1, testo&#41;;
			if &#40;playerReturn == 2&#41;&#123;
				break;
			&#125;else if &#40;&#40;playerReturn == 1&#41; | &#40;playerReturn == 0&#41;&#41;&#123;
				//Controllo se è finita la directory&#58;
				if &#40;&#40;playerReturn == 0&#41; & &#40;i == dirToPlay.number_of_directory_entries - 1&#41;&#41;&#123;
					break;
				&#125;
				//Altrimenti passo al file successivo&#58;
				i++;
				if &#40;i > dirToPlay.number_of_directory_entries - 1&#41;&#123;
					i = 0;
				&#125;
			&#125;else if &#40;playerReturn == -1&#41;&#123;
				i--;
				if &#40;i < 0&#41;&#123;
					i = dirToPlay.number_of_directory_entries - 1;
				&#125;
			&#125;
		&#125;
	&#125;
	opendir_close&#40;&dirToPlay&#41;;
	return;
&#125;

//Menu&#58;
void main_menu&#40;&#41;
	&#123;
	struct opendir_struct directory;
	char curDir&#91;256&#93;;
	char dirToPlay&#91;256&#93;;
	char fileToPlay&#91;256&#93;;

	//Provo prima directory&#58;
	strcpy&#40;curDir, mp3_directory_1&#41;;
	char *result = opendir_open&#40;&directory, curDir&#41;;
	if &#40;result != 0&#41;&#123;
		//Provo seconda directory&#58;
		strcpy&#40;curDir, mp3_directory_2&#41;;
		result = opendir_open&#40;&directory, curDir&#41;;
		if &#40;result != 0&#41;&#123;
			pspDebugScreenSetXY&#40;0, 4&#41;;
			pspDebugScreenPrintf&#40;"\"%s\" not found or empty", curDir&#41;;
			pspDebugScreenSetXY&#40;0, 8&#41;;
			return;
		&#125;
	&#125;
	sortDirectory&#40;directory&#41;;

	int selected_entry         = 0;
	int top_entry              = 0;
	int maximum_number_of_rows = 20;
	int starting_row           = 4;
	int updateInfo = 10;
	char author&#91;50&#93;;
	char title&#91;100&#93;;
	while &#40;1&#41;
		&#123;
        SceCtrlData controller;
		screen_init&#40;&#41;;
		screen_menu_init&#40;&#41;;
		pspDebugScreenSetXY&#40;0, 3&#41;;
		pspDebugScreenPrintf&#40;curDir&#41;;

		while &#40;1&#41;
			&#123;
			if &#40;updateInfo >= 10&#41;
			&#123;
				screen_sysinfo&#40;&#41;;
				updateInfo = 0;
			&#125;
			updateInfo++;

			sceCtrlReadBufferPositive&#40;&controller, 1&#41;;
			if &#40;&#40;controller.Buttons & PSP_CTRL_DOWN&#41; | &#40;controller.Ly > 158&#41;&#41;&#123;
				if &#40;selected_entry + 1 < directory.number_of_directory_entries&#41;&#123;
					selected_entry++;

					if &#40;selected_entry == top_entry + maximum_number_of_rows&#41;&#123;
						top_entry++;
						&#125;
					&#125;
			&#125; else if &#40;&#40;controller.Buttons & PSP_CTRL_UP&#41; | &#40;controller.Ly < 98&#41;&#41;&#123;
				if &#40;selected_entry != 0&#41;&#123;
					selected_entry--;

					if &#40;selected_entry == top_entry - 1&#41;&#123;
						top_entry--;
					&#125;
				&#125;
			&#125; else if &#40;&#40;controller.Buttons & PSP_CTRL_RIGHT&#41; | &#40;controller.Lx > 158&#41;&#41;&#123;
				//Pagina giù&#58;
				if &#40;top_entry + maximum_number_of_rows < directory.number_of_directory_entries&#41;&#123;
					top_entry = top_entry + maximum_number_of_rows;
					selected_entry += maximum_number_of_rows;
					if &#40;selected_entry > directory.number_of_directory_entries - 1&#41;&#123;
						selected_entry = directory.number_of_directory_entries - 1;
					&#125;
				&#125; else &#123;
					selected_entry = directory.number_of_directory_entries - 1;
				&#125;
				sceKernelDelayThread&#40;100000&#41;;
			&#125; else if &#40;&#40;controller.Buttons & PSP_CTRL_LEFT&#41; | &#40;controller.Lx < 98&#41;&#41;&#123;
				//Pagina su&#58;
				if &#40;top_entry - maximum_number_of_rows >= 0&#41;&#123;
					top_entry = top_entry - maximum_number_of_rows;
					selected_entry -= maximum_number_of_rows;
				&#125; else &#123;
					top_entry = 0;
					selected_entry = 0;
				&#125;
				sceKernelDelayThread&#40;100000&#41;;
			&#125;
			pspDebugScreenSetXY&#40;1, starting_row&#41;;
			pspDebugScreenSetTextColor&#40;WHITE&#41;;
			pspDebugScreenSetBackColor&#40;0xaa4400&#41;;

			//Segno precedente&#58;
			if &#40;top_entry > 0&#41;&#123;
				pspDebugScreenPrintf&#40;"%-66.66s", "..."&#41;;
			&#125; else&#123;
				pspDebugScreenPrintf&#40;"%-66.66s", ""&#41;;
			&#125;
			int i = 0;
			for &#40;; i < maximum_number_of_rows; i++&#41;&#123;
				int current_entry = top_entry + i;

				pspDebugScreenSetXY&#40;1, starting_row + i + 1&#41;;

				if &#40;current_entry < directory.number_of_directory_entries&#41;&#123;
					if &#40;current_entry == selected_entry&#41;&#123;
						pspDebugScreenSetBackColor&#40;0x882200&#41;;
					&#125; else &#123;
						pspDebugScreenSetBackColor&#40;0xcc6600&#41;;
					&#125;
					//Controllo se è una directory o un file&#58;
					if &#40;directory.directory_entry&#91;current_entry&#93;.d_stat.st_attr == 32&#41;&#123;
						pspDebugScreenSetTextColor&#40;YELLOW&#41;;
						pspDebugScreenPrintf&#40;"%-66.66s", directory.directory_entry&#91;current_entry&#93;.d_name&#41;;
					&#125; else &#123;
						//Spezzo autore e titolo&#58;
						if &#40;splitAuthorTitle&#40;directory.directory_entry&#91;current_entry&#93;.d_name, author, title&#41; != 0&#41;&#123;
							char format&#91;10&#93;;
							pspDebugScreenSetTextColor&#40;YELLOW&#41;;
							pspDebugScreenPrintf&#40;"%s", author&#41;;
							pspDebugScreenPrintf&#40;" "&#41;;
							pspDebugScreenSetTextColor&#40;WHITE&#41;;
							snprintf&#40;format, sizeof&#40;format&#41;, "%%-%i.%is", 66 - strlen&#40;author&#41; - 1, 66 - strlen&#40;author&#41; - 1&#41;;
							pspDebugScreenPrintf&#40;format, title&#41;;
						&#125; else &#123;
							pspDebugScreenSetTextColor&#40;0xcccccc&#41;;
							pspDebugScreenPrintf&#40;"%-66.66s", directory.directory_entry&#91;current_entry&#93;.d_name&#41;;
						&#125;
					&#125;
				&#125; else &#123;
					pspDebugScreenSetTextColor&#40;WHITE&#41;;
					pspDebugScreenSetBackColor&#40;0xaa4400&#41;;
					pspDebugScreenPrintf&#40;"%-66.66s", ""&#41;;
				&#125;
			&#125;
			pspDebugScreenSetXY&#40;1, starting_row + maximum_number_of_rows + 1&#41;;
			pspDebugScreenSetTextColor&#40;WHITE&#41;;
			pspDebugScreenSetBackColor&#40;0xaa4400&#41;;
			//Segno successivo&#58;
			if &#40;top_entry + maximum_number_of_rows < directory.number_of_directory_entries&#41;&#123;
				pspDebugScreenPrintf&#40;"%-66.66s", "..."&#41;;
			&#125;
			else&#123;
				pspDebugScreenPrintf&#40;"%-66.66s", ""&#41;;
			&#125;


			if &#40;controller.Buttons & PSP_CTRL_CROSS || controller.Buttons & PSP_CTRL_CIRCLE || controller.Buttons & PSP_CTRL_TRIANGLE || controller.Buttons & PSP_CTRL_SQUARE&#41;
				&#123;
				break;
				&#125;
			sceKernelDelayThread&#40;100000&#41;;
			&#125;

		if &#40;controller.Buttons & PSP_CTRL_TRIANGLE&#41;
		&#123;
			break;
		&#125; else if &#40;controller.Buttons & PSP_CTRL_CROSS&#41;
		&#123;
			//Controllo se è un file o una directory&#58;
			if &#40;directory.directory_entry&#91;selected_entry&#93;.d_stat.st_attr == 32&#41;
			&#123;
				if &#40;strstr&#40;directory.directory_entry&#91;selected_entry&#93;.d_name, ".ogg"&#41; != 0 || strstr&#40;directory.directory_entry&#91;selected_entry&#93;.d_name, ".OGG"&#41; != 0&#41;&#123;
					strcpy&#40;fileToPlay, curDir&#41;;


					if &#40;curDir&#91;strlen&#40;curDir&#41;-1&#93; != '/'&#41;&#123;
						strcat&#40;fileToPlay, "/"&#41;;
					&#125;
					strcat&#40;fileToPlay, directory.directory_entry&#91;selected_entry&#93;.d_name&#41;;
					play&#40;fileToPlay, 0, ""&#41;;
					sceKernelDelayThread&#40;200000&#41;;
				&#125;
			&#125; else if &#40;directory.directory_entry&#91;selected_entry&#93;.d_stat.st_attr == 16&#41;
			&#123;	
				if &#40;curDir&#91;strlen&#40;curDir&#41;-1&#93; != '/'&#41;&#123;
					strcat&#40;curDir, "/"&#41;;
				&#125;
				strcat&#40;curDir, directory.directory_entry&#91;selected_entry&#93;.d_name&#41;;
				opendir_close&#40;&directory&#41;;
				selected_entry = 0;
				top_entry = 0;
				result = opendir_open&#40;&directory, curDir&#41;;
				sortDirectory&#40;directory&#41;;
				sceKernelDelayThread&#40;200000&#41;;
			&#125;
		&#125; else if &#40;controller.Buttons & PSP_CTRL_CIRCLE&#41;
		&#123;
				opendir_close&#40;&directory&#41;;
				directoryUp&#40;curDir&#41;;
				selected_entry = 0;
				top_entry = 0;
				result = opendir_open&#40;&directory, curDir&#41;;
				sortDirectory&#40;directory&#41;;
				sceKernelDelayThread&#40;200000&#41;;
		&#125; else if &#40;controller.Buttons & PSP_CTRL_SQUARE&#41;
		&#123;
				//Controllo se è una directory&#58;
				if &#40;directory.directory_entry&#91;selected_entry&#93;.d_stat.st_attr == 16&#41;&#123;
					strcpy&#40;dirToPlay, curDir&#41;;
					if &#40;dirToPlay&#91;strlen&#40;dirToPlay&#41;-1&#93; != '/'&#41;&#123;
						strcat&#40;dirToPlay, "/"&#41;;
					&#125;
					strcat&#40;dirToPlay, directory.directory_entry&#91;selected_entry&#93;.d_name&#41;;
					playDirectory&#40;dirToPlay&#41;;
					sceKernelDelayThread&#40;200000&#41;;
				&#125;
		&#125;
		&#125;
	opendir_close&#40;&directory&#41;;
	&#125;

//Main
int main&#40;&#41; &#123;
		  scePowerSetClockFrequency&#40;222, 222, 111&#41;;
		  scePowerSetCpuClockFrequency&#40;80&#41;;
		  scePowerSetBusClockFrequency&#40;60&#41;;
		  sceCtrlSetSamplingMode&#40;PSP_CTRL_MODE_ANALOG&#41;;
          SetupCallbacks&#40;&#41;;
		  tzset&#40;&#41;; 

          pspAudioInit&#40;&#41;;		
		  pspAudioSetVolume&#40;1, 0x8000, 0x8000&#41;;
		  main_menu&#40;&#41;;
		  pspAudioEnd&#40;&#41;;
		  sceKernelExitGame&#40;&#41;;
		  return&#40;0&#41;;
&#125;
The code of oggplayer.h:

Code: Select all

extern int OGG_defaultCPUClock;

//private functions
void OGG_Init&#40;int channel&#41;;
int OGG_Play&#40;&#41;;
void OGG_Pause&#40;&#41;;
int OGG_Stop&#40;&#41;;
void OGG_End&#40;&#41;;
void OGG_FreeTune&#40;&#41;;
int OGG_Load&#40;char *filename&#41;;
void OGG_GetTimeString&#40;char *dest&#41;;
int OGG_EndOfStream&#40;&#41;;
struct fileInfo OGG_GetInfo&#40;&#41;;
struct fileInfo OGG_GetTagInfoOnly&#40;char *filename&#41;;
int OGG_GetStatus&#40;&#41;;
int OGG_GetPercentage&#40;&#41;;
void OGG_setVolumeBoostType&#40;char *boostType&#41;;
void OGG_setVolumeBoost&#40;int boost&#41;;
int OGG_getVolumeBoost&#40;&#41;;
int OGG_getPlayingSpeed&#40;&#41;;
int OGG_setPlayingSpeed&#40;int playingSpeed&#41;;
int OGG_setMute&#40;int onOff&#41;;
void OGG_fadeOut&#40;float seconds&#41;;

//Functions for filter &#40;equalizer&#41;&#58;	
int OGG_setFilter&#40;double tFilter&#91;32&#93;, int copyFilter&#41;;
void OGG_enableFilter&#40;&#41;;
void OGG_disableFilter&#40;&#41;;
int OGG_isFilterEnabled&#40;&#41;;
int OGG_isFilterSupported&#40;&#41;;

//Manage suspend&#58;
int OGG_suspend&#40;&#41;;
int OGG_resume&#40;&#41;;

This is the makefile:

Code: Select all

TARGET = ogg
OBJS = log.o id3.o main.o mem64.o opendir.o
#To build for custom firmware&#58;
BUILD_PRX = 1
#PSP_LARGE_MEMORY = 1
PSP_FW_VERSION=371

CFLAGS = -O3 -fomit-frame-pointer -ffast-math -frename-registers -G0 -Wall
CXXFLAGS = $&#40;CFLAGS&#41; -fno-exceptions -fno-rtti
ASFLAGS = $&#40;CFLAGS&#41;
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=$&#40;shell psp-config --pspsdk-path&#41;
include $&#40;PSPSDK&#41;/lib/build.mak
And here the mistakes on having compiled:

Code: Select all

                              
psp-gcc -I. -IC&#58;/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&#58; In function 'play'&#58;
main.c&#58;446&#58; warning&#58; implicit declaration of function 'OGG_GetPercentace'
main.c&#58;567&#58; warning&#58; control reaches end of non-void function
psp-gcc -I. -IC&#58;/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&#58;/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&#58;/PSPDev/psp/sdk/include -O3 -fomit-frame-pointer -ffast-math -fr
ename-registers -G0 -Wall -D_PSP_FW_VERSION=371  -L. -LC&#58;/PSPDev/psp/sdk/lib -sp
ecs=C&#58;/PSPDev/psp/sdk/lib/prxspecs -Wl,-q,-TC&#58;/PSPDev/psp/sdk/lib/linkfile.prx
 log.o id3.o main.o mem64.o opendir.o C&#58;/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&#58; In function `play'&#58;
main.c&#58;&#40;.text+0xe4c&#41;&#58; undefined reference to `OGG_Init'
main.c&#58;&#40;.text+0xe7c&#41;&#58; undefined reference to `OGG_Load'
main.c&#58;&#40;.text+0xe90&#41;&#58; undefined reference to `OGG_Play'
main.c&#58;&#40;.text+0xea0&#41;&#58; undefined reference to `OGG_GetTimeString'
main.c&#58;&#40;.text+0xedc&#41;&#58; undefined reference to `OGG_GetPercentace'
main.c&#58;&#40;.text+0x1000&#41;&#58; undefined reference to `OGG_Pause'
main.c&#58;&#40;.text+0x108c&#41;&#58; undefined reference to `OGG_EndOfStream'
main.c&#58;&#40;.text+0x10a0&#41;&#58; undefined reference to `OGG_End'
main.c&#58;&#40;.text+0x116c&#41;&#58; undefined reference to `OGG_End'
C&#58;/PSPDev/psp/sdk/lib\libpspaudiolib.a&#40;pspaudiolib.o&#41;&#58; In function `pspAudioEnd'
&#58;
&#58; undefined reference to `sceAudioChRelease'
C&#58;/PSPDev/psp/sdk/lib\libpspaudiolib.a&#40;pspaudiolib.o&#41;&#58; In function `pspAudioInit
'&#58;
&#58; undefined reference to `sceAudioChReserve'
C&#58;/PSPDev/psp/sdk/lib\libpspaudiolib.a&#40;pspaudiolib.o&#41;&#58; In function `pspAudioInit
'&#58;
&#58; undefined reference to `sceAudioChRelease'
C&#58;/PSPDev/psp/sdk/lib\libpspaudiolib.a&#40;pspaudiolib.o&#41;&#58; In function `pspAudioOutB
locking'&#58;
&#58; undefined reference to `sceAudioOutputPannedBlocking'
collect2&#58; ld returned 1 exit status
make&#58; *** &#91;mp3.elf&#93; Error 1

                                   
Is there some solution?
jsharrad
Posts: 100
Joined: Thu Oct 20, 2005 3:06 am

Post by jsharrad »

Looks like you need to link the oggplayer object that you compile with oggplayer.c and switch your ordering of your libs some, like -lpspaudio should come after -lpspaudiolib.
Pirata Nervo
Posts: 409
Joined: Tue Oct 09, 2007 4:22 am

Post by Pirata Nervo »

added this to your OBJS:
oggplayer.o

and -lpspaudio to your LIBS
of course you must have the oggplayer.c and .h in the same directory as the source code
Image
Upgrade your PSP
jsharrad
Posts: 100
Joined: Thu Oct 20, 2005 3:06 am

Post by jsharrad »

and if after all that it still doesn't compile, you may want to spell percentage correctly on line 446 ;)
nikocronaldo
Posts: 31
Joined: Sun Feb 24, 2008 7:19 am

Post by nikocronaldo »

I have solved the majority of errors, but now it has given me these:

Code: Select all

                            
psp-gcc -I. -IC&#58;/PSPDev/psp/sdk/include -O3 -fomit-frame-pointer -ffast-math -fr
ename-registers -G0 -Wall -D_PSP_FW_VERSION=371  -L. -LC&#58;/PSPDev/psp/sdk/lib -sp
ecs=C&#58;/PSPDev/psp/sdk/lib/prxspecs -Wl,-q,-TC&#58;/PSPDev/psp/sdk/lib/linkfile.prx
 log.o id3.o main.o mem64.o opendir.o oggplayer.o player.o pspaudiolib.o C&#58;/PSPD
ev/psp/sdk/lib/prxexports.o -lmad -lvorbisidec -lm -lpspgu -lpspgum -lpsppower -
lpsphprm -lpspusb -lpspusbstor -lpspaudiolib -logg -lpspaudio -lpspaudiocodec -l
pspdebug -lpspdisplay -lpspge -lpspctrl -lpspsdk -lc -lpspnet -lpspnet_inet -lps
pnet_apctl -lpspnet_resolver -lpsputility -lpspuser -lpspkernel -o ogg.elf
pspaudiolib.o&#58; In function `pspReleaseAudio'&#58;
pspaudiolib.c&#58;&#40;.text+0x90&#41;&#58; undefined reference to `sceAudioOutput2GetRestSample
'
pspaudiolib.o&#58; In function `pspAudioSetFrequency'&#58;
pspaudiolib.c&#58;&#40;.text+0x2ec&#41;&#58; undefined reference to `sceAudioOutput2GetRestSampl
e'
pspaudiolib.o&#58; In function `pspAudioEnd'&#58;
pspaudiolib.c&#58;&#40;.text+0x3e4&#41;&#58; undefined reference to `sceAudioOutput2GetRestSampl
e'
pspaudiolib.o&#58; In function `pspAudioInit'&#58;
pspaudiolib.c&#58;&#40;.text+0x4e8&#41;&#58; undefined reference to `sceAudioOutput2GetRestSampl
e'
pspaudiolib.c&#58;&#40;.text+0x768&#41;&#58; undefined reference to `sceAudioOutput2GetRestSampl
e'
collect2&#58; ld returned 1 exit status
make&#58; *** &#91;ogg.elf&#93; Error 1

The makefile:

Code: Select all

TARGET = ogg
OBJS = log.o id3.o main.o mem64.o opendir.o oggplayer.o player.o pspaudiolib.o 
#To build for custom firmware&#58;
BUILD_PRX = 1
#PSP_LARGE_MEMORY = 1
PSP_FW_VERSION=371

CFLAGS = -O3 -fomit-frame-pointer -ffast-math -frename-registers -G0 -Wall
CXXFLAGS = $&#40;CFLAGS&#41; -fno-exceptions -fno-rtti
ASFLAGS = $&#40;CFLAGS&#41;
LIBDIR =

LIBS =  -lmad -lvorbisidec -lm \
       -lpspgu -lpspgum -lpsppower \
       -lpsphprm -lpspusb -lpspusbstor -lpspaudiolib -logg -lpspaudio -lpspaudiocodec
LDFLAGS =
EXTRA_TARGETS = EBOOT.PBP
PSP_EBOOT_TITLE = OGG Sample
PSP_EBOOT_ICON = ICON0.PNG
PSPSDK=$&#40;shell psp-config --pspsdk-path&#41;
include $&#40;PSPSDK&#41;/lib/build.mak 
nikocronaldo
Posts: 31
Joined: Sun Feb 24, 2008 7:19 am

Post by nikocronaldo »

Excuse me this post,I solved the error,but it doesn't work in FAT or in SLIM.

I put you a link with all the files that I have used: the main, libraries, makefile : http://d01.megashares.com/?d01=f6292f9
It's rare :( . Very thanks to all ;)
J.F.
Posts: 2906
Joined: Sun Feb 22, 2004 11:41 am

Post by J.F. »

You might want to check out a more simple player first. It seems you really don't understand the code, so you don't understand what to cut and what to leave. Just do a search on flac as I added flac playing to the simple ogg example posted here. That should help you find the proper thread.
nikocronaldo
Posts: 31
Joined: Sun Feb 24, 2008 7:19 am

Post by nikocronaldo »

Thanks ;) I saw your ogg player,but i don't have libFLAC,libvorbis and libvorbisfile, because I have a Pack of Marce82.
J.F.
Posts: 2906
Joined: Sun Feb 22, 2004 11:41 am

Post by J.F. »

If you're using Windows, someone here built a recent toolchain and made an installer for it and a bunch of the libs. You'll find all that here:

http://sourceforge.net/project/showfile ... _id=223830
nikocronaldo
Posts: 31
Joined: Sun Feb 24, 2008 7:19 am

Post by nikocronaldo »

J.F. wrote:If you're using Windows, someone here built a recent toolchain and made an installer for it and a bunch of the libs. You'll find all that here:

http://sourceforge.net/project/showfile ... _id=223830
Oh,great! Thanks you,I search it ;).

I have other error:

Code: Select all

                              
psp-gcc -I. -IC&#58;/PSPDev/psp/sdk/include -O3 -G0 -Wall -D_PSP_FW_VERSION=371   -c
 -o main.o main.c
main.c&#58;55&#58; warning&#58; data definition has no type or storage class
main.c&#58;55&#58; warning&#58; type defaults to 'int' in declaration of 'PSP_HEAP_SIZE_MAX'

psp-gcc -I. -IC&#58;/PSPDev/psp/sdk/include -O3 -G0 -Wall -D_PSP_FW_VERSION=371   -c
 -o pspaudiolib.o pspaudiolib.c
psp-gcc -I. -IC&#58;/PSPDev/psp/sdk/include -O3 -G0 -Wall -D_PSP_FW_VERSION=371  -L.
 -LC&#58;/PSPDev/psp/sdk/lib -specs=C&#58;/PSPDev/psp/sdk/lib/prxspecs -Wl,-q,-TC&#58;/PSPDe
v/psp/sdk/lib/linkfile.prx   log.o id3.o mp3player.o main.o mem64.o opendir.o pl
ayer.o oggplayer.o pspaudiolib.o C&#58;/PSPDev/psp/sdk/lib/prxexports.o -lmad -lpspa
udiolib -lpspaudio -lpsppower -lpsphprm -lpspaudiocodec -lFLAC -lvorbisfile -lvo
rbis -logg -lpspaudiolib -lpspaudio -lpsppower -lm -lpspdebug -lpspdisplay -lpsp
ge -lpspctrl -lpspsdk -lc -lpspnet -lpspnet_inet -lpspnet_apctl -lpspnet_resolve
r -lpsputility -lpspuser -lpspkernel -o mp3.elf
pspaudiolib.o&#58; In function `pspReleaseAudio'&#58;
pspaudiolib.c&#58;&#40;.text+0x90&#41;&#58; undefined reference to `sceAudioOutput2GetRestSample
'
pspaudiolib.o&#58; In function `pspAudioSetFrequency'&#58;
pspaudiolib.c&#58;&#40;.text+0x2ec&#41;&#58; undefined reference to `sceAudioOutput2GetRestSampl
e'
pspaudiolib.o&#58; In function `pspAudioEnd'&#58;
pspaudiolib.c&#58;&#40;.text+0x3e4&#41;&#58; undefined reference to `sceAudioOutput2GetRestSampl
e'
pspaudiolib.o&#58; In function `pspAudioInit'&#58;
pspaudiolib.c&#58;&#40;.text+0x4e8&#41;&#58; undefined reference to `sceAudioOutput2GetRestSampl
e'
pspaudiolib.c&#58;&#40;.text+0x770&#41;&#58; undefined reference to `sceAudioOutput2GetRestSampl
e'
collect2&#58; ld returned 1 exit status
make&#58; *** &#91;mp3.elf&#93; Error 1

                                     
This is my makefile:

Code: Select all


TARGET = mp3
OBJS = log.o id3.o mp3player.o main.o mem64.o opendir.o player.o oggplayer.o pspaudiolib.o

BUILD_PRX = 1
PSP_FW_VERSION = 371

CFLAGS = -O3 -G0 -Wall
CXXFLAGS = $&#40;CFLAGS&#41; -fno-exceptions -fno-rtti
ASFLAGS = $&#40;CFLAGS&#41;
LIBDIR =



LIBS = -lmad -lpspaudiolib -lpspaudio -lpsppower -lpsphprm -lpspaudiocodec -lFLAC -lvorbisfile -lvorbis -logg -lpspaudiolib -lpspaudio -lpsppower -lm
#-lpspdisplay_driver
LDFLAGS =
EXTRA_TARGETS = EBOOT.PBP
PSP_EBOOT_TITLE = OGG Player
PSP_EBOOT_ICON = ICON0.PNG
PSPSDK=$&#40;shell psp-config --pspsdk-path&#41;
include $&#40;PSPSDK&#41;/lib/build.mak
Do I need the lib libpspaudio_driver? I din't find it.
Insert_witty_name
Posts: 376
Joined: Wed May 10, 2006 11:31 pm

Post by Insert_witty_name »

Update your SDK.

Just for you I updated the audio part of the SDK today ;)
nikocronaldo
Posts: 31
Joined: Sun Feb 24, 2008 7:19 am

Post by nikocronaldo »

Insert_witty_name wrote:Update your SDK.

Just for you I updated the audio part of the SDK today ;)
I have Win32.

pd:If you don't mind to upload libpspaudio_driver...:)
Insert_witty_name
Posts: 376
Joined: Wed May 10, 2006 11:31 pm

Post by Insert_witty_name »

You don't need the driver part of the library.

This update gives you the perfect opportunity to install the SDK as it was meant to be and not use one of those pre-compiled toolchains.
nikocronaldo
Posts: 31
Joined: Sun Feb 24, 2008 7:19 am

Post by nikocronaldo »

Insert_witty_name wrote:You don't need the driver part of the library.

This update gives you the perfect opportunity to install the SDK as it was meant to be and not use one of those pre-compiled toolchains.
I'll install it...but Cygwin can be late to install xD,thanks you.
J.F.
Posts: 2906
Joined: Sun Feb 22, 2004 11:41 am

Post by J.F. »

If you look in LightMP3, sakya used the "new" stereo sound routines directly in his code in place of the pspaudio lib. You find those undefined functions in his source in src/players/pspaudiolib.c and the corresponding h file.
Post Reply