Skip to content

Commit

Permalink
release 0.2.1 updates
Browse files Browse the repository at this point in the history
  • Loading branch information
sojamo committed Mar 14, 2016
1 parent 5c1a7fb commit 27c8d86
Show file tree
Hide file tree
Showing 12 changed files with 707 additions and 275 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.idea
.DS_Store
.classpath
.externalToolBuilders
Expand All @@ -6,3 +7,4 @@
dist/
target/
test/
*.iml
6 changes: 5 additions & 1 deletion changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/). More details at [keep a changelog](http://keepachangelog.com/)


## 0.1.4-alpha - 2016-02-01
### Added
- Moving from Eclipse to IntelliJ

## 0.1.3-alpha - 2014-03-05
### Added
- Adding Midi out support for virtual devices
Expand All @@ -18,7 +22,7 @@ All notable changes to this project will be documented in this file. This projec

## 0.1.1-alpha - 2014-02-17
### Changed
- changes made to the way method chaining is used with an AssignedDevice
- changes made to the way method chaining is used with an AssignedDevice

### Added
- changelog file to keep track of changes.
Expand Down
19 changes: 11 additions & 8 deletions examples/MidMapperOut/MidMapperOut.pde
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,27 @@ import sojamo.midimapper.*;
MidiMapper midi;
MidiOutMapper out;

float n;

void setup() {
size(800, 400);
midi = new MidiMapper(this);
println(midi.list());
println(MidiOutMapper.list());

out = new MidiOutMapper();
out.assign("/1/fader", 1,1);
// assign an index to a midi channel and note
String index = "/1/fader";
int channel = 1;
int note = 1;
out.assign( index, channel, note);
}

void keyPressed() {
// midi.send(1,1,int(random(127)));
// midi.send(out, 1,1,int(random(127)));
println(out.isAvailable());

// println(out.isAvailable());
// send a midi control-change previously assigned to an index
out.send("/1/fader", frameCount%127);
}



void draw() {
}

24 changes: 12 additions & 12 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,29 +3,29 @@
<groupId>sojamo.midimapper</groupId>
<artifactId>midimapper</artifactId>
<packaging>jar</packaging>
<version>0.1.3-alpha</version>
<version>0.2.1</version>
<name>midimapper</name>
<description>maps midi input to variables and functions.</description>
<properties>
<jdk.version>1.7</jdk.version>
<jdk.version>1.8</jdk.version>
</properties>

<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.processing</groupId>
<artifactId>papplet</artifactId>
<version>${java.version}</version>
<scope>system</scope>
<systemPath>${user.home}/Documents/workspace/libs/p5_2.2.1/core.jar</systemPath>
</dependency>
<dependency>
<groupId>org.processing</groupId>
<artifactId>papplet</artifactId>
<version>${java.version}</version>
<scope>system</scope>
<systemPath>${user.home}/Documents/workspace/libs/p5_3/core.jar</systemPath>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
Expand Down Expand Up @@ -60,4 +60,4 @@
</plugin>
</plugins>
</build>
</project>
</project>
33 changes: 33 additions & 0 deletions resources/install_instructions.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
Install library midimapper


Move folder midimapper into Processing's libraries folder and restart Processing.


How?

Contributed libraries must be downloaded separately and placed within
the "libraries" folder of your Processing sketchbook. To find the Processing
sketchbook location on your computer, open the Preferences window from the
Processing application and look for the "Sketchbook location" item at the top.

Copy the contributed library's folder into the "libraries" folder at this location.
You will need to create the "libraries" folder if this is your first contributed library.

By default the following locations are used for your sketchbook folder.
For mac users the sketchbook folder is located inside ~/Documents/Processing.
for windows users the sketchbook folder is located inside folder 'My Documents'/Processing

The folder structure for library midimapper should be as follows

Processing
libraries
midimapper
examples
library
midimapper.jar
reference
src


After library midimapper has been successfully installed, restart Processing.
15 changes: 11 additions & 4 deletions resources/jar.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
cd $HOME/Documents/workspace/midimapper/target/classes
jar cf ../midimapper.jar .
cp ../midimapper.jar $HOME/Documents/Processing/libraries/midimapper/library
echo "midimapper compiled on $(date)"
#!/bin/bash
echo "Creating jar file for $1"
cd $2
{ mvn compile; } &
wait
echo "done mvn $2"
pwd
cd $2/target/classes
jar cf ../$1.jar .
cp ../$1.jar $HOME/Documents/Processing3/libraries/$1/library
echo "$1 compiled on $(date)"
44 changes: 44 additions & 0 deletions resources/library.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# UTF-8 supported.

# The name of your library as you want it formatted
name = MidiMapper

# List of authors. Links can be provided using the syntax [author name](url)
authorList = [Andreas Schlegel](http://www.sojamo.de/)

# A website for your library
url = http://www.sojamo.de/libraries/midimapper

# The category of your library, must be one (or many) of the following:
# "3D" "Animation" "Compilations" "Data"
# "Fabrication" "Geometry" "GUI" "Hardware"
# "I/O" "Language" "Math" "Simulation"
# "Sound" "Utilities" "Typography" "Video & Vision"
#
# If a value other than those listed is used, your library will listed as "Other."
category = Sound

# A short sentence (fragment) to summarize the library's function. This will be
# shown from inside the PDE when the library is being installed. Avoid repeating
# the name of your library here. Also, avoid saying anything redundant like
# mentioning that its a library.
sentence = A midi library.

# Additional information suitable for the Processing website. The value of
# 'sentence' always will be prepended, so you should start by writing the
# second sentence here. If your library only works on certain operating systems,
# mention it here.
paragraph = A midi library that maps midi input to variables and functions.

# Links in the 'sentence' and 'paragraph' attributes can be inserted using the
# same syntax as for authors. That is, [here is a link to Processing](http://processing.org/)


# A version number that increments once with each release. This
# is used to compare different versions of the same library, and
# check if an update is available. You should think of it as a
# counter, counting the total number of releases you've had.
version = 2 # This must be parsable as an int

# The version as the user will see it. If blank, the version attribute will be used here
prettyVersion = 0.2.1 # This is treated as a String
84 changes: 58 additions & 26 deletions src/main/java/sojamo/midimapper/AssignedDevice.java
Original file line number Diff line number Diff line change
@@ -1,33 +1,65 @@
package sojamo.midimapper;

import javax.sound.midi.MidiDevice;
import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.Map;

public class AssignedDevice {

private final MidiDevice device;
private final Object parent;
private final String name;

AssignedDevice( Object theParent , MidiDevice theDevice, String theName ) {
parent = theParent;
device = theDevice;
name = theName;
}

public MidiNote assign( int theNote ) {
return new MidiNote( this , parent , theNote );
}

public MidiDevice get( ) {
return device;
}

public boolean exists( ) {
return !device.equals( null );
}

public String getName() {
return name;
}

private final MidiDevice device;
private final Object parent;
private final String name;
private final Map<Integer, MidiNote> map;

AssignedDevice(Object theParent, MidiDevice theDevice, String theName) {
parent = theParent;
device = theDevice;
name = theName;
map = new LinkedHashMap<>();
}

public MidiNote assign(int theNote) {
MidiNote note = new MidiNote(this, parent, theNote);
map.put(theNote, note);
return note;
}

public AssignedDevice remove(int theNote) {
map.remove(theNote);
return this;
}

public AssignedDevice clear() {
map.clear();
return this;
}

public MidiDevice get() {
return device;
}

public boolean exists() {
return !device.equals(null);
}

public String getName() {
return name;
}

public Map getMapping() {
return Collections.unmodifiableMap(map);
}

public String toString() {
StringBuilder b = new StringBuilder().
append("AssignedDevice{").
append(" name=").append(name).
append(", device=").append(device.getDeviceInfo().getName()).
append(", mapping=").append(getMapping().toString()).
append(" }");
return b.toString();
}


}
Loading

0 comments on commit 27c8d86

Please sign in to comment.