KINGx - Das inoffizielle PlayStation Forum & News Portal

Normale Version: MP3 funktioniert nicht - höre nichts.
Sie sehen gerade eine vereinfachte Darstellung unserer Inhalte. Normale Ansicht mit richtiger Formatierung.
Der Titel sagt es schon: Ich höre nichts.
(Achja, ich bin ein absoluter noob!)

Meine main.c sieht folgendermaßen aus:

Code:
#include <pspdisplay.h>
#include <pspctrl.h>
#include <pspkernel.h>
#include <pspdebug.h>
#include <pspgu.h>
#include <pspaudio.h>
#include <pspaudiolib.h>
#include <psppower.h>
#include <png.h>
#include <stdio.h>
#include "graphics.h"
#include "mp3player.h"

PSP_MODULE_INFO("Final Fantasy FM", 0, 1, 1);

#define printf pspDebugScreenPrintf
#define MAX(X, Y) ((X) > (Y) ? (X) : (Y))

//------------------------------------------------------------------------------

/* 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;
}

//------------------------------------------------------------------------------

int main()
{
    Image* testpng;
    pspDebugScreenInit();
    SetupCallbacks();
    initGraphics();
    testpng = loadImage("title_screen.png");

    if(!testpng)
   {
         //laden des Bildes ist fehlgeschlagen
         printf("laden des Bildes fehlgeschlagen!\n");
    }
    else
    {
         sceDisplayWaitVblankStart();
         blitAlphaImageToScreen(0 ,0 ,480 , 272, testpng, 0, 0);
         flipScreen();
    }

    sceKernelSleepThread();
    return 0;

    scePowerSetClockFrequency(333, 333, 166);

          pspDebugScreenInit();
          SetupCallbacks();

          pspAudioInit();
          
          MP3_Init(1);
          MP3_Load("test.mp3");
          MP3_Play();
          
    return 0;
}


Makefile sieht so aus:

Code:
TARGET = blabla
OBJS = main.o graphics.o framebuffer.o mp3player.o

CFLAGS = -O2 -G0 -Wall
CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti
ASFLAGS = $(CFLAGS)

LIBDIR =
LIBS = -lpspgu -lpng -lz -lm -lmad -lpspaudiolib -lpspaudio -lpsppower
LDFLAGS =

EXTRA_TARGETS = EBOOT.PBP
PSP_EBOOT_TITLE = Final Fantasy FM

PSPSDK=$(shell psp-config --pspsdk-path)
include $(PSPSDK)/lib/build.mak


Zu Beginn dieses Tutorials ist die Rede von Cygwin und libmad. Sind diese denn dringend nötig? Also bei Cygwin bezweifle ich das mal, aber falls ich libmad brauche - wie und wo habe ich das zu implentieren?

P.S.: Ja, meine MP3 ist unter 160kbps.

Danke im Vorraus! Smile

Code:
#include &lt;pspkernel.h&gt;
#include &lt;pspdebug.h&gt;
#include &lt;pspctrl.h&gt;
#include &lt;stdlib.h&gt;
#include &lt;string.h&gt;
#include &lt;pspaudio.h&gt;
#include &lt;pspaudiolib.h&gt;
#include &lt;psppower.h&gt;

#include "mp3player.h"

PSP_MODULE_INFO("MP3", 0, 1, 1);

//------------------------Callbacks Funtion-------------------------------------

/* 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 &gt;= 0) {
sceKernelStartThread(thid, 0, 0);
}

return thid;
}

//------------------------------------------------------------------------------


int main()
{  
    scePowerSetClockFrequency(333, 333, 166);
    
    pspDebugScreenInit();
    pspAudioInit();
    MP3_Init(1);
    MP3_Load("main.mp3");
        
    while(1) {
         MP3_Play();

    }
    return 0;
}


Hier es liegt daran das direkt nach MP3_Play(); return 0; kommt. Man könnte es auch mit sceKernelSleepThread(); lösen geht aber mit einer while ist es doch sinnvoller.

Referenz-URLs