Skip to content

Commit

Permalink
recommiting source to resolve github issues
Browse files Browse the repository at this point in the history
classes mixed up and code missing from Rory's latest commit. Github
seemed to try mix and match between my last commit and his. Hopefully
will be ok now
  • Loading branch information
conorrobotham committed Feb 11, 2013
1 parent 85292e8 commit 7bf8d2f
Show file tree
Hide file tree
Showing 6 changed files with 543 additions and 551 deletions.
2 changes: 1 addition & 1 deletion csoundo/src/csoundo/CallbackWrapper.java
Expand Up @@ -18,7 +18,7 @@
* Free Software Foundation, Inc., 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA
*
* @author Rory Walsh
* @author Rory Walsh
* @modified 10/01/2012
* @version 0.2.1
*/
Expand Down
73 changes: 9 additions & 64 deletions csoundo/src/csoundo/ChannelMessage.java
Expand Up @@ -18,7 +18,7 @@
* Free Software Foundation, Inc., 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA
*
* @author Rory Walsh
* @author Jacob Joaquin, Rory Walsh, Conor Dempsey
* @modified 10/01/2012
* @version 0.2.1
*/
Expand All @@ -30,70 +30,15 @@
import java.util.*;

/**
* This class is for saving messages to a queue
* so they can be sent to and from Csound in a thread safe mannor
* Simple class to hold channel name and value.
*/
public class MessageQueue {
private String csd;
int numberOfTablesToRetreive;
private Vector<ChannelMessage> channelMessageQueue;
private Vector<TableMessage> tableMessageQueue;
private Vector<ChannelMessage> valueMessageQueue;


public MessageQueue(){
channelMessageQueue = new Vector<ChannelMessage>();
valueMessageQueue = new Vector<ChannelMessage>();
tableMessageQueue = new Vector<TableMessage>();
}

public void addMessageToChannelQueue(String _chan, double _val){
channelMessageQueue.addElement(new ChannelMessage(_chan, _val));
}

public void addMessageToTableQueue(int _tableNumber, int _index, double _amp){
tableMessageQueue.addElement(new TableMessage(_tableNumber, _index, _amp));
}

public void addMessageToValueQueue(String _chan, double _val){
valueMessageQueue.addElement(new ChannelMessage(_chan, _val));
}

public void fillArrayWithTablePoints(int table, float[] array){

}


public ChannelMessage getMessageFromChannelQueue(int index){
return channelMessageQueue.get(index);
}

public TableMessage getMessageFromTableQueue(int index){
return tableMessageQueue.get(index);
}

public ChannelMessage getMessageFromValueQueue(int index){
return valueMessageQueue.get(index);
}

public int getNumberOfMessagesInQueue(String queue){
if(queue=="channel")
return channelMessageQueue.size();
else if(queue=="table")
return tableMessageQueue.size();
else if(queue=="value")
return valueMessageQueue.size();
else return 0;
public class ChannelMessage {
public String channelName;
public double channelData;

public ChannelMessage(String _chan, double _val){
channelData = _val;
channelName = _chan;
}

public void flushMessagesFromQueue(String queue){
if(queue=="channel")
channelMessageQueue.removeAllElements();
else if(queue=="table")
tableMessageQueue.removeAllElements();
else if(queue=="value")
valueMessageQueue.removeAllElements();
}

}

0 comments on commit 7bf8d2f

Please sign in to comment.