Hello JUCE community,
I am very new to JUCE, so I it can be that the issue that I will report is already known and/or resolved.
But since I found nothing by searching in the net, I have no other option than asking :-)
I am planning to write a commercial plugin and I am currently evaluating frameworks. Since JUCE has a lot audio functionality, and is cross platform and has a affordable licensing model, I started the evaluation with JUCE.
First of all I found JUCE easy to understand and use. And it has a elegant object orientation inside.
To start somewhere I wanted to write a small vst plug-in that reads and plays a MIDI file.
I could get productive real fast and wrote the plugin in one day for windows. It works. All fine.
Next step was porting it to OSX. Here I had several problems compiling the code.
I could resolve them by following these instructions:
1. http://www.juce.com/forum/topic/aus-xcode
2. http://www.juce.com/forum/topic/au-under-xcode-44
Finally the VST plugin was there. I could plug it in. The GUI came up, but there was no MIDI playback.
Making some printouts I found that the MIDI information read from the file into the MidiMessageSequence results getting corrupted MIDI data.
This is what I get when I dump the MIDI event code. This does not look like valid MIDI at all.
Data: 255 3 13 66 76 49 48 48 45 49 57 56 46 77 73 68
Data: 255 84 5 96 0 0 0 0
Data: 255 81 3 9 189 89
Data: 255 88 4 4 2 24 8
Data: 12 160 95
Here is the portion of code where this happens:
File file(m_midiFileName[m_currProgram]); if(!file.exists()) return; FileInputStream fiStream(file); MidiFile midiFile; if(!midiFile.readFrom(fiStream)) { m_displayTextDiag = "Error: Nothing Loaded"; return; } if(midiFile.getNumTracks()==0) return; midiFile.convertTimestampTicksToSeconds (); MidiMessageSequence tempos; midiFile.findAllTempoEvents(tempos); m_bpmTmp = 120.0; if( tempos.getNumEvents()>0 ) { m_bpmTmp = tempos.getEventPointer(0)->message.getTempoSecondsPerQuarterNote(); m_bpmTmp = 1.0 / (m_bpmTmp /60.0); // assuming 4/4 measure } if(m_bpmTmp < 20.0) m_bpmTmp = 120.0; MidiMessageSequence m_midiMessagesTmp(*midiFile.getTrack(0)); m_midiMessagesTmp.sort(); m_changeMIDIMessages = true; for(int currMessageIndex = 0; currMessageIndex < m_midiMessagesTmp.getNumEvents(); ++currMessageIndex) { MidiMessage msgMIDI = m_midiMessagesTmp.getEventPointer(currMessageIndex)->message; const unsigned char * data = msgMIDI.getRawData(); int size = msgMIDI.getRawDataSize(); String temp = "Data: "; for(int j=0; j< size; j++) { temp = temp + String(*data) + String(" "); data++; } m_displayTextDiag = m_displayTextDiag << temp << "\n"; }
This works perfectly on windows. I do not know why it does not work in OSX. Did I forget something or did something wrong? Did I found a bug in JUCE? Or is it related to the commenting out of the
AUBase.h line 698:
// virtual OSStatus MIDIEvent( UInt32 inStatus,
// UInt32 inData1,
// UInt32 inData2,
// UInt32 inOffsetSampleFrame) { return kAudio_UnimplementedError; }
by appliying http://www.juce.com/forum/topic/au-under-xcode-44 ?
And of course much more important right now: What can I do to get it running in OSX?
I am lost a little bit in here. Next thing would be to debug into the library code or write own midi file handling. But this I would like to avoid if possible.
Any directions for me?
thank you in advance
BTW: I am using XCode 4.6.2 and Mountain Lion