Midi, record, ui...

Oct 21, 2010 at 11:21 AM

Hi.

Is it possible to get OnRecord event or add some UI (new Form() brings new not integrated window:( ) to the plugin?

Actually i do need to write Export plugin and do export all midi notes to my custom format.

Coordinator
Oct 21, 2010 at 11:28 AM

The plugin has no notion whether the host is recording or not.

VST has an indication if the midi event is real time (played life by a mucisian) or not (played back from a track), but that flag is not implemented in VST.NET.

Can you explain a little further what it is you want to accomplish?

Oct 21, 2010 at 11:42 AM

My problem is very simple: i need to export all midi notes to my file when user press 'Export button'.

The format is: <NOTE_NO> <TIME_IN_MS_FROM_START_OR_DIFFERENCE_FROM_PRIOR_NOTE> <NOTE_LENGTH>

I have already found IVstPluginEditor and figgured out how to add 'export' button.

Now i do need to get absolute note position from start.

The best way is to export all notes when user press export button as fast as possible (offline, i mean i dont want to wait 4 minutes (track length))

 


 

Oct 21, 2010 at 11:43 AM

It is possible to get all notes and theirs positions and lengths?

Coordinator
Oct 21, 2010 at 11:44 AM
Edited Oct 21, 2010 at 11:52 AM

I'm sorry, VST.NET does not support the offline processing of the VST spec. (I'm not sure that VST Offline processing would enable what you're trying to do.)

Please create an item on the Issues list and get people to vote for it.

Oct 21, 2010 at 11:51 AM

Ok. Np.

MessageBox.Show(midiEvent.NoteLength.ToString());

NoteLength, Offset is allways equals to zero. Why?

Coordinator
Oct 21, 2010 at 11:55 AM
Edited Oct 21, 2010 at 11:57 AM

Its the offset from the current time-slice that is being processed.

The delta offset is coupled to the samplerate/blocksize of the audio processing. This is why you often see a dummy audio processor in midi plugins: Its a good place to call ProcessEvents on the host (output midi) but also to keep track of absolute time. All midi event offset values are relative to the timeslice that is represented by samplerate and the buffer size that is passed to Process of the AudioProcessor.

NoteLength shouldn't be zero.

Hope it helps.

Oct 21, 2010 at 12:07 PM

The code is:
public
void Process(VstEventCollection events) { foreach (VstEvent evnt in events) { if (evnt.EventType == VstEventTypes.MidiEvent) { VstMidiEvent midiEvent = (VstMidiEvent)evnt; if ((midiEvent.Data[0] & 0xF0) == 0x80) { _plugin.SampleManager.ProcessNoteOffEvent(midiEvent.Data[1]); } if ((midiEvent.Data[0] & 0xF0) == 0x90) { if (midiEvent.Data[2] == 0) { _plugin.SampleManager.ProcessNoteOffEvent(midiEvent.Data[1]); } else { _plugin.SampleManager.ProcessNoteOnEvent(midiEvent.Data[1]); string note = string.Format("L: {0}, O: {1}, V: {2}, DF: {3}", midiEvent.NoteLength, midiEvent.NoteOffset, midiEvent.NoteOffVelocity, midiEvent.DeltaFrames); string data = string.Format("0: '{0}', 1: {1}, 2: {2}, 3: {3}", midiEvent.Data[0], midiEvent.Data[1], midiEvent.Data[2], midiEvent.Data[3]); _plugin.Editor.SetText(note); _plugin.Editor.SetText2(data); } } } }

The results is: http://img842.imageshack.us/img842/4198/vstnetmidibug.png

Second label is midiEvent.Data.

The first one is Length, Offset, Velocity, DeltaFrames all is zero.

Coordinator
Oct 22, 2010 at 6:46 AM

Ok. I had to look this up again. Disregard my previous comments about NoteLength.

NoteLength and NoteOffset are not always filled. Some hosts fill them out when playing midi from a track (NoteLength requires a forward lookup) but not all. So these can be zero.

Only DeltaFrames should be filled (and can be zero) to indicate the number of sample frames into the current time slice of audio processing.
I can see no errors in the marshalling code, so if this remains zero (with rapid changing notes for instance) it is possible the host is not filling them properly.
You can also increase the buffer size to see if the midi events receive a DeltaFrames value. Otherwise try your plugin on a different host.

Hope it helps.
Marc.

Oct 29, 2010 at 9:04 AM

Hi.

I have tried to make bug report but there PPL is fucking twisted inside Image Line.

I was unable to Bug Report bcs iam not a customer, even can read forum messages.

Oct 29, 2010 at 9:26 AM

Delta Frames also is empty.

Are you sure this is FL Studio related problem?

Which host i can try for sure?

Coordinator
Oct 29, 2010 at 10:19 AM

You could try this free host. Its the one that I use for all my testing.

http://www.hermannseib.com/english/vsthost.htm

Hope it helps.
Marc 

Oct 29, 2010 at 10:44 AM

Yes. I have tried VSTHost but with no results.

DeltaFrames is filled but NoteLength and etc is not filled.

Coordinator
Oct 29, 2010 at 10:55 AM

Like I said earlier, NoteLength etc are optional fields...

So if DeltraFrames is filled, I say it works.

You must calculate the note length yourself by keeping track of the number of sample frames (x sample rate) across multiple calls to Process on the AudioProcessor.

 

Hope it helps.
Marc 

Oct 29, 2010 at 8:07 PM

Ok.

How to catch OnPlay event?

Coordinator
Oct 30, 2010 at 8:35 AM
Edited Oct 30, 2010 at 8:36 AM

The closest thing to an OnPlay event is the StartProcess method being called.

The sequence goes something like this.

[plugin.Open]

plugin.Resume

plugin.StartProcess

plugin.Process (audio) called repeaditly

plugin.StopProcess

plugin.Suspend

[plugin.Close]

Note that Suspend/Resume can be called multiple times.

Hope it helps.
Marc