Skip to content

Commit

Permalink
review feedback pr
Browse files Browse the repository at this point in the history
introduce local varaible where necessary, otherwise ignore warning
for the sake of shorter log message line.
  • Loading branch information
soloturn committed Feb 15, 2024
1 parent c4f4400 commit ff2247d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ public class OpenALManager implements AudioManager {

private final Map<SoundSource<?>, AudioEndListener> endListeners = Maps.newHashMap();

@SuppressWarnings("PMD.GuardLogStatement")
public OpenALManager(AudioConfig config) throws OpenALException {
logger.info("Initializing OpenAL audio manager");

Expand All @@ -66,14 +67,13 @@ public OpenALManager(AudioConfig config) throws OpenALException {

logger.atInfo().addArgument(() -> AL10.alGetString(AL10.AL_VERSION)).log("OpenAL {} initialized!");

logger.atInfo().addArgument(() -> AL10.alGetString(AL10.AL_RENDERER)).addArgument(() -> AL10.alGetString(AL10.AL_VENDOR)).
log("Using OpenAL: {} by {}");
logger.atInfo().addArgument(() -> ALC10.alcGetString(device, ALC10.ALC_DEVICE_SPECIFIER)).log("Using device: {}");
logger.atInfo().addArgument(() -> AL10.alGetString(AL10.AL_EXTENSIONS)).log("Available AL extensions: {}");
logger.atInfo().addArgument(() -> ALC10.alcGetString(device, ALC10.ALC_EXTENSIONS)).log("Available ALC extensions: {}");
logger.atInfo().addArgument(() -> ALC10.alcGetInteger(device, ALC11.ALC_MONO_SOURCES)).log("Max mono sources: {}");
logger.atInfo().addArgument(() -> ALC10.alcGetInteger(device, ALC11.ALC_STEREO_SOURCES)).log("Max stereo sources: {}");
logger.atInfo().addArgument(() -> ALC10.alcGetInteger(device, ALC10.ALC_FREQUENCY)).log("Mixer frequency: {}");
logger.info("Using OpenAL: {} by {}", AL10.alGetString(AL10.AL_RENDERER), AL10.alGetString(AL10.AL_VENDOR));
logger.info("Using device: {}", ALC10.alcGetString(device, ALC10.ALC_DEVICE_SPECIFIER));
logger.info("Available AL extensions: {}", AL10.alGetString(AL10.AL_EXTENSIONS));
logger.info("Available ALC extensions: {}", ALC10.alcGetString(device, ALC10.ALC_EXTENSIONS));
logger.info("Max mono sources: {}", ALC10.alcGetInteger(device, ALC11.ALC_MONO_SOURCES));
logger.info("Max stereo sources: {}", ALC10.alcGetInteger(device, ALC11.ALC_STEREO_SOURCES));
logger.info("Mixer frequency: {}", ALC10.alcGetInteger(device, ALC10.ALC_FREQUENCY));

AL10.alDistanceModel(AL10.AL_INVERSE_DISTANCE_CLAMPED);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,12 @@ private Prefab createPrefab(EntityData.Prefab prefabData) {
private void loadComponentMapping(EntityData.GlobalStore globalStore) {
Map<Class<? extends Component>, Integer> componentIdTable = Maps.newHashMap();
for (int index = 0; index < globalStore.getComponentClassCount(); ++index) {
ComponentMetadata<?> componentMetadata = componentLibrary.resolve(globalStore.getComponentClass(index));
String componentClass = globalStore.getComponentClass(index);
ComponentMetadata<?> componentMetadata = componentLibrary.resolve(componentClass);
if (componentMetadata != null) {
componentIdTable.put(componentMetadata.getType(), index);
} else {
logger.atWarn().addArgument(globalStore.getComponentClass(index)).log("Unable to resolve component '{}'");
logger.warn("Unable to resolve component '{}'", componentClass);
}
}

Expand Down

0 comments on commit ff2247d

Please sign in to comment.