fix vst3 note off, added calloc and exported all stdc functions in web

This commit is contained in:
Stefano D'Angelo 2024-02-08 15:53:17 +01:00
parent 219f36352e
commit 85fc4bbc53
4 changed files with 19 additions and 1 deletions

View File

@ -613,7 +613,7 @@ static Steinberg_tresult pluginProcess(void* thisInterface, struct Steinberg_Vst
break;
case Steinberg_Vst_Event_EventTypes_kNoteOffEvent:
{
const uint8_t data[3] = { 0x90 | ev.Steinberg_Vst_Event_noteOff.channel, ev.Steinberg_Vst_Event_noteOff.pitch, (uint8_t)(127.f * ev.Steinberg_Vst_Event_noteOff.velocity) };
const uint8_t data[3] = { 0x80 | ev.Steinberg_Vst_Event_noteOff.channel, ev.Steinberg_Vst_Event_noteOff.pitch, (uint8_t)(127.f * ev.Steinberg_Vst_Event_noteOff.velocity) };
plugin_midi_msg_in(&p->p, midiInIndex[ev.busIndex], data);
}
break;

View File

@ -16,6 +16,11 @@ LDFLAGS_ALL = \
-Wl,--lto-O3 \
-Wl,-strip-all \
-Wl,--export-table \
-Wl,--export=malloc \
-Wl,--export=realloc \
-Wl,--export=calloc \
-Wl,--export=free \
-Wl,--export=memset \
-Wl,--export=processor_new \
-Wl,--export=processor_free \
-Wl,--export=processor_get_x_buf \

View File

@ -5,6 +5,7 @@
#include "walloc.h"
#include <stdint.h>
#include "memset.h"
extern unsigned char __heap_base;
@ -109,6 +110,17 @@ void *realloc(void *ptr, size_t size) {
return p;
}
void *calloc(size_t nmemb, size_t size) {
if (nmemb == 0 || SIZE_MAX / nmemb > size || (SIZE_MAX / nmemb == size && SIZE_MAX % nmemb != 0))
return NULL;
size_t s = nmemb * size;
void *m = malloc(s);
if (m == NULL)
return NULL;
memset(m, 0, s);
return m;
}
void free(void *ptr) {
header *h = (header *)((char *)ptr - sizeof(header));
h->free = 1;

View File

@ -13,6 +13,7 @@ extern "C" {
void *malloc(size_t size);
void *realloc(void *ptr, size_t size);
void *calloc(size_t nmemb, size_t size);
void free(void *ptr);
#ifdef __cplusplus