├── CausticLiveCore ├── .gitignore ├── src │ └── main │ │ └── java │ │ └── com │ │ └── teotigraphix │ │ └── causticlive │ │ └── model │ │ ├── IPadMap.java │ │ ├── IPadMapModel.java │ │ ├── IChannelModel.java │ │ ├── ChannelModel.java │ │ ├── PadMapModel.java │ │ ├── IPadModel.java │ │ ├── PadMap.java │ │ ├── PadModel.java │ │ ├── PadData.java │ │ ├── PadChannel.java │ │ └── SongPlayer.java └── pom.xml ├── CausticLiveFX ├── .gitignore ├── src │ ├── main │ │ ├── resources │ │ │ ├── com │ │ │ │ └── teotigraphix │ │ │ │ │ └── causticlive │ │ │ │ │ ├── CausticLiveApplication.properties │ │ │ │ │ └── view │ │ │ │ │ ├── RootLayout.fxml │ │ │ │ │ ├── MainScreen.css │ │ │ │ │ ├── AssignmentScreen.fxml │ │ │ │ │ ├── MachineScreen.fxml │ │ │ │ │ └── MainScreeen.fxml │ │ │ ├── images │ │ │ │ ├── OrganAssign.png │ │ │ │ ├── BasslineAssign.png │ │ │ │ ├── BeatboxAssign.png │ │ │ │ ├── FMSynthAssign.png │ │ │ │ ├── ModularAssign.png │ │ │ │ ├── PCMSynthAssign.png │ │ │ │ ├── PadSynthAssign.png │ │ │ │ ├── SubSynthAssign.png │ │ │ │ ├── VocoderAssign.png │ │ │ │ ├── EightBitSynthAssign.png │ │ │ │ └── CausticLiveBackground.png │ │ │ └── main.css │ │ └── java │ │ │ └── com │ │ │ └── teotigraphix │ │ │ └── causticlive │ │ │ ├── screen │ │ │ ├── MachineScreenView.java │ │ │ ├── AssignmentScreenView.java │ │ │ └── MainScreenView.java │ │ │ ├── utils │ │ │ └── ImageUtils.java │ │ │ ├── mediator │ │ │ ├── main │ │ │ │ ├── TransportMediator.java │ │ │ │ ├── FunctionGroupMediator.java │ │ │ │ ├── BankMediator.java │ │ │ │ ├── ToolBarMediator.java │ │ │ │ └── PadMediator.java │ │ │ ├── ApplicationMediator.java │ │ │ ├── SongMediator.java │ │ │ ├── assignment │ │ │ │ └── AssignmentControlsMediator.java │ │ │ └── machine │ │ │ │ └── MachineScreenMediator.java │ │ │ ├── config │ │ │ ├── ApplicationConstants.java │ │ │ └── ApplicationModule.java │ │ │ ├── model │ │ │ ├── ISoundModel.java │ │ │ └── SoundModel.java │ │ │ └── CausticLiveApplication.java │ └── test │ │ ├── java │ │ └── com │ │ │ └── teotigraphix │ │ │ └── causticlive │ │ │ └── model │ │ │ ├── PULSAR.caustic │ │ │ ├── MockPadMapModel.java │ │ │ ├── PadDataTest.java │ │ │ └── SongPlayerTest.java │ │ └── resources │ │ └── libraries │ │ └── PadDataTest │ │ ├── presets │ │ ├── 31bcb5eb-eaee-49ae-9f7e-1ce573641f61.bassline │ │ ├── 45d5350a-e991-47a4-a2c6-bd7a0971a5d8.subsynth │ │ ├── 4f895eae-cb32-4724-b1e5-8a25c279ece0.subsynth │ │ ├── 7bf3dcc6-a4f9-46f3-b31a-74aa53908c4f.pcmsynth │ │ ├── 94261228-9ba7-49cd-ac60-c1796ee84277.subsynth │ │ └── f9020c9b-2a05-4965-8bb3-99983a1cc174.beatbox │ │ └── library.ctk ├── build.fxbuild └── pom.xml ├── README.md ├── CausticLiveGDX-android ├── assets │ ├── game.png │ ├── data │ │ └── libgdx.png │ ├── images │ │ └── splash.png │ └── game.atlas ├── res │ ├── drawable-hdpi │ │ └── ic_launcher.png │ ├── drawable-ldpi │ │ └── ic_launcher.png │ ├── drawable-mdpi │ │ └── ic_launcher.png │ ├── values │ │ └── strings.xml │ └── layout │ │ └── main.xml ├── project.properties ├── AndroidManifest.xml ├── proguard.cfg └── src │ └── com │ └── teotigraphix │ └── causticlive │ └── MainActivity.java ├── CausticLiveGDX └── src │ ├── CausticLiveApp.gwt.xml │ └── com │ └── teotigraphix │ └── causticlive │ ├── CausticLiveApp.java │ ├── application │ └── ApplicationMediator.java │ ├── screen │ └── SplashScreen.java │ └── config │ └── CausticLiveModule.java ├── .gitignore └── CausticLiveGDX-desktop └── src └── com └── teotigraphix └── causticlive └── Main.java /CausticLiveCore/.gitignore: -------------------------------------------------------------------------------- 1 | /target 2 | -------------------------------------------------------------------------------- /CausticLiveFX/.gitignore: -------------------------------------------------------------------------------- 1 | /target 2 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | CausticLive 2 | =========== 3 | 4 | A Live mixing application for the Caustic Rack Android music/sequencer application -------------------------------------------------------------------------------- /CausticLiveGDX-android/assets/game.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/teotigraphix/CausticLive/HEAD/CausticLiveGDX-android/assets/game.png -------------------------------------------------------------------------------- /CausticLiveFX/src/main/resources/com/teotigraphix/causticlive/CausticLiveApplication.properties: -------------------------------------------------------------------------------- 1 | APP_TITLE = Caustic Live 2 | APP_DIRECTORY = CausticLive -------------------------------------------------------------------------------- /CausticLiveGDX-android/assets/data/libgdx.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/teotigraphix/CausticLive/HEAD/CausticLiveGDX-android/assets/data/libgdx.png -------------------------------------------------------------------------------- /CausticLiveGDX-android/assets/images/splash.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/teotigraphix/CausticLive/HEAD/CausticLiveGDX-android/assets/images/splash.png -------------------------------------------------------------------------------- /CausticLiveFX/src/main/resources/images/OrganAssign.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/teotigraphix/CausticLive/HEAD/CausticLiveFX/src/main/resources/images/OrganAssign.png -------------------------------------------------------------------------------- /CausticLiveGDX-android/res/drawable-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/teotigraphix/CausticLive/HEAD/CausticLiveGDX-android/res/drawable-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /CausticLiveGDX-android/res/drawable-ldpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/teotigraphix/CausticLive/HEAD/CausticLiveGDX-android/res/drawable-ldpi/ic_launcher.png -------------------------------------------------------------------------------- /CausticLiveGDX-android/res/drawable-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/teotigraphix/CausticLive/HEAD/CausticLiveGDX-android/res/drawable-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /CausticLiveGDX-android/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | My LibGDX Game 4 | -------------------------------------------------------------------------------- /CausticLiveFX/src/main/resources/images/BasslineAssign.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/teotigraphix/CausticLive/HEAD/CausticLiveFX/src/main/resources/images/BasslineAssign.png -------------------------------------------------------------------------------- /CausticLiveFX/src/main/resources/images/BeatboxAssign.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/teotigraphix/CausticLive/HEAD/CausticLiveFX/src/main/resources/images/BeatboxAssign.png -------------------------------------------------------------------------------- /CausticLiveFX/src/main/resources/images/FMSynthAssign.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/teotigraphix/CausticLive/HEAD/CausticLiveFX/src/main/resources/images/FMSynthAssign.png -------------------------------------------------------------------------------- /CausticLiveFX/src/main/resources/images/ModularAssign.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/teotigraphix/CausticLive/HEAD/CausticLiveFX/src/main/resources/images/ModularAssign.png -------------------------------------------------------------------------------- /CausticLiveFX/src/main/resources/images/PCMSynthAssign.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/teotigraphix/CausticLive/HEAD/CausticLiveFX/src/main/resources/images/PCMSynthAssign.png -------------------------------------------------------------------------------- /CausticLiveFX/src/main/resources/images/PadSynthAssign.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/teotigraphix/CausticLive/HEAD/CausticLiveFX/src/main/resources/images/PadSynthAssign.png -------------------------------------------------------------------------------- /CausticLiveFX/src/main/resources/images/SubSynthAssign.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/teotigraphix/CausticLive/HEAD/CausticLiveFX/src/main/resources/images/SubSynthAssign.png -------------------------------------------------------------------------------- /CausticLiveFX/src/main/resources/images/VocoderAssign.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/teotigraphix/CausticLive/HEAD/CausticLiveFX/src/main/resources/images/VocoderAssign.png -------------------------------------------------------------------------------- /CausticLiveFX/src/main/resources/images/EightBitSynthAssign.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/teotigraphix/CausticLive/HEAD/CausticLiveFX/src/main/resources/images/EightBitSynthAssign.png -------------------------------------------------------------------------------- /CausticLiveFX/src/main/resources/images/CausticLiveBackground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/teotigraphix/CausticLive/HEAD/CausticLiveFX/src/main/resources/images/CausticLiveBackground.png -------------------------------------------------------------------------------- /CausticLiveFX/src/test/java/com/teotigraphix/causticlive/model/PULSAR.caustic: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/teotigraphix/CausticLive/HEAD/CausticLiveFX/src/test/java/com/teotigraphix/causticlive/model/PULSAR.caustic -------------------------------------------------------------------------------- /CausticLiveFX/src/main/resources/com/teotigraphix/causticlive/view/RootLayout.fxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /CausticLiveGDX-android/assets/game.atlas: -------------------------------------------------------------------------------- 1 | 2 | game.png 3 | format: RGBA8888 4 | filter: Nearest,Nearest 5 | repeat: none 6 | splash 7 | rotate: false 8 | xy: 2, 2 9 | size: 1200, 752 10 | orig: 1200, 752 11 | offset: 0, 0 12 | index: -1 13 | -------------------------------------------------------------------------------- /CausticLiveFX/src/test/resources/libraries/PadDataTest/presets/31bcb5eb-eaee-49ae-9f7e-1ce573641f61.bassline: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/teotigraphix/CausticLive/HEAD/CausticLiveFX/src/test/resources/libraries/PadDataTest/presets/31bcb5eb-eaee-49ae-9f7e-1ce573641f61.bassline -------------------------------------------------------------------------------- /CausticLiveFX/src/test/resources/libraries/PadDataTest/presets/45d5350a-e991-47a4-a2c6-bd7a0971a5d8.subsynth: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/teotigraphix/CausticLive/HEAD/CausticLiveFX/src/test/resources/libraries/PadDataTest/presets/45d5350a-e991-47a4-a2c6-bd7a0971a5d8.subsynth -------------------------------------------------------------------------------- /CausticLiveFX/src/test/resources/libraries/PadDataTest/presets/4f895eae-cb32-4724-b1e5-8a25c279ece0.subsynth: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/teotigraphix/CausticLive/HEAD/CausticLiveFX/src/test/resources/libraries/PadDataTest/presets/4f895eae-cb32-4724-b1e5-8a25c279ece0.subsynth -------------------------------------------------------------------------------- /CausticLiveFX/src/test/resources/libraries/PadDataTest/presets/7bf3dcc6-a4f9-46f3-b31a-74aa53908c4f.pcmsynth: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/teotigraphix/CausticLive/HEAD/CausticLiveFX/src/test/resources/libraries/PadDataTest/presets/7bf3dcc6-a4f9-46f3-b31a-74aa53908c4f.pcmsynth -------------------------------------------------------------------------------- /CausticLiveFX/src/test/resources/libraries/PadDataTest/presets/94261228-9ba7-49cd-ac60-c1796ee84277.subsynth: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/teotigraphix/CausticLive/HEAD/CausticLiveFX/src/test/resources/libraries/PadDataTest/presets/94261228-9ba7-49cd-ac60-c1796ee84277.subsynth -------------------------------------------------------------------------------- /CausticLiveFX/src/test/resources/libraries/PadDataTest/presets/f9020c9b-2a05-4965-8bb3-99983a1cc174.beatbox: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/teotigraphix/CausticLive/HEAD/CausticLiveFX/src/test/resources/libraries/PadDataTest/presets/f9020c9b-2a05-4965-8bb3-99983a1cc174.beatbox -------------------------------------------------------------------------------- /CausticLiveCore/src/main/java/com/teotigraphix/causticlive/model/IPadMap.java: -------------------------------------------------------------------------------- 1 | package com.teotigraphix.causticlive.model; 2 | 3 | import java.util.List; 4 | 5 | public interface IPadMap { 6 | 7 | PadData getPad(int bank, int localIndex); 8 | 9 | List getPads(int bank); 10 | } 11 | -------------------------------------------------------------------------------- /CausticLiveGDX-android/res/layout/main.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | -------------------------------------------------------------------------------- /CausticLiveGDX/src/CausticLiveApp.gwt.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /CausticLiveCore/src/main/java/com/teotigraphix/causticlive/model/IPadMapModel.java: -------------------------------------------------------------------------------- 1 | 2 | package com.teotigraphix.causticlive.model; 3 | 4 | import java.util.Collection; 5 | 6 | import com.teotigraphix.caustic.model.ICaustkModel; 7 | 8 | public interface IPadMapModel extends ICaustkModel, IPadMap { 9 | 10 | Collection getPads(); 11 | 12 | } 13 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # built application files 2 | *.apk 3 | *.ap_ 4 | 5 | # files for the dex VM 6 | *.dex 7 | 8 | # Java class files 9 | *.class 10 | 11 | # generated files 12 | bin/ 13 | gen/ 14 | 15 | # Local configuration file (sdk path, etc) 16 | local.properties 17 | 18 | # Eclipse project files 19 | .classpath 20 | .project 21 | .settings/ 22 | 23 | unit_test/ 24 | libs/ 25 | CausticCore.dll 26 | CausticCore.lib 27 | fmodex.dll 28 | 29 | build/ -------------------------------------------------------------------------------- /CausticLiveGDX-android/project.properties: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by Android Tools. 2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED! 3 | # 4 | # This file must be checked in Version Control Systems. 5 | # 6 | # To customize properties used by the Ant build system use, 7 | # "ant.properties", and override values to adapt the script to your 8 | # project structure. 9 | 10 | # Project target. 11 | target=android-18 12 | android.library.reference.1=../../CausticSDK/CausticAndroid 13 | -------------------------------------------------------------------------------- /CausticLiveFX/build.fxbuild: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /CausticLiveGDX/src/com/teotigraphix/causticlive/CausticLiveApp.java: -------------------------------------------------------------------------------- 1 | 2 | package com.teotigraphix.causticlive; 3 | 4 | import com.teotigraphix.causticlive.screen.SplashScreen; 5 | import com.teotigraphix.caustk.sound.ISoundGenerator; 6 | import com.teotigraphix.libgdx.application.GDXGame; 7 | 8 | public class CausticLiveApp extends GDXGame { 9 | 10 | public CausticLiveApp(ISoundGenerator generator) { 11 | super(generator); 12 | } 13 | 14 | @Override 15 | public void create() { 16 | setScreen(new SplashScreen()); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /CausticLiveGDX/src/com/teotigraphix/causticlive/application/ApplicationMediator.java: -------------------------------------------------------------------------------- 1 | 2 | package com.teotigraphix.causticlive.application; 3 | 4 | import com.google.inject.Singleton; 5 | import com.teotigraphix.libgdx.application.IApplicationMediator; 6 | import com.teotigraphix.libgdx.screen.IScreen; 7 | 8 | @Singleton 9 | public class ApplicationMediator implements IApplicationMediator { 10 | 11 | public ApplicationMediator() { 12 | } 13 | 14 | @Override 15 | public void onRegisterObservers() { 16 | } 17 | 18 | @Override 19 | public void onRegister() { 20 | } 21 | 22 | @Override 23 | public void dispose() { 24 | } 25 | 26 | @Override 27 | public void create(IScreen screen) { 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /CausticLiveFX/src/test/java/com/teotigraphix/causticlive/model/MockPadMapModel.java: -------------------------------------------------------------------------------- 1 | 2 | package com.teotigraphix.causticlive.model; 3 | 4 | import java.util.List; 5 | 6 | import com.teotigraphix.caustk.controller.ICaustkController; 7 | 8 | public class MockPadMapModel implements IPadMap { 9 | 10 | private PadMap map; 11 | 12 | public MockPadMapModel(ICaustkController controller, int banks, int patterns) { 13 | map = new PadMap(controller); 14 | map.initialize(banks, patterns); 15 | } 16 | 17 | @Override 18 | public PadData getPad(int bank, int localIndex) { 19 | return map.getPad(bank, localIndex); 20 | } 21 | 22 | @Override 23 | public List getPads(int bank) { 24 | return map.getPads(bank); 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /CausticLiveFX/src/main/java/com/teotigraphix/causticlive/screen/MachineScreenView.java: -------------------------------------------------------------------------------- 1 | 2 | package com.teotigraphix.causticlive.screen; 3 | 4 | import javafx.scene.layout.Pane; 5 | 6 | import com.google.inject.Inject; 7 | import com.google.inject.Singleton; 8 | import com.teotigraphix.caustic.screen.DesktopScreenView; 9 | import com.teotigraphix.causticlive.config.ApplicationConstants; 10 | import com.teotigraphix.causticlive.mediator.machine.MachineScreenMediator; 11 | 12 | @Singleton 13 | public class MachineScreenView extends DesktopScreenView { 14 | 15 | @Inject 16 | MachineScreenMediator machineScreenMediator; 17 | 18 | @Override 19 | protected String getResource() { 20 | return ApplicationConstants.SCREEN_MACHINE_VIEW; 21 | } 22 | 23 | @Override 24 | public void create(Pane root) { 25 | root.setVisible(false); 26 | machineScreenMediator.create(root); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /CausticLiveGDX-android/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 12 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /CausticLiveFX/src/main/java/com/teotigraphix/causticlive/screen/AssignmentScreenView.java: -------------------------------------------------------------------------------- 1 | package com.teotigraphix.causticlive.screen; 2 | 3 | import javafx.scene.layout.Pane; 4 | 5 | import com.google.inject.Inject; 6 | import com.teotigraphix.caustic.screen.DesktopScreenView; 7 | import com.teotigraphix.caustic.screen.IScreenView; 8 | import com.teotigraphix.causticlive.config.ApplicationConstants; 9 | import com.teotigraphix.causticlive.mediator.assignment.AssignmentControlsMediator; 10 | 11 | public class AssignmentScreenView extends DesktopScreenView implements IScreenView { 12 | 13 | @Inject 14 | AssignmentControlsMediator assignmentControlsMediator; 15 | 16 | public AssignmentScreenView() { 17 | } 18 | 19 | @Override 20 | protected String getResource() { 21 | return ApplicationConstants.SCREEN_ASSIGNMENT_VIEW; 22 | } 23 | 24 | @Override 25 | public void create(Pane root) { 26 | root.setVisible(false); 27 | assignmentControlsMediator.create(root); 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /CausticLiveFX/src/main/java/com/teotigraphix/causticlive/utils/ImageUtils.java: -------------------------------------------------------------------------------- 1 | 2 | package com.teotigraphix.causticlive.utils; 3 | 4 | import javafx.scene.control.ContentDisplay; 5 | import javafx.scene.control.ToggleButton; 6 | import javafx.scene.image.Image; 7 | import javafx.scene.image.ImageView; 8 | 9 | import com.teotigraphix.caustk.tone.Tone; 10 | 11 | public final class ImageUtils { 12 | 13 | public static void assignMachineIcon(Tone tone, ToggleButton button) { 14 | final ImageView imageView = new ImageView(getMachineImage(tone)); 15 | imageView.setFitWidth(100); 16 | imageView.setFitHeight(70); 17 | button.setGraphic(imageView); 18 | button.setContentDisplay(ContentDisplay.TOP); 19 | } 20 | 21 | public static Image getMachineImage(Tone tone) { 22 | String name = tone.getToneType().name(); 23 | Image result = new Image(ImageUtils.class.getClass().getResourceAsStream( 24 | "/images/" + name + "Assign.png")); 25 | return result; 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /CausticLiveFX/src/main/resources/main.css: -------------------------------------------------------------------------------- 1 | .root { 2 | /* A bright blue for highlighting/accenting objects. For example: selected 3 | * text; selected items in menus, lists, trees, and tables; progress bars; 4 | * default buttons. 5 | */ 6 | -fx-accent: #4F7620; 7 | 8 | /* A bright blue for the focus indicator of objects. Typically used as the 9 | * first color in -fx-background-color for the "focused" pseudo-class. Also 10 | * typically used with insets of -1.4 to provide a glowing effect. 11 | * 12 | * TODO: should this be derived from -fx-accent? 13 | */ 14 | -fx-focus-color: #4F7620; 15 | } 16 | 17 | .machine-button { 18 | -fx-background-color: transparent, transparent, transparent, transparent; 19 | -fx-background-radius: 10.0px; 20 | -fx-border-color: white; 21 | -fx-border-radius: 10.0px; 22 | -fx-text-fill: white; 23 | -fx-padding: 4px 2px 4px 2px 24 | } 25 | .machine-button:selected { 26 | -fx-effect: dropshadow( three-pass-box , #3F922C , 5 , 0.8 , 0 , 0 ); 27 | -fx-border-radius: 10px; 28 | } -------------------------------------------------------------------------------- /CausticLiveFX/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | CausticLiveFX 4 | CausticLiveFX 5 | 0.0.1-SNAPSHOT 6 | 7 | src 8 | 9 | 10 | maven-compiler-plugin 11 | 2.3.2 12 | 13 | 1.7 14 | 1.7 15 | 16 | 17 | 18 | 19 | 20 | 21 | CausticLiveCore 22 | CausticLiveCore 23 | 0.0.1-SNAPSHOT 24 | 25 | 26 | CausticFX 27 | CausticFX 28 | 0.0.1-SNAPSHOT 29 | 30 | 31 | -------------------------------------------------------------------------------- /CausticLiveCore/src/main/java/com/teotigraphix/causticlive/model/IChannelModel.java: -------------------------------------------------------------------------------- 1 | 2 | package com.teotigraphix.causticlive.model; 3 | 4 | import java.util.List; 5 | 6 | import com.teotigraphix.caustic.model.ICaustkModel; 7 | import com.teotigraphix.caustk.library.LibraryPhrase; 8 | 9 | public interface IChannelModel extends ICaustkModel { 10 | 11 | /** 12 | * Returns all the {@link PadChannel}s in view for the 13 | * {@link IPadModel#getSelectedData()}. 14 | */ 15 | List getChannleView(); 16 | 17 | /** 18 | * @param value 19 | * @see OnChannelModelSelectedChannelChange 20 | */ 21 | void setSelectedChannel(PadChannel value); 22 | 23 | PadChannel getSelectedChannel(); 24 | 25 | public static class OnChannelModelSelectedChannelChange { 26 | 27 | private PadChannel channel; 28 | 29 | public final PadChannel getChannel() { 30 | return channel; 31 | } 32 | 33 | public OnChannelModelSelectedChannelChange(PadChannel channel) { 34 | this.channel = channel; 35 | } 36 | } 37 | 38 | boolean assignPhrase(PadChannel channel, LibraryPhrase phrase); 39 | } 40 | -------------------------------------------------------------------------------- /CausticLiveGDX/src/com/teotigraphix/causticlive/screen/SplashScreen.java: -------------------------------------------------------------------------------- 1 | 2 | package com.teotigraphix.causticlive.screen; 3 | 4 | import com.badlogic.gdx.graphics.g2d.TextureAtlas.AtlasRegion; 5 | import com.badlogic.gdx.scenes.scene2d.ui.Image; 6 | import com.badlogic.gdx.scenes.scene2d.utils.Drawable; 7 | import com.badlogic.gdx.scenes.scene2d.utils.TextureRegionDrawable; 8 | import com.badlogic.gdx.utils.Scaling; 9 | import com.teotigraphix.libgdx.screen.ScreenBase; 10 | 11 | public class SplashScreen extends ScreenBase { 12 | 13 | private Image splashImage; 14 | 15 | public SplashScreen() { 16 | } 17 | 18 | @Override 19 | public void show() { 20 | super.show(); 21 | 22 | AtlasRegion splashRegion = getAtlas().findRegion("splash"); 23 | Drawable splashDrawable = new TextureRegionDrawable(splashRegion); 24 | 25 | // here we create the splash image actor; its size is set when the 26 | // resize() method gets called 27 | splashImage = new Image(splashDrawable, Scaling.stretch); 28 | splashImage.setFillParent(true); 29 | //splashImage.getColor().a = 0f; 30 | 31 | stage.addActor(splashImage); 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /CausticLiveCore/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | CausticLiveCore 4 | CausticLiveCore 5 | 0.0.1-SNAPSHOT 6 | 7 | src 8 | 9 | 10 | maven-compiler-plugin 11 | 2.3.2 12 | 13 | 1.7 14 | 1.7 15 | 16 | 17 | 18 | 19 | 20 | 21 | CausticToolkit 22 | CausticToolkit 23 | 0.0.1-SNAPSHOT 24 | 25 | 26 | CausticRuntime 27 | CausticRuntime 28 | 0.0.1-SNAPSHOT 29 | 30 | 31 | junit 32 | junit 33 | 4.11 34 | 35 | 36 | -------------------------------------------------------------------------------- /CausticLiveGDX-android/proguard.cfg: -------------------------------------------------------------------------------- 1 | -optimizationpasses 5 2 | -dontusemixedcaseclassnames 3 | -dontskipnonpubliclibraryclasses 4 | -dontpreverify 5 | -verbose 6 | -optimizations !code/simplification/arithmetic,!field/*,!class/merging/* 7 | 8 | -keep public class * extends android.app.Activity 9 | -keep public class * extends android.app.Application 10 | -keep public class * extends android.app.Service 11 | -keep public class * extends android.content.BroadcastReceiver 12 | -keep public class * extends android.content.ContentProvider 13 | -keep public class * extends android.app.backup.BackupAgentHelper 14 | -keep public class * extends android.preference.Preference 15 | -keep public class com.android.vending.licensing.ILicensingService 16 | 17 | -keepclasseswithmembernames class * { 18 | native ; 19 | } 20 | 21 | -keepclasseswithmembers class * { 22 | public (android.content.Context, android.util.AttributeSet); 23 | } 24 | 25 | -keepclasseswithmembers class * { 26 | public (android.content.Context, android.util.AttributeSet, int); 27 | } 28 | 29 | -keepclassmembers class * extends android.app.Activity { 30 | public void *(android.view.View); 31 | } 32 | 33 | -keepclassmembers enum * { 34 | public static **[] values(); 35 | public static ** valueOf(java.lang.String); 36 | } 37 | 38 | -keep class * implements android.os.Parcelable { 39 | public static final android.os.Parcelable$Creator *; 40 | } 41 | -------------------------------------------------------------------------------- /CausticLiveGDX-desktop/src/com/teotigraphix/causticlive/Main.java: -------------------------------------------------------------------------------- 1 | 2 | package com.teotigraphix.causticlive; 3 | 4 | import com.badlogic.gdx.backends.lwjgl.LwjglApplication; 5 | import com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration; 6 | import com.badlogic.gdx.tools.imagepacker.TexturePacker2.Settings; 7 | import com.teotigraphix.causticlive.config.CausticLiveModule; 8 | import com.teotigraphix.caustk.sound.DesktopSoundGenerator; 9 | 10 | public class Main { 11 | public static void main(String[] args) { 12 | LwjglApplicationConfiguration cfg = new LwjglApplicationConfiguration(); 13 | cfg.title = "Caustic Live"; 14 | cfg.useGL20 = false; 15 | cfg.width = 1200; 16 | cfg.height = 752; 17 | cfg.resizable = false; 18 | 19 | Settings settings = new Settings(); 20 | settings.maxWidth = 2048; 21 | settings.maxHeight = 2048; 22 | // TexturePacker2.process(settings, new File( 23 | // "C:/Users/Work/Documents/git/CausticLive/CausticLiveGDX-android/assets/images") 24 | // .getPath(), "../CausticLiveGDX-android/assets", "game"); 25 | 26 | try { 27 | Thread.sleep(500); 28 | } catch (InterruptedException e) { 29 | e.printStackTrace(); 30 | } 31 | 32 | CausticLiveApp listener = new CausticLiveApp(new DesktopSoundGenerator()); 33 | new LwjglApplication(listener, cfg); 34 | listener.initialize(new CausticLiveModule()); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /CausticLiveFX/src/main/java/com/teotigraphix/causticlive/screen/MainScreenView.java: -------------------------------------------------------------------------------- 1 | 2 | package com.teotigraphix.causticlive.screen; 3 | 4 | import javafx.scene.layout.Pane; 5 | 6 | import com.google.inject.Inject; 7 | import com.google.inject.Singleton; 8 | import com.teotigraphix.caustic.screen.DesktopScreenView; 9 | import com.teotigraphix.caustic.screen.IScreenView; 10 | import com.teotigraphix.causticlive.config.ApplicationConstants; 11 | import com.teotigraphix.causticlive.mediator.main.BankMediator; 12 | import com.teotigraphix.causticlive.mediator.main.FunctionGroupMediator; 13 | import com.teotigraphix.causticlive.mediator.main.PadMediator; 14 | import com.teotigraphix.causticlive.mediator.main.ToolBarMediator; 15 | import com.teotigraphix.causticlive.mediator.main.TransportMediator; 16 | 17 | @Singleton 18 | public class MainScreenView extends DesktopScreenView implements IScreenView { 19 | 20 | @Inject 21 | ToolBarMediator toolBarMediator; 22 | 23 | @Inject 24 | FunctionGroupMediator functionGroupMediator; 25 | 26 | @Inject 27 | PadMediator padMediator; 28 | 29 | @Inject 30 | BankMediator bankMediator; 31 | 32 | @Inject 33 | TransportMediator transportMediator; 34 | 35 | @Override 36 | protected String getResource() { 37 | return ApplicationConstants.SCREEN_MAIN_VIEW; 38 | } 39 | 40 | @Override 41 | public void create(Pane root) { 42 | toolBarMediator.create(root); 43 | functionGroupMediator.create(root); 44 | padMediator.create(root); 45 | bankMediator.create(root); 46 | transportMediator.create(root); 47 | } 48 | 49 | } 50 | -------------------------------------------------------------------------------- /CausticLiveFX/src/main/java/com/teotigraphix/causticlive/mediator/main/TransportMediator.java: -------------------------------------------------------------------------------- 1 | 2 | package com.teotigraphix.causticlive.mediator.main; 3 | 4 | import javafx.beans.value.ChangeListener; 5 | import javafx.beans.value.ObservableValue; 6 | import javafx.scene.control.ToggleButton; 7 | import javafx.scene.layout.Pane; 8 | 9 | import com.google.inject.Inject; 10 | import com.teotigraphix.caustic.mediator.DesktopMediatorBase; 11 | import com.teotigraphix.causticlive.model.ISoundModel; 12 | import com.teotigraphix.caustk.core.CausticException; 13 | 14 | public class TransportMediator extends DesktopMediatorBase { 15 | 16 | private ToggleButton playPauseButton; 17 | 18 | @Inject 19 | ISoundModel soundModel; 20 | 21 | public TransportMediator() { 22 | } 23 | 24 | @Override 25 | public void create(Pane root) { 26 | playPauseButton = (ToggleButton)root.lookup("#playPauseButton"); 27 | playPauseButton.selectedProperty().addListener(new ChangeListener() { 28 | @Override 29 | public void changed(ObservableValue observable, Boolean oldValue, 30 | Boolean newValue) { 31 | onPlayPuseSelected(); 32 | } 33 | }); 34 | } 35 | 36 | protected void onPlayPuseSelected() { 37 | if (playPauseButton.isSelected()) { 38 | try { 39 | soundModel.play(); 40 | } catch (CausticException e) { 41 | e.printStackTrace(); 42 | } 43 | } else { 44 | soundModel.stop(); 45 | } 46 | } 47 | 48 | @Override 49 | public void onRegister() { 50 | } 51 | 52 | } 53 | -------------------------------------------------------------------------------- /CausticLiveFX/src/main/resources/com/teotigraphix/causticlive/view/MainScreen.css: -------------------------------------------------------------------------------- 1 | 2 | .list-cell:filled:selected:focused, .list-cell:filled:selected { 3 | -fx-background-color: linear-gradient(#4F7620 0%, #4F7620 100%); 4 | -fx-text-fill: white; 5 | } 6 | 7 | /** 8 | * ------------------------------------- 9 | * ToggleButton 10 | * ------------------------------------- 11 | */ 12 | /* -fx-shadow-highlight-color, -fx-outer-border, -fx-inner-border, -fx-body-color; */ 13 | .pad-button { 14 | -fx-background-radius: 4px; 15 | -fx-background-color: transparent, transparent, transparent, transparent; 16 | -fx-border-color: white; 17 | -fx-border-radius: 4px; 18 | } 19 | 20 | /* 21 | * dropdhadow: blur-type, shadow-color, radius, spread, offx, offy 22 | * blur-type - gaussian | one-pass-box | three-pass-box | two-pass-box 23 | */ 24 | .pad-button:selected { 25 | -fx-effect: dropshadow( three-pass-box , #6A962F , 5 , 0.8 , 0 , 0 ); 26 | -fx-border-radius: 4px; 27 | } 28 | 29 | /** 30 | * ------------------------------------- 31 | * bank-button 32 | * ------------------------------------- 33 | */ 34 | 35 | /* -fx-shadow-highlight-color, -fx-outer-border, -fx-inner-border, -fx-body-color; */ 36 | .bank-button { 37 | -fx-background-radius: 4px; 38 | -fx-background-color: transparent, transparent, transparent, transparent; 39 | -fx-border-color: white; 40 | -fx-border-radius: 4px; 41 | } 42 | 43 | /* 44 | * dropdhadow: blur-type, shadow-color, radius, spread, offx, offy 45 | * blur-type - gaussian | one-pass-box | three-pass-box | two-pass-box 46 | */ 47 | .bank-button:selected { 48 | -fx-effect: dropshadow( three-pass-box , #6A962F , 5 , 0.8 , 0 , 0 ); 49 | -fx-border-radius: 4px; 50 | } 51 | -------------------------------------------------------------------------------- /CausticLiveGDX-android/src/com/teotigraphix/causticlive/MainActivity.java: -------------------------------------------------------------------------------- 1 | 2 | package com.teotigraphix.causticlive; 3 | 4 | import android.os.Bundle; 5 | 6 | import com.badlogic.gdx.backends.android.AndroidApplication; 7 | import com.badlogic.gdx.backends.android.AndroidApplicationConfiguration; 8 | import com.teotigraphix.causitc.sound.AndroidSoundGenerator; 9 | import com.teotigraphix.causticlive.config.CausticLiveModule; 10 | import com.teotigraphix.caustk.controller.ICaustkController; 11 | 12 | public class MainActivity extends AndroidApplication { 13 | 14 | ICaustkController controller; 15 | 16 | @Override 17 | public void onCreate(Bundle savedInstanceState) { 18 | super.onCreate(savedInstanceState); 19 | 20 | AndroidApplicationConfiguration cfg = new AndroidApplicationConfiguration(); 21 | cfg.useGL20 = false; 22 | 23 | CausticLiveApp listener = new CausticLiveApp(new AndroidSoundGenerator()); 24 | initialize(listener, cfg); 25 | listener.initialize(new CausticLiveModule()); 26 | controller = listener.getController(); 27 | } 28 | 29 | @Override 30 | protected void onStart() { 31 | controller.onStart(); 32 | super.onStart(); 33 | } 34 | 35 | @Override 36 | protected void onResume() { 37 | controller.onResume(); 38 | super.onResume(); 39 | } 40 | 41 | @Override 42 | protected void onPause() { 43 | controller.onPause(); 44 | super.onPause(); 45 | } 46 | 47 | @Override 48 | protected void onStop() { 49 | controller.onStop(); 50 | super.onStop(); 51 | } 52 | 53 | @Override 54 | protected void onDestroy() { 55 | controller.onDestroy(); 56 | super.onDestroy(); 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /CausticLiveFX/src/main/java/com/teotigraphix/causticlive/config/ApplicationConstants.java: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////////////////////////// 2 | // Copyright 2013 Michael Schmalle - Teoti Graphix, LLC 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License 15 | // 16 | // Author: Michael Schmalle, Principal Architect 17 | // mschmalle at teotigraphix dot com 18 | //////////////////////////////////////////////////////////////////////////////// 19 | 20 | package com.teotigraphix.causticlive.config; 21 | 22 | public final class ApplicationConstants { 23 | 24 | public static final String SCREEN_MACHINE_VIEW = "/com/teotigraphix/causticlive/view/MachineScreen.fxml"; 25 | 26 | public static final String SCREEN_MAIN_VIEW = "/com/teotigraphix/causticlive/view/MainScreeen.fxml"; 27 | 28 | public static final String SCREEN_ASSIGNMENT_VIEW = "/com/teotigraphix/causticlive/view/AssignmentScreen.fxml"; 29 | 30 | public static final String PANE_ROOT = "/com/teotigraphix/causticlive/view/RootLayout.fxml"; 31 | 32 | public static final String IMAGE_BACKGROUND = "/images/CausticLiveBackground.png"; 33 | 34 | //public static final String ID_STOP_BUTTON = "stop-button"; 35 | 36 | //public static final String ID_PLAY_PAUSE_BUTTON = "play-pause-button"; 37 | } 38 | -------------------------------------------------------------------------------- /CausticLiveFX/src/main/java/com/teotigraphix/causticlive/model/ISoundModel.java: -------------------------------------------------------------------------------- 1 | 2 | package com.teotigraphix.causticlive.model; 3 | 4 | import java.io.File; 5 | 6 | import com.teotigraphix.caustic.model.ICaustkModel; 7 | import com.teotigraphix.causticlive.model.SoundModel.ToneData; 8 | import com.teotigraphix.caustk.core.CausticException; 9 | import com.teotigraphix.caustk.library.Library; 10 | import com.teotigraphix.caustk.library.LibraryPatch; 11 | import com.teotigraphix.caustk.library.LibraryScene; 12 | import com.teotigraphix.caustk.sequencer.TrackSong; 13 | 14 | public interface ISoundModel extends ICaustkModel { 15 | 16 | Library getLibrary(); 17 | 18 | void loadScene(LibraryScene libraryScene, boolean reset); 19 | 20 | int getSelectedTone(); 21 | 22 | ToneData getSelectedToneData(); 23 | 24 | void setSelectedTone(int value); 25 | 26 | boolean setPatch(ToneData data, LibraryPatch patch); 27 | 28 | public static class OnSoundModelLibraryImportComplete { 29 | 30 | } 31 | 32 | LibraryScene getLibraryScene(); 33 | 34 | void loadLibrary(File file); 35 | 36 | void play() throws CausticException; 37 | 38 | void queue(PadData data); 39 | 40 | void unqueue(PadData data); 41 | 42 | int getCurrentMeasure(); 43 | 44 | int getCurrentBeat(); 45 | 46 | TrackSong getSong(); 47 | 48 | void measureChange(int measure); 49 | 50 | void stop(); 51 | 52 | void beatChange(int measure, int beat); 53 | 54 | /** 55 | * Triggered every beat change after the model has been updated. 56 | */ 57 | public static class OnSoundModelRefresh { 58 | 59 | private int beat; 60 | 61 | public int getBeat() { 62 | return beat; 63 | } 64 | 65 | public OnSoundModelRefresh(int beat) { 66 | this.beat = beat; 67 | } 68 | 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /CausticLiveCore/src/main/java/com/teotigraphix/causticlive/model/ChannelModel.java: -------------------------------------------------------------------------------- 1 | 2 | package com.teotigraphix.causticlive.model; 3 | 4 | import java.util.List; 5 | 6 | import com.google.inject.Inject; 7 | import com.google.inject.Singleton; 8 | import com.teotigraphix.caustic.model.ICaustkModelState; 9 | import com.teotigraphix.caustic.model.ModelBase; 10 | import com.teotigraphix.caustk.controller.ICaustkController; 11 | import com.teotigraphix.caustk.library.LibraryPhrase; 12 | 13 | @Singleton 14 | public class ChannelModel extends ModelBase implements IChannelModel { 15 | 16 | @Inject 17 | IPadMapModel padMapModel; 18 | 19 | @Inject 20 | IPadModel padModel; 21 | 22 | private PadChannel selectedChannel; 23 | 24 | @Override 25 | public void setSelectedChannel(PadChannel value) { 26 | selectedChannel = value; 27 | trigger(new OnChannelModelSelectedChannelChange(selectedChannel)); 28 | } 29 | 30 | @Override 31 | public PadChannel getSelectedChannel() { 32 | return selectedChannel; 33 | } 34 | 35 | @Override 36 | public List getChannleView() { 37 | return padModel.getSelectedData().getChannels(); 38 | } 39 | 40 | public ChannelModel() { 41 | setStateFactory(ChannelModelState.class); 42 | } 43 | 44 | @Override 45 | public void onShow() { 46 | 47 | } 48 | 49 | @Override 50 | public void onRegister() { 51 | 52 | } 53 | 54 | @Override 55 | public boolean assignPhrase(PadChannel channel, LibraryPhrase phrase) { 56 | channel.assignPhrase(phrase); 57 | return true; 58 | } 59 | 60 | public static class ChannelModelState implements ICaustkModelState { 61 | 62 | public ChannelModelState() { 63 | } 64 | 65 | @Override 66 | public void sleep() { 67 | } 68 | 69 | @Override 70 | public void wakeup(ICaustkController controller) { 71 | } 72 | 73 | } 74 | 75 | } 76 | -------------------------------------------------------------------------------- /CausticLiveGDX/src/com/teotigraphix/causticlive/config/CausticLiveModule.java: -------------------------------------------------------------------------------- 1 | 2 | package com.teotigraphix.causticlive.config; 3 | 4 | import java.io.File; 5 | 6 | import com.google.inject.Singleton; 7 | import com.teotigraphix.causticlive.application.ApplicationMediator; 8 | import com.teotigraphix.caustk.application.CaustkConfigurationBase; 9 | import com.teotigraphix.caustk.application.ICaustkConfiguration; 10 | import com.teotigraphix.caustk.controller.ICaustkController; 11 | import com.teotigraphix.caustk.sound.ISoundGenerator; 12 | import com.teotigraphix.caustk.utils.RuntimeUtils; 13 | import com.teotigraphix.libgdx.application.IApplicationMediator; 14 | import com.teotigraphix.libgdx.config.CausticRuntimeModule; 15 | 16 | public class CausticLiveModule extends CausticRuntimeModule { 17 | 18 | @Override 19 | protected void configurePlatformRequirements() { 20 | bind(IApplicationMediator.class).to(ApplicationMediator.class).in(Singleton.class); 21 | } 22 | 23 | @Override 24 | protected void configureApplicationRequirements() { 25 | // Config 26 | bind(ICaustkConfiguration.class).to(ApplicationConfiguration.class).in(Singleton.class); 27 | 28 | } 29 | 30 | public static class ApplicationConfiguration extends CaustkConfigurationBase { 31 | 32 | private ISoundGenerator soundGenerator; 33 | 34 | @Override 35 | public void setSoundGenerator(ISoundGenerator soundGenerator) { 36 | this.soundGenerator = soundGenerator; 37 | } 38 | 39 | @Override 40 | public String getApplicationId() { 41 | return "causticlive"; 42 | } 43 | 44 | @Override 45 | public void setCausticStorage(File value) { 46 | super.setCausticStorage(value); 47 | RuntimeUtils.STORAGE_ROOT = value.getAbsolutePath(); 48 | } 49 | 50 | public ApplicationConfiguration() { 51 | } 52 | 53 | @Override 54 | public ISoundGenerator createSoundGenerator(ICaustkController controller) { 55 | return soundGenerator; 56 | } 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /CausticLiveCore/src/main/java/com/teotigraphix/causticlive/model/PadMapModel.java: -------------------------------------------------------------------------------- 1 | 2 | package com.teotigraphix.causticlive.model; 3 | 4 | import java.util.Collection; 5 | import java.util.List; 6 | 7 | import com.google.inject.Singleton; 8 | import com.teotigraphix.caustic.model.ICaustkModelState; 9 | import com.teotigraphix.caustic.model.ModelBase; 10 | import com.teotigraphix.caustk.controller.ICaustkController; 11 | 12 | @Singleton 13 | public class PadMapModel extends ModelBase implements IPadMapModel { 14 | 15 | @Override 16 | protected PadMapModelState getState() { 17 | return (PadMapModelState)super.getState(); 18 | } 19 | 20 | public PadMapModel() { 21 | setStateFactory(PadMapModelState.class); 22 | } 23 | 24 | @Override 25 | public void onShow() { 26 | } 27 | 28 | @Override 29 | public void onRegister() { 30 | } 31 | 32 | @Override 33 | protected void configState(ICaustkModelState state) { 34 | getState().initialize(getController(), 4, 16); 35 | } 36 | 37 | public PadData getPad(int bank, int localIndex) { 38 | return getState().padMap.getPad(bank, localIndex); 39 | } 40 | 41 | public List getPads(int bank) { 42 | return getState().padMap.getPads(bank); 43 | } 44 | 45 | public static class PadMapModelState implements ICaustkModelState { 46 | 47 | private PadMap padMap; 48 | 49 | PadMap getPadMap() { 50 | return padMap; 51 | } 52 | 53 | public void initialize(ICaustkController controller, int banks, int pads) { 54 | padMap = new PadMap(controller); 55 | padMap.initialize(banks, pads); 56 | } 57 | 58 | public PadMapModelState() { 59 | 60 | } 61 | 62 | @Override 63 | public void sleep() { 64 | } 65 | 66 | @Override 67 | public void wakeup(ICaustkController controller) { 68 | padMap.wakeup(controller); 69 | } 70 | } 71 | 72 | @Override 73 | public Collection getPads() { 74 | return getState().getPadMap().getPads(); 75 | } 76 | 77 | } 78 | -------------------------------------------------------------------------------- /CausticLiveFX/src/main/java/com/teotigraphix/causticlive/mediator/ApplicationMediator.java: -------------------------------------------------------------------------------- 1 | 2 | package com.teotigraphix.causticlive.mediator; 3 | 4 | import java.io.File; 5 | import java.io.IOException; 6 | 7 | import com.google.inject.Inject; 8 | import com.google.inject.Singleton; 9 | import com.teotigraphix.caustic.mediator.MediatorBase; 10 | import com.teotigraphix.causticlive.model.IPadMapModel; 11 | import com.teotigraphix.causticlive.model.ISoundModel; 12 | import com.teotigraphix.caustk.core.CtkDebug; 13 | import com.teotigraphix.caustk.project.Project; 14 | 15 | @Singleton 16 | public class ApplicationMediator extends MediatorBase { 17 | 18 | private Integer numStarts; 19 | 20 | @Inject 21 | ISoundModel soundModel; 22 | 23 | @Inject 24 | IPadMapModel padMapModel; 25 | 26 | public ApplicationMediator() { 27 | } 28 | 29 | @Override 30 | protected void onProjectLoad() { 31 | Project project = getController().getProjectManager().getProject(); 32 | numStarts = project.getInteger("numStarts"); 33 | if (numStarts == null) 34 | numStarts = 0; 35 | numStarts++; 36 | } 37 | 38 | @Override 39 | protected void onProjectCreate() { 40 | getController().getSoundSource().clearAndReset(); 41 | } 42 | 43 | @Override 44 | protected void onProjectSave() { 45 | saveCausticFile(); 46 | } 47 | 48 | private void saveCausticFile() { 49 | // save the project's caustic file 50 | Project project = getController().getProjectManager().getProject(); 51 | 52 | project.put("numStarts", numStarts); 53 | 54 | File file = getProjectSongFile(project); 55 | CtkDebug.view("ApplicationMediator saving " + file); 56 | try { 57 | getController().getSoundSource().saveSongAs(file); 58 | } catch (IOException e) { 59 | CtkDebug.err("Error saving .caustic file", e); 60 | } 61 | } 62 | 63 | public static File getProjectSongFile(Project project) { 64 | File file = project.getResource("songs/" + project.getName() + ".caustic"); 65 | return file; 66 | } 67 | 68 | @Override 69 | public void onRegister() { 70 | } 71 | 72 | } 73 | -------------------------------------------------------------------------------- /CausticLiveFX/src/main/java/com/teotigraphix/causticlive/CausticLiveApplication.java: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////////////////////////// 2 | // Copyright 2013 Michael Schmalle - Teoti Graphix, LLC 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License 15 | // 16 | // Author: Michael Schmalle, Principal Architect 17 | // mschmalle at teotigraphix dot com 18 | //////////////////////////////////////////////////////////////////////////////// 19 | 20 | package com.teotigraphix.causticlive; 21 | 22 | import java.util.List; 23 | 24 | import javafx.application.Application; 25 | 26 | import com.google.inject.Inject; 27 | import com.google.inject.Module; 28 | import com.teotigraphix.caustic.application.JavaFXApplication; 29 | import com.teotigraphix.caustic.screen.IScreenView; 30 | import com.teotigraphix.causticlive.config.ApplicationConstants; 31 | import com.teotigraphix.causticlive.config.ApplicationModule; 32 | import com.teotigraphix.causticlive.mediator.ApplicationMediator; 33 | import com.teotigraphix.causticlive.screen.AssignmentScreenView; 34 | import com.teotigraphix.causticlive.screen.MachineScreenView; 35 | import com.teotigraphix.causticlive.screen.MainScreenView; 36 | 37 | public class CausticLiveApplication extends JavaFXApplication { 38 | 39 | @Inject 40 | ApplicationMediator applicationMediator; 41 | 42 | @Override 43 | protected String getRootPane() { 44 | return ApplicationConstants.PANE_ROOT; 45 | } 46 | 47 | @Override 48 | protected void initScreens(List> screens) { 49 | screens.add(MainScreenView.class); 50 | screens.add(MachineScreenView.class); 51 | screens.add(AssignmentScreenView.class); 52 | } 53 | 54 | @Override 55 | public void init(List modules) throws Exception { 56 | super.init(modules); 57 | modules.add(new ApplicationModule()); 58 | } 59 | 60 | public static void main(String[] args) { 61 | Application.launch(args); 62 | } 63 | 64 | } 65 | -------------------------------------------------------------------------------- /CausticLiveFX/src/main/java/com/teotigraphix/causticlive/mediator/SongMediator.java: -------------------------------------------------------------------------------- 1 | 2 | package com.teotigraphix.causticlive.mediator; 3 | 4 | import org.androidtransfuse.event.EventObserver; 5 | 6 | import com.google.inject.Inject; 7 | import com.google.inject.Singleton; 8 | import com.teotigraphix.caustic.mediator.MediatorBase; 9 | import com.teotigraphix.causticlive.model.ISoundModel; 10 | import com.teotigraphix.caustk.sequencer.ISystemSequencer.OnSongSequencerBeatChange; 11 | import com.teotigraphix.caustk.sequencer.ISystemSequencer.OnSongSequencerMeasureChange; 12 | 13 | @Singleton 14 | public class SongMediator extends MediatorBase { 15 | 16 | @Inject 17 | ISoundModel soundModel; 18 | 19 | public SongMediator() { 20 | } 21 | 22 | @Override 23 | protected void registerObservers() { 24 | super.registerObservers(); 25 | 26 | getController().getDispatcher().register(OnSongSequencerMeasureChange.class, 27 | new EventObserver() { 28 | @Override 29 | public void trigger(OnSongSequencerMeasureChange object) { 30 | //CtkDebug.model("Measure:" + object.getMeasure()); 31 | //soundModel.getSong().nextMeasure(); 32 | soundModel.measureChange(object.getMeasure()); 33 | //CtkDebug.model("M:" + soundModel.getSong().getCurrentBeat()); 34 | } 35 | }); 36 | /* 37 | Beat:0 % 0 38 | Beat:0 % 1 39 | Beat:0 % 2 40 | Beat:0 % 3 41 | Beat:1 % 0 42 | Beat:1 % 1 43 | Beat:1 % 2 44 | Beat:1 % 3 45 | Beat:2 % 0 46 | Beat:0 % 0 47 | */ 48 | getController().getDispatcher().register(OnSongSequencerBeatChange.class, 49 | new EventObserver() { 50 | @Override 51 | public void trigger(OnSongSequencerBeatChange object) { 52 | int beat = object.getBeat(); 53 | int measure = beat / 4; 54 | int startMeasure = beat % 4; 55 | if (startMeasure == 0) { 56 | // new measure 57 | 58 | } else if (startMeasure == 3) { 59 | // one beat before changing measures 60 | // signal add crap, lock UI for patterns in their last beat 61 | // 1 measure, 3 beat, 2 measure 7 beat, 4 measure, 15 beat 8, 31 62 | } 63 | soundModel.beatChange(measure, beat); 64 | //CtkDebug.model("Beat:" + beat / 4 + " % " + (beat % 4)); 65 | } 66 | }); 67 | 68 | } 69 | 70 | @Override 71 | public void onRegister() { 72 | // TODO Auto-generated method stub 73 | 74 | } 75 | 76 | } 77 | -------------------------------------------------------------------------------- /CausticLiveFX/src/main/java/com/teotigraphix/causticlive/mediator/main/FunctionGroupMediator.java: -------------------------------------------------------------------------------- 1 | 2 | package com.teotigraphix.causticlive.mediator.main; 3 | 4 | import javafx.beans.value.ChangeListener; 5 | import javafx.beans.value.ObservableValue; 6 | import javafx.collections.ObservableList; 7 | import javafx.scene.Node; 8 | import javafx.scene.Parent; 9 | import javafx.scene.control.ToggleButton; 10 | import javafx.scene.layout.Pane; 11 | 12 | import org.androidtransfuse.event.EventObserver; 13 | 14 | import com.google.inject.Inject; 15 | import com.teotigraphix.caustic.mediator.DesktopMediatorBase; 16 | import com.teotigraphix.causticlive.model.IPadModel.OnPadModelSelectedFunctionChange; 17 | import com.teotigraphix.causticlive.model.IPadModel.PadFunction; 18 | import com.teotigraphix.causticlive.model.PadModel; 19 | 20 | public class FunctionGroupMediator extends DesktopMediatorBase { 21 | 22 | private ToggleButton patternButton; 23 | 24 | private ToggleButton assignButton; 25 | 26 | @Inject 27 | PadModel padModel; 28 | 29 | @Override 30 | public void create(Pane root) { 31 | Parent group = (Parent)root.lookup("#functionButtonGroup"); 32 | ObservableList list = group.getChildrenUnmodifiable(); 33 | 34 | patternButton = (ToggleButton)list.get(0); 35 | patternButton.getProperties().put("function", PadFunction.PATTERN); 36 | assignButton = (ToggleButton)list.get(1); 37 | assignButton.getProperties().put("function", PadFunction.ASSIGN); 38 | 39 | patternButton.selectedProperty().addListener(new ChangeListener() { 40 | @Override 41 | public void changed(ObservableValue arg0, Boolean arg1, Boolean arg2) { 42 | if (patternButton.isSelected()) { 43 | padModel.setSelectedFunction(PadFunction.PATTERN); 44 | } 45 | } 46 | }); 47 | 48 | assignButton.selectedProperty().addListener(new ChangeListener() { 49 | @Override 50 | public void changed(ObservableValue arg0, Boolean arg1, Boolean arg2) { 51 | if (assignButton.isSelected()) { 52 | padModel.setSelectedFunction(PadFunction.ASSIGN); 53 | } 54 | } 55 | }); 56 | } 57 | 58 | @Override 59 | protected void registerObservers() { 60 | super.registerObservers(); 61 | 62 | padModel.getDispatcher().register(OnPadModelSelectedFunctionChange.class, 63 | new EventObserver() { 64 | @Override 65 | public void trigger(OnPadModelSelectedFunctionChange object) { 66 | if (object.getFunction() == PadFunction.ASSIGN) { 67 | assignButton.setSelected(true); 68 | } else if (object.getFunction() == PadFunction.PATTERN) { 69 | patternButton.setSelected(true); 70 | } 71 | } 72 | }); 73 | } 74 | 75 | @Override 76 | public void onRegister() { 77 | } 78 | 79 | } 80 | -------------------------------------------------------------------------------- /CausticLiveFX/src/main/java/com/teotigraphix/causticlive/mediator/main/BankMediator.java: -------------------------------------------------------------------------------- 1 | 2 | package com.teotigraphix.causticlive.mediator.main; 3 | 4 | import javafx.beans.value.ChangeListener; 5 | import javafx.beans.value.ObservableValue; 6 | import javafx.collections.ObservableList; 7 | import javafx.event.EventHandler; 8 | import javafx.scene.Node; 9 | import javafx.scene.control.ToggleButton; 10 | import javafx.scene.input.MouseEvent; 11 | import javafx.scene.layout.Pane; 12 | 13 | import org.androidtransfuse.event.EventObserver; 14 | 15 | import com.google.inject.Inject; 16 | import com.google.inject.Singleton; 17 | import com.teotigraphix.caustic.mediator.DesktopMediatorBase; 18 | import com.teotigraphix.causticlive.model.IPadModel; 19 | import com.teotigraphix.causticlive.model.IPadModel.OnPadModelSelectedDataChange; 20 | import com.teotigraphix.caustk.core.CtkDebug; 21 | 22 | @Singleton 23 | public class BankMediator extends DesktopMediatorBase { 24 | 25 | private Pane bankButtonPane; 26 | 27 | @Inject 28 | IPadModel padModel; 29 | 30 | @Override 31 | public void create(Pane root) { 32 | bankButtonPane = (Pane)root.lookup("#bankButtonPane"); 33 | ObservableList children = bankButtonPane.getChildren(); 34 | 35 | int index = 0; 36 | for (Node node : children) { 37 | final ToggleButton button = (ToggleButton)node; 38 | button.getProperties().put("index", index); 39 | 40 | button.selectedProperty().addListener(new ChangeListener() { 41 | @Override 42 | public void changed(ObservableValue observable, 43 | Boolean oldValue, Boolean newValue) { 44 | onBankButtonSelected(button); 45 | } 46 | }); 47 | 48 | // XXX have to add KeyEvent for space, enter 49 | button.addEventFilter(MouseEvent.MOUSE_PRESSED, new EventHandler() { 50 | @Override 51 | public void handle(MouseEvent event) { 52 | if (button.isSelected()) 53 | event.consume(); 54 | } 55 | }); 56 | index++; 57 | } 58 | } 59 | 60 | protected void onBankButtonSelected(ToggleButton button) { 61 | CtkDebug.ui("Bank pressed " + button + ":" + button.isSelected()); 62 | padModel.select((int)button.getProperties().get("index")); 63 | } 64 | 65 | @Override 66 | protected void registerObservers() { 67 | super.registerObservers(); 68 | 69 | padModel.getDispatcher().register(OnPadModelSelectedDataChange.class, 70 | new EventObserver() { 71 | @Override 72 | public void trigger(OnPadModelSelectedDataChange object) { 73 | int bank = object.getData().getBank(); 74 | ToggleButton button = (ToggleButton)bankButtonPane.getChildren().get(bank); 75 | button.setSelected(true); 76 | } 77 | }); 78 | } 79 | 80 | @Override 81 | public void onRegister() { 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /CausticLiveCore/src/main/java/com/teotigraphix/causticlive/model/IPadModel.java: -------------------------------------------------------------------------------- 1 | 2 | package com.teotigraphix.causticlive.model; 3 | 4 | import java.util.List; 5 | 6 | import com.teotigraphix.caustic.model.ICaustkModel; 7 | 8 | public interface IPadModel extends ICaustkModel { 9 | 10 | PadFunction getSelectedFunction(); 11 | 12 | /** 13 | * * @param value 14 | * 15 | * @see OnPadModelSelectedFunctionChange 16 | */ 17 | void setSelectedFunction(PadFunction value); 18 | 19 | /** 20 | * @param bank 21 | * @param localIndex 22 | * @see OnPadModelSelectedDataChange 23 | */ 24 | void select(int bank, int localIndex); 25 | 26 | /** 27 | * @param bank 28 | * @see OnPadModelSelectedDataChange 29 | */ 30 | void select(int bank); 31 | 32 | PadData getLocalData(int index); 33 | 34 | /** 35 | * @see OnPadModelSelectedDataChange 36 | * @return 37 | */ 38 | PadData getSelectedData(); 39 | 40 | List getPadDataView(); 41 | 42 | /** 43 | * Dispatched the the selected bank has changed in the {@link IPadModel}. 44 | *

45 | * This also implicitly says the selected data has changed, but its up to 46 | * the views to update based on this event. 47 | *

48 | * The {@link OnPadModelSelectedDataChange} event is the explicit change of 49 | * the localIndex, either by user action or programmaticly. 50 | */ 51 | public static class OnPadModelSelectedBankChange { 52 | public OnPadModelSelectedBankChange() { 53 | } 54 | } 55 | 56 | public static class OnPadModelSelectedDataChange { 57 | 58 | private PadData data; 59 | 60 | private List view; 61 | 62 | public final PadData getData() { 63 | return data; 64 | } 65 | 66 | public List getView() { 67 | return view; 68 | } 69 | 70 | public OnPadModelSelectedDataChange(PadData data, List view) { 71 | this.data = data; 72 | this.view = view; 73 | } 74 | 75 | } 76 | 77 | public static class OnPadModelSelectedFunctionChange { 78 | 79 | private PadFunction function; 80 | 81 | public PadFunction getFunction() { 82 | return function; 83 | } 84 | 85 | public OnPadModelSelectedFunctionChange(PadFunction function) { 86 | this.function = function; 87 | } 88 | } 89 | 90 | //-------------------------------------------------------------------------- 91 | // Enum API 92 | //-------------------------------------------------------------------------- 93 | 94 | public enum PadFunction { 95 | 96 | PATTERN(0), 97 | 98 | ASSIGN(1); 99 | 100 | private int value; 101 | 102 | public final int getValue() { 103 | return value; 104 | } 105 | 106 | PadFunction(int value) { 107 | this.value = value; 108 | } 109 | 110 | public static PadFunction fromInt(int value) { 111 | for (PadFunction function : values()) { 112 | if (function.getValue() == value) 113 | return function; 114 | } 115 | return null; 116 | } 117 | } 118 | 119 | public enum PadDataState { 120 | IDLE, 121 | 122 | SELECTED, 123 | 124 | QUEUED, 125 | 126 | UNQUEUED; 127 | } 128 | 129 | } 130 | -------------------------------------------------------------------------------- /CausticLiveCore/src/main/java/com/teotigraphix/causticlive/model/PadMap.java: -------------------------------------------------------------------------------- 1 | 2 | package com.teotigraphix.causticlive.model; 3 | 4 | import java.util.ArrayList; 5 | import java.util.Collection; 6 | import java.util.List; 7 | import java.util.Map; 8 | import java.util.TreeMap; 9 | 10 | import com.teotigraphix.caustk.controller.ICaustkController; 11 | import com.teotigraphix.caustk.service.ISerialize; 12 | 13 | /* 14 | 15 | The PadMap holds all banks and patterns of the pad view. 16 | 17 | The PadData is the sate of the IPadModel that gets serialized. 18 | 19 | 20 | 21 | */ 22 | 23 | public class PadMap implements ISerialize { 24 | 25 | private Map map = new TreeMap(); 26 | 27 | private transient ICaustkController controller; 28 | 29 | public PadMap(ICaustkController controller) { 30 | this.controller = controller; 31 | } 32 | 33 | @Override 34 | public void sleep() { 35 | } 36 | 37 | @Override 38 | public void wakeup(ICaustkController controller) { 39 | this.controller = controller; 40 | for (PadData data : map.values()) { 41 | data.wakeup(controller); 42 | } 43 | } 44 | 45 | /** 46 | * Initializes the pad map with all banks and pads. 47 | *

48 | * This method is not called when deserializing, since the data already 49 | * exists. 50 | *

51 | * Only needed when creating new songs or projects. 52 | * 53 | * @param banks The number of bank buttons. 54 | * @param pads The number of pad buttons. 55 | */ 56 | public void initialize(int banks, int pads) { 57 | int index = 0; 58 | for (int bank = 0; bank < banks; bank++) { 59 | for (int localIndex = 0; localIndex < pads; localIndex++) { 60 | PadData data = new PadData(index, bank, localIndex); 61 | data.wakeup(controller); 62 | map.put(index, data); 63 | index++; 64 | } 65 | } 66 | } 67 | 68 | /** 69 | * Creates a channel, if one exists, the {@link PadChannel} will be 70 | * returned. 71 | * 72 | * @param bank 73 | * @param localIndex 74 | * @param toneIndex The index of the channel (0-13) for 14 machines in the 75 | * core. 76 | */ 77 | public PadChannel createChannel(int bank, int localIndex, int toneIndex) { 78 | PadData pad = getPad(bank, localIndex); 79 | PadChannel channel = pad.createChannel(toneIndex); 80 | return channel; 81 | } 82 | 83 | /** 84 | * Returns the {@link PadData} at the index within the whole model. 85 | * 86 | * @param index The full pad index bank * localIndex. 87 | */ 88 | public PadData getPad(int index) { 89 | return map.get(index); 90 | } 91 | 92 | /** 93 | * Returns the {@link PadData} at the localIndex within a bank. 94 | * 95 | * @param bank The bank index. 96 | * @param localIndex The local index. 97 | */ 98 | public PadData getPad(int bank, int localIndex) { 99 | for (PadData data : map.values()) { 100 | if (data.getBank() == bank && data.getLocalIndex() == localIndex) 101 | return data; 102 | } 103 | return null; 104 | } 105 | 106 | public List getPads(int bank) { 107 | List result = new ArrayList(); 108 | for (PadData data : map.values()) { 109 | if (data.getBank() == bank) 110 | result.add(data); 111 | } 112 | return result; 113 | } 114 | 115 | public Collection getPads() { 116 | return map.values(); 117 | } 118 | } 119 | -------------------------------------------------------------------------------- /CausticLiveFX/src/main/java/com/teotigraphix/causticlive/config/ApplicationModule.java: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////////////////////////// 2 | // Copyright 2013 Michael Schmalle - Teoti Graphix, LLC 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License 15 | // 16 | // Author: Michael Schmalle, Principal Architect 17 | // mschmalle at teotigraphix dot com 18 | //////////////////////////////////////////////////////////////////////////////// 19 | 20 | package com.teotigraphix.causticlive.config; 21 | 22 | import java.io.File; 23 | import java.util.ResourceBundle; 24 | 25 | import com.google.inject.Singleton; 26 | import com.google.inject.name.Names; 27 | import com.teotigraphix.caustic.config.JavaFXRuntimeModule; 28 | import com.teotigraphix.causticlive.CausticLiveApplication; 29 | import com.teotigraphix.causticlive.model.ChannelModel; 30 | import com.teotigraphix.causticlive.model.IChannelModel; 31 | import com.teotigraphix.causticlive.model.IPadMapModel; 32 | import com.teotigraphix.causticlive.model.IPadModel; 33 | import com.teotigraphix.causticlive.model.ISoundModel; 34 | import com.teotigraphix.causticlive.model.PadMapModel; 35 | import com.teotigraphix.causticlive.model.PadModel; 36 | import com.teotigraphix.causticlive.model.SoundModel; 37 | import com.teotigraphix.caustk.application.CaustkConfigurationBase; 38 | import com.teotigraphix.caustk.application.ICaustkConfiguration; 39 | import com.teotigraphix.caustk.controller.ICaustkController; 40 | import com.teotigraphix.caustk.sound.DesktopSoundGenerator; 41 | import com.teotigraphix.caustk.sound.ISoundGenerator; 42 | import com.teotigraphix.caustk.utils.RuntimeUtils; 43 | 44 | public class ApplicationModule extends JavaFXRuntimeModule { 45 | 46 | @Override 47 | protected void configureApplicationRequirements() { 48 | // Config 49 | bind(ICaustkConfiguration.class).to(ApplicationConfiguration.class).in(Singleton.class); 50 | 51 | // Binds our resource bundle that contains localized Strings 52 | bind(ResourceBundle.class).annotatedWith(Names.named("resources")).toInstance( 53 | ResourceBundle.getBundle(CausticLiveApplication.class.getName())); 54 | 55 | // Application 56 | bind(IPadModel.class).to(PadModel.class).in(Singleton.class); 57 | bind(IPadMapModel.class).to(PadMapModel.class).in(Singleton.class); 58 | bind(ISoundModel.class).to(SoundModel.class).in(Singleton.class); 59 | bind(IChannelModel.class).to(ChannelModel.class).in(Singleton.class); 60 | } 61 | 62 | public static class ApplicationConfiguration extends CaustkConfigurationBase { 63 | 64 | private DesktopSoundGenerator generator; 65 | 66 | @Override 67 | public String getApplicationId() { 68 | return "causticlive"; 69 | } 70 | 71 | @Override 72 | public void setCausticStorage(File value) { 73 | super.setCausticStorage(value); 74 | RuntimeUtils.STORAGE_ROOT = value.getAbsolutePath(); 75 | } 76 | 77 | public ApplicationConfiguration() { 78 | generator = new DesktopSoundGenerator(); 79 | } 80 | 81 | @Override 82 | public ISoundGenerator createSoundGenerator(ICaustkController controller) { 83 | return new DesktopSoundGenerator(); 84 | } 85 | 86 | @Override 87 | public void setSoundGenerator(ISoundGenerator soundGenerator) { 88 | // TODO Auto-generated method stub 89 | 90 | } 91 | } 92 | } 93 | -------------------------------------------------------------------------------- /CausticLiveCore/src/main/java/com/teotigraphix/causticlive/model/PadModel.java: -------------------------------------------------------------------------------- 1 | 2 | package com.teotigraphix.causticlive.model; 3 | 4 | import java.util.HashMap; 5 | import java.util.List; 6 | import java.util.Map; 7 | 8 | import com.google.inject.Inject; 9 | import com.google.inject.Singleton; 10 | import com.teotigraphix.caustic.model.ICaustkModelState; 11 | import com.teotigraphix.caustic.model.ModelBase; 12 | import com.teotigraphix.caustk.controller.ICaustkController; 13 | 14 | @Singleton 15 | public class PadModel extends ModelBase implements IPadModel { 16 | 17 | @Inject 18 | IPadMapModel padMapModel; 19 | 20 | @Override 21 | protected PadModelState getState() { 22 | return (PadModelState)super.getState(); 23 | } 24 | 25 | @Override 26 | public PadData getLocalData(int index) { 27 | return padMapModel.getPad(getState().getSelectedBank(), index); 28 | } 29 | 30 | @Override 31 | public PadData getSelectedData() { 32 | return padMapModel.getPad(getState().getSelectedBank(), getState().getSelectedIndex()); 33 | } 34 | 35 | /** 36 | * Returns the {@link PadData} instances that are in the selected bank. 37 | */ 38 | @Override 39 | public List getPadDataView() { 40 | return padMapModel.getPads(getState().getSelectedBank()); 41 | } 42 | 43 | public PadFunction getSelectedFunction() { 44 | return getState().getSelectedFunction(); 45 | } 46 | 47 | public void setSelectedFunction(PadFunction value) { 48 | getState().setSelectedFunction(value); 49 | trigger(new OnPadModelSelectedFunctionChange(value)); 50 | } 51 | 52 | public PadModel() { 53 | setStateFactory(PadModelState.class); 54 | } 55 | 56 | @Override 57 | protected void configState(ICaustkModelState state) { 58 | getState().selectedIndex.put(0, 0); 59 | getState().selectedIndex.put(1, 0); 60 | getState().selectedIndex.put(2, 0); 61 | getState().selectedIndex.put(3, 0); 62 | } 63 | 64 | @Override 65 | public void onRegister() { 66 | } 67 | 68 | @Override 69 | public void onShow() { 70 | setSelectedFunction(getSelectedFunction()); 71 | select(getState().getSelectedBank(), getState().getSelectedIndex()); 72 | } 73 | 74 | @Override 75 | public void select(int bank) { 76 | getState().setSelectedBank(bank); 77 | //getDispatcher().trigger( 78 | // new OnPadModelSelectedDataChange(getSelectedData(), getPadDataView())); 79 | trigger(new OnPadModelSelectedBankChange()); 80 | } 81 | 82 | @Override 83 | public void select(int bank, int localIndex) { 84 | getState().setSelectedBank(bank); 85 | getState().setSelectedIndex(localIndex); 86 | getDispatcher().trigger( 87 | new OnPadModelSelectedDataChange(getSelectedData(), getPadDataView())); 88 | } 89 | 90 | public static class PadModelState implements ICaustkModelState { 91 | 92 | int selectedBank = 0; 93 | 94 | public int getSelectedBank() { 95 | return selectedBank; 96 | } 97 | 98 | public void setSelectedBank(int value) { 99 | selectedBank = value; 100 | } 101 | 102 | Map selectedIndex = new HashMap(); 103 | 104 | public int getSelectedIndex() { 105 | return selectedIndex.get(selectedBank); 106 | } 107 | 108 | public void setSelectedIndex(int value) { 109 | selectedIndex.put(selectedBank, value); 110 | } 111 | 112 | private PadFunction selectedFunction = PadFunction.PATTERN; 113 | 114 | public PadFunction getSelectedFunction() { 115 | return selectedFunction; 116 | } 117 | 118 | public void setSelectedFunction(PadFunction value) { 119 | selectedFunction = value; 120 | } 121 | 122 | public PadModelState() { 123 | } 124 | 125 | @Override 126 | public void sleep() { 127 | } 128 | 129 | @Override 130 | public void wakeup(ICaustkController controller) { 131 | } 132 | 133 | } 134 | 135 | } 136 | -------------------------------------------------------------------------------- /CausticLiveFX/src/test/java/com/teotigraphix/causticlive/model/PadDataTest.java: -------------------------------------------------------------------------------- 1 | 2 | package com.teotigraphix.causticlive.model; 3 | 4 | import static org.junit.Assert.assertEquals; 5 | import static org.junit.Assert.assertSame; 6 | 7 | import java.io.File; 8 | import java.io.IOException; 9 | 10 | import org.junit.Test; 11 | 12 | import com.teotigraphix.caustk.CaustkTestBase; 13 | import com.teotigraphix.caustk.core.CausticException; 14 | import com.teotigraphix.caustk.library.Library; 15 | import com.teotigraphix.caustk.library.LibraryPhrase; 16 | import com.teotigraphix.caustk.sequencer.ISystemSequencer.SequencerMode; 17 | import com.teotigraphix.caustk.sequencer.Track; 18 | import com.teotigraphix.caustk.sequencer.TrackSong; 19 | import com.teotigraphix.caustk.sound.ISoundSource; 20 | import com.teotigraphix.caustk.tone.BeatboxTone; 21 | import com.teotigraphix.caustk.tone.ModularTone; 22 | import com.teotigraphix.caustk.tone.PCMSynthTone; 23 | import com.teotigraphix.caustk.tone.PadSynthTone; 24 | import com.teotigraphix.caustk.tone.SubSynthTone; 25 | import com.teotigraphix.caustk.tone.Tone; 26 | 27 | public class PadDataTest extends CaustkTestBase { 28 | 29 | private ISoundSource soundSource; 30 | 31 | private Tone track0; 32 | 33 | private Tone track3; 34 | 35 | private Tone track5; 36 | 37 | private Tone track8; 38 | 39 | private Tone track13; 40 | 41 | private PadMap map; 42 | 43 | private Library library; 44 | 45 | @Override 46 | protected void start() throws CausticException, IOException { 47 | soundSource = controller.getSoundSource(); 48 | 49 | track0 = soundSource.createTone(0, "track0", SubSynthTone.class); 50 | track3 = soundSource.createTone(3, "track3", PCMSynthTone.class); 51 | track5 = soundSource.createTone(5, "track5", ModularTone.class); 52 | track8 = soundSource.createTone(8, "track8", BeatboxTone.class); 53 | track13 = soundSource.createTone(13, "track13", PadSynthTone.class); 54 | 55 | map = new PadMap(controller); 56 | map.initialize(4, 16); 57 | 58 | File libraryFile = new File("src/test/resources/libraries/PadDataTest"); 59 | library = controller.getLibraryManager().loadLibrary(libraryFile); 60 | 61 | } 62 | 63 | @Override 64 | protected void end() { 65 | 66 | } 67 | 68 | /* 69 | * - Load library 70 | * - Put model into ASSIGN state 71 | * - Select Pad 72 | * - Handle button action 73 | * - Show pad assignment popup 74 | * - popup.setPadData(padMap.getData(bank, localIndex) 75 | * 76 | * 77 | * 78 | * 79 | */ 80 | 81 | @Test 82 | public void test_setPhrase() throws IOException, CausticException { 83 | LibraryPhrase libraryPhrase = library.getPhrases().get(0); 84 | PadData pad = map.getPad(3, 4); 85 | // get the channel for the PadSynth 86 | PadChannel channel = pad.getChannel(track13.getIndex()); 87 | 88 | channel.assignPhrase(libraryPhrase); 89 | 90 | File songFile = new File("C:/Users/Work/Documents/git/CausticLive/CausticLiveFX/src/test/resources/PadDataTestSong.ctks"); 91 | TrackSong song = controller.getSongManager().create(songFile); 92 | song.setNumTracks(14); 93 | Track track = song.getTrack(13); 94 | track.addPhrase(10, channel.getChannelPhrase()); 95 | controller.getSongManager().save(); 96 | 97 | // assert the trackItemId is the same as the channel phraseId 98 | assertEquals(track.getTrackItem(0).getPhraseId(), channel.getChannelPhrase().getId()); 99 | 100 | String prettyString1 = controller.getSerializeService().toPrettyString(pad); 101 | String prettyString2 = controller.getSerializeService().toPrettyString(song); 102 | 103 | controller.getSystemSequencer().play(SequencerMode.SONG); 104 | } 105 | 106 | @Test 107 | public void test_getChannel() { 108 | 109 | PadData pad = map.getPad(3, 4); 110 | // get the channel for the PadSynth 111 | PadChannel channel = pad.getChannel(track13.getIndex()); 112 | 113 | assertSame(track13, channel.getTone()); 114 | assertEquals(3, channel.getBankIndex()); 115 | assertEquals(4, channel.getPatternIndex()); 116 | assertEquals(13, channel.getIndex()); 117 | 118 | ///-------------------------- 119 | 120 | String string = controller.getSerializeService().toPrettyString(map); 121 | 122 | PadMap map2 = controller.getSerializeService().fromString(string, PadMap.class); 123 | String string2 = controller.getSerializeService().toPrettyString(map2); 124 | assertEquals(string, string2); 125 | 126 | PadChannel channel2 = map2.getPad(0, 0).getChannel(13); 127 | 128 | assertSame(track13, channel2.getTone()); 129 | } 130 | } 131 | -------------------------------------------------------------------------------- /CausticLiveCore/src/main/java/com/teotigraphix/causticlive/model/PadData.java: -------------------------------------------------------------------------------- 1 | 2 | package com.teotigraphix.causticlive.model; 3 | 4 | import java.util.ArrayList; 5 | import java.util.List; 6 | import java.util.Map; 7 | import java.util.TreeMap; 8 | 9 | import com.teotigraphix.causticlive.model.IPadModel.PadDataState; 10 | import com.teotigraphix.caustk.controller.ICaustkController; 11 | import com.teotigraphix.caustk.service.ISerialize; 12 | 13 | public class PadData implements ISerialize { 14 | 15 | private transient ICaustkController controller; 16 | 17 | private Map map = new TreeMap(); 18 | 19 | //---------------------------------- 20 | // index 21 | //---------------------------------- 22 | 23 | private int index; 24 | 25 | public final int getIndex() { 26 | return index; 27 | } 28 | 29 | //---------------------------------- 30 | // bank 31 | //---------------------------------- 32 | 33 | private int bank; 34 | 35 | public final int getBank() { 36 | return bank; 37 | } 38 | 39 | //---------------------------------- 40 | // localIndex 41 | //---------------------------------- 42 | 43 | private int localIndex; 44 | 45 | public final int getLocalIndex() { 46 | return localIndex; 47 | } 48 | 49 | //---------------------------------- 50 | // state 51 | //---------------------------------- 52 | 53 | private PadDataState state = PadDataState.IDLE; 54 | 55 | public final PadDataState getState() { 56 | return state; 57 | } 58 | 59 | public void setState(PadDataState value) { 60 | state = value; 61 | } 62 | 63 | //---------------------------------- 64 | // state 65 | //---------------------------------- 66 | 67 | private Integer viewChannel = null; 68 | 69 | /** 70 | * Returns the {@link PadChannel} index that is considered the top view. 71 | */ 72 | public int getViewChannel() { 73 | if (viewChannel == null) { 74 | for (PadChannel channel : map.values()) { 75 | return channel.getIndex(); 76 | } 77 | viewChannel = 0; 78 | } 79 | return viewChannel; 80 | } 81 | 82 | public void setViewChannel(int viewChannel) { 83 | this.viewChannel = viewChannel; 84 | } 85 | 86 | //-------------------------------------------------------------------------- 87 | // Constructor 88 | //-------------------------------------------------------------------------- 89 | 90 | public PadData(int index, int bank, int localIndex) { 91 | this.index = index; 92 | this.bank = bank; 93 | this.localIndex = localIndex; 94 | } 95 | 96 | /** 97 | * Creates a channel, if one exists, the {@link PadChannel} will be 98 | * returned. 99 | * 100 | * @param index The index of the channel (0-13) for 14 machines in the core. 101 | */ 102 | PadChannel createChannel(int toneIndex) { 103 | PadChannel channel = new PadChannel(toneIndex); 104 | channel.setPadData(this); 105 | channel.wakeup(controller); 106 | map.put(toneIndex, channel); 107 | return channel; 108 | } 109 | 110 | /** 111 | * Returns whether the pad contains a {@link PadChannel} at the tone index. 112 | * 113 | * @param toneIndex The toneIndex to test. 114 | */ 115 | public boolean hasChannel(int toneIndex) { 116 | return map.containsKey(toneIndex); 117 | } 118 | 119 | /** 120 | * Returns a {@link PadChannel} at the toneIndex, will return 121 | * null if the channel has not been created. 122 | * 123 | * @param toneIndex The toneIndex to retrieve. 124 | */ 125 | public PadChannel findChannel(int toneIndex) { 126 | return map.get(toneIndex); 127 | } 128 | 129 | /** 130 | * Returns a {@link PadChannel} at the tone index, this method will create 131 | * the channel if it does not exist. 132 | * 133 | * @param toneIndex The toneIndex to retrieve. 134 | */ 135 | public PadChannel getChannel(int toneIndex) { 136 | PadChannel channel = map.get(toneIndex); 137 | if (channel == null) { 138 | channel = createChannel(toneIndex); 139 | } 140 | return channel; 141 | } 142 | 143 | @Override 144 | public void sleep() { 145 | } 146 | 147 | @Override 148 | public void wakeup(ICaustkController controller) { 149 | this.controller = controller; 150 | for (PadChannel channel : map.values()) { 151 | channel.setPadData(this); 152 | channel.wakeup(controller); 153 | } 154 | } 155 | 156 | @Override 157 | public String toString() { 158 | return "Data[" + bank + "," + localIndex + "]"; 159 | } 160 | 161 | public List getChannels() { 162 | return new ArrayList<>(map.values()); 163 | } 164 | 165 | public boolean hasChannels() { 166 | return map.size() > 0; 167 | } 168 | } 169 | -------------------------------------------------------------------------------- /CausticLiveFX/src/main/resources/com/teotigraphix/causticlive/view/AssignmentScreen.fxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 |