diff --git a/audio_files/va_droite b/audio_files/va_droite new file mode 100644 index 0000000..c32fd0d --- /dev/null +++ b/audio_files/va_droite @@ -0,0 +1 @@ +Va à droite diff --git a/audio_files/va_droite.pho b/audio_files/va_droite.pho new file mode 100644 index 0000000..e69de29 diff --git a/audio_files/va_gauche b/audio_files/va_gauche new file mode 100644 index 0000000..9cf6e29 --- /dev/null +++ b/audio_files/va_gauche @@ -0,0 +1 @@ +Va à gauche diff --git a/control.py b/control.py index cf87647..79601e2 100644 --- a/control.py +++ b/control.py @@ -218,6 +218,16 @@ def coup_pied_droit(): est_stop = 0 ajoute_action("Coup de pied droit !") +def attention_obstacle(): + global est_stop + est_stop = 0 + ajoute_action("Attention obstacle") + +def attention_escalier(): + global est_stop + est_stop = 0 + ajoute_action("Attention escalier") + print(inputs.devices.gamepads) actions = { @@ -248,6 +258,8 @@ actions = { 25 : saute, 26 : coup_pied_gauche, 27 : coup_pied_droit, + 28 : attention_obstacle, + 29 : attention_escalier, } @@ -282,6 +294,12 @@ pied_droit = 0 prev_A = -1 A = -1 +prev_Y = -1 +Y = -1 + +prev_B = -1 +B = -1 + prev_brase_gauche = -1 bras_gauche = -1 bras_gauche_tendu = 0 @@ -314,6 +332,10 @@ while (True) : X = event.state if event.code == "BTN_SOUTH" : A = event.state + if event.code == "BTN_EAST" : + B = event.state + if event.code == "BTN_WEST" : + Y = event.state if event.code == "BTN_TL" : TL = event.state if event.code == "BTN_TR" : @@ -424,3 +446,13 @@ while (True) : if TR == 1 : actions[27]() prev_TR = TR + + if B > -1 and not B == prev_B : + if B == 1 : + actions[29]() + prev_B = B + + if Y > -1 and not Y == prev_Y : + if Y == 1 : + actions[28]() + prev_Y = Y diff --git a/exemple.txt b/exemple.txt new file mode 100644 index 0000000..a2df31d --- /dev/null +++ b/exemple.txt @@ -0,0 +1 @@ +Regarde à gauche diff --git a/install_slender.sh b/install_slender.sh new file mode 100644 index 0000000..daad13b --- /dev/null +++ b/install_slender.sh @@ -0,0 +1,25 @@ +#!/bin/bash + +# This script will create a virtual microphone for PulseAudio to use and set it +# as the default device. + +# Load the "module-pipe-source" module to read audio data from a FIFO special +# file. +echo "Creating virtual microphone." +pactl load-module module-pipe-source source_name=virtmic file=/home/faquin/audioFiles/virtmic format=s16le rate=16000 channels=1 + +# Set the virtmic as the default source device. +echo "Set the virtual microphone as the default device." +pactl set-default-source virtmic + +# Create a file that will set the default source device to virtmic for all +# PulseAudio client applications. +echo "default-source = virtmic" > /home/faquin/.config/pulse/client.conf + +# Write the audio file to the named pipe virtmic. This will block until the +# named pipe is read. +echo "Writing audio file to virtual microphone." +#while true; do +#cat audioFile0.raw > /home/faquin/audioFiles/virtmic +#done + diff --git a/test_input.py b/test_input.py new file mode 100644 index 0000000..10cfc0d --- /dev/null +++ b/test_input.py @@ -0,0 +1,10 @@ +import inputs + +print(inputs.devices.gamepads) + +while True: + events = inputs.get_gamepad() + for event in events: + if "ABS" not in event.code and "REPORT" not in event.code : + print(event.ev_type, event.code, event.state) + diff --git a/uninstall_slender.sh b/uninstall_slender.sh new file mode 100644 index 0000000..079d00b --- /dev/null +++ b/uninstall_slender.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +# Uninstall the virtual microphone. + +pactl unload-module module-pipe-source +rm /home/faquin/.config/pulse/client.conf diff --git a/v2.sh b/v2.sh new file mode 100644 index 0000000..70d17a1 --- /dev/null +++ b/v2.sh @@ -0,0 +1,14 @@ +#Load pulseaudio virtual audio source +#pulseaudio -D --disable-shm=yes --exit-idle-time=-1 + +# Create virtual output device (used for audio playback) +pactl load-module module-null-sink sink_name=DummyOutput sink_properties=device.description="Virtual_Dummy_Output" + +# Create virtual microphone output, used to play media into the "microphone" +pactl load-module module-null-sink sink_name=MicOutput sink_properties=device.description="Virtual_Microphone_Output" + +pacmd load-module module-virtual-source source_name=VirtualMic +pacmd load-module module-virtual-sink sink_name=VirtualSink + +pacmd set-default-sink VirtualSink +pacmd set-default-source VirtualSink.monitor