Example #1
0
void SNDDMA_Shutdown(void)
{
	if (snd_inited)
	{
		SDL_CloseAudio();
		snd_inited = 0;
	}
}
void AudioManager::deinit()
{
	//stop all playback
	stop();
	//completely tear down SDL audio. else SDL hogs audio resources and emulators might fail to start...
	SDL_CloseAudio();
	SDL_QuitSubSystem(SDL_INIT_AUDIO);
}
Example #3
0
AUD_SDLDevice::~AUD_SDLDevice()
{
	lock();
	SDL_CloseAudio();
	unlock();

	destroy();
}
Example #4
0
void ExitSDLSound ()
{
#if 0
    SDL_CloseAudio();

    m_pbNow = m_pbStart = m_pbEnd = NULL;
#endif
}
Example #5
0
void audio_device::sound_close()
{
    sound_stop();

    SDL_CloseAudio();
    audio_running = false;

}
Example #6
0
CSound::~CSound()
{
  // disable the sound
  SDL_PauseAudio(1);
  
  // shut down the SDL audio subsystem
  SDL_CloseAudio();
}
Example #7
0
// close audio device
static void uninit(int immed){
        mp_msg(MSGT_AO,MSGL_V,"SDL: Audio Subsystem shutting down!\n");
        if (!immed)
        while(buf_free() < BUFFSIZE - CHUNK_SIZE)
                usec_sleep(50000);
        SDL_CloseAudio();
        SDL_QuitSubSystem(SDL_INIT_AUDIO);
}
Example #8
0
void Java_org_puder_trs80_XTRS_setSoundMuted(JNIEnv* e, jclass clazz, jboolean muted) {
    if (muted) {
        sdl_audio_muted = 1;
        SDL_CloseAudio();
    }
    flush_audio_queue();
    sdl_audio_muted = muted;
}
Example #9
0
void wxSoundBackendSDL::CloseAudio()
{
    if (m_audioOpen)
    {
        SDL_CloseAudio();
        wxLogTrace(wxT("sound"), wxT("closed audio"));
        m_audioOpen = false;
    }
}
Example #10
0
/*
 * Shutdown
 */
void
syssnd_shutdown(void)
{
    if (!isAudioActive) return;

    SDL_CloseAudio();
    SDL_DestroyMutex(sndlock);
    isAudioActive = FALSE;
}
Example #11
0
AudioSdl::~AudioSdl()
{
	stopProcessing();

	SDL_CloseAudio();
	SDL_Quit();
	delete[] m_convertedBuf;
	delete[] m_outBuf;
}
Example #12
0
void sound_shutdown(void) {
#ifdef Z80_EMULATED
//puts("sound_shutdown");
    sound_stop();
    streams_sh_stop();
    YM2610_sh_stop();
    SDL_CloseAudio();
#endif
}
Example #13
0
/* Shut down audio */
void digi_audio_close()
{
	if (!digi_initialised) return;
	digi_initialised = 0;
#ifdef __MINGW32__
	SDL_Delay(500); // CloseAudio hangs if it's called too soon after opening?
#endif
	SDL_CloseAudio();
}
Example #14
0
static void sdl_kill(running_machine &machine)
{
	if (initialized_audio)
	{
		mame_printf_verbose("sdl_kill: closing audio\n");

		SDL_CloseAudio();
	}
}
Example #15
0
void I_ShutdownSound(void)
{
  int i;    
  I_ShutdownMusic();
  Mix_HaltChannel(-1);
  for (i=0 ; i<NUMSFX ; i++)
    Mix_FreeChunk( S_sfx[i].chunk );
  SDL_CloseAudio();
}
Example #16
0
void RemoveSound(void) {
	if (pSndBuffer == NULL) return;

	SDL_CloseAudio();
	DestroySDL();

	free(pSndBuffer);
	pSndBuffer = NULL;
}
Example #17
0
/* Open the mixer with a certain desired audio format */
int Mix_OpenAudio(int frequency, Uint16 format, int nchannels, int chunksize)
{
	int i;
	SDL_AudioSpec desired;

	/* If the mixer is already opened, increment open count */
	if ( audio_opened ) {
	    ++audio_opened;
	    return(0);
	}

	/* Set the desired format and frequency */
	desired.freq = frequency;
	desired.format = format;
	desired.channels = nchannels;
	desired.samples = chunksize;
	desired.callback = mix_channels;
	desired.userdata = NULL;

	/* Accept nearly any audio format */
	if ( SDL_OpenAudio(&desired, &mixer) < 0 ) {
		return(-1);
	}
#if 0
	PrintFormat("Audio device", &mixer);
#endif

	/* Initialize the music players */
	if ( open_music(&mixer) < 0 ) {
		SDL_CloseAudio();
		return(-1);
	}

	num_channels = MIX_CHANNELS;
	mix_channel = (struct _Mix_Channel *) malloc(num_channels * sizeof(struct _Mix_Channel));

	/* Clear out the audio channels */
	for ( i=0; i<num_channels; ++i ) {
		mix_channel[i].chunk = NULL;
		mix_channel[i].playing = 0;
		mix_channel[i].looping = 0;
		mix_channel[i].volume = SDL_MIX_MAXVOLUME;
		mix_channel[i].fade_volume = SDL_MIX_MAXVOLUME;
		mix_channel[i].fading = MIX_NO_FADING;
		mix_channel[i].tag = -1;
		mix_channel[i].expire = 0;
		mix_channel[i].effects = NULL;
		mix_channel[i].paused = 0;
	}
	Mix_VolumeMusic(SDL_MIX_MAXVOLUME);

	_Mix_InitEffects();

	audio_opened = 1;
	SDL_PauseAudio(0);
	return(0);
}
Example #18
0
Q_DECL_EXPORT
#endif
int main(int argc, char *argv[])
{
#if defined(Q_OS_LINUX) && !defined(MAEMO)
	QApplication::setAttribute(Qt::AA_X11InitThreads, true);
#endif
	QApplication a(argc, argv);
	QSize res = QApplication::desktop()->screenGeometry().size();
	if (res.width() < res.height())
		res.transpose();
	pixel_xres = res.width();
	pixel_yres = res.height();
	g_dpi_scale = CalculateDPIScale();
	dp_xres = (int)(pixel_xres * g_dpi_scale); dp_yres = (int)(pixel_yres * g_dpi_scale);
	net::Init();
	std::string savegame_dir = ".";
	std::string assets_dir = ".";
#if QT_VERSION > QT_VERSION_CHECK(5, 0, 0)
	savegame_dir = QStandardPaths::writableLocation(QStandardPaths::HomeLocation).toStdString();
	assets_dir = QStandardPaths::writableLocation(QStandardPaths::DataLocation).toStdString();
#elif defined(__SYMBIAN32__)
	savegame_dir = "E:/PPSSPP";
	assets_dir = "E:/PPSSPP";
#elif defined(BLACKBERRY)
	savegame_dir = "/accounts/1000/shared/misc";
	assets_dir = "app/native/assets";
#elif defined(MAEMO)
	savegame_dir = "/home/user/MyDocs/PPSSPP";
	assets_dir = "/opt/PPSSPP";
#endif
	savegame_dir += "/";
	assets_dir += "/";
	
	bool fullscreenCLI=false;
	for (int i = 1; i < argc; i++) 
	{
		if (!strcmp(argv[i],"--fullscreen"))
			fullscreenCLI=true;
	}
	NativeInit(argc, (const char **)argv, savegame_dir.c_str(), assets_dir.c_str(), nullptr, fullscreenCLI);
	
	int ret = mainInternal(a);

#ifndef MOBILE_DEVICE
	exit(0);
#endif
	NativeShutdownGraphics();
#ifdef SDL
	SDL_PauseAudio(1);
	SDL_CloseAudio();
#endif
	NativeShutdown();
	net::Shutdown();
	return ret;
}
Example #19
0
AudioSdl::~AudioSdl()
{
	stopProcessing();
	m_stopSemaphore.release();

	SDL_CloseAudio();
	SDL_Quit();
	delete[] m_convertedBuf;
	delete[] m_outBuf;
}
Example #20
0
void SST_ShutDown()
{
	if( !isup )
	{
		__warning( "sst is not up\n" );
		return;
	}

	SDL_CloseAudio();
}
Example #21
0
void close_sdl_audio(void) {
	sound_initialize=GN_FALSE;
    SDL_PauseAudio(1);
    SDL_CloseAudio();
    SDL_QuitSubSystem(SDL_INIT_AUDIO);
	if (desired) free(desired);
	desired = NULL;
	if (obtain) free(obtain);
	obtain = NULL;
}
/**
    \fn localStop
    \brief stop audio playback + cleanup buffers

*/
bool  sdlAudioDevice::localStop(void) 
{
	active=false;
    SDL_PauseAudio(1); // First pause it
    SDL_CloseAudio();
    SDL_QuitSubSystem(SDL_INIT_AUDIO);
    
	printf("[SDLAUDIO]Closing SDL audio\n");
	return true;
}
Example #23
0
/****Main Function*********************************************************************/
int main(int argc, char **argv) 
{
	
    if(!Jukebox::init())
		exit;
    glutInit(&argc, argv);
    Game::getInstance().init();
    SDL_CloseAudio();
	
}
Example #24
0
int SOUND_CloseAudio()
{
   if (g_fAudioOpened) {
      SDL_CloseAudio();
      if (g_fSDLInit) {
         SDL_Quit();
      }
   }
   return 0;
}
Example #25
0
void soundb_sdl_done(void)
{
	log_std(("sound:sdl: soundb_sdl_done()\n"));

	if (sdl_state.active_flag) {
		sdl_state.active_flag = 0;
		SDL_CloseAudio();
		SDL_QuitSubSystem(SDL_INIT_AUDIO);
	}
}
Example #26
0
/**
 * Shut down the audio subsystem.
 */
int KillSound(void) {
    FCEUI_Sound(0);
    SDL_CloseAudio();
    SDL_QuitSubSystem(SDL_INIT_AUDIO);
    if (s_Buffer) {
        free((void *) s_Buffer);
        s_Buffer = 0;
    }
    return (0);
}
Example #27
0
Game::~Game() {
    m_res_manager.shutdown();
    TTF_Quit();
    SDL_CloseAudio();
    SDL_DestroyRenderer(m_render);
    SDL_DestroyWindow(m_window);
    Mix_Quit();
    IMG_Quit();
    SDL_Quit();
}
Example #28
0
void SDLAudioSink::stop()
{
    if (_started)
    {
        if (!_paused) SDL_PauseAudio(1);
        SDL_CloseAudio();

        osg::notify(osg::NOTICE)<<"~SDLAudioSink() destructor, but still playing"<<std::endl;
    }
}
Example #29
0
void WINCESdlMixerManager::init() {
	SDL_AudioSpec desired;
	int thread_priority;

	uint32 sampleRate = compute_sample_rate();
	if (sampleRate == 0)
		warning("OSystem_WINCE3::setupMixer called with sample rate 0 - audio will not work");
	else if (_mixer && _mixer->getOutputRate() == sampleRate) {
		debug(1, "Skipping sound mixer re-init: samplerate is good");
		return;
	}

	memset(&desired, 0, sizeof(desired));
	desired.freq = sampleRate;
	desired.format = AUDIO_S16SYS;
	desired.channels = 2;
	desired.samples = 128;
	desired.callback = private_sound_proc;
	desired.userdata = this;

	// Create the mixer instance
	if (_mixer == 0)
		_mixer = new Audio::MixerImpl(g_system, sampleRate);

	// Add sound thread priority
	if (!ConfMan.hasKey("sound_thread_priority"))
		thread_priority = THREAD_PRIORITY_NORMAL;
	else
		thread_priority = ConfMan.getInt("sound_thread_priority");

	desired.thread_priority = thread_priority;

	SDL_CloseAudio();
	if (SDL_OpenAudio(&desired, NULL) != 0) {
		warning("Could not open audio device: %s", SDL_GetError());
		_mixer->setReady(false);

	} else {
		debug(1, "Sound opened OK, mixing at %d Hz", sampleRate);

		// Re-create mixer to match the output rate
		int vol1 = _mixer->getVolumeForSoundType(Audio::Mixer::kPlainSoundType);
		int vol2 = _mixer->getVolumeForSoundType(Audio::Mixer::kMusicSoundType);
		int vol3 = _mixer->getVolumeForSoundType(Audio::Mixer::kSFXSoundType);
		int vol4 = _mixer->getVolumeForSoundType(Audio::Mixer::kSpeechSoundType);
		delete _mixer;
		_mixer = new Audio::MixerImpl(g_system, sampleRate);
		_mixer->setVolumeForSoundType(Audio::Mixer::kPlainSoundType, vol1);
		_mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, vol2);
		_mixer->setVolumeForSoundType(Audio::Mixer::kSFXSoundType, vol3);
		_mixer->setVolumeForSoundType(Audio::Mixer::kSpeechSoundType, vol4);
		_mixer->setReady(true);
		SDL_PauseAudio(0);
	}
}
int video_thread(void *arg) {
  VideoState *is = (VideoState *)arg;
  AVPacket pkt1, *packet = &pkt1;
  int len1, frameFinished;
  AVFrame *pFrame;
  double pts;

  pFrame = avcodec_alloc_frame();

  is->rgbaFrame = avcodec_alloc_frame();
  avpicture_alloc ((AVPicture *)is->rgbaFrame, PIX_FMT_RGBA, is->video_st->codec->width, is->video_st->codec->height);


  for(;;) {
    if(packet_queue_get(&is->videoq, packet, 1) < 0) {
      // means we quit getting packets
      break;
    }
    pts = 0;

    // Save global pts to be stored in pFrame
    global_video_pkt_pts = packet->pts;
    // Decode video frame
    len1 = avcodec_decode_video2(is->video_st->codec, pFrame, &frameFinished,
        packet);
    if(packet->dts == AV_NOPTS_VALUE
       && pFrame->opaque && *(uint64_t*)pFrame->opaque != AV_NOPTS_VALUE) {
      pts = (double)(*(uint64_t *)pFrame->opaque);
    } else if(packet->dts != AV_NOPTS_VALUE) {
		pts = (double)packet->dts;
    } else {
      pts = 0;
    }
    pts *= av_q2d(is->video_st->time_base);


    // Did we get a video frame?
    if(frameFinished) {
      pts = synchronize_video(is, pFrame, pts);
      if(queue_picture(is, pFrame, pts) < 0) {
  break;
      }
    }
    av_free_packet(packet);
  }

  SDL_CloseAudio();

  av_free(pFrame);

  avpicture_free((AVPicture *)is->rgbaFrame);
  av_free(is->rgbaFrame);

  return 0;
}