Пример #1
0
void SpekerTestWdg::Close()
{
	ui.cmbSpeakerList->disconnect();
	ui.cmbSpeakerList->clear();
	StopAudio();
	hide();
}
Пример #2
0
void SpekerTestWdg::OnStartTest()
{
	m_WaveFile.WavRead("test.wav");
	int i = m_WaveFile.head.samplerate;
	m_HasRead = 0;
	StopAudio();
	StartAudio();
}
Пример #3
0
int vmsStopPlay(VmsPlayRecordType *vmsP)
{
	if(vmsP==0)
	{
		return 1;
	}
	return StopAudio(vmsP->aqRecordPlayPcm,false);	
	
}
Пример #4
0
void closeSoundInterface(void *udata)
{
	LtpInterfaceType *ltpInterfaceP;
	ltpInterfaceP = (LtpInterfaceType *)udata;
	if(ltpInterfaceP->ltpObjectP->sipOnB)
	{
		return ;
	}
	/*if(ltpInterfaceP->stopAutioQueueImidateB)
	{
		removeAudioQueueListener(ltpInterfaceP->recordP);
		removeAudioQueueListener(ltpInterfaceP->playbackP);
	}*/
	StopAudio(ltpInterfaceP->recordP,ltpInterfaceP->stopAutioQueueImidateB);
	
	StopAudio(ltpInterfaceP->playbackP,ltpInterfaceP->stopAutioQueueImidateB);
		return ;
}
Пример #5
0
void CFMOD::ShutDownSound(void)
{
    if(!bfmod) return;

    DeleteAllSamples();

    StopAudio();
    FSOUND_Close();

}
Пример #6
0
void DirectSoundDriver::SetFrequency(uint32_t Frequency, uint32_t BufferSize)
{
    WriteTrace(TraceAudioDriver, TraceDebug, "Start (Frequency: 0x%08X)", Frequency);
    StopAudio();
    m_LOCK_SIZE = (BufferSize * 2);
    SetSegmentSize(m_LOCK_SIZE, Frequency);

    StartAudio();
    WriteTrace(TraceAudioDriver, TraceDebug, "Done");
}
CDROM_Interface_Aspi::~CDROM_Interface_Aspi(void)
{
	// Stop Audio
	StopAudio();

	pGetASPI32SupportInfo	= NULL;	// clear funcs
	pSendASPI32Command		= NULL;

	if (hASPI) {					// free aspi
		FreeLibrary(hASPI);
		hASPI=NULL;
	}
};
Пример #8
0
void AudioPluginOSX::LenChanged()
{
	if (gAudioPluginEnabled > APM_DISABLED)
	{
		u32	address = Memory_AI_GetRegister(AI_DRAM_ADDR_REG) & 0xFFFFFF;
		u32	length  = Memory_AI_GetRegister(AI_LEN_REG);

		AddBuffer( g_pu8RamBase + address, length );
	}
	else
	{
		StopAudio();
	}
}
Пример #9
0
u32 GetJoy(int pad)
{
    pad = 0;

    s8 gc_px = PAD_SubStickX (0);
    s8 gc_py = PAD_SubStickY (0);

    #ifdef HW_RVL
    s8 wm_sx = WPAD_Stick (0,1,0);
    s8 wm_sy = WPAD_Stick (0,1,1);
    u32 wm_pb = WPAD_ButtonsHeld (0); // wiimote / expansion button info
    #endif

    // Check for video zoom
	if (GCSettings.Zoom)
	{
		if (gc_py < -36 || gc_py > 36)
			zoom ((float) gc_py / -36);
		#ifdef HW_RVL
			if (wm_sy < -36 || wm_sy > 36)
				zoom ((float) wm_sy / -36);
		#endif
	}

    // request to go back to menu
    if ((gc_px < -70)
    #ifdef HW_RVL
    		 || (wm_pb & WPAD_BUTTON_HOME)
    		 || (wm_pb & WPAD_CLASSIC_BUTTON_HOME)
    		 || (wm_sx < -70)
    #endif
    )
	{
    	StopAudio();
    	ConfigRequested = 1;
		return 0;
	}
	else
	{
		return DecodeJoy(pad);
	}
}
Пример #10
0
HRESULT DSCapture::SetAudioFormat( DWORD dwPreferredSamplesPerSec, WORD wPreferredBitsPerSample, WORD nPreferredChannels )
{
    StopAudio();

    ds_audio_graph_->Destroy();

    ds_audio_cap_device_->SetPreferredSamplesPerSec( dwPreferredSamplesPerSec );
    ds_audio_cap_device_->SetPreferredBitsPerSample( wPreferredBitsPerSample );
    ds_audio_cap_device_->SetPreferredChannels( nPreferredChannels );

    HRESULT hr = ds_audio_graph_->Create( ds_audio_cap_device_ );
    if( FAILED( hr ) )
    {
        return hr;
    }

    StartAudio();

    return 0;
}
Пример #11
0
void SoundDriverBase::AI_Shutdown()
{
    StopAudio();
}
Пример #12
0
CDROM_Interface_Ioctl::~CDROM_Interface_Ioctl() {
	StopAudio();
	if (use_mciplay) mci_CDStop();
	Close();
	if (use_mciplay) mci_CDClose();
}
Пример #13
0
int CallBackVmsSoundPCM(void * userData,sampleFrame *pcmBufferP,unsigned int *lengthP,Boolean recordB)
{
	VmsPlayRecordType *vmsObjP;
	sampleFrame *tempP=0;
	sampleFrame *pcmP=0;
	//sampleFrame *pcmLoopP = 0;
	//int j;
	char audioBuff[150];
	int index = 0;
	int i;
	int nsamples;
	nsamples = *lengthP;
	vmsObjP = (VmsPlayRecordType *)userData;
	if(vmsObjP)
	{
		if(vmsObjP->stopB)
		{
			StopAudio(vmsObjP->aqRecordPlayPcm,false);
			return 1;
		}
		 pcmP = pcmBufferP;
		if(recordB)
		{
			
			if(*lengthP<640)
			 {
				 tempP = malloc(640*sizeof(sampleFrame)+4);//extra 4 byte
				 memset(tempP,0,640*sizeof(sampleFrame));
				 memmove(tempP,pcmBufferP,*lengthP*sizeof(sampleFrame));
				 pcmP = tempP;
				 nsamples = 640;
			 
			 
			 }
			 else
			 {
			 
				  pcmP = pcmBufferP;
			 
			 }
			for ( i = 0; i < nsamples; i+= 160){
				gsm_encode(vmsObjP->playRecordObj,(short*) pcmP + i, (gsm_byte *)(audioBuff + index));
				index += 33;
			}
			fwrite(audioBuff,1,index,vmsObjP->playRecordFP);
			 if(tempP)
			 {
				 free(tempP);
			 }
			
		
		}
		else
		{
			memset(audioBuff,0,33*4);
			nsamples = fread(audioBuff,1,33*4,vmsObjP->playRecordFP);
			if(nsamples<33*4)
			{
				vmsObjP->stopB = true;
			}
			index = 0;
			for ( i = 0; i < nsamples; i+= 33){
				gsm_decode(vmsObjP->playRecordObj,(gsm_byte *)(audioBuff + i),(short*) pcmP + index );
				
				index += 160;
			}
			
			*lengthP = index;
			
		
		}
	
	
	
	
	}

	return 0;
}
Пример #14
0
static void PlayGame()
{
    Uint8 *keystate;
    int quit = 0;
    int turn;
    int prev_ticks = 0, cur_ticks = 0; /* for keeping track of timing */

    /* framerate counter variables */
    int start_time, end_time;
    int frames_drawn = 0;
	
    /* Start audio playback. */
    StartAudio();
    StartMusic();

    /* Start the music update thread. */
    music_update_thread = SDL_CreateThread(UpdateMusicThread, NULL);
    if (music_update_thread == NULL) {
	printf("Unable to start music update thread.\n");
    }

    prev_ticks = SDL_GetTicks();
    start_time = time(NULL);
	
    while (quit == 0) {
		
	/* Determine how many milliseconds have passed since
	   the last frame, and update our motion scaling. */
		
	prev_ticks = cur_ticks;
	cur_ticks = SDL_GetTicks();
	time_scale = (double)(cur_ticks-prev_ticks)/30.0;
				
	/* Update SDL's internal input state information. */
	SDL_PumpEvents();
		
	/* Grab a snapshot of the keyboard. */
	keystate = SDL_GetKeyState(NULL);
		
	/* Respond to input. */
	if (keystate[SDLK_q] || keystate[SDLK_ESCAPE]) quit = 1;
		
	/* Left and right arrow keys control turning. */
	turn = 0;
	if (keystate[SDLK_LEFT]) turn += 15;
	if (keystate[SDLK_RIGHT]) turn -= 15;
		
	/* Forward and back arrow keys activate thrusters. */
	player.accel = 0;
	if (keystate[SDLK_UP]) player.accel = PLAYER_FORWARD_THRUST;
	if (keystate[SDLK_DOWN]) player.accel = PLAYER_REVERSE_THRUST;
		
	/* Spacebar slows the ship down. */
	if (keystate[SDLK_SPACE]) {
	    player.velocity *= 0.8;
	}
		
	/* Just an amusing way to test the particle system. */
	if (keystate[SDLK_e]) {
	    CreateParticleExplosion(
		player.world_x, player.world_y, 255, 255, 255, 10, 300);
	    CreateParticleExplosion(
		player.world_x, player.world_y, 255, 0, 0, 5, 100);
	    CreateParticleExplosion(
		player.world_x, player.world_y, 255, 255, 0, 2, 50);
	}
		
	/* Allow a turn of four degrees per frame. */
	player.angle += turn * time_scale;
	if (player.angle < 0) player.angle += 360;
	if (player.angle >= 360) player.angle -= 360;

	/* Update the player's position. */
	UpdatePlayer(&player);
	UpdatePlayer(&opponent);

	/* Make the camera follow the player (but impose limits). */
	camera_x = player.world_x - SCREEN_WIDTH/2;
	camera_y = player.world_y - SCREEN_HEIGHT/2;
		
	if (camera_x < 0) camera_x = 0;
	if (camera_x >= WORLD_WIDTH-SCREEN_WIDTH)
	    camera_x = WORLD_WIDTH-SCREEN_WIDTH-1;
	if (camera_y < 0) camera_y = 0;
	if (camera_y >= WORLD_HEIGHT-SCREEN_HEIGHT)
	    camera_y = WORLD_HEIGHT-SCREEN_HEIGHT-1;

	/* Update the particle system. */
	UpdateParticles();
				
	/* Keep OpenAL happy. */
	UpdateAudio(&player, &opponent);
	       
	/* Redraw everything. */
	DrawBackground(screen, camera_x, camera_y);
	DrawParallax(screen, camera_x, camera_y);
	DrawParticles(screen, camera_x, camera_y);
	DrawPlayer(&player);
	DrawPlayer(&opponent);
	
	/* Flip the page. */
	SDL_Flip(screen);

	frames_drawn++;

    }

    end_time = time(NULL);
    if (start_time == end_time) end_time++;

    /* Display the average framerate. */
    printf("Drew %i frames in %i seconds, for a framerate of %.2f fps.\n",
	   frames_drawn,
	   end_time-start_time,
	   (float)frames_drawn/(float)(end_time-start_time));

    /* Terminate the music update thread. */
    if (music_update_thread != NULL) {
	SDL_KillThread(music_update_thread);
	music_update_thread = NULL;
    }
	
    /* Stop audio playback. */
    StopAudio();
    StopMusic();

}
Пример #15
0
static void PlayGame()
{
    Uint8 *keystate;
    int quit = 0;
    int turn;
    int prev_ticks = 0, cur_ticks = 0; /* for keeping track of timing */
    int awaiting_respawn = 0;

    /* framerate counter variables */
    int start_time, end_time;
    int frames_drawn = 0;

    /* respawn timer */
    int respawn_timer = -1;
	
    prev_ticks = SDL_GetTicks();
	
    start_time = time(NULL);

    /* Reset the score counters. */
    player.score = 0;
    opponent.score = 0;

    /* Start sound playback. */
    StartAudio();
    StartMusic();

    /* Start the music update thread. */
    music_update_thread = SDL_CreateThread(UpdateMusicThread, NULL);
    if (music_update_thread == NULL) {
	printf("Unable to start music update thread.\n");
    }

    /* Start the game! */
    while ((quit == 0) && network_ok) {

	/* Determine how many milliseconds have passed since
	   the last frame, and update our motion scaling. */
	prev_ticks = cur_ticks;
	cur_ticks = SDL_GetTicks();
	time_scale = (double)(cur_ticks-prev_ticks)/30.0;
				
	/* Update SDL's internal input state information. */
	SDL_PumpEvents();
		
	/* Grab a snapshot of the keyboard. */
	keystate = SDL_GetKeyState(NULL);

	/* Lock the mutex so we can access the player's data. */
	SDL_LockMutex(player_mutex);
		
	/* If this is a network game, take note of variables
	   set by the network thread. These are handled differently
	   for a scripted opponent. */
	if (opponent_type == OPP_NETWORK) {

	    /* Has the opponent respawned? */
	    if (network_opponent_respawn) {
		printf("Remote player has respawned.\n");
		opponent.shields = 100;
		network_opponent_respawn = 0;
		awaiting_respawn = 0;
	    }
		
	    /* Has the local player been hit? */
	    if (local_player_hit) {
		local_player_hit--;
		player.shields -= PHASER_DAMAGE;
		ShowPhaserHit(&player);
				/* No need to check for death, the
				   other computer will tell us. */
	    }
		}

	/* Update phasers. */
	player.firing -= time_scale;
	if (player.firing < 0) player.firing = 0;
	opponent.firing -= time_scale;
	if (opponent.firing < 0) opponent.firing = 0;
	ChargePhasers(&player);

	/* If the local player is destroyed, the respawn timer will
	   start counting. During this time the controls are disabled
	   and explosion sequence occurs. */
	if (respawn_timer >= 0) {
	    respawn_timer++;

	    if (respawn_timer >= ((double)RESPAWN_TIME / time_scale)) {
		respawn_timer = -1;
		InitPlayer(&player);

				/* Set the local_player_respawn flag so the
				   network thread will notify the opponent
				   of the respawn. */
		local_player_respawn = 1;

		SetStatusMessage("GOOD LUCK, WARRIOR!");
	    }
	}

	/* Respond to input and network events, but not if we're in a respawn. */
	if (respawn_timer == -1) {
	    if (keystate[SDLK_q] || keystate[SDLK_ESCAPE]) quit = 1;
			
	    /* Left and right arrow keys control turning. */
	    turn = 0;
	    if (keystate[SDLK_LEFT]) turn += 10;
	    if (keystate[SDLK_RIGHT]) turn -= 10;
			
	    /* Forward and back arrow keys activate thrusters. */
	    player.accel = 0;
	    if (keystate[SDLK_UP]) player.accel = PLAYER_FORWARD_THRUST;
	    if (keystate[SDLK_DOWN]) player.accel = PLAYER_REVERSE_THRUST;
			
	    /* Spacebar fires phasers. */
	    if (keystate[SDLK_SPACE]) {

		if (CanPlayerFire(&player)) {

		    FirePhasers(&player);

		    /* If it's a hit, either notify the opponent
		       or exact the damage. Create a satisfying particle
		       burst. */
		    if (!awaiting_respawn &&
			CheckPhaserHit(&player,&opponent)) {

			ShowPhaserHit(&opponent);
			DamageOpponent();

			/* If that killed the opponent, set the
			   "awaiting respawn" state, to prevent multiple
			   kills. */
			if (opponent.shields <= 0 &&
			    opponent_type == OPP_NETWORK)
			    awaiting_respawn = 1;
       		    }
		}
	    }
			
	    /* Turn. */
	    player.angle += turn * time_scale;
	    if (player.angle < 0) player.angle += 360;
	    if (player.angle >= 360) player.angle -= 360;

	    /* If this is a network game, the remote player will
	       tell us if we've died. Otherwise we have to check
	       for failed shields. */
	    if (((opponent_type == OPP_NETWORK) && local_player_dead) ||
		(player.shields <= 0))
	    {
		printf("Local player has been destroyed.\n");
		local_player_dead = 0;
				
		/* Kaboom! */
		KillPlayer();
				
		/* Respawn. */
		respawn_timer = 0;
	    }
	}

	/* If this is a player vs. computer game, give the computer a chance. */
	if (opponent_type == OPP_COMPUTER) {
	    if (RunGameScript() != 0) {
		fprintf(stderr, "Ending game due to script error.\n");
		quit = 1;
	    }
			
	    /* Check for phaser hits against the player. */
	    if (opponent.firing) {
		if (CheckPhaserHit(&opponent,&player)) {
					
		    ShowPhaserHit(&player);
		    player.shields -= PHASER_DAMAGE;

		    /* Did that destroy the player? */
		    if (respawn_timer < 0 && player.shields <= 0) {
			KillPlayer();
			respawn_timer = 0;
		    }
		}
	    }

	    ChargePhasers(&opponent);
	    UpdatePlayer(&opponent);
	}

	/* Update the player's position. */
	UpdatePlayer(&player);

	/* Update the status information. */
	SetPlayerStatusInfo(player.score, player.shields, player.charge);
	SetOpponentStatusInfo(opponent.score, opponent.shields);

	/* Make the camera follow the player (but impose limits). */
	camera_x = player.world_x - SCREEN_WIDTH/2;
	camera_y = player.world_y - SCREEN_HEIGHT/2;
		
	if (camera_x < 0) camera_x = 0;
	if (camera_x >= WORLD_WIDTH-SCREEN_WIDTH)
	    camera_x = WORLD_WIDTH-SCREEN_WIDTH-1;
	if (camera_y < 0) camera_y = 0;
	if (camera_y >= WORLD_HEIGHT-SCREEN_HEIGHT)
	    camera_y = WORLD_HEIGHT-SCREEN_HEIGHT-1;

	/* Update the particle system. */
	UpdateParticles();

	/* Keep OpenAL happy. */
	UpdateAudio(&player, &opponent);
				
	/* Redraw everything. */
	DrawBackground(screen, camera_x, camera_y);
	DrawParallax(screen, camera_x, camera_y);
	DrawParticles(screen, camera_x, camera_y);
	if (opponent.firing)
	    DrawPhaserBeam(&opponent, screen, camera_x, camera_y);
	if (player.firing)
	    DrawPhaserBeam(&player, screen, camera_x, camera_y);

	if (respawn_timer < 0)
	    DrawPlayer(&player);
	if (!awaiting_respawn)
	    DrawPlayer(&opponent);
	UpdateStatusDisplay(screen);
		
	/* Release the mutex so the networking system can get it.
	   It doesn't stay unlocked for very long, but the networking
	   system should still have plenty of time. */
	SDL_UnlockMutex(player_mutex);
	
	/* Flip the page. */
	SDL_Flip(screen);

	frames_drawn++;
    }

    end_time = time(NULL);
    if (start_time == end_time) end_time++;

    /* Display the average framerate. */
    printf("Drew %i frames in %i seconds, for a framerate of %.2f fps.\n",
	   frames_drawn,
	   end_time-start_time,
	   (float)frames_drawn/(float)(end_time-start_time));


    /* Terminate the music update thread. */
    if (music_update_thread != NULL) {
	SDL_KillThread(music_update_thread);
	music_update_thread = NULL;
    }
	
    /* Stop audio playback. */
    StopAudio();
    StopMusic();
}
Пример #16
0
CDROM_Interface_SDL::~CDROM_Interface_SDL(void) 
{
	StopAudio();
	SDL_CDClose(cd);
	cd		= 0;
};
void ProcessIFlyFunctions() // process the functions 
{
	if (CheckCockpitView() == 1)
	{
		hMapFileSDK = OpenFileMapping(
			   FILE_MAP_READ,				// read/write access
			   FALSE,						// do not inherit the name
			   szNameSDK);					// name of mapping object 

		if (hMapFileSDK != NULL) 
		{ 
			pBufSDK = (LPTSTR)MapViewOfFile(hMapFileSDK,    // handle to mapping object
					   FILE_MAP_READ,						// read/write permission
					   0,
					   0,
					   BUF_SIZE_SDK);
		}
	
		if(pBufSDK)
		{
			CopyMemory((PVOID)pShareMemSDK, pBufSDK, sizeof(struct ShareMemorySDK));
			if (pShareMemSDK->DC_AMPS_minus_Status == 10)  // if the batery has power
			{
				// Check if Wiper Left Status has change
				if (CurrentWiperLeftStatus != pShareMemSDK->Wiper_L_Switches_Status)
				{
					// Play the f**k wav sound
					if (pShareMemSDK->Wiper_L_Switches_Status == 1) // Int
					{
						StopAudio();
						PlayLoopAudio(".\\iFly\\737NG\\Sound\\Wiper1.wav");
					} else if (pShareMemSDK->Wiper_L_Switches_Status == 2) // Low
					{
						StopAudio();
						PlayLoopAudio(".\\iFly\\737NG\\Sound\\Wiper2.wav");
					} else if (pShareMemSDK->Wiper_L_Switches_Status == 3) // High
					{
						StopAudio();
						PlayLoopAudio(".\\iFly\\737NG\\Sound\\Wiper3.wav");
					} 
					else
					{
						StopAudio();
						/*PlaySound(NULL, NULL, SND_ASYNC);*/
					}
					CurrentWiperLeftStatus = pShareMemSDK->Wiper_L_Switches_Status;
				}

				// Check if Engine 1 Start Levers Status has change
				if (CurrentEngine1StartLeversStatus != pShareMemSDK->Engine_1_Start_Levers_Status)
				{
					PlaySound(".\\iFly\\737NG\\Sound\\StartLeversClick.wav", NULL, SND_ASYNC);
					/*PlaySound(".\\iFly\\737NG\\Sound\\StartLeversClick.wav", NULL, SND_ASYNC);*/
					CurrentEngine1StartLeversStatus = pShareMemSDK->Engine_1_Start_Levers_Status;
				}

				// Check if Engine 2 Start Levers Status has change
				if (CurrentEngine2StartLeversStatus != pShareMemSDK->Engine_2_Start_Levers_Status)
				{
					PlaySound(".\\iFly\\737NG\\Sound\\StartLeversClick.wav", NULL, SND_ASYNC);
					CurrentEngine2StartLeversStatus = pShareMemSDK->Engine_2_Start_Levers_Status;
				}

				// Check if Landing Light Status has change
				if (CurrentLandingLightStatus != pShareMemSDK->Landing_Light_Status)
				{
					PlaySound(".\\iFly\\737NG\\Sound\\LandingLightClick.wav", NULL, SND_ASYNC);
					CurrentLandingLightStatus = pShareMemSDK->Landing_Light_Status;
				}

				// Check if Taxi Light Status has change
				if (CurrentTaxiLightStatus != pShareMemSDK->Taxi_Light_Status)
				{
					PlaySound(".\\iFly\\737NG\\Sound\\iFly737NG-click.wav", NULL, SND_ASYNC);
					CurrentTaxiLightStatus = pShareMemSDK->Taxi_Light_Status;
				}
				
				// Check if Panel Light Status has change
				if (CurrentPanelLightStatus != pShareMemSDK->Panel_Light_Status)
				{
					PlaySound(".\\iFly\\737NG\\Sound\\iFly737NG-click.wav", NULL, SND_ASYNC);
					CurrentPanelLightStatus = pShareMemSDK->Panel_Light_Status;
				}

				// Check if Logo Light Status has change
				if (CurrentLogoLightStatus != pShareMemSDK->Logo_Light_Status)
				{
					PlaySound(".\\iFly\\737NG\\Sound\\iFly737NG-click.wav", NULL, SND_ASYNC);
					CurrentLogoLightStatus = pShareMemSDK->Logo_Light_Status;
				}

				// Check if Anti Collision Light Status has change
				if (CurrentAntiCollisionLightStatus != pShareMemSDK->Anti_Collision_Light_Status)
				{
					PlaySound(".\\iFly\\737NG\\Sound\\iFly737NG-click.wav", NULL, SND_ASYNC);
					CurrentAntiCollisionLightStatus = pShareMemSDK->Anti_Collision_Light_Status;
				}

				// Check if Wing Light Status has change
				if (CurrentWingLightStatus != pShareMemSDK->Wing_Light_Status)
				{
					PlaySound(".\\iFly\\737NG\\Sound\\iFly737NG-click.wav", NULL, SND_ASYNC);
					CurrentWingLightStatus = pShareMemSDK->Wing_Light_Status;
				}

				// Check if MCP IAS/MACH Switches Status has change
				if (CurrentMCPIASMACHSwitchesStatus != pShareMemSDK->MCP_IASMACH_Switches_Status)
				{
					PlaySound(".\\iFly\\737NG\\Sound\\MCP_knob1.wav", NULL, SND_ASYNC);
					CurrentMCPIASMACHSwitchesStatus = pShareMemSDK->MCP_IASMACH_Switches_Status;
				}

				// Check if MCP HEADING Switches Status has change
				if (CurrentMCPHEADINGSwitchesStatus != pShareMemSDK->MCP_HEADING_Switches_Status)
				{
					PlaySound(".\\iFly\\737NG\\Sound\\MCP_knob1.wav", NULL, SND_ASYNC);
					CurrentMCPHEADINGSwitchesStatus = pShareMemSDK->MCP_HEADING_Switches_Status;
				}

				// Check if MCP ALTIDUTE Switches Status has change
				if (CurrentMCPALTIDUTESwitchesStatus != pShareMemSDK->MCP_ALTIDUTE_Switches_Status)
				{
					PlaySound(".\\iFly\\737NG\\Sound\\MCP_knob1.wav", NULL, SND_ASYNC);
					CurrentMCPALTIDUTESwitchesStatus = pShareMemSDK->MCP_ALTIDUTE_Switches_Status;
				}

				// Check if MCP VERT SPEED Switches Status has change
				if (CurrentMCPVERTSPEEDSwitchesStatus != pShareMemSDK->MCP_VERTSPEED_Switches_Status)
				{
					PlaySound(".\\iFly\\737NG\\Sound\\MCP_knob1.wav", NULL, SND_ASYNC);
					CurrentMCPVERTSPEEDSwitchesStatus = pShareMemSDK->MCP_VERTSPEED_Switches_Status;
				}

				// Check if Course 1 Switches Status has change
				if (CurrentCourse1SwitchesStatus != pShareMemSDK->Course_1_Switches_Status)
				{
					PlaySound(".\\iFly\\737NG\\Sound\\MCP_knob1.wav", NULL, SND_ASYNC);
					CurrentCourse1SwitchesStatus = pShareMemSDK->Course_1_Switches_Status;
				}

				// Check if Course 2 Switches Status has change
				if (CurrentCourse2SwitchesStatus != pShareMemSDK->Course_2_Switches_Status)
				{
					PlaySound(".\\iFly\\737NG\\Sound\\MCP_knob1.wav", NULL, SND_ASYNC);
					CurrentCourse2SwitchesStatus = pShareMemSDK->Course_2_Switches_Status;
				}

				// Check if Parking Brake Lever Status has change
				if (CurrentParkingBrakeLeverStatus != pShareMemSDK->Parking_Brake_Lever_Status)
				{
					PlaySound(".\\iFly\\737NG\\Sound\\ParkingBrakes.wav", NULL, SND_ASYNC);
					CurrentParkingBrakeLeverStatus = pShareMemSDK->Parking_Brake_Lever_Status;
				}

				// Check if BANK LIMIT Selector has change
				if (CurrentBANKLIMITSelector != pShareMemSDK->BANK_LIMIT_Selector)
				{
					PlaySound(".\\iFly\\737NG\\Sound\\iFly737NG-click.wav", NULL, SND_ASYNC);
					CurrentBANKLIMITSelector = pShareMemSDK->BANK_LIMIT_Selector;
				}

				// Check if Toga Push has change
				if (CurrentTogaPushSelector != pShareMemSDK->Autopilot_PitchMode)  
				{
					if (pShareMemSDK->Autopilot_PitchMode == 1)     //0:NULL;1:TO/GA;2:V/S;3:ALT ACQ;4:ALT HOLD;5:VNAV SPD;6:VNAV PTH;7:MCP SPD;8:G/S;9:FLARE;10:VNAV ALT
						PlaySound(".\\iFly\\737NG\\Sound\\TogaPush.wav", NULL, SND_ASYNC);

					CurrentTogaPushSelector = pShareMemSDK->Autopilot_PitchMode;
				}

				// Check if Pack 1 Switches has change
				if (CurrentPack1SwitchesStatus != pShareMemSDK->Pack_1_Switches_Status)  
				{
					if (pShareMemSDK->Pack_1_Switches_Status == 1 && (pShareMemSDK->Duct_Pressure_L_neddle_Status > 5 || pShareMemSDK->Duct_Pressure_R_neddle_Status > 5))  //1:auto
						PlaySound(".\\iFly\\737NG\\Sound\\PacksAuto.wav", NULL, SND_ASYNC);

					if (pShareMemSDK->Pack_1_Switches_Status == 0 && (pShareMemSDK->Duct_Pressure_L_neddle_Status > 5 || pShareMemSDK->Duct_Pressure_R_neddle_Status > 5))  //1:auto
						PlaySound(".\\iFly\\737NG\\Sound\\PacksOff.wav", NULL, SND_ASYNC);

					CurrentPack1SwitchesStatus = pShareMemSDK->Pack_1_Switches_Status;
				}

				// Check if Pack 2 Switches has change
				if (CurrentPack2SwitchesStatus != pShareMemSDK->Pack_2_Switches_Status)  
				{
					if (pShareMemSDK->Pack_2_Switches_Status == 1 && (pShareMemSDK->Duct_Pressure_L_neddle_Status > 5 || pShareMemSDK->Duct_Pressure_R_neddle_Status > 5)) //1:auto
						PlaySound(".\\iFly\\737NG\\Sound\\PacksAuto.wav", NULL, SND_ASYNC);

					if (pShareMemSDK->Pack_2_Switches_Status == 0 && (pShareMemSDK->Duct_Pressure_L_neddle_Status > 5 || pShareMemSDK->Duct_Pressure_R_neddle_Status > 5))  //1:auto
						PlaySound(".\\iFly\\737NG\\Sound\\PacksOff.wav", NULL, SND_ASYNC);

					CurrentPack2SwitchesStatus = pShareMemSDK->Pack_2_Switches_Status;
				}

				// Check if NAV1 Switches Status has change
				if (Current1NAV1SwitchesStatus != pShareMemSDK->NAV_1_Right_num_point2_status + pShareMemSDK->NAV_1_Right_num_1_status)  
				{
					PlaySound(".\\iFly\\737NG\\Sound\\MCP_knob1.wav", NULL, SND_ASYNC);

					Current1NAV1SwitchesStatus = pShareMemSDK->NAV_1_Right_num_point2_status + pShareMemSDK->NAV_1_Right_num_1_status;
				}

				// Check if NAV2 Switches Status has change
				if (Current1NAV2SwitchesStatus != pShareMemSDK->NAV_2_Right_num_point2_status + pShareMemSDK->NAV_2_Right_num_1_status)  
				{
					PlaySound(".\\iFly\\737NG\\Sound\\MCP_knob1.wav", NULL, SND_ASYNC);

					Current1NAV2SwitchesStatus = pShareMemSDK->NAV_2_Right_num_point2_status + pShareMemSDK->NAV_2_Right_num_1_status;
				}

				// Check if Transponder Status has change
				if (CurrentTransponderStatus != pShareMemSDK->Transponder_1000_Status + pShareMemSDK->Transponder_100_Status  + pShareMemSDK->Transponder_10_Status + pShareMemSDK->Transponder_1_Status)  
				{
					PlaySound(".\\iFly\\737NG\\Sound\\MCP_knob1.wav", NULL, SND_ASYNC);

					CurrentTransponderStatus = pShareMemSDK->Transponder_1000_Status + pShareMemSDK->Transponder_100_Status  + pShareMemSDK->Transponder_10_Status + pShareMemSDK->Transponder_1_Status;
				}

				// Check if VHF1 Left Switches Status has change
				if (CurrentVHF1LeftStatus != pShareMemSDK->VHF_1_Left_num_1_status + pShareMemSDK->VHF_1_Left_num_point2_status)  
				{
					PlaySound(".\\iFly\\737NG\\Sound\\MCP_knob1.wav", NULL, SND_ASYNC);
					CurrentVHF1LeftStatus = pShareMemSDK->VHF_1_Left_num_1_status + pShareMemSDK->VHF_1_Left_num_point2_status;
				}

				// Check if VHF1 Right Switches Status has change
				if (CurrentVHF1RightStatus != pShareMemSDK->VHF_1_Right_num_1_status + pShareMemSDK->VHF_1_Right_num_point2_status)  
				{
					PlaySound(".\\iFly\\737NG\\Sound\\MCP_knob1.wav", NULL, SND_ASYNC);
					CurrentVHF1RightStatus = pShareMemSDK->VHF_1_Right_num_1_status + pShareMemSDK->VHF_1_Right_num_point2_status;
				}

				// Check if VHF2 Left Switches Status has change
				if (CurrentVHF2LeftStatus != pShareMemSDK->VHF_2_Left_num_1_status + pShareMemSDK->VHF_2_Left_num_point2_status)  
				{
					PlaySound(".\\iFly\\737NG\\Sound\\MCP_knob1.wav", NULL, SND_ASYNC);
					CurrentVHF2LeftStatus = pShareMemSDK->VHF_2_Left_num_1_status + pShareMemSDK->VHF_2_Left_num_point2_status;
				}

				// Check if VHF2 Right Switches Status has change
				if (CurrentVHF2RightStatus != pShareMemSDK->VHF_2_Right_num_1_status + pShareMemSDK->VHF_2_Right_num_point2_status)  
				{
					PlaySound(".\\iFly\\737NG\\Sound\\MCP_knob1.wav", NULL, SND_ASYNC);
					CurrentVHF2RightStatus = pShareMemSDK->VHF_2_Right_num_1_status + pShareMemSDK->VHF_2_Right_num_point2_status;
				}

				// Check if ADF1 Left Switches Status has change
				if (CurrentADF1LeftStatus != pShareMemSDK->ADF_1_Left_num_point1_Status + pShareMemSDK->ADF_1_Left_num_1_Status + pShareMemSDK->ADF_1_Left_num_10_Status + pShareMemSDK->ADF_1_Left_num_100_Status)  
				{
					PlaySound(".\\iFly\\737NG\\Sound\\MCP_knob1.wav", NULL, SND_ASYNC);
					CurrentADF1LeftStatus = pShareMemSDK->ADF_1_Left_num_point1_Status + pShareMemSDK->ADF_1_Left_num_1_Status + pShareMemSDK->ADF_1_Left_num_10_Status + pShareMemSDK->ADF_1_Left_num_100_Status;
				}

				// Check if ADF1 Right Switches Status has change
				if (CurrentADF1RightStatus != pShareMemSDK->ADF_1_Right_num_point1_Status + pShareMemSDK->ADF_1_Right_num_1_Status + pShareMemSDK->ADF_1_Right_num_10_Status + pShareMemSDK->ADF_1_Right_num_100_Status)  
				{
					PlaySound(".\\iFly\\737NG\\Sound\\MCP_knob1.wav", NULL, SND_ASYNC);
					CurrentADF1RightStatus = pShareMemSDK->ADF_1_Right_num_point1_Status + pShareMemSDK->ADF_1_Right_num_1_Status + pShareMemSDK->ADF_1_Right_num_10_Status + pShareMemSDK->ADF_1_Right_num_100_Status;
				}

				// Check if ADF2 Left Switches Status has change
				if (CurrentADF2LeftStatus != pShareMemSDK->ADF_2_Left_num_point1_Status + pShareMemSDK->ADF_2_Left_num_1_Status + pShareMemSDK->ADF_2_Left_num_10_Status + pShareMemSDK->ADF_2_Left_num_100_Status)  
				{
					PlaySound(".\\iFly\\737NG\\Sound\\MCP_knob1.wav", NULL, SND_ASYNC);
					CurrentADF2LeftStatus = pShareMemSDK->ADF_2_Left_num_point1_Status + pShareMemSDK->ADF_2_Left_num_1_Status + pShareMemSDK->ADF_2_Left_num_10_Status + pShareMemSDK->ADF_2_Left_num_100_Status;
				}

				// Check if ADF2 Right Switches Status has change
				if (CurrentADF2RightStatus != pShareMemSDK->ADF_2_Right_num_point1_Status + pShareMemSDK->ADF_2_Right_num_1_Status + pShareMemSDK->ADF_2_Right_num_10_Status + pShareMemSDK->ADF_2_Right_num_100_Status)  
				{
					PlaySound(".\\iFly\\737NG\\Sound\\MCP_knob1.wav", NULL, SND_ASYNC);
					CurrentADF2RightStatus = pShareMemSDK->ADF_2_Right_num_point1_Status + pShareMemSDK->ADF_2_Right_num_1_Status + pShareMemSDK->ADF_2_Right_num_10_Status + pShareMemSDK->ADF_2_Right_num_100_Status;
				}

				// Check if Autothrottle Light Status has change
				if (CurrentAutothrottleLightStatus != pShareMemSDK->AT_Switches_Status) 
				{
					if (pShareMemSDK->AT_Switches_Status == 0)
						PlaySound(".\\iFly\\737NG\\Sound\\iFly737NG-switch.wav", NULL, SND_ASYNC);

					CurrentAutothrottleLightStatus = pShareMemSDK->AT_Switches_Status;
				}

				// Check if Speed brake Mode Status has change
				if (CurrentSPEEDBRAKEARMEDStatus != pShareMemSDK->SPEED_BRAKE_ARMED_Light_Status)
				{
					if (pShareMemSDK->Spoiler_Lever_Status <= 25)
						PlaySound(".\\iFly\\737NG\\Sound\\SpeedBrakeArmed.wav", NULL, SND_ASYNC);
					CurrentSPEEDBRAKEARMEDStatus = pShareMemSDK->SPEED_BRAKE_ARMED_Light_Status;
				}

				// Check if BARO Status has change
				if (CurrentBAROStatus  !=  pShareMemSDK->BARO_DH)  
				{
					PlaySound(".\\iFly\\737NG\\Sound\\MCP_knob1.wav", NULL, SND_ASYNC);
					CurrentBAROStatus = pShareMemSDK->BARO_DH;
				}
				
				// Check if RADIO Status has change
				if (CurrentRADIOStatus  !=  pShareMemSDK->RADIO_DH)  
				{
					PlaySound(".\\iFly\\737NG\\Sound\\MCP_knob1.wav", NULL, SND_ASYNC);
					CurrentRADIOStatus  =  pShareMemSDK->RADIO_DH;
				}

			}
			else
			{
				// Stop any wav sound
				StopAudio();
				PlaySound(NULL, NULL, SND_ASYNC);
			}
		}	

		UnmapViewOfFile(pBufSDK);
		pBufSDK=NULL;
		CloseHandle(hMapFileSDK);
		hMapFileSDK=NULL;
	}
	else
	{ // the view is not from cockpit
		PlaySound(NULL, NULL, SND_ASYNC);
		StopAudio();
		CurrentWiperLeftStatus = 0;
	}
}
Пример #18
0
/**
 * @brief Stop the music playback
 *
 */
void stopMusic() {

	StopAudio();
	GPIO_ResetBits(GPIOD,GPIO_Pin_4);
}
Пример #19
0
AudioPluginOSX::~AudioPluginOSX()
{
	StopAudio();
}
Пример #20
0
static void play_mp3(char* filename) {

	bool out_of_data;
	int cc;


	// Open file
	if (FR_OK == f_open(&file, filename, FA_OPEN_EXISTING | FA_READ)) {

		// Read ID3v2 Tag
		char szArtist[120];
		char szTitle[120];
		Mp3ReadId3V2Tag(&file, szArtist, sizeof(szArtist), szTitle, sizeof(szTitle));


		///////////////////////////////////////////////////////////buffer starts getting filled for first time
		// Start Initial fill of buffer
		hMP3Decoder = MP3InitDecoder();
		for (cc = 0 ; cc < NUMBER_BUFFERS ; cc++ ) {
			out_of_data = fill_mp3_buffer(&file,cc);

			if ( out_of_data ) {
				break;
			}
		}

		// Initialize buffer counters
		buffer_read = 0;
		buffer_write = 0;

/////////////////////////////////////////////////////////////////////////////////////////
		// Play mp3
		running_player = true;
		InitializeAudio(Audio44100HzSettings);
		// InitializeAudio(Audio32000HzSettings);
		SetAudioVolume(0xAF);
		PlayAudioWithCallback(AudioCallback, 0);
//////////////////////////////////////////////////////////////////////////////////////////
		for(;;) {
			/*
			 *  If we have an unused buffer, call fill_mp3_buffer to fill it.
			 */
			if ( buffer_read != buffer_write ) {


				// Refill the MP3 buffer
				out_of_data = fill_mp3_buffer(&file,buffer_write);

				if ( !out_of_data ) {
					buffer_write = ( buffer_write + 1 ) % NUMBER_BUFFERS;
				}

				// Out of data or error or user button... Stop playback!
				if (out_of_data || (exitMp3 == 1))
				{
					StopAudio();
					running_player = false;

					// Re-initialize and set volume to avoid noise
					InitializeAudio(Audio44100HzSettings);
					SetAudioVolume(0);

					// Close currently open file
					f_close(&file);
					return;
				}


			}
			else {
				// We don't have any work to do, shut down until interrupt (DMA transfer complete)
				__asm__ volatile ("wfi");
			}
		}
	}
Пример #21
0
_Use_decl_annotations_
VOID
OnIoDeviceControl(
    WDFQUEUE    Queue,
    WDFREQUEST  Request,
    size_t      OutputBufferLength,
    size_t      InputBufferLength,
    ULONG       IoControlCode
)
/*++

Routine Description:

    This event handled device control calls.

Arguments:

    Queue - Handle of the queue object associated with the request
    Request - Handle of the request object
    OutputBufferLength - length of the request's output buffer
    InputBufferLength - length of the request's input buffer
    IoControlCode - the driver-defined or system-defined I/O control code

Return Value:

    None

--*/
{
    UNREFERENCED_PARAMETER(OutputBufferLength);
    UNREFERENCED_PARAMETER(InputBufferLength);

    WDFDEVICE device;
    PDEVICE_CONTEXT deviceContext;
    NTSTATUS status = STATUS_SUCCESS;

    device = WdfIoQueueGetDevice(Queue);
    deviceContext = GetContext(device);

    //
    // Validate the IO code and exexute on it.
    //

    switch (IoControlCode)
    {
    case IOCTL_BCM_PWM_SET_CLOCKCONFIG:
        status = ValidateAndSetClockConfig(device, Request);
        break;

    case IOCTL_BCM_PWM_GET_CLOCKCONFIG:
        status = GetClockConfig(device, Request);
        break;

    case IOCTL_BCM_PWM_SET_CHANNELCONFIG:
        status = ValidateAndSetChannelConfig(device, Request);
        break;

    case IOCTL_BCM_PWM_GET_CHANNELCONFIG:
        status = GetChannelConfig(device, Request);
        break;

    case IOCTL_BCM_PWM_SET_DUTY_REGISTER:
        status = ValidateAndSetDutyRegister(device, Request);
        break;

    case IOCTL_BCM_PWM_GET_DUTY_REGISTER:
        status = GetDutyRegister(device, Request);
        break;

    case IOCTL_BCM_PWM_START:
        status = ValidateAndStartChannel(device, Request);
        break;

    case IOCTL_BCM_PWM_STOP:
        status = ValidateAndStopChannel(device, Request);
        break;

    case IOCTL_BCM_PWM_AQUIRE_AUDIO:
        status = AquireAudio(device);
        break;

    case IOCTL_BCM_PWM_RELEASE_AUDIO:
        status = ReleaseAudio(device);
        break;

    case IOCTL_BCM_PWM_INITIALIZE_AUDIO:
        status = InitializeAudio(device, Request);
        break;

    case IOCTL_BCM_PWM_REGISTER_AUDIO_NOTIFICATION:
        status = RegisterAudioNotification(device, Request);
        break;

    case IOCTL_BCM_PWM_UNREGISTER_AUDIO_NOTIFICATION:
        status = UnregisterAudioNotification(device, Request);
        break;

    case IOCTL_BCM_PWM_START_AUDIO:
        status = StartAudio(device);
        break;

    case IOCTL_BCM_PWM_PAUSE_AUDIO:
        status = PauseAudio(device);
        break;

    case IOCTL_BCM_PWM_RESUME_AUDIO:
        status = ResumeAudio(device);
        break;

    case IOCTL_BCM_PWM_STOP_AUDIO:
        status = StopAudio(device);
        break;

    default:
        status = STATUS_INVALID_DEVICE_REQUEST;
        TraceEvents(TRACE_LEVEL_ERROR, TRACE_IOCTL, "Unexpected IO code in request. Request: 0x%08x, Code: 0x%08x", (ULONG)Request, IoControlCode);
        break;
    }

    WdfRequestComplete(Request, status);
}
Пример #22
0
static void play_mp3(char* filename) {
	unsigned int br, btr;
	FRESULT res;

	bytes_left = FILE_READ_BUFFER_SIZE;
	read_ptr = file_read_buffer;

	if (FR_OK == f_open(&file, filename, FA_OPEN_EXISTING | FA_READ)) {

		// Read ID3v2 Tag
		char szArtist[120];
		char szTitle[120];
		Mp3ReadId3V2Tag(&file, szArtist, sizeof(szArtist), szTitle, sizeof(szTitle));

		// Fill buffer
		f_read(&file, file_read_buffer, FILE_READ_BUFFER_SIZE, &br);

		// Play mp3
		hMP3Decoder = MP3InitDecoder();
		InitializeAudio(Audio44100HzSettings);
		SetAudioVolume(0xAF);
		PlayAudioWithCallback(AudioCallback, 0);

		for(;;) {
			/*
			 * If past half of buffer, refill...
			 *
			 * When bytes_left changes, the audio callback has just been executed. This
			 * means that there should be enough time to copy the end of the buffer
			 * to the beginning and update the pointer before the next audio callback.
			 * Getting audio callbacks while the next part of the file is read from the
			 * file system should not cause problems.
			 */
			if (bytes_left < (FILE_READ_BUFFER_SIZE / 2)) {
				// Copy rest of data to beginning of read buffer
				memcpy(file_read_buffer, read_ptr, bytes_left);

				// Update read pointer for audio sampling
				read_ptr = file_read_buffer;

				// Read next part of file
				btr = FILE_READ_BUFFER_SIZE - bytes_left;
				res = f_read(&file, file_read_buffer + bytes_left, btr, &br);

				// Update the bytes left variable
				bytes_left = FILE_READ_BUFFER_SIZE;

				// Out of data or error or user button... Stop playback!
				if (br < btr || res != FR_OK || BUTTON)
				  {
					StopAudio();

					// Re-initialize and set volume to avoid noise
					InitializeAudio(Audio44100HzSettings);
					SetAudioVolume(0);

					// Close currently open file
					f_close(&file);

					// Wait for user button release
					while(BUTTON){};

					// Return to previous function
					return;
				}
			}
		}
	}
}
Пример #23
0
AudioEngine::~AudioEngine()
{
    StopAudio();
}
Пример #24
0
void AudioPluginOSX::StopEmulation()
{
	Audio_Reset();
	StopAudio();
}