Compare commits

..

3 commits

Author SHA1 Message Date
Arnaud HOUDELETTE-LANGLOIS
7a27345f0a Correction bug de répercussion sur Sequenceur Maitre sur ajout suppression entrées dans les Seq Macro, Midi et OSC 2026-10-29 00:28:47 +01:00
Arnaud HOUDELETTE-LANGLOIS
0a3b58f73d Passage serveur UDP OSC en Asynchrone (suppression ThreadLoop) 2026-10-29 00:28:09 +01:00
Arnaud HOUDELETTE-LANGLOIS
ea8ee8040a Suppression du Thread.Abort (compatibilité future) 2026-10-29 00:25:57 +01:00
5 changed files with 39 additions and 43 deletions

View file

@ -378,7 +378,6 @@ namespace DMX2
if (tickThread != null) {
running = false;
tickThread.Join (50);
tickThread.Abort ();
}
foreach (var seq in sequenceurs) {
IDisposable idis = seq as IDisposable;

View file

@ -3,6 +3,7 @@ using System.Net;
using System.Net.Sockets;
using System.Threading;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace DMX2
{
@ -10,26 +11,22 @@ namespace DMX2
{
UdpClient udpCli=null;
Thread pollThread = null;
bool running=true;
public OSCServer ()
{
pollThread = new Thread(new ThreadStart(Loop));
pollThread.Start();
udpCli = new UdpClient(7772);
udpCli.BeginReceive(UdpCliReceive,null);
}
void Loop ()
void UdpCliReceive(IAsyncResult ar)
{
udpCli = new UdpClient (7772);
if (!ar.IsCompleted) return;
byte[] recv;
IPEndPoint remep = new IPEndPoint(IPAddress.Any, 0);
try {
while (running) {
recv = udpCli.Receive (ref remep);
//Console.WriteLine(remep);
recv = udpCli.EndReceive(ar, ref remep);
OSCMessage msg = new OSCMessage(recv);
#if DEBUG
Console.Write(msg.Address);
@ -37,17 +34,16 @@ namespace DMX2
foreach (var arg in msg.Args)
Console.WriteLine(arg.GetString());
#endif
try{
try
{
ProcessMessage(msg, remep);
}catch{}
}
} catch (SocketException ex) {
}
finally {
}
catch { }
udpCli.BeginReceive(UdpCliReceive, null);
}
/// <summary>
/// /master <X---
/// /masterseq/
@ -347,15 +343,8 @@ namespace DMX2
protected virtual void Dispose (bool disposing)
{
if (disposing) {
running=false;
if(udpCli!=null)
udpCli.Close();
if(pollThread!=null)
{
if(!pollThread.Join(100))
pollThread.Abort();
pollThread=null;
}
}
}

View file

@ -658,7 +658,7 @@ namespace DMX2
var cmd = regexCommand2.Match(commands[i]);
if(cmd.Success){
int ef = int.Parse(cmd.Groups["effet"].Value);
if (ef-1>index) {
if (ef>index) {
ef++;
commands[i] = ef.ToString() + cmd.Groups["params"].Value;
}

View file

@ -566,7 +566,7 @@ namespace DMX2
var cmd = regexCommand2.Match(commands[i]);
if(cmd.Success){
int ef = int.Parse(cmd.Groups["effet"].Value);
if (ef-1>index) {
if (ef>index) {
ef++;
commands[i] = ef.ToString() + cmd.Groups["params"].Value;
}

View file

@ -309,6 +309,7 @@ namespace DMX2
string[] data = enCours.Commande.Split(' ');
OSCMessage message = new OSCMessage(data[0]);
if (data.Length < 2) return;
for (int i = 1; i < data.Length; i++)
{
if (int.TryParse(data[i], out int di))
@ -320,8 +321,15 @@ namespace DMX2
var buff = message.Encode();
try
{
udpClient.Send(buff, buff.Length);
}
catch (SocketException)
{
}
}
@ -479,7 +487,7 @@ namespace DMX2
var cmd = regexCommand2.Match(commands[i]);
if(cmd.Success){
int ef = int.Parse(cmd.Groups["effet"].Value);
if (ef-1>index) {
if (ef>index) {
ef++;
commands[i] = ef.ToString() + cmd.Groups["params"].Value;
}