pax_global_header00006660000000000000000000000064136771771640014535gustar00rootroot0000000000000052 comment=e871f691b178554c0f9230c08ad2347dd88ec319 mcpdisp-mcpdisp-0.1.2/000077500000000000000000000000001367717716400146315ustar00rootroot00000000000000mcpdisp-mcpdisp-0.1.2/.gitignore000066400000000000000000000000771367717716400166250ustar00rootroot00000000000000# files we don't want git to play with *~ src/*~ build build/* mcpdisp-mcpdisp-0.1.2/AUTHORS000066400000000000000000000002031367717716400156740ustar00rootroot00000000000000Authors: Len Ovens Copyright: Len Ovens 2020 Translators: - French: Olivier Humbert mcpdisp-mcpdisp-0.1.2/COPYING000066400000000000000000000432541367717716400156740ustar00rootroot00000000000000 GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Lesser General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. mcpdisp-mcpdisp-0.1.2/INSTALL000066400000000000000000000007531367717716400156670ustar00rootroot00000000000000Instalation instructions: The build system is meson (if you do not already have meson and ninja installed, do that first). This repository builds mcpdisp. Dependencies are JACK Audio Connection Kit and FLTK. For many Linux distros this means installing libfltk1.3-dev and libjack-jackd2-dev (or the jackd1 equivalent if using jackd1) meson build --prefix=/usr cd build && ninja sudo ninja install If installed as above, mcpdisp can be removed from the system with: sudo ninja uninstall mcpdisp-mcpdisp-0.1.2/README.md000066400000000000000000000016351367717716400161150ustar00rootroot00000000000000# mcpdisp Mackie Control Protocol Display Program. mcpdisp presents a jack midi port that will accept mackie control protocol display messages that would normally appear on the surface "scribble strip" and displays them on the screen. The strip LEDs and meters are displayed as well. If -m is added to the command line, Global or Master displays are added. - The two charactor Assign display - The Timecode display (optional with -t) - When -t is not used the same space shows other button states. -x and -y allow the starting position of the window to be set. - I have noticed that if either -x or -y are out of bounds the window will end up on the left display with dual monitors. -y -1 does not work as expected (negative numbers all seem to be the same as 1). This is handy for devices such as the BCF2000 or midikb that have no display of their own. Home page: http://www.ovenwerks.net/software/mcpdisp.html mcpdisp-mcpdisp-0.1.2/changelog000066400000000000000000000047111367717716400165060ustar00rootroot00000000000000mcpdisp v 0.1.2 force no optimization which causes crash fix text for --version added french to desktop file mcpdisp v 0.1.1 add a man page fix licencing issues add alert dialog if jack is not running mcpdisp v 0.1.0 moved to meson build system for easier distribution mcpdisp (0.0.7) unreleased * Timeout Peak indication so it doesn't remain forever. * Fix timecode initialization bug. * Renamed out port to _thru to give better user info. * Lowered Cpu usage. * Added -s param for small display. * Made size variable. * Split display to per strip. mcpdisp (0.0.6) * Added -x and -y command line arguments for window placement. * Updated README.md to add above change. * Updated INSTALL file to add reference to fltk depends. * Accept sysex version of time as well (not tested). * Added extender desktop file. * Fix a bug where some midi events may be skipped or mutilated. * Changed port names to match client name. * Add a Thru port so only one input needs to connected to daw. * Release version 0.0.6 mcpdisp (0.0.5) * Fixed INSTALL file for no mcpdisp.sh. * Added Assign display. * Added timecode/beats display. * Added Strip meters. * Added command line parameters for help, version, master and time. * Made window title more descriptive. * jack client name shows mcpdisp-ext if no -m * Clean up source... again. * Remove extra processing of unused CC signals. * Start work on global buttons, moved SMPT/beats out of real time. * Finished Transport LEDs and flip, assign and View LEDs. * Set MIDI in port to type Terminal. * Set Display in to accept whole display of text at a time. * Move midi parsing out of real time. * Only update time/beats when new time/beat data comes in. * Release 0.0.5 mcpdisp (0.0.4) * Moved from c to c++ to work with GUI. * Cleaned up white space. * Added GUI window with top two lines. * brought GUI to current text functionality. * Make window name match jack port. mcpdisp (0.0.3) * Increase buffer for text x4 * Removed buffer full warnings for now. * Put a description in the README file. mcpdisp (0.0.2) * Added fflush so we don't use repeating prinfs to flush * Added command to park cursor in lower right corner * Hide cursor! * Set application to start in the lower right screen corner * Control C now exits gracefully * Added changelog * Window close (X) closes jack port properly mcpdisp (0.0.1) * Initial release mcpdisp-mcpdisp-0.1.2/mcpdisp.1000066400000000000000000000023541367717716400163560ustar00rootroot00000000000000.TH MCPDISP 1 .SH NAME mcpdisp \- provide a mackie control display panel .SH SYNOPSIS .B mcpdisp [\fB\-hmtsV\fR] [\fB\-x\fR \fIx\fR] [\fB\-y\fR \fIy\fR] .SH DESCRIPTION .B mcpdisp Mackie Control Protocol Display Program. Mcpdisp presents a jack midi port that will accept mackie control protocol display messages that would normally appear on the surface "scribble strip" and displays them on the screen. The strip LEDs and meters are displayed as well. Mcpdisp also provides a through midi port to connect back to the controller. This is handy for devices such as the BCF2000 or midikb that have no display of their own. .PP A jack server must be running before mcpdisp is started or mcpdisp will fail. .SH OPTIONS .TP .BR \-h ", " \-\-help Show usage text .BR \-m ", " \-\-master Show master portion of display .BR \-s ", " \-\-small Make it smaller (for low resolution screens) .BR \-t ", " \-\-time Show Clock. This shows the time code or beats and bars information. (only works with master enabled) .BR \-V ", " \-\-version Show the version od mcpdisp and exit .BR \-x \fIX-POSITION\fR Number of pixels from the left to place mcpdisp .BR \-y \fIY-POSITION\fR Number of pixels from the top to place mcpdisp .SH AUTHOR Len Ovens mcpdisp-mcpdisp-0.1.2/meson.build000066400000000000000000000011771367717716400170010ustar00rootroot00000000000000project('mcpdisp', 'c', 'cpp', version : '0.1.2', license : 'GPL-2+') add_project_arguments('-DVERSION="0.1.2"', language : 'cpp') jackdep = dependency('jack') cc = meson.get_compiler('c') fltkdep = cc.find_library('fltk', required: true) executable('mcpdisp', sources: ['src/mcpdisp.cc'], cpp_args : '-O0', dependencies: [fltkdep, jackdep], install: true, ) install_data(['src/mcpdisp.desktop', 'src/mcpdisp-ext.desktop'], install_dir : get_option('datadir') / 'applications') install_data('src/mcpdisp.svg', install_dir : get_option('datadir') / 'icons/hicolor/scalable/apps') install_man('mcpdisp.1') mcpdisp-mcpdisp-0.1.2/src/000077500000000000000000000000001367717716400154205ustar00rootroot00000000000000mcpdisp-mcpdisp-0.1.2/src/mcpdisp-ext.desktop000066400000000000000000000003061367717716400212470ustar00rootroot00000000000000[Desktop Entry] Type=Application Name=mcpdisp-ext GenericName=mcpdisp-ext Comment=Mackie Control Surface Emulator extender Icon=mcpdisp Exec=mcpdisp Terminal=false Categories=AudioVideo;Audio;Midi; mcpdisp-mcpdisp-0.1.2/src/mcpdisp.cc000066400000000000000000000571741367717716400174040ustar00rootroot00000000000000/* * Copyright (C) 2015 - 2020 Len Ovens * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301, USA. * */ #include #include #include #include //Jack includes #include #include #include //fltk includes #include #include #include #include #include #include #include using namespace std; jack_client_t *client; // only need input to display things jack_port_t *input_port; // well, lets add a thru port to feed the surface jack_port_t *thru_port; // need ring buffer to go from real time to not jack_ringbuffer_t *midibuffer = 0; // state globals bool master (false); bool shotime (false); unsigned int siz (3); // text globals char line1_in[57]; char line2_in[57]; char disp2_in[3]; char time1_in[14]; char tm_bt; char midichunk[120]; class ChLed : public Fl_Pack { private: int wx, wy; Fl_Output *led_R; Fl_Output *led_S; Fl_Output *led_M; Fl_Output *led_W; Fl_Box *space; public: ChLed(int wx, int wy) : Fl_Pack(wx, wy, siz * 23, siz * 7, "") { color(57); type(Fl_Pack::HORIZONTAL); begin(); space = new Fl_Box (0, 0, siz + 1, siz * 7, ""); space->color (56); led_R = new Fl_Output (0, 0, siz * 5, siz * 7, ""); led_R->color(57); led_S = new Fl_Output (0, 0, siz * 5, siz * 7, ""); led_S->color(57); led_M = new Fl_Output (0, 0, siz * 5, siz * 7, ""); led_M->color(57); led_W = new Fl_Output (0, 0, siz * 5, siz * 7, ""); led_W->color(57); led_W->textcolor (FL_RED); end(); show(); } // turn record enable LED on/off void rec (bool rst) { if (rst == true) { led_R->color(FL_RED); } else { led_R->color(57); } led_R->redraw(); } // turn solo LED on/off void sol (bool sst) { if (sst == true) { led_S->color(FL_GREEN); } else { led_S->color(57); } led_S->redraw(); } // Turn mute LED on/off void mute (bool mst) { if (mst == true) { led_M->color(FL_YELLOW); } else { led_M->color(57); } led_M->redraw(); } // Turn Selected LED on/off void sel (bool sest) { if (sest == true) { led_W->color(FL_WHITE); } else { led_W->color(57); } led_W->redraw(); } // Set or unset peak detected void peak (bool pk) { if (pk == true) { led_W->value("*"); } else { led_W->value(" "); } led_W->redraw(); } }; // channel combines a channel LED pack with a meter and chanel display class Chan : public Fl_Pack { private: int wx, wy; int loopcount = 0; char old_lv; Fl_Progress *meter; Fl_Output *top_disp; Fl_Output *low_disp; ChLed *chled; public: Chan(int wx, int wy) : Fl_Pack(wx, wy, siz * 23, siz * 8, "") { color(57); begin(); top_disp = new Fl_Output (0, 0, siz * 23, siz * 7, ""); top_disp->color(57); top_disp->textfont(4); top_disp->textcolor(181); top_disp->textsize(siz * 5); low_disp = new Fl_Output (0, 0, siz * 23, siz * 7, ""); low_disp->color(57); low_disp->textfont(4); low_disp->textcolor(181); low_disp->textsize(siz * 5); chled = new ChLed(0, 0); chled->color(57); // do I need this? meter = new Fl_Progress(0, 0, siz * 20, siz * 4, ""); meter->color(57); meter->maximum(12.0); meter->minimum(0.0); meter->value(12.0); old_lv = 12; end(); show(); } void top (char* line) { top_disp->value(line); } void low (char* line) { low_disp->value(line); } // these just map chled stuff straight through void rec (bool rst) {chled->rec(rst);} void sol (bool sst) {chled->sol(sst);} void mute (bool mst) {chled->mute(mst);} void sel (bool sest) {chled->sel(sest);} void peak (bool pk) {chled->peak(pk);} // This sets the meter level void level (char lv) { if (lv >= old_lv) { if (lv < 13) { meter->value((float) lv); old_lv = lv; } } else { decr(); } } // This decrements the meter to provide fall off void decr (void) { if (old_lv) { if (++loopcount > 10) { loopcount = 0; if (old_lv > 0) { old_lv--; } meter->value((float) old_lv); if (!old_lv) { peak (false); } } } } }; // transport class Transport : public Fl_Pack { private: int wx, wy; Fl_Output *RW; Fl_Output *FF; Fl_Output *Stop; Fl_Output *Play; Fl_Output *Rec; Fl_Output *Solo; Fl_Output *Assign; Fl_Output *Flip; Fl_Output *View; public: Transport(int wx, int wy) : Fl_Pack(wx, wy, siz * 83, siz * 10, "") { color(57); type(Fl_Pack::HORIZONTAL); begin(); RW = new Fl_Output(1, 1, siz * 8, siz * 10, ""); RW->color(58); RW->textsize(siz * 6); RW->textcolor(57); RW->value("◂◂"); FF = new Fl_Output(0, 1, siz * 8, siz * 10, ""); FF->color(58); FF->textsize(siz * 6); FF->textcolor(57); FF->value("▸▸"); Stop = new Fl_Output(0, 1, siz * 8, siz * 10, ""); Stop->color(58); Stop->textsize(siz * 6); Stop->textcolor(57); Stop->value("■"); Play = new Fl_Output(0, 1, siz * 8, siz * 10, ""); Play->color(58); Play->textsize(siz * 6); Play->textcolor(57); Play->value("▶"); Rec = new Fl_Output(0, 1, siz * 8, siz * 10, ""); Rec->color(105); Rec->textsize(siz * 5); Rec->textcolor(106); Rec->value("⬤"); Solo = new Fl_Output(0, 1, siz * 17, siz * 10, ""); Solo->color(105); Solo->textsize(siz * 6); Solo->textcolor(106); Solo->value("Solo"); Assign = new Fl_Output(0, 1, siz * 38, siz * 10, ""); Assign->color(58); Assign->textsize(siz * 6); Assign->textcolor(61); Assign->value(""); Flip = new Fl_Output(0, 1, siz * 14, siz * 10, ""); Flip->color(58); Flip->textsize(siz * 6); Flip->textcolor(57); Flip->value("Flip"); View = new Fl_Output(0, 1, siz * 17, siz * 10, ""); View->color(58); View->textsize(siz * 6); View->textcolor(57); View->value("View"); end(); show(); } // turn record enable LED on/off void rec (bool rst) { if (rst == true) { Rec->textcolor(1); } else { Rec->textcolor(106); } Rec->redraw(); } // turn SOLO warning LED on/off void solo (bool rst) { if (rst == true) { Solo->textcolor(1); } else { Solo->textcolor(106); } Solo->redraw(); } // turn RW LED on/off void rw (bool rst) { if (rst == true) { RW->textcolor(61); } else { RW->textcolor(57); } RW->redraw(); } // turn FF LED on/off void ff (bool rst) { if (rst == true) { FF->textcolor(61); } else { FF->textcolor(57); } FF->redraw(); } // turn Stop LED on/off void stop (bool rst) { if (rst == true) { Stop->textcolor(61); } else { Stop->textcolor(57); } Stop->redraw(); } // turn Play LED on/off void play (bool rst) { if (rst == true) { Play->textcolor(61); } else { Play->textcolor(57); } Play->redraw(); } // turn Flip LED on/off void flip (bool rst) { if (rst == true) { Flip->textcolor(61); } else { Flip->textcolor(57); } Flip->redraw(); } // turn View LED on/off void view (bool rst) { if (rst == true) { View->textcolor(61); } else { View->textcolor(57); } View->redraw(); } // Set vpot assignment -> track void track (bool pk) { if (pk == true) { Assign->value(" Track"); } Assign->redraw(); } // Set vpot assignment -> send void send (bool pk) { if (pk == true) { Assign->value(" Send"); } Assign->redraw(); } // Set vpot assignment -> pan void pan (bool pk) { if (pk == true) { Assign->value(" Pan"); } Assign->redraw(); } // Set vpot assignment -> plugin void plug (bool pk) { if (pk == true) { Assign->value(" Plugin"); } Assign->redraw(); } // Set vpot assignment -> EQ void eq (bool pk) { if (pk == true) { Assign->value(" EQ"); } Assign->redraw(); } // Set vpot assignment -> Instrument void inst (bool pk) { if (pk == true) { Assign->value("Instrument"); } Assign->redraw(); } }; static int usage() { printf( "mcpdisp Version %s\n" "Usage: mcpdisp [options]\n" " Options are as follows:\n" " -h, --help Show this help text\n" " -m, --master Show master portion of display\n" " -t, --time Show Clock if master enabled\n" " -s, --small Make it smaller\n" " -x Place mcpdisp at x position\n" " -y place mcpdisp at y position\n" " -V, --version Show version information\n\n" , VERSION); return 0; } // Jack RT process function int process(jack_nframes_t nframes, void *arg) { uint i; char sendstring[127]; void* port_buf = jack_port_get_buffer(input_port, nframes); void* thru_buf = jack_port_get_buffer(thru_port, nframes); unsigned char* buffer; jack_midi_clear_buffer(thru_buf); jack_midi_event_t in_event; jack_nframes_t event_count = jack_midi_get_event_count(port_buf); if(event_count > 0) { for(i=0; i in_event.size) { sendstring[0] = in_event.size; memcpy (&sendstring[1], in_event.buffer, in_event.size); unsigned int written = jack_ringbuffer_write( midibuffer, (const char*) sendstring, in_event.size + 1); if (written != in_event.size + 1) { // only for debug //cout << "ERROR! Partial midibuffer write\n"; } } else { // only for debug // cout << "midibuffer full skipping\n"; } memcpy (buffer, in_event.buffer, in_event.size); } } return 0; } // Clean up if someone closes the window void close_cb(Fl_Widget*, void*) { printf("Killing child processes..\n"); jack_port_unregister(client, input_port); jack_port_unregister(client, thru_port); jack_deactivate(client); jack_ringbuffer_free(midibuffer); jack_client_close(client); printf("Done.\n"); exit(0); } /* Allow SIGTERM to cause graceful termination */ /* I don't know which of these are actually needed, but it ends nice */ void on_term(int signum) { jack_port_unregister(client, input_port); jack_port_unregister(client, thru_port); jack_deactivate(client); jack_ringbuffer_free(midibuffer); jack_client_close(client); exit(0); return; } void jack_shutdown(void *arg) { exit(1); } int main(int argc, char** argv) { char jackname[16]; int winsz; int win_x = 2000; // default to lower right corner of a single screen int win_y = 1000; bool help (false); bool version (false); line1_in[56] = 0x00; line2_in[56] = 0x00; disp2_in[2] = 0x00; time1_in[13] = 0x00; // strcpy(time1_in, "000|00| 0|000"); strcpy(time1_in, " "); tm_bt = '|'; Chan *chan[8]; char wname[64]; Transport *transport; struct option options[] = { { "help", no_argument, 0, 'h' }, { "master", no_argument, 0, 'm' }, { "time", no_argument, 0, 't' }, { "small", no_argument, 0, 's' }, { "xpos", required_argument, 0, 'x' }, { "ypos", required_argument, 0, 'y' }, { "version", no_argument, 0, 'V' }, }; while (1) { int c, option_index = 0; c = getopt_long (argc, argv, "hmtsx:y:V", options, &option_index); if (c == -1) break; switch (c) { case 'h': help = true; break; case 'm': master = true; break; case 't': shotime = true; break; case 's': siz = 2; break; case 'x': if (optarg) { win_x = stoi(strdup(optarg), 0, 10); } else { usage(); return -1; } break; case 'y': if (optarg) { win_y = stoi(strdup(optarg), 0, 10); } else { usage(); return -1; } break; case 'V': version = true; break; default: usage(); return -1; } } Fl_Output disp2(siz * 184, 0, siz * 20, siz * 14, ""); Fl_Output time1(siz * 204, 0, siz * 110,siz * 14, ""); if (help) { return usage(); } if (version) { printf("mcpdisp Version %s\n\n", VERSION); return 0; } if(!master) { // if we are not showing master, can't show time either shotime = false; strcpy(jackname, "mcpdisp-ext"); // use different name when extender } else { strcpy(jackname, "mcpdisp"); } if ((client = jack_client_open (jackname, JackNoStartServer, NULL)) == 0) { std::cout << "Jack server not running?" << std::endl; fl_alert ("Jack server not found. Jackd must be running before starting mcpdisp."); return 1; } jack_set_process_callback (client, process, 0); jack_on_shutdown (client, jack_shutdown, 0); char *jname = jack_get_client_name (client); char pname[16]; strcpy (pname, jname); strcat (pname, "_in"); input_port = jack_port_register (client, pname, JACK_DEFAULT_MIDI_TYPE, (JackPortIsInput | JackPortIsTerminal | JackPortIsPhysical), 0); strcpy (pname, jname); strcat (pname, "_thru"); thru_port = jack_port_register (client, pname, JACK_DEFAULT_MIDI_TYPE, JackPortIsOutput, 0); /* set up midi buffer */ midibuffer = jack_ringbuffer_create( 16384 ); int res = jack_ringbuffer_mlock(midibuffer); if ( res ) { std::cout << "Error locking midi memory!\n"; return -1; } if (jack_activate (client)) { std::cout << "Error cannot activate client\n"; return 1; } /* try to end nice on anything one of these makes window close work */ signal(SIGTERM, on_term); signal(SIGINT, on_term); signal(SIGPIPE, on_term); signal(SIGHUP, on_term); signal(SIGQUIT, on_term); signal(SIGKILL, on_term); signal(SIGABRT, on_term); strcpy (wname,"Mackie Control Display Emulator - "); // add jack port name to window title strcat (wname, jname); // lets make a window if(master) { winsz = siz * 314; } else { winsz = siz * 184; } Fl_Window win (win_x, win_y, winsz, siz * 25, wname); win.callback(close_cb); win.color(56); win.begin(); for ( int x=0; x < 8; x++) { Chan *led = new Chan((x * siz * 23), 0); chan[x] = led; } if(master) { // Two char display win.add(disp2); disp2.color(64); disp2.textfont(5); disp2.textcolor(88); disp2.textsize(siz * 14 - 1); disp2.value(disp2_in); transport = new Transport(siz * 186, siz * 14); if(shotime) { // timecode/bar display win.add(time1); time1.color(64); time1.textfont(5); time1.textcolor(88); time1.textsize(siz * 14 - 1); time1.value(time1_in); } else { // stuff that only shows when time doesn't } } win.end(); win.show (); /* run until interrupted */ while(1) { // .03 gives about the right delay for // meters to go from FS to 0 in 1.8 seconds // but we now count to 100 so we can run this loop more often Fl::wait(.003); // need to make sure we get all the the midi events int availableMidi (1); while (availableMidi) { // make sure there is at least one byte available availableMidi = jack_ringbuffer_read_space(midibuffer); if( availableMidi > 0 ) { char bytes (0); // just peek at it in case read space is < bytes int read = jack_ringbuffer_peek(midibuffer, &bytes, 1 ); if (read) { // this is painful need to make function calls for each event type availableMidi = jack_ringbuffer_read_space(midibuffer); if( availableMidi >= bytes ) { // first read one byte to to set pointer then read data int read = jack_ringbuffer_read(midibuffer, &bytes, 1 ); read = jack_ringbuffer_read(midibuffer, (char*)midichunk, bytes); if (read == bytes) { // parse events next switch ((unsigned char) midichunk[0]) { case 0xf0: if (midichunk[5] == 0x12) { // display stuff (should be a function) bool line1 = false; bool line2 = false; int offset = midichunk[6]; if (offset < 56) { if ((bytes - 8 + offset) < 57) { memcpy(&line1_in[offset], &midichunk[7], bytes - 8); line1 = true; } else { memcpy(&line1_in[offset], &midichunk[7], 56 - offset); line1 = true; memcpy(&line2_in[0], &midichunk[7 + (55 - offset)], bytes - (56 - offset)); line2 = true; } } else { offset = offset - 56; if ((bytes - 8 + offset) < 57) { memcpy(&line2_in[offset], &midichunk[7], bytes - 8); line2 = true; } else { memcpy(&line2_in[offset], &midichunk[7], 56 - offset); line2 = true; } } if (line1) { for ( int x=0; x < 8; x++) { char text[8]; memcpy (text, &line1_in[x * 7], 7); text[7] = 0x00; chan[x]->top(text); } } if (line2) { for ( int x=0; x < 8; x++) { char text[8]; memcpy (text, &line2_in[x * 7], 7); text[7] = 0x00; chan[x]->low(text); } } } else if (midichunk[5] == 0x10) { // time code all at once Should be a function int p = 12; for (int i = 6; i < 16; i++) { time1_in[p] = midichunk[i] & 0x03; if (time1_in[p] == 0x00) { time1_in[p] = 0x20; } if (p == 10 || p == 7 || p == 4) { // skip position 9,6 and 3 p--; } p--; } } break; case 0x90: // now display "Lamps" //these are button events (make function) if( midichunk[1] < 8 ) { if (midichunk[2] == 0) { chan[(int) midichunk[1]]->rec(false); } else { chan[(int)midichunk[1]]->rec(true); } } else if ( midichunk[1] < 16 ) { /* Lamps 8 - 15 are PFL (Solo?) buttons */ if (midichunk[2] == 0) { chan[(int) midichunk[1] - 8]->sol(false); } else { chan[(int) midichunk[1] - 8]->sol(true); } } else if ( midichunk[1] < 24 ) { /* Lamps 16 - 23 are Mute buttons */ if (midichunk[2] == 0) { chan[(int) midichunk[1] - 16]->mute(false); } else { chan[(int) midichunk[1] - 16]->mute(true); } } else if ( midichunk[1] < 32 ) { /* Lamps 24 - 31 are channel select indicators */ if (midichunk[2] == 0) { chan[(int) midichunk[1] - 24]->sel(false); } else { chan[(int) midichunk[1] - 24]->sel(true); } } else if (master) { // anything else is a master switch ((unsigned char) midichunk[1]) { case 0x5b: // rewind «⏪ transport->rw(midichunk[2]); break; case 0x5c: // fwd »⏩ transport->ff(midichunk[2]); break; case 0x5d: transport->stop(midichunk[2]); // stop∎■⬛ break; case 0x5e: // play‣▶ transport->play(midichunk[2]); break; case 0x5f: // master record enable transport->rec(midichunk[2]); break; case 0x73: transport->solo(midichunk[2]); // solo break; case 0x32: transport->flip(midichunk[2]); // Flip break; case 0x33: // global view transport->view(midichunk[2]); break; case 0x28: // track (Trim) transport->track(midichunk[2]); break; case 0x29: // Send transport->send(midichunk[2]); break; case 0x2a: // Pan transport->pan(midichunk[2]); break; case 0x2b: // Plug-in transport->plug(midichunk[2]); break; case 0x2c: // EQ transport->eq(midichunk[2]); break; case 0x2d: // Instrument transport->inst(midichunk[2]); break; // these next two are really shotime only, but don't hurt anything case 0x72: // time display is time if(midichunk[2] == 0) tm_bt = ':'; break; case 0x71: // time display is beats and bars if(midichunk[2] == 0) tm_bt = '|'; break; default: break; } if (!shotime) { // if time is off we have room for more lamps // some day I might even add them :) switch ((int) midichunk[1]) { case 0x4a: // read/off case 0x4b: // write case 0x4c: // trim (not trim pot) case 0x4d: // touch case 0x4e: // latch case 0x4f: // group case 0x50: //save case 0x51: // undo case 0x54: // marker case 0x55: // nudge case 0x56: // cycle case 0x57: // drop case 0x58: // replace case 0x59: // click case 0x64: // zoom case 0x65: // scrub default: break; } } } break; case 0xd0: // this is meters (make function) int chm; // meter channel int mval; // meter value // divide into chm and mval mval = midichunk[1] & 0x0f; chm = midichunk[1] >> 4; if (mval == 0x0e) { chan[(int)chm]->peak(true); chan[(int)chm]->level(0x0c); } else if (mval == 0x0f) { chan[(int)chm]->peak(false); } else { chan[(int)chm]->level(mval); } break; case 0xb0: // make function if (master) { // timecode if (midichunk[1] & 0x40) { char data1 = 0x20; if( midichunk[2] < 0x20 ) { data1 = midichunk[2] + 0x40; // cludge because some DAWs send @ instead of space if(data1 == 0x40) data1 = 0x20; } else { data1 = midichunk[2]; } switch (midichunk[1]) { case 0x4b: // left assign char disp2_in[0] = data1; disp2.value(disp2_in); break; case 0x4a: // left assign char disp2_in[1] = data1; disp2.value(disp2_in); break; // timecode stuff, should maybe not be checked // for if not used, if time turned off, no data sent. case 0x49: // time digit 10 (msb) time1_in[0] = data1; break; case 0x48: // time digit 9 time1_in[1] = data1; break; case 0x47: // time digit 8 time1_in[2] = data1; break; case 0x46: // time digit 7 time1_in[4] = data1; break; case 0x45: // time digit 6 time1_in[5] = data1; break; case 0x44: // time digit 5 time1_in[7] = data1; break; case 0x43: // time digit 4 time1_in[8] = data1; break; case 0x42: // time digit 3 time1_in[10] = data1; break; case 0x41: // time digit 2 time1_in[11] = data1; break; case 0x40: // time digit 1 (lsb) time1_in[12] = data1; break; default: break; } if(shotime) { // insert | for beats or : for time. // this is odd, we should only do this when mode switches time1_in[3] = tm_bt; time1_in[6] = tm_bt; time1_in[9] = tm_bt; // diplay time. time1.value(time1_in); } } } default: break; } } } } } } // too lazy to reindent all :) //tell meters to decrement for (int i = 0; i < 8; i++) { chan[i]->decr(); } } std::cout << "after while\n"; cout.flush(); sleep(10); jack_client_close(client); exit (0); } mcpdisp-mcpdisp-0.1.2/src/mcpdisp.desktop000066400000000000000000000003611367717716400204520ustar00rootroot00000000000000[Desktop Entry] Type=Application Name=mcpdisp GenericName=mcpdisp Comment=Mackie Control Surface Emulator Comment[fr]=Émulateur de surface de contrôle Mackie Icon=mcpdisp Exec=mcpdisp -m -t Terminal=false Categories=AudioVideo;Audio;Midi; mcpdisp-mcpdisp-0.1.2/src/mcpdisp.svg000066400000000000000000000077031367717716400176070ustar00rootroot00000000000000 image/svg+xml