I am a beginner for Ubuntu developing.My Ubuntu version is Lubuntu 22.04 for aarch64.
I added a .py script like this;
import evdevimport os#symlink pathdevice_path = '/dev/input/by-id/usb-eGalax_Inc._USB_TouchController-event-mouse'#wav filewav_file = '/usr/local/autobase/Warn.wav'def play_wav(): os.system(f'aplay {wav_file}')def main(): try: #open the device device = evdev.InputDevice(device_path) for event in device.read_loop(): #check BTN_TOUCH if event.type == evdev.ecodes.EV_KEY and event.code == evdev.ecodes.BTN_TOUCH and event.value == 1: print(" play !") play_wav() except Exception as e: print(f"Error: {e}")if __name__ == "__main__": main()
Then, I added this .py script as a systemctl service to run it at the background whwnever I get an event from the touchscreen, which has value ==1 .
It works well, however, the problem is playing wav file getg mute when I run other processes with sound.For example, if I run YouTube video playing wav gets mute.And, if I run the alsamixer to control the wav, playing wav gets mute.Then, if I stop playing sound or quit the process, it returns to play wav.
I checked it with systemctl -status, but it says "active".What would be the problem?Please help me.
+Plus,Even I make the volume of alsamixer mute, this service keep making wav file with certain volume.Isn't it related to alsamixer?