forked from libpd/libpd
-
Notifications
You must be signed in to change notification settings - Fork 0
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
0a8d7cf
commit 41ec88b
Showing
5 changed files
with
84 additions
and
104 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
/** | ||
* | ||
* For information on usage and redistribution, and for a DISCLAIMER OF ALL | ||
* WARRANTIES, see the file, "LICENSE.txt," in this distribution. | ||
* | ||
*/ | ||
|
||
package org.puredata.core; | ||
|
||
/** | ||
* | ||
* PdListener provides an interface for receiving messages from Pd. | ||
* | ||
* @author Peter Brinkmann ([email protected]) | ||
* | ||
*/ | ||
public interface PdListener { | ||
|
||
/** | ||
* Receive bang from Pd | ||
* | ||
* @param source symbol to which the bang was sent | ||
*/ | ||
public void receiveBang(String source); | ||
|
||
/** | ||
* Receive float from Pd | ||
* | ||
* @param source symbol to which the float was sent | ||
* @param x float value | ||
*/ | ||
public void receiveFloat(String source, float x); | ||
|
||
public void receiveSymbol(String source, String symbol); | ||
|
||
/** | ||
* Receive a list from Pd | ||
* | ||
* @param source symbol to which the list was sent | ||
* @param args elements may be of type Integer, Float, or String | ||
*/ | ||
public void receiveList(String source, Object... args); | ||
|
||
/** | ||
* Receive a typed message from Pd; e.g., [;foo bar a b c( corresponds to the call receiveMessage("foo", "bar", { "a", "b", "c"}); | ||
* | ||
* @param source symbol to which the typed message was sent | ||
* @param symbol | ||
* @param args elements may be of type Integer, Float, or String | ||
*/ | ||
public void receiveMessage(String source, String symbol, Object... args); | ||
|
||
/** | ||
* Adapter for PdListener implementations that only need to handle a subset of Pd messages | ||
*/ | ||
public class Adapter implements PdListener { | ||
@Override public void receiveBang(String source) {} | ||
@Override public void receiveFloat(String source, float x) {} | ||
@Override public void receiveSymbol(String source, String symbol) {} | ||
@Override public void receiveList(String source, Object... args) {} | ||
@Override public void receiveMessage(String source, String symbol, Object... args) {} | ||
} | ||
} |
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 |
---|---|---|
|
@@ -14,7 +14,7 @@ | |
* @author Peter Brinkmann ([email protected]) | ||
* | ||
*/ | ||
public interface PdReceiver { | ||
public interface PdReceiver extends PdListener { | ||
|
||
/** | ||
* Print output from Pd print objects | ||
|
@@ -23,49 +23,10 @@ public interface PdReceiver { | |
*/ | ||
public void print(String s); | ||
|
||
/** | ||
* Receive bang from Pd | ||
* | ||
* @param source symbol to which the bang was sent | ||
*/ | ||
public void receiveBang(String source); | ||
|
||
/** | ||
* Receive float from Pd | ||
* | ||
* @param source symbol to which the float was sent | ||
* @param x float value | ||
*/ | ||
public void receiveFloat(String source, float x); | ||
|
||
public void receiveSymbol(String source, String symbol); | ||
|
||
/** | ||
* Receive a list from Pd | ||
* | ||
* @param source symbol to which the list was sent | ||
* @param args elements may be of type Integer, Float, or String | ||
*/ | ||
public void receiveList(String source, Object... args); | ||
|
||
/** | ||
* Receive a typed message from Pd; e.g., [;foo bar a b c( corresponds to the call receiveMessage("foo", "bar", { "a", "b", "c"}); | ||
* | ||
* @param source symbol to which the typed message was sent | ||
* @param symbol | ||
* @param args elements may be of type Integer, Float, or String | ||
*/ | ||
public void receiveMessage(String source, String symbol, Object... args); | ||
|
||
/** | ||
* Adapter for PdReceiver implementations that only need to handle a subset of Pd messages | ||
*/ | ||
public static class Adapter implements PdReceiver { | ||
public static class Adapter extends PdListener.Adapter implements PdReceiver { | ||
@Override public void print(String s) {} | ||
@Override public void receiveBang(String source) {} | ||
@Override public void receiveFloat(String source, float x) {} | ||
@Override public void receiveList(String source, Object... args) {} | ||
@Override public void receiveMessage(String source, String symbol, Object... args) {} | ||
@Override public void receiveSymbol(String source, String symbol) {} | ||
} | ||
} |
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 was deleted.
Oops, something went wrong.
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