Skip to content
Snippets Groups Projects
Select Git revision
  • 6f434c67107245e2ebbbc2dcef78499d3bc1a8c0
  • master default
  • renovate/selenium.version
  • renovate/assertj-core.version
  • renovate/major-fontawesome.version
  • renovate/datatables.version
  • renovate/opencsv.version
  • renovate/org.springframework.boot-spring-boot-starter-parent-3.x
  • renovate/junit-jupiter-engine.version
  • renovate/testcontainer.version
  • demo
  • v1_8_1
  • v2.18.1
  • v2.18.0
  • v2.17.2
  • v2.17.1
  • v2.17.0
  • v2.16.1
  • v2.16.0
  • v2.15.1
  • v2.15.0
  • v2.14.0
  • v2.13.0
  • v2.12.0
  • v2.11.0
  • v2.10.0
  • v2.9.2
  • v2.9.1
  • v2.9.0
  • v2.8.0
  • testPipeline2
  • v2.7.0
32 results

newChart.ftl

Blame
  • NativeAudioMacHandlerConnect.java 2.28 KiB
    package de.tobias.playpad;
    
    import java.util.HashMap;
    
    import de.tobias.playpad.NativeAudio.NativeAudioDelegate;
    import de.tobias.playpad.audio.AudioCapability;
    import de.tobias.playpad.audio.AudioHandler;
    import de.tobias.playpad.audio.AudioHandlerConnect;
    import de.tobias.playpad.audio.Peakable.Channel;
    import de.tobias.playpad.pad.PadStatus;
    import de.tobias.playpad.pad.conntent.PadContent;
    import de.tobias.playpad.viewcontroller.AudioHandlerViewController;
    import javafx.util.Duration;
    
    public class NativeAudioMacHandlerConnect extends AudioHandlerConnect implements NativeAudioDelegate {
    
    	private static final HashMap<Integer, NativeAudioMacHandler> handlers = new HashMap<>();
    
    	public NativeAudioMacHandlerConnect() {
    		NativeAudio.initialize();
    		NativeAudio.setDelegate(this);
    	}
    
    	@Override
    	public AudioHandler createAudioHandler(PadContent content) {
    		NativeAudioMacHandler nativeAudioMacHandler = new NativeAudioMacHandler(content);
    		handlers.put(nativeAudioMacHandler.getId(), nativeAudioMacHandler);
    		return nativeAudioMacHandler;
    	}
    
    	@Override
    	public AudioHandlerViewController getAudioHandlerSettingsViewController() {
    		return null;
    	}
    
    	@Override
    	public String getType() {
    		return "Native";
    	}
    
    	@Override
    	public void onFinish(int id) {
    		NativeAudioMacHandler nativeAudioMacHandler = handlers.get(id);
    		if (nativeAudioMacHandler != null) {
    			PadContent content = nativeAudioMacHandler.getContent();
    			if (content != null) {
    				content.getPad().setStatus(PadStatus.STOP);
    			}
    		}
    	}
    	
    	@Override
    	public void onPositionChanged(int id, double position) {
    		NativeAudioMacHandler nativeAudioMacHandler = handlers.get(id);
    		if (nativeAudioMacHandler != null) {
    			nativeAudioMacHandler.positionProperty.set(Duration.seconds(position));
    		}
    	}
    	
    	@Override
    	public void onPeakMeter(int id, float left, float right) {
    		NativeAudioMacHandler nativeAudioMacHandler = handlers.get(id);
    		if (nativeAudioMacHandler != null) {
    			nativeAudioMacHandler.audioLevelProperty(Channel.LEFT).set(left);
    			nativeAudioMacHandler.audioLevelProperty(Channel.RIGHT).set(right);
    		}
    	}
    
    	@Override
    	public boolean isFeatureAvaiable(AudioCapability audioCapability) {
    		return false;
    	}
    
    	@Override
    	public AudioHandlerViewController getAudioFeatureSettings(AudioCapability audioCapablility) {
    		return null;
    	}
    }