Beispiel #1
0
void al_pause_duh(AL_DUH_PLAYER *dp)
{
	if (dp && dp->sigrenderer && (dp->flags & ADP_PLAYING)) {
		voice_stop(dp->stream->voice);
		dp->flags &= ~ADP_PLAYING;
	}
}
Beispiel #2
0
void osd_stop_audio_stream(void)
{
#ifdef USE_SEAL
	int i;
#endif


	if (Machine->sample_rate == 0) return;

#ifdef USE_SEAL
	/* stop and release voices */
	for (i = 0;i < SOUND_CHANNELS;i++)
	{
		if (lpWave[i])
		{
			AStopVoice(hVoice[i]);
			ADestroyAudioData(lpWave[i]);
			free(lpWave[i]);
			lpWave[i] = 0;
			ADestroyAudioVoice(hVoice[i]);
		}
	}
#endif
#ifdef USE_ALLEGRO
	voice_stop(myvoice);
	deallocate_voice(myvoice);
	destroy_sample(mysample);
	mysample = 0;
#endif

	stream_playing = 0;
}
Beispiel #3
0
void SOUNDCLIP::pause() {
    if (state_ != SoundClipPlaying) { return; }

    int voice = get_voice();
    if (voice >= 0) {
        voice_stop(voice);
        state_ = SoundClipPaused;
    }
}
Beispiel #4
0
void saDestroyChannel( int chan )
{
  if( lpWave[chan] ){
    voice_stop(hVoice[chan]);
    destroy_sample( lpWave[chan] );
    lpWave[chan] = 0;
    playing[chan] = 0;
    deallocate_voice(hVoice[chan]);
  }
}
Beispiel #5
0
void pause_mod (void)
{
    int index;

    mi.forbid = TRUE;
    mi.pause = TRUE;
    for (index=0; index<(mi.max_chn); index++)
        voice_stop (voice_table[index]);

    mi.forbid = FALSE;
}
Beispiel #6
0
void sa_pause_sound(void)
{
   int i;

   pause_sound	    = 1;

   //pause_raine_ym3812();
   for( i = 0; i < NUMVOICES; i++ ){
     if (playing[i])
       voice_stop( hVoice[i] );
   }
}
Beispiel #7
0
void kill_loop(short *voice)
{
 if (!snd_data)
   return;

 if (*voice < 0)
   return;

 voice_stop(*voice);
 deallocate_voice(*voice);
 *voice = -1;
}
void _apeg_audio_set_speed_multiple(APEG_LAYER *layer, float multiple)
{
	if(layer->audio.stream)
	{
		int newfreq = (float)layer->stream.audio.freq * multiple;
		int voice = layer->audio.voice;

		if(newfreq > 0)
		{
			voice_set_frequency(voice, newfreq);
			voice_start(voice);
		}
		else
			voice_stop(voice);
	}
}
Beispiel #9
0
static void NORETURN_ATTR audio_thread(void)
{
    struct queue_event ev;
    ev.id = Q_NULL; /* something not in switch below */

    pcm_postinit();

    while (1)
    {
        switch (ev.id)
        {
        /* Starts the playback engine branch */
        case Q_AUDIO_PLAY:
            LOGFQUEUE("audio < Q_AUDIO_PLAY");
            audio_playback_handler(&ev);
            continue;

        /* Playback has to handle these, even if not playing */
        case Q_AUDIO_REMAKE_AUDIO_BUFFER:
#ifdef HAVE_DISK_STORAGE
        case Q_AUDIO_UPDATE_WATERMARK:
#endif
            audio_playback_handler(&ev);
            break;

#ifdef AUDIO_HAVE_RECORDING
        /* Starts the recording engine branch */
        case Q_AUDIO_INIT_RECORDING:
            LOGFQUEUE("audio < Q_AUDIO_INIT_RECORDING");
            audio_recording_handler(&ev);
            continue;
#endif

        /* All return upon USB */
        case SYS_USB_CONNECTED:
            LOGFQUEUE("audio < SYS_USB_CONNECTED");
            voice_stop();
            usb_acknowledge(SYS_USB_CONNECTED_ACK);
            usb_wait_for_disconnect(&audio_queue);
            break;
        }

        queue_wait(&audio_queue, &ev);
    }
}
Beispiel #10
0
void stop_mod (void)
{
    int index;

    if (of == null)
        return;

    mi.forbid = TRUE;
    mi.is_playing = FALSE;
    mi.trk = 0;
    for (index=0; index<(mi.max_chn); index++)
        {
        voice_stop (voice_table[index]);
        voice_set_volume (voice_table[index], 0);
        }
        
    of = null;
    mi.forbid = FALSE;
}END_OF_FUNCTION (stop_mod)
Beispiel #11
0
void FreePlayerAnimation(struct Animation *Anim)
{
   int c;

   if (Anim) {
      c = 3;
      while (c--)
         destroy_bitmap(Anim->Animation[c]);
      destroy_bitmap(Anim->Still);
      destroy_bitmap(Anim->Slow);
      destroy_bitmap(Anim->Medium);
      destroy_bitmap(Anim->Fast);

      if (Anim->SkateVoice >= 0) {
         voice_stop(Anim->SkateVoice);
         release_voice(Anim->SkateVoice);
      }

      free(Anim);
   }
}
Beispiel #12
0
static void allegro_close(void)
{
    voice_stop(voice);
    deallocate_voice(voice);
    destroy_sample(buffer);
}
Beispiel #13
0
// pauses all active voices
void pause_all_sfx()
{
    for(int i=0; i<WAV_COUNT; i++)
        if(sfx_voice[i]!=-1)
            voice_stop(sfx_voice[i]);
}
Beispiel #14
0
// pauses a voice
void pause_sfx(int index)
{
    if(index>0 && index<WAV_COUNT && sfx_voice[index]!=-1)
        voice_stop(sfx_voice[index]);
}
void Arcade()
{
    int selectedplayer,nextmap,nextplayer,won=1;
    Location locat;
    int Played[5],i,playedCount=1,exists=1;
    //Loading of data
    voice_set_playmode(Dramatic, PLAYMODE_LOOP);
    Cinematic1();
    voice_ramp_volume(Dramatic,1000,Music_volume);
    rest(1000);
    selectedplayer=CharacterSelect();
    if(selectedplayer==-1)
    {
        voice_stop(Dramatic);
        return;
    }
    Played[0]=selectedplayer;

    while(playedCount<5)
    {
        if(won)
        {
            exists=1;
            while(exists)
            {
                nextplayer=Random(0,4);
                player1=selectedplayer;
                player2=nextplayer;
                exists=0;
                for (i=0; i<playedCount; i++)
                {
                    if(Played[i]==nextplayer)
                    {
                        exists=1;
                    }
                }
            }
            Played[playedCount]=nextplayer;
            playedCount++;

            nextmap=Random(0,4);
        }

        CinematicVoice(selectedplayer,nextplayer,nextmap);
        voice_stop(Dramatic);

        switch(GamePlay(selectedplayer,nextplayer,nextmap,1))
        {
        case 0:
            voice_stop(Dramatic);
            return;
        case 1:
            won=1;
            CinematicWin(selectedplayer,nextplayer);
            break;
        case 2:
            won=0;
            if(!GameOver(selectedplayer))
            {
                voice_stop(Dramatic);
                return;
            }
            break;
        }
        Savegame();
    }
    voice_stop(Dramatic);
}
Beispiel #16
0
int main() 
	{
         
           
        
	    int audio, working_format, bitcap,stereocap,ratecap;
	  int ofs = 0;
	    int len;
	    int interval;
	  SAMPLE *sample;
	    int foo;
	    int size = 1024*1024;
	    unsigned char *buf;
	    init();
	       show_mouse(screen);
	  bitcap = get_sound_input_cap_bits();
	    if (bitcap == 0) 
	        allegro_message("No Audio input capabilty?");
	    stereocap = get_sound_input_cap_stereo();
	  if (stereocap == 0) 
	    allegro_message("No Sterecordingreo ");
	    ratecap = get_sound_input_cap_rate(bitcap, 0);
	    working_format = get_sound_input_cap_parm(ratecap, bitcap, 0);
	    if (working_format == 0) 
	        allegro_message("We Are not a go!"); 
	    else if (working_format == 1) 
	    allegro_message("We Are a go but can't record and playback at the same time!");
	    else if (working_format == 2) 
	    allegro_message("We Are a go!");
	    BITMAP *catli=NULL,*catmo=NULL,*catmc=NULL;
	    catli=load_bitmap("listen.bmp",NULL);
	    catmo=load_bitmap("mo.bmp",NULL);
	    catmc=load_bitmap("mc.bmp",NULL);
	  
	    sample = create_sample(bitcap, 0, ratecap, size);
	    buf=(unsigned char*)(sample->data);

	    allegro_message("Start Recording");
	    len = start_sound_input(ratecap, 16, 0);
	     masked_blit(catli,screen,0,0,200,50,500,500);
	    
	    interval = 1000 / ((len / 2) / ratecap);
	    
	    interval *= 9;
	    interval /= 10;
 	  
	    
	   
	    while (!keypressed() && ofs < size) 
	    {
	        foo = read_sound_input(buf);        
	        if (foo > 0) 
	        {
	            ofs += len;
	            buf += len;
	        }
	        rest(interval);
	    }
	 if (keypressed()) 
	    {
	        foo = read_sound_input(buf);        
	        if (foo > 0) 
	        {
	            ofs += len;
	            buf += len;
	        }
	    }
	    
	   
       	    stop_sound_input();
	     BITMAP *bit=NULL,*bit2=NULL;
	    bit=load_bitmap("play.bmp",NULL);
	   masked_blit(bit,screen,0,0,100,100,400,400);
bit2=load_bitmap("pause.bmp",NULL);
	   masked_blit(bit2,screen,0,0,100,200,400,400);
	audio= allocate_voice(sample);
int u=0;
	  while (!key[KEY_ESC]) {
          	if((mouse_x>=100 && mouse_x<=200)&&(mouse_y>=100 && mouse_y<=200)&& mouse_b&0x1)
	{ play_sample(sample,255,128,1400,0);
         //voice_start(audio);
           while(!((mouse_x>=100 && mouse_x<=200)&&(mouse_y>=200 && mouse_y<=300)&& mouse_b&0x1u<=10)&& u<size)
          { masked_blit(catmo,screen,0,0,200,100,500,500);
            rest(300);
             masked_blit(catmc,screen,0,0,200,100,500,500);
             rest(300);
             u++;
             }
}
    if((mouse_x>=100 && mouse_x<=200)&&(mouse_y>=200 && mouse_y<=300)&& mouse_b&0x1)
	  {
                     voice_stop(audio);
                      masked_blit(catmc,screen,0,0,200,100,500,500);}
    /* put your code here */
	  }
	 
	  deinit();
	  return 0;
	}
Beispiel #17
0
void PauseAnimation(struct Animation *Anim)
{
   if (Anim->SkateVoice >= 0)
      voice_stop(Anim->SkateVoice);
}
Beispiel #18
0
int _apeg_audio_flush(APEG_LAYER *layer)
{
	unsigned char *buf = layer->audio.pcm.samples;
	unsigned char *data;
	int hs;
	int ret = APEG_OK;

	if(layer->audio.pcm.point < layer->audio.bufsize)
	{
		int count = layer->audio.pcm.point / 2;
		int samplesend = layer->audio.bufsize / 2;

		while(count < samplesend)
			((short*)buf)[count++] = 0x8000;

		if(layer->audio.pcm.point == 0)
			ret = APEG_EOF;
	}

	if(layer->audio.callback)
	{
		if(ret != APEG_OK)
			return ret;

		ret = layer->audio.callback((APEG_STREAM*)layer, buf,
		                            layer->audio.pcm.point,
		                            layer->audio.callback_arg);
		if(ret < 0)
			return APEG_ERROR;

		if(ret > 0)
		{
			layer->audio.pos += ret / 2 / layer->stream.audio.channels;
			layer->audio.pcm.point -= ret;
			if(layer->audio.pcm.point > 0)
				memmove(buf, buf+ret, layer->audio.pcm.point);
			layer->stream.audio.flushed = TRUE;

			if(!(layer->stream.flags&APEG_HAS_VIDEO))
				layer->stream.pos = (double)layer->audio.pos /
				                    (double)layer->stream.audio.freq;
		}

		return APEG_OK;
	}

	/* We need to test the stream buffer to see if it's ready for more audio
	 * yet.
	 */
	hs = layer->audio.stream->len/2;
	if((layer->audio.buf_segment &&
	    voice_get_position(layer->audio.voice) >= hs) ||
	   (!layer->audio.buf_segment &&
	    voice_get_position(layer->audio.voice) < hs))
		return ret;

	voice_stop(layer->audio.voice);
	data  = layer->audio.stream->data;
	data += layer->audio.buf_segment * hs * layer->stream.audio.channels * 2;

	/* Commit the buffer to the stream and update the time */
	memcpy(data, buf, layer->audio.bufsize);

	voice_start(layer->audio.voice);
	layer->audio.buf_segment ^= 1;

	layer->audio.pos += ((layer->audio.pcm.point >= layer->audio.bufsize) ?
	                     layer->audio.samples_per_update :
	                     (layer->audio.pcm.point/2/layer->stream.audio.channels));
	if(!(layer->stream.flags&APEG_HAS_VIDEO))
		layer->stream.pos = (double)layer->audio.pos /
		                    (double)layer->stream.audio.freq;

	/* Remove the old data and put the unused samples at the beginning */
	layer->audio.pcm.point -= layer->audio.bufsize;
	if(layer->audio.pcm.point > 0)
		memmove(buf, buf+layer->audio.bufsize, layer->audio.pcm.point);
	else if(layer->audio.pcm.point < 0)
		layer->audio.pcm.point = 0;

	layer->stream.audio.flushed = TRUE;

	return ret;
}
Beispiel #19
0
static int allegro_suspend(void)
{
    voice_stop(voice);
    been_suspended = 1;
    return 0;
}