Permalink
Browse files

cosmetics

  • Loading branch information...
1 parent ff7a1d9 commit 12fc3af30102a249f0924762e85f02ab3505f5f3 @tebjan committed May 13, 2012
Showing with 10 additions and 17 deletions.
  1. +10 −17 csharp/Native/LibPDNativeMessaging.cs
@@ -154,7 +154,7 @@ private static void SetupHooks()
public static event LibPDList List = delegate{};
/// <summary>
- /// Subscribe to this event in order to get PDs message messages. Currently only
+ /// Subscribe to this event in order to get PDs typed messages. Currently only
/// float and symbol types are supported. Other types in the list such as pointers will be null.
/// Note: Events may be raised by several threads, such as the GUI thread and
/// the audio thread. If a subscriber method calls operations that must be executed
@@ -202,19 +202,7 @@ private static void RaiseListEvent(string recv, int argc, IntPtr argv)
{
var args = new object[argc];
- for (int i = 0; i < argc; i++)
- {
- if(i!=0) argv = next_atom(argv);
-
- if(atom_is_float(argv) != 0)
- {
- args[i] = atom_get_float(argv);
- }
- else if(atom_is_symbol(argv) != 0)
- {
- args[i] = Marshal.PtrToStringAnsi(atom_get_symbol(argv));
- }
- }
+ ConvertList(args, argc, argv);
List(recv, args);
}
@@ -223,7 +211,14 @@ private static void RaiseMessageEvent(string recv, string msg, int argc, IntPtr
{
var args = new object[argc];
- for (int i = 0; i < argc; i++)
+ ConvertList(args, argc, argv);
+
+ Message(recv, msg, args);
+ }
+
+ private static void ConvertList(object[] args, int argc, IntPtr argv)
+ {
+ for (int i = 0; i < argc; i++)
{
if(i!=0) argv = next_atom(argv);
@@ -236,8 +231,6 @@ private static void RaiseMessageEvent(string recv, string msg, int argc, IntPtr
args[i] = Marshal.PtrToStringAnsi(atom_get_symbol(argv));
}
}
-
- Message(recv, msg, args);
}
#endregion Events

0 comments on commit 12fc3af

Please sign in to comment.