const char *MusicDriver_LibTimidity::Start(const char * const *param) { _midi.status = MIDI_STOPPED; _midi.song = NULL; if (mid_init(param == NULL ? NULL : const_cast<char *>(param[0])) < 0) { /* If init fails, it can be because no configuration was found. * If it was not forced via param, try to load it without a * configuration. Who knows that works. */ if (param != NULL || mid_init_no_config() < 0) { return "error initializing timidity"; } } DEBUG(driver, 1, "successfully initialised timidity"); _midi.options.rate = 44100; _midi.options.format = MID_AUDIO_S16LSB; _midi.options.channels = 2; #if defined(PSP) _midi.options.buffer_size = PSP_NUM_AUDIO_SAMPLES; #else _midi.options.buffer_size = _midi.options.rate; #endif #if defined(PSP) pspAudioInit(); pspAudioSetChannelCallback(_midi.options.channels, &AudioOutCallback, NULL); pspAudioSetVolume(_midi.options.channels, PSP_VOLUME_MAX, PSP_VOLUME_MAX); #endif /* PSP */ return NULL; }
static BOOL PSP_Init(void) { if (VC_Init()) return 1; pspAudioInit(); pspAudioSetChannelCallback(0, (void *)sound_callback, NULL); return 0; }
int Init(int channel) { pspAudioInit(); // init the audio psp mad_stream_init(&stream); // create the mad variables, streams etc. mad_frame_init(&frame); mad_synth_init(&synth); mad_timer_reset(&timer); pspAudioSetChannelCallback(channel, fillOutputBuffer, 0); // set the callback to the function. mutex = sceKernelCreateSema("myMutexName", 0, 1, 1, 0); // create the mutex for threading secure. pausesong = 1; // set the variable to pause so no sound is played. started = 0; // the mp3 has not yet started. file = 0; // set the file to zero fileSize = 1; filePos = 0; printf("MusicEngine is initialized.\n"); return 1; };
//********************************************************************************** // //********************************************************************************** void CMusicFileHandler::Open() { //get codecStubs int stubnum( 0 ); //CODEC_INITSTUBS OGGsetStubs( &s_Stubs[ stubnum++ ] ); MODsetStubs( &s_Stubs[ stubnum++ ] ); AHXsetStubs( &s_Stubs[ stubnum++ ] ); MP3setStubs( &s_Stubs[ stubnum++ ] ); //YMPLAYsetStubs(&s_Stubs[stubnum++]); //XMPLAYsetStubs(&s_Stubs[stubnum++]); s_CodecNum = stubnum; s_szFilePlaying = ""; pspAudioInit(); }
void Core::Reload() { Config* cfgBoot = new Config("ms0:/MbShell/config/boot.cfg"); Cfg = new Config("ms0:/MbShell/config/main.cfg"); CfgTheme = new ConfigTheme(Cfg->GetValue("theme")); Desktop::Init(); Taskbar::Init(); LCD::Init(); Cursor::Init(); WindowManager::Init(); if (cfgBoot->CheckValue("homebrewloader")) { //HomeBrewManager::Init(); //HomeBrewManager::Container->Hide(); } pspAudioInit(); delete (cfgBoot); }
int main() { pspDebugScreenInit(); SetupCallbacks(); scePowerSetClockFrequency(333, 333, 166); pspAudioInit(); SceCtrlData pad; int i; tzset(); printf("Hello World\n"); time_t now; now = time(NULL); printf("Started %s\n", ctime(&now)); MP3_Init(1); MP3_Load("test.mp3"); MP3_Play(); while(1) { sceCtrlReadBufferPositive(&pad, 1); if(pad.Buttons & PSP_CTRL_CROSS) { break; } else if(pad.Buttons & PSP_CTRL_CIRCLE) { MP3_Pause(); for(i=0; i<10; i++) { sceDisplayWaitVblankStart(); } } if (MP3_EndOfStream() == 1) { MP3_Stop(); } } MP3_Stop(); MP3_FreeTune(); sceKernelSleepThread(); return 0; }
void MP3Play(char * path) { struct ID3Tag ID3; nowplaying = oslLoadImageFilePNG(nowplayingBgPath, OSL_IN_RAM, OSL_PF_8888); mp3Play = oslLoadImageFilePNG("system/app/apollo/play.png", OSL_IN_RAM, OSL_PF_8888); mp3Pause = oslLoadImageFilePNG("system/app/apollo/pause.png", OSL_IN_RAM, OSL_PF_8888); if (!nowplaying) debugDisplay(); scePowerSetClockFrequency(333, 333, 166); pspAudioInit(); int i, mp3Min = 0; MP3ME_Init(1); ParseID3(path, &ID3); MP3ME_Load(path); MP3ME_Play(); isPlaying = 1; while (!osl_quit) { LowMemExit(); oslStartDrawing(); oslClearScreen(RGB(0,0,0)); oslReadKeys(); oslIntraFontSetStyle(Roboto, fontSize, BLACK, 0, 0); if (MP3ME_playingTime > 59) { mp3Min += 1; MP3ME_playingTime = 0; } oslDrawImageXY(nowplaying, 0, 0); oslDrawStringf(240,76, "Playing: %.19s", folderIcons[current].name); oslDrawStringf(240,96, "Title: %.21s", ID3.ID3Title); oslDrawStringf(240,116, "Artist: %.20s", ID3.ID3Artist); oslDrawStringf(240,136, "Album: %.21s", ID3.ID3Album); oslDrawStringf(240,156, "Year: %.22s", ID3.ID3Year); oslDrawStringf(240,176, "Genre: %.21s", ID3.ID3GenreText); oslDrawStringf(435,206, "0%d:%.f", mp3Min, MP3ME_playingTime); if (MP3ME_isPlaying == 1) oslDrawImageXY(mp3Play, 230, 224); if (MP3ME_isPlaying == 0) oslDrawImageXY(mp3Pause, 230, 224); battery(370,2,1); digitaltime(420,4,0,hrTime); volumeController(); if(osl_keys->pressed.select) { oslDeleteImage(nowplaying); oslDeleteImage(mp3Play); oslDeleteImage(mp3Pause); return; } if(MP3ME_isPlaying == 1 && osl_keys->pressed.cross) { oslPlaySound(KeypressStandard, 1); MP3ME_Pause(); for(i=0; i<10; i++) { sceDisplayWaitVblankStart(); } } else if (MP3ME_isPlaying == 0 && osl_keys->pressed.cross) { MP3ME_Play(); } if (MP3ME_EndOfStream() == 1) { isPlaying = 0; endAudioLib(); MP3ME_Stop(); releaseAudio(); MP3ME_Play(); } if(osl_keys->pressed.circle) { endAudioLib(); MP3ME_Stop(); releaseAudio(); oslDeleteImage(nowplaying); oslDeleteImage(mp3Play); oslDeleteImage(mp3Pause); isPlaying = 0; setCpuBoot(); //Restore previous CPU state return; } if (osl_keys->pressed.square) { powermenu(); } if (osl_keys->pressed.L) { oslPlaySound(Lock, 1); lockscreen(); } captureScreenshot(); oslEndDrawing(); oslEndFrame(); oslSyncFrame(); } }
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //Init pspaudiolib: /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// int initAudioLib(){ pspAudioInit(); return 0; }
void InitAudio() { pspAudioInit(); pspAudioSetChannelCallback(0, AudioCallback, NULL); }
bool Core::Init() { // Open config file Config* cfgBoot = new Config("ms0:/MbShell/config/boot.cfg"); Cfg = new Config("ms0:/MbShell/config/main.cfg"); CfgTheme = new ConfigTheme(Cfg->GetValue("theme")); // Init all the shell components Graphics::Init(); Image * screenbuffer = Graphics::LoadPNG(CfgTheme->GetPathValue("b_background").c_str()); if (!screenbuffer || !cfgBoot->CheckValue("showbuffer")) { screenbuffer = Graphics::CreateImage(480, 272); Graphics::ClearImage(0x00000000, screenbuffer); } Graphics::BlitImageToScreen(0, 0, screenbuffer->imageWidth, screenbuffer->imageHeight, screenbuffer, 0, 0); Graphics::FlipScreen(); Image * system = Graphics::LoadPNG(CfgTheme->GetPathValue("b_system").c_str()); Image * bar = Graphics::LoadPNG(CfgTheme->GetPathValue("b_bar").c_str()); Graphics::BlitAlphaImageToImage(0, 0, system->imageWidth, system->imageHeight, system, 75, 90, screenbuffer); Graphics::BlitAlphaImageToImage(0, 0, bar->imageWidth-250, bar->imageHeight, bar, 101, 163, screenbuffer); Graphics::BlitImageToScreen(0, 0, screenbuffer->imageWidth, screenbuffer->imageHeight, screenbuffer, 0, 0); Graphics::FlipScreen(); Desktop::Init(); Taskbar::Init(); LCD::Init(); Image * controller = Graphics::LoadPNG(CfgTheme->GetPathValue("b_controller").c_str()); Graphics::BlitAlphaImageToImage(0, 0, controller->imageWidth, controller->imageHeight, controller, 170, 90, screenbuffer); Graphics::BlitAlphaImageToImage(0, 0, bar->imageWidth-150, bar->imageHeight, bar, 101, 163, screenbuffer); Graphics::BlitImageToScreen(0, 0, screenbuffer->imageWidth, screenbuffer->imageHeight, screenbuffer, 0, 0); Graphics::FlipScreen(); Cursor::Init(); Controller::Init(); Image * wm = Graphics::LoadPNG(CfgTheme->GetPathValue("b_windowmanager").c_str()); Graphics::BlitAlphaImageToImage(0, 0, wm->imageWidth, wm->imageHeight, wm, 255, 90, screenbuffer); Graphics::BlitAlphaImageToImage(0, 0, bar->imageWidth-75, bar->imageHeight, bar, 101, 163, screenbuffer); Graphics::BlitImageToScreen(0, 0, screenbuffer->imageWidth, screenbuffer->imageHeight, screenbuffer, 0, 0); Graphics::FlipScreen(); WindowManager::Init(); if (cfgBoot->CheckValue("iconmanager")) { IconManager::Init(); } PluginManager::Init(); pspAudioInit(); Image * desktop = Graphics::LoadPNG(CfgTheme->GetPathValue("b_desktop").c_str()); Graphics::BlitAlphaImageToImage(0, 0, desktop->imageWidth, desktop->imageHeight, desktop, 340, 90, screenbuffer); Graphics::BlitAlphaImageToImage(0, 0, bar->imageWidth, bar->imageHeight, bar, 101, 163, screenbuffer); Graphics::BlitImageToScreen(0, 0, screenbuffer->imageWidth, screenbuffer->imageHeight, screenbuffer, 0, 0); Graphics::FlipScreen(); if (cfgBoot->CheckValue("homebrewloader")) { HomeBrewManager::Init(); HomeBrewManager::Container->Hide(); } if (cfgBoot->CheckValue("startusb")) USBManager::ToggleUSB(1); Graphics::FreeImage(controller); Graphics::FreeImage(system); Graphics::FreeImage(wm); Graphics::FreeImage(desktop); Graphics::FreeImage(bar); Graphics::FreeImage(screenbuffer); #ifdef DBG // Debug console Console::Init(); Console::Print("Artillery Debug Console"); #endif delete (cfgBoot); return true; }