Comments (2)
Something like this fixes it, but it's ugly:
diff --git tml.h tml.h
index 31a7b9b..5bbd515 100644
--- tml.h
+++ tml.h
@@ -88,8 +88,8 @@ typedef struct tml_message
// - pitch_bend for TML_PITCH_BEND messages
union
{
- struct { union { char key, control, program, channel_pressure; }; union { char velocity, key_pressure, control_value; }; };
- struct { unsigned short pitch_bend; };
+ struct { union { char key, control, program, channel_pressure; }; union { char velocity, key_pressure, control_value; }; } param;^M
+ struct { unsigned short bend; } pitch;^M
};
// The pointer to the next message in time following this event
@@ -331,7 +331,7 @@ static int tml_parsemessage(tml_message** f, struct tml_parser* p)
{
int param;
if ((param = tml_readbyte(p)) < 0) { TML_WARN("Unexpected end of file"); return -1; }
- evt->key = (param & 0x7f);
+ evt->param.key = (param & 0x7f);^M
evt->channel = (status & 0x0f);
switch (evt->type = (status & 0xf0))
{
@@ -340,17 +340,17 @@ static int tml_parsemessage(tml_message** f, struct tml_parser* p)
case TML_KEY_PRESSURE:
case TML_CONTROL_CHANGE:
if ((param = tml_readbyte(p)) < 0) { TML_WARN("Unexpected end of file"); return -1; }
- evt->velocity = (param & 0x7f);
+ evt->param.velocity = (param & 0x7f);^M
break;
case TML_PITCH_BEND:
if ((param = tml_readbyte(p)) < 0) { TML_WARN("Unexpected end of file"); return -1; }
- evt->pitch_bend = ((param & 0x7f) << 7) | evt->key;
+ evt->pitch.bend = ((param & 0x7f) << 7) | evt->param.key;^M
break;
case TML_PROGRAM_CHANGE:
case TML_CHANNEL_PRESSURE:
- evt->velocity = 0;
+ evt->param.velocity = 0;^M
break;
default: //ignore system/manufacture messages
@@ -482,7 +482,7 @@ TMLDEF int tml_get_info(tml_message* Msg, int* out_used_channels, int* out_used_
for (;Msg; Msg = Msg->next)
{
time_length = Msg->time;
- if (Msg->type == TML_PROGRAM_CHANGE && !programs[(int)Msg->program]) { programs[(int)Msg->program] = 1; used_programs++; }
+ if (Msg->type == TML_PROGRAM_CHANGE && !programs[(int)Msg->param.program]) { programs[(int)Msg->param.program] = 1; used_programs++; }^M
if (Msg->type != TML_NOTE_ON) continue;
if (time_first_note == 0xffffffff) time_first_note = time_length;
if (!channels[Msg->channel]) { channels[Msg->channel] = 1; used_channels++; }
from tinysoundfont.
I committed a "fix" for this. Not a nice solution but it seemed better than breaking the API at this point.
from tinysoundfont.
Related Issues (20)
- How many channels does this support? HOT 2
- white noise unexpected sound when playing the files HOT 2
- Stuck instrument with Windows XP onestop.mid HOT 1
- `TSF_MALLOC(...)` without non-NULL check/error handling HOT 3
- Design issue: having playback handling and soundfont in same structure incentivizes people to write memory hogs(?) HOT 3
- `tsf_set_max_voices()` should actually be enforced HOT 2
- Unicode open HOT 1
- Would be possible to sustain a note? HOT 2
- Is .sfz support something devs consider also thank you for the library HOT 6
- voices active for slightly longer than they should be
- Reading samples directly at runtime (port to STM32) HOT 1
- MIDI latency HOT 1
- Likely memory leak in use of TSF_REALLOC in new sf3 code in out of memory conditions HOT 1
- Player ending before end of music (not playing last notes)
- [Question] Loading multiple SF2 files?
- soundnames inside drumkits
- large soundfonts HOT 2
- Dynamic Voice Allocation and Immediate Cutoff Mechanism Proposal for Memory Optimization in SoundFont Library HOT 1
- Extending sfotool support with optional sample load callback. HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tinysoundfont.