-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added Travis CI configurations.
- Loading branch information
Showing
4 changed files
with
23 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters