Skip to content

Commit

Permalink
The documents moved to github wiki.
Browse files Browse the repository at this point in the history
Added Travis CI configurations.
  • Loading branch information
kshoji committed Feb 22, 2015
1 parent f026e2b commit a3ea1f9
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 67 deletions.
13 changes: 13 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
language: android
jdk: openjdk7
android:
components:
- build-tools-21.1.2
- extra-android-m2repository
- android-19
licenses:
- '.+'
before_install:
- chmod +x gradlew
script:
- ./gradlew check
71 changes: 5 additions & 66 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,79 +1,18 @@
JFugue-for-Android
==================

[![Build Status](https://travis-ci.org/kshoji/JFugue-for-Android.svg?branch=master)](https://travis-ci.org/kshoji/JFugue-for-Android)

Music library [JFugue](http://www.jfugue.org/) porting for Android<br />
Based on the version 4.0.3.

*Currently, work in progress*

Usage
=====

Initialization / Termination
--------------
At the main Activity or Fragment, append `MidiSystem.initialize(Context)` in `onCreate` and append `MidiSystem.terminate()` in `onDestroy`.

```java
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

MidiSystem.initialize(this);
}

@Override
protected void onDestroy() {
super.onDestroy();
MidiSystem.terminate();
}
```

Use of JFugue
-------------
See the [original documents](http://www.jfugue.org/examples.html).

## Playing C scale:
```java
Player player = new Player();
player.play("C D E F G A B");
```

Different from the original JFugue, `Player.play(...)` **doesn't block the current thread**.
To wait finishing playing, `player.getSequencer().addMetaEventListener(...)` can be used.

For example:
```java
player.getSequencer().addMetaEventListener(new MetaEventListener() {
@Override
public void meta(MetaMessage metaMessage) {
if (MetaMessage.TYPE_END_OF_TRACK == metaMessage.getType()) {
// XXX playing finished
}
}
});
```

## Writing MusicXML to file:
```java
FileOutputStream file = context.openFileOutput("music.xml", MODE_PRIVATE);

MusicXmlRenderer renderer = new MusicXmlRenderer();
MusicStringParser parser = new MusicStringParser();
parser.addParserListener(renderer);

Pattern pattern = new Pattern("C D E F G A B |");
parser.parse(pattern);

Serializer serializer = new Serializer(file, "UTF-8");
serializer.setIndent(4);
serializer.write(renderer.getMusicXMLDoc());

file.flush();
file.close();
```
See [the wiki page](https://github.com/kshoji/JFugue-for-Android/wiki) for configurations and using of this library.
About the JFugue features, see [the original documents](http://www.jfugue.org/examples.html).

License
=======
- JFugue for Android's license is same as the original, [LGPL](https://www.gnu.org/licenses/lgpl.html).
- Other modified referencial library's license is also same as original. See each directories' license file for more information.
- Other modified referential library's license is also same as original. See each directories' license file for more information.
3 changes: 2 additions & 1 deletion jfugue-android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ android {
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
lintOptions {
abortOnError false
}
}

Expand Down
3 changes: 3 additions & 0 deletions mod_xalan/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ android {
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
lintOptions {
abortOnError false
}
}

dependencies {
Expand Down

0 comments on commit a3ea1f9

Please sign in to comment.