Skip to content

Commit

Permalink
improvements to fade timing
Browse files Browse the repository at this point in the history
  • Loading branch information
Mindgamesnl committed Jul 8, 2024
1 parent 28cd0ac commit dd36f04
Show file tree
Hide file tree
Showing 10 changed files with 18 additions and 22 deletions.
2 changes: 1 addition & 1 deletion client/public/metadata.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"buildMajor":1,"buildMinor":125,"buildRevision":250,"buildTag":"dev","buildDate":"Thu Jun 13 2024","build":"1.125.250 dev"}
{"buildMajor":1,"buildMinor":125,"buildRevision":251,"buildTag":"dev","buildDate":"Tue Jul 09 2024","build":"1.125.251 dev"}
4 changes: 2 additions & 2 deletions client/src/client/services/media/objects/Mixer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export class Mixer {
}, 250);
}

tick() {
tick(forceInstant = false) {
this.channels.forEach((channel) => {
channel.tick();
});
Expand Down Expand Up @@ -57,7 +57,7 @@ export class Mixer {
}
});

const fade = channel.getPrefferedFadeTime() > 5;
const fade = channel.getPrefferedFadeTime() > 5 && !forceInstant;

if (score >= 1 && !channel.mutedByScore) {
channel.mutedByScore = true;
Expand Down
11 changes: 9 additions & 2 deletions client/src/client/services/socket/handlers/HandleCreateMedia.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,11 @@ export async function handleCreateMedia(data) {
if (muteRegions) {
debugLog('Incrementing region inhibit');
MediaManager.mixer.incrementInhibitor('REGION');
MediaManager.mixer.tick();
}

if (muteSpeakers) {
debugLog('Incrementing speaker inhibit');
MediaManager.mixer.incrementInhibitor('SPEAKER');
MediaManager.mixer.tick();
}

MediaManager.mixer.whenFinished(id, () => {
Expand All @@ -67,9 +65,12 @@ export async function handleCreateMedia(data) {

createdChannel.setTag(flag);

MediaManager.mixer.tick();

// load file and play
await createdMedia.load(source);
createdChannel.setChannelVolume(0);
createdChannel.originalVolume = volume;
createdMedia.setLooping(looping);
createdMedia.setStartAt(startAt);
// convert distance
Expand All @@ -83,7 +84,13 @@ export async function handleCreateMedia(data) {
} else {
// default sound, just play
createdChannel.setTag('DEFAULT');

createdMedia.whenInitialized(() => {
// are we not already nicked from the start?
if (createdChannel.mutedByScore) {
return;
}

if (fadeTime === 0) {
createdChannel.setChannelVolume(volume);
createdChannel.updateFromMasterVolume();
Expand Down
5 changes: 0 additions & 5 deletions client/src/client/util/AudioSourceProcessor.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,6 @@ export class AudioSourceProcessor {
this.isYoutube = true;
}

// strip old endpoint
if (source.includes('https://weathered-dust-0281.craftmend.workers.dev/')) {
source = source.replace('https://weathered-dust-0281.craftmend.workers.dev/', '');
}

// handle soundcloud
if (source.includes('soundcloud.com')) {
// update now playing too
Expand Down
2 changes: 1 addition & 1 deletion client/src/metadata.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"buildMajor":1,"buildMinor":125,"buildRevision":250,"buildTag":"dev","buildDate":"Thu Jun 13 2024","build":"1.125.250 dev"}
{"buildMajor":1,"buildMinor":125,"buildRevision":251,"buildTag":"dev","buildDate":"Tue Jul 09 2024","build":"1.125.251 dev"}
6 changes: 0 additions & 6 deletions modules/vistas-server/dependency-reduced-pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -152,12 +152,6 @@
<artifactId>junit</artifactId>
<version>4.13.2</version>
<scope>test</scope>
<exclusions>
<exclusion>
<artifactId>hamcrest-core</artifactId>
<groupId>org.hamcrest</groupId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
<properties>
Expand Down
2 changes: 1 addition & 1 deletion plugin/src/main/bash/data.bin
Original file line number Diff line number Diff line change
@@ -1 +1 @@
BUILD_NUM="1443"
BUILD_NUM="1445"
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public RegionModule(@Nullable AbstractRegionAdapter customAdapter) {

OpenAudioMc.getService(MediaService.class).getResetTriggers().add(() -> {
// clean media once a new media adapter is loaded, this ensures that they will be re-evaluated
worldManagers.forEach((s, worldRegionManager) -> {worldRegionManager.clearMedia();});
worldManagers.forEach((s, worldRegionManager) -> {worldRegionManager.dropMediaCache();});
});

// register unknown regions
Expand Down
2 changes: 1 addition & 1 deletion plugin/src/main/resources/data.bin
Original file line number Diff line number Diff line change
@@ -1 +1 @@
BUILD_NUM="1443"
BUILD_NUM="1445"
4 changes: 2 additions & 2 deletions plugin/src/main/resources/openaudiomc-build.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
BUILD_VERSION="1443"
BUILD_COMMIT="258a4b8a41ea78b464d2501a76164dceee302f7e"
BUILD_VERSION="1445"
BUILD_COMMIT="28cd0ac842b271f5be2e8efe9dc60208b96ad077"
BUILD_AUTHOR="Mats"

0 comments on commit dd36f04

Please sign in to comment.