Exemple #1
0
void USBStorage_Deinitialize()
{
	__usbstorage_Shutdown();

	LWP_CloseQueue(__usbstorage_waitq);

	__inited = false;
}
Exemple #2
0
static void wii_audio_free(void *data)
{
   AUDIO_StopDMA();
   AUDIO_RegisterDMACallback(NULL);
   if (g_audio && g_audio->cond)
   {
      LWP_CloseQueue(g_audio->cond);
      g_audio->cond = 0;
   }
   if (data)
      free(data);
   g_audio = NULL;
}
void GuiElement::UnlockElement()
{
	//  LWP_MutexUnlock(mutex);
	LWP_MutexLock(_lock_mutex);
	// only the thread was locked this element, can call unlock
	if (_lock_thread == LWP_GetSelf()) // but we check it here safe is safe
	{
		if (--_lock_count == 0) // dec count of locks and check if it last lock;
		{
			_lock_thread = LWP_THREAD_NULL; // mark as unlocked
			if (_lock_queue != LWP_TQUEUE_NULL) // has a queue
			{
				LWP_CloseQueue(_lock_queue); // close the queue and wake all waited threads
				_lock_queue = LWP_TQUEUE_NULL;
			}
		}
	}
	LWP_MutexUnlock(_lock_mutex);
}
Exemple #4
0
void OSystem_Wii::deinitSfx() {
	if (_mixer)
		_mixer->setReady(false);

	AUDIO_StopDMA();
	AUDIO_RegisterDMACallback(NULL);

	if (sfx_thread_running) {
		sfx_thread_quit = true;
		LWP_ThreadBroadcast(sfx_queue);

		LWP_JoinThread(sfx_thread, NULL);
		LWP_CloseQueue(sfx_queue);

		free(sfx_stack);
		sfx_thread_running = false;

		for (u32 i = 0; i < SFX_BUFFERS; ++i)
			free(sound_buffer[i]);
	}
}
void SoundHandler::InternalSoundUpdates()
{
	u16 i = 0;
	LWP_InitQueue(&ThreadQueue);
	while (!ExitRequested)
	{
		LWP_ThreadSleep(ThreadQueue);

		for(i = 0; i < MAX_DECODERS; ++i)
		{
			if(DecoderList[i] == NULL)
				continue;

			Decoding = true;
			DecoderList[i]->Decode();
		}
		Decoding = false;
	}
	LWP_CloseQueue(ThreadQueue);
	ThreadQueue = LWP_TQUEUE_NULL;
}
Exemple #6
0
void OSystem_Wii::initSfx() {
	_mixer = new Audio::MixerImpl(this, 48000);

	sfx_thread_running = false;
	sfx_thread_quit = false;

	sfx_stack = (u8 *) memalign(32, SFX_THREAD_STACKSIZE);

	if (sfx_stack) {
		memset(sfx_stack, 0, SFX_THREAD_STACKSIZE);

		LWP_InitQueue(&sfx_queue);

		s32 res = LWP_CreateThread(&sfx_thread, sfx_thread_func, _mixer, sfx_stack,
									SFX_THREAD_STACKSIZE, SFX_THREAD_PRIO);

		if (res) {
			printf("ERROR creating sfx thread: %d\n", res);
			LWP_CloseQueue(sfx_queue);
			return;
		}

		sfx_thread_running = true;
	}

	for (u32 i = 0; i < SFX_BUFFERS; ++i) {
		sound_buffer[i] = (u8 *) memalign(32, SFX_THREAD_FRAG_SIZE);
		memset(sound_buffer[i], 0, SFX_THREAD_FRAG_SIZE);
		DCFlushRange(sound_buffer[i], SFX_THREAD_FRAG_SIZE);
	}

	_mixer->setReady(true);

	sb_hw = 0;

	AUDIO_SetDSPSampleRate(AI_SAMPLERATE_48KHZ);
	AUDIO_RegisterDMACallback(audio_switch_buffers);
	AUDIO_InitDMA((u32) sound_buffer[sb_hw], SFX_THREAD_FRAG_SIZE);
	AUDIO_StartDMA();
}