-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d827fd3
commit 70c0fe8
Showing
7 changed files
with
86 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package org.puredata.core | ||
|
||
internal class PdBase { | ||
external fun initialize() | ||
external fun addToSearchPath(dir: String) | ||
external fun openFile(patch: String, dir: String): Long | ||
external fun closeFile(ptr: Long) | ||
|
||
external fun sendBang(receiver: String): Int | ||
external fun sendFloat(receiver: String, x: Float): Int | ||
|
||
fun sendList(receiver: String, vararg args: Any) { | ||
if (startMessage(args.size) == 0) { | ||
var success = true | ||
for (arg in args) { | ||
when (arg) { | ||
is Int -> addFloat(arg.toFloat()) | ||
is Float -> addFloat(arg) | ||
is Double -> addFloat(arg.toFloat()) | ||
is String -> addSymbol(arg) | ||
else -> { | ||
success = false | ||
break | ||
} | ||
} | ||
} | ||
if (success) { | ||
finishList(receiver) | ||
} | ||
} | ||
} | ||
|
||
private external fun startMessage(length: Int): Int | ||
private external fun addFloat(x: Float) | ||
private external fun addSymbol(symbol: String) | ||
private external fun finishList(receiver: String): Int | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters