qspeakers-1.1.0/0000755000175000017500000000000013153054161011600 5ustar benbenqspeakers-1.1.0/locale/0000755000175000017500000000000013153053656013047 5ustar benbenqspeakers-1.1.0/COPYING0000644000175000017500000000135113153053656012643 0ustar benben QSpeakers is written by Benoît Rouits. Copyright © 2014 Benoît Rouits 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 3 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, see qspeakers-1.1.0/LICENSE0000644000175000017500000010451413153053656012622 0ustar benben GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The GNU General Public License is a free, copyleft license for software and other kinds of works. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. 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 them 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 prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. 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. Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users. Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS 0. Definitions. "This License" refers to version 3 of the GNU General Public License. "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. "The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. A "covered work" means either the unmodified Program or a work based on the Program. To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. 1. Source Code. The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. The Corresponding Source for a work in source code form is that same work. 2. Basic Permissions. All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. 3. Protecting Users' Legal Rights From Anti-Circumvention Law. No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. 4. Conveying Verbatim Copies. You may convey 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; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. 5. Conveying Modified Source Versions. You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: a) The work must carry prominent notices stating that you modified it, and giving a relevant date. b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices". c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. 6. Conveying Non-Source Forms. You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. "Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. 7. Additional Terms. "Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or d) Limiting the use for publicity purposes of names of licensors or authors of the material; or e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. 8. Termination. You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. 9. Acceptance Not Required for Having Copies. You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. 10. Automatic Licensing of Downstream Recipients. Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. 11. Patents. A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. 12. No Surrender of Others' Freedom. If 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 convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. 13. Use with the GNU Affero General Public License. Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such. 14. Revised Versions of this License. The Free Software Foundation may publish revised and/or new versions of the GNU 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 that a certain numbered version of the GNU General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation. If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. 15. Disclaimer of Warranty. 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. 16. Limitation of Liability. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 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. 17. Interpretation of Sections 15 and 16. If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. 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 state 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 3 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, see . Also add information on how to contact you by electronic and paper mail. If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: Copyright (C) This program 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, your program's commands might be different; for a GUI interface, you would use an "about box". You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see . The GNU 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. But first, please read . qspeakers-1.1.0/TODO0000644000175000017500000000030513153053656012276 0ustar benben- more plots: excursion, phase and impendance - consider dual-free ports and dual-flanged ports in a combobox option - consider box W x H x L live calculation for a fixed volume (W&H as spinboxes) qspeakers-1.1.0/application-x-qspeakers.xml0000644000175000017500000000100313153053656017070 0ustar benben Loudspeaker project file Projet d'enceinte acoustique qspeakers-1.1.0/bandpassbox.cpp0000644000175000017500000000633513153053656014627 0ustar benben#include #include "bandpassbox.h" BandPassBox::BandPassBox(double svol, double pvol, double pfreq, unsigned int pnum, double plen, double pdiam) : sealedBox(svol), portedBox(pvol, pfreq, pnum, plen, pdiam) { } void BandPassBox::setSealedBoxVolume(double vol) { sealedBox.setVolume(vol); } void BandPassBox::setPortedBoxVolume(double vol) { portedBox.setBoxVolume(vol); } void BandPassBox::setPortedBoxPortNum(unsigned int val) { portedBox.setPortNum(val); } void BandPassBox::setPortedBoxPortLen(double len) { portedBox.setPortLen(len); } void BandPassBox::setPortedBoxPortDiam(double diam) { portedBox.setPortDiam(diam); } void BandPassBox::setPortedBoxResFreq(double freq) { portedBox.setResFreq(freq); } void BandPassBox::updatePortedBoxPorts(double sd, double xmax) { portedBox.updatePorts(sd, xmax); } void BandPassBox::updatePortedBoxPortsLength() { portedBox.updatePortsLength(); } double BandPassBox::getSealedBoxVolume() const { return sealedBox.getVolume(); } double BandPassBox::getPortedBoxVolume() const { return portedBox.getBoxVolume(); } unsigned int BandPassBox::getPortedBoxPortNum() const { return portedBox.getPortNum(); } double BandPassBox::getPortedBoxPortLen() const { return portedBox.getPortLen(); } double BandPassBox::getPortedBoxPortDiam() const { return portedBox.getPortDiam(); } double BandPassBox::getPortedBoxResFreq(void) const { return portedBox.getResFreq(); } QDomElement BandPassBox::toDomElement(QDomDocument &doc) const { QDomElement e = Box::toDomElement(doc); e.setAttribute("type", "bandpass"); QDomElement b = sealedBox.toDomElement(doc); e.appendChild(b); QDomElement c = portedBox.toDomElement(doc); e.appendChild(c); return e; } void BandPassBox::fromDomElement(const QDomElement &e) { Box::fromDomElement(e); if (e.attribute("type") != "bandpass") { qWarning() << __func__ << "wrong box type! (not bandpass, giving up)"; return; } QDomElement b = e.firstChildElement("box"); while (!b.isNull()) { if (b.attribute("type") == "sealed") sealedBox.fromDomElement(b); else if (b.attribute("type") == "ported") portedBox.fromDomElement(b); b = b.nextSiblingElement("box"); } } void BandPassBox::render(QPainter *painter, const QRectF &area) { if (!painter) return; QString params[6]; qreal tab = area.left(); painter->drawRoundRect(area.toRect(), 5, 5); params[0] = QObject::tr("Sealed Vol. %1 L").arg(getSealedBoxVolume()); params[1] = QObject::tr("Ported Vol. %1 L").arg(getPortedBoxVolume()); params[2] = QObject::tr("Port Diam. %1 cm").arg(getPortedBoxPortDiam()); params[3] = QObject::tr("Port Len. %1 cm").arg(QString::number(getPortedBoxPortLen(), 'f', 2)); params[4] = QObject::tr("Port Num. %1").arg(getPortedBoxPortNum()); params[5] = QObject::tr("Fb %1 Hz").arg(getPortedBoxResFreq()); for (int i = 0; i < 6; i++) { QString text = params[i]; QRectF where(tab, area.top(), area.width() / 6, area.height()); QTextOption option(Qt::AlignVCenter|Qt::AlignLeft); painter->drawText(where, text, option); tab += area.width() / 6; } } qspeakers-1.1.0/bandpassbox.h0000644000175000017500000000221313153053656014263 0ustar benben#ifndef BANDPASSBOX_H #define BANDPASSBOX_H #include #include "sealedbox.h" #include "portedbox.h" class BandPassBox : public Box { public: BandPassBox(double svol = 0.1, double pvol = 0.01, double pfreq = 1, unsigned int pnum = 1, double plen = 0, double pdiam = 0); void setSealedBoxVolume(double vol); void setPortedBoxVolume(double vol); void setPortedBoxPortNum(unsigned int val); void setPortedBoxPortLen(double len); void setPortedBoxPortDiam(double diam); void setPortedBoxResFreq(double freq); void updatePortedBoxPorts(double sd, double xmax); void updatePortedBoxPortsLength(); double getSealedBoxVolume(void) const; double getPortedBoxVolume(void) const; unsigned int getPortedBoxPortNum(void) const; double getPortedBoxPortLen(void) const; double getPortedBoxPortDiam(void) const; double getPortedBoxResFreq(void) const; QDomElement toDomElement(QDomDocument& doc) const; void fromDomElement(const QDomElement &e); void render(QPainter *painter, const QRectF& area); private: SealedBox sealedBox; PortedBox portedBox; }; #endif // BANDPASSBOX_H qspeakers-1.1.0/box.cpp0000644000175000017500000000046713153053656013113 0ustar benben#include #include "box.h" QDomElement Box::toDomElement(QDomDocument& doc) const { QDomElement e = doc.createElement("box"); return e; } void Box::fromDomElement(const QDomElement &e) { if (e.tagName() != "box") qWarning() << __func__ << "wrong tag name while importing box!"; } qspeakers-1.1.0/box.h0000644000175000017500000000046213153053656012553 0ustar benben#ifndef BOX_H #define BOX_H #include #include #define PI 3.1415927 class Box { public: QDomElement toDomElement(QDomDocument& doc) const; void fromDomElement(const QDomElement& e); virtual void render(QPainter *painter, const QRectF& area) = 0; }; #endif // BOX_H qspeakers-1.1.0/config.h.in0000644000175000017500000000023513153053656013633 0ustar benben#ifndef CONFIG_H #define CONFIG_H #define TARGET \"$$TARGET\" #define PREFIX \"$$PREFIX\" #define VERSION \"$$VERSION\" #define DATADIR \"$$DATADIR\" #endif qspeakers-1.1.0/importexport.cpp0000644000175000017500000000772513153053656015103 0ustar benben#include #if QT_VERSION >= QT_VERSION_CHECK(5,0,0) #include #endif #include #include #include #include "importexport.h" QString ImportExport::savePath; QString ImportExport::getSavePath(void) { if (!ImportExport::savePath.isNull() && !ImportExport::savePath.isEmpty()) { return ImportExport::savePath; } #if QT_VERSION >= QT_VERSION_CHECK(5,0,0) QString prefix = QStandardPaths::writableLocation(QStandardPaths::DataLocation); #else QString prefix = QDesktopServices::storageLocation(QDesktopServices::DataLocation); #endif QDir dir(prefix); if (!dir.exists()) dir.mkpath(prefix); QString path = prefix + QDir::separator() + SAVE_FILENAME; return path; } void ImportExport::saveProject(const Speaker &speaker, const SealedBox &sbox, const PortedBox &pbox, const BandPassBox &bpbox, int number, int tab) { QString path = ImportExport::getSavePath(); qDebug() << "exporting" << path; QFile file(path); /* do not test if it exists, just override it */ exportProject(file, speaker, sbox, pbox, bpbox, number, tab); } void ImportExport::restoreProject(Speaker &speaker, SealedBox &sbox, PortedBox &pbox, BandPassBox &bpbox, int* number, int* tab) { QString path = ImportExport::getSavePath(); qDebug() << "importing" << path; QFile file(path); importProject(speaker, sbox, pbox, bpbox, number, tab, file); } void ImportExport::exportProject(QFile &file, const Speaker &speaker, const SealedBox &sbox, const PortedBox &pbox, const BandPassBox &bpbox, int number, int tab) { QDomDocument xml("QSpeakersProject"); QDomElement root = xml.createElement("project"); xml.appendChild(root); QDomElement spk = speaker.toDomElement(xml); root.appendChild(spk); QDomElement xsbox = sbox.toDomElement(xml); root.appendChild(xsbox); QDomElement xpbox = pbox.toDomElement(xml); root.appendChild(xpbox); QDomElement xbpbox = bpbox.toDomElement(xml); root.appendChild(xbpbox); QDomElement xlayout = xml.createElement("layout"); xlayout.setAttribute("sibling", number); root.appendChild(xlayout); QDomElement xstate = xml.createElement("state"); xstate.setAttribute("tab", tab); root.appendChild(xstate); file.open(QIODevice::WriteOnly); file.write(xml.toByteArray()); file.close(); } void ImportExport::importProject(Speaker &speaker, SealedBox &sbox, PortedBox &pbox, BandPassBox &bpbox, int *number, int *tab, QFile &file) { QDomDocument doc("QSpeakersProject"); if (file.exists()) { file.open(QIODevice::ReadOnly); doc.setContent(&file); file.close(); } QDomElement root = doc.firstChildElement("project"); QDomNodeList speakers = root.elementsByTagName("speaker"); /* for now, only one speaker is considered */ QDomElement spk = speakers.at(0).toElement(); if (!spk.isNull()) speaker.fromDomElement(spk); /* crawl 1st level boxes */ QDomElement box = root.firstChildElement("box"); while (!box.isNull()) { if (box.attribute("type") == "sealed") sbox.fromDomElement(box); else if (box.attribute("type") == "ported") pbox.fromDomElement(box); else if (box.attribute("type") == "bandpass") bpbox.fromDomElement(box); else qWarning() << __func__ << "unrecognized box type"; box = box.nextSiblingElement("box"); } if (number != NULL) { QDomElement layout = root.firstChildElement("layout"); if (layout.isNull()) *number = 1; /* default */ else *number = layout.attribute("sibling", "1").toInt(); } if (tab != NULL) { QDomElement state = root.firstChildElement("state"); if (state.isNull()) *tab = 0; else *tab = state.attribute("tab", "0").toInt(); } } void ImportExport::setSavePath(const QString &path) { ImportExport::savePath = path; } qspeakers-1.1.0/importexport.h0000644000175000017500000000231213153053656014533 0ustar benben#ifndef IMPORTEXPORT_H #define IMPORTEXPORT_H #include #include "speaker.h" #include "sealedbox.h" #include "portedbox.h" #include "bandpassbox.h" class ImportExport { public: /* save the project state into a unique dotfile */ static void saveProject(const Speaker& speaker, const SealedBox& sbox, const PortedBox& pbox, const BandPassBox& bpbox, int number = 1, int tab = 0); /* restore the saved project from the dotfile */ static void restoreProject(Speaker& speaker, SealedBox& sbox, PortedBox& pbox, BandPassBox& bpbox, int *number, int *tab); /* in: speaker, sbox, pbox, bpbox, number, tab * out: file */ static void exportProject(QFile& file, const Speaker& speaker, const SealedBox& sbox, const PortedBox& pbox, const BandPassBox& bpbox, int number = 1, int tab = 0); /* in: file * out: speaker, sbox, pbox, bpbox */ static void importProject(Speaker& speaker, SealedBox& sbox, PortedBox& pbox, BandPassBox& bpbox, int *number, int *tab, QFile &file); static void setSavePath(const QString& path); static QString getSavePath(void); private: static QString savePath; #define SAVE_FILENAME "qspeakers_save.xml" }; #endif // IMPORTEXPORT_H qspeakers-1.1.0/listdialog.cpp0000644000175000017500000000411213153053656014445 0ustar benben#include #include #include "listdialog.h" #include "ui_listdialog.h" SpeakerListModel::SpeakerListModel(const QList &speakers, QWidget *parent) : QAbstractListModel(parent) { this->speakers = speakers; } SpeakerListModel::~SpeakerListModel() { } int SpeakerListModel::rowCount(const QModelIndex &parent) const { if (!parent.isValid()) return speakers.size(); if (parent.row() > 0) return 0; return speakers.size(); } QVariant SpeakerListModel::data(const QModelIndex &index, int role) const { if (!index.isValid()) return QVariant(); if (index.row() >= speakers.size()) return QVariant(); if (role == Qt::DisplayRole) { return QVariant(speakers.at(index.row()).getVendor() + " - " + speakers.at(index.row()).getModel()); } else if (role == Qt::UserRole){ return QVariant::fromValue(speakers.at(index.row())); } else { return QVariant(); } } void SpeakerListModel::clear() { speakers.clear(); } ListDialog::ListDialog(const QList &speakers, QWidget *parent) : QDialog(parent), ui(new Ui::ListDialog), model(NULL) { ui->setupUi(this); setSpeakerItems(speakers); connect(this, SIGNAL(accepted()), this, SLOT(onAccepted())); connect(this, SIGNAL(rejected()), this, SLOT(onRejected())); } ListDialog::~ListDialog() { delete ui; if (model != NULL) delete model; } void ListDialog::setSpeakerItems(const QList &speakers) { if (model != NULL) { model->clear(); delete model; } model = new SpeakerListModel(speakers, this); ui->listDialogListView->setModel(model); } void ListDialog::clear() { model->clear(); } void ListDialog::onAccepted() { QString title = model->data(QModelIndex(ui->listDialogListView->currentIndex()), Qt::DisplayRole).toString(); Speaker s = (Speaker) model->data(QModelIndex(ui->listDialogListView->currentIndex()), Qt::UserRole).value(); emit speakerItemSelected(title, s); } void ListDialog::onRejected() { emit speakerItemCancelled(); } qspeakers-1.1.0/listdialog.h0000644000175000017500000000200513153053656014111 0ustar benben#ifndef LISTDIALOG_H #define LISTDIALOG_H #include #include #include "speaker.h" class SpeakerListModel : public QAbstractListModel { Q_OBJECT public: explicit SpeakerListModel(const QList &speakers, QWidget *parent = 0); ~SpeakerListModel(); int rowCount(const QModelIndex &parent = QModelIndex()) const; QVariant data(const QModelIndex &index, int role) const; void clear(void); private: QList speakers; }; namespace Ui { class ListDialog; } class ListDialog : public QDialog { Q_OBJECT public: explicit ListDialog(const QList& speakers, QWidget *parent = 0); ~ListDialog(); void setSpeakerItems(const QList &speakers); void clear(void); signals: void speakerItemSelected(QString title, const Speaker &speaker); void speakerItemCancelled(); private slots: void onAccepted(); void onRejected(); private: Ui::ListDialog *ui; SpeakerListModel *model; }; #endif // LISTDIALOG_H qspeakers-1.1.0/listdialog.ui0000644000175000017500000000326113153053656014304 0ustar benben ListDialog 0 0 400 300 Please select an item Qt::AlignCenter Qt::Horizontal QDialogButtonBox::Cancel|QDialogButtonBox::Ok listDialogButtonBox accepted() ListDialog accept() 248 254 157 274 listDialogButtonBox rejected() ListDialog reject() 316 260 286 274 qspeakers-1.1.0/main.cpp0000644000175000017500000000247113153053656013244 0ustar benben#include "mainwindow.h" #include "importexport.h" #include #include #include #include #include "config.h" int main(int argc, char *argv[]) { QApplication a(argc, argv); a.setOrganizationName("Herewe"); a.setOrganizationDomain("herewe"); a.setApplicationName("QSpeakers"); QString locale = QLocale::system().name(); QTranslator qtTranslator; qtTranslator.load("qt_" + locale, QLibraryInfo::location(QLibraryInfo::TranslationsPath)); a.installTranslator(&qtTranslator); QTranslator qspeakersTranslator; if (!qspeakersTranslator.load(TARGET "_" + locale, "locale")) qspeakersTranslator.load(TARGET "_" + locale, DATADIR "/" TARGET "/locale"); a.installTranslator(&qspeakersTranslator); if (argc > 1) ImportExport::setSavePath(argv[argc - 1]); MainWindow w; /* must be created _after_ setSavePath */ QString iconpath = QString(DATADIR "/pixmaps/" TARGET ".png"); #if QT_VERSION >= QT_VERSION_CHECK(5,0,0) if (QFileInfo::exists(iconpath)) #else if ((QFileInfo(iconpath)).exists()) #endif w.setWindowIcon(QIcon(iconpath)); else w.setWindowIcon(QIcon(TARGET ".png")); if (argc > 1) w.setWindowFilePath(argv[argc - 1]); w.show(); return a.exec(); } qspeakers-1.1.0/mainwindow.ui0000644000175000017500000010643213153053656014331 0ustar benben MainWindow 0 0 970 720 0 0 0 0 Loudspeaker number 1 8 vendor 0 0 model 0 0 Qt::Horizontal 40 20 75 true Fs 0 Hz Qt::Horizontal 40 20 75 true Qts 0 Qt::Horizontal 40 20 75 true Vas 0 L Qt::Horizontal 40 20 75 true Sd 0 Qt::Horizontal 40 20 75 true Re 0 Ohm Qt::Horizontal 40 20 0 0 0 Sealed enclosure 1st order filter Simple, safe enclosure good for several speakers. QLayout::SetDefaultConstraint Qt::Horizontal QSizePolicy::Expanding 40 20 Enclosure volume 0.010000000000000 999.990000000000009 L Qt::Horizontal QSizePolicy::Expanding 40 20 0 0 Ported enclosure 2nd order filter Popular enclosure type to enhance bass for most speakers. QLayout::SetDefaultConstraint Qt::Horizontal 40 20 Enclosure volume (Vb) 0.010000000000000 999.990000000000009 L Qt::Horizontal 40 20 Enclosure filter resonance (Fb) 1.000000000000000 999.990000000000009 Hz Qt::Horizontal 40 20 0 0 Number of ports 1 10 Port diameter 0.500000000000000 cm Qt::Horizontal 40 20 Slot port x 0 0 true cm Qt::Horizontal 40 20 Port length 0 0 true cm Bandpass enclosure 4th order filter Enclosure for subwoofer, mostly used in 2:1, 5:1 and 7:1 systems. QLayout::SetDefaultConstraint Qt::Horizontal 40 20 Sealed enclosure volume 0.010000000000000 999.990000000000009 L Qt::Horizontal 40 20 QLayout::SetDefaultConstraint Qt::Horizontal 40 20 Ported enclosure volume 0.010000000000000 999.990000000000009 L Qt::Horizontal 40 20 Ported enclosure filter resonance 1.000000000000000 999.990000000000009 Hz Qt::Horizontal 40 20 0 0 Number of ports 1 10 Port diameter 0.500000000000000 cm Qt::Horizontal 40 20 Port length 0 0 true cm 0 0 970 25 Project Edit Ported alignments About Speaker 0 0 TopToolBarArea false Open... Open a speaker project Ctrl+I Save Save the current project Ctrl+S Save copy... Save the current project in a copy Ctrl+E Print Print the current project Ctrl+P Quit Quit the application Ctrl+Q About QSpeakers Ctrl+A New New speaker parameters Ctrl+N Search Search a speaker Optimize Optimize frequency response Ctrl+O Modify Modify the current speaker Ctrl+M Remove Remove the current speaker Bessel <html><head/><body><p>Linear phase and fast transient response alignment.</p></body></html> Legendre <html><head/><body><p>Extended bass response with minimum ripple.</p></body></html> Hoge BB4 <html><head/><body><p>Boom box butterworth 4th order alignment.</p></body></html> Bullock SBB4 <html><head/><body><p>Super boom box butterworth 4th order alignment.</p></body></html> Zbinden M4 <html><head/><body><p>Moderate alignment (infinite baffle).</p></body></html> qspeakers-1.1.0/manpage.sgml0000644000175000017500000000733113153053656014110 0ustar benben BENOIT"> ROUITS"> october 20, 2016"> 1"> brouits@free.fr"> QSPEAKERS"> Ubuntu"> Debian"> GNU"> GPL"> ]>
&dhemail;
&dhfirstname; &dhsurname; 2014 &dhusername; &dhdate;
&dhucpackage; &dhsection; &dhpackage; simulate common loudspeaker enclosures &dhpackage; file.qsp DESCRIPTION This manual page documents the &dhpackage; program. &dhpackage; is a graphical program that simulates common loudspeaker enclosures such as sealed-system, ported-system and symmetric bandpass-system. &dhpackage displays the expected frequency response curve of a system, given the loudspeaker Thiele / Small parameters and the enclosure parameters.
qspeakers-1.1.0/portedbox.cpp0000644000175000017500000001062213153053656014323 0ustar benben#include #include #include #include "portedbox.h" PortedBox::PortedBox(double volume, double resfreq, unsigned int portnum, double portdiam, double portlen) : box(volume) { resFreq = resfreq; portNum = portnum; portDiam = portdiam; portLen = portlen; } void PortedBox::setBoxVolume(double vol) { box.setVolume(vol); } void PortedBox::setPortNum(unsigned int value) { portNum = value; } void PortedBox::setPortLen(double len) { portLen = len; } void PortedBox::setPortDiam(double diam) { portDiam = diam; } void PortedBox::setSlotWidth(double width) { slotWidth = width; } void PortedBox::setResFreq(double value) { resFreq = value; } double PortedBox::getBoxVolume() const { return box.getVolume(); } unsigned int PortedBox::getPortNum() const { return portNum; } double PortedBox::getPortLen() const { return portLen; } double PortedBox::getPortDiam() const { return portDiam; } double PortedBox::getSlotWidth() const { return slotWidth; } double PortedBox::getSlotHeight() const { /* width is manual, height is computed from eq. diam. */ return (PI * pow(portDiam, 2.0)) / (4.0 * slotWidth); } double PortedBox::getResFreq() const { return resFreq; } void PortedBox::updatePorts(double sd, double xmax) { /* compute minimum port diameter and optionaly set it */ double vol = sd * xmax * 0.001; /* m³ */ double dmin = 100 * (20.3 * pow((pow(vol, 2.0) / getResFreq()), 0.25)) / sqrt(getPortNum()); /* cm */ setPortDiam(dmin); updateSlots(); updatePortsLength(); } void PortedBox::updateSlots() { /* compute square slot */ double diam = getPortDiam(); double s = sqrt(PI * pow(diam, 2.0) / 4.0); /* consider "width" over "height" and reset if too small */ if (slotWidth == 0.0) slotWidth = s; } void PortedBox::updatePortsLength() { /* compute resulting length */ double diam = getPortDiam(); double res = getResFreq(); double vol = getBoxVolume(); double num = getPortNum(); double plen = ((23562.5 * pow(diam, 2.0)) * num / (vol * pow(res, 2.0))) - (K * diam); setPortLen(plen); } QDomElement PortedBox::toDomElement(QDomDocument& doc) const { QLocale c(QLocale::C); QDomElement e = Box::toDomElement(doc); e.setAttribute("type", "ported"); e.setAttribute("res", c.toString(resFreq)); QDomElement b = box.toDomElement(doc); e.appendChild(b); QDomElement p = doc.createElement("port"); p.setAttribute("num", c.toString(portNum)); p.setAttribute("len", c.toString(portLen)); p.setAttribute("diam", c.toString(portDiam)); p.setAttribute("width", c.toString(slotWidth)); e.appendChild(p); return e; } void PortedBox::fromDomElement(const QDomElement &e) { QLocale c(QLocale::C); Box::fromDomElement(e); if (e.attribute("type") != "ported") { qWarning() << __func__ << "wrong box type! (not ported, giving up)"; return; } resFreq = c.toDouble(e.attribute("res")); QDomElement b = e.elementsByTagName("box").at(0).toElement(); box.fromDomElement(b); QDomElement p = e.elementsByTagName("port").at(0).toElement(); portNum = c.toUInt(p.attribute("num")); portLen = c.toDouble(p.attribute("len")); portDiam = c.toDouble(p.attribute("diam")); slotWidth = c.toDouble(p.attribute("width")); } void PortedBox::render(QPainter *painter, const QRectF &area) { if (!painter) return; #define PORTED_PARAMS 6 QString params[PORTED_PARAMS]; qreal tab = area.left(); painter->drawRoundRect(area.toRect(), 5, 5); params[0] = QObject::tr("Vol. %1 L").arg(getBoxVolume()); params[1] = QObject::tr("Port Diam. %1 cm").arg(getPortDiam()); params[2] = QObject::tr("[Slot %1x%2 cm]").arg(QString::number(getSlotWidth(), 'f', 2), QString::number(getSlotHeight(), 'f', 2)); params[3] = QObject::tr("Port Len. %1 cm").arg(QString::number(getPortLen(), 'f', 2)); params[4] = QObject::tr("Port Num. %1").arg(QString::number(getPortNum())); params[5] = QObject::tr("Fb %1 Hz").arg(QString::number(getResFreq())); for (int i = 0; i < PORTED_PARAMS; i++) { QString text = params[i]; QRectF where(tab, area.top(), area.width() / PORTED_PARAMS, area.height()); QTextOption option(Qt::AlignVCenter|Qt::AlignLeft); painter->drawText(where, text, option); tab += area.width() / PORTED_PARAMS; } } qspeakers-1.1.0/portedbox.h0000644000175000017500000000227213153053656013772 0ustar benben#ifndef PORTEDBOX_H #define PORTEDBOX_H #include #include "sealedbox.h" #define K 0.732 /* correction factor for a half flanged disposed port */ class PortedBox : public Box { public: PortedBox(double volume = 0.01, double resfreq = 1, unsigned int portnum = 1, double portdiam = 0, double portlen = 0); void setBoxVolume(double vol); void setPortNum(unsigned int value); void setPortLen(double len); void setPortDiam(double diam); void setSlotWidth(double width); void setResFreq(double value); double getBoxVolume(void) const; unsigned int getPortNum() const; double getPortLen(void) const; double getPortDiam(void) const; double getSlotWidth() const; double getSlotHeight() const; double getResFreq() const; void updateSlots(); void updatePorts(double sd, double xmax); void updatePortsLength(); QDomElement toDomElement(QDomDocument& doc) const; void fromDomElement(const QDomElement& e); void render(QPainter *painter, const QRectF& area); private: SealedBox box; double resFreq; unsigned int portNum; double portLen; double portDiam; double slotWidth; }; #endif // PORTEDBOX_H qspeakers-1.1.0/qspeakers.10000644000175000017500000000111013153053656013661 0ustar benben.TH "QSPEAKERS" "1" .SH "NAME" qspeakers \(em simulate common loudspeaker enclosures .SH "SYNOPSIS" .PP \fBqspeakers\fR [file.qsp] .SH "DESCRIPTION" .PP This manual page documents the \fBqspeakers\fR program. .PP \fBqspeakers\fR is a graphical program that simulates common loudspeaker enclosures such as sealed-system, ported-system and symmetric bandpass-system. .PP \fBqspeakers\fR displays the expected frequency response curve of a system, given the loudspeaker Thiele / Small parameters and the enclosure parameters. .\" created by instant / docbook-to-man qspeakers-1.1.0/qspeakers.desktop0000644000175000017500000000111613153053656015200 0ustar benben[Desktop Entry] Encoding=UTF-8 Name=QSpeakers Name[fr]=QSpeakers GenericName=Loudspeaker Enclosure Design Tool GenericName[fr]=Outil de conception d'enceinte acoustique Comment=Simulate an optimizes common loudspeaker enclosures Comment[fr]=Simule et optimise des enceintes acoustiques classiques Keywords=do it yourself;diy;box;speaker;woofer;audio;simulation;acoustics Keywords[fr]=bricolage;diy;boîte;haut-parleur;boomer;audio;simulation;acoustique Exec=qspeakers %f Icon=qspeakers Terminal=false Type=Application Categories=Science;Education;Physics; MimeType=application/x-qspeakers; qspeakers-1.1.0/qspeakers.ico0000644000175000017500000004107613153053656014312 0ustar benben@@ (B(@ @  MMMMMMMMM3MMMyMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMOMMMMMMMMMMMMoMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMNNNNNNMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM7MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMLLLFFFBBBBBBGGGLLLMMMMMMMMMNNNMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMNNNNNNNNNMMMEEE999333555???JJJNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNHHH444$$$ &&&888IIIMMMNNNNNNMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMNNNOOOMMM:::###---FFFOOONNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNOOOJJJ,,,111LLLOOONNNMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMOOOTTTCCC///RRRRRROOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOPPPTTT;;;BBBTTTOOOMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMSSSXXX...HHHYYYOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOSSSXXX,,,444ZZZQQQMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMYYYWWW"""===aaaQQQPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPOOOWWW\\\'''---```TTTMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM^^^[[[ ;;;iiiSSSPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPYYYddd***222hhhUUUNNNMMMMMMMMMMMMMMMMMMMMMMMMMMM___hhh&&&HHHnnnSSSQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQPPPOOOOOONOOOOOOOOPPPQQQQQQQQQQQQQQQQQQQQQQQQPPPWWWppp<<<HHHoooSSSNNNMMMMMMMMMMMMMMMMMMMMMMMMMMMYYYxxx@@@"""hhhlllQQQQQQQQQQQQQQQRRRQQQNNNHHHAAA;;;666555HIJBDD333555:::@@@GGGMMMQQQRRRQQQQQQQQQQQQRRRoooggg$$$+++oooiiiPPPNNNMMMMMMMMMMMMMMMMMMMMMMMMMMMQQQssssss,,,PPP]]]QQQRRRRRRRRRPPPIII<<=222+++'''&&&%%%(((=??9::&&&&&&&&&'''+++111;;;GGGOOORRRRRRRRRQQQ\\\```(((...jjj|||XXXPPPNNNMMMMMMMMMMMMMMMMMMMMMMMMNNNPPPZZZxxx@@@###...]]]kkkRRRRRRRRRQQQHHH899,,,'''&&&&&&''''''&&&&&&((('''&&&'''(((((((((((())),,,666EEEPPPSSSRRRRRRbbb|||WWWDDDFFF\\\^^^RRRQQQOOOMMMMMMMMMMMMMMMMMMMMMMMMNNNQQQRRR^^^}}}qqqvvvmmmTTTSSSSSSNNN===--.((((((((('''%%%###########################$$$&&&)))*********...:::KKKSSSSSSSSS]]]wwwsssZZZRRRSSSRRROOOMMMMMMMMMMMMMMMMMMMMMMMMNNNQQQSSSRRRVVVgggzzzqqq\\\SSSSSSSSSHHH555***))))))'''$$$###$$$%%%&&&&&&''''''''''''&&&&&&&&&%%%$$$&&&))),,,,,,,,,333EEERRRSSSRRRSSSXXX]]]\\\WWWSSSRRRSSSSSSRRROOOMMMMMMMMMMMMMMMMMMMMMMMMNNNQQQSSSSSSSSSRRRSSSSSSSSSRRRSSSSSSSSSEEE111++++++)))%%%###%%%&&&''''''''''''''''''''''''(('(((((((((((('''&&&&&&+++......111AAAQRRTTTSSSSSSSSSSSSSSSSSSSSSSSSSSSRRROOOMMMMMMMMMMMMMMMMMMMMMMMMNNNRRRTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTDDD000,,,---((($$$%%%'''''''''''''&&(''*((++*,,,,,,,++*)()('(''((()(())))))(((&&&***///000122@AARRRTTTTTTTTTTTTTTTTTTTTTTTTTTTSSSOOOMMMMMMMMMMMMMMMMMMMMMMMMNNNRRRUUUUUUUUUUUUUUUUUUUUUUUUUUUFGG111...---(((%%%'''((((((('')((---19<1LR-]h(jz$p#q$l~&ao)PZ,=B,/0+)(*)(*********((()))000222333CCCTTTUUUUUUUUUUUUUUUUUUUUUUUUSSSOOOMMMMMMMMMMMMMMMMMMMMMMMMNNNRRRUUUUUUUUUUUUUUUUUUUUUVVVKKK444//////(((&&&((((((((()((0113JO,m} x'S^+57+***********))))))111333555GHHVVVUUUUUUUUUUUUUUUUUUUUUTTTOOOMMMMMMMMMMMMMMMMMMMMMMMMNNNRRRUUUUUUUUUUUUUUUUUUVVVQQR999111000)))&&&(((((((((,++6CF-p |'LU+./*))******)))***333555999NNNVVVUUUUUUUUUUUUUUUUUUTTTOOOMMMMMMMMMMMMMMMMMMMMMMMMNNNSSSVVVVVVVVVVVVVVVVVVWXXIJK666222+++&&&)))))))))0006W_  ct+57++*++++++***,,,666999GHHVWWVVVVVVVVVVVVVVVVVVTTTOOOMMMMMMMMMMMMMMMMMMMMMMMMNNNSSSVVVVVVVVVVVVVVVXXXTTTNQQCDD///'''))))))))(2237`k m*8;,**,,,,,,***000ABBFHIOQQXYYVVVVVVVVVVVVVVVUUUOOOMMMMMMMMMMMMMMMMMMMMMMMMNNNSSSWWWWWWWWWWWWWWWXYYCDD???:::)))((())))))1008akm+57++*,,,,,,+++899;<>>EFFZ[[YYYXXXXXXXXXVVVPPPMMMMMMMMMMMMMMMMMMMMMMMMNNNTTTXXXXXXXXXYYYYZZ@@@;;;222((())))))10/7jw  }_qO^M[Xho q*47,++,,,+++222@@@AAAWXX[[[XXXXXXXXXVVVPPPMMMMMMMMMMMMMMMMMMMMMMMMNNNUUUXXXXXXXXX\\\TTT===<<<,,,((()))*));EH GR)+!!!!!! %&9Ah~ "MX,++++++++--->>>BBBPQQ^__XXXXXXXXXWWWPPPMMMMMMMMMMMMMMMMMMMMMMMMOOOUUUYYYYYYYYY___MNN>>>:::)))))))))/--9cm  t27! ! !!!!!!!!!!!!!!!! (*Wh  h{+12,++,,,+++:::CCCKKK`aaYYYYYYYYYWWWPPPMMMMMMMMMMMMMMMMMMMMMMMMOOOUUUYYYYYYZZZaaaHII@@@777((()))(((677, 16!!!!!!!!!!!!!!!!!!!!!!!!!! &'^r w&=B+**+++***555EEEHHH_``[\\YYYYYYWWWPPPMMMMMMMMMMMMMMMMMMMMMMMMOOOVVVZZZZZZ\\\`aaFFFBBB333'''(((('':DGJW! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 38 w }!JT+*)******111FFFHHH^__^^^ZZZZZZWWWPPPMMMMMMMMMMMMMMMMMMMMMMMMOOOVVVZZZZZZ]]^``aFFFCCC000'''(((*((;SX }+.! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! "#Wh ~Ub*++******...FFFIII]]^`aaZZZZZZXXXPPPMMMMMMMMMMMMMMMMMMMMMMMMOOOVVV[[[ZZZ____``GGGDDD...'''(((,)):]ecw ""!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! AK ~}|),,******,,,FFFJJJ]]]bbcZZZ[[[XXXQQQMMMMMMMMMMMMMMMMMMMMMMMMOOOWWW[[[[[[`aa`aaHHHEEE...&&&''',))9ak Td! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 7=y }|zy]m(,-))()))+++FFFLLL]^^dee[[[\\\YYYQQQMMMMMMMMMMMMMMMMMMMMMMMMOOOWWW\\\[[[aaabccIJJGGG...&&&&&&+((9`k Sb! !!!###%&&&''&''&''&''&''&''&&&###!!!! 6<w ~|{ywvZj'+,((((((+++GGGMNN_``eee[[[\\\YYYQQQMMMMMMMMMMMMMMMMMMMMMMMMOOOWWW\\\\\\aaaeffLLLHHH///%%%&&&*'':Zc]p!""$$$355;==;==;==;==;==;==;==<==666&&&! >Gx{yxvutTc')*(''''',,,JJJOOObcceee[[[\\\ZZZQQQMMMMMMMMMMMMMMMMMMMMMMMMOOOXXX]]]\\\```ijjOOOKKK333$$$%%%'%%:PUq),//.PRRVXXUXXUXXUXXUXXUXXUXXVXXRTT333!""O]yxvusrpKW'''&&&&&&---MMMRRRfggdee\\\]]]ZZZQQQMMMMMMMMMMMMMMMMMMMMMMMMOOOXXX]]]]]]___lmmSTTMMM888###$$$$##8AC! BL110beeruuqttpttpttpttpttqttruufii666/2fzwusrpoj ?G&%%&&&%%%222QQQTUUkllccc]]]]]]ZZZQQQMMMMMMMMMMMMMMMMMMMMMMMMOOOXXX^^^^^^^^^mnnZZZOOO@@@%%%######233.vm$25NNN}TVU(,-O\strpoml`s"36%$$%%%$$$:::TTTYYYoppa`a^^^^^^[[[QQQMMMMMMMMMMMMMMMMMMMMMMMMPPPYYY^^^^^^^^]jkkdeeQQQIII)))""""""(''9[c ^q'36FGFlooprsKLL*./GRnspomlji~P]#')$##$$$%%%EEEVVV`aapqq^^^^^^^^^[[[QQQMMMMMMMMMMMMMMMMMMMMMMMMOOOYYY^^^^^^^^^effmnoTTTPPP111 !!!"!!6>@$ dx ;B*./656=>=>>>766+-.#26Q^lqomljh~g|au9@""""""!!!+++PPPXWWjkkkll^^^^^^^^^[[[RRRMMMMMMMMMMMMMMMMMMMMMMMMOOOYYY_________bbbrss]]]TTTAAA!!! (''7^h u]oIS?F=DCMSafzpomljh~f|ezcxO]!'(!!!!!!!!!999XXX\\\suueff_________\\\RRRMMMMMMMMMMMMMMMMMMMMMMMMOOOZZZ```_________oopijjVVVPPP+++ 28:*s   } | z wrpq q pnlji~g}ezcxbvZk49! %%%LLL[[[fggtuuaaa______```]]]RRRMMMMMMMMMMMMMMMMMMMMMMMMOOOZZZ`````````___fgguvv]]]]^^BBB! 6GK z  ~ | z x v t s r p n ljhf|ezcxav`t\n>F !888_``___suulmm___`````````]]]RRRMMMMMMMMMMMMMMMMMMMMMMMMOOOZZZ```````````````sttnpp]_`XYY///$$#5QWy ~ | z x w u s q p n l j hg}ezcxbv`s^r[mCN#$'''STT_bbjkkxzzccc````````````]]]RRRMMMMMMMMMMMMMMMMMMMMMMMMOOOZZZaaaaaaaaaaaa```gggy{{^__[[[LLL###$%%4NTs z y w u s q p n l j h g} e{cybv`t^r]pXjBK#%DDD___]^^xyzmnn```aaaaaaaaaaaa^^^RRRMMMMMMMMMMMMMMMMMMMMMMMMOOOZZZaaaaaaaaaaaaaaaaaarssuww^^^\\\BBB!!!1DI&hxt t q p n l j i g} e{ cy av`t^q\p[mSb:B !888]]]aaarssxzzcccaaaaaaaaaaaaaaa^^^SSSMMMMMMMMMMMMMMMMMMMMMMMMOOO[[[bbbbbbbbbbbbbbbbbbdddz{{opp___\\\<<<*13-S\hzn l j h f} e{ cx av _t ^r \pZmUeFP,0333[[[ccclmm~hiiaaabbbbbbbbbbbbbbb^^^SSSMMMMMMMMMMMMMMMMMMMMMMMMOOO[[[bbbcccccccccccccccbbbiii~lmm```]]]<<<*47+MU#]kcudydxbw`t^r[nXiQ^CL/3222ZZZdddjkkoppbbbcccccccccccccccccc___SSSMMMMMMMMMMMMMMMMMMMMMMMMOOO\\\cccccccccccccccccccccbbbmnnmmmbbb___CCC!%&&25'=B%CK#FN"EM!AH!9? /3#$:::]]]fffkkktuucccccccccccccccccccccccc___SSSMMMMMMMMMMMMMMMMMMMMMMMMOOO\\\cccccccccccccccccccccccccccopppqqdddcccOOO+++###GGGcccgggnnnvwwdddcccccccccccccccccccccccc___SSSMMMMMMMMMMMMMMMMMMMMMMMMPPP\\\ccccccccccccccccccccccccccccccoppwxxgggfff^^^BBB$$$:::ZZZhhhiiituuuvvdddccccccccccccccccccccccccccc```SSSMMMMMMMMMMMMMMMMMMMMMMMMPPP]]]dddddddddddddddddddddddddddddddddlllnnnhhhggg\\\DDD+++ &&&>>>XXXgggjjjnnn}qrrddddddddddddddddddddddddddddddddd```SSSMMMMMMMMMMMMMMMMMMMMMMMMPPP]]]dddeeeeeeeeeeeeeeeeeeeeeeeeeeeeeedddhhhy{{|}}nnnjjjiiidddXXXHHH888---&&&######%%%+++555DDDTTTcccjjjlllnnnz{{kkkdddeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee```SSSMMMMMMMMMMMMMMMMMMMMMMMMPPP]]]eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeennn~rssmmmlllllkjjjgggddd______dddgggjjjlllmmmnnnrrr}~~sssfffeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeaaaSSSMMMMMMMMMMMMMMMMMMMMMMMMPPP^^^eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeefffoop~zz{tuuqrqppp_``^^_pppqqqtuuyzzsssgggeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeaaaSSSMMMMMMMMMMMMMMMMMMMMMMMMPPP^^^ffffffffffffffffffffffffffffffffffffffffffffffffffffffkkkuuu~wxxmmnffgffeffffffffffffffffffffffffffffffffffffffffffffffffbbbSSSMMMMMMMMMMMMMMMMMMMMMMMMPPPaaakkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkjjjjjjjjjlllooorrsuuvwwwwwwuvvssspppmmmkkkjjjjjjkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkfffUUUMMMMMMMMMMMMMMMMMMMMMMMMRRRgggttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttnnnWWWMMMMMMMMMMMMMMMMMMMMMMMMSSSooovvvZZZMMMMMMMMMMMMMMMMMMMMMMMMUUUvvv]]]MMMMMMMMMMMMMMMMMMMMMMMMUUU|||___MMMMMMMMMMMMMMM}MMMMMMMMMUUUyyy^^^MMMMMMMMMMMMMMM MMM^MMMMMMRRRjjjyyyzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzqqqXXXMMMMMMMMMMMM*MMMMMMMMM%MMMcOOOWWW]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]ZZZQQQMMM~MMM=MMM MMMqspeakers-1.1.0/qspeakers.png0000644000175000017500000001213113153053656014312 0ustar benbenPNG  IHDR@@iqgAMA a cHRMz&u0`:pQ<bKGD pHYs  tIME5#IDATxݛIs}:kς()Re)J'W|!r)#[OCRRr]c&[$SD8Xffzfz{/^0@bI3y76R﹮mk~!Id8Nq -=7/Qo<{ t܈_;` 0 %ɮzi!J|x S$ z1W'd~e) H ^oҰp8,8o7[!JSꔳsϭy( KܥW7!",)|R0DQD\Zڝ/mKnxLa>ZM^ o)F e(QjPȌThйt(Rq}+`4)J<z/l(+>8CJE\ûSYhFٺ**U-'4Y y-Dj!b*pEQ !iyf0" i+z9ȟ!4I[\jGsF0BѨ&Ex, B:(Zv! W!N6$I0l2BD&{;N4#,Mhʏ$#Rg*51 J %*"[4X@=l^ >*/[yȹ00%i0'Bh^/^ٯJ.ܫʈZD#sZkPZ,87(~"7G1f'`L7.GTK.\Y(9 X,G0$LC@zV0ti䠴.2bp9+(7x~+ggB^iXmƼ\eɑ.Ǿ#@75B Ds;U1efb>d\д ?Θf25'l ̿fJ#9i.>(9,*>^`2 $twBSχl#\uPʮ8ƐLO% ck=KypnY|jI`Na (8dW]{ WdlKoi?ud!"gs%O^y N BsH>eS%pXAEضMZMp;o!gr&mS&\ owzCD jg#_ XҞa",ND[N-PkeYE8q\Eh@n\!,ZP0x.7lEUO|„ +L]hRΊj,Kۼq f b ۶QJa,o< .CM\.m{!X;﮲]gnihʎ*+52 fnܪi(DZÔp.1d 僻u~KwM(I8S8Ή-Hŧ[.ZcZV-惈9$f} ^ƕ#6[TیiƉdt]vV'nbb.pؓq] |x\nqppH$XEE$vA3̸&^u k͘V-dH "/9 0 ZӼ8Naw:j,CZN(.qcY#iM1r|($0̮CGn:θ5RI8nf u<[zK 8]W?.aqx MA h//\_YYRpt4d4EQ=i5ȑV*B LS}]zRJָv米x<>Wop*$6MWorxx0g_ ~)x|~<Oҙ\,j}}(v{ `f18YVq]T%*mݻǭ[~eNUj): qeYܺunP 1>xJ%\ץyk=JBj5Xm8mۅ<ҮvovAyӟ4BJR۶<|:N{.?LQBqZr *!ozNeYu0 =2>4nܸ\ image/svg+xmlOpenclipart image/svg+xml qspeakers-1.1.0/qspeakers_db.xml0000644000175000017500000001176013153053656015002 0ustar benben qspeakers-1.1.0/qspeakers_en.ts0000644000175000017500000006042713153053656014651 0ustar benben ListDialog Please select an item MainWindow Loudspeaker number vendor model Fs 0 Hz Qts Vas L Sd Re Ohm Sealed enclosure 1st order filter Simple, safe enclosure good for several speakers. Enclosure volume Ported enclosure 2nd order filter Popular enclosure type to enhance bass for most speakers. Enclosure volume (Vb) Enclosure filter resonance (Fb) Number of ports Port diameter cm Slot port x Port length Bandpass enclosure 4th order filter Enclosure for subwoofer, mostly used in 2:1, 5:1 and 7:1 systems. Sealed enclosure volume Ported enclosure volume Ported enclosure filter resonance Project Edit Ported alignments About Speaker Ctrl+I Save Ctrl+S Ctrl+E Print Print the current project Ctrl+P Quit Quit the application Ctrl+Q About QSpeakers Ctrl+A New New speaker parameters Ctrl+N Search Search a speaker Optimize Optimize frequency response Ctrl+O Modify Modify the current speaker Ctrl+M Remove Remove the current speaker Bessel <html><head/><body><p>Linear phase and fast transient response alignment.</p></body></html> Zbinden M4 <html><head/><body><p>Super boom box butterworth 4th order alignment.</p></body></html> <html><head/><body><p>Moderate alignment (infinite baffle).</p></body></html> <html><head/><body><p>Moderate alignment for indoor (infinite baffle) application.</p></body></html> Legendre Open... Open a speaker project Save the current project Save copy... Save the current project in a copy <html><head/><body><p>Extended bass response with minimum ripple.</p></body></html> Hoge BB4 <html><head/><body><p>Boom box butterworth 4th order alignment.</p></body></html> <html><head/><body><p>Boom box butterworht 4th order alignment.</p></body></html> Bullock SBB4 Sealed volume frequency response Ported volume frequency response Bandpass volumes frequency response Export File /untitled.qsp QSpeakers project (*.qsp) Project not saved The current project has not been saved. Continue anyway? Import File The current project has not been saved. Exit anyway? Removal confirmation Do you really want to remove this loudspeaker from the database? QSpeakers version Unsaved speaker This speaker is not present in the database. Would you like to insert it before to continue? Plot Frequency [Hz] Sound pressure [dB] Peak: %1 dB %1 dB at %2 Hz QObject Sealed Vol. %1 L Ported Vol. %1 L Port Diam. %1 cm Port Len. %1 cm Port Num. %1 Fb %1 Hz Vol. %1 L [Slot %1x%2 cm] number of driver(s) is SearchDialog Loudspeaker parameter is between and SpeakerDialog Vendor speaker vendor name Model speaker name or reference number Fs (Hz) Qts Vas (L) Sd (m²) Re (Ohm) Xmax (mm) qspeakers-1.1.0/qspeakers_fr.ts0000644000175000017500000006211713153053656014654 0ustar benben ListDialog Please select an item Veuillez sélectionner un item MainWindow Loudspeaker Haut-parleur number nombre vendor constructeur model modèle Fs Fs 0 0 Hz Hz Qts Qts Vas Vas L L Sd Sd Re Re Ohm Ohm Sealed enclosure Enceinte close 1st order filter filtre du premier ordre Simple, safe enclosure good for several speakers. Enceinte simple et sûre, bonne pour certains haut-parleurs. Enclosure volume Volume de l'enceinte Ported enclosure Enceinte à évent 2nd order filter filtre du second ordre Popular enclosure type to enhance bass for most speakers. Type d'enceinte réputé pour améliorer la réponse en basses pour la plupart des haut-parleurs. Enclosure volume (Vb) Volume de l'enceinte (Vb) Enclosure filter resonance (Fb) Résonnance de l'enceinte (Fb) Number of ports Nombre d'évents Port diameter Diamètre d'évent cm cm Slot port Laminaire x multiply sign x Port length Longueur d'évent Bandpass enclosure Caisson de basse 4th order filter filtre du quatrième ordre Enclosure for subwoofer, mostly used in 2:1, 5:1 and 7:1 systems. Enceinte pour subwoofer, souvent utilisée pour les systèmes 2:1, 5:1 et 7:1. Sealed enclosure volume Volume de l'enceinte close Ported enclosure volume Volume de l'enceinte à évent Ported enclosure filter resonance Résonnance de l'enceinte à évent Project Projet Edit Éditer Ported alignments Alignements avec évent About À propos Speaker Haut-parleur Ctrl+I Ctrl+I Save Enregistrer Ctrl+S Ctrl+S Ctrl+E Ctrl+E Print Imprimer Print the current project Imprime le projet Ctrl+P Ctrl+P Quit Quitter Quit the application Quitte l'application Ctrl+Q Ctrl+Q About QSpeakers À propos de QSpeakers Ctrl+A Ctrl+A New Nouveau New speaker parameters Nouveau haut-parleur Ctrl+N Ctrl+N Search Rechercher Search a speaker Recherche un haut-parleur Optimize Optimiser Optimize frequency response Optimise la réponse en fréquence Ctrl+O Ctrl+O Modify Modifier Modify the current speaker Modifie le haut-parleur Ctrl+M Ctrl+M Remove Retirer Remove the current speaker Retire le haut-parleur Bessel Bessel <html><head/><body><p>Linear phase and fast transient response alignment.</p></body></html> <html><head/><body><p>Alignement à phase linéaire et réponse transitoire courte.</p></body></html> Zbinden M4 M4 Zbinden <html><head/><body><p>Super boom box butterworth 4th order alignment.</p></body></html> <html><head/><body><p>Alignement butterworth du 4ème ordre pour un super boom box.</p></body></html> <html><head/><body><p>Moderate alignment (infinite baffle).</p></body></html> <html><head/><body><p>Moderate alignment for indoor (infinite baffle) application.</p></body></html> <html><head/><body><p>Alignment modéré (baffle infini).</p></body></html> Legendre Legendre Open... Ouvrir... Open a speaker project Ouvre un projet Save the current project Enregistre le projet Save copy... Enregistrer une copie... Save the current project in a copy Enregistre une copie du projet <html><head/><body><p>Extended bass response with minimum ripple.</p></body></html> <html><head/><body><p>Réponse étendue dans le grave avec un minimum d'oscillation.</p></body></html> Hoge BB4 BB4 Hoge <html><head/><body><p>Boom box butterworth 4th order alignment.</p></body></html> <html><head/><body><p>Boom box butterworht 4th order alignment.</p></body></html> <html><head/><body><p>Alignement butterworth du 4ème ordre pour une boom box.</p></body></html> Bullock SBB4 SBB4 Bullock Sealed volume frequency response Réponse fréquentielle de l'enceinte close Ported volume frequency response Réponse fréquentielle de l'enceinte à évent Bandpass volumes frequency response Réponse fréquentielle du caisson de basse Export File Exporter le fichier /untitled.qsp /Sans nom.qsp QSpeakers project (*.qsp) Projet QSpeakers (*.qsp) Project not saved Projet non enregistré The current project has not been saved. Continue anyway? Le.projet actuel n'a pas été enregistré. Continuer malgré tout ? Import File Importer un fichier The current project has not been saved. Exit anyway? Le projet actuel n'a pas été enregistré. Quitter malgré tout ? Removal confirmation Confirmation de la suppression Do you really want to remove this loudspeaker from the database? Voulez-vous vraiment retirer ce haut-parleur de la base de données ? QSpeakers version QSpeakers version Unsaved speaker Haut-parleur non enregistré This speaker is not present in the database. Would you like to insert it before to continue? Ce haut-parleur n'est pas présent dans la base de données. Voulez-vous l'insérer avant de continuer ? Plot Frequency [Hz] Fréquence [Hz] Sound pressure [dB] Pression sonore [dB] Peak: %1 dB Pic : %1 dB %1 dB at %2 Hz %1 dB à %2 Hz QObject Sealed Vol. %1 L Vol. Clos %1 L Ported Vol. %1 L Vol. avec évent %1 L Port Diam. %1 cm Diam. Évent %1 cm Port Len. %1 cm Long. Évent %1 cm Port Num. %1 Nombre Évent %1 Fb %1 Hz Fb %1 Hz Vol. %1 L Vol. %1 L [Slot %1x%2 cm] [Laminaire %1x%2 cm] number of driver(s) is le nombre de haut-parleur(s) est SearchDialog Loudspeaker parameter Paramètre de haut-parleur is between est entre and et SpeakerDialog Vendor Constructeur speaker vendor name nom du constructeur de haut-parleur Model Modèle speaker name or reference number nom ou numéro de référence du haut-parleur Fs (Hz) Fs (Hz) Qts Qts Vas (L) Vas (L) Sd (m²) Sd (m²) Re (Ohm) Re (Ohm) Xmax (mm) Xmax (mm) qspeakers-1.1.0/sealedbox.cpp0000644000175000017500000000222513153053656014263 0ustar benben#include #include #include "sealedbox.h" SealedBox::SealedBox(double vol) { volume = vol; } void SealedBox::setVolume(double vol) { volume = vol; } double SealedBox::getVolume() const { return volume; } QDomElement SealedBox::toDomElement(QDomDocument& doc) const { QDomElement e = Box::toDomElement(doc); e.setAttribute("type", "sealed"); QLocale c(QLocale::C); e.setAttribute("volume", c.toString(volume)); return e; } void SealedBox::fromDomElement(const QDomElement &e) { Box::fromDomElement(e); if (e.attribute("type") != "sealed") { qWarning() << __func__ << "wrong box type! (not sealed, giving up)"; return; } QLocale c(QLocale::C); volume = c.toDouble(e.attribute("volume")); } void SealedBox::render(QPainter *painter, const QRectF &area) { if (!painter) return; painter->drawRoundRect(area.toRect(), 5, 5); QString text = QObject::tr("Vol. %1 L").arg(getVolume()); QRectF where(area.left(), area.top(), area.width(), area.height()); QTextOption option(Qt::AlignVCenter|Qt::AlignLeft); painter->drawText(where, text, option); } qspeakers-1.1.0/sealedbox.h0000644000175000017500000000066313153053656013734 0ustar benben#ifndef SEALEDBOX_H #define SEALEDBOX_H #include #include "box.h" class SealedBox : public Box { public: SealedBox(double vol = 0.01); void setVolume(double vol); double getVolume(void) const; QDomElement toDomElement(QDomDocument& doc) const; void fromDomElement(const QDomElement& e); void render(QPainter *painter, const QRectF& area); private: double volume; }; #endif // SEALEDBOX_H qspeakers-1.1.0/searchdialog.cpp0000644000175000017500000000150513153053656014742 0ustar benben#include "searchdialog.h" #include "ui_searchdialog.h" #include "speakerdb.h" SearchDialog::SearchDialog(QWidget *parent) : QDialog(parent), ui(new Ui::SearchDialog) { ui->setupUi(this); QStringList params = QString("Fs,Qts,Vas,Sd,Re,Xmax").split(','); ui->searchComboBox->addItems(params); connect(this, SIGNAL(accepted()), this, SLOT(onAccepted())); connect(this, SIGNAL(rejected()), this, SLOT(onRejected())); } SearchDialog::~SearchDialog() { delete ui; } void SearchDialog::onAccepted() { QString param = ui->searchComboBox->currentText(); double min = ui->searchMinDoubleSpinBox->value(); double max = ui->searchMaxdoubleSpinBox->value(); QString p = param.toLower(); emit searchRequested(p, min, max); } void SearchDialog::onRejected() { emit searchCancelled(); } qspeakers-1.1.0/searchdialog.h0000644000175000017500000000075513153053656014415 0ustar benben#ifndef SEARCHDIALOG_H #define SEARCHDIALOG_H #include #include "speaker.h" namespace Ui { class SearchDialog; } class SearchDialog : public QDialog { Q_OBJECT public: explicit SearchDialog(QWidget *parent = 0); ~SearchDialog(); signals: void searchRequested(const QString& param, double min, double max); void searchCancelled(); private slots: void onAccepted(); void onRejected(); private: Ui::SearchDialog *ui; }; #endif // SEARCHDIALOG_H qspeakers-1.1.0/searchdialog.ui0000644000175000017500000000477513153053656014611 0ustar benben SearchDialog 0 0 194 213 0 0 Loudspeaker parameter Qt::AlignCenter is between Qt::AlignCenter and Qt::AlignCenter Qt::Horizontal QDialogButtonBox::Cancel|QDialogButtonBox::Ok searchButtonBox accepted() SearchDialog accept() 248 254 157 274 searchButtonBox rejected() SearchDialog reject() 316 260 286 274 qspeakers-1.1.0/speaker.cpp0000644000175000017500000000736113153053656013755 0ustar benben#include "speaker.h" #include Speaker::Speaker() : fs(0.0), vas(0.0), re(0.0), qts(0.0), sd(0.0), xmax(0.0) { } Speaker::Speaker(const Speaker ©) { this->fs = copy.getFs(); this->vas = copy.getVas(); this->re = copy.getRe(); this->qts = copy.getQts(); this->sd = copy.getSd(); this->xmax = copy.getXmax(); this->vendor = copy.getVendor(); this->model = copy.getModel(); } Speaker::~Speaker() { /* nothing to do, just for QMetatype */ } bool Speaker::operator!=(const Speaker& r) const { return this->fs != r.getFs() || this->vas != r.getVas() || this->re != r.getRe() || this->qts != r.getQts() || this->sd != r.getSd() || this->xmax != r.getXmax(); } bool Speaker::operator==(const Speaker& r) const { return !(*this != r); } bool Speaker::isValid() const { return !vendor.isNull() && !model.isNull(); } void Speaker::setVendor(const QString &vnd) { vendor = vnd; } void Speaker::setModel(const QString &mdl) { model = mdl; } void Speaker::setFs(double val) { fs = val; } void Speaker::setVas(double val) { vas = val; } void Speaker::setRe(double val) { re = val; } void Speaker::setQts(double val) { qts = val; } void Speaker::setSd(double val) { sd = val; } void Speaker::setXmax(double val) { xmax = val; } QString Speaker::getVendor() const { return vendor; } QString Speaker::getModel() const { return model; } double Speaker::getFs() const { return fs; } double Speaker::getVas() const { return vas; } double Speaker::getRe() const { return re; } double Speaker::getQts() const { return qts; } double Speaker::getSd() const { return sd; } double Speaker::getXmax() const { return xmax; } QDomElement Speaker::toDomElement(QDomDocument &doc) const { QDomElement e = doc.createElement("speaker"); e.setAttribute("vendor", vendor); e.setAttribute("model", model); QLocale c(QLocale::C); e.setAttribute("fs", c.toString(fs)); e.setAttribute("vas", c.toString(vas)); e.setAttribute("re", c.toString(re)); e.setAttribute("qts", c.toString(qts)); e.setAttribute("sd", c.toString(sd)); e.setAttribute("xmax", c.toString(xmax)); return e; } void Speaker::fromDomElement(const QDomElement &el) { vendor = el.attribute("vendor"); model = el.attribute("model"); QLocale c(QLocale::C); fs = c.toDouble(el.attribute("fs")); vas = c.toDouble(el.attribute("vas")); re = c.toDouble(el.attribute("re")); qts = c.toDouble(el.attribute("qts")); sd = c.toDouble(el.attribute("sd")); xmax = c.toDouble(el.attribute("xmax")); } void Speaker::render(QPainter *painter, const QRectF &area) { if (!painter) return; painter->drawRoundRect(area.toRect(), 5, 5); QString params[6]; params[0] = QString::fromUtf8("Fs: %1 Hz").arg(getFs()); params[1] = QString::fromUtf8("Qts: %1").arg(getQts()); params[2] = QString::fromUtf8("Vas: %1 L").arg(getVas()); params[3] = QString::fromUtf8("Sd: %1 m²").arg(getSd()); params[4] = QString::fromUtf8("Xmax: %1 mm").arg(getXmax()); params[5] = QString::fromUtf8("Re: %1 Ohm").arg(getRe()); qreal tab = area.left(); QString text = getVendor() + " " + getModel(); QRectF where(area.left(), area.top(), area.width(), area.height() / 2); QTextOption option(Qt::AlignCenter); painter->drawText(where, text, option); for (int i = 0; i < 6; i++) { where.setRect(tab, area.top() + area.height() / 2, area.width() / 6, area.height() / 2); text = params[i]; option.setAlignment(Qt::AlignVCenter|Qt::AlignLeft); painter->drawText(where, text, option); tab += area.width() / 6; } } qspeakers-1.1.0/speaker.h0000644000175000017500000000226713153053656013422 0ustar benben#ifndef SPEAKER_H #define SPEAKER_H #include #include #include class Speaker { public: Speaker(); Speaker(const Speaker& copy); ~Speaker(); bool operator!=(const Speaker& r) const; bool operator==(const Speaker& r) const; bool isValid(void) const; void setVendor(const QString& vnd); void setModel(const QString& mdl); void setFs(double val); void setVas(double val); void setRe(double val); void setQts(double val); void setSd(double val); void setXmax(double val); QString getVendor() const; QString getModel() const; double getFs(void) const; double getVas(void) const; double getRe(void) const; double getQts(void) const; double getSd(void) const; double getXmax() const; QDomElement toDomElement(QDomDocument& doc) const; void fromDomElement(const QDomElement& el); void render(QPainter *painter, const QRectF& area); private: QString vendor; QString model; double fs; // Hz double vas; // L double re; // Ohm double qts; // unitless double sd; // m² double xmax; // mm }; Q_DECLARE_METATYPE(Speaker) #endif // SPEAKER_H qspeakers-1.1.0/speakerdb.cpp0000644000175000017500000002577413153053656014273 0ustar benben#include "speakerdb.h" #include #include #include #if QT_VERSION >= QT_VERSION_CHECK(5,0,0) #include #endif #include #include #include #include #include #include #include #include QString SpeakerDb::getPath(void) { #if QT_VERSION >= QT_VERSION_CHECK(5,0,0) QString prefix = QStandardPaths::writableLocation(QStandardPaths::DataLocation); #else QString prefix = QDesktopServices::storageLocation(QDesktopServices::DataLocation); #endif QDir dir(prefix); if (!dir.exists()) dir.mkpath(prefix); QString path = prefix + QDir::separator() + DB_FILENAME; return path; } QDomDocument SpeakerDb::getDoc(void) { QDomImplementation impl = QDomDocument().implementation(); QString name = "QSpeakers"; QString publicId = "-//HEREWE//DTD QSpeakers 1.0 //EN"; QString systemId = "http://def.herewe.org/DTD/qspeakers1.dtd"; QDomDocument doc(impl.createDocumentType(name, publicId, systemId)); doc.appendChild(doc.createComment("QSpeakers db of Thiele-Small parameters")); return doc; } QList SpeakerDb::getModelsByVendor(const QString& vendor) { QString path = getPath(); QFile file(path); QDomDocument doc = getDoc(); if (file.exists()) { file.open(QIODevice::ReadOnly); doc.setContent(&file); file.close(); } QDomNodeList speakers = doc.elementsByTagName("speaker"); QList list; for (int i = 0; i < speakers.size(); i++) { QDomNode s = speakers.at(i); QDomElement spk = s.toElement(); QString vnd = spk.attribute("vendor"); QString mdl = spk.attribute("model"); if (vnd == vendor) list.append(mdl); } qSort(list); return list; } QList SpeakerDb::getByVendor(const QString &vendor) { QString path = getPath(); QFile file(path); QDomDocument doc = getDoc(); if (file.exists()) { file.open(QIODevice::ReadOnly); doc.setContent(&file); file.close(); } QDomNodeList xspeakers = doc.elementsByTagName("speaker"); QList speakers; for (int i = 0; i < xspeakers.size(); i++) { QDomNode s = xspeakers.at(i); QDomElement spk = s.toElement(); if (spk.attribute("vendor") == vendor) { Speaker speaker; speaker.fromDomElement(spk); speakers.append(speaker); } } return speakers; } QList SpeakerDb::getByValue(QString var, double min, double max) { QString path = getPath(); QFile file(path); QDomDocument doc = getDoc(); if (file.exists()) { file.open(QIODevice::ReadOnly); doc.setContent(&file); file.close(); } QDomNodeList xspeakers = doc.elementsByTagName("speaker"); QList speakers; for (int i = 0; i < xspeakers.size(); i++) { QDomNode s = xspeakers.at(i); QDomElement spk = s.toElement(); QLocale c(QLocale::C); if (c.toDouble(spk.attribute(var)) >= min && c.toDouble(spk.attribute(var)) <= max) { Speaker speaker; speaker.fromDomElement(spk); speakers.append(speaker); } } return speakers; } /* two-way merge, where user db is prioritized (return true if had to resolve conflict) */ bool SpeakerDb::merge(QFile &with) { if (!with.exists()) return false; bool ret = false; QString path = getPath(); QFile file(path); QDomDocument doc = getDoc(); QDomDocument xml = getDoc(); if (file.exists()) { file.open(QIODevice::ReadOnly); doc.setContent(&file); file.close(); } with.open(QIODevice::ReadOnly); xml.setContent(&with); with.close(); QDomNodeList speakerlist = doc.elementsByTagName("speaker"); QDomNodeList withlist = xml.elementsByTagName("speaker"); QDomDocument temp = getDoc(); QDomElement troot = temp.createElement("speakers"); temp.appendChild(troot); /* first way */ for (int i = 0; i < withlist.size(); i++) { bool conflict = false; QDomNode s_ = withlist.at(i); QDomElement spk_ = s_.toElement(); QString vnd_ = spk_.attribute("vendor"); QString mdl_ = spk_.attribute("model"); for (int j = 0; j < speakerlist.size(); j++) { QDomNode s = speakerlist.at(j); QDomElement spk = s.toElement(); QString vnd = spk.attribute("vendor"); QString mdl = spk.attribute("model"); if ((vnd.toUpper() == vnd_.toUpper()) && (mdl.toUpper() == mdl_.toUpper())) { conflict = true; ret = true; /* copy the element from user's db to the temporary xml */ QDomElement t = spk.cloneNode(true).toElement(); t.normalize(); troot.appendChild(t); break; } } if (conflict) continue; /* no conflict, so append the new speaker */ QDomElement t_ = spk_.cloneNode(true).toElement(); t_.normalize(); troot.appendChild(t_); } /* prepend temp in merged */ QDomDocument merged(temp); QDomElement mroot = merged.firstChildElement("speakers"); QDomNodeList templist = temp.elementsByTagName("speaker"); /* second way */ for (int i = 0; i < speakerlist.size(); i++) { bool already; QDomNode s = speakerlist.at(i); QDomElement spk = s.toElement(); QString vnd = spk.attribute("vendor"); QString mdl = spk.attribute("model"); for (int j = 0; j < templist.size(); j++) { QDomNode s_ = templist.at(j); QDomElement spk_ = s_.toElement(); QString vnd_ = spk_.attribute("vendor"); QString mdl_ = spk_.attribute("model"); if ((vnd.toUpper() == vnd_.toUpper()) && (mdl.toUpper() == mdl_.toUpper())) { already = true; break; } } if (already) continue; /* not already inserted, so append the old speaker */ QDomElement m = spk.cloneNode(true).toElement(); m.normalize(); mroot.appendChild(m); } QDomNodeList mergedlist = merged.elementsByTagName("speaker"); /* write back */ QFile wfile(path); wfile.open(QIODevice::WriteOnly); wfile.write(merged.toByteArray()); wfile.close(); return ret; } QDateTime SpeakerDb::lastModified() { QFileInfo info(getPath()); return info.lastModified(); } QDateTime SpeakerDb::pkgInstalled() { QFile pkg_db(PKG_DB); if (pkg_db.exists()) { QFileInfo info(PKG_DB); return info.lastModified(); } /* necessary for ms-win32 */ QFile cwd_db(DB_FILENAME); if (cwd_db.exists()) { QFileInfo info(DB_FILENAME); return info.lastModified(); } qWarning() << "no pkg db found, returning current datetime as db access!"; return QDateTime(); } QString SpeakerDb::pkgPath() { QFile pkg_db(PKG_DB); if (pkg_db.exists()) return PKG_DB; /* necessary for ms-win32 */ QFile cwd_db(DB_FILENAME); if (cwd_db.exists()) return DB_FILENAME; qWarning() << "no pkg db found, return empty path!"; return QString(); } QList SpeakerDb::getByFs(double min, double max) { return getByValue("fs", min, max); } QList SpeakerDb::getBySd(double min, double max) { return getByValue("sd", min, max); } QList SpeakerDb::getByVas(double min, double max) { return getByValue("vas", min, max); } QList SpeakerDb::getByQts(double min, double max) { return getByValue("qts", min, max); } QList SpeakerDb::getByRe(double min, double max) { return getByValue("re", min, max); } QList SpeakerDb::getByXmax(double min, double max) { return getByValue("xmax", min, max); } QList SpeakerDb::getVendors(void) { QString path = getPath(); QFile file(path); QDomDocument doc= getDoc(); if (file.exists()) { file.open(QIODevice::ReadOnly); doc.setContent(&file); file.close(); } QDomNodeList speakers = doc.elementsByTagName("speaker"); QList list; for (int i = 0; i < speakers.size(); i++) { QDomNode s = speakers.at(i); QDomElement spk = s.toElement(); QString vnd = spk.attribute("vendor"); if (list.contains(vnd)) /* avoid duplicates */ continue; list.append(vnd); } qSort(list); return list; } bool SpeakerDb::exists() { QString path = getPath(); QFile file(path); return file.exists(); } void SpeakerDb::insertOrReplace(const QString& vendor, const QString& model, const Speaker& speaker) { QString path = getPath(); QFile file(path); QDomDocument doc = getDoc(); QDomDocument xml = getDoc(); QDomElement wroot = xml.createElement("speakers"); xml.appendChild(wroot); if (file.exists()) { file.open(QIODevice::ReadOnly); doc.setContent(&file); file.close(); } QDomNodeList speakerlist = doc.elementsByTagName("speaker"); for (int i = 0; i < speakerlist.size(); i++) { QDomNode s = speakerlist.at(i); QDomElement spk = s.toElement(); QString vnd = spk.attribute("vendor"); QString mdl = spk.attribute("model"); if ((vnd == vendor) && (mdl == model)) /* 'delete' it for future insert */ continue; /* copy the element to the writeable xml, otherwise we will have a messy loop */ QDomElement w = spk.cloneNode(true).toElement(); w.normalize(); wroot.appendChild(w); } if (speaker.isValid()) { /* append the new speaker */ QDomElement n = speaker.toDomElement(xml); if (speaker.getVendor() != vendor || speaker.getModel() != model) qDebug() << "inserted/updated speaker vendor or name changed."; n.normalize(); wroot.appendChild(n); } /* write back */ QFile wfile(path); wfile.open(QIODevice::WriteOnly); wfile.write(xml.toByteArray()); wfile.close(); } void SpeakerDb::removeByVendorAndModel(const QString &vendor, const QString &model) { return insertOrReplace(vendor, model, Speaker()); } Speaker SpeakerDb::getByVendorAndModel(const QString &vendor, const QString &model) { QString path = getPath(); QFile file(path); QDomDocument doc = getDoc(); if (file.exists()) { file.open(QIODevice::ReadOnly); doc.setContent(&file); file.close(); } QDomNodeList speakers = doc.elementsByTagName("speaker"); Speaker speaker; for (int i = 0; i < speakers.size(); i++) { QDomNode s = speakers.at(i); QDomElement spk = s.toElement(); QString vnd = spk.attribute("vendor"); QString mdl = spk.attribute("model"); if ((vnd == vendor) && (mdl == model)) { speaker.fromDomElement(spk); break; } } return speaker; } qspeakers-1.1.0/speakerdb.h0000644000175000017500000000262413153053656013725 0ustar benben#ifndef SPEAKERDB_H #define SPEAKERDB_H #include #include #include #include "speaker.h" #include "config.h" #define PKG_DB DATADIR "/qspeakers/qspeakers_db.xml" class SpeakerDb { public: static bool exists(void); static void insertOrReplace(const QString& vendor, const QString& name, const Speaker& speaker); static void removeByVendorAndModel(const QString& vendor, const QString& model); static Speaker getByVendorAndModel(const QString& vendor, const QString& model); static QList getVendors(void); static QList getModelsByVendor(const QString& vendor); static QList getByVendor(const QString& vendor); static QList getByFs(double min, double max); static QList getBySd(double min, double max); static QList getByVas(double min, double max); static QList getByQts(double min, double max); static QList getByRe(double min, double max); static QList getByXmax(double min, double max); static QList getByValue(QString var, double min, double max); static bool merge(QFile& with); static QDateTime lastModified(void); static QDateTime pkgInstalled(void); static QString pkgPath(void); private: static QString getPath(void); static QDomDocument getDoc(void); #define DB_FILENAME "qspeakers_db.xml" }; #endif // SPEAKERDB_H qspeakers-1.1.0/speakerdialog.cpp0000644000175000017500000000626213153053656015134 0ustar benben#include #include #include "speakerdialog.h" #include "ui_speakerdialog.h" #include "speaker.h" #include "speakerdb.h" SpeakerDialog::SpeakerDialog(QWidget *parent) : QDialog(parent), ui(new Ui::SpeakerDialog) { ui->setupUi(this); /* do not enable 'ok' since model and vendor are empty */ ui->speakerButtonBox->button(QDialogButtonBox::Ok)->setEnabled(false); connect(this, SIGNAL(accepted()), this, SLOT(onSpeakerAccepted())); connect(this, SIGNAL(rejected()), this, SLOT(onSpeakerRejected())); connect(ui->vendorLineEdit, SIGNAL(textChanged(QString)), this, SLOT(onVendorTextChanged(QString))); connect(ui->modelLineEdit, SIGNAL(textChanged(QString)), this, SLOT(onModelTextChanged(QString))); } SpeakerDialog::SpeakerDialog(const Speaker &edit, QWidget *parent) : QDialog(parent), ui(new Ui::SpeakerDialog) { ui->setupUi(this); ui->fsDoubleSpinBox->setValue(edit.getFs()); ui->qtsDoubleSpinBox->setValue(edit.getQts()); ui->vasDoubleSpinBox->setValue(edit.getVas()); ui->reDoubleSpinBox->setValue(edit.getRe()); ui->sdDoubleSpinBox->setValue(edit.getSd()); ui->xmaxDoubleSpinBox->setValue(edit.getXmax()); oldVendor = edit.getVendor(); oldModel = edit.getModel(); ui->vendorLineEdit->setText(oldVendor); ui->modelLineEdit->setText(oldModel); connect(this, SIGNAL(accepted()), this, SLOT(onSpeakerAccepted())); connect(this, SIGNAL(rejected()), this, SLOT(onSpeakerRejected())); connect(ui->vendorLineEdit, SIGNAL(textChanged(QString)), this, SLOT(onVendorTextChanged(QString))); connect(ui->modelLineEdit, SIGNAL(textChanged(QString)), this, SLOT(onModelTextChanged(QString))); } SpeakerDialog::~SpeakerDialog() { delete ui; } void SpeakerDialog::onVendorTextChanged(QString text) { if (text.isNull() || text.isEmpty()) ui->speakerButtonBox->button(QDialogButtonBox::Ok)->setEnabled(false); else if (!ui->modelLineEdit->text().isNull() && !ui->modelLineEdit->text().isEmpty()) ui->speakerButtonBox->button(QDialogButtonBox::Ok)->setEnabled(true); } void SpeakerDialog::onModelTextChanged(QString text) { if (text.isNull() || text.isEmpty()) ui->speakerButtonBox->button(QDialogButtonBox::Ok)->setEnabled(false); else if (!ui->vendorLineEdit->text().isNull() && !ui->vendorLineEdit->text().isEmpty()) ui->speakerButtonBox->button(QDialogButtonBox::Ok)->setEnabled(true); } void SpeakerDialog::onSpeakerAccepted() { Speaker spk; QString vendor = ui->vendorLineEdit->text(); QString model = ui->modelLineEdit->text(); spk.setVendor(vendor); spk.setModel(model); spk.setFs(ui->fsDoubleSpinBox->value()); spk.setVas(ui->vasDoubleSpinBox->value()); spk.setQts(ui->qtsDoubleSpinBox->value()); spk.setRe(ui->reDoubleSpinBox->value()); spk.setSd(ui->sdDoubleSpinBox->value()); spk.setXmax(ui->xmaxDoubleSpinBox->value()); if (oldVendor.isNull() || oldModel.isNull()) { SpeakerDb::insertOrReplace(vendor, model, spk); } else { SpeakerDb::insertOrReplace(oldVendor, oldModel, spk); } emit speakerInserted(spk); } void SpeakerDialog::onSpeakerRejected() { emit speakerCancelled(); } qspeakers-1.1.0/speakerdialog.h0000644000175000017500000000124413153053656014574 0ustar benben#ifndef SPEAKERDIALOG_H #define SPEAKERDIALOG_H #include #include "speaker.h" namespace Ui { class SpeakerDialog; } class SpeakerDialog : public QDialog { Q_OBJECT public: explicit SpeakerDialog(QWidget *parent = 0); SpeakerDialog(const Speaker& edit, QWidget *parent = 0); ~SpeakerDialog(); signals: void speakerInserted(Speaker spk); void speakerCancelled(); private slots: void onVendorTextChanged(QString text); void onModelTextChanged(QString text); void onSpeakerAccepted(); void onSpeakerRejected(); private: Ui::SpeakerDialog *ui; QString oldVendor; QString oldModel; }; #endif // SPEAKERDIALOG_H qspeakers-1.1.0/speakerdialog.ui0000644000175000017500000001117313153053656014764 0ustar benben SpeakerDialog 0 0 400 317 QFormLayout::AllNonFixedFieldsGrow Vendor speaker vendor name Model speaker name or reference number Fs (Hz) Qts Vas (L) Sd (m²) 2 999.990000000000009 2 9999.989999999999782 8 Re (Ohm) Xmax (mm) true Qt::Horizontal QDialogButtonBox::Cancel|QDialogButtonBox::Ok speakerButtonBox accepted() SpeakerDialog accept() 248 254 157 274 speakerButtonBox rejected() SpeakerDialog reject() 316 260 286 274 qspeakers-1.1.0/system.h0000644000175000017500000000126213153053656013306 0ustar benben#ifndef SYSTEM_H #define SYSTEM_H #include "speaker.h" #include "box.h" #include "sealedbox.h" #include "portedbox.h" #include "bandpassbox.h" class System { public: System(const Speaker &s, const SealedBox *b, unsigned int number = 1); System(const Speaker &s, const PortedBox *b, unsigned int number = 1); System(const Speaker &s, const BandPassBox *b, unsigned int number = 1); double response(double f); void render(QPainter *painter, const QRectF& area); private: #define SEALED 0 #define PORTED 1 #define BANDPASS 2 Speaker speaker; const Box* box; int type; int sibling; /* number of same drivers (not for push-pull!) */ }; #endif // SYSTEM_H qspeakers-1.1.0/system.cpp0000644000175000017500000000600513153053656013641 0ustar benben#include #include #include "system.h" #include "sealedbox.h" #include "portedbox.h" #include "bandpassbox.h" #define Q 7 /* common ported box resonance quality loss */ #define QL 10000 /* common box losses */ System::System(const Speaker& s, const SealedBox *b, unsigned int number) : speaker(s), box(b), type(SEALED), sibling(number) { } System::System(const Speaker& s, const PortedBox *b, unsigned int number) : speaker(s), box(b), type(PORTED), sibling(number) { } System::System(const Speaker& s, const BandPassBox *b, unsigned int number) : speaker(s), box(b), type(BANDPASS), sibling(number) { } double System::response(double f) { if (type == SEALED) { SealedBox *b = (SealedBox *)box; double vr = speaker.getVas() * sibling / b->getVolume(); double qr = sqrt(vr + 1.0); double qtc = qr * speaker.getQts(); double fb = qr * speaker.getFs(); double fr = pow(f / fb, 2.0); double db = 10 * log10(pow(fr, 2.0) / (pow(fr - 1, 2.0) + fr/pow(qtc, 2.0))); return db; } else if (type == PORTED) { PortedBox *b = (PortedBox *)box; double A = pow(b->getResFreq() / speaker.getFs(), 2.0); double B = A / speaker.getQts() + b->getResFreq() / (Q * speaker.getFs() * speaker.getQts()); double C = 1.0 + A + (speaker.getVas() * sibling / b->getBoxVolume()) + b->getResFreq() / (Q * speaker.getFs() * speaker.getQts()); double D = 1.0 / speaker.getQts() + b->getResFreq() / (Q * speaker.getFs()); double fn2 = pow(f / speaker.getFs(), 2.0); double fn4 = pow(fn2, 2.0); double db = 10 * log10(pow(fn4, 2.0) / (pow(fn4 - C * fn2 + A, 2.0) + fn2 * pow(D * fn2 - B, 2.0))); return db; } else { BandPassBox *b = (BandPassBox *)box; double A = pow(1.0 / (b->getPortedBoxResFreq()), 2.0) * pow(f, 4.0); double B = ((1 / QL + (speaker.getFs() / b->getPortedBoxResFreq()) / speaker.getQts()) / b->getPortedBoxResFreq()) * pow(f, 3.0); double C = (((1 + speaker.getVas() * sibling / b->getSealedBoxVolume() + speaker.getVas() * sibling / b->getPortedBoxVolume()) * speaker.getFs() / b->getPortedBoxResFreq() + (1 / speaker.getQts()) / QL) * speaker.getFs() / b->getPortedBoxResFreq() + 1) * pow(f, 2.0); double D = ((1 / speaker.getQts() + (speaker.getFs() / b->getPortedBoxResFreq()) / QL * (speaker.getVas() * sibling / b->getSealedBoxVolume() + 1)) * speaker.getFs()) * f; double E = (speaker.getVas() * sibling / b->getSealedBoxVolume() + 1) * pow(speaker.getFs(), 2); double G = A - C + E; double H = -B + D; double db = 20 * log10(pow(f, 2.0) / sqrt(pow(G, 2.0) + pow(H, 2.0))); return db; } } void System::render(QPainter *painter, const QRectF& area) { QString text = QObject::tr("number of driver(s) is ") + QString::number(sibling); QTextOption option(Qt::AlignLeft); painter->drawText(area, text, option); } qspeakers-1.1.0/qspeakers.pro0000644000175000017500000000564213153053656014337 0ustar benben#------------------------------------------------- # # Project created by QtCreator 2014-09-23T08:12:05 # #------------------------------------------------- QT += core gui xml greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport greaterThan(QT_VERSION, 5.8): QT += charts VERSION = 1.1.0 TARGET = qspeakers TEMPLATE = app unix { isEmpty(PREFIX): PREFIX = /usr/local isEmpty(BINDIR): BINDIR = $$PREFIX/bin isEmpty(DATADIR): DATADIR = $$PREFIX/share } win32 { isEmpty(PREFIX): PREFIX = "C:/Program Files/QSpeakers" isEmpty(BINDIR): BINDIR = $$PREFIX isEmpty(DATADIR): DATADIR = $$PREFIX } config.input = config.h.in config.output = config.h QMAKE_SUBSTITUTES += config SOURCES += main.cpp\ mainwindow.cpp \ speakerdialog.cpp \ speakerdb.cpp \ speaker.cpp \ importexport.cpp \ box.cpp \ sealedbox.cpp \ portedbox.cpp \ bandpassbox.cpp \ plot.cpp \ listdialog.cpp \ searchdialog.cpp \ system.cpp HEADERS += mainwindow.h \ speakerdialog.h \ speakerdb.h \ speaker.h \ importexport.h \ box.h \ sealedbox.h \ portedbox.h \ bandpassbox.h \ plot.h \ listdialog.h \ searchdialog.h \ system.h FORMS += mainwindow.ui \ speakerdialog.ui \ listdialog.ui \ searchdialog.ui isEmpty(QMAKE_LRELEASE):QMAKE_LRELEASE = $$[QT_INSTALL_BINS]/lrelease TRANSLATIONS += \ qspeakers_en.ts \ qspeakers_fr.ts LOCALE_DIR = locale updateqm.input = TRANSLATIONS updateqm.output = $$LOCALE_DIR/${QMAKE_FILE_BASE}.qm updateqm.commands = $$QMAKE_LRELEASE ${QMAKE_FILE_IN} -qm $$LOCALE_DIR/${QMAKE_FILE_BASE}.qm updateqm.CONFIG += no_link target_predeps QMAKE_EXTRA_COMPILERS += updateqm unix { MANPAGE = "qspeakers.1" manpage.input = MANPAGE manpage.output = $${MANPAGE}.gz manpage.commands = gzip --to-stdout ${QMAKE_FILE_IN} > ${QMAKE_FILE_OUT} manpage.CONFIG += no_link target_predeps QMAKE_EXTRA_COMPILERS += manpage } unix { target.path = $$BINDIR manual.path = $$DATADIR/man/man1 manual.files = $${MANPAGE}.gz manual.CONFIG = no_check_exist database.path = $$DATADIR/qspeakers database.files = "qspeakers_db.xml" translations.path = $$DATADIR/$${TARGET} translations.files = $${LOCALE_DIR} mime.path = $$DATADIR/mime/packages mime.files = application-x-$${TARGET}.xml desktop.path = $$DATADIR/applications desktop.files = $${TARGET}.desktop icon.path = $$DATADIR/pixmaps icon.files = qspeakers.png INSTALLS += target \ manual \ database \ translations \ mime \ desktop \ icon } win32 { target.path = $$BINDIR database.path = $$DATADIR database.files = qspeakers_db.xml translations.path = $$DATADIR/$${TARGET} translations.files = $${LOCALE_DIR} RC_ICONS += qspeakers.ico INSTALLS += target \ database \ translations \ } qspeakers-1.1.0/mainwindow.h0000644000175000017500000000647213153053656014146 0ustar benben#ifndef MAINWINDOW_H #define MAINWINDOW_H #include #include #include #include "speakerdialog.h" #include "searchdialog.h" #include "listdialog.h" #include "speaker.h" #include "sealedbox.h" #include "portedbox.h" #include "bandpassbox.h" #include "plot.h" namespace Ui { class MainWindow; } class MainWindow : public QMainWindow { Q_OBJECT public: explicit MainWindow(QWidget *parent = 0); ~MainWindow(); signals: void currentSpeakerChanged(Speaker spk); void currentSealedBoxChanged(SealedBox box); void currentPortedBoxChanged(PortedBox box); void currentBandPassBoxChanged(BandPassBox box); public slots: void onProjectSave(); void onProjectExport(); void onProjectImport(); void onProjectQuit(); void onSpeakerNew(); void onSpeakerRemove(); void onSpeakerModify(); void onSpeakerInserted(Speaker spk); void onSpeakerCancelled(); void onEditOptimize(); void onSpeakerSearch(); void onProjectPrint(); void onAboutAbout(); void onSearchRequested(const QString& param, double min, double max); void onSearchCancelled(); void onSpeakerItemSelected(QString title, const Speaker &speaker); void onSpeakerItemCancelled(); void onCurrentTabChanged(int tab); void onNumberSpinChanged(int number); void onVendorChanged(QString vendor); void onModelChanged(QString model); void onCurrentSpeakerChanged(const Speaker& spk); void onCurrentSealedBoxChanged(const SealedBox& box); void onCurrentPortedBoxChanged(const PortedBox& box); void onCurrentBandPassBoxChanged(const BandPassBox& box); void onSealedVolumeDoubleSpinChanged(double val); void onPortedVolumeDoubleSpinChanged(double val); void onPortedResonanceDoubleSpinChanged(double val); void onPortedPortsNumberSpinChanged(int val); void onPortedPortDiameterDoubleSpinChanged(double val); void onPortedSlotWidthDoubleSpinChanged(double val); void onBandPassSealedVolumeDoubleSpinChanged(double val); void onBandPassPortedVolumeDoubleSpinChanged(double val); void onBandPassPortedResonanceDoubleSpinChanged(double val); void onBandPassPortNumSpinChanged(int val); void onBandPassPortDiameterDoubleSpinChanged(double val); void onAlignModerate_Inf(); void onAlignLegendre(); void onAlignBessel(); void onAlignBullock(); void onAlignKeele_Hoge(); protected: bool print(QPrinter* printer); void syncUiFromCurrentSpeaker(const Speaker &spk); void syncUiFromCurrentSealedBox(const SealedBox& box); void syncUiFromCurrentPortedBox(const PortedBox& box); void syncUiFromCurrentBandPassBox(const BandPassBox& box); void setActivateActions(QList actions, bool enable); void setCurrentSpeaker(const Speaker& spk); private: static QString getHome(); Ui::MainWindow *ui; bool projectSaved; bool isModifying; SpeakerDialog *spkDialog; QFileDialog *fileDialog; SearchDialog *searchDialog; ListDialog *listDialog; Speaker currentSpeaker; int currentSpeakerNumber; SealedBox currentSealedBox; PortedBox currentPortedBox; BandPassBox currentBandPassBox; int currentTabIndex; Plot *sealedPlot; Plot *portedPlot; Plot *bandpassPlot; const Speaker *notInDbSpeaker; }; #endif // MAINWINDOW_H qspeakers-1.1.0/README0000644000175000017500000000154513153053656012475 0ustar benbenBuilding QSpeakers: Pre requisites: Install Qt5 (and QtCharts) library. Don't forget to install the development header files too. Compilation: You can use both command-line compilation or QtCreator. See below: In short, for Qt5 on Debian Buster, this should do the trick: $ sudo apt-get install qt5-default qttools5-dev-tools $ cd qspeakers $ qmake -config release && make && sudo make install Using QSpeakers: Start it by your window manager's menu, or /usr/local/bin/qspeakers from a shell. Choose a loudspeaker, or create a new one you want to build an enclosure for. Change the box parameters or click 'Optimize'. Contributing: If you want, you can read TODO and start contribute, or write litterals translations in your own language. Thanks: Thanks to Upacesky for his drawing: https://openclipart.org/detail/202508/ Happy DIY! qspeakers-1.1.0/INFO0000644000175000017500000000224313153053656012267 0ustar benben- about frequency response formulae: http://www.diysubwoofers.org/ - about multiple instance of the same loudspeaker: Two drivers in series: Re, Le, Sd, Vas and Bl double and the sensitivity is the same as for one driver. Two drivers in parallel: Re and Le are halved, Sd and Vas double (Bl same as for one driver) and the sensitivity increases by 6dB. Qes, Qms and Qts don't change for either combination, remaining same as for one driver. - about Legendre bass-reflex alignment: Fb = 0.3802 * pow(Qts, 1.0657) * Fs Vb = 10.728 * pow(Qts, 2.4186) * Vas (see: https://sites.google.com/site/francisaudio69/5-l-enceinte-acoustique/5-6-comment-calculer-une-enceinte-bass-reflex) - about Bessel bass-refex alignment: Fb = 0.3552 * pow(Qts, 0.9649) * Fs Vb = 8.0707 * pow(Qts, 2.5848) * Vas (see: same site as above) - about the Zbinden M4 alignment: for average baffle: Volume = (2.68 * Qts - 0.45) * Vas Tuning frequency = 0.41 * sqrt(1/(Qts*Qts) + 0.97) * Fs the one above is used in QSpeakers. for infinite baffle or car application: Volume = (2.52 * Qts - 0.35) * Vas Tuning frequency = 0.32 * sqrt(1/(Qts*Qts) + 3.38) * Fs (see: http://www.mzbinden.ch/ventedalignments/index.html) qspeakers-1.1.0/mainwindow.cpp0000644000175000017500000010400313153053656014466 0ustar benben#include #include #include #include #include #include #if QT_VERSION >= QT_VERSION_CHECK(5,0,0) #include #endif #include #include "mainwindow.h" #include "ui_mainwindow.h" #include "speakerdb.h" #include "importexport.h" #include "plot.h" #include "searchdialog.h" #include "listdialog.h" #include "system.h" MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow), projectSaved(false), isModifying(false), spkDialog(NULL), fileDialog(NULL), searchDialog(NULL), listDialog(NULL), currentSpeakerNumber(0), currentTabIndex(-1), sealedPlot(NULL), portedPlot(NULL), bandpassPlot(NULL), notInDbSpeaker(NULL) { ui->setupUi(this); /* insert QChartView plotters in ui */ QHBoxLayout *ly1 = new QHBoxLayout(ui->sealedVolumePlotWidget); sealedPlot = new Plot(tr("Sealed volume frequency response"), ui->sealedVolumePlotWidget); sealedPlot->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Ignored); ly1->insertWidget(0, sealedPlot); QHBoxLayout *ly2 = new QHBoxLayout(ui->portedPlotWidget); portedPlot = new Plot(tr("Ported volume frequency response"), ui->portedPlotWidget); portedPlot->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Ignored); ly2->insertWidget(0, portedPlot); QHBoxLayout *ly3 = new QHBoxLayout(ui->bandpassPlotWidget); bandpassPlot = new Plot(tr("Bandpass volumes frequency response"), ui->bandpassPlotWidget); bandpassPlot->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Ignored); ly3->insertWidget(0, bandpassPlot); /* test db */ if (!SpeakerDb::exists() || (SpeakerDb::lastModified() < SpeakerDb::pkgInstalled())) { QFile pkg_db(SpeakerDb::pkgPath()); if (SpeakerDb::merge(pkg_db)) qDebug() << "merged db"; } /* fill speaker combos */ ui->vendorComboBox->addItems(SpeakerDb::getVendors()); ui->modelComboBox->addItems(SpeakerDb::getModelsByVendor(ui->vendorComboBox->currentText())); /* restore last saved project... */ ImportExport::restoreProject(currentSpeaker, currentSealedBox, currentPortedBox, currentBandPassBox, ¤tSpeakerNumber, ¤tTabIndex); projectSaved = true; /* on first run, no speaker. reset to the speaker of the combos if needed */ if (!currentSpeaker.isValid()) { currentSpeaker = SpeakerDb::getByVendorAndModel(ui->vendorComboBox->currentText(), ui->modelComboBox->currentText()); } /* display sibling number */ ui->numberSpinBox->setValue(currentSpeakerNumber); /* select restored tab */ ui->tabWidget->setCurrentIndex(currentTabIndex); /* tab index change is not connected yet, do menu modifications manually */ if (currentTabIndex != 1) { /* index != 1 needs to deactivate the ported alignments menu */ setActivateActions(ui->menuPorted_alignments->actions(), false); } syncUiFromCurrentSpeaker(currentSpeaker); syncUiFromCurrentSealedBox(currentSealedBox); syncUiFromCurrentPortedBox(currentPortedBox); syncUiFromCurrentBandPassBox(currentBandPassBox); /* display speaker's values */ ui->fsValueLabel->setNum(currentSpeaker.getFs()); ui->qtsValueLabel->setNum(currentSpeaker.getQts()); ui->vasValueLabel->setNum(currentSpeaker.getVas()); ui->sdValueLabel->setNum(currentSpeaker.getSd()); ui->reValueLabel->setNum(currentSpeaker.getRe()); /* * connections */ /* drivers number spin action */ connect(ui->numberSpinBox, SIGNAL(valueChanged(int)), this, SLOT(onNumberSpinChanged(int))); /* combos action */ connect(ui->vendorComboBox, SIGNAL(activated(QString)), this, SLOT(onVendorChanged(QString))); connect(ui->modelComboBox, SIGNAL(activated(QString)), this, SLOT(onModelChanged(QString))); /* menu actions */ connect(ui->actionProjectSave, SIGNAL(triggered()), this, SLOT(onProjectSave())); connect(ui->actionProjectQuit, SIGNAL(triggered()), this, SLOT(onProjectQuit())); connect(ui->actionSpeakerNew, SIGNAL(triggered()), this, SLOT(onSpeakerNew())); connect(ui->actionSpeakerModify, SIGNAL(triggered()), this, SLOT(onSpeakerModify())); connect(ui->actionSpeakerRemove, SIGNAL(triggered()), this, SLOT(onSpeakerRemove())); connect(ui->actionProjectExport, SIGNAL(triggered()), this, SLOT(onProjectExport())); connect(ui->actionProjectImport, SIGNAL(triggered()), this, SLOT(onProjectImport())); connect(ui->actionEditOptimize, SIGNAL(triggered()), this, SLOT(onEditOptimize())); connect(ui->actionSpeakerSearch, SIGNAL(triggered()), this, SLOT(onSpeakerSearch())); connect(ui->actionProjectPrint, SIGNAL(triggered()), this, SLOT(onProjectPrint())); connect(ui->actionAbout, SIGNAL(triggered()), this, SLOT(onAboutAbout())); /* ported alignments sub-menu */ connect(ui->actionModerate_Inf, SIGNAL(triggered()), this, SLOT(onAlignModerate_Inf())); connect(ui->actionLegendre, SIGNAL(triggered()), this, SLOT(onAlignLegendre())); connect(ui->actionBessel, SIGNAL(triggered()), this, SLOT(onAlignBessel())); connect(ui->actionBullock, SIGNAL(triggered()), this, SLOT(onAlignBullock())); connect(ui->actionKeele_Hoge, SIGNAL(triggered()), this, SLOT(onAlignKeele_Hoge())); /* tabs actions */ connect(ui->tabWidget, SIGNAL(currentChanged(int)), this, SLOT(onCurrentTabChanged(int))); connect(ui->sealedVolumeDoubleSpinBox, SIGNAL(valueChanged(double)), this, SLOT(onSealedVolumeDoubleSpinChanged(double))); connect(ui->portedVolumeDoubleSpinBox, SIGNAL(valueChanged(double)), this, SLOT(onPortedVolumeDoubleSpinChanged(double))); connect(ui->portedResonancedoubleSpinBox, SIGNAL(valueChanged(double)), this, SLOT(onPortedResonanceDoubleSpinChanged(double))); connect(ui->portedPortsNumberSpinBox, SIGNAL(valueChanged(int)), this, SLOT(onPortedPortsNumberSpinChanged(int))); connect(ui->portedPortDiameterDoubleSpinBox, SIGNAL(valueChanged(double)), this, SLOT(onPortedPortDiameterDoubleSpinChanged(double))); connect(ui->portedPortSlotWidthDoubleSpinBox, SIGNAL(valueChanged(double)), this, SLOT(onPortedSlotWidthDoubleSpinChanged(double))); connect(ui->bandPassSealedVolumeDoubleSpinBox, SIGNAL(valueChanged(double)), this, SLOT(onBandPassSealedVolumeDoubleSpinChanged(double))); connect(ui->bandPassPortedVolumeDoubleSpinBox, SIGNAL(valueChanged(double)), this, SLOT(onBandPassPortedVolumeDoubleSpinChanged(double))); connect(ui->bandPassPortedResonanceDoubleSpinBox, SIGNAL(valueChanged(double)), this, SLOT(onBandPassPortedResonanceDoubleSpinChanged(double))); connect(ui->bandPassPortsNumberSpinBox, SIGNAL(valueChanged(int)), this, SLOT(onBandPassPortNumSpinChanged(int))); connect(ui->bandPassPortDiameterDoubleSpinBox, SIGNAL(valueChanged(double)), this, SLOT(onBandPassPortDiameterDoubleSpinChanged(double))); /* app state */ connect(this, SIGNAL(currentSpeakerChanged(Speaker)), this, SLOT(onCurrentSpeakerChanged(const Speaker&))); connect(this, SIGNAL(currentSealedBoxChanged(SealedBox)), this, SLOT(onCurrentSealedBoxChanged(const SealedBox&))); connect(this, SIGNAL(currentPortedBoxChanged(PortedBox)), this, SLOT(onCurrentPortedBoxChanged(const PortedBox&))); connect(this, SIGNAL(currentBandPassBoxChanged(BandPassBox)), this, SLOT(onCurrentBandPassBoxChanged(const BandPassBox&))); } MainWindow::~MainWindow() { delete ui; } void MainWindow::onProjectSave() { projectSaved = true; ImportExport::saveProject(currentSpeaker, currentSealedBox, currentPortedBox, currentBandPassBox, currentSpeakerNumber, currentTabIndex); } void MainWindow::onProjectExport() { QString home = MainWindow::getHome(); QString fileName = QFileDialog::getSaveFileName(this, tr("Export File"), home + tr("/untitled.qsp"), tr("QSpeakers project (*.qsp)")); QFile file(fileName); ImportExport::exportProject(file, currentSpeaker, currentSealedBox, currentPortedBox, currentBandPassBox, currentSpeakerNumber, currentTabIndex); } void MainWindow::onProjectImport() { if (!projectSaved) { QMessageBox::StandardButton pressed = QMessageBox::question(this, tr("Project not saved"), tr("The current project has not been saved. Continue anyway?"), QMessageBox::Yes|QMessageBox::No); if (pressed == QMessageBox::No) return; } QString home = MainWindow::getHome(); QString fileName = QFileDialog::getOpenFileName(this, tr("Import File"), home, tr("QSpeakers project (*.qsp)")); /* user cancelled */ if (fileName.isEmpty()) return; QFile file(fileName); ImportExport::importProject(currentSpeaker, currentSealedBox, currentPortedBox, currentBandPassBox, ¤tSpeakerNumber, ¤tTabIndex, file); ImportExport::setSavePath(fileName); setWindowFilePath(ImportExport::getSavePath()); ui->numberSpinBox->setValue(currentSpeakerNumber); ui->tabWidget->setCurrentIndex(currentTabIndex); syncUiFromCurrentSpeaker(currentSpeaker); syncUiFromCurrentSealedBox(currentSealedBox); syncUiFromCurrentPortedBox(currentPortedBox); syncUiFromCurrentBandPassBox(currentBandPassBox); emit currentSpeakerChanged(currentSpeaker); emit currentSealedBoxChanged(currentSealedBox); emit currentPortedBoxChanged(currentPortedBox); emit currentBandPassBoxChanged(currentBandPassBox); } void MainWindow::onProjectQuit() { if (projectSaved) { this->close(); return; } if (!currentSpeaker.isValid()) this->close(); QMessageBox::StandardButton pressed = QMessageBox::question(this, tr("Project not saved"), tr("The current project has not been saved. Exit anyway?"), QMessageBox::Yes|QMessageBox::No); if (pressed == QMessageBox::Yes) this->close(); } void MainWindow::syncUiFromCurrentSpeaker(const Speaker& spk) { if (!spk.isValid()) return; /* look if vendor is in the db */ QList speakers = SpeakerDb::getByVendor(spk.getVendor()); if (speakers.count() == 0) { /* if this is an unknown vendor, insert in combo */ ui->vendorComboBox->insertItem(0, spk.getVendor()); ui->vendorComboBox->setCurrentIndex(0); ui->modelComboBox->clear(); /* this means also a new model */ ui->modelComboBox->insertItem(0, spk.getModel()); ui->modelComboBox->setCurrentIndex(0); notInDbSpeaker = &spk; } else { /* select correct vendor */ ui->vendorComboBox->setCurrentIndex(ui->vendorComboBox->findText(spk.getVendor())); /* fill speakers of this vendor */ ui->modelComboBox->clear(); ui->modelComboBox->addItems(SpeakerDb::getModelsByVendor(spk.getVendor())); for (int i = 0; i < speakers.count(); i++) { Speaker speaker = speakers[i]; if (speaker.getModel() == spk.getModel()) { if (speaker != spk) { /* speaker conflict, renaming */ currentSpeaker.setModel(speaker.getModel() + "*"); ui->modelComboBox->addItem(spk.getModel()); ui->modelComboBox->setCurrentIndex(ui->modelComboBox->findText(spk.getModel())); notInDbSpeaker = &spk; } else { /* okay, select correct combo */ ui->modelComboBox->setCurrentIndex(ui->modelComboBox->findText(spk.getModel())); notInDbSpeaker = NULL; } } } } } void MainWindow::syncUiFromCurrentSealedBox(const SealedBox& box) { ui->sealedVolumeDoubleSpinBox->setValue(box.getVolume()); System s(currentSpeaker, &box, currentSpeakerNumber); sealedPlot->clear(); for (double f = sealedPlot->getXmin(); f < portedPlot->getXmax(); f *= pow(10, 1.0/100.0)) { double db = s.response(f); sealedPlot->appendPointF(QPointF(f, db)); } sealedPlot->draw3dbVLine(); } void MainWindow::syncUiFromCurrentPortedBox(const PortedBox& box) { ui->portedVolumeDoubleSpinBox->setValue(box.getBoxVolume()); ui->portedResonancedoubleSpinBox->setValue(box.getResFreq()); ui->portedPortsNumberSpinBox->setValue(box.getPortNum()); ui->portedPortDiameterDoubleSpinBox->setValue(box.getPortDiam()); ui->portedPortSlotWidthDoubleSpinBox->setValue(box.getSlotWidth()); ui->portedPortSlotHeightLineEdit->setText(QString::number(box.getSlotHeight(), 'f', 2)); ui->portedPortLengthLineEdit->setText(QString::number(box.getPortLen(), 'f', 2)); System s(currentSpeaker, &box, currentSpeakerNumber); portedPlot->clear(); for (double f = portedPlot->getXmin(); f < portedPlot->getXmax(); f *= pow(10, 1.0/100.0)) { double db = s.response(f); portedPlot->appendPointF(QPointF(f, db)); } portedPlot->draw3dbVLine(); } void MainWindow::syncUiFromCurrentBandPassBox(const BandPassBox& box) { ui->bandPassSealedVolumeDoubleSpinBox->setValue(box.getSealedBoxVolume()); ui->bandPassPortedVolumeDoubleSpinBox->setValue(box.getPortedBoxVolume()); ui->bandPassPortedResonanceDoubleSpinBox->setValue(box.getPortedBoxResFreq()); ui->bandPassPortsNumberSpinBox->setValue(box.getPortedBoxPortNum()); ui->bandPassPortDiameterDoubleSpinBox->setValue(box.getPortedBoxPortDiam()); ui->bandPassPortLengthLineEdit->setText(QString::number(box.getPortedBoxPortLen(), 'f', 2)); System s(currentSpeaker, &box, currentSpeakerNumber); bandpassPlot->clear(); for (double f = bandpassPlot->getXmin(); f < bandpassPlot->getXmax(); f *= pow(10, 1.0/100.0)) { double db = s.response(f); bandpassPlot->appendPointF(QPointF(f, db)); } bandpassPlot->draw3dbVLine(); } void MainWindow::setCurrentSpeaker(const Speaker &spk) { if ((currentSpeaker.getVendor() == spk.getVendor()) && (currentSpeaker.getModel() == spk.getModel())) return; currentSpeaker = spk; emit currentSpeakerChanged(spk); } bool MainWindow::print(QPrinter *printer) { QPainter painter; if (!painter.begin(printer)) return false; QRect page = printer->pageRect(); qreal step = page.height() / 8; currentSpeaker.render(&painter, QRectF(page.left(), page.top(), page.width(), step)); if (ui->tabWidget->currentWidget() == ui->sealedTab) { System s(currentSpeaker, ¤tSealedBox, currentSpeakerNumber); s.render(&painter, QRectF(page.left(), page.top() + step, page.width(), page.height() / 16)); step += page.height() / 16; currentSealedBox.render(&painter, QRectF(page.left(), page.top() + step, page.width(), page.height() / 16)); step += page.height() / 16; sealedPlot->setUseOpenGL(false); sealedPlot->render(&painter, QRectF(page.left(), page.top() + step, page.width(), page.height() - step)); sealedPlot->setUseOpenGL(true); } else if (ui->tabWidget->currentWidget() == ui->portedTab) { System s(currentSpeaker, ¤tPortedBox, currentSpeakerNumber); s.render(&painter, QRectF(page.left(), page.top() + step, page.width(), page.height() / 16)); step += page.height() / 16; currentPortedBox.render(&painter, QRectF(page.left(), page.top() + step, page.width(), page.height() / 16)); step += page.height() / 16; portedPlot->setUseOpenGL(false); portedPlot->render(&painter, QRectF(page.left(), page.top() + step, page.width(), page.height() - step)); portedPlot->setUseOpenGL(true); } else { System s(currentSpeaker, ¤tBandPassBox, currentSpeakerNumber); s.render(&painter, QRectF(page.left(), page.top() + step, page.width(), page.height()/ 16)); step += page.height() / 16; currentBandPassBox.render(&painter, QRectF(page.left(), page.top() + step, page.width(), page.height() / 16)); step += page.height() / 16; bandpassPlot->setUseOpenGL(false); bandpassPlot->render(&painter, QRectF(page.left(), page.top() + step, page.width(), page.height() - step)); bandpassPlot->setUseOpenGL(true); } painter.end(); return true; } QString MainWindow::getHome() { QString home; #if QT_VERSION >= QT_VERSION_CHECK(5,0,0) home = QStandardPaths::writableLocation(QStandardPaths::HomeLocation); #else home = QDesktopServices::storageLocation(QDesktopServices::HomeLocation); #endif return home; } void MainWindow::onSpeakerNew() { isModifying = false; spkDialog = new SpeakerDialog(this); connect(spkDialog, SIGNAL(speakerInserted(Speaker)), this, SLOT(onSpeakerInserted(Speaker))); connect(spkDialog, SIGNAL(speakerCancelled()), this, SLOT(onSpeakerCancelled())); spkDialog->show(); } void MainWindow::onSpeakerRemove() { QMessageBox::StandardButton pressed = QMessageBox::question(this, tr("Removal confirmation"), tr("Do you really want to remove this loudspeaker from the database?"), QMessageBox::Yes|QMessageBox::No); if (pressed == QMessageBox::No) return; QString vendor = currentSpeaker.getVendor(); QString model = currentSpeaker.getModel(); int num = SpeakerDb::getModelsByVendor(currentSpeaker.getVendor()).size(); ui->modelComboBox->removeItem(ui->modelComboBox->currentIndex()); if (num == 1) { ui->vendorComboBox->removeItem(ui->vendorComboBox->currentIndex()); } SpeakerDb::removeByVendorAndModel(vendor, model); } void MainWindow::onSpeakerModify() { isModifying = true; spkDialog = new SpeakerDialog(currentSpeaker, this); connect(spkDialog, SIGNAL(speakerInserted(Speaker)), this, SLOT(onSpeakerInserted(Speaker))); connect(spkDialog, SIGNAL(speakerCancelled()), this, SLOT(onSpeakerCancelled())); spkDialog->show(); } void MainWindow::onSpeakerInserted(Speaker spk) { if (isModifying) { int idx; idx = ui->vendorComboBox->currentIndex(); ui->vendorComboBox->setItemText(idx, spk.getVendor()); idx = ui->modelComboBox->currentIndex(); ui->modelComboBox->setItemText(idx, spk.getModel()); currentSpeaker = spk; emit currentSpeakerChanged(currentSpeaker); } else { int idx = ui->vendorComboBox->findText(spk.getVendor()); if (idx == -1) ui->vendorComboBox->addItem(spk.getVendor()); else if (idx == ui->vendorComboBox->currentIndex()) ui->modelComboBox->addItem(spk.getModel()); } disconnect(spkDialog, SIGNAL(speakerInserted(Speaker)), this, SLOT(onSpeakerInserted(Speaker))); disconnect(spkDialog, SIGNAL(speakerCancelled()), this, SLOT(onSpeakerCancelled())); spkDialog->close(); delete spkDialog; spkDialog = NULL; } void MainWindow::onSpeakerCancelled() { disconnect(spkDialog, SIGNAL(speakerInserted(Speaker)), this, SLOT(onSpeakerInserted(Speaker))); disconnect(spkDialog, SIGNAL(speakerCancelled()), this, SLOT(onSpeakerCancelled())); spkDialog->close(); delete spkDialog; spkDialog = NULL; } void MainWindow::onEditOptimize() { if (ui->tabWidget->currentWidget() == ui->sealedTab) { double qr = 0.707 / currentSpeaker.getQts(); double vr = pow(qr, 2.0) - 1; currentSealedBox.setVolume(currentSpeaker.getVas() * currentSpeakerNumber / vr); emit currentSealedBoxChanged(currentSealedBox); } else if (ui->tabWidget->currentWidget() == ui->portedTab) { /* approx. "natural max flat", a good starting point */ currentPortedBox.setBoxVolume(20 * currentSpeaker.getVas() * currentSpeakerNumber * pow(currentSpeaker.getQts(), 3.3)); currentPortedBox.setResFreq(currentSpeaker.getFs() * pow(currentSpeaker.getVas() * currentSpeakerNumber / currentPortedBox.getBoxVolume(), 0.31)); currentPortedBox.updatePorts(currentSpeaker.getSd() * currentSpeakerNumber, currentSpeaker.getXmax()); emit currentPortedBoxChanged(currentPortedBox); } else { /* optimization constants */ double pa = 0.0; double s = 0.7; //double b = 0.7206; double qbp = pow((pow(10.0,(-pa/40.0)) * 2 * s ), -1); //double fl = (-b + pow(pow(b, 2.0) + 4 * pow(qbp, 2.0), 0.5) / 2.0) * (currentSpeaker.getFs() / currentSpeaker.getQts()); //double fh = fl + (b * currentSpeaker.getFs() / currentSpeaker.getQts()); double fb = qbp * currentSpeaker.getFs() / currentSpeaker.getQts(); double vf = pow(2 * s * currentSpeaker.getQts(), 2) * currentSpeaker.getVas() * currentSpeakerNumber; double vr = currentSpeaker.getVas() * currentSpeakerNumber / (pow(qbp / currentSpeaker.getQts(), 2) - 1); currentBandPassBox.setSealedBoxVolume(vr); currentBandPassBox.setPortedBoxVolume(vf); currentBandPassBox.setPortedBoxResFreq(fb); currentBandPassBox.updatePortedBoxPorts(currentSpeaker.getSd() * currentSpeakerNumber, currentSpeaker.getXmax()); emit currentBandPassBoxChanged(currentBandPassBox); } } void MainWindow::onAlignModerate_Inf() { if (ui->tabWidget->currentWidget() == ui->portedTab) { /* use M4 Moderate alignment (see http://www.mzbinden.ch/ventedalignments/index.html) */ currentPortedBox.setBoxVolume((2.52 * currentSpeaker.getQts() - 0.35) * currentSpeaker.getVas() * currentSpeakerNumber); currentPortedBox.setResFreq(0.32 * sqrt((1.0/pow(currentSpeaker.getQts(), 2.0)) + 3.38) * currentSpeaker.getFs()); currentPortedBox.updatePorts(currentSpeaker.getSd() * currentSpeakerNumber, currentSpeaker.getXmax()); emit currentPortedBoxChanged(currentPortedBox); } } void MainWindow::onAlignLegendre() { if (ui->tabWidget->currentWidget() == ui->portedTab) { currentPortedBox.setBoxVolume(10.728 * pow(currentSpeaker.getQts(), 2.4186) * currentSpeaker.getVas() * currentSpeakerNumber); currentPortedBox.setResFreq(0.3802 * pow(currentSpeaker.getQts(), -1.0657) * currentSpeaker.getFs()); currentPortedBox.updatePorts(currentSpeaker.getSd() * currentSpeakerNumber, currentSpeaker.getXmax()); emit currentPortedBoxChanged(currentPortedBox); } } void MainWindow::onAlignBessel() { if (ui->tabWidget->currentWidget() == ui->portedTab) { currentPortedBox.setBoxVolume(8.0707 * pow(currentSpeaker.getQts(), 2.5848) * currentSpeaker.getVas() * currentSpeakerNumber); currentPortedBox.setResFreq(0.3552 * pow(currentSpeaker.getQts(), -0.9649) * currentSpeaker.getFs()); currentPortedBox.updatePorts(currentSpeaker.getSd() * currentSpeakerNumber, currentSpeaker.getXmax()); emit currentPortedBoxChanged(currentPortedBox); } } void MainWindow::onAlignKeele_Hoge() { /* BB4 */ if (ui->tabWidget->currentWidget() == ui->portedTab) { currentPortedBox.setBoxVolume(currentSpeaker.getVas() * currentSpeakerNumber * 5.2358 * pow(currentSpeaker.getQts(), 2.1687)); currentPortedBox.setResFreq(currentSpeaker.getFs()); currentPortedBox.updatePorts(currentSpeaker.getSd() * currentSpeakerNumber, currentSpeaker.getXmax()); emit currentPortedBoxChanged(currentPortedBox); } } void MainWindow::onAlignBullock() { /* SBB4 */ if (ui->tabWidget->currentWidget() == ui->portedTab) { double qts = currentSpeaker.getQts(); currentPortedBox.setBoxVolume(qts * currentSpeaker.getVas() * currentSpeakerNumber * (4.96 * qts - 0.136)); currentPortedBox.setResFreq(currentSpeaker.getFs()); currentPortedBox.updatePorts(currentSpeaker.getSd() * currentSpeakerNumber, currentSpeaker.getXmax()); emit currentPortedBoxChanged(currentPortedBox); } } void MainWindow::onSpeakerSearch() { searchDialog = new SearchDialog(this); connect(searchDialog, SIGNAL(searchRequested(const QString&, double, double)), this, SLOT(onSearchRequested(const QString&, double, double))); connect(searchDialog, SIGNAL(searchCancelled()), this, SLOT(onSearchCancelled())); searchDialog->show(); } void MainWindow::onProjectPrint() { QPrinter printer; printer.setCreator("QSpeakers"); printer.setOrientation(QPrinter::Landscape); QPrintDialog dialog(&printer, this); if (dialog.exec() == QDialog::Accepted) { print(&printer); } } void MainWindow::onAboutAbout() { QMessageBox::about(this, tr("About QSpeakers"), tr("QSpeakers version " VERSION "\n\n" "This program simulates common acoustical enclosures behaviour to help designing loudspeaker systems.\n\n" "This program is free software, copyright (C) 2014 Benoit Rouits and released under the GNU General Public Lisence " "version 3. It is delivered as is in the hope it can be useful, but with no warranty of correctness.")); } void MainWindow::onSearchRequested(const QString& param, double min, double max) { disconnect(searchDialog, SIGNAL(searchRequested(const QString&, double, double)), this, SLOT(onSearchRequested(const QString&, double, double))); disconnect(searchDialog, SIGNAL(searchCancelled()), this, SLOT(onSearchCancelled())); searchDialog->close(); delete searchDialog; searchDialog = NULL; QList speakers = SpeakerDb::getByValue(param, min, max); listDialog = new ListDialog(speakers, this); connect(listDialog, SIGNAL(speakerItemSelected(QString, const Speaker&)), this, SLOT(onSpeakerItemSelected(QString, const Speaker&))); connect(listDialog, SIGNAL(speakerItemCancelled()), this, SLOT(onSpeakerItemCancelled())); listDialog->show(); } void MainWindow::onSearchCancelled() { disconnect(searchDialog, SIGNAL(searchRequested(const QString&, double, double)), this, SLOT(onSearchRequested(const QString&, double, double))); disconnect(searchDialog, SIGNAL(searchCancelled()), this, SLOT(onSearchCancelled())); searchDialog->close(); delete searchDialog; searchDialog = NULL; } void MainWindow::onSpeakerItemSelected(QString title, const Speaker& speaker) { qDebug() << title; if (speaker.isValid()) { setCurrentSpeaker(speaker); syncUiFromCurrentSpeaker(speaker); } disconnect(listDialog, SIGNAL(speakerItemSelected(QString, const Speaker&)), this, SLOT(onSpeakerItemSelected(QString, const Speaker&))); disconnect(listDialog, SIGNAL(speakerItemCancelled()), this, SLOT(onSpeakerItemCancelled())); listDialog->close(); delete listDialog; listDialog = NULL; } void MainWindow::onSpeakerItemCancelled() { disconnect(listDialog, SIGNAL(speakerItemSelected(QString,const Speaker&)), this, SLOT(onSpeakerItemSelected(QString,const Speaker&))); disconnect(listDialog, SIGNAL(speakerItemCancelled()), this, SLOT(onSpeakerItemCancelled())); listDialog->close(); delete listDialog; listDialog = NULL; } void MainWindow::setActivateActions(QList actions, bool enable) { for (int i = 0; i < actions.count(); i++) { actions[i]->setEnabled(enable); } } void MainWindow::onCurrentTabChanged(int tab) { if (tab == currentTabIndex) return; QList alignments = ui->menuPorted_alignments->actions(); currentTabIndex = tab; switch (tab) { case 0: { setActivateActions(alignments, false); syncUiFromCurrentSealedBox(currentSealedBox); break; } case 1: { setActivateActions(alignments, true); syncUiFromCurrentPortedBox(currentPortedBox); break; } case 2: { setActivateActions(alignments, false); syncUiFromCurrentBandPassBox(currentBandPassBox); break; } default: break; } } void MainWindow::onNumberSpinChanged(int number) { if (currentSpeakerNumber == number) return; currentSpeakerNumber = number; /* the user may have used the "?" fake speaker */ if (!currentSpeaker.isValid()) { qDebug() << "invalid speaker, not computing."; return; } projectSaved = false; if (ui->tabWidget->currentWidget() == ui->sealedTab) syncUiFromCurrentSealedBox(currentSealedBox); else if (ui->tabWidget->currentWidget() == ui->portedTab) syncUiFromCurrentPortedBox(currentPortedBox); else syncUiFromCurrentBandPassBox(currentBandPassBox); } void MainWindow::onVendorChanged(QString vendor) { if (notInDbSpeaker) { QMessageBox::StandardButton pressed = QMessageBox::question(this, tr("Unsaved speaker"), tr("This speaker is not present in the database. Would you like to insert it before to continue?"), QMessageBox::Yes|QMessageBox::No); if (pressed == QMessageBox::Yes) { SpeakerDb::insertOrReplace(notInDbSpeaker->getVendor(), notInDbSpeaker->getModel(), *notInDbSpeaker); notInDbSpeaker = NULL; } } /* fill speakers of this vendor */ ui->modelComboBox->clear(); ui->modelComboBox->addItems(SpeakerDb::getModelsByVendor(vendor)); /* insert a fake speaker to let the choice to the user */ ui->modelComboBox->insertItem(0, "?"); ui->modelComboBox->setCurrentIndex(0); setCurrentSpeaker(Speaker()); } void MainWindow::onModelChanged(QString model) { if (model.isNull() || model.isEmpty()) return; if (notInDbSpeaker) { QMessageBox::StandardButton pressed = QMessageBox::question(this, tr("Unsaved speaker"), tr("This speaker is not present in the database. Would you like to insert it before to continue?"), QMessageBox::Yes|QMessageBox::No); if (pressed == QMessageBox::Yes) { SpeakerDb::insertOrReplace(notInDbSpeaker->getVendor(), notInDbSpeaker->getModel(), *notInDbSpeaker); notInDbSpeaker = NULL; } } if ((ui->modelComboBox->findText("?") == 0) && (ui->modelComboBox->currentIndex() != 0)) { /* user choose a speaker; safely remove fake speaker */ ui->modelComboBox->removeItem(0); } QString vendor = ui->vendorComboBox->currentText(); setCurrentSpeaker(SpeakerDb::getByVendorAndModel(vendor, model)); } void MainWindow::onCurrentSpeakerChanged(const Speaker &spk) { ui->fsValueLabel->setNum(spk.getFs()); ui->qtsValueLabel->setNum(spk.getQts()); ui->vasValueLabel->setNum(spk.getVas()); ui->sdValueLabel->setNum(spk.getSd()); ui->reValueLabel->setNum(spk.getRe()); /* the user may have activated the "?" fake speaker */ if (!spk.isValid()) { qDebug() << "invalid speaker, not computing."; return; } projectSaved = false; if (ui->tabWidget->currentWidget() == ui->sealedTab) syncUiFromCurrentSealedBox(currentSealedBox); else if (ui->tabWidget->currentWidget() == ui->portedTab) syncUiFromCurrentPortedBox(currentPortedBox); else syncUiFromCurrentBandPassBox(currentBandPassBox); } void MainWindow::onCurrentSealedBoxChanged(const SealedBox &box) { if (!currentSpeaker.isValid()) return; projectSaved = false; if (ui->tabWidget->currentWidget() == ui->sealedTab) syncUiFromCurrentSealedBox(box); } void MainWindow::onCurrentPortedBoxChanged(const PortedBox &box) { if (!currentSpeaker.isValid()) return; projectSaved = false; if (ui->tabWidget->currentWidget() == ui->portedTab) syncUiFromCurrentPortedBox(box); } void MainWindow::onCurrentBandPassBoxChanged(const BandPassBox &box) { if (!currentSpeaker.isValid()) return; projectSaved = false; if (ui->tabWidget->currentWidget() == ui->bandpassTab) syncUiFromCurrentBandPassBox(box); } void MainWindow::onSealedVolumeDoubleSpinChanged(double val) { currentSealedBox.setVolume(val); emit currentSealedBoxChanged(currentSealedBox); } void MainWindow::onPortedVolumeDoubleSpinChanged(double val) { currentPortedBox.setBoxVolume(val); currentPortedBox.updatePorts(currentSpeaker.getSd() * currentSpeakerNumber, currentSpeaker.getXmax()); emit currentPortedBoxChanged(currentPortedBox); } void MainWindow::onPortedResonanceDoubleSpinChanged(double val) { currentPortedBox.setResFreq(val); currentPortedBox.updatePorts(currentSpeaker.getSd() * currentSpeakerNumber, currentSpeaker.getXmax()); emit currentPortedBoxChanged(currentPortedBox); } void MainWindow::onPortedPortsNumberSpinChanged(int val) { currentPortedBox.setPortNum(val); currentPortedBox.updatePorts(currentSpeaker.getSd()* currentSpeakerNumber, currentSpeaker.getXmax()); emit currentPortedBoxChanged(currentPortedBox); } void MainWindow::onPortedPortDiameterDoubleSpinChanged(double val) { /* allow manual decrease/increase of port diameter */ currentPortedBox.setPortDiam(val); currentPortedBox.updateSlots(); currentPortedBox.updatePortsLength(); emit currentPortedBoxChanged(currentPortedBox); } void MainWindow::onPortedSlotWidthDoubleSpinChanged(double val) { currentPortedBox.setSlotWidth(val); emit currentPortedBoxChanged(currentPortedBox); } void MainWindow::onBandPassSealedVolumeDoubleSpinChanged(double val) { currentBandPassBox.setSealedBoxVolume(val); emit currentBandPassBoxChanged(currentBandPassBox); } void MainWindow::onBandPassPortedVolumeDoubleSpinChanged(double val) { currentBandPassBox.setPortedBoxVolume(val); currentBandPassBox.updatePortedBoxPorts(currentSpeaker.getSd() * currentSpeakerNumber, currentSpeaker.getXmax()); emit currentBandPassBoxChanged(currentBandPassBox); } void MainWindow::onBandPassPortedResonanceDoubleSpinChanged(double val) { currentBandPassBox.setPortedBoxResFreq(val); currentBandPassBox.updatePortedBoxPorts(currentSpeaker.getSd() * currentSpeakerNumber, currentSpeaker.getXmax()); emit currentBandPassBoxChanged(currentBandPassBox); } void MainWindow::onBandPassPortNumSpinChanged(int val) { currentBandPassBox.setPortedBoxPortNum(val); currentBandPassBox.updatePortedBoxPorts(currentSpeaker.getSd() * currentSpeakerNumber, currentSpeaker.getXmax()); emit currentBandPassBoxChanged(currentBandPassBox); } void MainWindow::onBandPassPortDiameterDoubleSpinChanged(double val) { currentBandPassBox.setPortedBoxPortDiam(val); currentBandPassBox.updatePortedBoxPortsLength(); emit currentBandPassBoxChanged(currentBandPassBox); } qspeakers-1.1.0/plot.h0000644000175000017500000000202713153053656012740 0ustar benben#ifndef PLOT_H #define PLOT_H #include class Plot : public QChartView { Q_OBJECT public: Plot(QWidget *parent = 0); Plot(QString title, QWidget *parent = 0); ~Plot(); void appendPointF(const QPointF& pointf); void plot(const QList x, QListy); void clear(void); void setUseOpenGL(bool enable = true); void draw3dbVLine(); double getXmin() const; double getXmax() const; protected: void initializeScales(); void initializeChart(const QString& title = nullptr); void initializeCurve(); void resizeEvent(QResizeEvent *event); void mousePressEvent(QMouseEvent *event); void mouseMoveEvent(QMouseEvent *event); void mouseReleaseEvent(QMouseEvent *event); double curveXfromY(double y); double curveYfromX(double x); private: QLineSeries *curve; QChart *chart; double xmin; double xmax; QGraphicsSimpleTextItem *pointerLabel; QGraphicsLineItem *vLine; QGraphicsSimpleTextItem *vLabel; }; #endif // PLOT_H qspeakers-1.1.0/plot.cpp0000644000175000017500000001152613153053656013277 0ustar benben#include "plot.h" #include using namespace QtCharts; Plot::Plot(QWidget *parent) : QChartView(parent), xmin(10.0), xmax(1000.0), pointerLabel(nullptr), vLine(nullptr), vLabel(nullptr) { initializeChart(); initializeCurve(); initializeScales(); } Plot::Plot(QString title, QWidget *parent) : QChartView(parent), xmin(10.0), xmax(1000.0), pointerLabel(nullptr), vLine(nullptr), vLabel(nullptr) { initializeChart(title); initializeCurve(); initializeScales(); } Plot::~Plot() { curve->clear(); delete chart; delete curve; delete vLine; delete vLabel; delete pointerLabel; } void Plot::appendPointF(const QPointF &pointf) { curve->append(pointf); } void Plot::plot(const QList x, QList y) { QList samples; for (int i = 0; i < x.size(); i++) { QPointF p(x[i], y[i]); curve->append(p); } } void Plot::clear() { curve->clear(); } void Plot::setUseOpenGL(bool enable) { curve->setUseOpenGL(enable); } void Plot::initializeCurve() { curve = new QLineSeries(chart); curve->setUseOpenGL(true); chart->addSeries(curve); } void Plot::draw3dbVLine() { double x = curveXfromY(-3.0); double y1 = 10.0, y2 = -40.0; QPointF value1(x, y1); QPointF point1 = chart->mapToPosition(value1); QPointF value2 = QPoint(x, y2); QPointF point2 = chart->mapToPosition(value2); QLineF line (point1, point2); if (vLine) { this->scene()->removeItem(vLine); delete vLine; vLine = nullptr; } vLine = this->scene()->addLine(line, QPen(Qt::DashLine)); if (vLabel) { this->scene()->removeItem(vLabel); delete vLabel; vLabel = nullptr; } QString label = QString(tr("%1 dB at %2 Hz")).arg(-3.0).arg(round(x)); vLabel = this->scene()->addSimpleText(label); QPointF pos = chart->mapToPosition(value1); vLabel->setPos(pos); } void Plot::resizeEvent(QResizeEvent *event) { QChartView::resizeEvent(event); draw3dbVLine(); } void Plot::mousePressEvent(QMouseEvent *event) { if (!pointerLabel) { QPoint pos = event->pos(); QPointF val = chart->mapToValue(pos); double y = curveYfromX(val.x()); QString label = QString(tr("%1 dB at %2 Hz")).arg(round(y)).arg(round(val.x())); pointerLabel = this->scene()->addSimpleText(label); pointerLabel->setPos(pos.x() - pointerLabel->boundingRect().width(), pos.y() - pointerLabel->boundingRect().height()); event->accept(); } } void Plot::mouseMoveEvent(QMouseEvent *event) { if (pointerLabel) { QPoint pos = event->pos(); QPointF val = chart->mapToValue(pos); double y = curveYfromX(val.x()); QString label = QString(tr("%1 dB at %2 Hz")).arg(round(y)).arg(round(val.x())); pointerLabel->setText(label); pointerLabel->setPos(pos.x() - pointerLabel->boundingRect().width(), pos.y() - pointerLabel->boundingRect().height()); event->accept(); } } void Plot::mouseReleaseEvent(QMouseEvent *event) { if (pointerLabel) { this->scene()->removeItem(pointerLabel); delete pointerLabel; pointerLabel = nullptr; event->accept(); } } double Plot::curveXfromY(double y) { double x = 1.0; QList list = curve->points(); for (int i = 0; i < list.size() - 1; i++) { QPointF p1 = list.at(i); QPointF p2 = list.at(i+1); if (p1.y() <= y && p2.y() > y) { x = p1.x(); break; } } return x; } double Plot::curveYfromX(double x) { double y = 0.0; QList list = curve->points(); for (int i = 0; i < list.size() - 1; i++) { QPointF p1 = list.at(i); QPointF p2 = list.at(i+1); if (p1.x() <= x && p2.x() > x) { y = p1.y(); break; } } return y; } double Plot::getXmax() const { return xmax; } double Plot::getXmin() const { return xmin; } void Plot::initializeChart(const QString& title) { chart = new QChart(); chart->setTitle(title); chart->legend()->hide(); this->setChart(chart); this->setRenderHint(QPainter::Antialiasing); } void Plot::initializeScales() { QLogValueAxis *XAxis = new QLogValueAxis(); XAxis->setBase(10.0); XAxis->setLabelFormat("%g"); XAxis->setTitleText(tr("Frequency [Hz]")); XAxis->setMax(xmax); XAxis->setMin(xmin); XAxis->setMinorTickCount(8); chart->addAxis(XAxis, Qt::AlignBottom); curve->attachAxis(XAxis); QValueAxis *YAxis = new QValueAxis(); YAxis->setTitleText(tr("Sound pressure [dB]")); YAxis->setLabelFormat("%g"); YAxis->setMax(10); YAxis->setMin(-40); YAxis->setTickCount(6); YAxis->setMinorTickCount(1); chart->addAxis(YAxis, Qt::AlignLeft); curve->attachAxis(YAxis); } qspeakers-1.1.0/qspeakers.pro.user0000644000175000017500000005712213153053656015314 0ustar benben EnvironmentId {8fbc1dac-06a0-4b82-811f-1834de4e8013} ProjectExplorer.Project.ActiveTarget 0 ProjectExplorer.Project.EditorSettings true false true Cpp CppGlobal QmlJS QmlJSGlobal 2 UTF-8 false 4 false 80 true true 1 true false 0 true true 0 8 true 1 true true true false ProjectExplorer.Project.PluginSettings ProjectExplorer.Project.Target.0 Qt 5.7.1 in PATH (qt5) Qt 5.7.1 in PATH (qt5) {dea046f5-71f7-4944-a4f5-3c3ede52eddc} 0 0 0 /home/ben/src/qspeakers/build-qspeakers-Qt_5_7_1_in_PATH_qt5-Debug true qmake QtProjectManager.QMakeBuildStep true false false false true Make Qt4ProjectManager.MakeStep -w -r false 2 Compiler ProjectExplorer.BuildSteps.Build true Make Qt4ProjectManager.MakeStep -w -r true clean 1 Nettoyer ProjectExplorer.BuildSteps.Clean 2 false Debug Qt4ProjectManager.Qt4BuildConfiguration 2 true /home/ben/src/qspeakers/build-qspeakers-Qt_5_7_1_in_PATH_qt5-Release true qmake QtProjectManager.QMakeBuildStep false false false false true Make Qt4ProjectManager.MakeStep -w -r false 2 Compiler ProjectExplorer.BuildSteps.Build true Make Qt4ProjectManager.MakeStep -w -r true clean 1 Nettoyer ProjectExplorer.BuildSteps.Clean 2 false Release Qt4ProjectManager.Qt4BuildConfiguration 0 true /home/ben/src/qspeakers/build-qspeakers-Qt_5_7_1_in_PATH_qt5-Profile true qmake QtProjectManager.QMakeBuildStep true false true false true Make Qt4ProjectManager.MakeStep -w -r false 2 Compiler ProjectExplorer.BuildSteps.Build true Make Qt4ProjectManager.MakeStep -w -r true clean 1 Nettoyer ProjectExplorer.BuildSteps.Clean 2 false Profile Qt4ProjectManager.Qt4BuildConfiguration 0 true 3 0 Déploiement ProjectExplorer.BuildSteps.Deploy 1 Déployer localement ProjectExplorer.DefaultDeployConfiguration 1 false false 1000 true false false false false true 0.01 10 true 1 25 1 true false true valgrind 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 2 qspeakers Qt4ProjectManager.Qt4RunConfiguration:/home/ben/src/qspeakers/qtcharts/qspeakers.pro true qspeakers.pro false /home/ben/src/qspeakers/build-qspeakers-Qt_5_7_1_in_PATH_qt5-Debug 3768 false true false false true 1 ProjectExplorer.Project.TargetCount 1 ProjectExplorer.Project.Updater.FileVersion 18 Version 18