goom_core.c
来自「linux下的MPEG1」· C语言 代码 · 共 894 行 · 第 1/3 页
C
894 行
zoomFilterFastRGB (goomInfo, goomInfo->p1, goomInfo->p2, pzfd, goomInfo->screen.width, goomInfo->screen.height, goomInfo->update.switchIncr, goomInfo->update.switchMult); /* * Affichage tentacule */ goomInfo->tentacles_fx.apply(&goomInfo->tentacles_fx, goomInfo->p1, goomInfo->p2, goomInfo); goomInfo->star_fx.apply (&goomInfo->star_fx,goomInfo->p2,goomInfo->p1,goomInfo); /* * Affichage de texte */ { /*char title[1024];*/ char text[64]; /* * Le message */ update_message (goomInfo, message); if (fps > 0) { sprintf (text, "%2.0f fps", fps); goom_draw_text (goomInfo->p1,goomInfo->screen.width,goomInfo->screen.height, 10, 24, text, 1, 0); } /* * Le titre */ if (songTitle != NULL) { strncpy (goomInfo->update.titleText, songTitle, 1023); goomInfo->update.titleText[1023]=0; goomInfo->update.timeOfTitleDisplay = 200; } if (goomInfo->update.timeOfTitleDisplay) { goom_draw_text (goomInfo->p1,goomInfo->screen.width,goomInfo->screen.height, goomInfo->screen.width / 2, goomInfo->screen.height / 2 + 7, goomInfo->update.titleText, ((float) (190 - goomInfo->update.timeOfTitleDisplay) / 10.0f), 1); goomInfo->update.timeOfTitleDisplay--; if (goomInfo->update.timeOfTitleDisplay < 4) goom_draw_text (goomInfo->p2,goomInfo->screen.width,goomInfo->screen.height, goomInfo->screen.width / 2, goomInfo->screen.height / 2 + 7, goomInfo->update.titleText, ((float) (190 - goomInfo->update.timeOfTitleDisplay) / 10.0f), 1); } } /* * Gestion du Scope */ /* * arret demande */ if ((goomInfo->update.stop_lines & 0xf000)||(!goomInfo->curGState->drawScope)) { float param1, param2, amplitude; int couleur; int mode; choose_a_goom_line (goomInfo, ¶m1, ¶m2, &couleur, &mode, &litude,1); couleur = GML_BLACK; goom_lines_switch_to (goomInfo->gmline1, mode, param1, amplitude, couleur); goom_lines_switch_to (goomInfo->gmline2, mode, param2, amplitude, couleur); goomInfo->update.stop_lines &= 0x0fff; } /* * arret aleatore.. changement de mode de ligne.. */ if (goomInfo->update.lineMode != goomInfo->update.drawLinesDuration) { goomInfo->update.lineMode--; if (goomInfo->update.lineMode == -1) goomInfo->update.lineMode = 0; } else if ((goomInfo->cycle%80==0)&&(goom_irand(goomInfo->gRandom,5)==0)&&goomInfo->update.lineMode) goomInfo->update.lineMode--; if ((goomInfo->cycle % 120 == 0) && (goom_irand(goomInfo->gRandom,4) == 0) && (goomInfo->curGState->drawScope)) { if (goomInfo->update.lineMode == 0) goomInfo->update.lineMode = goomInfo->update.drawLinesDuration; else if (goomInfo->update.lineMode == goomInfo->update.drawLinesDuration) { float param1, param2, amplitude; int couleur1,couleur2; int mode; goomInfo->update.lineMode--; choose_a_goom_line (goomInfo, ¶m1, ¶m2, &couleur1, &mode, &litude,goomInfo->update.stop_lines); couleur2 = 5-couleur1; if (goomInfo->update.stop_lines) { goomInfo->update.stop_lines--; if (goom_irand(goomInfo->gRandom,2)) couleur2=couleur1 = GML_BLACK; } goom_lines_switch_to (goomInfo->gmline1, mode, param1, amplitude, couleur1); goom_lines_switch_to (goomInfo->gmline2, mode, param2, amplitude, couleur2); } } /* * si on est dans un goom : afficher les lignes... */ if ((goomInfo->update.lineMode != 0) || (goomInfo->sound.timeSinceLastGoom < 5)) { goomInfo->gmline2->power = goomInfo->gmline1->power; goom_lines_draw (goomInfo, goomInfo->gmline1, data[0], goomInfo->p2); goom_lines_draw (goomInfo, goomInfo->gmline2, data[1], goomInfo->p2); if (((goomInfo->cycle % 121) == 9) && (goom_irand(goomInfo->gRandom,3) == 1) && ((goomInfo->update.lineMode == 0) || (goomInfo->update.lineMode == goomInfo->update.drawLinesDuration))) { float param1, param2, amplitude; int couleur1,couleur2; int mode; choose_a_goom_line (goomInfo, ¶m1, ¶m2, &couleur1, &mode, &litude, goomInfo->update.stop_lines); couleur2 = 5-couleur1; if (goomInfo->update.stop_lines) { goomInfo->update.stop_lines--; if (goom_irand(goomInfo->gRandom,2)) couleur2=couleur1 = GML_BLACK; } goom_lines_switch_to (goomInfo->gmline1, mode, param1, amplitude, couleur1); goom_lines_switch_to (goomInfo->gmline2, mode, param2, amplitude, couleur2); } } return_val = goomInfo->p1; tmp = goomInfo->p1; goomInfo->p1 = goomInfo->p2; goomInfo->p2 = tmp; /* affichage et swappage des buffers.. */ goomInfo->cycle++; /* xine: no convolve_fx */ /* goomInfo->convolve_fx.apply(&goomInfo->convolve_fx,return_val,goomInfo->outputBuf,goomInfo); */ xine_fast_memcpy(goomInfo->outputBuf, return_val, goomInfo->screen.size * sizeof(Pixel)); return (guint32*)goomInfo->outputBuf;}/***************************************** CLOSE *****************************************/void goom_close (PluginInfo *goomInfo){ if (goomInfo->pixel != NULL) free (goomInfo->pixel); if (goomInfo->back != NULL) free (goomInfo->back); if (goomInfo->conv != NULL) free (goomInfo->conv); goomInfo->pixel = goomInfo->back = NULL; goomInfo->conv = NULL; goom_random_free(goomInfo->gRandom); goom_lines_free (&goomInfo->gmline1); goom_lines_free (&goomInfo->gmline2); /* release_ifs (); */ goomInfo->ifs_fx.free(&goomInfo->ifs_fx); goomInfo->convolve_fx.free(&goomInfo->convolve_fx); goomInfo->star_fx.free(&goomInfo->star_fx); goomInfo->tentacles_fx.free(&goomInfo->tentacles_fx); goomInfo->zoomFilter_fx.free(&goomInfo->zoomFilter_fx); free(goomInfo);}/* *** */voidchoose_a_goom_line (PluginInfo *goomInfo, float *param1, float *param2, int *couleur, int *mode, float *amplitude, int isfar){ *mode = goom_irand(goomInfo->gRandom,3); *amplitude = 1.0f; switch (*mode) { case GML_CIRCLE: if (isfar) { *param1 = *param2 = 0.47f; *amplitude = 0.8f; break; } if (goom_irand(goomInfo->gRandom,3) == 0) { *param1 = *param2 = 0; *amplitude = 3.0f; } else if (goom_irand(goomInfo->gRandom,2)) { *param1 = 0.40f * goomInfo->screen.height; *param2 = 0.22f * goomInfo->screen.height; } else { *param1 = *param2 = goomInfo->screen.height * 0.35; } break; case GML_HLINE: if (goom_irand(goomInfo->gRandom,4) || isfar) { *param1 = goomInfo->screen.height / 7; *param2 = 6.0f * goomInfo->screen.height / 7.0f; } else { *param1 = *param2 = goomInfo->screen.height / 2.0f; *amplitude = 2.0f; } break; case GML_VLINE: if (goom_irand(goomInfo->gRandom,3) || isfar) { *param1 = goomInfo->screen.width / 7.0f; *param2 = 6.0f * goomInfo->screen.width / 7.0f; } else { *param1 = *param2 = goomInfo->screen.width / 2.0f; *amplitude = 1.5f; } break; } *couleur = goom_irand(goomInfo->gRandom,6);}#define ECART_VARIATION 1.5#define POS_VARIATION 3.0#define SCROLLING_SPEED 80/* * Met a jour l'affichage du message defilant */void update_message (PluginInfo *goomInfo, char *message) { int fin = 0; if (message) { int i=1,j=0; sprintf (goomInfo->update_message.message, "%s", message); for (j=0;goomInfo->update_message.message[j];j++) if (goomInfo->update_message.message[j]=='\n') i++; goomInfo->update_message.numberOfLinesInMessage = i; goomInfo->update_message.affiche = goomInfo->screen.height + goomInfo->update_message.numberOfLinesInMessage * 25 + 105; goomInfo->update_message.longueur = strlen(goomInfo->update_message.message); } if (goomInfo->update_message.affiche) { int i = 0; char *msg = malloc(goomInfo->update_message.longueur + 1); char *ptr = msg; int pos; float ecart; message = msg; sprintf (msg, "%s", goomInfo->update_message.message); while (!fin) { while (1) { if (*ptr == 0) { fin = 1; break; } if (*ptr == '\n') { *ptr = 0; break; } ++ptr; } pos = goomInfo->update_message.affiche - (goomInfo->update_message.numberOfLinesInMessage - i)*25; pos += POS_VARIATION * (cos((double)pos / 20.0)); pos -= SCROLLING_SPEED; ecart = (ECART_VARIATION * sin((double)pos / 20.0)); if ((fin) && (2 * pos < (int)goomInfo->screen.height)) pos = (int)goomInfo->screen.height / 2; pos += 7; goom_draw_text(goomInfo->p1,goomInfo->screen.width,goomInfo->screen.height, goomInfo->screen.width/2, pos, message, ecart, 1); message = ++ptr; i++; } goomInfo->update_message.affiche --; free (msg); }}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?