-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #29 from stijnfrishert/develop
v1.1.1
- Loading branch information
Showing
39 changed files
with
1,229 additions
and
528 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,76 @@ | ||
/* | ||
This file is a part of liblsdj, a C library for managing everything | ||
that has to do with LSDJ, software for writing music (chiptune) with | ||
your gameboy. For more information, see: | ||
* https://github.com/stijnfrishert/liblsdj | ||
* http://www.littlesounddj.com | ||
-------------------------------------------------------------------------------- | ||
MIT License | ||
Copyright (c) 2018 Stijn Frishert | ||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. | ||
*/ | ||
|
||
#include <iostream> | ||
|
||
#include "common.hpp" | ||
|
||
namespace lsdj | ||
{ | ||
int handle_error(lsdj_error_t* error) | ||
{ | ||
std::cerr << "ERROR: " << lsdj_error_get_c_str(error) << std::endl; | ||
lsdj_error_free(error); | ||
return 1; | ||
} | ||
|
||
bool compareCaseInsensitive(std::string str1, std::string str2) | ||
{ | ||
std::transform(str1.begin(), str1.end(), str1.begin(), ::tolower); | ||
std::transform(str2.begin(), str2.end(), str2.begin(), ::tolower); | ||
return str1 == str2; | ||
} | ||
|
||
std::string constructProjectName(const lsdj_project_t* project, bool underscore) | ||
{ | ||
char name[9] = { 0, 0, 0, 0, 0, 0, 0, 0, 0 }; | ||
lsdj_project_get_name(project, name, sizeof(name)); | ||
|
||
if (underscore) | ||
std::replace(name, name + 9, 'x', '_'); | ||
|
||
return name; | ||
} | ||
|
||
bool isHiddenFile(const std::string& str) | ||
{ | ||
switch (str.size()) | ||
{ | ||
case 0: return true; | ||
case 1: return false; | ||
default: return str[0] == '.' && str[1] != '.' && str[1] != '/'; | ||
} | ||
} | ||
} |
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,52 @@ | ||
/* | ||
This file is a part of liblsdj, a C library for managing everything | ||
that has to do with LSDJ, software for writing music (chiptune) with | ||
your gameboy. For more information, see: | ||
* https://github.com/stijnfrishert/liblsdj | ||
* http://www.littlesounddj.com | ||
-------------------------------------------------------------------------------- | ||
MIT License | ||
Copyright (c) 2018 Stijn Frishert | ||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. | ||
*/ | ||
|
||
#ifndef LSDJ_COMMON_HPP | ||
#define LSDJ_COMMON_HPP | ||
|
||
#include <string> | ||
|
||
#include "../liblsdj/error.h" | ||
#include "../liblsdj/project.h" | ||
|
||
namespace lsdj | ||
{ | ||
int handle_error(lsdj_error_t* error); | ||
bool compareCaseInsensitive(std::string str1, std::string str2); | ||
std::string constructProjectName(const lsdj_project_t* project, bool underscore); | ||
bool isHiddenFile(const std::string& str); | ||
} | ||
|
||
#endif |
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
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,57 @@ | ||
/* | ||
This file is a part of liblsdj, a C library for managing everything | ||
that has to do with LSDJ, software for writing music (chiptune) with | ||
your gameboy. For more information, see: | ||
* https://github.com/stijnfrishert/liblsdj | ||
* http://www.littlesounddj.com | ||
-------------------------------------------------------------------------------- | ||
MIT License | ||
Copyright (c) 2018 Stijn Frishert | ||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. | ||
*/ | ||
|
||
#ifndef LSDJ_CHANNEL_H | ||
#define LSDJ_CHANNEL_H | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
typedef enum | ||
{ | ||
LSDJ_PULSE1, | ||
LSDJ_PULSE2, | ||
LSDJ_WAVE, | ||
LSDJ_NOISE, | ||
} lsdj_channel_t; | ||
|
||
#define LSDJ_CHANNEL_COUNT (4) | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif | ||
|
||
#endif |
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
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
Oops, something went wrong.