// 20110501/supah: replaced this for non-console windowed version :) //int main(int argc, char* argv[]) { int PASCAL WinMain(HINSTANCE hi, HINSTANCE pi, LPSTR cmd, int show) { Window window(RESX, RESY, BPP, TITLE, FULLSCREEN); GLContext glc(window); EffectPlayer effectPlayer; glc.setDefaultParameters(); FSOUND_File_SetCallbacks(memopen, memclose, memread, memseek, memtell); FMUSIC_MODULE* mod = FMUSIC_LoadSong("", 0); FMUSIC_PlaySong(mod); float startTime = (float) FMUSIC_GetTime(mod); // timeGetTime(); while(window.active() && effectPlayer.isRunning()) { //float time = (float)timeGetTime() - startTime; float time = FMUSIC_GetTime(mod) - startTime; effectPlayer.run(time); glc.flush(); } FMUSIC_StopSong(mod); return 0; }
void SOUND_play_song(int idx) { g_MusicIndex = idx ; mod = FMUSIC_LoadSong("", NULL); FMUSIC_PlaySong(mod); }
int main() { FMUSIC_MODULE *mod = NULL; if (FSOUND_GetVersion() < FMOD_VERSION) { printf("Error : You are using the wrong DLL version! You should be using FMOD %.02f\n", FMOD_VERSION); exit(1); } /* INITIALIZE */ if (!FSOUND_Init(32000, 64, 0)) { printf("%s\n", FMOD_ErrorString(FSOUND_GetError())); exit(1); } /* LOAD SONG */ mod = FMUSIC_LoadSong("../../media/invtro94.s3m"); if (!mod) { printf("%s\n", FMOD_ErrorString(FSOUND_GetError())); exit(1); } FMUSIC_PlaySong(mod); /* UPDATE INTERFACE */ printf("Press any key to quit\n"); printf("=========================================================================\n"); printf("Playing %s...\n", FMUSIC_GetName(mod)); do { printf("order = %d/%d, row = %d/%d channels playing = %d cpu usage = %.02f%% \r", FMUSIC_GetOrder(mod), FMUSIC_GetNumOrders(mod), FMUSIC_GetRow(mod), FMUSIC_GetPatternLength(mod, FMUSIC_GetOrder(mod)), FSOUND_GetChannelsPlaying(), FSOUND_GetCPUUsage()); Sleep(10); } while (!kbhit()); getch(); printf("\n"); /* FREE SONG AND SHUT DOWN */ FMUSIC_FreeSong(mod); FSOUND_Close(); return 0; }
char CFMOD::PlayMusic(char* szFilename) { if(!bfmod) return 0; StopMusic(); fmusic=FMUSIC_LoadSong(szFilename); if(fmusic) { FMUSIC_SetMasterVolume(fmusic,mvol); return FMUSIC_PlaySong(fmusic); } return 0; }
int cnsSynth_LoadMusic() { #ifdef __DELTA delta_decode(music_data,MUSICSIZE); #endif // FSOUND_File_SetCallbacks(memread, memseek, memtell); FSOUND_File_Read=memread; FSOUND_File_Seek=memseek; FSOUND_File_Tell=memtell; if (!FSOUND_Init(44100)) return 0; mod=FMUSIC_LoadSong(sampleloadcallback,noteloadcallback); return 1; }
/// <summary> Loads the music. </summary> /// /// <returns> The music. </returns> int CSound::LoadMusic() { m_BC1 = FMUSIC_LoadSong("midi/BC1.mid"); m_BC2 = FMUSIC_LoadSong("midi/BC2.mid"); m_BC3 = FMUSIC_LoadSong("midi/BC3.mid"); m_BC5 = FMUSIC_LoadSong("midi/BC5.mid"); m_BC6 = FMUSIC_LoadSong("midi/BC6.mid"); m_BC8 = FMUSIC_LoadSong("midi/BC8.mid"); m_BC9 = FMUSIC_LoadSong("midi/BC9.mid"); if (!m_BC1 || !m_BC2 || !m_BC3 || !m_BC5 || !m_BC6 || !m_BC8 || !m_BC9) return 0; return 1; }
u32 Gdl_playSong(u8* song,u32 size) { if(!song || !size) return 0; if(!soundWasInit) Gdl_iniSound(); #ifdef useMiniFmod MEMFILE mzk ; mzk.pos=0 ; mzk.length=size; mzk.data=(char*)song; gzk = FMUSIC_LoadSong((char*)&mzk,0); if(gzk) { FMUSIC_PlaySong(gzk); return 1; } #endif return 0; }
//=========================================================================== // DM_FModExtPlayFile //=========================================================================== int DM_FModExtPlayFile(const char *path, int looped) { if(!ext_inited) return false; DM_FModExtReset(); // Try playing as a module first. if((module = FMUSIC_LoadSong(path))) { FMUSIC_SetLooping(module, looped); } else { // Try as a stream. stream = FSOUND_Stream_Open(path, looped ? FSOUND_LOOP_NORMAL : 0, 0, 0); if(!stream) return false; // Failed...! } DM_FModExtStartPlaying(); //ext_looped_play = looped; return true; }
bool C4MusicFileMID::Play(bool loop) { // check existance if (!FileExists(FileName)) // try extracting it if (!ExtractFile()) // doesn't exist - or file is corrupt return false; // init fmusic mod = FMUSIC_LoadSong(SongExtracted ? Config.AtTempPath(C4CFN_TempMusic2) : FileName); if (!mod) { LogF("FMod: %s", FMOD_ErrorString(FSOUND_GetError())); return false; } // Play Song FMUSIC_PlaySong(mod); return true; }
BOOL C4MusicFileMID::Play(BOOL loop) { // check existance if(!FileExists(FileName)) // try extracting it if(!ExtractFile()) // doesn't exist - or file is corrupt return FALSE; // init fmusic mod = FMUSIC_LoadSong(SongExtracted ? Config.AtTempPath(C4CFN_TempMusic2) : FileName); if (!mod) { sprintf(OSTR, "FMod: %s", FMOD_ErrorString(FSOUND_GetError())); Log(OSTR); return FALSE; } // Play Song FMUSIC_PlaySong(mod); return TRUE; }
/* [ [DESCRIPTION] [PARAMETERS] [RETURN_VALUE] [REMARKS] [SEE_ALSO] ] */ void main(int argc, char *argv[]) { #ifdef USEFMOD FMUSIC_MODULE *mod; #ifndef USEMEMLOAD FSOUND_File_SetCallbacks(fileopen, fileclose, fileread, fileseek, filetell); #else FSOUND_File_SetCallbacks(memopen, memclose, memread, memseek, memtell); #endif #endif if (argc < 2) { printf("-------------------------------------------------------------\n"); printf("MINIFMOD example XM player.\n"); printf("Copyright (c) Firelight Multimedia, 2000.\n"); printf("-------------------------------------------------------------\n"); printf("Syntax: simplest infile.xm\n\n"); return; } #ifdef USEFMOD // ========================================================================================== // INITIALIZE // ========================================================================================== if (!FSOUND_Init(44100, 0)) { printf("Error upon initialization\n"); return; } // ========================================================================================== // LOAD SONG // ========================================================================================== mod = FMUSIC_LoadSong(argv[1], NULL); //sampleloadcallback); if (!mod) { printf("Error loading song\n"); return; } // ========================================================================================== // PLAY SONG // ========================================================================================== FMUSIC_PlaySong(mod); #endif printf("Press any key to quit\n"); printf("=========================================================================\n"); printf("Playing song...\n"); { char key = 0; do { int ord = 0, row = 0; float mytime = 0; if (kbhit()) { key = getch(); } #ifdef USEFMOD ord = FMUSIC_GetOrder(mod); row = FMUSIC_GetRow(mod); mytime = (float)FMUSIC_GetTime(mod) / 1000.0f; #endif printf("ord %2d row %2d seconds %5.02f %s \r", ord, row, mytime, (row % 8 ? " " : "TICK")); } while (key != 27); } printf("\n"); #ifdef USEFMOD FMUSIC_FreeSong(mod); FSOUND_Close(); #endif }
/* [ [DESCRIPTION] [PARAMETERS] [RETURN_VALUE] [REMARKS] [SEE_ALSO] ] */ void main(int argc, char *argv[]) { #ifdef USEFMOD FMUSIC_MODULE *mod; #ifndef USEMEMLOAD FSOUND_File_SetCallbacks(fileopen, fileclose, fileread, fileseek, filetell); #else FSOUND_File_SetCallbacks(memopen, memclose, memread, memseek, memtell); #endif #endif if (argc < 2) { printf("-------------------------------------------------------------\n"); printf("MINIFMOD example XM player.\n"); printf("Copyright (c) Firelight Technologies, 2000-2004.\n"); printf("-------------------------------------------------------------\n"); printf("Syntax: simplest infile.xm\n\n"); return; } #ifdef USEFMOD #if USE_XAUDIO2_ENGINE // Init FMod XAudio2 Driver FMUSIC_XAudio2_Init(); #endif // ========================================================================================== // LOAD SONG // ========================================================================================== mod = FMUSIC_LoadSong(argv[1], NULL); //sampleloadcallback); if (!mod) { printf("Error loading song\n"); return; } // ========================================================================================== // PLAY SONG // ========================================================================================== FMUSIC_PlaySong(mod); #endif printf("Press Esc key to quit\n"); printf("=========================================================================\n"); printf("Playing song...\n"); { char key = 0; do { int ord = 0, row = 0; float mytime = 0; if (kbhit()) { key = getch(); } #ifdef USEFMOD ord = FMUSIC_GetOrder(mod); row = FMUSIC_GetRow(mod); mytime = (float)FMUSIC_GetTime(mod) / 1000.0f; #endif printf("ord %2d row %2d seconds %5.02f %s \r", ord, row, mytime, (row % 8 ? " " : "TICK")); } while (key != VK_ESCAPE); } printf("\n"); #ifdef USEFMOD FMUSIC_FreeSong(mod); #endif }
/* [ [DESCRIPTION] [PARAMETERS] [RETURN_VALUE] [REMARKS] [SEE_ALSO] ] */ void main(int argc, char *argv[]) { #ifdef USEFMOD FMUSIC_MODULE *mod; #ifndef USEMEMLOAD FSOUND_File_SetCallbacks(fileopen, fileclose, fileread, fileseek, filetell); #else FSOUND_File_SetCallbacks(memopen, memclose, memread, memseek, memtell); #endif #endif #ifdef USEFMOD // ========================================================================================== // LOAD SONG // ========================================================================================== mod = FMUSIC_LoadSong(MAKEINTRESOURCE(CHIPTUNE_MUS), NULL); //sampleloadcallback); if (!mod) { printf("Error loading song\n"); return; } // ========================================================================================== // PLAY SONG // ========================================================================================== FMUSIC_PlaySong(mod); #endif printf("Press any key to quit\n"); printf("=========================================================================\n"); printf("Playing song...\n"); { char key = 0; do { int ord = 0, row = 0; float mytime = 0; if (kbhit()) { key = getch(); } #ifdef USEFMOD ord = FMUSIC_GetOrder(mod); row = FMUSIC_GetRow(mod); mytime = (float)FMUSIC_GetTime(mod) / 1000.0f; #endif printf("ord %2d row %2d seconds %5.02f %s \r", ord, row, mytime, (row % 8 ? " " : "TICK")); } while (key != 27); } printf("\n"); #ifdef USEFMOD FMUSIC_FreeSong(mod); #endif }
bool CSoundManager::LoadSong(char *Filename, int Nr) { if (false == InitSuccessfull) return false; bool fromrar; char *pData; char Temp[256]; unsigned long Size; char Buffer[100]; fromrar = false; // Zuerst checken, ob sich der Song in einem MOD-Ordner befindet if (CommandLineParams.RunOwnLevelList == true) { sprintf_s(Temp, "levels/%s/%s", CommandLineParams.OwnLevelList, Filename); if (FileExists(Temp)) goto loadfile; } // Dann checken, ob sich das File im Standard Ordner befindet sprintf_s(Temp, "data/%s", Filename); if (FileExists(Temp)) goto loadfile; // Auch nicht? Dann ist es hoffentlich im RAR file if (urarlib_get(&pData, &Size, Filename, RARFILENAME, convertText(RARFILEPASSWORD)) == false) { sprintf_s(Temp, "\n-> Error loading %s from Archive !\n", Filename); Protokoll.WriteText(Temp, true); return false; } else fromrar = true; loadfile: int Nummer = Nr; if (its_Songs[Nummer] != NULL) { delete(its_Songs[Nummer]); its_Songs[Nummer] = NULL; } its_Songs[Nummer] = new CSong(); if (fromrar == false) its_Songs[Nummer]->SongData = FMUSIC_LoadSong(Temp); else { its_Songs[Nummer]->SongData = FMUSIC_LoadSongEx(pData, 0, Size, FSOUND_LOADMEMORY, NULL, 0); free(pData); } // Fehler beim Laden ? // if (its_Songs[Nummer]->SongData == NULL) { strcpy_s(Buffer, strlen("\n-> Error loading ") + 1, "\n-> Error loading "); strcat_s(Buffer, strlen(Filename) + 1, Filename); strcat_s(Buffer, 3, "\n"); Protokoll.WriteText(Buffer, true); //return (-1); return false; } its_LoadedSongs++; //its_Songs[Nummer].Name = Filename; its_Songs[Nummer]->Volume = 100; its_Songs[Nummer]->FadingVolume = 0.0f; // TODO FIX /* strcpy_s(Buffer, "Load Song : "); strcat_s(Buffer, Filename); strcat_s(Buffer, " successfull\n"); Protokoll.WriteText(Buffer, false); */ //return Nummer; return true; } // LoadSong
void init() { GLUquadricObj *quadric; int i, numInsts; GLfloat position[] = {0.0f, 25.0f, -ZOOM*0.9, 1.0f}; GLfloat specular[] = {1.0f, 1.0f, 1.0f, 1.0f}; GLfloat ambient[] = {0.4f, 0.4f, 0.4f}; glClearColor(0.0, 0.0, 0.0, 1.0); glClearDepth(1.0); glDepthFunc(GL_LESS); glEnable(GL_DEPTH_TEST); glShadeModel(GL_SMOOTH); glBlendFunc(GL_SRC_ALPHA, GL_ONE); glEnable(GL_BLEND); glLightfv( GL_LIGHT0, GL_POSITION, position ); glLightfv( GL_LIGHT0, GL_AMBIENT, ambient ); glLightfv( GL_LIGHT0, GL_SPECULAR, specular ); glEnable(GL_LIGHT0); glEnable(GL_LIGHTING); glEnable(GL_COLOR_MATERIAL); glColorMaterial(GL_FRONT, GL_AMBIENT_AND_DIFFUSE); glMateriali(GL_FRONT, GL_SHININESS, 255); sphere = glGenLists(1); glNewList(sphere, GL_COMPILE); quadric = gluNewQuadric(); gluQuadricNormals(quadric, GLU_SMOOTH); gluQuadricTexture(quadric, GL_FALSE); gluSphere(quadric, RADIUS, 32, 32); gluDeleteQuadric(quadric); glEndList(); for(i = 0; i < DROPCOUNT; ++i) drops[i].offset = -1; FSOUND_Init(44100, 64, FSOUND_INIT_USEDEFAULTMIDISYNTH); song = FMUSIC_LoadSong(SONG); if(song == NULL) song = FMUSIC_LoadSong("Obj\\" SONG); FSOUND_DSP_SetActive(FSOUND_DSP_GetFFTUnit(), TRUE); FMUSIC_SetMasterVolume(song, 256); srand(0xDEADBEEF); numInsts = FMUSIC_GetNumInstruments(song); instrumentOffsets = (int *) malloc(sizeof(int) * numInsts); for(i = 0; i < numInsts; ++i) { FMUSIC_SetInstCallback(song, instrumentCallback, i); instrumentOffsets[i] = rand() % (GRID_HEIGHT * GRID_WIDTH); } FMUSIC_PlaySong(song); setText("STRAYLIGHT"); }