示例#1
0
VbError_t VbExBeep(uint32_t msec, uint32_t frequency)
{
	int res;
        if (frequency) {
                res = sound_start(frequency);
        } else {
                res = sound_stop();
	}

	if (res > 0) {
		// The previous call had an error.
		return VBERROR_UNKNOWN;
	} else if (res < 0) {
		// Non-blocking beeps aren't supported.
		if (msec > 0 && sound_play(msec, frequency))
			return VBERROR_UNKNOWN;
		return VBERROR_NO_BACKGROUND_SOUND;
	} else {
		// The non-blocking call worked. Delay if requested.
		if (msec > 0) {
			mdelay(msec);
			if (sound_stop())
				return VBERROR_UNKNOWN;
		}
		return VBERROR_SUCCESS;
        }
}
示例#2
0
void error(void){
    set_all_leds(POWER,0,0);
    sound_start(4);
    delay(100);
    sound_stop();
    set_all_leds(0,0,0);
    delay(50);
    set_all_leds(POWER,0,0);
    sound_start(4);
    delay(100);
    sound_stop();
    set_all_leds(0,0,0); 
    delay(10);
}
示例#3
0
文件: weapon.c 项目: zid/naev
/**
 * @brief Clears all the weapons, does NOT free the layers.
 */
void weapon_clear (void)
{
   int i;
   /* Don't forget to stop the sounds. */
   for (i=0; i < nwbackLayer; i++) {
      sound_stop(wbackLayer[i]->voice);
      weapon_free(wbackLayer[i]);
   }
   nwbackLayer = 0;
   for (i=0; i < nwfrontLayer; i++) {
      sound_stop(wfrontLayer[i]->voice);
      weapon_free(wfrontLayer[i]);
   }
   nwfrontLayer = 0;
}
示例#4
0
文件: sound.c 项目: skyfex/happygem
void sound_process()
{
   if (snd.current_pattern) {
      if (snd.delay_i) {
         snd.delay_i--;
         if (!snd.delay_i)
            sound_update();
      }
      else {
         snd.dur_i++;
         if (snd.dur_i == snd.current_pattern->sounds[snd.sound_i].dur) {
            snd.dur_i = 0;
            snd.sound_i++;
            if (snd.current_pattern->delay)
               snd.delay_i = snd.current_pattern->delay;
            if (snd.sound_i == snd.current_pattern->count) {
               snd.sound_i = 0;
               snd.repeat_i++;
               if (snd.repeat_i == snd.current_pattern->repeat) {
                  sound_stop();
                  return;
               }
            }
            sound_update();  
         }
      }
   }  
}
示例#5
0
gme_err_t Music_Player::start_track( int track )
{
	if ( emu_ )
	{
		gme_free_info( track_info_ );
		track_info_ = NULL;
		RETURN_ERR( gme_track_info( emu_, &track_info_, track ) );
	
		// Sound must not be running when operating on emulator
		sound_stop();
		RETURN_ERR( gme_start_track( emu_, track ) );
		
		// Calculate track length
		if ( track_info_->length <= 0 )
			track_info_->length = track_info_->intro_length +
						track_info_->loop_length * 2;
		
		if ( track_info_->length <= 0 )
			track_info_->length = (long) (2.5 * 60 * 1000);
		gme_set_fade( emu_, track_info_->length );
		
		paused = false;
		sound_start();
	}
	return 0;
}
示例#6
0
void main_poke()
{
   sound_stop();
   DialogBox(hIn, MAKEINTRESOURCE(IDD_POKE), wnd, pokedlg);
   eat();
   sound_play();
}
示例#7
0
void opensnap()
{
   sound_stop();
   opensnap(0);
   eat();
   sound_play();
}
示例#8
0
void savesnap()
{
   sound_stop();
   savesnap(-1);
   eat();
   sound_play();
}
示例#9
0
void Music_Player::pause( int b )
{
	paused = b;
	if ( b )
		sound_stop();
	else
		sound_start();
}
示例#10
0
文件: trap.c 项目: Protovision/io-lua
int	trap_StopSound(lua_State *s)
{
	CHANNEL c;

	trap_args(s, "StopSound", "i", &c);
	sound_stop(c);
	return 0;
}
示例#11
0
void main_maxspeed()
{
   conf.sound.enabled ^= 1;
   temp.frameskip = conf.sound.enabled? conf.frameskip : conf.frameskipmax;
   if (conf.sound.enabled) sound_play(); else sound_stop();
   sprintf(statusline, "Max speed: %s", conf.sound.enabled ? "NO" : "YES"); statcnt = 50;
   set_priority();
}
示例#12
0
void audio_device::sound_close()
{
    sound_stop();

    SDL_CloseAudio();
    audio_running = false;

}
示例#13
0
void sound_shutdown(void) {
#ifdef Z80_EMULATED
//puts("sound_shutdown");
    sound_stop();
    streams_sh_stop();
    YM2610_sh_stop();
    SDL_CloseAudio();
#endif
}
示例#14
0
文件: sound.c 项目: kamejoko80/xboot
void sound_free(struct sound_t * snd)
{
	if(snd)
	{
		sound_stop(snd);
		if(snd->close)
			snd->close(snd);
		free(snd);
	}
}
示例#15
0
int answer_play(char* filename) // Отвечает и воспроизводит файл
{
	ANSWER;
	MODE_MYSOUND;
	_delay_ms(1000);
	if (play_wav_pgm(filename) == 0)
	{
		while (sound_read() >= 0)
		{
			if (!LINE_POWER || OFFHOOK) // Сняли трубку, или сигнал исчез
			{
				sound_stop();
				return 1;
			}
		}
		sound_stop();
	}
	return 0;
}
示例#16
0
void main_selectfilter()
{
   sound_stop();
   int index = DialogBoxParam(hIn, MAKEINTRESOURCE(IDD_FILTER_DIALOG), wnd, filterdlg, 0);
   eat(); sound_play(); if (index < 0) return;

   conf.render = index;
   sprintf(statusline, "Video: %s", renders[index].name); statcnt = 50;
   apply_video(); eat();
}
示例#17
0
void correct_exit()
{
   sound_stop();
   if(!done_fdd(true))
       return;

   nowait = 1;
   normal_exit = true;
   exit();
}
示例#18
0
int main (void)
{
	clunet_init();  
	clunet_set_on_data_received(data_received);	
	time_init();
	sei();
	//eeprom_write_dword((void*)0, 0);
	record_num = eeprom_read_dword((void*)0); // Читаем кол-во записей
	mode_current = eeprom_read_byte((void*)4); // Режим 
	mode_temp = eeprom_read_byte((void*)5); // Временный режим

	disk_initialize(0);	

	unset_bit(DDRA, 3); set_bit(PORTA, 3);	 // Определение сигнала в линии	
	//unset_bit(DDRA, 4);	unset_bit(PORTA, 4); // Открывалка двери, напрямую
	set_bit(DDRA, 4);	unset_bit(PORTA, 4); // Открывалка двери, через реле
	set_bit(DDRA, 5); HANGUP; // Реле снимания трубки
	set_bit(DDRA, 6); MODE_NORMAL; // Реле выбора режима
	unset_bit(DDRG, 0); set_bit(PORTG, 0); // Определение, лежит ли трубка	
	set_bit(DDRD, 6); set_bit(DDRD, 7); // Светодиоды
	unset_bit(DDRA, 7); set_bit(PORTA, 7); // Счётчик оборотов диска

	unset_bit(DDRF, 0); // ADC+
	unset_bit(PORTF, 0);
	unset_bit(DDRF, 1); // ADC-
	unset_bit(PORTF, 1);

	beep(500, 200);
	beep(1500, 200);
	beep(3000, 200);
	_delay_ms(1000);
	if (play_wav_pgm(STARTED_WAV) == 0)
	{
		LED_GREEN_ON;
		while (sound_read() >= 0) ;
		LED_GREEN_OFF;
		sound_stop();
	} else {
		LED_RED_ON;
		beep(3000, 200);
		beep(1500, 200);
		beep(500, 200);
		LED_RED_OFF;
	}
	
	send_current_mode(CLUNET_BROADCAST_ADDRESS);

	while(1)
	{
		if (is_LINE_POWER()) incoming_ring();
		if (OFFHOOK) control_mode();
		transfer_data(); // Передаём данные на досуге.
	}
}
示例#19
0
文件: system.c 项目: gravufo/INF3995
void system_end(void)
{
	clear_screen();
	XTft_DisableDisplay(&g_tft);
	XIntc_MasterDisable(XPAR_INTC_0_BASEADDR);
	system_disable_caches();
	microblaze_disable_interrupts();
	system_stop_network();
	sound_stop();
	htmlParserCleanup();
}
示例#20
0
文件: sound.c 项目: skyfex/happygem
void sound_init()
{
   DDRD |= (1<<3); // Enable output on sound pin
   
   TCCR4A_struct.wgm4 = 0;
   TCCR4B_struct.wgm4 = 1;
   OCR4A = 3822;
   TIMSK4_struct.ocie4a = 1;
   TCCR4B_struct.cs4 = 0;  

   sound_stop();
}
示例#21
0
文件: ui.c 项目: barak/gtkboard
void ui_cleanup ()
{
	if (opt_game)
		ui_terminate_game();
	sound_stop ();
	prefs_write_config_file ();
	signal (SIGCHLD, ignore);
	if (engine_pid > 0)
		kill (engine_pid, SIGKILL);
	if (opt_verbose)
		printf ("gtkboard: normal exit.\n");
	exit (0);
}
示例#22
0
文件: weapon.c 项目: zid/naev
/**
 * @brief Destroys a weapon.
 *
 *    @param w Weapon to destroy.
 *    @param layer Layer to which the weapon belongs.
 */
static void weapon_destroy( Weapon* w, WeaponLayer layer )
{
   int i;
   Weapon** wlayer;
   int *nlayer;
   Pilot *pilot_target;

   /* Decrement target lockons if needed */
   if (outfit_isSeeker(w->outfit)) {
      pilot_target = pilot_get( w->target );
      if (pilot_target != NULL)
         pilot_target->lockons--;
   }

   /* Stop playing sound if beam weapon. */
   if (outfit_isBeam(w->outfit)) {
      sound_stop( w->voice );
      sound_playPos(w->outfit->u.bem.sound_off,
            w->solid->pos.x,
            w->solid->pos.y,
            w->solid->vel.x,
            w->solid->vel.y);
   }

   switch (layer) {
      case WEAPON_LAYER_BG:
         wlayer = wbackLayer;
         nlayer = &nwbackLayer;
         break;
      case WEAPON_LAYER_FG:
         wlayer = wfrontLayer;
         nlayer = &nwfrontLayer;
         break;

      default:
         WARN("Unknown weapon layer!");
   }

   for (i=0; (wlayer[i] != w) && (i < *nlayer); i++); /* get to the curent position */
   if (i >= *nlayer) {
      WARN("Trying to destroy weapon not found in stack!");
      return;
   }

   weapon_free(wlayer[i]);
   wlayer[i] = NULL;
   (*nlayer)--;

   for ( ; i < (*nlayer); i++)
      wlayer[i] = wlayer[i+1];
}
示例#23
0
int answer_record(char* filename1, char* filename2, char use_beep) // Отвечает, записывает сообщение,
{
	if (answer_play(filename1)) return 1; // Отвечаем, предлагаем оставить сообщение
	if (use_beep) beep(3000, 500);	// Биип
	sprintf(buffer, "/%08lu.wav", record_num); // Формируем имя файла
	clunet_send(CLUNET_BROADCAST_ADDRESS, CLUNET_PRIORITY_INFO, CLUNET_COMMAND_INTERCOM_MESSAGE, (char*)&record_num, sizeof(record_num)); // Отправляем в сеть сообщение
	record_num++;
	eeprom_write_dword((void*)0, record_num); // Запоминаем кол-во записей
	if (rec_wav(buffer) == 0) // Пишем сообщение
	{
		int s = 0;
		long int totalSize = 0;
		while (s >= 0 && totalSize < 8000UL*RECORD_MAX_LENGTH)
		{
			s = sound_write();
			totalSize += s;
			if (!LINE_POWER || OFFHOOK) // Сняли трубку, или сигнал исчез
			{
				sound_stop();
				return 1;
			}
		}
		sound_stop();
	}	
	if (play_wav_pgm(filename2) == 0) // Если пациент дождался, благодарим
	{
		while (sound_read() >= 0)
		{
			if (!LINE_POWER || OFFHOOK) // Сняли трубку, или сигнал исчез
			{
				sound_stop();
				return 1;
			}
		}
		sound_stop();
	}
	return 0;
}
示例#24
0
void main_save()
{
   sound_stop();
   if (conf.cmos)
       save_nv();
   unsigned char optype = 0;
   for (int i = 0; i < 4; i++)
   {
      if (!comp.wd.fdd[i].test())
          return;
      optype |= comp.wd.fdd[i].optype;
   }

   if (!optype)
       sprintf(statusline, "all saved"), statcnt = 30;
}
示例#25
0
void main_pause()
{
   text_i(rbuf+temp.scx/2-8,"pause",0x0F); flip();

   pause = 1;
   sound_stop();
   updatebitmap();
   active = 0;
   adjust_mouse_cursor();

   while (!process_msgs());
   eat();

   active = 1; adjust_mouse_cursor();
   sound_play();
   pause = 0;
}
示例#26
0
文件: timer.c 项目: hine/MXBasic
void __attribute__ (( interrupt(ipl2), vector(_TIMER_1_VECTOR) )) _T1Interrupt(void)
{
    //extern void disk_timerproc(void);
    unsigned short key;

    // *** down count, etc timer *******************
    // provide timer
    if(AplTimer) AplTimer--;
    if(delay_timer) delay_timer--;

    // disk i/o command timeout timer
    //disk_timerproc();

    // support Display refresh timing
    //if(RefreshTime) RefreshTime--;

    // support USB keyboard polling(10msec)
    if(!KeyPolling){
        //USBTasks();
        // keyboard_scan();
        KeyPolling=10;
    }else{
        KeyPolling--;
    }

    // *** toggle interval timer *************
    if(soundon == 1){
        soundcount--;
        if(soundcount <= 0) sound_stop();
    }
 
    // update 2Hz cursor blink timer
    if(!(timer_tick % 500)) CursorBlink ^= 1;

    // count up timer_tick
    ++timer_tick;

    // *** 1sec interval process *******
    if(timer_tick >= 1000){
        timer_tick = 0;
    } // tick  

    // clear interrupt flag
    clear_timer();

}
示例#27
0
文件: sound.c 项目: barak/gtkboard
void sound_play_real (char *file)
{
#ifdef HAVE_SDL
    SDL_AudioSpec wave;
    SDL_AudioCVT cvt;
    Uint8 *tmp;

    sound_stop ();

    music = Mix_LoadMUS (file);
    if (!music)
    {
        fprintf(stderr, "Couldn't load %s: %s\n", file, SDL_GetError());
        return;
    }
    Mix_PlayMusic(music, 0);

#endif
}
示例#28
0
void main_selectdriver()
{
   if (!(temp.rflags & RF_DRIVER)) {
     strcpy(statusline, "Not available for this filter"); statcnt = 50;
     return;
   }

   sound_stop();
   int index = DialogBoxParam(hIn, MAKEINTRESOURCE(IDD_FILTER_DIALOG), wnd, filterdlg, 1);
   eat();
   sound_play();

   if (index < 0)
       return;

   conf.driver = index;
   sprintf(statusline, "Render to: %s", drivers[index].name); statcnt = 50;
   apply_video();
   eat();
}
示例#29
0
文件: state_io.c 项目: saucjedi/nagi
u8 *cmd_restart_game(u8 *c)
{
	u16 snd_state;
	u16 user_result;
	u16 input_state;
	
	sound_stop();
	input_state = input_edit_status();
	input_edit_on();
	
	if (flag_test(F16_RESTARTMODE) != 0)
		user_result = 1;
	else
		user_result = message_box("Press ENTER to restart\nthe game.\n\nPress ESC to continue\nthis game.");

	if ( user_result != 0)
	{
		cmd_cancel_line(0);
		snd_state = flag_test(F09_SOUND);
		//clear_memory();	// shouldn't be necessary
		game_init();
		volumes_close();
		flag_set(F06_RESTART);
		if ( snd_state != 0)
			flag_set(F09_SOUND);
		state.ticks = 0;
		if (trace_logic != 0)
			logic_load_2(trace_logic);
		menu_enable_all();
	}
	
	
	if ( (user_result != 0) || (input_state != 0) )
		input_edit_off();
	
	if (user_result != 0)
		return 0;
	else
		return c;
}
示例#30
0
blargg_err_t Music_Player::start_track( int track )
{
	if ( emu_ )
	{
		// Sound must not be running when operating on emulator
		sound_stop();
		RETURN_ERR( emu_->start_track( track ) );
		
		// Calculate track length
		if ( !emu_->track_info( &track_info_ ) )
		{
			if ( track_info_.length <= 0 )
				track_info_.length = track_info_.intro_length +
						track_info_.loop_length * 2;
		}
		if ( track_info_.length <= 0 )
			track_info_.length = (long) (2.5 * 60 * 1000);
		emu_->set_fade( track_info_.length );
		
		paused = false;
		sound_start();
	}
	return 0;
}