[Xastir] Bulletin received sound

Steve Huston huston at srhuston.net
Sun Aug 8 18:26:36 PDT 2021


I have a Raspberry Pi setup running Xastir, and use the "play sound
effect" system to manually turn on the display when I receive a
message.  When I get a message it calls a script I wrote that simply
looks at the argument (.wav filename) and if it's "newmessage.wav" it
turns off the screen blanking and unsets dpms to light up the display.
This way without having the screen on all the time, it lets me know if
I have a new message.

I'd like this to work for bulletins as well, and quickly realized when
looking at the source that adding a new config option for playing a
certain message when a new bulletin is received is beyond my ability.
What is within my ability, however, is copying the call for play_sound
to the right place in db.c so that it uses the same "new message"
sound when a bulletin comes in:

diff --git a/src/db.c b/src/db.c
index 4ccfd68a..78291e64 100644
--- a/src/db.c
+++ b/src/db.c
@@ -18709,6 +18709,10 @@ int decode_message(char *call,char *path,char
*message,char from,int port,int th
   {
     // fprintf(stderr,"found BLN: |%s| |%s|\n",addr,message);
     bulletin_data_add(addr,call,message,"",MESSAGE_BULLETIN,from);
+    if (sound_play_new_message)
+    {
+      play_sound(sound_command,sound_new_message);
+    }
     done = 1;
   }
   if (debug_level & 1)

I'd submit this as a pull request, but it seems silly to fork the
project to add four lines to it.  If you'd like me to, I will however.
Or if you think there's a better way to do this, that's fine too.  Or
if you think you don't want it at all, I'll keep hacking my local copy
:D

-- 
Steve Huston - W2SRH - Unix Sysadmin, PICSciE/CSES & Astrophysical Sci
  Princeton University  |    ICBM Address: 40.346344   -74.652242
    345 Lewis Library   |"On my ship, the Rocinante, wheeling through
  Princeton, NJ   08544 | the galaxies; headed for the heart of Cygnus,
    (267) 793-0852      | headlong into mystery."  -Rush, 'Cygnus X-1'


More information about the Xastir mailing list