Skip to content

Commit

Permalink
chore: update to CsoundFFM 1.0.1 (uses new Csound 7 API)
Browse files Browse the repository at this point in the history
  • Loading branch information
kunstmusik committed Sep 8, 2024
1 parent accf6c8 commit 3963f6a
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 27 deletions.
2 changes: 1 addition & 1 deletion blue-csnd6/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
<dependency>
<groupId>com.kunstmusik</groupId>
<artifactId>csoundffm</artifactId>
<version>1.0.0</version>
<version>1.0.1</version>
</dependency>
</dependencies>
<distributionManagement>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,6 @@ public boolean isAvailable() {

@Override
public String toString() {
return "Csound 6 API";
return "Csound 7 API";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public CS6DiskRendererService() {

@Override
public String toString() {
return "Csound 6 API";
return "Csound 7 API";
}

@Override
Expand Down Expand Up @@ -108,12 +108,11 @@ private void exec(String[] args,

if (retVal != 0) {
notifyPlayModeListeners(PlayModeListener.PLAY_MODE_STOP);
csound.stop();
csound.cleanup();
csound.setMessageCallback(null);
csound.reset();
return;
}
csound.start();

int updateRate = (int) (csound.getKr()
/ PlaybackSettings.getInstance().getPlaybackFPS());
Expand Down Expand Up @@ -161,10 +160,9 @@ private void exec(String[] args,
}
}
} while (csound.performKsmps() == 0 && keepRunning);
csound.stop();
csound.cleanup();
csound.setMessageCallback(null);

csound.reset();
csound.setMessageCallback(null);


manager.endRender();
Expand Down Expand Up @@ -215,19 +213,18 @@ public String execWaitAndCollect(String[] args,

if (retVal != 0) {
blueCallbackWrapper.setStringBuffer(null);
csound.stop();
csound.cleanup();
csound.setMessageCallback(null);
csound.reset();
csound.setMessageCallback(null);

return buffer.toString();
}

csound.start();


while (csound.performKsmps() == 0 && keepRunning) {
// empty
}
csound.stop();
csound.cleanup();
csound.setMessageCallback(null);
csound.reset();

Expand Down Expand Up @@ -347,21 +344,20 @@ public void renderToDisk(DiskRenderJob job) {

if (retVal != 0) {
notifyPlayModeListeners(PlayModeListener.PLAY_MODE_STOP);
csound.stop();
csound.cleanup();
csound.setMessageCallback(null);
csound.reset();
return;
}

csound.start();

while (csound.performKsmps() == 0 && keepRunning) {

}
csound.stop();
csound.cleanup();

csound.setMessageCallback(null);
csound.reset();

keepRunning = false;

notifyPlayModeListeners(PlayModeListener.PLAY_MODE_STOP);
Expand All @@ -371,6 +367,6 @@ public void renderToDisk(DiskRenderJob job) {

@Override
public int getCsoundVersion(String csoundCommand) {
return 6;
return 7;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public CS6RealtimeRenderService() {

@Override
public String toString() {
return "Csound 6 API";
return "Csound 7 API";
}

@Override
Expand Down Expand Up @@ -152,14 +152,15 @@ public void play(BlueData blueData, CsdRenderResult result,

}
notifyPlayModeListeners(PlayModeListener.PLAY_MODE_STOP);
csound.stop();
csound.cleanup();
csound.reset();
csound.setMessageCallback(null);
csound = null;
blueCallbackWrapper = null;
return;

}

csound.start();

runnerThread = new APIRunnerThread(blueData, csound, this,
result.getParameters(), result.getStringChannels(),
Expand Down Expand Up @@ -501,10 +502,10 @@ public void run() {
Message m = buffer.getMessage(i % capacity);
switch (m.messageType) {
case 0:
csound.readScore(m.payload);
csound.eventString(m.payload, 0);
break;
case 1:
csound.compileOrc(m.payload);
csound.compileOrc(m.payload, 0);
break;
}

Expand Down Expand Up @@ -576,8 +577,7 @@ public void run() {

bindings.clear();

csound.stop();
csound.cleanup();
csound.reset();
csound.setMessageCallback(null);

if (renderUpdatesTime) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public RealtimeRenderService createInstance() {

@Override
public String toString() {
return "Csound 6 API";
return "Csound 7 API";
}

@Override
Expand Down

0 comments on commit 3963f6a

Please sign in to comment.