Initial commit
This commit is contained in:
commit
45115830c0
30 changed files with 2923 additions and 0 deletions
676
LICENSE.txt
Executable file
676
LICENSE.txt
Executable file
|
@ -0,0 +1,676 @@
|
|||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||
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.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
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:
|
||||
|
||||
<program> Copyright (C) <year> <name of author>
|
||||
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
|
||||
<http://www.gnu.org/licenses/>.
|
||||
|
||||
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
|
||||
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
|
||||
|
31
changelog.txt
Executable file
31
changelog.txt
Executable file
|
@ -0,0 +1,31 @@
|
|||
*******************************************************************************
|
||||
|
||||
Libre Media Server Audio - An Open source Media Server.
|
||||
(c) Santiago Noreña 2014
|
||||
|
||||
*******************************************************************************
|
||||
|
||||
Developing and support: libremediaserver@gmail.com
|
||||
|
||||
Code: http://code.google.com/p/libremediaserver
|
||||
|
||||
*******************************************************************************
|
||||
|
||||
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, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
*******************************************************************************
|
||||
|
||||
Lbre Media Server ChangeLog
|
||||
|
||||
*******************************************************************************
|
||||
|
||||
v 0.1-1
|
||||
|
||||
+ First Version: 4 layers playing .ogg
|
||||
+ Needs Open Lighting Arquitecture => 0.9.0
|
||||
+ Pure Data as audio engine
|
||||
|
60
compiling.txt
Executable file
60
compiling.txt
Executable file
|
@ -0,0 +1,60 @@
|
|||
*******************************************************************************
|
||||
|
||||
Libre Media Server Audio - An Open source Media Server.
|
||||
(c) Santiago Noreña 2014
|
||||
|
||||
*******************************************************************************
|
||||
|
||||
Developing and support: libremediaserver@gmail.com
|
||||
|
||||
Code: http://code.google.com/p/libremediaserver
|
||||
|
||||
*******************************************************************************
|
||||
|
||||
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, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
*******************************************************************************
|
||||
|
||||
If you have troubles, or you are in another distro, you can try compiling from the source code.
|
||||
|
||||
0. Requisites
|
||||
tcl tk --> To compile Pure Data, not necesary to execute it without GUI (-gui option in command line)
|
||||
build-essential
|
||||
make
|
||||
qmake
|
||||
gcc
|
||||
g++
|
||||
libtool
|
||||
ola-dev
|
||||
|
||||
1. Building pd
|
||||
$./configure
|
||||
$make
|
||||
|
||||
2. LibreMediaserver Audio
|
||||
|
||||
Open the file libremediaserver-audio.pro with QtCreator and compile it.
|
||||
|
||||
or
|
||||
|
||||
$ cd src
|
||||
$ qmake-qt4 libremediaserver-audio.pro -r -spec linux-g++
|
||||
$ make -w
|
||||
|
||||
3. Putting all together.
|
||||
|
||||
Make a directory. Copy in it:
|
||||
- libremediaserver binary
|
||||
- Folder scripts
|
||||
- Folder puredata
|
||||
- the tcl folder in the pd sources. This is only necessary to show the Pure Data GUI's. You don't need if you don't want the GUI's. Only it's good for debugging purpouses and developing, for normal use you can skip this step.
|
||||
|
||||
In the folder puredata copy:
|
||||
- the pd executable
|
||||
- Make a folder named externals and copy all the externals to it. All the externals compiled must be in ~HOME/pd-external.
|
||||
|
||||
|
4
credits.txt
Executable file
4
credits.txt
Executable file
|
@ -0,0 +1,4 @@
|
|||
Pure Data: Copyright © Miller Miller Puckette and others - BSD License.
|
||||
|
||||
pdogg~/oggread~: Copyright © 2002-2004 by Olaf Matthes - GPL License.
|
||||
|
66
instalacion.txt
Executable file
66
instalacion.txt
Executable file
|
@ -0,0 +1,66 @@
|
|||
*******************************************************************************
|
||||
|
||||
Libre Media Server Audio - An Open source Media Server.
|
||||
(c) Santiago Noreña 2014
|
||||
|
||||
*******************************************************************************
|
||||
|
||||
Desarrollo y soporte: libremediaserver@gmail.com
|
||||
|
||||
Página del proyecto: http://code.google.com/p/libremediaserver
|
||||
|
||||
*******************************************************************************
|
||||
|
||||
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, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
*******************************************************************************
|
||||
|
||||
0. Requerimientos
|
||||
|
||||
LMS Audio está desarrollado y probado en Debian Wheezy y derivados.
|
||||
|
||||
Para resolver dependencias es necesario tener conexión a internet en el ordenador durante el proceso de instalación.
|
||||
|
||||
LMS se comunica con Pure Data mediante puertos TCP, del 9195 al 9198. Open Lighting Arquitecure utiliza el puerto 9090 para su servidor web. Es necesario que estos puertos no estén siendo utilizados por otras aplicaciones.
|
||||
|
||||
1. Instala Open Lignting Arquitecture
|
||||
|
||||
Añadimos el repositorio de Open Lighting al archivo /etc/apt/sources.list:
|
||||
|
||||
$ echo "deb http://apt.openlighting.org/debian/ wheezy main" >> /etc/apt/sources.list
|
||||
|
||||
Actualizamos las fuentes:
|
||||
|
||||
$ apt-get update
|
||||
|
||||
Instalamos los paquetes necesarios:
|
||||
|
||||
$ apt-get -y --force-yes install ola libqtcore4 libqtgui4
|
||||
|
||||
2. Configuración
|
||||
|
||||
Este proceso sólo es necesario la primera vez que se ejecuta LMS Audio.
|
||||
|
||||
a. Inicia LMS Audio ejecutando el archivo "libremediaserver-audio"
|
||||
|
||||
b. Pincha en la opción "OLA setup" en el menu File.
|
||||
|
||||
c. Pincha en el botón "add universe"
|
||||
|
||||
d. Marca en la casilla del protocolo de red o dispositivo por el que quieras introducir datos. Asegúrate de que en "Direction" sea "input".
|
||||
|
||||
Si el protocolo elegido es ArtNet en "Universe Id" introduce el número del universo ArtNet por el que quieres recibir. La Net y la Subnet de Artnet se pueden cambiar en el archivo ~/.ola/ola-artnet.conf, por defecto es la Net 0 y la SubNet 0.
|
||||
|
||||
Puedes confirmar que está llegando información pinchando en el universo en el menú de la izquierda y luego en la pestaña "DMX Monitor". Puedes cerrar la ventana.
|
||||
|
||||
Si quieres usar el mismo ordenador como mesa y media server edit el archivo ~/.ola/ola-artnet.conf y define la opción use_loopback a true.
|
||||
|
||||
e. Pincha en el menu File -> Change Media Path y elige el directorio donde estén tus medias.
|
||||
|
||||
f. La configuración de los universos de ola a los que LMS Audio escucha y las direcciones DMX de las capas se configuran en el fichero lms.xlm. En el campo Universe tienes que poner el universo de ola que has definido anteriormente. Edita este fichero con un editor de texto plano y reinicia el programa. De momento no se puede configurar mediante GUI.
|
||||
|
||||
|
11
lms-audio.xlm
Executable file
11
lms-audio.xlm
Executable file
|
@ -0,0 +1,11 @@
|
|||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<dmxSettings fileVersion="1" layersNumber="4" path="/home/santi/audio" universeNumber="1">
|
||||
<layer0 dmx="1" universe="0" />
|
||||
<layer1 dmx="17" universe="0" />
|
||||
<layer2 dmx="33" universe="0" />
|
||||
<layer3 dmx="49" universe="0" />
|
||||
<layer4 dmx="257" universe="0" />
|
||||
<layer5 dmx="321" universe="0" />
|
||||
<layer6 dmx="385" universe="0" />
|
||||
<layer7 dmx="449" universe="0" />
|
||||
</dmxSettings>
|
55
recursos/LibreMediaServer_Audio.hed
Executable file
55
recursos/LibreMediaServer_Audio.hed
Executable file
|
@ -0,0 +1,55 @@
|
|||
^皾湏毄讍悊€潫憙嚈曀寑剛扰臓崙櫗泛疮鷼岸沪瓲驖か<EFBFBD><EFBFBD><EFBFBD><EFBFBD>堪彪Й,称蛽咴斕与栧蚜赁尬履匾娤了脜绿衼祧<EFBFBD><EFBFBD><EFBFBD><EFBFBD>雠疰鬻惆<EFBFBD><<EFBFBD>
|
||||
堀阜刀ā相槜灜鬯勖
|
||||
и拍媚菀<EFBFBD>彏帶寣巼秮憯剴€煥覆蝶趱毤丁窚但К煯缚<EFBFBD>溟驷钽伿谠訖<EFBFBD>
|
||||
増唵檮儌劀煘潨嚉櫂棅晹搾崘<EFBFBD><EFBFBD><EFBFBD>┅沪イ⒕ 榭〖缓垢范胆
|
||||
≡顡嫄欃稚惹婆拿禽肋掭苒谫<EFBFBD>
|
||||
哦剨廖研镱盱腓蹊珂邃汊帱
|
||||
韴<EFBFBD><EFBFBD>魂膂豸篁耩崚崒媻増噺<EFBFBD>
|
||||
桋圯諐倽湜殭槜攭敁拺惎<EFBFBD><EFBFBD>
|
||||
故貔铘赭<EFBFBD>綘烤郊缓护范荡巢睘<EFBFBD>
|
||||
呖敂崐槡棕寐晾咿蒉勤儇字赵佄
|
||||
枚安ū菌勘钩鼬汊徉<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>鲺趔<EFBFBD>
|
||||
銋咽吓浭盅俾棙儌亐煘潥嚉櫂棖晹悗
|
||||
冨耜镥皇鲴<EFBFBD>狄<EFBFBD>臣烤郊缓归<EFBFBD>荡巢毕脱
|
||||
拶稚惹婆拿垒肋掭苒谯<EFBFBD>
|
||||
拍稍右研镱镳腙殍珂彐<EFBFBD>
|
||||
痼<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>鲺趔蝰饙<EFBFBD>
|
||||
煘棅増噯厔仦亐煘潨洏<EFBFBD>
|
||||
妳姇敁拺惎<EFBFBD><EFBFBD><EFBFBD>ěΗ<EFBFBD>
|
||||
卑綘烤郊缓护范荡巢蓖<EFBFBD>
|
||||
咿资扇瞧拍赁晾咿蒈圬<EFBFBD>
|
||||
刈中扔已畜铐潆鲩桤琦溷赆<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>牾趔黜饛帊悑妷帥唴寖<EFBFBD>
|
||||
亐煔亷<EFBFBD>妊厞晹搾崘<EFBFBD>グ<EFBFBD>┅沪イ"<EFBFBD>竣
|
||||
郊痪オ则牯‘毕夏兴适邵婆穆蘖肋掭苒谂
|
||||
刈盅攘皠摢掣<EFBFBD>觊脲<EFBFBD>溏除<EFBFBD><EFBFBD><EFBFBD>帑<EFBFBD><EFBFBD>鲺麸
|
||||
蝰饖挓筝軟攪唴劅倎仐倽湜泤槜枙敁拺<EFBFBD>
|
||||
<EFBFBD><EFBFBD>犯婶鲲黪瘗臣烤嫉Ш够丢荡吵<EFBFBD>瓮趟噬熔
|
||||
婆拿铝肋<EFBFBD>
|
||||
蒈圳儇字稍右研镱眇腙殍珂邃<EFBFBD>忉<EFBFBD><EFBFBD><EFBFBD><EFBFBD>纟<EFBFBD>鲺趔蝽饛帊寢妷攪唴剝倎€優潨洑櫂棅晹搾憪<EFBFBD>爆<EFBFBD>┄Еジ"<EFBFBD>烤郊Ш垢范荡钞毕瓮趟噬郧婆拿铝烂掭苒谫刈收杂已酗铖
|
||||
<EFBFBD>鲩桤驽溷恺<EFBFBD><EFBFBD><EFBFBD>帑<EFBFBD><EFBFBD>鲺趔铖饛帒寢妷<EFBFBD>
|
||||
噯厔儌亣優湝泦櫃枱墧捛悓
|
||||
<EFBFBD><EFBFBD><EFBFBD>┊沪が><EFBFBD>烤〖翰工
|
||||
范荡巢馍彝趟收惹婆孛铝烂
|
||||
掭苒谫嬓收杂彝酗铐痣觊棼
|
||||
驽溷忉锄恺<EFBFBD><EFBFBD><EFBFBD>鲺梵篑驌
|
||||
帊寢妷蹆殔厓倽€煘潃洓櫂<EFBFBD>
|
||||
枙敁拺惃箔<EFBFBD><EFBFBD>ěΕ福)牐
|
||||
窘蓟汗攵<EFBFBD>闯箔衔吞资扇勤
|
||||
拍寐晾屵淋圳倌字赵弦研矧
|
||||
盱腙殍存<EFBFBD>汊狳<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
豸篁耩軒憣媻墧噯厔焸亐焸
|
||||
潨洑櫂臇墧搾憣<EFBFBD><EFBFBD>藩┄Ш
|
||||
イ"<EFBFBD>炀〖缓工范荡<EFBFBD>毕窝
|
||||
趟噬惹暸孛铝烂掭苒瀑刈稚
|
||||
杂已酗巾痣觊棼驽溷<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
<EFBFBD><EFBFBD><EFBFBD>ヵ梵蝰饟帊寢枆垏啓
|
||||
柵偀€湆<EFBFBD>
|
||||
湜殭剠剦唩巸偝<EFBFBD><EFBFBD>订ěЧぃⅰ伎窘姬汗缚<EFBFBD>闯脖衔托
|
||||
耸扇瞧牌<EFBFBD>
|
||||
杏芡塘紊<EFBFBD>
|
||||
倨字赵右托耦盱腙轸瑛邃汊徉泾泓<EFBFBD><EFBFBD>麝蹶篁耩弾憣晩増噯厴
|
||||
憪潃煘潃
|
||||
泦檮棅晥搸憣<EFBFBD><EFBFBD><EFBFBD>┄Еイ<EFBFBD>
|
||||
⒔牐尽姬亥斧订疮箔弦托
|
||||
酥稍勤
|
||||
咆<EFBFBD>
|
26
src/audiolayerwidget.cpp
Normal file
26
src/audiolayerwidget.cpp
Normal file
|
@ -0,0 +1,26 @@
|
|||
#include "audiolayerwidget.h"
|
||||
|
||||
AudioLayerWidget::AudioLayerWidget(QWidget *parent, QString name):
|
||||
QGroupBox(parent)
|
||||
{
|
||||
folder = new QLabel(this);
|
||||
file = new QLabel(this);
|
||||
status = new QLabel(this);
|
||||
vol = new QSlider(this);
|
||||
vol->setMaximum(99);
|
||||
mute = new QCheckBox(this);
|
||||
|
||||
QVBoxLayout *vbox = new QVBoxLayout;
|
||||
vbox->addWidget(folder);
|
||||
vbox->addWidget(file);
|
||||
vbox->addWidget(status);
|
||||
vbox->addWidget(vol);
|
||||
vbox->addWidget(mute);
|
||||
this->setLayout(vbox);
|
||||
}
|
||||
|
||||
AudioLayerWidget::~AudioLayerWidget()
|
||||
{
|
||||
|
||||
}
|
||||
|
45
src/audiolayerwidget.h
Normal file
45
src/audiolayerwidget.h
Normal file
|
@ -0,0 +1,45 @@
|
|||
#ifndef AUDIOLAYERWIDGET_H
|
||||
#define AUDIOLAYERWIDGET_H
|
||||
|
||||
#include <QtGui>
|
||||
|
||||
//#include "ui_audiolayerwidget.h"
|
||||
/*
|
||||
namespace Ui {
|
||||
class AudioLayerWidget;
|
||||
}*/
|
||||
|
||||
class AudioLayerWidget : public QGroupBox
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
|
||||
AudioLayerWidget(QWidget *parent, QString name);
|
||||
~AudioLayerWidget();
|
||||
|
||||
inline void setFile(QString file) const
|
||||
{
|
||||
this->file->setText(file);
|
||||
}
|
||||
|
||||
inline void setFolder(QString folder) const
|
||||
{
|
||||
this->folder->setText(folder);
|
||||
}
|
||||
|
||||
inline void setVol(float vol) const
|
||||
{
|
||||
this->vol->setValue(vol);
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
QLabel *file;
|
||||
QLabel *folder;
|
||||
QSlider *vol;
|
||||
QCheckBox *mute;
|
||||
QLabel *status;
|
||||
};
|
||||
|
||||
#endif // AUDIOLAYERWIDGET_H
|
20
src/audiomasterwidget.cpp
Normal file
20
src/audiomasterwidget.cpp
Normal file
|
@ -0,0 +1,20 @@
|
|||
#include "audiomasterwidget.h"
|
||||
|
||||
AudioMasterWidget::AudioMasterWidget(QWidget *parent) :
|
||||
QGroupBox(parent)
|
||||
{
|
||||
status = new QLabel(this);
|
||||
vol = new QSlider(this);
|
||||
mute = new QCheckBox(this);
|
||||
|
||||
QVBoxLayout *vbox = new QVBoxLayout;
|
||||
vbox->addWidget(status);
|
||||
vbox->addWidget(vol);
|
||||
vbox->addWidget(mute);
|
||||
this->setLayout(vbox);
|
||||
}
|
||||
|
||||
AudioMasterWidget::~AudioMasterWidget()
|
||||
{
|
||||
|
||||
}
|
33
src/audiomasterwidget.h
Normal file
33
src/audiomasterwidget.h
Normal file
|
@ -0,0 +1,33 @@
|
|||
#ifndef AUDIOMASTERWIDGET_H
|
||||
#define AUDIOMASTERWIDGET_H
|
||||
|
||||
#include <QLabel>
|
||||
#include <QtGui>
|
||||
|
||||
//#include "ui_audiomasterwidget.h"
|
||||
|
||||
/*
|
||||
namespace Ui {
|
||||
class AudioMasterWidget;
|
||||
}*/
|
||||
|
||||
class AudioMasterWidget : public QGroupBox //, public Ui::AudioMasterWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
AudioMasterWidget(QWidget *parent);
|
||||
|
||||
~AudioMasterWidget();
|
||||
|
||||
private:
|
||||
|
||||
QLabel *file;
|
||||
QLabel *folder;
|
||||
QSlider *vol;
|
||||
QCheckBox *mute;
|
||||
QLabel *status;
|
||||
};
|
||||
|
||||
|
||||
#endif // AUDIOMASTERWIDGET_H
|
380
src/audiomotor.cpp
Normal file
380
src/audiomotor.cpp
Normal file
|
@ -0,0 +1,380 @@
|
|||
#include "audiomotor.h"
|
||||
|
||||
#define PAUSE 2
|
||||
#define PLAY 0
|
||||
#define STOP 1
|
||||
|
||||
#define MAX_DATA = 1024;
|
||||
|
||||
AudioMotor *AudioMotor::_instance = 0;
|
||||
|
||||
AudioMotor *AudioMotor::getInstance() {
|
||||
if (_instance == 0) {
|
||||
_instance = new AudioMotor();
|
||||
Q_CHECK_PTR(_instance);
|
||||
}
|
||||
return _instance;
|
||||
}
|
||||
|
||||
AudioMotor::AudioMotor(QObject *parent) :
|
||||
QObject(parent),
|
||||
m_startaudio(0),
|
||||
m_writePD(NULL),
|
||||
m_readPD(NULL),
|
||||
m_pd_audio(NULL),
|
||||
m_connectedSocket(NULL),
|
||||
m_gui(true)
|
||||
{
|
||||
qsrand(qrand());
|
||||
qDebug() << "Init MotorAudio";
|
||||
}
|
||||
|
||||
AudioMotor::~AudioMotor()
|
||||
{
|
||||
close();
|
||||
}
|
||||
|
||||
|
||||
/** Init the engine
|
||||
*/
|
||||
bool AudioMotor::init()
|
||||
{
|
||||
/* Sets the socket an connections for the comunication with PD
|
||||
QFile socket(SOCKET);
|
||||
if (socket.exists())
|
||||
{
|
||||
socket.remove();
|
||||
}*/
|
||||
|
||||
// Socket para mandar órdenes a Pure Data
|
||||
m_writePD = new QTcpSocket(this);
|
||||
Q_CHECK_PTR(m_writePD);
|
||||
|
||||
connect(m_writePD, SIGNAL(connected()),this, SLOT(newConexion()));
|
||||
connect(m_writePD, SIGNAL(error(QAbstractSocket::SocketError)) , this, SLOT(errorWrite(QAbstractSocket::SocketError)));
|
||||
|
||||
|
||||
|
||||
// Servidor para recibir feedback de Pure Data
|
||||
m_readPD = new QTcpServer(this);
|
||||
Q_CHECK_PTR(m_readPD);
|
||||
connect(m_readPD, SIGNAL(newConnection()),this, SLOT(newPeer()));
|
||||
|
||||
if (m_readPD->listen(QHostAddress::LocalHost, PDPORT)) {
|
||||
qDebug(QString("AudioMotor| Listening to PD on TCP port %1").arg(PDPORT).toLatin1());
|
||||
} else {
|
||||
qErrnoWarning(QString("AudioMotor::init() can not init TCP Server on port %1").arg(PDPORT).toLatin1());
|
||||
}
|
||||
|
||||
// Start the pd process an set up PD
|
||||
m_pd_audio = new QProcess(this);
|
||||
|
||||
connect(m_pd_audio, SIGNAL(readyReadStandardError()), this, SLOT(stdout()));
|
||||
connect(m_pd_audio, SIGNAL(finished(int)), this, SLOT(restartAudio()));
|
||||
|
||||
QString arguments;
|
||||
// arguments.append("./puredata/pd -alsa -channels 2 -audiodev 1 -stderr -nostdpath -path ./puredata/externals/ -open ./puredata/lms-audio.pd ");
|
||||
arguments.append("./puredata/pd -channels 2 -stderr -nostdpath -path ./puredata/externals/ -open ./puredata/lms-audio.pd ");
|
||||
if (!m_gui)
|
||||
arguments.append("-nogui");
|
||||
qDebug() << "PD starts with arguments: " << arguments;
|
||||
|
||||
m_pd_audio->start(arguments);
|
||||
|
||||
if (m_pd_audio->waitForStarted(3000)){
|
||||
qDebug("AudioMotor| PD started.");
|
||||
}
|
||||
else
|
||||
{
|
||||
qWarning("AudioMotor| PD not started!");
|
||||
qErrnoWarning("AudioMotor| Can not init PD");
|
||||
return false;
|
||||
}
|
||||
m_startaudio++;
|
||||
return true;
|
||||
}
|
||||
|
||||
/** Close the engine
|
||||
*/
|
||||
bool AudioMotor::close()
|
||||
{
|
||||
disconnect(m_pd_audio, SIGNAL(readyReadStandardError()), this, SLOT(stdout()));
|
||||
disconnect(m_pd_audio, SIGNAL(finished(int)), this, SLOT(restartAudio()));
|
||||
m_pd_audio->terminate();
|
||||
m_pd_audio->waitForFinished(1000);
|
||||
delete m_pd_audio;
|
||||
m_pd_audio = NULL;
|
||||
if (m_writePD != NULL)
|
||||
{
|
||||
disconnect(m_writePD, SIGNAL(connected()),this, SLOT(newConexion()));
|
||||
m_writePD->close();
|
||||
delete m_writePD;
|
||||
m_writePD = NULL;
|
||||
}
|
||||
if (m_readPD != NULL)
|
||||
{
|
||||
disconnect(m_readPD, SIGNAL(newConnection()),this, SLOT(newPeer()));
|
||||
m_readPD->close();
|
||||
delete m_readPD;
|
||||
m_readPD = NULL;
|
||||
}
|
||||
/*
|
||||
QFile socket(SOCKET);
|
||||
if (socket.exists())
|
||||
{
|
||||
socket.remove();
|
||||
}*/
|
||||
}
|
||||
|
||||
/** Set the numbers of layers
|
||||
*/
|
||||
void AudioMotor::setLayers (int layers){
|
||||
|
||||
}
|
||||
|
||||
/** Get the number of layers
|
||||
*/
|
||||
int AudioMotor::getlayers(){
|
||||
|
||||
}
|
||||
|
||||
/** Load a file in memory
|
||||
*
|
||||
*/
|
||||
bool AudioMotor::load(int layer, QString file)
|
||||
{
|
||||
if (!QFile::exists(file))
|
||||
return false;
|
||||
QString message = tr("%1 ").arg(layer +201);
|
||||
message.append("open ");
|
||||
message.append(file);
|
||||
message.append(";");
|
||||
qDebug() << "AudioMotor::load " << message;
|
||||
|
||||
if (QAbstractSocket::ConnectedState != m_writePD->state())
|
||||
{
|
||||
qErrnoWarning("AudioMotor::load(): Socket not conected: ");
|
||||
return false;
|
||||
}
|
||||
if (message.size() != m_writePD->write(message.toAscii().constData(), message.size()))
|
||||
{
|
||||
qErrnoWarning("AudioMotor::load(): Can not write to socket");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/** Starts the playback at start position
|
||||
*
|
||||
*/
|
||||
bool AudioMotor::play(int layer)
|
||||
{
|
||||
QString buffer = tr("%1 %2 %3;").arg(layer).arg(PLAYBACK).arg(PLAY);
|
||||
if (!sendPacket(buffer.toAscii().constData(), buffer.size()))
|
||||
{
|
||||
errorSending();
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/** Unpause the playback
|
||||
*/
|
||||
bool AudioMotor::pause(int layer)
|
||||
{
|
||||
QString buffer = tr("%1 %2 %3;").arg(layer).arg(PLAYBACK).arg(PAUSE);
|
||||
if (!sendPacket(buffer.toAscii().constData(), buffer.size()))
|
||||
{
|
||||
errorSending();
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/** Stops/pause the playback
|
||||
*
|
||||
*/
|
||||
bool AudioMotor::stop(int layer)
|
||||
{
|
||||
QString buffer = tr("%1 %2 %3;").arg(layer).arg(PLAYBACK).arg(STOP);
|
||||
if (!sendPacket(buffer.toAscii().constData(), buffer.size()))
|
||||
{
|
||||
errorSending();
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/** Sets the start playback position
|
||||
*
|
||||
*/
|
||||
void AudioMotor::setEntryPoint(int layer, int entry)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
/** Sets the final playback position
|
||||
*
|
||||
*/
|
||||
void AudioMotor::setExitPoint(int layer, int exit)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/** Set the volumen in one layer
|
||||
* @param int vol Normalized 0 to 1
|
||||
@param int layer the layer which applied
|
||||
*/
|
||||
void AudioMotor::setLayerVolume(int layer, float vol)
|
||||
{
|
||||
QString buffer = tr("%1 %2 %3;").arg(layer).arg(VOLUME_COARSE).arg(vol);
|
||||
if (!sendPacket(buffer.toAscii().constData(), buffer.size()))
|
||||
{
|
||||
errorSending();
|
||||
}
|
||||
}
|
||||
|
||||
/** Set pan in one layer
|
||||
*
|
||||
* @param int vol Normalized 0 (Left) to 1 (Right)
|
||||
@param int layer the layer which applied
|
||||
*/
|
||||
void AudioMotor::setLayerPan(int layer, float pan)
|
||||
{
|
||||
QString buffer = tr("%1 %2 %3;").arg(layer).arg(PAN).arg(pan);
|
||||
if (!sendPacket(buffer.toAscii().constData(), buffer.size()))
|
||||
{
|
||||
errorSending();
|
||||
}
|
||||
}
|
||||
|
||||
/** Set Volumen master.
|
||||
* All layers are limited by this master
|
||||
* 0 will mute all the outputs
|
||||
*/
|
||||
void AudioMotor::setMasterVolume(int vol){
|
||||
|
||||
}
|
||||
|
||||
/** Set pan master
|
||||
* Will pan the master output of sound
|
||||
*/
|
||||
void AudioMotor::setMasterPan(int pan){
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/** Restart the audio process
|
||||
*
|
||||
*/
|
||||
void AudioMotor::restartAudio()
|
||||
{
|
||||
close();
|
||||
init();
|
||||
}
|
||||
|
||||
/** New conexion on TCP Server
|
||||
*
|
||||
*/
|
||||
void AudioMotor::newPeer()
|
||||
{
|
||||
m_connectedSocket = m_readPD->nextPendingConnection();
|
||||
connect(m_connectedSocket, SIGNAL(readyRead()),this, SLOT(newMessage()));
|
||||
}
|
||||
|
||||
/** New message in a TCP socket stablished connection
|
||||
*
|
||||
*/
|
||||
|
||||
void AudioMotor::newMessage()
|
||||
{
|
||||
if (m_connectedSocket == NULL)
|
||||
{
|
||||
qDebug()<<("AudioMotor::newMessage() Socket not connected. Trying open it...");
|
||||
newPeer();
|
||||
return;
|
||||
}
|
||||
QString message = m_connectedSocket->readAll();
|
||||
parse(message);
|
||||
}
|
||||
|
||||
void AudioMotor::parse(QString message)
|
||||
{
|
||||
int aux;
|
||||
QStringList list = message.split("\n", QString::SkipEmptyParts);
|
||||
for (int i = 0; i < list.size(); i ++) {
|
||||
if (list.at(i).size() > 0) {
|
||||
qDebug() << "AudioMotor::newMessage() message received: " << list.at(i);
|
||||
QChar val = list.at(i).at(0);
|
||||
switch (val.digitValue()) {
|
||||
case 0:
|
||||
qDebug() << "AudioMotor::newMessage() Loadbang from PD Audio received...";
|
||||
// Conectamos a Pure Data para escribir
|
||||
m_writePD->connectToHost(QHostAddress::LocalHost, SOCKET, QIODevice::WriteOnly);
|
||||
if (m_writePD->waitForConnected(30000))
|
||||
emit loadbang();
|
||||
break;
|
||||
case 9:
|
||||
if (list.at(i).at(2).digitValue() == 0)
|
||||
emit (volChanged(list.at(i).at(4).digitValue(), ( ( list.at(i).at(6).digitValue() * 10 ) + list.at(i).at(7).digitValue() ) ) );
|
||||
break;
|
||||
case 1:
|
||||
case 2:
|
||||
case 3:
|
||||
case 4:
|
||||
case 5:
|
||||
case 6:
|
||||
case 7:
|
||||
case 8:
|
||||
QStringList folders = list.at(i).split("/", QString::SkipEmptyParts);
|
||||
if (folders.size() >= 2)
|
||||
emit (mediaLoaded(val.digitValue(), folders.at(folders.size() -2), folders.at(folders.size() -1)));
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** Error writing to PD
|
||||
*
|
||||
*/
|
||||
|
||||
void AudioMotor::errorWrite(QAbstractSocket::SocketError error)
|
||||
{
|
||||
// QString error = m_writePD->errorString();
|
||||
|
||||
qErrnoWarning(QString("AudioMotor::errorWrite() %1").arg(error).toLatin1());
|
||||
}
|
||||
|
||||
/** Sends packets to Pure Data audio
|
||||
*
|
||||
*/
|
||||
|
||||
bool AudioMotor::sendPacket(const char *buffer, int bufferLen)
|
||||
{
|
||||
if (m_writePD == NULL) {
|
||||
return false;
|
||||
}
|
||||
if (QAbstractSocket::ConnectedState != m_writePD->state())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (bufferLen != m_writePD->write((const char*)buffer, bufferLen))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// Function error sending packets to PD audio
|
||||
void AudioMotor::errorSending() {
|
||||
qDebug() << "AudioMotor| Can not send packets to PD";
|
||||
}
|
||||
|
142
src/audiomotor.h
Normal file
142
src/audiomotor.h
Normal file
|
@ -0,0 +1,142 @@
|
|||
#ifndef AUDIOMOTOR_H
|
||||
#define AUDIOMOTOR_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QtDebug>
|
||||
#include <QtNetwork>
|
||||
#include <QTcpServer>
|
||||
#include <QLocalSocket>
|
||||
#include <QTcpSocket>
|
||||
#include <QChar>
|
||||
|
||||
#include "dmxPersonality.h"
|
||||
|
||||
#define PDPORT 9198
|
||||
#define SOCKET 9197 // "/tmp/socket"
|
||||
|
||||
class AudioMotor : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
|
||||
static AudioMotor *getInstance();
|
||||
|
||||
/** Init the engine
|
||||
*/
|
||||
bool init();
|
||||
|
||||
/** Close the engine
|
||||
*/
|
||||
bool close();
|
||||
|
||||
/** Set the numbers of layers
|
||||
*/
|
||||
void setLayers (int layers);
|
||||
|
||||
/** Get the number of layers
|
||||
*/
|
||||
int getlayers();
|
||||
|
||||
/** Load a file in memory
|
||||
*
|
||||
*/
|
||||
bool load(int layer, QString file);
|
||||
|
||||
/** Starts the playback at start position
|
||||
*
|
||||
*/
|
||||
bool play(int layer);
|
||||
|
||||
/** Pause/unpause the playback
|
||||
*/
|
||||
bool pause(int layer);
|
||||
|
||||
/** Stops the playback and reset the media to the start position
|
||||
*
|
||||
*/
|
||||
bool stop(int layer);
|
||||
|
||||
/** Sets the start playback position
|
||||
*
|
||||
*/
|
||||
void setEntryPoint(int layer, int entry);
|
||||
|
||||
/** Sets the final playback position
|
||||
*
|
||||
*/
|
||||
void setExitPoint(int layer, int exit);
|
||||
|
||||
/** Set the volumen in one layer
|
||||
*
|
||||
*/
|
||||
void setLayerVolume(int layer, float vol);
|
||||
|
||||
/** Set pan in one layer
|
||||
*/
|
||||
void setLayerPan(int layer, float pan);
|
||||
|
||||
/** Set Volumen master.
|
||||
* All layers are limited by this master
|
||||
* 0 will mute all the outputs
|
||||
*/
|
||||
void setMasterVolume(int vol);
|
||||
|
||||
/** Set pan master
|
||||
* Will pan the master output of sound
|
||||
*/
|
||||
void setMasterPan(int pan);
|
||||
|
||||
inline void setGui(bool gui) { m_gui = gui; }
|
||||
|
||||
private:
|
||||
|
||||
AudioMotor(QObject *parent = 0);
|
||||
virtual ~AudioMotor();
|
||||
static AudioMotor *_instance;
|
||||
|
||||
bool m_gui;
|
||||
int m_layersNumber;
|
||||
QProcess *m_pd_audio; // Pure Data process for audio
|
||||
|
||||
// Audio TCP Sockets
|
||||
QTcpSocket *m_writePD;
|
||||
QTcpServer *m_readPD;
|
||||
QTcpSocket *m_connectedSocket; // connected socket to server
|
||||
int m_startaudio; // Counter starts audio engine. Debugging purpose
|
||||
|
||||
bool sendPacket(const char *buffer, int bufferLen);
|
||||
void errorSending();
|
||||
void parse(QString message);
|
||||
|
||||
signals:
|
||||
void loadbang();
|
||||
void newConnection();
|
||||
void mediaLoaded(int layer, QString folder, QString file);
|
||||
void volChanged(int layer, int vol);
|
||||
|
||||
private slots:
|
||||
|
||||
void newPeer();
|
||||
inline void newConexion() { qDebug() << "AudioMotor write socket connected to PD"; }
|
||||
void restartAudio();
|
||||
void newMessage();
|
||||
void errorWrite(QAbstractSocket::SocketError error);
|
||||
/**
|
||||
*
|
||||
* Listen the terminal exit of PD
|
||||
*
|
||||
*/
|
||||
|
||||
// Sacamos la salida de Pure Data Audio en la terminal
|
||||
inline void stdout() {
|
||||
QString out = m_pd_audio->readAllStandardError();
|
||||
out.chop(1);
|
||||
if (!out.isEmpty())
|
||||
{
|
||||
qDebug() << "AudioMotor from PD: " << out;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
#endif // AUDIOMOTOR_H
|
31
src/audiowidget.cpp
Normal file
31
src/audiowidget.cpp
Normal file
|
@ -0,0 +1,31 @@
|
|||
#include "audiowidget.h"
|
||||
|
||||
AudioWidget::AudioWidget(QWidget *parent) :
|
||||
QWidget(parent)
|
||||
{
|
||||
layout = new QHBoxLayout();
|
||||
for (int i= 0; i < LAYERS_NUMBER; i++ ) {
|
||||
// Conectar los slots
|
||||
layout->insertWidget(i, new AudioLayerWidget(this, tr("Layer %1").arg(i)));
|
||||
}
|
||||
setLayout(layout);
|
||||
qDebug( "Init AudioWidget");
|
||||
}
|
||||
|
||||
void AudioWidget::mediaLoaded(int layer, QString folder, QString file)
|
||||
{
|
||||
QLayoutItem * const item = layout->itemAt(layer - 1);
|
||||
qDebug() << "AudioWidget::mediaLoaded Received layer: " << layer
|
||||
<< "Folder: " << folder
|
||||
<<"File : " << file;
|
||||
dynamic_cast<AudioLayerWidget *>(item->widget())->setFolder(folder);
|
||||
dynamic_cast<AudioLayerWidget *>(item->widget())->setFile(file);
|
||||
}
|
||||
|
||||
void AudioWidget::volChanged(int layer, int vol) {
|
||||
QLayoutItem * const item = layout->itemAt(layer - 1);
|
||||
qDebug() << "AudioWidget::volChanged Received layer: " << layer
|
||||
<< "Vol : " << vol;
|
||||
dynamic_cast<AudioLayerWidget *>(item->widget())->setVol(vol);
|
||||
}
|
||||
|
34
src/audiowidget.h
Normal file
34
src/audiowidget.h
Normal file
|
@ -0,0 +1,34 @@
|
|||
#ifndef AUDIOWIDGET_H
|
||||
#define AUDIOWIDGET_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QWidget>
|
||||
#include <QVBoxLayout>
|
||||
#include "audiomasterwidget.h"
|
||||
#include "audiolayerwidget.h"
|
||||
#include "defines.h"
|
||||
|
||||
class AudioWidget : public QWidget
|
||||
{
|
||||
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
|
||||
AudioWidget(QWidget *parent);
|
||||
|
||||
private:
|
||||
|
||||
// QList<AudioLayerWidget*> *list;
|
||||
|
||||
QHBoxLayout *layout;
|
||||
|
||||
signals:
|
||||
|
||||
public slots:
|
||||
void mediaLoaded(int layer, QString folder, QString file);
|
||||
void volChanged(int layer, int vol);
|
||||
|
||||
};
|
||||
|
||||
#endif // AUDIOWIDGET_H
|
8
src/defines.h
Normal file
8
src/defines.h
Normal file
|
@ -0,0 +1,8 @@
|
|||
#ifndef DEFINES_H
|
||||
#define DEFINES_H
|
||||
|
||||
#define LAYERS_NUMBER 4
|
||||
|
||||
|
||||
#endif // DEFINES_H
|
||||
|
36
src/dmxPersonality.h
Normal file
36
src/dmxPersonality.h
Normal file
|
@ -0,0 +1,36 @@
|
|||
#ifndef DMXPERSONALITY_H
|
||||
#define DMXPERSONALITY_H
|
||||
|
||||
/** Define the DMX personality to avoid dealing with
|
||||
* numbers and change it easyly in case
|
||||
*
|
||||
1 - Volumen Coarse
|
||||
2 - Pan
|
||||
3 - Folder
|
||||
4 - File
|
||||
5 - Playback
|
||||
0-24 : Play. Reproduce desde el inicio del fichero.
|
||||
25-49: Stop.
|
||||
50-74: Resume. Reproduce desde el punto desde el que se paró, o desde el punto designado por Entry Point.
|
||||
6 - Control - Reservado, sin uso en este momento.
|
||||
7 - Volume Fine
|
||||
8 - Entry Point Coarse - Punto de entrada de reproducción.
|
||||
9 - Entry Point Fine - El valor de estos dos canales en centésimas de segundo.
|
||||
*/
|
||||
|
||||
// ToDo: Tiene bastante sentido cambiar estos defines por un enum
|
||||
// ¿Ganaría algo en eficiencia? En claridad del código sí.
|
||||
|
||||
#define VOLUME_COARSE 0
|
||||
#define PAN 1
|
||||
#define DMX_FOLDER 2
|
||||
#define DMX_FILE 3
|
||||
#define PLAYBACK 4
|
||||
#define CONTROL 5
|
||||
#define VOLUME_FINE 6
|
||||
#define ENTRY_POINT_COARSE 7
|
||||
#define ENTRY_POINT_FINE 8
|
||||
|
||||
#define LAYER_CHANNELS 5
|
||||
|
||||
#endif // DMXPERSONALITY_H
|
245
src/libremediaserver-audio.cpp
Executable file
245
src/libremediaserver-audio.cpp
Executable file
|
@ -0,0 +1,245 @@
|
|||
/*
|
||||
Pure Media Server - A Media Server Sotfware for stage and performing
|
||||
|
||||
Copyright (C) 2012-2013 Santi Noreña libremediaserver@gmail.com
|
||||
|
||||
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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "libremediaserver-audio.h"
|
||||
|
||||
/**
|
||||
/ Constructor
|
||||
*/
|
||||
|
||||
libreMediaServerAudio::libreMediaServerAudio(QStringList args, QWidget *parent)
|
||||
: QMainWindow(parent)
|
||||
{
|
||||
ola = new olaThread();
|
||||
|
||||
qDebug() << "********************************************************************************";
|
||||
qDebug() << QDate::currentDate() << QTime::currentTime();
|
||||
qDebug() << VERSION;
|
||||
qDebug() << COPYRIGHT;
|
||||
qDebug() << LICENSE;
|
||||
|
||||
// Inicia el User Interface
|
||||
ui.setupUi(this);
|
||||
|
||||
// Inicia la lectura de dmx a través de ola
|
||||
|
||||
ola->start(QThread::TimeCriticalPriority );
|
||||
ola->blockSignals(true);
|
||||
|
||||
// Inicia el widget Terminal
|
||||
|
||||
textEdit = new QTextEdit(this);
|
||||
textEdit->append(QString::fromAscii(VERSION));
|
||||
textEdit->append(QString::fromAscii(LICENSE));
|
||||
textEdit->append(QString::fromAscii(COPYRIGHT));
|
||||
|
||||
QDockWidget *bottomWidget = new QDockWidget(tr("Terminal"), this);
|
||||
bottomWidget->setAllowedAreas(Qt::BottomDockWidgetArea);
|
||||
bottomWidget->setWidget(textEdit);
|
||||
addDockWidget(Qt::BottomDockWidgetArea, bottomWidget);
|
||||
|
||||
// Inicia el widget central de audio
|
||||
|
||||
aw = new AudioWidget(this);
|
||||
setCentralWidget(aw);
|
||||
|
||||
// Inicia el widget Master. No implementado todavía
|
||||
/*
|
||||
amw = new AudioMasterWidget(this);
|
||||
QDockWidget *topWidget = new QDockWidget(tr("Master"), this);
|
||||
topWidget->setAllowedAreas(Qt::TopDockWidgetArea);
|
||||
topWidget->setWidget(amw);
|
||||
addDockWidget(Qt::TopDockWidgetArea, topWidget);
|
||||
*/
|
||||
// Parse the command line options
|
||||
if (args.contains("-gui"))
|
||||
{
|
||||
qDebug()<< "libremediaserver Constructor option GUI detected";
|
||||
AudioMotor::getInstance()->setGui(true);
|
||||
textEdit->append("Pure Data GUI's will be shown");
|
||||
} else { AudioMotor::getInstance()->setGui(false); }
|
||||
|
||||
if (args.contains("-log"))
|
||||
{
|
||||
textEdit->append("Log to file");
|
||||
}
|
||||
|
||||
// Conectamos los menus
|
||||
connect(ui.actionOpen_conf, SIGNAL(triggered()), this, SLOT(openFile()));
|
||||
connect(ui.actionSave_conf, SIGNAL(triggered()), this, SLOT(saveFile()));
|
||||
connect(ui.actionChange_Media_Path, SIGNAL(triggered()), this, SLOT(ChangeMediaPath()));
|
||||
connect(ui.actionLaunch_OLA_Setup, SIGNAL(triggered()), this, SLOT(olasetup()));
|
||||
|
||||
Settings *set = new Settings();
|
||||
|
||||
// Iniciamos Pure Data
|
||||
AudioMotor::getInstance()->init();
|
||||
|
||||
connect(set, SIGNAL( layersNumber(int)),
|
||||
ola, SLOT( setLayersNumber(int)));
|
||||
|
||||
connect(set, SIGNAL( DMXConf(dmxSetting ) ),
|
||||
ola, SLOT( setDMXConf(dmxSetting) ) );
|
||||
|
||||
connect(AudioMotor::getInstance(), SIGNAL(mediaLoaded(int, QString, QString)),
|
||||
aw, SLOT(mediaLoaded(int, QString, QString)));
|
||||
|
||||
connect(AudioMotor::getInstance(), SIGNAL(volChanged(int, int)),
|
||||
aw, SLOT(volChanged(int, int)));
|
||||
|
||||
connect(AudioMotor::getInstance(), SIGNAL(loadbang()),
|
||||
this, SLOT (loadbang()));
|
||||
|
||||
connect(ola, SIGNAL( dmxOutput(int, int, int) ),
|
||||
this, SLOT( dmxInput(int, int, int) ) );
|
||||
|
||||
// Lee la configuración por defecto
|
||||
set->readDefaultFile();
|
||||
ola->blockSignals(false);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////
|
||||
// Destructor
|
||||
///////////////////////////////////////////////////////////////////
|
||||
|
||||
libreMediaServerAudio::~libreMediaServerAudio()
|
||||
{
|
||||
// save_finish();
|
||||
delete MediaLibrary::getInstance();
|
||||
ola->stop();
|
||||
AudioMotor::getInstance()->close();
|
||||
// qDebug() << "PD Audio restarts: " << m_startaudio;
|
||||
qDebug() << QDate::currentDate() << QTime::currentTime();
|
||||
qDebug() << "********************************************************************************";
|
||||
return;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////
|
||||
// Menu File
|
||||
///////////////////////////////////////////////////////////////////
|
||||
|
||||
// Open a configuration File
|
||||
void libreMediaServerAudio::openFile()
|
||||
{
|
||||
QFileDialog dialog(this);
|
||||
if (!dialog.exec())
|
||||
return;
|
||||
QStringList fileNames;
|
||||
fileNames = dialog.selectedFiles();
|
||||
QFile file(fileNames.at(0));
|
||||
// open(&file);
|
||||
}
|
||||
// Save configuration File
|
||||
void libreMediaServerAudio::saveFile()
|
||||
{
|
||||
QFileDialog dialog(this);
|
||||
if (!dialog.exec())
|
||||
return;
|
||||
QStringList fileNames;
|
||||
fileNames = dialog.selectedFiles();
|
||||
QFile file(fileNames.at(0));
|
||||
// save(&file);
|
||||
}
|
||||
|
||||
// Change Media path
|
||||
void libreMediaServerAudio::ChangeMediaPath()
|
||||
{
|
||||
QFileDialog dialog(this);
|
||||
dialog.setFileMode(QFileDialog::Directory);
|
||||
QStringList fileNames;
|
||||
if (!dialog.exec())
|
||||
return;
|
||||
fileNames = dialog.selectedFiles();
|
||||
QString file = fileNames.at(0);
|
||||
MediaLibrary::getInstance()->setPath(file);
|
||||
QString desc = tr("Media Path Changed to: %1").arg(m_pathmedia);
|
||||
textEdit->append(desc.toAscii());
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////
|
||||
// OLA Stuff
|
||||
///////////////////////////////////////////////////////////////////
|
||||
|
||||
void libreMediaServerAudio::olasetup()
|
||||
{
|
||||
QWebView *view = new QWebView();
|
||||
view->load(QUrl("http://localhost:9090/ola.html"));
|
||||
view->show();
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse the nes dmx information
|
||||
*/
|
||||
void libreMediaServerAudio::dmxInput(int layer, int channel, int value)
|
||||
{
|
||||
// This qDebug slows all the program. Uncomment only for debugging purpouse and comment again in normal use
|
||||
// qDebug() << tr("olaInterface|") << "newdmx layer" << layer << "channel" << channel << "value" << value;
|
||||
QString mediaFile = NULL;
|
||||
int aux;
|
||||
float vol;
|
||||
switch(channel){
|
||||
case DMX_FOLDER:// Folder
|
||||
aux = ola->getValue(layer, DMX_FILE);
|
||||
mediaFile = MediaLibrary::getInstance()->requestNewFile(value, aux);
|
||||
if (QFile::exists(mediaFile))
|
||||
AudioMotor::getInstance()->load(layer, mediaFile);
|
||||
break;
|
||||
case DMX_FILE:// File
|
||||
aux = ola->getValue(layer, DMX_FOLDER);
|
||||
mediaFile = MediaLibrary::getInstance()->requestNewFile(aux, value);
|
||||
if (QFile::exists(mediaFile))
|
||||
AudioMotor::getInstance()->load(layer, mediaFile);
|
||||
break;
|
||||
case VOLUME_COARSE:
|
||||
vol = ( value * 0x100 ) + ola->getValue(layer, VOLUME_FINE);
|
||||
AudioMotor::getInstance()->setLayerVolume(layer, vol/65535);
|
||||
break;
|
||||
case VOLUME_FINE:
|
||||
vol = ( ola->getValue(layer, VOLUME_COARSE) * 0x100 ) + value;
|
||||
AudioMotor::getInstance()->setLayerVolume(layer, vol/65535);
|
||||
break;
|
||||
case PAN:
|
||||
AudioMotor::getInstance()->setLayerPan(layer, value/255);
|
||||
break;
|
||||
case PLAYBACK:
|
||||
aux = value / 25;
|
||||
switch (aux) {
|
||||
case 0 :
|
||||
AudioMotor::getInstance()->play(layer);
|
||||
break;
|
||||
case 1 :
|
||||
AudioMotor::getInstance()->stop(layer);
|
||||
break;
|
||||
case 2 :
|
||||
AudioMotor::getInstance()->pause(layer);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
// emit dmxInput(layer, channel, value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Send the DMX info to Pure Data in init
|
||||
*
|
||||
*/
|
||||
void libreMediaServerAudio::loadbang() {
|
||||
ola->resendDmx();
|
||||
}
|
108
src/libremediaserver-audio.h
Executable file
108
src/libremediaserver-audio.h
Executable file
|
@ -0,0 +1,108 @@
|
|||
/*
|
||||
Libre Media Server - A Media Server Sotfware for stage and performing
|
||||
Copyright (C) 2012-2013 Santiago Noreña libremediaserver@gmail.com
|
||||
|
||||
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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef LIBREMEDIASERVER_H
|
||||
#define LIBREMEDIASERVER_H
|
||||
|
||||
#include <QMainWindow>
|
||||
//#include <QApplication>
|
||||
#include <QObject>
|
||||
#include <QDesktopWidget>
|
||||
#include <QtGui>
|
||||
|
||||
#include <QFile>
|
||||
#include <QFileInfo>
|
||||
#include <QFileDialog>
|
||||
#include <QTextStream>
|
||||
#include <QWebView>
|
||||
#include <QUrl>
|
||||
#include <QVBoxLayout>
|
||||
#include <QTextEdit>
|
||||
|
||||
#include "settings.h"
|
||||
#include "audiomotor.h"
|
||||
#include "olathread.h"
|
||||
#include "audiolayerwidget.h"
|
||||
#include "audiomasterwidget.h"
|
||||
#include "audiowidget.h"
|
||||
|
||||
#include "ui_libremediaserver-audio.h"
|
||||
|
||||
#define VERSION "LibreMediaServer-Audio Version 0.1.0"
|
||||
#define COPYRIGHT "(C) 2014 Santi Norena libremediaserver@gmail.com"
|
||||
#define LICENSE "GPL 3 License. See LICENSE.txt and credits.txt for details"
|
||||
|
||||
class QMenu;
|
||||
class QProcess;
|
||||
|
||||
class libreMediaServerAudio : public QMainWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
|
||||
libreMediaServerAudio (QStringList args, QWidget *parent = 0);
|
||||
virtual ~libreMediaServerAudio();
|
||||
|
||||
Ui::LibreMediaServerAudio ui;
|
||||
|
||||
protected:
|
||||
|
||||
QString m_pathmedia; // Path to Medias
|
||||
QProcess *m_ola; // OLA daemon process
|
||||
|
||||
bool m_gui;
|
||||
|
||||
private:
|
||||
|
||||
QTextEdit *textEdit; // Terminal de feedback
|
||||
AudioMasterWidget *amw;
|
||||
// AudioLayerWidget *alw;
|
||||
AudioWidget *aw;
|
||||
|
||||
olaThread *ola;
|
||||
|
||||
void open_start();
|
||||
void save_finish();
|
||||
void open(QFile *file);
|
||||
void save(QFile *file);
|
||||
|
||||
// void MessageHandler(QtMsgType type, const char *msg);
|
||||
|
||||
public slots:
|
||||
|
||||
private slots:
|
||||
|
||||
/**
|
||||
* @brief loadbang The audio motor engine is setup. Resend the dmx info to maintain aupdated to the current state
|
||||
*/
|
||||
|
||||
void loadbang();
|
||||
|
||||
void olasetup();
|
||||
|
||||
void dmxInput(int layer, int channel, int value);
|
||||
|
||||
// Menu File
|
||||
void openFile();
|
||||
void saveFile();
|
||||
void ChangeMediaPath();// Change the path to medias
|
||||
|
||||
};
|
||||
|
||||
#endif // LIBREMEDIASERVER_H
|
51
src/libremediaserver-audio.pro
Executable file
51
src/libremediaserver-audio.pro
Executable file
|
@ -0,0 +1,51 @@
|
|||
TEMPLATE = app
|
||||
TARGET = libremediaserver-audio
|
||||
QT += network script webkit
|
||||
CONFIG += debug
|
||||
DESTDIR = ./debug
|
||||
|
||||
HEADERS += libremediaserver-audio.h \
|
||||
medialibrary.h \
|
||||
audiomotor.h \
|
||||
olathread.h \
|
||||
audiolayerwidget.h \
|
||||
dmxPersonality.h \
|
||||
audiowidget.h \
|
||||
audiomasterwidget.h \
|
||||
defines.h \
|
||||
settings.h
|
||||
|
||||
SOURCES += main.cpp \
|
||||
libremediaserver-audio.cpp \
|
||||
medialibrary.cpp \
|
||||
audiomotor.cpp \
|
||||
olathread.cpp \
|
||||
audiolayerwidget.cpp \
|
||||
audiowidget.cpp \
|
||||
audiomasterwidget.cpp \
|
||||
settings.cpp
|
||||
|
||||
FORMS += \
|
||||
libremediaserver-audio.ui
|
||||
|
||||
#INCLUDEPATH += ./
|
||||
|
||||
LIBS += -L./debug -lola -lolacommon
|
||||
|
||||
#win32:CONFIG(release, debug|release): LIBS += -L$$PWD/../debug/release/ -lcitp
|
||||
#else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/../debug/debug/ -lcitp
|
||||
#else:symbian: LIBS += -lcitp
|
||||
#else:unix: LIBS += -L$$PWD/../debug/ -lcitp
|
||||
#INCLUDEPATH += $$PWD/../debug
|
||||
#DEPENDPATH += $$PWD/../debug
|
||||
|
||||
RESOURCES =
|
||||
|
||||
|
||||
OTHER_FILES += \
|
||||
../LICENSE.txt \
|
||||
../instalacion.txt \
|
||||
../credits.txt \
|
||||
../compiling.txt \
|
||||
../changelog.txt \
|
||||
../lms-audio.xlm
|
84
src/libremediaserver-audio.ui
Executable file
84
src/libremediaserver-audio.ui
Executable file
|
@ -0,0 +1,84 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<author>Santi Noreña belfegor@gmail.com</author>
|
||||
<class>LibreMediaServerAudio</class>
|
||||
<widget class="QMainWindow" name="LibreMediaServerAudio">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>745</width>
|
||||
<height>636</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>LibreMediaServer</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="centralwidget"/>
|
||||
<widget class="QMenuBar" name="menuBar">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>745</width>
|
||||
<height>29</height>
|
||||
</rect>
|
||||
</property>
|
||||
<widget class="QMenu" name="menuFile">
|
||||
<property name="title">
|
||||
<string>File</string>
|
||||
</property>
|
||||
<addaction name="actionOpen_conf"/>
|
||||
<addaction name="actionSave_conf"/>
|
||||
<addaction name="actionChange_Media_Path"/>
|
||||
<addaction name="actionLaunch_OLA_Setup"/>
|
||||
</widget>
|
||||
<addaction name="menuFile"/>
|
||||
</widget>
|
||||
<action name="actionExit">
|
||||
<property name="text">
|
||||
<string>Exit</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionOpen_conf">
|
||||
<property name="text">
|
||||
<string>Open Configuration</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionSave_conf">
|
||||
<property name="text">
|
||||
<string>Save Configuration</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionChange_Media_Path">
|
||||
<property name="text">
|
||||
<string>Change Media Path</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionInitMSEX">
|
||||
<property name="checkable">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Init</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionIP_Address">
|
||||
<property name="text">
|
||||
<string>IP Address</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionMake_Thumbs">
|
||||
<property name="text">
|
||||
<string>Make Thumbs</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionLaunch_OLA_Setup">
|
||||
<property name="text">
|
||||
<string>OLA Setup</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
122
src/main.cpp
Executable file
122
src/main.cpp
Executable file
|
@ -0,0 +1,122 @@
|
|||
/*
|
||||
Libre Media Server - A media server for audio playback in stage arts
|
||||
controlled by lingting protocols (DMX, ArtNet, ACN,...)
|
||||
|
||||
Copyright (C) 2015 Santiago Noreña libremediaserver@gmail.com
|
||||
|
||||
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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <QApplication>
|
||||
#include "libremediaserver-audio.h"
|
||||
|
||||
// Handler for pipe the stderr to a log file
|
||||
|
||||
bool initMessageHandler = false;
|
||||
QFile outFile;
|
||||
|
||||
void MessageHandler(QtMsgType type, const char *msg)
|
||||
{
|
||||
QString txt;
|
||||
switch (type) {
|
||||
case QtDebugMsg:
|
||||
txt = QString("Debug: %1").arg(msg);
|
||||
break;
|
||||
case QtWarningMsg:
|
||||
txt = QString("Warning: %1").arg(msg);
|
||||
break;
|
||||
case QtCriticalMsg:
|
||||
txt = QString("Critical: %1").arg(msg);
|
||||
break;
|
||||
case QtFatalMsg:
|
||||
txt = QString("Fatal: %1").arg(msg);
|
||||
abort();
|
||||
}
|
||||
// Create the log dir and log file
|
||||
if (!initMessageHandler)
|
||||
{
|
||||
QDir dir;
|
||||
if (!dir.exists("log"))
|
||||
{
|
||||
if (!dir.mkdir("log"))
|
||||
{
|
||||
qDebug()<<"MessageHandler: Can not create log folder";
|
||||
return;
|
||||
}
|
||||
}
|
||||
QString filename;
|
||||
QDate date = QDate::currentDate();
|
||||
QTime time = QTime::currentTime();
|
||||
filename.append("./log/log_");
|
||||
filename.append(date.toString("ddMMyy-"));
|
||||
filename.append(time.toString("hhmmss.txt"));
|
||||
outFile.setFileName(filename);
|
||||
if (!outFile.open(QIODevice::WriteOnly | QIODevice::Append))
|
||||
{
|
||||
qDebug()<<"main/MessageHandler/Qfile::open: can not open log file";
|
||||
return;
|
||||
}
|
||||
initMessageHandler = true;
|
||||
}
|
||||
QTextStream ts(&outFile);
|
||||
ts << txt << endl;
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
QApplication app(argc, argv);
|
||||
|
||||
QStringList args = app.arguments();
|
||||
// parse the command line
|
||||
if (args.size() > 1)
|
||||
{
|
||||
if (args.contains("-v") > 0)
|
||||
{
|
||||
qDebug() << VERSION;
|
||||
qDebug() << COPYRIGHT;
|
||||
qDebug() << LICENSE;
|
||||
return 0;
|
||||
}
|
||||
if (args.contains("-h") > 0)
|
||||
{
|
||||
qDebug() << VERSION;
|
||||
qDebug() << COPYRIGHT;
|
||||
qDebug() << LICENSE;
|
||||
qDebug() << "Help for command line options:";
|
||||
qDebug() << "-v show the version and exits";
|
||||
qDebug() << "-gui show the Pure Data GUI's";
|
||||
qDebug() << "-log write the debug information to a log file instead stderr";
|
||||
qDebug() << "-h this help";
|
||||
return 0;
|
||||
}
|
||||
if (args.contains("-log"))
|
||||
{
|
||||
qInstallMsgHandler(MessageHandler);
|
||||
}
|
||||
if (!args.contains("-gui"))
|
||||
{
|
||||
for (int i=1; i<args.size();i++)
|
||||
{
|
||||
qDebug() << "Option not known: " << args.at(i);
|
||||
}
|
||||
qDebug() <<"Write ./libremediaserver-audio -h for help in command line arguments";
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
libreMediaServerAudio libreMediaServerAudio(args);
|
||||
libreMediaServerAudio.show();
|
||||
return app.exec();
|
||||
}
|
||||
|
||||
|
92
src/medialibrary.cpp
Normal file
92
src/medialibrary.cpp
Normal file
|
@ -0,0 +1,92 @@
|
|||
#include "medialibrary.h"
|
||||
|
||||
|
||||
MediaLibrary *MediaLibrary::_instance = 0;
|
||||
|
||||
MediaLibrary *MediaLibrary::getInstance() {
|
||||
|
||||
if (_instance == 0) {
|
||||
_instance = new MediaLibrary();
|
||||
Q_CHECK_PTR(_instance);
|
||||
}
|
||||
return _instance;
|
||||
}
|
||||
|
||||
MediaLibrary::MediaLibrary(QObject *parent) :
|
||||
QObject(parent)
|
||||
{
|
||||
initMediaLibrary();
|
||||
qDebug("Init MediaLibrary");
|
||||
}
|
||||
|
||||
/** Initializes the media library and the media information
|
||||
* from the path to media in m_pathmedia
|
||||
*/
|
||||
|
||||
void MediaLibrary::initMediaLibrary() {
|
||||
QDir dir;
|
||||
if (!dir.cd(m_pathmedia)) {
|
||||
qWarning("olaInterface::initMediaLibrary| Can not cd to the path: ");
|
||||
qWarning(m_pathmedia.toAscii().constData());
|
||||
return;
|
||||
}
|
||||
m_media = new QList<MediaFolder>;
|
||||
dir.setFilter(QDir::Dirs | QDir::NoSymLinks | QDir::NoDotAndDotDot);
|
||||
QFileInfoList filelist = dir.entryInfoList();
|
||||
dir.setFilter(QDir::Files);
|
||||
QFileInfo fileInfo;
|
||||
struct MediaFolder mediai;
|
||||
for (int i = 0; i < filelist.size(); ++i) {
|
||||
fileInfo = filelist.at(i);
|
||||
QString name = fileInfo.absoluteFilePath();
|
||||
dir.cd(fileInfo.baseName());
|
||||
mediai.m_Id = i;
|
||||
mediai.m_Name = name;
|
||||
mediai.m_ElementCount = dir.count();
|
||||
mediai.m_MediaInformation = getMediaInformation(dir);
|
||||
dir.cdUp();
|
||||
m_media->append(mediai);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This set every media file included in one library/folder
|
||||
*/
|
||||
QList<MediaFile> MediaLibrary::getMediaInformation(QDir dir)
|
||||
{
|
||||
QList<MediaFile> mediaList;
|
||||
MediaFile mediainf;
|
||||
dir.setFilter(QDir::Files);
|
||||
QFileInfoList filelist = dir.entryInfoList();
|
||||
QFileInfo fileInfo;
|
||||
for (int i = 0; i < filelist.size(); ++i) {
|
||||
fileInfo = filelist.at(i);
|
||||
// Update the data base with the new file
|
||||
mediainf.Number = i;
|
||||
mediainf.MediaName = fileInfo.absoluteFilePath();
|
||||
mediainf.MediaLength = 1000; // ¿?¿?¿?¿?
|
||||
mediaList.append(mediainf);
|
||||
}
|
||||
return mediaList;
|
||||
}
|
||||
|
||||
/** Selects one media name
|
||||
*
|
||||
*/
|
||||
|
||||
QString MediaLibrary::requestNewFile(int folder, int file){
|
||||
// Select one mediafile from the media library
|
||||
QString newfile;
|
||||
if (folder < m_media->size()) {
|
||||
if (file < m_media->at(folder).m_MediaInformation.size()) {
|
||||
newfile = m_media->at(folder).m_MediaInformation.at(file).MediaName;
|
||||
} else {
|
||||
qDebug("MediaLibrary::requestNewFile(): Requested file is greater than files in library");
|
||||
}
|
||||
} else {
|
||||
qDebug("MediaLibrary::requestNewFile(): Requested folder is greater than media libraries");
|
||||
}
|
||||
return newfile;
|
||||
}
|
||||
|
||||
|
67
src/medialibrary.h
Normal file
67
src/medialibrary.h
Normal file
|
@ -0,0 +1,67 @@
|
|||
#ifndef MEDIALIBRARY_H
|
||||
#define MEDIALIBRARY_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QDir>
|
||||
|
||||
// Media Information for MELIn packages. v1.0
|
||||
struct MediaFile {
|
||||
quint8 Number; // 0-based contiguous index of the media.
|
||||
QString MediaName;// Media name.
|
||||
quint32 MediaLength;// Media length (in frames).
|
||||
};
|
||||
|
||||
// Media Library for ELin packages v1.0
|
||||
struct MediaFolder {
|
||||
quint8 m_Id; // Library id.
|
||||
QString m_Name;// Library name.
|
||||
quint8 m_ElementCount;// Number of elements in the library.
|
||||
QList<MediaFile> m_MediaInformation; // Pointer to the Medias Information List of this Library
|
||||
};
|
||||
|
||||
|
||||
class MediaLibrary : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
||||
static MediaLibrary *getInstance();
|
||||
|
||||
inline void setPath(QString path) { m_pathmedia = path; rescanMediaLibrary();}
|
||||
|
||||
QString requestNewFile(int folder, int layer);
|
||||
|
||||
private:
|
||||
|
||||
explicit MediaLibrary(QObject *parent = 0);
|
||||
static MediaLibrary *_instance;
|
||||
inline QString getPath () { return m_pathmedia; } // Get the path to the medias folder tree.
|
||||
|
||||
inline void deleteMediaLibrary() { delete m_media; m_media = NULL; }
|
||||
/**
|
||||
* Change library/path
|
||||
*/
|
||||
inline void rescanMediaLibrary()
|
||||
{
|
||||
deleteMediaLibrary();
|
||||
initMediaLibrary();
|
||||
}
|
||||
|
||||
QList<MediaFolder> *m_media; // Library to save the folders/media libraries and index each media file inside
|
||||
QString m_pathmedia; // Path to Medias
|
||||
|
||||
void initMediaLibrary();
|
||||
/** Called when there is a change in the channels folder or file
|
||||
* this is called. Creates a new source.
|
||||
*/
|
||||
|
||||
|
||||
QList<MediaFile> getMediaInformation(QDir dir); // Get all the information of each media file in a dir
|
||||
|
||||
signals:
|
||||
|
||||
public slots:
|
||||
|
||||
};
|
||||
|
||||
#endif // MEDIALIBRARY_H
|
51
src/olainterface.cpp
Executable file
51
src/olainterface.cpp
Executable file
|
@ -0,0 +1,51 @@
|
|||
/* olainterface.cpp
|
||||
Santi Noreña 2013
|
||||
It includes two classes:
|
||||
olaWorker is the threading class that reads raw DMX from ola daemon and save it into a buffer ordered in layers
|
||||
olaInterface controls olaWorker and translates DMX values received from olaWorker into orders to RenderingManager and Source
|
||||
*/
|
||||
|
||||
#include "olainterface.h"
|
||||
|
||||
olaInterface::olaInterface()
|
||||
{
|
||||
qDebug() << tr("olaInterface|") << "Starting";
|
||||
m_thread = NULL;
|
||||
m_thread = new QThread;
|
||||
Q_CHECK_PTR(m_thread);
|
||||
worker = new olaWorker();
|
||||
Q_CHECK_PTR(worker);
|
||||
connect (worker, SIGNAL(dmx(int,int,int)), this, SLOT(dmx(int,int,int)), Qt::QueuedConnection); // The DMX values.
|
||||
worker->moveToThread(m_thread);
|
||||
connect(m_thread, SIGNAL(started()), worker, SLOT(olastart()));
|
||||
connect(m_thread, SIGNAL(finished()), m_thread, SLOT(deleteLater()));
|
||||
m_thread->start();
|
||||
}
|
||||
|
||||
olaInterface::~olaInterface()
|
||||
{
|
||||
close();
|
||||
}
|
||||
|
||||
// Close olaWorker and finish the thread
|
||||
void olaInterface::close()
|
||||
{
|
||||
worker->blockSignals(true);
|
||||
worker->olastop();
|
||||
delete worker;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Parse new DMX
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
//New dmx. Connected with signal newdmx from olaInterface->Worker
|
||||
void olaInterface::dmx(int layer, int channel, int value)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
68
src/olainterface.h
Executable file
68
src/olainterface.h
Executable file
|
@ -0,0 +1,68 @@
|
|||
/* olainterface.h
|
||||
Santi Noreña 2013
|
||||
It includes two classes:
|
||||
olaWorker is the threading class that reads raw DMX from ola daemon
|
||||
olaInterface controls olaWorker and translates DMX values received from olaWorker into orders to RenderingManager and Source
|
||||
*/
|
||||
#ifndef OLAINTERFACE_H
|
||||
#define OLAINTERFACE_H
|
||||
|
||||
//#define DMX_SOURCETYPE 7
|
||||
|
||||
#define LAYER_CHANNELS 15 // The numer of control channels per video layer
|
||||
#define MAX_SOURCE_DMX 8 // Number of maximum Sources controlled by DMX. It should be equal to MAX_SOURCE_COUNT
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <QObject>
|
||||
|
||||
#include <QDebug>
|
||||
#include <QXmlStreamReader>
|
||||
#include <QFile>
|
||||
#include <QMessageBox>
|
||||
#include <QProcess>
|
||||
|
||||
// The OLA Library
|
||||
#include <ola/OlaClientWrapper.h>
|
||||
#include <ola/OlaCallbackClient.h>
|
||||
//#include <ola/OlaClient.h>
|
||||
|
||||
|
||||
#include "libremediaserver.h"
|
||||
|
||||
using namespace ola;
|
||||
|
||||
class olaInterface : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit olaInterface();
|
||||
virtual ~olaInterface();
|
||||
|
||||
void open(); // Starts the thread and open the connection with olad
|
||||
void close(); // Close the connection with olad
|
||||
|
||||
olaWorker *worker; // The thread of connection with ola.
|
||||
|
||||
protected:
|
||||
|
||||
QThread *m_thread; // The thread for olaWorker
|
||||
|
||||
private:
|
||||
|
||||
void readDataFromXML(); // Read the DMX configuration from the file dmx.xml
|
||||
|
||||
public slots:
|
||||
|
||||
void dmx(int layer, int channel, int value); // Connected with signal dmx from olaWorker. This is the horsepower of all this. Converts DMX orders
|
||||
// into orders to RenderingManager and Source. Mantains updated the videolayer struct.
|
||||
signals:
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif // OLAINTERFACE_H
|
||||
|
138
src/olathread.cpp
Normal file
138
src/olathread.cpp
Normal file
|
@ -0,0 +1,138 @@
|
|||
#include "olathread.h"
|
||||
|
||||
|
||||
olaThread::olaThread(QObject *parent)
|
||||
// : QObject(parent)
|
||||
{
|
||||
m_universe = new QList<int>();
|
||||
m_counter = 0;
|
||||
gettimeofday(&m_last_data, NULL);
|
||||
dmxSetting newsetting;
|
||||
newsetting.address = -1;
|
||||
newsetting.universe = -1;
|
||||
newsetting.updated = false;
|
||||
m_layersNumber = LAYERS_NUMBER;
|
||||
for (int i=0; i < LAYERS_NUMBER; i++)
|
||||
{
|
||||
newsetting.layer = i;
|
||||
m_settings.append(newsetting);
|
||||
for (int j=0; j < LAYER_CHANNELS; j++)
|
||||
{
|
||||
m_dmx[i][j] = 0;
|
||||
}
|
||||
}
|
||||
/* int argc = 1;
|
||||
char argv[] = "-l 3";
|
||||
if (!ola::AppInit (&argc, &argv,"LMS", "DMX sound media server"))
|
||||
qCritical("Can not init ola");*/
|
||||
|
||||
// set up ola connection
|
||||
m_clientWrapper = new ola::client::OlaClientWrapper;
|
||||
Q_CHECK_PTR(m_clientWrapper);
|
||||
if (!m_clientWrapper->Setup()) { qErrnoWarning("olaThread::olaStart| Failed Setup() in Client Wrapper"); }
|
||||
m_client = m_clientWrapper->GetClient();
|
||||
ola::InitLogging(ola::OLA_LOG_INFO , ola::OLA_LOG_STDERR);
|
||||
m_client->SetDMXCallback(ola::NewCallback(this, &olaThread::NewDmx));
|
||||
m_clientWrapper->GetSelectServer()->RegisterRepeatingTimeout(4000, ola::NewCallback(this, &olaThread::CheckDataLoss));
|
||||
qDebug() << "Init olaThread";
|
||||
}
|
||||
|
||||
// --- DECONSTRUCTOR ---
|
||||
olaThread::~olaThread() {
|
||||
stop();
|
||||
}
|
||||
|
||||
/** Open the connection with olad and start processing data.
|
||||
*/
|
||||
|
||||
void olaThread::run() {
|
||||
|
||||
/* register the universe
|
||||
if (!m_client->RegisterUniverse(m_universe, ola::REGISTER,ola::NewSingleCallback(&RegisterComplete))) {
|
||||
qDebug() << "Can not register universe %1".arg(m_universe);
|
||||
}*/
|
||||
m_clientWrapper->GetSelectServer()->Run();
|
||||
qDebug()<< tr("olaThread|") << "Running";
|
||||
}
|
||||
|
||||
void olaThread::stop()
|
||||
{
|
||||
if (m_clientWrapper != NULL)
|
||||
{
|
||||
for (int i = 0; i < m_universe->size(); i++) {
|
||||
m_client->RegisterUniverse(m_universe->at(i), ola::client::UNREGISTER, ola::NewSingleCallback(this, &olaThread::RegisterComplete));
|
||||
}
|
||||
m_clientWrapper->GetSelectServer()->Terminate();
|
||||
m_client = NULL;
|
||||
m_clientWrapper = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* RepeteableDMXCallBack
|
||||
* Callback2<void, const DMXMetada&, const DmxBuffer&>
|
||||
* from OLA daemon when there is new DMX data. This is called one for second if there is not updated in the DMX frame. We need emit only the channels that
|
||||
* has changed to save resources.
|
||||
*/
|
||||
|
||||
// ToDo: It can be more efficient making the dmx buffer a DmxBuffer class instead a int array and compare with the new if there is changes at start. Also all access to the buffer it should be get/set. I should profile this
|
||||
|
||||
// typedef Callback2<void, const DMXMetadata&, const DmxBuffer&> ola::client::RepeatableDMXCallback
|
||||
void olaThread::NewDmx(const ola::client::DMXMetadata &data,
|
||||
const ola::DmxBuffer &buffer)
|
||||
{
|
||||
m_counter++;
|
||||
gettimeofday(&m_last_data, NULL);
|
||||
int universe = data.universe;
|
||||
for (int i = 0; i < m_layersNumber; i++) { // loop for reading the channels by layer.
|
||||
if((m_settings.at(i).universe == universe)
|
||||
&& ( m_settings.at(i).address > -1 )) { // Compare if the layer is from this universe
|
||||
// AND if the DMX address is 0 or greater, process this layer.
|
||||
for (int j = 0; j < LAYER_CHANNELS; j++){
|
||||
int value = buffer.Get((m_settings.at(i).address) + j); // Get the value for this channel.
|
||||
if (m_dmx[i][j] != value) { // Compare the new value with the old value.
|
||||
emit dmxOutput(i,j,value); // Connected with dmx slot in olaInterface.
|
||||
m_dmx[i][j] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check for data loss each 4 seconds.
|
||||
*/
|
||||
|
||||
bool olaThread::CheckDataLoss() {
|
||||
struct timeval now, diff;
|
||||
if (timerisset(&m_last_data)) {
|
||||
gettimeofday(&now, NULL);
|
||||
timersub(&now, &m_last_data, &diff);
|
||||
if (diff.tv_sec > 4 || (diff.tv_sec == 4 && diff.tv_usec > 4000000)) {
|
||||
// loss of data
|
||||
qDebug()<< "olaThread| Can not read one or several universes";
|
||||
// return false; // Retorna false para deshabilitar el callback
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void olaThread::setLayersNumber(int layersNumber) { m_layersNumber = layersNumber; }
|
||||
|
||||
|
||||
void olaThread::resendDmx()
|
||||
{
|
||||
for (int i = 0; i < m_layersNumber; i++) { // loop for reading the channels by layer.
|
||||
for (int j = 0; j < LAYER_CHANNELS; j++){
|
||||
emit dmxOutput(i, j, m_dmx[i][j]); // Connected with dmx slot in olaInterface.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
||||
|
126
src/olathread.h
Normal file
126
src/olathread.h
Normal file
|
@ -0,0 +1,126 @@
|
|||
#ifndef OLATHREAD_H
|
||||
#define OLATHREAD_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QThread>
|
||||
#include <QDebug>
|
||||
|
||||
#include <string>
|
||||
|
||||
#include <ola/DmxBuffer.h>
|
||||
#include <ola/Logging.h>
|
||||
#include <ola/OlaClientWrapper.h>
|
||||
#include <ola/client/OlaClient.h>
|
||||
#include <ola/DmxBuffer.h>
|
||||
#include <ola/client/ClientTypes.h>
|
||||
|
||||
#include "defines.h"
|
||||
#include "dmxPersonality.h"
|
||||
|
||||
// struct where save the DMX settings for each layer
|
||||
struct dmxSetting {
|
||||
int address;
|
||||
uint universe;
|
||||
bool updated;
|
||||
int layer;
|
||||
};
|
||||
|
||||
class olaThread : public QThread
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
|
||||
olaThread(QObject *parent = 0);
|
||||
virtual ~olaThread();
|
||||
|
||||
|
||||
|
||||
/** Retorna el valor de un canal
|
||||
*@param int layer the layer for we want the channel
|
||||
*@param int channel the channel for the value wanted
|
||||
*@return int the value
|
||||
*/
|
||||
|
||||
inline int getValue(int layer, int channel) {
|
||||
return m_dmx[layer][channel];
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief resendDMX emite todo el buffer DMX
|
||||
*/
|
||||
|
||||
void resendDmx();
|
||||
|
||||
private:
|
||||
|
||||
|
||||
void run ();
|
||||
|
||||
ola::client::OlaClientWrapper *m_clientWrapper;
|
||||
ola::client::OlaClient *m_client;
|
||||
unsigned int m_counter;
|
||||
struct timeval m_last_data; // Last DMX frame received
|
||||
|
||||
// DMX Conf
|
||||
// Cambiar para múltiples universos. Array? método de de ola::client?
|
||||
QList<int> *m_universe; // Registered universes.
|
||||
int m_layersNumber; // Number of layers in wich divide the dmx frame. Each layer, one source.
|
||||
|
||||
int m_dmx[LAYERS_NUMBER][LAYER_CHANNELS]; // DMX Buffer. Habría que cambiarlo si queremos hacer las capas dinámicas
|
||||
|
||||
QList<dmxSetting> m_settings;
|
||||
|
||||
inline void registerUniverse(int universe)
|
||||
{
|
||||
|
||||
// void ola::client::OlaClient::RegisterUniverse(unsigned int universe,RegisterAction register_action,SetCallback * callback
|
||||
m_client->RegisterUniverse(universe, ola::client::REGISTER,ola::NewSingleCallback(this, &olaThread::RegisterComplete));
|
||||
}
|
||||
|
||||
/**
|
||||
* Control de errores en el registro de Universos en OLA
|
||||
*/
|
||||
|
||||
// typedef SingleUseCallback1<void, const Result&> ola::client::SetCallback
|
||||
|
||||
inline void RegisterComplete(const ola::client::Result &error) {
|
||||
if (error.Success()) {
|
||||
qDebug() << "Register Universe success";
|
||||
} else {
|
||||
qWarning() << "olaThread|" << "Register command failed" << QString::fromStdString(error.Error());
|
||||
}
|
||||
}
|
||||
|
||||
bool CheckDataLoss();
|
||||
|
||||
// typedef Callback2<void, const DMXMetadata&, const DmxBuffer&> ola::client::RepeatableDMXCallback
|
||||
void NewDmx(const ola::client::DMXMetadata &dmx_meta, const ola::DmxBuffer &buffer); // Callback from OlaCLient when there is new dmx info
|
||||
|
||||
public slots:
|
||||
|
||||
void stop(); // Close the connection with olad.
|
||||
void setLayersNumber(int layersNumber);
|
||||
|
||||
inline void setDMXConf(dmxSetting set)
|
||||
{
|
||||
if (set.layer >= m_layersNumber) { return; }
|
||||
|
||||
m_settings.replace(set.layer, set);
|
||||
|
||||
// ToDo: registro del nuevo universo si no está registrado ya
|
||||
if (!m_universe->contains(set.universe)) {
|
||||
registerUniverse(set.universe);
|
||||
m_universe->append(set.universe);
|
||||
}
|
||||
}
|
||||
|
||||
protected slots:
|
||||
|
||||
signals:
|
||||
|
||||
void finished(); // Signal for closing. Not used now.
|
||||
void dmxOutput(int layer, int channel, int value); // Signal when a channel has changed
|
||||
};
|
||||
|
||||
#endif // OLATHREAD_H
|
81
src/settings.cpp
Normal file
81
src/settings.cpp
Normal file
|
@ -0,0 +1,81 @@
|
|||
#include "settings.h"
|
||||
|
||||
Settings::Settings(QObject *parent) :
|
||||
QObject(parent)
|
||||
{
|
||||
readDefaultFile();
|
||||
}
|
||||
|
||||
// Read the dmx settings for dmx.xml At the moment we need:
|
||||
// - The path to the medias folder tree
|
||||
// - The number of sources/layers controlled by DMX
|
||||
// - The first DMX channel of each source/layer
|
||||
// - The universe to bind in OLA
|
||||
// All this is being moved to settingsDialog Class
|
||||
|
||||
void Settings::readFromFile(QString file) {
|
||||
|
||||
QFile* xmlFile = new QFile(file);
|
||||
if (!xmlFile->open(QIODevice::ReadOnly | QIODevice::Text)) {
|
||||
QMessageBox::critical(NULL,"Load XML File Problem",
|
||||
QString("Couldn't open %1 to load settings for olaInterface").arg(file),
|
||||
QMessageBox::Ok);
|
||||
return;
|
||||
}
|
||||
QXmlStreamReader* xmlReader = new QXmlStreamReader(xmlFile);
|
||||
int counter = 0;
|
||||
//Parse the XML until we reach end of it
|
||||
while(!xmlReader->atEnd() && !xmlReader->hasError()) {
|
||||
// Read next element
|
||||
QXmlStreamReader::TokenType token = xmlReader->readNext();
|
||||
//If token is just StartDocument - go to next
|
||||
if(token == QXmlStreamReader::StartDocument) {
|
||||
continue;
|
||||
}
|
||||
//If token is StartElement - read it
|
||||
if(token == QXmlStreamReader::StartElement) {
|
||||
if(xmlReader->name() == "dmxSettings") {
|
||||
int version = xmlReader->attributes().value("fileVersion").toLocal8Bit().toInt();
|
||||
if(version == 1) {
|
||||
int layers = xmlReader->attributes().value("layersNumber").toLocal8Bit().toInt();
|
||||
emit layersNumber(layers);
|
||||
MediaLibrary::getInstance()->setPath (xmlReader->attributes().value("path").toLocal8Bit());
|
||||
continue;
|
||||
}
|
||||
}
|
||||
/* if (worker->m_layersNumber > MAX_SOURCE_DMX) {
|
||||
worker->m_layersNumber = MAX_SOURCE_DMX;
|
||||
}*/
|
||||
QString add = "layer";
|
||||
add.append(QString("%1").arg(counter));
|
||||
if((xmlReader->name() == add)) {
|
||||
dmxSetting temp;
|
||||
temp.address = xmlReader->attributes().value("dmx").toLocal8Bit().toInt() - 1;
|
||||
temp.universe = xmlReader->attributes().value("universe").toLocal8Bit().toInt();
|
||||
temp.layer = counter;
|
||||
emit DMXConf(temp);
|
||||
// If the universe is not in the list, append it.
|
||||
// if(!worker->m_universe.contains(temp.universe)) {
|
||||
// worker->m_universe.append(temp.universe);
|
||||
// }
|
||||
}
|
||||
counter++;
|
||||
}
|
||||
}
|
||||
if(xmlReader->hasError()) {
|
||||
QMessageBox::critical(NULL,"File xml Parse Error ", xmlReader->errorString(), QMessageBox::Ok);
|
||||
}
|
||||
//close reader and flush file
|
||||
xmlReader->clear();
|
||||
xmlFile->close();
|
||||
|
||||
delete xmlReader;
|
||||
delete xmlFile;
|
||||
}
|
||||
|
||||
/** Read the default file
|
||||
*
|
||||
*/
|
||||
void Settings::readDefaultFile() {
|
||||
readFromFile(DEFAULT_FILE);
|
||||
}
|
32
src/settings.h
Normal file
32
src/settings.h
Normal file
|
@ -0,0 +1,32 @@
|
|||
#ifndef SETTINGS_H
|
||||
#define SETTINGS_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QXmlStreamReader>
|
||||
#include <QFile>
|
||||
#include <QMessageBox>
|
||||
|
||||
#include "olathread.h"
|
||||
#include "audiomotor.h"
|
||||
#include "medialibrary.h"
|
||||
|
||||
#define DEFAULT_FILE "lms-audio.xlm"
|
||||
|
||||
class Settings : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit Settings(QObject *parent = 0);
|
||||
void readFromFile(QString file);
|
||||
void readDefaultFile();
|
||||
|
||||
signals:
|
||||
void pathChanged(QString path);
|
||||
void layersNumber(int number);
|
||||
void DMXConf(dmxSetting universe);
|
||||
|
||||
public slots:
|
||||
|
||||
};
|
||||
|
||||
#endif // SETTINGS_H
|
Loading…
Add table
Reference in a new issue