Powered by Blogger.

Building JRTP in Windows

Monday, May 20, 2013

1.
- jrtp depends on jthread. Hence, we have to build jthread first.
- Download jrtplib and jthread from this link and extract it.
- Detailed video tutorial is available in the following links from the authors, thanks a lot for such a good library and help. ;-).

http://research.edm.uhasselt.be/jori/jthread_jrtplib_example_mpeg1.mpg
http://research.edm.uhasselt.be/jori/jthread_jrtplib_example_mpeg2.mpg
http://research.edm.uhasselt.be/jori/jthread_jrtplib_example.avi

2. Download and install CMake.

3.
- Open CMake.
- Set the jthread folder path as the browse source.
- Create a folder named "build" in the above folder and set build folder location in CMake to that path.
- Click 'Add entry' and add an entry named 'CMAKE_INSTALL_PREFIX', type is 'PATH', set the value to a empty folder. In my case it is 'C:/testlocal'.
- Click OK.

- Click 'Configure'.
- Click Finish.


- Click "configure" again.

- Then click "generate".

- Now you can see VS project files in the build directory.
- Open the solution with VS.
- Right click in the 'INSTALL' project and select 'Build'.

- Check whether it builds without any fails.

- Select 'Release' from the 'Solutions configuration' menu. and build the 'INSTALL' project again.
- Again check for any errors.

4.
- Now follow the same steps for the jrtplib as well.
- Make sure to set the 'CMAKE_INSTALL_PREFIX' same like before.
- Build 'INSTALL' project for both 'Debug' and 'Release' Solution configurations in VS same as before.

5.
- Now you can locate all the relevant header and library files in 'C:\testlocal'

Use RtMidi in Windows in a Microsoft Visual Studio C++ Project

Sunday, May 12, 2013

Create a "Win32 Console Application" in Visual Studio.


Name it, click OK.


Click next.


Deselect "Precompiled header" and select "Empty project", click Finish.

Add a C++ (.cpp) file, name it and click Add.


Copy the code of "midiout.cpp" from this link to your .cpp file.
Change "SLEEP" in the code to "Sleep". (Since we are using Windows)
Add "#include " at the beginning of the code.
Copy "RtMidi.cpp", "RtMidi.h" and "RtError.h" files to your project folder. You can find these files from here.

Right click on your project in VS -> Add -> Existing item.
Select and add above three files to your project.


Now your project file structure will look like this.


Add "#define __WINDOWS_MM__" line at the beginning of the "RtMidi.h" file.


Right click on your project in VS -> Properties.


Go to Configuration properties -> Linker -> Input. Add "winmm.lib" at the end of "Additional dependencies".


Click Apply and OK.

Go to Visual Studio project. Press "F7". Press "Control key + F5". Then you can see the command prompt and can hear a short beep. If so, your RtMidi now works fine. Good luck!