Yattm - unified GTK instant-messaging client logo
   [Generated for version 0.2-17 - Mon Jan 6 19:01:23 GMT+1 2003]

Home - Main Page - Data Structures - File List - Data Fields - Globals

sound.h File Reference

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Enumerations

enum  {
  BUDDY_ARRIVE, BUDDY_LEAVE, BUDDY_AWAY, SEND,
  RECEIVE, FIRSTMSG
}

Functions

void play_sound (int sound)
void playsoundfile (gchar *soundfile)
void sound_init ()
void sound_shutdown ()


Enumeration Type Documentation

anonymous enum
 

Enumeration values:
BUDDY_ARRIVE 
BUDDY_LEAVE 
BUDDY_AWAY 
SEND 
RECEIVE 
FIRSTMSG 

Definition at line 25 of file sound.h.

00025     {
00026     BUDDY_ARRIVE,
00027     BUDDY_LEAVE,
00028     BUDDY_AWAY,
00029     SEND,
00030     RECEIVE,
00031     FIRSTMSG
00032 };


Function Documentation

void play_sound int    sound
 

Definition at line 658 of file sound.c.

References BUDDY_ARRIVE, BUDDY_AWAY, BUDDY_LEAVE, cGetLocalPref(), FIRSTMSG, playsoundfile(), RECEIVE, and SEND.

Referenced by contact_login(), contact_logoff(), eb_chat_room_show_message(), eb_chat_window_display_remote_message(), and send_message().

00659 {
00660     if (do_no_sound_when_away && is_away)
00661         return;
00662     switch(sound) 
00663     {
00664         case BUDDY_AWAY:
00665         {
00666             playsoundfile(cGetLocalPref("BuddyAwayFilename"));
00667         }
00668         break;
00669         case BUDDY_ARRIVE:
00670         {
00671             playsoundfile(cGetLocalPref("BuddyArriveFilename"));
00672         }
00673         break;
00674         case BUDDY_LEAVE:
00675         {
00676             playsoundfile(cGetLocalPref("BuddyLeaveFilename"));
00677         }
00678         break;
00679         case SEND:
00680         {
00681             playsoundfile(cGetLocalPref("SendFilename"));
00682         }
00683         break;
00684         case RECEIVE:
00685         {
00686             playsoundfile(cGetLocalPref("ReceiveFilename"));
00687             break;
00688         }
00689         case FIRSTMSG:
00690         {
00691             playsoundfile(cGetLocalPref("FirstMsgFilename"));
00692             break;
00693         }
00694         default:
00695             return;
00696     }
00697 }

void playsoundfile gchar *    soundfile
 

Definition at line 590 of file sound.c.

References auscale(), fGetLocalPref(), file_ok(), and play_soundfile.

Referenced by do_trigger_action(), play_sound(), and testsoundfile().

00591 {
00592     
00593 #ifdef _WIN32
00594     if(!play_soundfile)
00595         return;
00596 
00597     if (!file_ok(soundfile)) 
00598         return;
00599 
00600     PlaySound(soundfile,NULL,SND_FILENAME|SND_SYNC);
00601     return;
00602 #endif
00603 #ifndef __MINGW32__
00604     gint pid;
00605 
00606     if(!play_soundfile)
00607         return;
00608 
00609     if (!file_ok(soundfile)) 
00610         return;
00611 
00612     pid = fork();
00613     if (pid < 0)
00614     {
00615         fprintf(stderr, "in playsoundfile(), fork failed!\n");
00616         return;
00617     }
00618     else if (pid == 0)
00619     {
00620         /* we're the child process, play the sound... */
00621         if(fGetLocalPref("SoundVolume") != 0.0)
00622         {
00623         gchar tmp_soundfile[9] = "ebXXXXXX";
00624             
00625             if (mkstemp(tmp_soundfile) == -1) /* create name for auscale */
00626             {
00627                 fprintf(stderr, "in playsoundfile(), mkstemp failed!\n");
00628                 return;
00629             }
00630 
00631             soundfile = auscale(soundfile,tmp_soundfile,fGetLocalPref("SoundVolume"));
00632 
00633             play_soundfile(soundfile);
00634 
00635             if (unlink(tmp_soundfile))
00636                fprintf(stderr,
00637                     "in playsoundfile(), unlink failed!\n");
00638         }
00639         else
00640         {
00641                 play_soundfile(soundfile);
00642         }
00643 
00644         _exit(0);
00645         
00646     }
00647     else
00648     {
00649         /* We're the parent process... */
00650         gtk_timeout_add(100, (GtkFunction)clean_pid, NULL);
00651     }
00652 #endif 
00653     
00654 }

void sound_init  
 

Definition at line 699 of file sound.c.

References arts_shutdown(), can_play_arts(), can_play_audio(), can_play_esd(), DBG_CORE, eb_debug, play_arts_file(), play_audio(), play_esd_file(), play_soundfile, and shutdown_sounddrv.

Referenced by main().

00700 {
00701     /* Determine which sound module will be used to play sounds */
00702 
00703 
00704     if(can_play_arts())
00705     {
00706         eb_debug(DBG_CORE,"Using arts sound\n");
00707         play_soundfile = play_arts_file;
00708         shutdown_sounddrv = arts_shutdown;
00709     }
00710     else if(can_play_esd())
00711     {
00712         eb_debug(DBG_CORE,"Using esd sound\n");
00713         play_soundfile = play_esd_file;
00714         shutdown_sounddrv = NULL;
00715     }
00716     /* handle sound direct to /dev/audio */
00717     else if (can_play_audio())
00718     {
00719         eb_debug(DBG_CORE,"Using raw audio\n");
00720         play_soundfile = play_audio;
00721         shutdown_sounddrv = NULL;
00722     }
00723     else
00724     {
00725        eb_debug(DBG_CORE,"Sound not available\n");
00726        play_soundfile = NULL;
00727        shutdown_sounddrv = NULL;
00728     }
00729 }

void sound_shutdown  
 

Definition at line 731 of file sound.c.

References shutdown_sounddrv.

Referenced by main().

00732 {
00733     if(shutdown_sounddrv != NULL) {
00734         shutdown_sounddrv();
00735     }
00736 }


Contact: Andy Maloney     [Documentation generated by doxygen]