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"); }
//------------------------------------------------------------------------ // attempt to open the mp3 file as a stream g_sample = FSOUND_Sample_Load(FSOUND_FREE,"AUDIO/bell6.wav",FSOUND_2D,0,0); //g_sample2 = FSOUND_Sample_Load(FSOUND_FREE,"AUDIO/dung.wav",FSOUND_2D,0,0); //------------------------------------------------------------------------ // start the sound playing ch = FSOUND_PlaySound(FSOUND_FREE,g_sample); FSOUND_SetLoopMode(ch,FSOUND_LOOP_OFF); //ch2 = FSOUND_PlaySound(FSOUND_FREE,g_sample2); //FSOUND_SetLoopMode(ch2,FSOUND_LOOP_NORMAL); //============================================================================================ //__________________________________________________________________frequencies // initialise fmod, 44000 Hz, 64 channels // attempt to open the mp3 file as a stream //g_mp3_stream = FSOUND_Stream_Open( "AUDIO/Hawaii5O.mp3" , FSOUND_2D , 0 , 0 ); // play the mp3 //FSOUND_Stream_Play(0,g_mp3_stream); // get a pointer to fmods fft (fast fourier transform) unit DLL_API FSOUND_DSPUNIT *fft = FSOUND_DSP_GetFFTUnit(); // enable the fft unit FSOUND_DSP_SetActive(fft,TRUE);