summaryrefslogtreecommitdiff
path: root/NET/worlds/scape/MCIThread.java
diff options
context:
space:
mode:
authorFuwn <[email protected]>2026-02-12 22:33:32 -0800
committerFuwn <[email protected]>2026-02-12 22:33:32 -0800
commitc7a9d4a6bd53ed7d61731770f2f10e8b9fd435f9 (patch)
treedf9f48bf128a6c0186a8e91857d6ff30fe0e9f18 /NET/worlds/scape/MCIThread.java
downloadworldsplayer-c7a9d4a6bd53ed7d61731770f2f10e8b9fd435f9.tar.xz
worldsplayer-c7a9d4a6bd53ed7d61731770f2f10e8b9fd435f9.zip
Initial commit
Diffstat (limited to 'NET/worlds/scape/MCIThread.java')
-rw-r--r--NET/worlds/scape/MCIThread.java44
1 files changed, 44 insertions, 0 deletions
diff --git a/NET/worlds/scape/MCIThread.java b/NET/worlds/scape/MCIThread.java
new file mode 100644
index 0000000..e63518a
--- /dev/null
+++ b/NET/worlds/scape/MCIThread.java
@@ -0,0 +1,44 @@
+package NET.worlds.scape;
+
+import NET.worlds.console.Main;
+import NET.worlds.console.MainCallback;
+import NET.worlds.console.MainTerminalCallback;
+import java.util.Vector;
+
+class MCIThread implements MainCallback, MainTerminalCallback {
+ private Vector queue = new Vector();
+ private int frameNum;
+
+ public MCIThread() {
+ Main.register(this);
+ }
+
+ public synchronized void pushCommand(MCISoundCommand c) {
+ this.queue.addElement(c);
+ c.onQueue(true);
+ c.frameNum = this.frameNum + 2;
+ }
+
+ @Override
+ public synchronized void mainCallback() {
+ this.frameNum++;
+
+ while (this.queue.size() > 0) {
+ MCISoundCommand command = (MCISoundCommand)this.queue.elementAt(0);
+ if (command.frameNum > this.frameNum) {
+ return;
+ }
+
+ command.onQueue(false);
+ this.queue.removeElementAt(0);
+ command.run();
+ }
+ }
+
+ @Override
+ public synchronized void terminalCallback() {
+ MCISoundPlayer.shutdown();
+ ASFSoundPlayer.shutdown();
+ Main.unregister(this);
+ }
+}