Skip to content

Commit fd8c2c9

Browse files
committed
Minor update. Updated GLua MIDI parser script and readme...
Moved "midi-parser.lua" file to "lua/includes/modules" folder. "midiParser" function has been renamed into "midi.Parse". Added verification for function arguments (fileName and path). Fixed a nil concat error when path were passed as nil. Added Contributor Guidelines and Code of Conduct.
1 parent e904678 commit fd8c2c9

File tree

5 files changed

+560
-303
lines changed

5 files changed

+560
-303
lines changed

.github/CODE_OF_CONDUCT.md

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
# Contributor Covenant Code of Conduct
2+
3+
## Our Pledge
4+
5+
In the interest of fostering an open and welcoming environment, we as
6+
contributors and maintainers pledge to making participation in our project and
7+
our community a harassment-free experience for everyone, regardless of age, body
8+
size, disability, ethnicity, gender identity and expression, level of experience,
9+
nationality, personal appearance, race, religion, or sexual identity and
10+
orientation.
11+
12+
## Our Standards
13+
14+
Examples of behavior that contributes to creating a positive environment
15+
include:
16+
17+
* Using welcoming and inclusive language
18+
* Being respectful of differing viewpoints and experiences
19+
* Gracefully accepting constructive criticism
20+
* Focusing on what is best for the community
21+
* Showing empathy towards other community members
22+
23+
Examples of unacceptable behavior by participants include:
24+
25+
* The use of sexualized language or imagery and unwelcome sexual attention or
26+
advances
27+
* Trolling, insulting/derogatory comments, and personal or political attacks
28+
* Public or private harassment
29+
* Publishing others' private information, such as a physical or electronic
30+
address, without explicit permission
31+
* Other conduct which could reasonably be considered inappropriate in a
32+
professional setting
33+
34+
## Our Responsibilities
35+
36+
Project maintainers are responsible for clarifying the standards of acceptable
37+
behavior and are expected to take appropriate and fair corrective action in
38+
response to any instances of unacceptable behavior.
39+
40+
Project maintainers have the right and responsibility to remove, edit, or
41+
reject comments, commits, code, wiki edits, issues, and other contributions
42+
that are not aligned to this Code of Conduct, or to ban temporarily or
43+
permanently any contributor for other behaviors that they deem inappropriate,
44+
threatening, offensive, or harmful.
45+
46+
## Scope
47+
48+
This Code of Conduct applies both within project spaces and in public spaces
49+
when an individual is representing the project or its community. Examples of
50+
representing a project or community include using an official project e-mail
51+
address, posting via an official social media account, or acting as an appointed
52+
representative at an online or offline event. Representation of a project may be
53+
further defined and clarified by project maintainers.
54+
55+
## Enforcement
56+
57+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
58+
reported by contacting the project team at [support@github.com](mailto:support@github.com). All
59+
complaints will be reviewed and investigated and will result in a response that
60+
is deemed necessary and appropriate to the circumstances. The project team is
61+
obligated to maintain confidentiality with regard to the reporter of an incident.
62+
Further details of specific enforcement policies may be posted separately.
63+
64+
Project maintainers who do not follow or enforce the Code of Conduct in good
65+
faith may face temporary or permanent repercussions as determined by other
66+
members of the project's leadership.
67+
68+
## Attribution
69+
70+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71+
available at [http://contributor-covenant.org/version/1/4][version]
72+
73+
[homepage]: http://contributor-covenant.org
74+
[version]: http://contributor-covenant.org/version/1/4/

.github/CONTRIBUTING.md

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
# How to Contribute
2+
3+
Contributions take many forms from submitting issues, writing docs, to making
4+
code changes - we welcome it all!
5+
6+
## Getting Started
7+
8+
If you don't have a GitHub account, you can [sign up](https://github.com/signup/free)
9+
as it will help you to participate with the project.
10+
11+
If you are running GitHub Desktop, you can clone this repository locally from
12+
GitHub using the "Clone in Desktop" button from the GLua-midi-parser project page,
13+
or run this command in your Git-enabled Shell/Bash:
14+
15+
`git clone https://github.com/garrysmodlua/GLua-midi-parser.git midi-parser`
16+
17+
If you want to make contributions to the project,
18+
[forking the project](https://help.github.com/articles/fork-a-repo) is the
19+
easiest way to do this. You can then clone down your fork instead:
20+
21+
`git clone https://github.com/MY-USERNAME-HERE/GLua-midi-parser.git midi-parser`
22+
23+
## How can I get involved?
24+
25+
We have an [`up-for-grabs`](https://github.com/garrysmodlua/GLua-midi-parser/labels/up-for-grabs)
26+
tag on our issue tracker to indicate tasks which contributors can pick up.
27+
28+
If you've found something you'd like to contribute to, leave a comment in the issue
29+
so everyone is aware.
30+
31+
## Making Changes
32+
33+
When you're ready to make a change, create a branch off the `master` branch:
34+
35+
```
36+
git checkout master
37+
git pull origin master
38+
git checkout -b SOME-BRANCH-NAME
39+
```
40+
41+
We use `master` as the default branch for the repository, and it holds the most
42+
recent contributions. By working in a branch away from `master` you can handle
43+
potential conflicts that may occur in the future.
44+
45+
If you make focused commits (instead of one monolithic commit) and have descriptive
46+
commit messages, this will help speed up the review process.
47+
48+
### Submitting Changes
49+
50+
You can publish your branch from GitHub for Windows, or run this command from
51+
the Git Shell/Bash:
52+
53+
`git push origin MY-BRANCH-NAME`
54+
55+
Once your changes are ready to be reviewed, publish the branch to GitHub and
56+
[open a pull request](https://help.github.com/articles/using-pull-requests)
57+
against it.
58+
59+
A few suggestions when opening a pull request:
60+
61+
- If you are addressing a particular issue, reference it like this:
62+
63+
> Fixes #1234
64+
65+
- Prefix the title with `[WIP]` to indicate this is a work-in-progress. It's
66+
always good to get feedback early, so don't be afraid to open the PR before
67+
it's "done".
68+
- Use [checklists](https://github.com/blog/1375-task-lists-in-gfm-issues-pulls-comments)
69+
to indicate the tasks which need to be done, so everyone knows how close you
70+
are to done.
71+
- Add comments to the PR about things that are unclear or you would like
72+
suggestions on.
73+
74+
Some things that will increase the chance that your pull request is accepted:
75+
76+
* Follow existing code conventions.
77+
* Update the documentation, the surrounding one, examples elsewhere, guides,
78+
whatever is affected by your contribution.
79+
80+
# Additional Resources
81+
82+
* [General GitHub documentation](http://help.github.com/)

README.md

Lines changed: 72 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,53 @@
11
# MIDI Parser for Garry's Mod Lua
22

3-
**It is not perfect**! Use it for just experiment.
3+
**It is not perfect**! Use it for experimental purposes.
44
This is a GLua fork of [Lua_midiParser](https://github.com/FMS-Cat/Lua_midiParser).
55

6-
## Usage
6+
## Installation
7+
8+
### Download
9+
10+
You must download the source code first, there are 4 ways to do it, use any way you like:
11+
* Download the latest release from [here](https://github.com/garrysmodlua/GLua-midi-parser/releases/latest).
12+
* Download ZIP of this repository [here](https://github.com/garrysmodlua/GLua-midi-parser/archive/master.zip).
13+
* Clone this repository using [git](https://git-scm.com/downloads): `git clone https://github.com/garrysmodlua/GLua-midi-parser.git midi-parser`.
14+
* Save the <code><a href="lua/includes/modules/midi-parser.lua">midi-parser.lua</a></code> file (Press <kbd>Ctrl</kbd>+<kbd>S</kbd>; Or, <kbd>Cmd</kbd>+<kbd>S</kbd> on Mac).
15+
16+
### GMod Setup
17+
18+
1. Navigate to your `./Steam/steamapps/common/GarrysMod/garrysmod` folder.
19+
2. Depending on which download method you have used, make sure you have the following directory structure (create any neccessary folder yourself if it doesn't exist):
20+
21+
![Expected directory structure](https://user-images.githubusercontent.com/9789070/27001572-ba3c1c16-4dcd-11e7-9348-a2954c8bd033.png)
22+
23+
3. You are done. Have fun!
24+
25+
## Usage / Code Example
26+
27+
1. Must require our `midi-parser` module:
28+
```lua
29+
require( "midi-parser" )
30+
```
31+
32+
2. Call either of these 2 functions:
33+
* `[table] = midi.Parse(string midiData)` - To parse MIDI data as string.
34+
* `[table] = midi.ParseFile(string fileName[, string path="DATA"])` - To parse a given `.mid` file.
735

836
```lua
9-
-- Will attempt to parse "garrysmod/data/abcdef.mid" file
10-
myMidi = midiParser( "abcdef.mid" ) -- if path is omitted, it defaults to "DATA"
37+
-- Notes/Information:
38+
-- ParseFile function: A fileName argument, if you are dealing with multiple directories, remember to use forward-slash (/) character as directory separator; do NOT use backslash (\) character.
39+
-- ParseFile function: A path argument is optional, it defaults to "DATA" when omitted; by default it will search relative to "GarrysMod/garrysmod/data" folder.
40+
-- Both of the Parse functions will throw an error if something goes wrong (e.g. if a given file does not exist, or could not be read, etc).
41+
-- Moreover, if MIDI file/data is succesfully parsed, a function will return a table as a result.
1142

12-
-- Will attempt to parse "garrysmod/lua/test.mid" file
13-
testingMidi = midiParser( "test.mid", "LUA" )
43+
local firstMidi = midi.ParseFile( "midis/first.mid" ) -- Will attempt to parse "GarrysMod/garrysmod/data/midis/first.mid" file
1444

15-
-- Prints the contents of testingMidi table:
16-
PrintTable( testingMidi )
45+
local testingMidi = midi.ParseFile( "test.mid", "LUA" ) -- Will attempt to parse "GarrysMod/garrysmod/lua/test.mid" file
46+
47+
PrintTable( testingMidi ) -- Prints the contents of testingMidi table
1748
```
1849

19-
## Return sample
50+
### Return Sample
2051

2152
```lua
2253
{
@@ -87,6 +118,37 @@ PrintTable( testingMidi )
87118
}
88119
```
89120

121+
## Documentation
122+
123+
Sorry, there is no wiki nor docs...
124+
125+
## Contribution
126+
127+
Visit the [Contributor Guidelines](https://github.com/garrysmodlua/GLua-midi-parser/blob/master/.github/CONTRIBUTING.md) for more details. All contributors are expected to follow our [Code of Conduct](https://github.com/garrysmodlua/GLua-midi-parser/master/.github/CODE_OF_CONDUCT.md).
128+
129+
## Support
130+
131+
If you think you have found a bug or have a feature/enhancement request for GLua MIDI parser, use our [issue tracker](https://github.com/garrysmodlua/GLua-midi-parser/issues/new).
132+
133+
Before opening a new issue, please be kind and search to see if your problem has already been reported. Try to be as detailed as possible in your issue reports.
134+
When creating an issue, clearly explain
135+
136+
* What you were trying to do?
137+
* What you expected to happen?
138+
* What actually happened?
139+
* Steps to reproduce the problem.
140+
141+
Also include any other information you think is relevant to reproduce the problem.
142+
90143
## License
91144

92-
This repository is licensed with the [MIT](LICENSE) license.
145+
[GLua MIDI parser](https://github.com/garrysmodlua/GLua-midi-parser) repository/code is freely distributed under the [MIT](LICENSE) license. See [LICENSE](LICENSE) for more details.
146+
147+
## Credits
148+
149+
[FMS-Cat](https://github.com/FMS-Cat) for the original Lua code.
150+
[CaptainPRICE](https://github.com/CaptainPRICE) for making it compatible with [Garry's Mod](http://gmod.facepunch.com/) (GLua).
151+
152+
## Related Projects
153+
154+
[GMod-Expression2-midi-parser](https://github.com/garrysmodlua/GMod-Expression2-midi-parser): MIDI Parser (Wire Expression 2 extension).

0 commit comments

Comments
 (0)