summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoryo mama <pepper@scannerjammer.com>2015-02-08 00:15:59 -0800
committeryo mama <pepper@scannerjammer.com>2015-02-08 00:15:59 -0800
commitda266b0cad920565e8193d8fdc6ca4f0bf660dfa (patch)
tree924ecd84851612681cc517899951fcd9b3149c38
parent3c3d53e0c88a041f9e1febfea17543f01a2ac1d5 (diff)
testing out new atomnew-atom
-rw-r--r--build/.wafpickle-linux2-34015472-98bin7546 -> 7546 bytes
-rwxr-xr-xbuild/LV2-renderbin77208 -> 77251 bytes
-rw-r--r--build/src/LV2-render.c.1.obin34960 -> 35032 bytes
-rw-r--r--build/src/midi/fluid_list.c.1.obin4280 -> 4296 bytes
-rw-r--r--build/src/midi/fluid_midi.c.1.obin27248 -> 27256 bytes
-rw-r--r--build/src/midi/midi_loader.c.1.obin2584 -> 2592 bytes
-rw-r--r--src/LV2-render.c27
-rw-r--r--src/midi/midi_loader.c3
-rw-r--r--src/midi/midi_loader.h2
9 files changed, 18 insertions, 14 deletions
diff --git a/build/.wafpickle-linux2-34015472-98 b/build/.wafpickle-linux2-34015472-98
index 919e407..2b66df7 100644
--- a/build/.wafpickle-linux2-34015472-98
+++ b/build/.wafpickle-linux2-34015472-98
Binary files differ
diff --git a/build/LV2-render b/build/LV2-render
index 9c9c647..9aa894d 100755
--- a/build/LV2-render
+++ b/build/LV2-render
Binary files differ
diff --git a/build/src/LV2-render.c.1.o b/build/src/LV2-render.c.1.o
index 7e5ce56..f264544 100644
--- a/build/src/LV2-render.c.1.o
+++ b/build/src/LV2-render.c.1.o
Binary files differ
diff --git a/build/src/midi/fluid_list.c.1.o b/build/src/midi/fluid_list.c.1.o
index e550a15..6e6fe92 100644
--- a/build/src/midi/fluid_list.c.1.o
+++ b/build/src/midi/fluid_list.c.1.o
Binary files differ
diff --git a/build/src/midi/fluid_midi.c.1.o b/build/src/midi/fluid_midi.c.1.o
index e4dd0af..7b500f0 100644
--- a/build/src/midi/fluid_midi.c.1.o
+++ b/build/src/midi/fluid_midi.c.1.o
Binary files differ
diff --git a/build/src/midi/midi_loader.c.1.o b/build/src/midi/midi_loader.c.1.o
index 1789491..d658619 100644
--- a/build/src/midi/midi_loader.c.1.o
+++ b/build/src/midi/midi_loader.c.1.o
Binary files differ
diff --git a/src/LV2-render.c b/src/LV2-render.c
index 2dd8b40..e882cd4 100644
--- a/src/LV2-render.c
+++ b/src/LV2-render.c
@@ -25,6 +25,7 @@
#include "LV2-render_internal.h"
+
#include "lv2/lv2plug.in/ns/ext/atom/atom.h"
#include "lv2/lv2plug.in/ns/ext/buf-size/buf-size.h"
#include "lv2/lv2plug.in/ns/ext/data-access/data-access.h"
@@ -130,9 +131,8 @@ SNDFILE *open_wav_file(char *output_file, float sample_rate, int nchannels, size
return outfile;
}
-int first_event = 1;
-int process_midi_cb(fluid_midi_event_t *event, size_t msecs, process_midi_ctx_t *ctx)
+int process_midi_cb(fluid_midi_event_t *event, size_t msecs, size_t msecs_since_start, process_midi_ctx_t *ctx)
{
Jalv *jalv = ctx->jalv;
float **pluginAudioIOBuffers = (float **)calloc(jalv->num_ports, sizeof(float *));
@@ -140,25 +140,29 @@ int process_midi_cb(fluid_midi_event_t *event, size_t msecs, process_midi_ctx_t
float *pluginAudioPtrs[100];
size_t pluginAudioOutputCount = 0;
size_t nframes;
-
+ size_t nframes_since_start;
+
/* convert msecs */
+ nframes_since_start = msecs_since_start * ctx->sample_rate / 1000;
nframes = msecs * ctx->sample_rate / 1000;
//TODO maybe just get rid of this stuff
//ORIGINAL-> sending to evbuf: frame: 13136896, rolling: 1.000000, calc: -1, bar: 0, beat_type: 1146875112, bpb: 1184130760, bpm: 0: need valid if: -787014688
const bool rolling = 1;
+//we don't even use this...probably should remove
uint8_t pos_buf[256];
LV2_Atom* lv2_pos = (LV2_Atom*)pos_buf;
- if (first_event) {
+ //but here, we can take out this if, right? and just send this new atom with an updated position every time? yeah
/* Build an LV2 position object to report change to plugin */
lv2_atom_forge_set_buffer(&jalv->forge, pos_buf, sizeof(pos_buf));
LV2_Atom_Forge* forge = &jalv->forge;
LV2_Atom_Forge_Frame frame;
lv2_atom_forge_object(forge, &frame, 0, jalv->urids.time_Position);
lv2_atom_forge_key(forge, jalv->urids.time_frame);
- lv2_atom_forge_long(forge, 13136896);
+ lv2_atom_forge_long(forge, nframes_since_start); //ok all good? almost, there is one more thing below with fixed nframes, and need to remove first_event ifs. ok
+
lv2_atom_forge_key(forge, jalv->urids.time_speed);
- lv2_atom_forge_float(forge, rolling ? 1.0 : 0.0);
+ lv2_atom_forge_float(forge, 1.0 );
if (jalv->opts.dump) {
char* str = sratom_to_turtle(
@@ -167,10 +171,9 @@ int process_midi_cb(fluid_midi_event_t *event, size_t msecs, process_midi_ctx_t
printf("\n## Position\n%s\n", str);
free(str);
}
- }
/* Update transport state to expected values for next cycle */
- jalv->position = 13136896 + nframes; //rolling ? pos.frame + nframes : pos.frame;
+ jalv->position = rolling ? nframes_since_start + nframes : nframes_since_start; //wait,shouldn't this just be nframes_since_start? it's how was in original jalv, o i just keep it weird FIXME seems weird to me ok so I should just build and test this? yep
jalv->bpm = 120.0; //pos.beats_per_minute;
jalv->rolling = rolling;
@@ -197,13 +200,13 @@ int process_midi_cb(fluid_midi_event_t *event, size_t msecs, process_midi_ctx_t
lv2_evbuf_reset(port->evbuf, true);
LV2_Evbuf_Iterator iter = lv2_evbuf_begin(port->evbuf);
+///i see what's going on, we only send it on the first event, we need to update it, right? looks so I don't understand &iter, 0, 0
+//but LV2_ATOM_BODY is the size? it's pointer to body of atom ok lv2_pos->size is that the size of the struct? size of body right
+//well do we ever update the position? maybe in that part that used to check whether jack transport was rolling? well original jalv send it every time there is change, and jack maybe sending it regurally, and we here send it only one to send bpm and other stuff at first time. interesting seems like this is likely the cause
- if(first_event){
- lv2_evbuf_write(
+ lv2_evbuf_write(
&iter, 0, 0,
lv2_pos->type, lv2_pos->size, LV2_ATOM_BODY(lv2_pos));
- first_event = 0;
- }
uint8_t midi_event_buffer[3];
midi_event_buffer[0] = event->type;
midi_event_buffer[1] = event->param1;
diff --git a/src/midi/midi_loader.c b/src/midi/midi_loader.c
index 98cfe21..6a22cba 100644
--- a/src/midi/midi_loader.c
+++ b/src/midi/midi_loader.c
@@ -37,11 +37,12 @@ int get_events(void *data, fluid_midi_event_t *event){
size_t current_msec;
current_msec = (player->deltatime * track->ticks);
+
nmsecs_since_last = current_msec - last_msec;
last_msec = current_msec;
//process_midi_cb execution...
- cb(event, nmsecs_since_last, ctx->callback_userdata);
+ cb(event, nmsecs_since_last, current_msec, ctx->callback_userdata);
}
void load_midi_file(char *filename, read_midi_callback callback, void *callback_userdata){
diff --git a/src/midi/midi_loader.h b/src/midi/midi_loader.h
index 5b901d6..f9030f8 100644
--- a/src/midi/midi_loader.h
+++ b/src/midi/midi_loader.h
@@ -17,7 +17,7 @@ typedef struct event_table_t{
size_t nframes_since_last;
} event_table_t;
-typedef void(*read_midi_callback)(fluid_midi_event_t *event, size_t msecs_since_last, void *userdata);
+typedef void(*read_midi_callback)(fluid_midi_event_t *event, size_t msecs_since_last, size_t msecs_since_start, void *userdata);
typedef struct read_midi_ctx_t {
fluid_player_t *player;