diff --git a/LTTR0.mp3 b/LTTR0.mp3 new file mode 100644 index 0000000..b7d1c0d Binary files /dev/null and b/LTTR0.mp3 differ diff --git a/LTTR1.mp3 b/LTTR1.mp3 new file mode 100644 index 0000000..ba05685 Binary files /dev/null and b/LTTR1.mp3 differ diff --git a/LTTR2.mp3 b/LTTR2.mp3 new file mode 100644 index 0000000..c73cb35 Binary files /dev/null and b/LTTR2.mp3 differ diff --git a/LTTR3.mp3 b/LTTR3.mp3 new file mode 100644 index 0000000..41f08b3 Binary files /dev/null and b/LTTR3.mp3 differ diff --git a/LTTR4.mp3 b/LTTR4.mp3 new file mode 100644 index 0000000..544af58 Binary files /dev/null and b/LTTR4.mp3 differ diff --git a/LTTR5.mp3 b/LTTR5.mp3 new file mode 100644 index 0000000..d2c3711 Binary files /dev/null and b/LTTR5.mp3 differ diff --git a/LTTR6.mp3 b/LTTR6.mp3 new file mode 100644 index 0000000..eec701a Binary files /dev/null and b/LTTR6.mp3 differ diff --git a/LTTR7.mp3 b/LTTR7.mp3 new file mode 100644 index 0000000..eb4355d Binary files /dev/null and b/LTTR7.mp3 differ diff --git a/LTTR8.mp3 b/LTTR8.mp3 new file mode 100644 index 0000000..004ab29 Binary files /dev/null and b/LTTR8.mp3 differ diff --git a/LTTR9.mp3 b/LTTR9.mp3 new file mode 100644 index 0000000..0f9468a Binary files /dev/null and b/LTTR9.mp3 differ diff --git a/LTTRA.mp3 b/LTTRA.mp3 new file mode 100644 index 0000000..c3b3a79 Binary files /dev/null and b/LTTRA.mp3 differ diff --git a/LTTRB.mp3 b/LTTRB.mp3 new file mode 100644 index 0000000..3e06575 Binary files /dev/null and b/LTTRB.mp3 differ diff --git a/LTTRC.mp3 b/LTTRC.mp3 new file mode 100644 index 0000000..e715ffd Binary files /dev/null and b/LTTRC.mp3 differ diff --git a/LTTRD.mp3 b/LTTRD.mp3 new file mode 100644 index 0000000..fbc249e Binary files /dev/null and b/LTTRD.mp3 differ diff --git a/LTTRE.mp3 b/LTTRE.mp3 new file mode 100644 index 0000000..b36bb50 Binary files /dev/null and b/LTTRE.mp3 differ diff --git a/LTTRF.mp3 b/LTTRF.mp3 new file mode 100644 index 0000000..31728c7 Binary files /dev/null and b/LTTRF.mp3 differ diff --git a/LTTRG.mp3 b/LTTRG.mp3 new file mode 100644 index 0000000..5cf2aea Binary files /dev/null and b/LTTRG.mp3 differ diff --git a/LTTRH.mp3 b/LTTRH.mp3 new file mode 100644 index 0000000..81be4e9 Binary files /dev/null and b/LTTRH.mp3 differ diff --git a/LTTRI.mp3 b/LTTRI.mp3 new file mode 100644 index 0000000..96461e7 Binary files /dev/null and b/LTTRI.mp3 differ diff --git a/LTTRJ.mp3 b/LTTRJ.mp3 new file mode 100644 index 0000000..27a1806 Binary files /dev/null and b/LTTRJ.mp3 differ diff --git a/LTTRK.mp3 b/LTTRK.mp3 new file mode 100644 index 0000000..abe4e9c Binary files /dev/null and b/LTTRK.mp3 differ diff --git a/LTTRL.mp3 b/LTTRL.mp3 new file mode 100644 index 0000000..d149047 Binary files /dev/null and b/LTTRL.mp3 differ diff --git a/LTTRM.mp3 b/LTTRM.mp3 new file mode 100644 index 0000000..4b39ba6 Binary files /dev/null and b/LTTRM.mp3 differ diff --git a/LTTRMINUS.mp3 b/LTTRMINUS.mp3 new file mode 100644 index 0000000..00b43c5 Binary files /dev/null and b/LTTRMINUS.mp3 differ diff --git a/LTTRN.mp3 b/LTTRN.mp3 new file mode 100644 index 0000000..c36e86b Binary files /dev/null and b/LTTRN.mp3 differ diff --git a/LTTRO.mp3 b/LTTRO.mp3 new file mode 100644 index 0000000..b80c816 Binary files /dev/null and b/LTTRO.mp3 differ diff --git a/LTTRP.mp3 b/LTTRP.mp3 new file mode 100644 index 0000000..aa9b874 Binary files /dev/null and b/LTTRP.mp3 differ diff --git a/LTTRPOINT.mp3 b/LTTRPOINT.mp3 new file mode 100644 index 0000000..aa99d3f Binary files /dev/null and b/LTTRPOINT.mp3 differ diff --git a/LTTRQ.mp3 b/LTTRQ.mp3 new file mode 100644 index 0000000..57a0d8d Binary files /dev/null and b/LTTRQ.mp3 differ diff --git a/LTTRQUESTMARK.mp3 b/LTTRQUESTMARK.mp3 new file mode 100644 index 0000000..f1ae82b Binary files /dev/null and b/LTTRQUESTMARK.mp3 differ diff --git a/LTTRR.mp3 b/LTTRR.mp3 new file mode 100644 index 0000000..6f8388a Binary files /dev/null and b/LTTRR.mp3 differ diff --git a/LTTRS.mp3 b/LTTRS.mp3 new file mode 100644 index 0000000..93f8354 Binary files /dev/null and b/LTTRS.mp3 differ diff --git a/LTTRSPACE.mp3 b/LTTRSPACE.mp3 new file mode 100644 index 0000000..a538e6e Binary files /dev/null and b/LTTRSPACE.mp3 differ diff --git a/LTTRSTROKE.mp3 b/LTTRSTROKE.mp3 new file mode 100644 index 0000000..f89ce07 Binary files /dev/null and b/LTTRSTROKE.mp3 differ diff --git a/LTTRT.mp3 b/LTTRT.mp3 new file mode 100644 index 0000000..b4f3472 Binary files /dev/null and b/LTTRT.mp3 differ diff --git a/LTTRU.mp3 b/LTTRU.mp3 new file mode 100644 index 0000000..d340772 Binary files /dev/null and b/LTTRU.mp3 differ diff --git a/LTTRV.mp3 b/LTTRV.mp3 new file mode 100644 index 0000000..3c2c3ec Binary files /dev/null and b/LTTRV.mp3 differ diff --git a/LTTRW.mp3 b/LTTRW.mp3 new file mode 100644 index 0000000..f4273c9 Binary files /dev/null and b/LTTRW.mp3 differ diff --git a/LTTRX.mp3 b/LTTRX.mp3 new file mode 100644 index 0000000..7baecb8 Binary files /dev/null and b/LTTRX.mp3 differ diff --git a/LTTRY.mp3 b/LTTRY.mp3 new file mode 100644 index 0000000..ebe42f4 Binary files /dev/null and b/LTTRY.mp3 differ diff --git a/LTTRZ.mp3 b/LTTRZ.mp3 new file mode 100644 index 0000000..cb225be Binary files /dev/null and b/LTTRZ.mp3 differ diff --git a/NOISECQWINDOW.mp3 b/NOISECQWINDOW.mp3 new file mode 100644 index 0000000..db7bc1f Binary files /dev/null and b/NOISECQWINDOW.mp3 differ diff --git a/NOISEERROR.mp3 b/NOISEERROR.mp3 new file mode 100644 index 0000000..0073ad6 Binary files /dev/null and b/NOISEERROR.mp3 differ diff --git a/NOISENOTIFY.mp3 b/NOISENOTIFY.mp3 new file mode 100644 index 0000000..531a20c Binary files /dev/null and b/NOISENOTIFY.mp3 differ diff --git a/NOISEPMWINDOW.mp3 b/NOISEPMWINDOW.mp3 new file mode 100644 index 0000000..d0a3b15 Binary files /dev/null and b/NOISEPMWINDOW.mp3 differ diff --git a/NOISESTARTUP.mp3 b/NOISESTARTUP.mp3 new file mode 100644 index 0000000..cd13361 Binary files /dev/null and b/NOISESTARTUP.mp3 differ diff --git a/Prakti_elster_20.11.2022_21.24.pfx b/Prakti_elster_20.11.2022_21.24.pfx new file mode 100644 index 0000000..1a24767 Binary files /dev/null and b/Prakti_elster_20.11.2022_21.24.pfx differ diff --git a/VOICE0.mp3 b/VOICE0.mp3 new file mode 100644 index 0000000..c14397f Binary files /dev/null and b/VOICE0.mp3 differ diff --git a/VOICE1.mp3 b/VOICE1.mp3 new file mode 100644 index 0000000..a999387 Binary files /dev/null and b/VOICE1.mp3 differ diff --git a/VOICE2.mp3 b/VOICE2.mp3 new file mode 100644 index 0000000..5729162 Binary files /dev/null and b/VOICE2.mp3 differ diff --git a/VOICE3.mp3 b/VOICE3.mp3 new file mode 100644 index 0000000..f4e1ffd Binary files /dev/null and b/VOICE3.mp3 differ diff --git a/VOICE4.mp3 b/VOICE4.mp3 new file mode 100644 index 0000000..a944228 Binary files /dev/null and b/VOICE4.mp3 differ diff --git a/VOICE5.mp3 b/VOICE5.mp3 new file mode 100644 index 0000000..b7702a0 Binary files /dev/null and b/VOICE5.mp3 differ diff --git a/VOICE6.mp3 b/VOICE6.mp3 new file mode 100644 index 0000000..59a7678 Binary files /dev/null and b/VOICE6.mp3 differ diff --git a/VOICE7.mp3 b/VOICE7.mp3 new file mode 100644 index 0000000..44e7443 Binary files /dev/null and b/VOICE7.mp3 differ diff --git a/VOICE73.mp3 b/VOICE73.mp3 new file mode 100644 index 0000000..da3c2a2 Binary files /dev/null and b/VOICE73.mp3 differ diff --git a/VOICE8.mp3 b/VOICE8.mp3 new file mode 100644 index 0000000..4cf45a3 Binary files /dev/null and b/VOICE8.mp3 differ diff --git a/VOICE9.mp3 b/VOICE9.mp3 new file mode 100644 index 0000000..c84a2e1 Binary files /dev/null and b/VOICE9.mp3 differ diff --git a/VOICEA.mp3 b/VOICEA.mp3 new file mode 100644 index 0000000..9e1f2fe Binary files /dev/null and b/VOICEA.mp3 differ diff --git a/VOICEB.mp3 b/VOICEB.mp3 new file mode 100644 index 0000000..1dcecac Binary files /dev/null and b/VOICEB.mp3 differ diff --git a/VOICEBELL.mp3 b/VOICEBELL.mp3 new file mode 100644 index 0000000..ff1858b Binary files /dev/null and b/VOICEBELL.mp3 differ diff --git a/VOICEC.mp3 b/VOICEC.mp3 new file mode 100644 index 0000000..bb4aaa7 Binary files /dev/null and b/VOICEC.mp3 differ diff --git a/VOICED.mp3 b/VOICED.mp3 new file mode 100644 index 0000000..557b8b7 Binary files /dev/null and b/VOICED.mp3 differ diff --git a/VOICEE.mp3 b/VOICEE.mp3 new file mode 100644 index 0000000..2729b0e Binary files /dev/null and b/VOICEE.mp3 differ diff --git a/VOICEF.mp3 b/VOICEF.mp3 new file mode 100644 index 0000000..2b18c89 Binary files /dev/null and b/VOICEF.mp3 differ diff --git a/VOICEG.mp3 b/VOICEG.mp3 new file mode 100644 index 0000000..417abc4 Binary files /dev/null and b/VOICEG.mp3 differ diff --git a/VOICEH.mp3 b/VOICEH.mp3 new file mode 100644 index 0000000..bfca53d Binary files /dev/null and b/VOICEH.mp3 differ diff --git a/VOICEHELLO.mp3 b/VOICEHELLO.mp3 new file mode 100644 index 0000000..8fe16c8 Binary files /dev/null and b/VOICEHELLO.mp3 differ diff --git a/VOICEI.mp3 b/VOICEI.mp3 new file mode 100644 index 0000000..c9e281c Binary files /dev/null and b/VOICEI.mp3 differ diff --git a/VOICEJ.mp3 b/VOICEJ.mp3 new file mode 100644 index 0000000..cb673c2 Binary files /dev/null and b/VOICEJ.mp3 differ diff --git a/VOICEK.mp3 b/VOICEK.mp3 new file mode 100644 index 0000000..8ad4e22 Binary files /dev/null and b/VOICEK.mp3 differ diff --git a/VOICEL.mp3 b/VOICEL.mp3 new file mode 100644 index 0000000..8ca449b Binary files /dev/null and b/VOICEL.mp3 differ diff --git a/VOICEM.mp3 b/VOICEM.mp3 new file mode 100644 index 0000000..7151f3a Binary files /dev/null and b/VOICEM.mp3 differ diff --git a/VOICEMEEPMEEP.mp3 b/VOICEMEEPMEEP.mp3 new file mode 100644 index 0000000..71776d8 Binary files /dev/null and b/VOICEMEEPMEEP.mp3 differ diff --git a/VOICEN.mp3 b/VOICEN.mp3 new file mode 100644 index 0000000..3adbd3a Binary files /dev/null and b/VOICEN.mp3 differ diff --git a/VOICEO.mp3 b/VOICEO.mp3 new file mode 100644 index 0000000..768d62f Binary files /dev/null and b/VOICEO.mp3 differ diff --git a/VOICEP.mp3 b/VOICEP.mp3 new file mode 100644 index 0000000..338a618 Binary files /dev/null and b/VOICEP.mp3 differ diff --git a/VOICEQ.mp3 b/VOICEQ.mp3 new file mode 100644 index 0000000..1abe264 Binary files /dev/null and b/VOICEQ.mp3 differ diff --git a/VOICER.mp3 b/VOICER.mp3 new file mode 100644 index 0000000..5335890 Binary files /dev/null and b/VOICER.mp3 differ diff --git a/VOICES.mp3 b/VOICES.mp3 new file mode 100644 index 0000000..eddff00 Binary files /dev/null and b/VOICES.mp3 differ diff --git a/VOICESTROKE.mp3 b/VOICESTROKE.mp3 new file mode 100644 index 0000000..80c531d Binary files /dev/null and b/VOICESTROKE.mp3 differ diff --git a/VOICESTROKEPORTABLE.mp3 b/VOICESTROKEPORTABLE.mp3 new file mode 100644 index 0000000..5135958 Binary files /dev/null and b/VOICESTROKEPORTABLE.mp3 differ diff --git a/VOICET.mp3 b/VOICET.mp3 new file mode 100644 index 0000000..9d1532e Binary files /dev/null and b/VOICET.mp3 differ diff --git a/VOICEU.mp3 b/VOICEU.mp3 new file mode 100644 index 0000000..9978e3e Binary files /dev/null and b/VOICEU.mp3 differ diff --git a/VOICEV.mp3 b/VOICEV.mp3 new file mode 100644 index 0000000..ec13664 Binary files /dev/null and b/VOICEV.mp3 differ diff --git a/VOICEW.mp3 b/VOICEW.mp3 new file mode 100644 index 0000000..221387b Binary files /dev/null and b/VOICEW.mp3 differ diff --git a/VOICEX.mp3 b/VOICEX.mp3 new file mode 100644 index 0000000..6fca76a Binary files /dev/null and b/VOICEX.mp3 differ diff --git a/VOICEY.mp3 b/VOICEY.mp3 new file mode 100644 index 0000000..9d5f84b Binary files /dev/null and b/VOICEY.mp3 differ diff --git a/VOICEYOUGOTMAIL.mp3 b/VOICEYOUGOTMAIL.mp3 new file mode 100644 index 0000000..a48ab1f Binary files /dev/null and b/VOICEYOUGOTMAIL.mp3 differ diff --git a/VOICEZ.mp3 b/VOICEZ.mp3 new file mode 100644 index 0000000..c778889 Binary files /dev/null and b/VOICEZ.mp3 differ diff --git a/jdk.cmd b/jdk.cmd new file mode 100644 index 0000000..cb44119 --- /dev/null +++ b/jdk.cmd @@ -0,0 +1,3 @@ +@echo off +SET JAVA_HOME=C:\Program Files\Java\jdk-17 +SET PATH=%JAVA_HOME%\bin,%PATH% \ No newline at end of file diff --git a/sk.mp3 b/sk.mp3 new file mode 100644 index 0000000..177a97d Binary files /dev/null and b/sk.mp3 differ diff --git a/src/main/java/kst4contest/controller/ChatController.java b/src/main/java/kst4contest/controller/ChatController.java index 1635cdf..eae42c0 100644 --- a/src/main/java/kst4contest/controller/ChatController.java +++ b/src/main/java/kst4contest/controller/ChatController.java @@ -18,6 +18,7 @@ import kst4contest.model.ChatMember; import kst4contest.model.ChatMessage; import kst4contest.model.ChatPreferences; import kst4contest.model.ClusterMessage; +import kst4contest.utils.PlayAudioUtils; import java.io.*; @@ -232,6 +233,12 @@ public class ChatController { private MessageBusManagementThread messageProcessor; private ReadUDPbyAirScoutMessageThread airScoutUDPReaderThread; + private PlayAudioUtils playAudioUtils = new PlayAudioUtils(); + + public PlayAudioUtils getPlayAudioUtils() { + return playAudioUtils; + } + private TimerTask userActualizationTask; private TimerTask keepAliveMessageSenderTask; diff --git a/src/main/java/kst4contest/controller/MessageBusManagementThread.java b/src/main/java/kst4contest/controller/MessageBusManagementThread.java index 87d5eb4..df3c200 100644 --- a/src/main/java/kst4contest/controller/MessageBusManagementThread.java +++ b/src/main/java/kst4contest/controller/MessageBusManagementThread.java @@ -15,6 +15,7 @@ import kst4contest.model.AirPlaneReflectionInfo; import kst4contest.model.ChatMember; import kst4contest.model.ChatMessage; import kst4contest.model.ClusterMessage; +import kst4contest.utils.PlayAudioUtils; /** * @@ -544,14 +545,30 @@ public class MessageBusManagementThread extends Thread { // System.out.println("message directed to: " + newMessage.getReceiver().getCallSign() + ". EQ?: " + this.client.getownChatMemberObject().getCallSign() + " sent by: " + newMessage.getSender().getCallSign().toUpperCase() + " -> EQ?: "+ this.client.getChatPreferences().getLoginCallSign().toUpperCase()); try { + /** + * message is directed to me, will be put in the "to me" messagelist + */ if (newMessage.getReceiver().getCallSign() .equals(this.client.getChatPreferences().getLoginCallSign())) { this.client.getLst_toMeMessageList().add(0, newMessage); + if (this.client.getChatPreferences().isNotify_playSimpleSounds()) { + this.client.getPlayAudioUtils().playNoiseLauncher('P'); + } + if (this.client.getChatPreferences().isNotify_playCWCallsignsOnRxedPMs()) { + this.client.getPlayAudioUtils().playCWLauncher(" " + " " + newMessage.getSender().getCallSign().toUpperCase()); + } + if (this.client.getChatPreferences().isNotify_playVoiceCallsignsOnRxedPMs()) { + this.client.getPlayAudioUtils().playVoiceLauncher( "?" + newMessage.getSender().getCallSign().toUpperCase()); + } + System.out.println("message directed to me: " + newMessage.getReceiver().getCallSign() + "."); } else if (newMessage.getSender().getCallSign().toUpperCase() + /** + * message from me will appear in the PM window, too, with (>CALLSIGN) before + */ .equals(this.client.getChatPreferences().getLoginCallSign().toUpperCase())) { String originalMessage = newMessage.getMessageText(); newMessage @@ -566,7 +583,7 @@ public class MessageBusManagementThread extends Thread { // System.out.println("MSGBS bgfx: tx call = " + newMessage.getSender().getCallSign() + " / rx call = " + newMessage.getReceiver().getCallSign()); } } catch (NullPointerException referenceDeletedByUserLeftChatDuringMessageprocessing) { - System.out.println("MSGBS bgfx, catched error: referenced user left the chat during messageprocessing: "); + System.out.println("MSGBS bgfx, <<>>: referenced user left the chat during messageprocessing: "); referenceDeletedByUserLeftChatDuringMessageprocessing.printStackTrace(); } diff --git a/src/main/java/kst4contest/model/ChatPreferences.java b/src/main/java/kst4contest/model/ChatPreferences.java index 80fa711..52ff3ab 100644 --- a/src/main/java/kst4contest/model/ChatPreferences.java +++ b/src/main/java/kst4contest/model/ChatPreferences.java @@ -164,6 +164,13 @@ public class ChatPreferences { * Notification prefs */ + //Audio section + boolean notify_playSimpleSounds = true; + boolean notify_playCWCallsignsOnRxedPMs = true; + boolean notify_playVoiceCallsignsOnRxedPMs = true; + + + /** * Shortcuts and Textsnippets prefs */ @@ -198,6 +205,8 @@ public class ChatPreferences { // MYQRG = mYQRG; // } + + public String getLoginCallSign() { return loginCallSign; } @@ -267,6 +276,30 @@ public class ChatPreferences { this.logsynch_storeWorkedCallSignsFileNameUDPMessageBackup = logsynch_storeWorkedCallSignsFileNameUDPMessageBackup; } + public boolean isNotify_playSimpleSounds() { + return notify_playSimpleSounds; + } + + public boolean isNotify_playCWCallsignsOnRxedPMs() { + return notify_playCWCallsignsOnRxedPMs; + } + + public boolean isNotify_playVoiceCallsignsOnRxedPMs() { + return notify_playVoiceCallsignsOnRxedPMs; + } + + public void setNotify_playSimpleSounds(boolean notify_playSimpleSounds) { + this.notify_playSimpleSounds = notify_playSimpleSounds; + } + + public void setNotify_playCWCallsignsOnRxedPMs(boolean notify_playCWCallsignsOnRxedPMs) { + this.notify_playCWCallsignsOnRxedPMs = notify_playCWCallsignsOnRxedPMs; + } + + public void setNotify_playVoiceCallsignsOnRxedPMs(boolean notify_playVoiceCallsignsOnRxedPMs) { + this.notify_playVoiceCallsignsOnRxedPMs = notify_playVoiceCallsignsOnRxedPMs; + } + /** * actualQTF, int, QTF in degrees * @@ -603,6 +636,27 @@ public class ChatPreferences { asQry_airScoutBandValue.setTextContent(this.getAirScout_asBandString()); AirScoutQuerier.appendChild(asQry_airScoutBandValue); + + /** + * Notifications + */ + + Element notifications = doc.createElement("notifications"); + rootElement.appendChild(notifications); + + Element notify_SimpleAudioNotificationsEnabled = doc.createElement("notify_SimpleAudioNotificationsEnabled"); + notify_SimpleAudioNotificationsEnabled.setTextContent(this.isNotify_playSimpleSounds()+""); + notifications.appendChild(notify_SimpleAudioNotificationsEnabled); + + Element notify_CWCallSignAudioNotificationsEnabled = doc.createElement("notify_CWCallsignAudioNotificationsEnabled"); + notify_CWCallSignAudioNotificationsEnabled.setTextContent(this.isNotify_playCWCallsignsOnRxedPMs()+""); + notifications.appendChild(notify_CWCallSignAudioNotificationsEnabled); + + Element notify_VoiceCallSignAudioNotificationsEnabled = doc.createElement("notify_VoiceCallsignAudioNotificationsEnabled"); + notify_VoiceCallSignAudioNotificationsEnabled.setTextContent(this.isNotify_playVoiceCallsignsOnRxedPMs()+""); + notifications.appendChild(notify_VoiceCallSignAudioNotificationsEnabled); + + /** * Shortcuts */ @@ -905,6 +959,56 @@ public class ChatPreferences { } } + /** + * Case notifications + */ + + list = doc.getElementsByTagName("notifications"); + if (list.getLength() != 0) { + + for (int temp = 0; temp < list.getLength(); temp++) { + + Node node = list.item(temp); + + if (node.getNodeType() == Node.ELEMENT_NODE) { + + Element element = (Element) node; + + String notify_simpleAudioNotificationsEnabled = element.getElementsByTagName("notify_SimpleAudioNotificationsEnabled").item(0) + .getTextContent(); + + if (notify_simpleAudioNotificationsEnabled.equals("true")) { + notify_playSimpleSounds = true; + } else { + notify_playSimpleSounds = false; + } + + String notify_cwAudioNotificationsEnabled = element.getElementsByTagName("notify_CWCallsignAudioNotificationsEnabled").item(0) + .getTextContent(); + + if (notify_cwAudioNotificationsEnabled.equals("true")) { + notify_playCWCallsignsOnRxedPMs = true; + } else { + notify_playCWCallsignsOnRxedPMs = false; + } + + String notify_voiceAudioNotificationsEnabled = element.getElementsByTagName("notify_VoiceCallsignAudioNotificationsEnabled").item(0) + .getTextContent(); + + if (notify_voiceAudioNotificationsEnabled.equals("true")) { + notify_playVoiceCallsignsOnRxedPMs = true; + } else { + notify_playVoiceCallsignsOnRxedPMs = false; + } + + System.out.println( + "[ChatPreferences, info]: Set the audionotifications simple: " + notify_playSimpleSounds + ", CW: " + notify_playCWCallsignsOnRxedPMs + ", Voice: " + notify_playVoiceCallsignsOnRxedPMs); + + } + } + } + + /** * Case AirScout querier */ diff --git a/src/main/java/kst4contest/utils/PlayAudioUtils.java b/src/main/java/kst4contest/utils/PlayAudioUtils.java new file mode 100644 index 0000000..1c07df9 --- /dev/null +++ b/src/main/java/kst4contest/utils/PlayAudioUtils.java @@ -0,0 +1,395 @@ +package kst4contest.utils; + +import javafx.scene.media.Media; +import javafx.scene.media.MediaPlayer; + +import java.io.File; +import java.util.Arrays; +import java.util.LinkedList; +import java.util.Queue; + +/** + * This part of the client drives the sounds. Its a singleton instance. All audio outs are directed to this instance.
+ *
+ * Instance of this classes will use the audio-notification-settings of the ChatPreferences instance and then wheter + * play a sound or not. Each method of this class will only cause an audio output if the settings for audio-out are + * made. This is good for less typing work. If audio is switched off by the user, all audio out callings will do:
+ * nothing. + * + */ +public class PlayAudioUtils { + +// public boolean useNormalProgramSounds, useCWCallSignSounds, useVoiceCallSignSounds; + +// public void setUseNormalProgramSounds(boolean useNormalProgramSounds) { +// this.useNormalProgramSounds = useNormalProgramSounds; +// } +// +// public void setUseCWCallSignSounds(boolean useCWCallSignSounds) { +// this.useCWCallSignSounds = useCWCallSignSounds; +// } +// +// public void setUseVoiceCallSignSounds(boolean useVoiceCallSignSounds) { +// this.useVoiceCallSignSounds = useVoiceCallSignSounds; +// } + + private Queue musicList = new LinkedList(); + private MediaPlayer mediaPlayer ; + + /** + * Plays notification sounds out of the windws 95 box by given action character
+ *
+ * Note that the audio settings (ChatPreferences) must be switched on in order to make the sounds playing.
+ * case '!': Startup
+ * case 'C': CQ Window new entry
+ * case 'P': PM Window new entry
+ * case 'E': Error occured
+ * case 'N': other notification sounds
+ * + * @param actionChar + */ + public void playNoiseLauncher(char actionChar) { + + switch (actionChar){ + case '!': + musicList.add(new Media(new File ("NOISESTARTUP.mp3").toURI().toString())); + break; + case 'C': + musicList.add(new Media(new File ("NOISECQWINDOW.mp3").toURI().toString())); + break; + case 'P': + musicList.add(new Media(new File ("NOISEPMWINDOW.mp3").toURI().toString())); + break; + case 'E': + musicList.add(new Media(new File ("NOISEERROR.mp3").toURI().toString())); + break; + case 'N': + musicList.add(new Media(new File ("NOISENOTIFY.mp3").toURI().toString())); + break; +// case 'M': +// musicList.add(new Media(new File ("VOICE.mp3").toURI().toString())); +// break; + + default: + System.out.println("[KST4ContestApp, warning, letter not defined!]"); + + } + playMusic(); +// mediaPlayer.dispose(); + + } + + + /** + * Plays all chars of a given String-parameter as CW Sound out of the speaker. + * As a workaround for delay problems at the beginning of playing, there are added 2x pause chars to the string. + * Note that the audio settings (ChatPreferences) must be switched on in order to make the sounds playing.
+ * @param playThisChars + */ + public void playCWLauncher(String playThisChars) { + + char[] playThisInCW = playThisChars.toUpperCase().toCharArray(); + + + for (char letterToPlay: playThisInCW){ + switch (letterToPlay){ + case 'A': + musicList.add(new Media(new File("LTTRA.mp3").toURI().toString())); + break; + case 'B': + musicList.add(new Media(new File ("LTTRB.mp3").toURI().toString())); + break; + case 'C': + musicList.add(new Media(new File ("LTTRC.mp3").toURI().toString())); + break; + case 'D': + musicList.add(new Media(new File ("LTTRD.mp3").toURI().toString())); + break; + case 'E': + musicList.add(new Media(new File ("LTTRE.mp3").toURI().toString())); + break; + case 'F': + musicList.add(new Media(new File ("LTTRF.mp3").toURI().toString())); + break; + case 'G': + musicList.add(new Media(new File ("LTTRG.mp3").toURI().toString())); + break; + case 'H': + musicList.add(new Media(new File ("LTTRH.mp3").toURI().toString())); + break; + case 'I': + musicList.add(new Media(new File ("LTTRI.mp3").toURI().toString())); + break; + case 'J': + musicList.add(new Media(new File ("LTTRJ.mp3").toURI().toString())); + break; + case 'K': + musicList.add(new Media(new File ("LTTRK.mp3").toURI().toString())); + break; + case 'L': + musicList.add(new Media(new File ("LTTRL.mp3").toURI().toString())); + break; + case 'M': + musicList.add(new Media(new File ("LTTRM.mp3").toURI().toString())); + break; + case 'N': + musicList.add(new Media(new File ("LTTRN.mp3").toURI().toString())); + break; + case 'O': + musicList.add(new Media(new File ("LTTRO.mp3").toURI().toString())); + break; + case 'P': + musicList.add(new Media(new File ("LTTRP.mp3").toURI().toString())); + break; + case 'Q': + musicList.add(new Media(new File ("LTTRQ.mp3").toURI().toString())); + break; + case 'R': + musicList.add(new Media(new File ("LTTRR.mp3").toURI().toString())); + break; + case 'S': + musicList.add(new Media(new File ("LTTRS.mp3").toURI().toString())); + break; + case 'T': + musicList.add(new Media(new File ("LTTRT.mp3").toURI().toString())); + break; + case 'U': + musicList.add(new Media(new File ("LTTRU.mp3").toURI().toString())); + break; + case 'V': + musicList.add(new Media(new File ("LTTRV.mp3").toURI().toString())); + break; + case 'W': + musicList.add(new Media(new File ("LTTRW.mp3").toURI().toString())); + break; + case 'X': + musicList.add(new Media(new File ("LTTRX.mp3").toURI().toString())); + break; + case 'Y': + musicList.add(new Media(new File ("LTTRY.mp3").toURI().toString())); + break; + case 'Z': + musicList.add(new Media(new File ("LTTRZ.mp3").toURI().toString())); + break; + case '1': + musicList.add(new Media(new File ("LTTR1.mp3").toURI().toString())); + break; + case '2': + musicList.add(new Media(new File ("LTTR2.mp3").toURI().toString())); + break; + case '3': + musicList.add(new Media(new File ("LTTR3.mp3").toURI().toString())); + break; + case '4': + musicList.add(new Media(new File ("LTTR4.mp3").toURI().toString())); + break; + case '5': + musicList.add(new Media(new File ("LTTR5.mp3").toURI().toString())); + break; + case '6': + musicList.add(new Media(new File ("LTTR6.mp3").toURI().toString())); + break; + case '7': + musicList.add(new Media(new File ("LTTR7.mp3").toURI().toString())); + break; + case '8': + musicList.add(new Media(new File ("LTTR8.mp3").toURI().toString())); + break; + case '9': + musicList.add(new Media(new File ("LTTR9.mp3").toURI().toString())); + break; + case '0': + musicList.add(new Media(new File ("LTTR0.mp3").toURI().toString())); + break; + case '/': + musicList.add(new Media(new File ("LTTRSTROKE.mp3").toURI().toString())); + break; + case ' ': + musicList.add(new Media(new File ("LTTRSPACE.mp3").toURI().toString())); + break; + default: + System.out.println("[KST4ContestApp, warning, letter not defined:] cwLetters = " + Arrays.toString(playThisInCW)); + } + } + playMusic(); +// mediaPlayer.dispose(); + + } + + /** + * + * Plays a voice file for each char in the string (only EN alphabetic and numbers) except some specials:

+ * Note that the audio settings (ChatPreferences) must be switched on in order to make the sounds playing.

+ * case '!': BELL
+ * case '?': YOUGOTMAIL
+ * case '#': HELLO
+ * case '*': 73 bye
+ * case '$': STROKEPORTABLE
+ * @param playThisChars + */ + public void playVoiceLauncher(String playThisChars) { + + char[] playThisInCW = playThisChars.toUpperCase().toCharArray(); + + for (char letterToPlay: playThisInCW){ + switch (letterToPlay){ + case '!': + musicList.add(new Media(new File ("VOICEBELL.mp3").toURI().toString())); + break; + case '?': + musicList.add(new Media(new File ("VOICEYOUGOTMAIL.mp3").toURI().toString())); + break; + case '#': + musicList.add(new Media(new File ("VOICEHELLO.mp3").toURI().toString())); + break; + case '*': + musicList.add(new Media(new File ("VOICE73.mp3").toURI().toString())); + break; + case '$': + musicList.add(new Media(new File ("VOICESTROKEPORTABLE.mp3").toURI().toString())); + break; + case 'A': + musicList.add(new Media(new File ("VOICEA.mp3").toURI().toString())); + break; + case 'B': + musicList.add(new Media(new File ("VOICEB.mp3").toURI().toString())); + break; + case 'C': + musicList.add(new Media(new File ("VOICEC.mp3").toURI().toString())); + break; + case 'D': + musicList.add(new Media(new File ("VOICED.mp3").toURI().toString())); + break; + case 'E': + musicList.add(new Media(new File ("VOICEE.mp3").toURI().toString())); + break; + case 'F': + musicList.add(new Media(new File ("VOICEF.mp3").toURI().toString())); + break; + case 'G': + musicList.add(new Media(new File ("VOICEG.mp3").toURI().toString())); + break; + case 'H': + musicList.add(new Media(new File ("VOICEH.mp3").toURI().toString())); + break; + case 'I': + musicList.add(new Media(new File ("VOICEI.mp3").toURI().toString())); + break; + case 'J': + musicList.add(new Media(new File ("VOICEJ.mp3").toURI().toString())); + break; + case 'K': + musicList.add(new Media(new File ("VOICEK.mp3").toURI().toString())); + break; + case 'L': + musicList.add(new Media(new File ("VOICEL.mp3").toURI().toString())); + break; + case 'M': + musicList.add(new Media(new File ("VOICEM.mp3").toURI().toString())); + break; + case 'N': + musicList.add(new Media(new File ("VOICEN.mp3").toURI().toString())); + break; + case 'O': + musicList.add(new Media(new File ("VOICEO.mp3").toURI().toString())); + break; + case 'P': + musicList.add(new Media(new File ("VOICEP.mp3").toURI().toString())); + break; + case 'Q': + musicList.add(new Media(new File ("VOICEQ.mp3").toURI().toString())); + break; + case 'R': + musicList.add(new Media(new File ("VOICER.mp3").toURI().toString())); + break; + case 'S': + musicList.add(new Media(new File ("VOICES.mp3").toURI().toString())); + break; + case 'T': + musicList.add(new Media(new File ("VOICET.mp3").toURI().toString())); + break; + case 'U': + musicList.add(new Media(new File ("VOICEU.mp3").toURI().toString())); + break; + case 'V': + musicList.add(new Media(new File ("VOICEV.mp3").toURI().toString())); + break; + case 'W': + musicList.add(new Media(new File ("VOICEW.mp3").toURI().toString())); + break; + case 'X': + musicList.add(new Media(new File ("VOICEX.mp3").toURI().toString())); + break; + case 'Y': + musicList.add(new Media(new File ("VOICEY.mp3").toURI().toString())); + break; + case 'Z': + musicList.add(new Media(new File ("VOICEZ.mp3").toURI().toString())); + break; + case '1': + musicList.add(new Media(new File ("VOICE1.mp3").toURI().toString())); + break; + case '2': + musicList.add(new Media(new File ("VOICE2.mp3").toURI().toString())); + break; + case '3': + musicList.add(new Media(new File ("VOICE3.mp3").toURI().toString())); + break; + case '4': + musicList.add(new Media(new File ("VOICE4.mp3").toURI().toString())); + break; + case '5': + musicList.add(new Media(new File ("VOICE5.mp3").toURI().toString())); + break; + case '6': + musicList.add(new Media(new File ("VOICE6.mp3").toURI().toString())); + break; + case '7': + musicList.add(new Media(new File ("VOICE7.mp3").toURI().toString())); + break; + case '8': + musicList.add(new Media(new File ("VOICE8.mp3").toURI().toString())); + break; + case '9': + musicList.add(new Media(new File ("VOICE9.mp3").toURI().toString())); + break; + case '0': + musicList.add(new Media(new File ("VOICE0.mp3").toURI().toString())); + break; + case '/': + musicList.add(new Media(new File ("VOICESTROKE.mp3").toURI().toString())); + break; +// case ' ': +// musicList.add(new Media(new File ("VOICESPACE.mp3").toURI().toString())); +// break; + default: + System.out.println("[KST4ContestApp, warning, letter not defined:] cwLetters = " + Arrays.toString(playThisInCW)); + } + } + playMusic(); +// mediaPlayer.dispose(); + + } + private void playMusic() { + +// System.out.println("Kst4ContestApplication.playMusic"); + if(musicList.peek() == null) + { + return; + } + mediaPlayer = new MediaPlayer(musicList.poll()); + mediaPlayer.setRate(1.0); + + mediaPlayer.setOnReady(() -> { + mediaPlayer.play(); + mediaPlayer.setOnEndOfMedia(() -> { +// mediaPlayer.dispose(); + playMusic(); + if (musicList.isEmpty()) { +// mediaPlayer.dispose(); + } + }); + }); + + } +} diff --git a/src/main/java/kst4contest/view/Kst4ContestApplication.java b/src/main/java/kst4contest/view/Kst4ContestApplication.java index 6f7e18e..ba43cef 100644 --- a/src/main/java/kst4contest/view/Kst4ContestApplication.java +++ b/src/main/java/kst4contest/view/Kst4ContestApplication.java @@ -2,12 +2,13 @@ package kst4contest.view; import java.io.File; import java.io.IOException; -import java.util.Date; -import java.util.Iterator; -import java.util.Optional; -import java.util.Timer; -import java.util.TimerTask; +import java.net.URI; +import java.net.URISyntaxException; +import java.nio.file.Path; +import java.util.*; +import javafx.scene.media.Media; +import javafx.scene.media.MediaPlayer; import kst4contest.controller.ChatController; import kst4contest.controller.Utils4KST; import javafx.application.Application; @@ -71,6 +72,8 @@ import kst4contest.model.ChatCategory; import kst4contest.model.ChatMember; import kst4contest.model.ChatMessage; import kst4contest.model.ClusterMessage; +import kst4contest.utils.PlayAudioUtils; + public class Kst4ContestApplication extends Application { @@ -740,8 +743,6 @@ public class Kst4ContestApplication extends Application { if (item.contains(chatcontroller.getChatPreferences().getLoginCallSign())) { this.setTextFill(Color.GREEN); -// AudioClip sound = new AudioClip(getClass().getResource("/K.mp3").toExternalForm()); -// sound.play(); } setText(item); @@ -882,12 +883,18 @@ public class Kst4ContestApplication extends Application { if (!isEmpty()) { this.setTextFill(Color.BLACK); // Get fancy and change color based on data - if (item.contains("100%")) { - this.setTextFill(Color.BLUEVIOLET); - } else if (item.contains("75%") && !item.contains("100%")) { - this.setTextFill(Color.RED); - } else if (item.contains("50%") && ((!item.contains("100%")) || (!item.contains("75%")))) { - this.setTextFill(Color.ORANGE); + + try { + if (item.contains("100%")) { + this.setTextFill(Color.BLUEVIOLET); + } else if (item.contains("75%") && !item.contains("100%")) { + this.setTextFill(Color.RED); + } else if (item.contains("50%") && ((!item.contains("100%")) || (!item.contains("75%")))) { + this.setTextFill(Color.ORANGE); + } + + } catch (Exception exc) { + //TODO: on nullpointerexcteption dont to that } setText(item); @@ -1876,8 +1883,324 @@ public class Kst4ContestApplication extends Application { } + private Queue musicList = new LinkedList(); + private MediaPlayer mediaPlayer ; + + private void playCWLauncher(String playThisChars) { + + char[] playThisInCW = playThisChars.toUpperCase().toCharArray(); + + for (char letterToPlay: playThisInCW){ + switch (letterToPlay){ + case 'A': + musicList.add(new Media(new File ("LTTRA.mp3").toURI().toString())); + break; + case 'B': + musicList.add(new Media(new File ("LTTRB.mp3").toURI().toString())); + break; + case 'C': + musicList.add(new Media(new File ("LTTRC.mp3").toURI().toString())); + break; + case 'D': + musicList.add(new Media(new File ("LTTRD.mp3").toURI().toString())); + break; + case 'E': + musicList.add(new Media(new File ("LTTRE.mp3").toURI().toString())); + break; + case 'F': + musicList.add(new Media(new File ("LTTRF.mp3").toURI().toString())); + break; + case 'G': + musicList.add(new Media(new File ("LTTRG.mp3").toURI().toString())); + break; + case 'H': + musicList.add(new Media(new File ("LTTRH.mp3").toURI().toString())); + break; + case 'I': + musicList.add(new Media(new File ("LTTRI.mp3").toURI().toString())); + break; + case 'J': + musicList.add(new Media(new File ("LTTRJ.mp3").toURI().toString())); + break; + case 'K': + musicList.add(new Media(new File ("LTTRK.mp3").toURI().toString())); + break; + case 'L': + musicList.add(new Media(new File ("LTTRL.mp3").toURI().toString())); + break; + case 'M': + musicList.add(new Media(new File ("LTTRM.mp3").toURI().toString())); + break; + case 'N': + musicList.add(new Media(new File ("LTTRN.mp3").toURI().toString())); + break; + case 'O': + musicList.add(new Media(new File ("LTTRO.mp3").toURI().toString())); + break; + case 'P': + musicList.add(new Media(new File ("LTTRP.mp3").toURI().toString())); + break; + case 'Q': + musicList.add(new Media(new File ("LTTRQ.mp3").toURI().toString())); + break; + case 'R': + musicList.add(new Media(new File ("LTTRR.mp3").toURI().toString())); + break; + case 'S': + musicList.add(new Media(new File ("LTTRS.mp3").toURI().toString())); + break; + case 'T': + musicList.add(new Media(new File ("LTTRT.mp3").toURI().toString())); + break; + case 'U': + musicList.add(new Media(new File ("LTTRU.mp3").toURI().toString())); + break; + case 'V': + musicList.add(new Media(new File ("LTTRV.mp3").toURI().toString())); + break; + case 'W': + musicList.add(new Media(new File ("LTTRW.mp3").toURI().toString())); + break; + case 'X': + musicList.add(new Media(new File ("LTTRX.mp3").toURI().toString())); + break; + case 'Y': + musicList.add(new Media(new File ("LTTRY.mp3").toURI().toString())); + break; + case 'Z': + musicList.add(new Media(new File ("LTTRZ.mp3").toURI().toString())); + break; + case '1': + musicList.add(new Media(new File ("LTTR1.mp3").toURI().toString())); + break; + case '2': + musicList.add(new Media(new File ("LTTR2.mp3").toURI().toString())); + break; + case '3': + musicList.add(new Media(new File ("LTTR3.mp3").toURI().toString())); + break; + case '4': + musicList.add(new Media(new File ("LTTR4.mp3").toURI().toString())); + break; + case '5': + musicList.add(new Media(new File ("LTTR5.mp3").toURI().toString())); + break; + case '6': + musicList.add(new Media(new File ("LTTR6.mp3").toURI().toString())); + break; + case '7': + musicList.add(new Media(new File ("LTTR7.mp3").toURI().toString())); + break; + case '8': + musicList.add(new Media(new File ("LTTR8.mp3").toURI().toString())); + break; + case '9': + musicList.add(new Media(new File ("LTTR9.mp3").toURI().toString())); + break; + case '0': + musicList.add(new Media(new File ("LTTR0.mp3").toURI().toString())); + break; + case '/': + musicList.add(new Media(new File ("LTTRSTROKE.mp3").toURI().toString())); + break; + case ' ': + musicList.add(new Media(new File ("LTTRSPACE.mp3").toURI().toString())); + break; + default: + System.out.println("[KST4ContestApp, warning, letter not defined:] cwLetters = " + Arrays.toString(playThisInCW)); + } + } + playMusic(); +// mediaPlayer.dispose(); + + } + + /** + * Plays a voice file for each char in the string (only EN alphabetic and numbers) except some specials:

+ * + * case '!': BELL
+ * case '?': YOUGOTMAIL
+ * case '#': HELLO
+ * case '*': 73 bye
+ * case '$': STROKEPORTABLE
+ * @param playThisChars + */ + private void playVoiceLauncher(String playThisChars) { + + char[] playThisInCW = playThisChars.toUpperCase().toCharArray(); + + for (char letterToPlay: playThisInCW){ + switch (letterToPlay){ + case '!': + musicList.add(new Media(new File ("VOICEBELL.mp3").toURI().toString())); + break; + case '?': + musicList.add(new Media(new File ("VOICEYOUGOTMAIL.mp3").toURI().toString())); + break; + case '#': + musicList.add(new Media(new File ("VOICEHELLO.mp3").toURI().toString())); + break; + case '*': + musicList.add(new Media(new File ("VOICE73.mp3").toURI().toString())); + break; + case '$': + musicList.add(new Media(new File ("VOICESTROKEPORTABLE.mp3").toURI().toString())); + break; + case 'A': + musicList.add(new Media(new File ("VOICEA.mp3").toURI().toString())); + break; + case 'B': + musicList.add(new Media(new File ("VOICEB.mp3").toURI().toString())); + break; + case 'C': + musicList.add(new Media(new File ("VOICEC.mp3").toURI().toString())); + break; + case 'D': + musicList.add(new Media(new File ("VOICED.mp3").toURI().toString())); + break; + case 'E': + musicList.add(new Media(new File ("VOICEE.mp3").toURI().toString())); + break; + case 'F': + musicList.add(new Media(new File ("VOICEF.mp3").toURI().toString())); + break; + case 'G': + musicList.add(new Media(new File ("VOICEG.mp3").toURI().toString())); + break; + case 'H': + musicList.add(new Media(new File ("VOICEH.mp3").toURI().toString())); + break; + case 'I': + musicList.add(new Media(new File ("VOICEI.mp3").toURI().toString())); + break; + case 'J': + musicList.add(new Media(new File ("VOICEJ.mp3").toURI().toString())); + break; + case 'K': + musicList.add(new Media(new File ("VOICEK.mp3").toURI().toString())); + break; + case 'L': + musicList.add(new Media(new File ("VOICEL.mp3").toURI().toString())); + break; + case 'M': + musicList.add(new Media(new File ("VOICEM.mp3").toURI().toString())); + break; + case 'N': + musicList.add(new Media(new File ("VOICEN.mp3").toURI().toString())); + break; + case 'O': + musicList.add(new Media(new File ("VOICEO.mp3").toURI().toString())); + break; + case 'P': + musicList.add(new Media(new File ("VOICEP.mp3").toURI().toString())); + break; + case 'Q': + musicList.add(new Media(new File ("VOICEQ.mp3").toURI().toString())); + break; + case 'R': + musicList.add(new Media(new File ("VOICER.mp3").toURI().toString())); + break; + case 'S': + musicList.add(new Media(new File ("VOICES.mp3").toURI().toString())); + break; + case 'T': + musicList.add(new Media(new File ("VOICET.mp3").toURI().toString())); + break; + case 'U': + musicList.add(new Media(new File ("VOICEU.mp3").toURI().toString())); + break; + case 'V': + musicList.add(new Media(new File ("VOICEV.mp3").toURI().toString())); + break; + case 'W': + musicList.add(new Media(new File ("VOICEW.mp3").toURI().toString())); + break; + case 'X': + musicList.add(new Media(new File ("VOICEX.mp3").toURI().toString())); + break; + case 'Y': + musicList.add(new Media(new File ("VOICEY.mp3").toURI().toString())); + break; + case 'Z': + musicList.add(new Media(new File ("VOICEZ.mp3").toURI().toString())); + break; + case '1': + musicList.add(new Media(new File ("VOICE1.mp3").toURI().toString())); + break; + case '2': + musicList.add(new Media(new File ("VOICE2.mp3").toURI().toString())); + break; + case '3': + musicList.add(new Media(new File ("VOICE3.mp3").toURI().toString())); + break; + case '4': + musicList.add(new Media(new File ("VOICE4.mp3").toURI().toString())); + break; + case '5': + musicList.add(new Media(new File ("VOICE5.mp3").toURI().toString())); + break; + case '6': + musicList.add(new Media(new File ("VOICE6.mp3").toURI().toString())); + break; + case '7': + musicList.add(new Media(new File ("VOICE7.mp3").toURI().toString())); + break; + case '8': + musicList.add(new Media(new File ("VOICE8.mp3").toURI().toString())); + break; + case '9': + musicList.add(new Media(new File ("VOICE9.mp3").toURI().toString())); + break; + case '0': + musicList.add(new Media(new File ("VOICE0.mp3").toURI().toString())); + break; + case '/': + musicList.add(new Media(new File ("VOICESTROKE.mp3").toURI().toString())); + break; +// case ' ': +// musicList.add(new Media(new File ("VOICESPACE.mp3").toURI().toString())); +// break; + default: + System.out.println("[KST4ContestApp, warning, letter not defined:] cwLetters = " + Arrays.toString(playThisInCW)); + } + } + playMusic(); +// mediaPlayer.dispose(); + + } + +// protected static final int SAMPLE_RATE = 16 * 1024; + + + + + private void playMusic() { + + +// System.out.println("Kst4ContestApplication.playMusic"); + if(musicList.peek() == null) + { + return; + } + mediaPlayer = new MediaPlayer(musicList.poll()); + mediaPlayer.setRate(1.0); + + mediaPlayer.setOnReady(() -> { + mediaPlayer.play(); + mediaPlayer.setOnEndOfMedia(() -> { +// mediaPlayer.dispose(); + playMusic(); + if (musicList.isEmpty()) { +// mediaPlayer.dispose(); + } + }); + }); + + } + @Override - public void start(Stage primaryStage) throws InterruptedException, IOException { + public void start(Stage primaryStage) throws InterruptedException, IOException, URISyntaxException { + // this.primaryStage = primaryStage; // ChatCategory category = new ChatCategory(0); //TODO: get the Category out of the preferences-object @@ -1888,6 +2211,9 @@ public class Kst4ContestApplication extends Application { // ownChatMemberObject.setQra("JO51IJ"); chatcontroller = new ChatController(ownChatMemberObject); // instantiate the Chatcontroller with the user object + + this.chatcontroller.getPlayAudioUtils().playNoiseLauncher('!'); + // chatcontroller.execute(); //TODO:THAT IS THE MAIN POINT WHERE THE CHAT WILL BE STARTED --- MOVED TO CONNECT BUTTON EVENTHANDLER // System.out.println(chatcontroller.getChatMemberTable().size()); @@ -2717,15 +3043,41 @@ public class Kst4ContestApplication extends Application { grdPnlNotify.setPadding(new Insets(10, 10, 10, 10)); grdPnlNotify.setVgap(5); grdPnlNotify.setHgap(5); + grdPnlNotify.add(generateLabeledSeparator(100, "Notification settings"), 0, 0, 2, 1); - Label lblNitificationInfo = new Label( - "Switch bands, prefix worked by others alert, direction notifications, notification pattern matchers"); +// Label lblNitificationInfo = new Label( +// "Switch bands, prefix worked by others alert, direction notifications, notification pattern matchers"); // CheckBox chkBxEnableTRXMsgbyUCX = new CheckBox(); - grdPnlNotify.add(generateLabeledSeparator(100, "Notification settings"), 0, 0, 2, 1); - grdPnlNotify.add(lblNitificationInfo, 0, 1); + Label lblNotifyEnableSimpleSounds = new Label("Enable audio notifications at: startup, new personal messages, other"); + Label lblNotifyCWSounds = new Label("Enable CW callsign spelling for new personal messages"); + Label lblNotifyVoiceSounds = new Label("Enable phonetic callsign spelling for new personal messages"); + + + CheckBox chkBxEnableNotifySimpleSounds = new CheckBox(); + chkBxEnableNotifySimpleSounds.setSelected(this.chatcontroller.getChatPreferences().isNotify_playSimpleSounds()); + + chkBxEnableNotifySimpleSounds.selectedProperty().addListener(new ChangeListener() { + @Override + public void changed(ObservableValue observable, Boolean oldValue, Boolean newValue) { + + chatcontroller.getChatPreferences() + .setNotify_playSimpleSounds(chkBxEnableNotifySimpleSounds.isSelected()); + System.out.println("[Main.java, Info]: Notification simplesounds enabled: " + newValue); + } + }); + + + grdPnlNotify.add(lblNotifyEnableSimpleSounds, 0, 1); + grdPnlNotify.add(chkBxEnableNotifySimpleSounds, 1, 1); + + +// grdPnlNotify.add(lblNitificationInfo, 0, 1); // grdPnltrx.add(chkBxEnableTRXMsgbyUCX, 1, 1); + + + VBox vbxNotify = new VBox(); vbxNotify.setPadding(new Insets(10, 10, 10, 10)); vbxNotify.getChildren().addAll(grdPnlNotify); @@ -3188,6 +3540,8 @@ public class Kst4ContestApplication extends Application { // event.consume(); } else { System.out.println("closewindowevent: Platform.exit"); + + Platform.exit(); } } diff --git a/src/main/java/module-info.java b/src/main/java/module-info.java new file mode 100644 index 0000000..a52fe40 --- /dev/null +++ b/src/main/java/module-info.java @@ -0,0 +1,10 @@ +module praktiKST { + requires javafx.controls; + requires jdk.xml.dom; + requires java.sql; + requires javafx.media; + exports kst4contest.controller; + exports kst4contest.locatorUtils; + exports kst4contest.model; + exports kst4contest.view; +} \ No newline at end of file diff --git a/src/test/java/kst4contest/test/TestAudioPlayerUtils.java b/src/test/java/kst4contest/test/TestAudioPlayerUtils.java new file mode 100644 index 0000000..4ca6b75 --- /dev/null +++ b/src/test/java/kst4contest/test/TestAudioPlayerUtils.java @@ -0,0 +1,19 @@ +package kst4contest.test; + +import javafx.application.Application; +import javafx.stage.Stage; +import kst4contest.utils.PlayAudioUtils; + +public class TestAudioPlayerUtils extends Application { + + public static void main(String[] args) { + + } + + @Override + public void start(Stage stage) throws Exception { + + PlayAudioUtils testAudio = new PlayAudioUtils(); + testAudio.playCWLauncher("DO5AMF"); + } +}