static PyObject* sound_stop(PySound *self, PyObject *args, PyObject *kwargs) { if (!PyArg_ParseTuple(args, ":stop")) return NULL; oslStopSound(self->pSound); Py_INCREF(Py_None); return Py_None; }
int soundPlay(char * path) { 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); OSL_SOUND * sound = oslLoadSoundFile(path, OSL_FMT_NONE); if (!nowplaying) debugDisplay(); oslInitAudioME(3); oslPlaySound(sound,0); isPlaying = 1; int Play = 1; while (!osl_quit) { LowMemExit(); oslStartDrawing(); oslClearScreen(RGB(0,0,0)); oslReadKeys(); oslIntraFontSetStyle(Roboto, fontSize, BLACK, 0, 0); oslDrawImageXY(nowplaying, 0, 0); if (Play == 1) oslDrawImageXY(mp3Play, 230, 224); else if (Play == 0) oslDrawImageXY(mp3Pause, 230, 224); oslDrawStringf(240,76, "%.28s", folderIcons[current].name); battery(370,2,1); digitaltime(420,4,0,hrTime); volumeController(); if(osl_keys->pressed.select) { oslDeleteImage(nowplaying); oslDeleteImage(mp3Play); oslDeleteImage(mp3Pause); return 1; } if(osl_keys->pressed.cross && Play == 1) { Play = 0; oslPlaySound(KeypressStandard, 1); oslPauseSound(sound,-1); } else if(osl_keys->pressed.cross && Play == 0) { Play = 1; oslPlaySound(KeypressStandard, 1); oslPauseSound(sound,-1); } if(osl_keys->pressed.circle) { isPlaying = 0; oslStopSound(sound); oslDeleteSound(sound); oslDeleteImage(nowplaying); oslDeleteImage(mp3Play); oslDeleteImage(mp3Pause); return 1; } if (osl_keys->pressed.square) { powermenu(); } if (osl_keys->pressed.L) { oslPlaySound(Lock, 1); lockscreen(); } captureScreenshot(); oslEndDrawing(); oslEndFrame(); oslSyncFrame(); } oslStopSound(sound); oslDeleteSound(sound); oslDeleteImage(nowplaying); oslDeleteImage(mp3Play); oslDeleteImage(mp3Pause); return 0; }