Пример #1
0
DttSP_EXP void
sound_thread_keyd (void)
{
	for (;;)
	{
		sem_wait (&clock_fired);

		if (playing)
		{
            // CWTone keeps playing for awhile after it's turned off,
			// in order to allow for a decay envelope;
			// returns FALSE when it's actually done.
			playing = CWTone (gen);
			EnterCriticalSection(update_ok);
			send_tone ();
			LeaveCriticalSection(update_ok);
		}
		else
		{
			EnterCriticalSection(update_ok);
			send_silence ();
			// only let updates run when we've just generated silence
			LeaveCriticalSection(update_ok);
		}
	}

	pthread_exit (0);
}
Пример #2
0
void on_message(struct _mumble_client_t* client, void *data, int type, ProtobufCMessage *message) {
  switch (type) {
    case MUMBLE_TYPE_VERSION:
      ;
      MumbleProto__Version *version = (MumbleProto__Version*)message;
      int major = version->version >> 16;
      int minor = (version->version >> 8) & 0xFF;
      int bugfix = version->version & 0xFF;
      printf("Server version: %d.%d.%d (%s)\n", major, minor, bugfix, version->release);
      break;
    case MUMBLE_TYPE_TEXT_MESSAGE:
      ;
      MumbleProto__TextMessage *msg = (MumbleProto__TextMessage*)message;
      printf("Text: [%u] %s\n", msg->actor, msg->message);

      send_tone(client, 300, 2);
      break;
  }
}