1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Max/MSPでOSの判定を入れる

Posted at

Max/MSPをあまり触ってきていないので、別の方法がある場合は教えていただけるとうれしいです!

mxjの実装

import com.cycling74.max.*;

public class MyPlatform extends MaxObject {
    private static final String OS_NAME = System.getProperty("os.name").toLowerCase();

    public static boolean isLinux() {
        return OS_NAME.startsWith("linux");
    }

    public static boolean isMac() {
        return OS_NAME.startsWith("mac");
    }

    public static boolean isWindows() {
        return OS_NAME.startsWith("windows");
    }

    public static boolean isSunOS() {
        return OS_NAME.startsWith("sunos");
    }

    public MyPlatform() {
        declareIO(1, 2);
    }

    public void bang() {
        if (isWindows()) {
            outlet(0, "bang");
        } else if (isMac()) {
            outlet(1, "bang");
        } else {
            outlet(2, "bang");
        }
    }
}

ビルド後にclassファイルをcodeディレクトリに入れて下さい。

リポジトリ

使い方

bangを送ると対象のoutletからbangが届きます。
screenshot.png

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?