mirror of
https://github.com/projectM-visualizer/projectm.git
synced 2026-02-04 15:15:35 +00:00
revised repo structure to "svn style".
git-svn-id: https://projectm.svn.sourceforge.net/svnroot/projectm/trunk@133 6778bc44-b910-0410-a7a0-be141de4315d
This commit is contained in:
0
libprojectM/AUTHORS
Normal file
0
libprojectM/AUTHORS
Normal file
504
libprojectM/COPYING
Normal file
504
libprojectM/COPYING
Normal file
@ -0,0 +1,504 @@
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
Version 2.1, February 1999
|
||||
|
||||
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
[This is the first released version of the Lesser GPL. It also counts
|
||||
as the successor of the GNU Library Public License, version 2, hence
|
||||
the version number 2.1.]
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
Licenses are intended to guarantee your freedom to share and change
|
||||
free software--to make sure the software is free for all its users.
|
||||
|
||||
This license, the Lesser General Public License, applies to some
|
||||
specially designated software packages--typically libraries--of the
|
||||
Free Software Foundation and other authors who decide to use it. You
|
||||
can use it too, but we suggest you first think carefully about whether
|
||||
this license or the ordinary General Public License is the better
|
||||
strategy to use in any particular case, based on the explanations below.
|
||||
|
||||
When we speak of free software, we are referring to freedom of use,
|
||||
not price. Our General Public Licenses are designed to make sure that
|
||||
you have the freedom to distribute copies of free software (and charge
|
||||
for this service if you wish); that you receive source code or can get
|
||||
it if you want it; that you can change the software and use pieces of
|
||||
it in new free programs; and that you are informed that you can do
|
||||
these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
distributors to deny you these rights or to ask you to surrender these
|
||||
rights. These restrictions translate to certain responsibilities for
|
||||
you if you distribute copies of the library or if you modify it.
|
||||
|
||||
For example, if you distribute copies of the library, whether gratis
|
||||
or for a fee, you must give the recipients all the rights that we gave
|
||||
you. You must make sure that they, too, receive or can get the source
|
||||
code. If you link other code with the library, you must provide
|
||||
complete object files to the recipients, so that they can relink them
|
||||
with the library after making changes to the library and recompiling
|
||||
it. And you must show them these terms so they know their rights.
|
||||
|
||||
We protect your rights with a two-step method: (1) we copyright the
|
||||
library, and (2) we offer you this license, which gives you legal
|
||||
permission to copy, distribute and/or modify the library.
|
||||
|
||||
To protect each distributor, we want to make it very clear that
|
||||
there is no warranty for the free library. Also, if the library is
|
||||
modified by someone else and passed on, the recipients should know
|
||||
that what they have is not the original version, so that the original
|
||||
author's reputation will not be affected by problems that might be
|
||||
introduced by others.
|
||||
|
||||
Finally, software patents pose a constant threat to the existence of
|
||||
any free program. We wish to make sure that a company cannot
|
||||
effectively restrict the users of a free program by obtaining a
|
||||
restrictive license from a patent holder. Therefore, we insist that
|
||||
any patent license obtained for a version of the library must be
|
||||
consistent with the full freedom of use specified in this license.
|
||||
|
||||
Most GNU software, including some libraries, is covered by the
|
||||
ordinary GNU General Public License. This license, the GNU Lesser
|
||||
General Public License, applies to certain designated libraries, and
|
||||
is quite different from the ordinary General Public License. We use
|
||||
this license for certain libraries in order to permit linking those
|
||||
libraries into non-free programs.
|
||||
|
||||
When a program is linked with a library, whether statically or using
|
||||
a shared library, the combination of the two is legally speaking a
|
||||
combined work, a derivative of the original library. The ordinary
|
||||
General Public License therefore permits such linking only if the
|
||||
entire combination fits its criteria of freedom. The Lesser General
|
||||
Public License permits more lax criteria for linking other code with
|
||||
the library.
|
||||
|
||||
We call this license the "Lesser" General Public License because it
|
||||
does Less to protect the user's freedom than the ordinary General
|
||||
Public License. It also provides other free software developers Less
|
||||
of an advantage over competing non-free programs. These disadvantages
|
||||
are the reason we use the ordinary General Public License for many
|
||||
libraries. However, the Lesser license provides advantages in certain
|
||||
special circumstances.
|
||||
|
||||
For example, on rare occasions, there may be a special need to
|
||||
encourage the widest possible use of a certain library, so that it becomes
|
||||
a de-facto standard. To achieve this, non-free programs must be
|
||||
allowed to use the library. A more frequent case is that a free
|
||||
library does the same job as widely used non-free libraries. In this
|
||||
case, there is little to gain by limiting the free library to free
|
||||
software only, so we use the Lesser General Public License.
|
||||
|
||||
In other cases, permission to use a particular library in non-free
|
||||
programs enables a greater number of people to use a large body of
|
||||
free software. For example, permission to use the GNU C Library in
|
||||
non-free programs enables many more people to use the whole GNU
|
||||
operating system, as well as its variant, the GNU/Linux operating
|
||||
system.
|
||||
|
||||
Although the Lesser General Public License is Less protective of the
|
||||
users' freedom, it does ensure that the user of a program that is
|
||||
linked with the Library has the freedom and the wherewithal to run
|
||||
that program using a modified version of the Library.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow. Pay close attention to the difference between a
|
||||
"work based on the library" and a "work that uses the library". The
|
||||
former contains code derived from the library, whereas the latter must
|
||||
be combined with the library in order to run.
|
||||
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License Agreement applies to any software library or other
|
||||
program which contains a notice placed by the copyright holder or
|
||||
other authorized party saying it may be distributed under the terms of
|
||||
this Lesser General Public License (also called "this License").
|
||||
Each licensee is addressed as "you".
|
||||
|
||||
A "library" means a collection of software functions and/or data
|
||||
prepared so as to be conveniently linked with application programs
|
||||
(which use some of those functions and data) to form executables.
|
||||
|
||||
The "Library", below, refers to any such software library or work
|
||||
which has been distributed under these terms. A "work based on the
|
||||
Library" means either the Library or any derivative work under
|
||||
copyright law: that is to say, a work containing the Library or a
|
||||
portion of it, either verbatim or with modifications and/or translated
|
||||
straightforwardly into another language. (Hereinafter, translation is
|
||||
included without limitation in the term "modification".)
|
||||
|
||||
"Source code" for a work means the preferred form of the work for
|
||||
making modifications to it. For a library, complete source code means
|
||||
all the source code for all modules it contains, plus any associated
|
||||
interface definition files, plus the scripts used to control compilation
|
||||
and installation of the library.
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running a program using the Library is not restricted, and output from
|
||||
such a program is covered only if its contents constitute a work based
|
||||
on the Library (independent of the use of the Library in a tool for
|
||||
writing it). Whether that is true depends on what the Library does
|
||||
and what the program that uses the Library does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Library's
|
||||
complete source code as you receive it, in any medium, provided that
|
||||
you conspicuously and appropriately publish on each copy an
|
||||
appropriate copyright notice and disclaimer of warranty; keep intact
|
||||
all the notices that refer to this License and to the absence of any
|
||||
warranty; and distribute a copy of this License along with the
|
||||
Library.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy,
|
||||
and you may at your option offer warranty protection in exchange for a
|
||||
fee.
|
||||
|
||||
2. You may modify your copy or copies of the Library or any portion
|
||||
of it, thus forming a work based on the Library, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) The modified work must itself be a software library.
|
||||
|
||||
b) You must cause the files modified to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
c) You must cause the whole of the work to be licensed at no
|
||||
charge to all third parties under the terms of this License.
|
||||
|
||||
d) If a facility in the modified Library refers to a function or a
|
||||
table of data to be supplied by an application program that uses
|
||||
the facility, other than as an argument passed when the facility
|
||||
is invoked, then you must make a good faith effort to ensure that,
|
||||
in the event an application does not supply such function or
|
||||
table, the facility still operates, and performs whatever part of
|
||||
its purpose remains meaningful.
|
||||
|
||||
(For example, a function in a library to compute square roots has
|
||||
a purpose that is entirely well-defined independent of the
|
||||
application. Therefore, Subsection 2d requires that any
|
||||
application-supplied function or table used by this function must
|
||||
be optional: if the application does not supply it, the square
|
||||
root function must still compute square roots.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Library,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Library, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote
|
||||
it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Library.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Library
|
||||
with the Library (or with a work based on the Library) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may opt to apply the terms of the ordinary GNU General Public
|
||||
License instead of this License to a given copy of the Library. To do
|
||||
this, you must alter all the notices that refer to this License, so
|
||||
that they refer to the ordinary GNU General Public License, version 2,
|
||||
instead of to this License. (If a newer version than version 2 of the
|
||||
ordinary GNU General Public License has appeared, then you can specify
|
||||
that version instead if you wish.) Do not make any other change in
|
||||
these notices.
|
||||
|
||||
Once this change is made in a given copy, it is irreversible for
|
||||
that copy, so the ordinary GNU General Public License applies to all
|
||||
subsequent copies and derivative works made from that copy.
|
||||
|
||||
This option is useful when you wish to copy part of the code of
|
||||
the Library into a program that is not a library.
|
||||
|
||||
4. You may copy and distribute the Library (or a portion or
|
||||
derivative of it, under Section 2) in object code or executable form
|
||||
under the terms of Sections 1 and 2 above provided that you accompany
|
||||
it with the complete corresponding machine-readable source code, which
|
||||
must be distributed under the terms of Sections 1 and 2 above on a
|
||||
medium customarily used for software interchange.
|
||||
|
||||
If distribution of object code is made by offering access to copy
|
||||
from a designated place, then offering equivalent access to copy the
|
||||
source code from the same place satisfies the requirement to
|
||||
distribute the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
5. A program that contains no derivative of any portion of the
|
||||
Library, but is designed to work with the Library by being compiled or
|
||||
linked with it, is called a "work that uses the Library". Such a
|
||||
work, in isolation, is not a derivative work of the Library, and
|
||||
therefore falls outside the scope of this License.
|
||||
|
||||
However, linking a "work that uses the Library" with the Library
|
||||
creates an executable that is a derivative of the Library (because it
|
||||
contains portions of the Library), rather than a "work that uses the
|
||||
library". The executable is therefore covered by this License.
|
||||
Section 6 states terms for distribution of such executables.
|
||||
|
||||
When a "work that uses the Library" uses material from a header file
|
||||
that is part of the Library, the object code for the work may be a
|
||||
derivative work of the Library even though the source code is not.
|
||||
Whether this is true is especially significant if the work can be
|
||||
linked without the Library, or if the work is itself a library. The
|
||||
threshold for this to be true is not precisely defined by law.
|
||||
|
||||
If such an object file uses only numerical parameters, data
|
||||
structure layouts and accessors, and small macros and small inline
|
||||
functions (ten lines or less in length), then the use of the object
|
||||
file is unrestricted, regardless of whether it is legally a derivative
|
||||
work. (Executables containing this object code plus portions of the
|
||||
Library will still fall under Section 6.)
|
||||
|
||||
Otherwise, if the work is a derivative of the Library, you may
|
||||
distribute the object code for the work under the terms of Section 6.
|
||||
Any executables containing that work also fall under Section 6,
|
||||
whether or not they are linked directly with the Library itself.
|
||||
|
||||
6. As an exception to the Sections above, you may also combine or
|
||||
link a "work that uses the Library" with the Library to produce a
|
||||
work containing portions of the Library, and distribute that work
|
||||
under terms of your choice, provided that the terms permit
|
||||
modification of the work for the customer's own use and reverse
|
||||
engineering for debugging such modifications.
|
||||
|
||||
You must give prominent notice with each copy of the work that the
|
||||
Library is used in it and that the Library and its use are covered by
|
||||
this License. You must supply a copy of this License. If the work
|
||||
during execution displays copyright notices, you must include the
|
||||
copyright notice for the Library among them, as well as a reference
|
||||
directing the user to the copy of this License. Also, you must do one
|
||||
of these things:
|
||||
|
||||
a) Accompany the work with the complete corresponding
|
||||
machine-readable source code for the Library including whatever
|
||||
changes were used in the work (which must be distributed under
|
||||
Sections 1 and 2 above); and, if the work is an executable linked
|
||||
with the Library, with the complete machine-readable "work that
|
||||
uses the Library", as object code and/or source code, so that the
|
||||
user can modify the Library and then relink to produce a modified
|
||||
executable containing the modified Library. (It is understood
|
||||
that the user who changes the contents of definitions files in the
|
||||
Library will not necessarily be able to recompile the application
|
||||
to use the modified definitions.)
|
||||
|
||||
b) Use a suitable shared library mechanism for linking with the
|
||||
Library. A suitable mechanism is one that (1) uses at run time a
|
||||
copy of the library already present on the user's computer system,
|
||||
rather than copying library functions into the executable, and (2)
|
||||
will operate properly with a modified version of the library, if
|
||||
the user installs one, as long as the modified version is
|
||||
interface-compatible with the version that the work was made with.
|
||||
|
||||
c) Accompany the work with a written offer, valid for at
|
||||
least three years, to give the same user the materials
|
||||
specified in Subsection 6a, above, for a charge no more
|
||||
than the cost of performing this distribution.
|
||||
|
||||
d) If distribution of the work is made by offering access to copy
|
||||
from a designated place, offer equivalent access to copy the above
|
||||
specified materials from the same place.
|
||||
|
||||
e) Verify that the user has already received a copy of these
|
||||
materials or that you have already sent this user a copy.
|
||||
|
||||
For an executable, the required form of the "work that uses the
|
||||
Library" must include any data and utility programs needed for
|
||||
reproducing the executable from it. However, as a special exception,
|
||||
the materials to be distributed need not include anything that is
|
||||
normally distributed (in either source or binary form) with the major
|
||||
components (compiler, kernel, and so on) of the operating system on
|
||||
which the executable runs, unless that component itself accompanies
|
||||
the executable.
|
||||
|
||||
It may happen that this requirement contradicts the license
|
||||
restrictions of other proprietary libraries that do not normally
|
||||
accompany the operating system. Such a contradiction means you cannot
|
||||
use both them and the Library together in an executable that you
|
||||
distribute.
|
||||
|
||||
7. You may place library facilities that are a work based on the
|
||||
Library side-by-side in a single library together with other library
|
||||
facilities not covered by this License, and distribute such a combined
|
||||
library, provided that the separate distribution of the work based on
|
||||
the Library and of the other library facilities is otherwise
|
||||
permitted, and provided that you do these two things:
|
||||
|
||||
a) Accompany the combined library with a copy of the same work
|
||||
based on the Library, uncombined with any other library
|
||||
facilities. This must be distributed under the terms of the
|
||||
Sections above.
|
||||
|
||||
b) Give prominent notice with the combined library of the fact
|
||||
that part of it is a work based on the Library, and explaining
|
||||
where to find the accompanying uncombined form of the same work.
|
||||
|
||||
8. You may not copy, modify, sublicense, link with, or distribute
|
||||
the Library except as expressly provided under this License. Any
|
||||
attempt otherwise to copy, modify, sublicense, link with, or
|
||||
distribute the Library is void, and will automatically terminate your
|
||||
rights under this License. However, parties who have received copies,
|
||||
or rights, from you under this License will not have their licenses
|
||||
terminated so long as such parties remain in full compliance.
|
||||
|
||||
9. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Library or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Library (or any work based on the
|
||||
Library), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Library or works based on it.
|
||||
|
||||
10. Each time you redistribute the Library (or any work based on the
|
||||
Library), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute, link with or modify the Library
|
||||
subject to these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties with
|
||||
this License.
|
||||
|
||||
11. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Library at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Library by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Library.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under any
|
||||
particular circumstance, the balance of the section is intended to apply,
|
||||
and the section as a whole is intended to apply in other circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
12. If the distribution and/or use of the Library is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Library under this License may add
|
||||
an explicit geographical distribution limitation excluding those countries,
|
||||
so that distribution is permitted only in or among countries not thus
|
||||
excluded. In such case, this License incorporates the limitation as if
|
||||
written in the body of this License.
|
||||
|
||||
13. The Free Software Foundation may publish revised and/or new
|
||||
versions of the Lesser 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 Library
|
||||
specifies a version number of this License which applies to it and
|
||||
"any later version", you have the option of following the terms and
|
||||
conditions either of that version or of any later version published by
|
||||
the Free Software Foundation. If the Library does not specify a
|
||||
license version number, you may choose any version ever published by
|
||||
the Free Software Foundation.
|
||||
|
||||
14. If you wish to incorporate parts of the Library into other free
|
||||
programs whose distribution conditions are incompatible with these,
|
||||
write to the author to ask for permission. For software which is
|
||||
copyrighted by the Free Software Foundation, write to the Free
|
||||
Software Foundation; we sometimes make exceptions for this. Our
|
||||
decision will be guided by the two goals of preserving the free status
|
||||
of all derivatives of our free software and of promoting the sharing
|
||||
and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
|
||||
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
|
||||
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
|
||||
OTHER PARTIES PROVIDE THE LIBRARY "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
|
||||
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
|
||||
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
|
||||
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
|
||||
AND/OR REDISTRIBUTE THE LIBRARY 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
|
||||
LIBRARY (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 LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
|
||||
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
||||
DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Libraries
|
||||
|
||||
If you develop a new library, and you want it to be of the greatest
|
||||
possible use to the public, we recommend making it free software that
|
||||
everyone can redistribute and change. You can do so by permitting
|
||||
redistribution under these terms (or, alternatively, under the terms of the
|
||||
ordinary General Public License).
|
||||
|
||||
To apply these terms, attach the following notices to the library. It is
|
||||
safest to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least the
|
||||
"copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the library's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library 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
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the library, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the
|
||||
library `Frob' (a library for tweaking knobs) written by James Random Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1990
|
||||
Ty Coon, President of Vice
|
||||
|
||||
That's all there is to it!
|
||||
|
||||
|
||||
63
libprojectM/ChangeLog
Normal file
63
libprojectM/ChangeLog
Normal file
@ -0,0 +1,63 @@
|
||||
New for version 0.99
|
||||
------------------------------------------------------
|
||||
*config file now saved at ~/.projectM/config
|
||||
|
||||
*internal rendering coordinate spaces corrected. (basically, I made some stupid decisions a long time ago, and just fixed them now)
|
||||
|
||||
*xmms plugins close properly via window decorations
|
||||
|
||||
*mouse cursor hidden in xmms-projectM during fullscreen
|
||||
|
||||
*menus should resize relative to the screen size now
|
||||
|
||||
*Fixed numerous compilation bugs
|
||||
|
||||
*when the player changes to a new song, libprojectM will zoom in the title for a few seconds, then blend the title into the vis (ala milkdrop), if the player support sending the title to libprojectM (only xmms-projectM now)
|
||||
|
||||
|
||||
New for version 0.98
|
||||
------------------------------------------------------
|
||||
*projectM has been refactored into a shared library called libprojectM.
|
||||
-Now compiles as C++ (even though 99% of the code is C)
|
||||
|
||||
*libvisual-projectM now supports libvisual 0.4.0
|
||||
|
||||
*Preset library updated (~150 new, ~25 removed)
|
||||
|
||||
*Improved Rendering Engine
|
||||
-rewrote per pixel mathematics
|
||||
-fixed waveforms 0, 1, and 4
|
||||
-fixed Order of drawing (Vectors, Custom Shapes, Custom Waves, Waveform, Borders)
|
||||
-fixed custom shape rotation and texture parameter bugs
|
||||
-added support for the bDarkenCenter feature
|
||||
-added pbuffer support (however, you can't use it yet)
|
||||
-improved motion vectors when using pbuffers
|
||||
|
||||
*Improved .milk Parser
|
||||
-corrected behavior of frame, wave, and shape init_eqns
|
||||
-fixed bug with multiple equations on one line
|
||||
|
||||
*Menu/Help/Display System Improvements
|
||||
-Replaced GLF with FTGL (TrueType) fonts.
|
||||
-Added the solarize, brighten, darken, and invert filters to the post-processing menu
|
||||
-(F4) new Rendering stats display
|
||||
-(F5) Framerate display fixed
|
||||
|
||||
*New Framerate limiter
|
||||
|
||||
*n0dalus contributed some autotools patches.
|
||||
|
||||
*Chris Byrne of Monstavision contributed:
|
||||
-3 Memory Leak fixes!
|
||||
-Performance improvements during PCM input
|
||||
-Preset index code rewritten to allow presets to be added while projectM is running
|
||||
|
||||
*Hai Zaar helped us clean up the autotools stuff
|
||||
-Presets/fonts will be stored in $DATADIR/projectM/fonts and /presets
|
||||
-The config file will be stored in $SYSCONFDIR/projectM
|
||||
-By default DATADIR is $PREFIX/share and SYSCONFDIR is $PREFIX/etc
|
||||
so we reccomend you run configure like so:
|
||||
|
||||
./configure --sysconfdir=/etc
|
||||
|
||||
|
||||
9
libprojectM/INSTALL
Normal file
9
libprojectM/INSTALL
Normal file
@ -0,0 +1,9 @@
|
||||
If you just checked out of CVS run './autogen.sh' first.
|
||||
|
||||
If you downloaded a tarball then do this:
|
||||
|
||||
./configure
|
||||
make
|
||||
make install (as root)
|
||||
|
||||
projectM will install its presets, fonts, and default config in $DATADIR, which defaults to $PREFIX/share/projectM. So feel free to change these values with the --prefix, or --datadir arguments to ./configure.
|
||||
4
libprojectM/Makefile.am
Normal file
4
libprojectM/Makefile.am
Normal file
@ -0,0 +1,4 @@
|
||||
SUBDIRS = src
|
||||
|
||||
pkgconfigdir = $(libdir)/pkgconfig
|
||||
pkgconfig_DATA = libprojectM.pc
|
||||
0
libprojectM/NEWS
Normal file
0
libprojectM/NEWS
Normal file
0
libprojectM/README
Normal file
0
libprojectM/README
Normal file
5
libprojectM/autogen.sh
Executable file
5
libprojectM/autogen.sh
Executable file
@ -0,0 +1,5 @@
|
||||
#!/bin/sh
|
||||
aclocal -I m4
|
||||
libtoolize --force
|
||||
autoconf
|
||||
automake -a
|
||||
168
libprojectM/config.h.in
Normal file
168
libprojectM/config.h.in
Normal file
@ -0,0 +1,168 @@
|
||||
/* config.h.in. Generated from configure.ac by autoheader. */
|
||||
|
||||
/* Define to 1 if the `closedir' function returns void instead of `int'. */
|
||||
#undef CLOSEDIR_VOID
|
||||
|
||||
/* Use the Apple OpenGL framework. */
|
||||
#undef HAVE_APPLE_OPENGL_FRAMEWORK
|
||||
|
||||
/* Define to 1 if you have the <dirent.h> header file, and it defines `DIR'.
|
||||
*/
|
||||
#undef HAVE_DIRENT_H
|
||||
|
||||
/* Define to 1 if you have the <dlfcn.h> header file. */
|
||||
#undef HAVE_DLFCN_H
|
||||
|
||||
/* Define to 1 if you have the `floor' function. */
|
||||
#undef HAVE_FLOOR
|
||||
|
||||
/* Define to 1 if you have the `fork' function. */
|
||||
#undef HAVE_FORK
|
||||
|
||||
/* Define to 1 if you have the `gettimeofday' function. */
|
||||
#undef HAVE_GETTIMEOFDAY
|
||||
|
||||
/* Define to 1 if you have the <inttypes.h> header file. */
|
||||
#undef HAVE_INTTYPES_H
|
||||
|
||||
/* Define to 1 if your system has a GNU libc compatible `malloc' function, and
|
||||
to 0 otherwise. */
|
||||
#undef HAVE_MALLOC
|
||||
|
||||
/* Define to 1 if you have the <malloc.h> header file. */
|
||||
#undef HAVE_MALLOC_H
|
||||
|
||||
/* Define to 1 if you have the <memory.h> header file. */
|
||||
#undef HAVE_MEMORY_H
|
||||
|
||||
/* Define to 1 if you have the `memset' function. */
|
||||
#undef HAVE_MEMSET
|
||||
|
||||
/* Define to 1 if you have the <ndir.h> header file, and it defines `DIR'. */
|
||||
#undef HAVE_NDIR_H
|
||||
|
||||
/* Define to 1 if you have the `pow' function. */
|
||||
#undef HAVE_POW
|
||||
|
||||
/* Define if you have POSIX threads libraries and header files. */
|
||||
#undef HAVE_PTHREAD
|
||||
|
||||
/* Define to 1 if you have the `setenv' function. */
|
||||
#undef HAVE_SETENV
|
||||
|
||||
/* Define to 1 if you have the `sqrt' function. */
|
||||
#undef HAVE_SQRT
|
||||
|
||||
/* Define to 1 if you have the <stdint.h> header file. */
|
||||
#undef HAVE_STDINT_H
|
||||
|
||||
/* Define to 1 if you have the <stdlib.h> header file. */
|
||||
#undef HAVE_STDLIB_H
|
||||
|
||||
/* Define to 1 if you have the `strcasecmp' function. */
|
||||
#undef HAVE_STRCASECMP
|
||||
|
||||
/* Define to 1 if you have the `strchr' function. */
|
||||
#undef HAVE_STRCHR
|
||||
|
||||
/* Define to 1 if you have the <strings.h> header file. */
|
||||
#undef HAVE_STRINGS_H
|
||||
|
||||
/* Define to 1 if you have the <string.h> header file. */
|
||||
#undef HAVE_STRING_H
|
||||
|
||||
/* Define to 1 if you have the `strstr' function. */
|
||||
#undef HAVE_STRSTR
|
||||
|
||||
/* Define to 1 if you have the `strtol' function. */
|
||||
#undef HAVE_STRTOL
|
||||
|
||||
/* Define to 1 if you have the `strverscmp' function. */
|
||||
#undef HAVE_STRVERSCMP
|
||||
|
||||
/* Define to 1 if you have the <sys/dir.h> header file, and it defines `DIR'.
|
||||
*/
|
||||
#undef HAVE_SYS_DIR_H
|
||||
|
||||
/* Define to 1 if you have the <sys/ndir.h> header file, and it defines `DIR'.
|
||||
*/
|
||||
#undef HAVE_SYS_NDIR_H
|
||||
|
||||
/* Define to 1 if you have the <sys/stat.h> header file. */
|
||||
#undef HAVE_SYS_STAT_H
|
||||
|
||||
/* Define to 1 if you have the <sys/time.h> header file. */
|
||||
#undef HAVE_SYS_TIME_H
|
||||
|
||||
/* Define to 1 if you have the <sys/types.h> header file. */
|
||||
#undef HAVE_SYS_TYPES_H
|
||||
|
||||
/* Define to 1 if you have the <unistd.h> header file. */
|
||||
#undef HAVE_UNISTD_H
|
||||
|
||||
/* Define to 1 if you have the `vfork' function. */
|
||||
#undef HAVE_VFORK
|
||||
|
||||
/* Define to 1 if you have the <vfork.h> header file. */
|
||||
#undef HAVE_VFORK_H
|
||||
|
||||
/* Define to 1 if you have the <windows.h> header file. */
|
||||
#undef HAVE_WINDOWS_H
|
||||
|
||||
/* Define to 1 if `fork' works. */
|
||||
#undef HAVE_WORKING_FORK
|
||||
|
||||
/* Define to 1 if `vfork' works. */
|
||||
#undef HAVE_WORKING_VFORK
|
||||
|
||||
/* Name of package */
|
||||
#undef PACKAGE
|
||||
|
||||
/* Define to the address where bug reports for this package should be sent. */
|
||||
#undef PACKAGE_BUGREPORT
|
||||
|
||||
/* Define to the full name of this package. */
|
||||
#undef PACKAGE_NAME
|
||||
|
||||
/* Define to the full name and version of this package. */
|
||||
#undef PACKAGE_STRING
|
||||
|
||||
/* Define to the one symbol short name of this package. */
|
||||
#undef PACKAGE_TARNAME
|
||||
|
||||
/* Define to the version of this package. */
|
||||
#undef PACKAGE_VERSION
|
||||
|
||||
/* Define to necessary symbol if this constant uses a non-standard name on
|
||||
your system. */
|
||||
#undef PTHREAD_CREATE_JOINABLE
|
||||
|
||||
/* Define to 1 if you have the ANSI C header files. */
|
||||
#undef STDC_HEADERS
|
||||
|
||||
/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
|
||||
#undef TIME_WITH_SYS_TIME
|
||||
|
||||
/* Version number of package */
|
||||
#undef VERSION
|
||||
|
||||
/* Define to empty if `const' does not conform to ANSI C. */
|
||||
#undef const
|
||||
|
||||
/* Define to `__inline__' or `__inline' if that's what the C compiler
|
||||
calls it, or to nothing if 'inline' is not supported under any name. */
|
||||
#ifndef __cplusplus
|
||||
#undef inline
|
||||
#endif
|
||||
|
||||
/* Define to rpl_malloc if the replacement function should be used. */
|
||||
#undef malloc
|
||||
|
||||
/* Define to `int' if <sys/types.h> does not define. */
|
||||
#undef pid_t
|
||||
|
||||
/* Define to `unsigned' if <sys/types.h> does not define. */
|
||||
#undef size_t
|
||||
|
||||
/* Define as `fork' if `vfork' does not work. */
|
||||
#undef vfork
|
||||
51
libprojectM/configure.ac
Normal file
51
libprojectM/configure.ac
Normal file
@ -0,0 +1,51 @@
|
||||
# -*- Autoconf -*-
|
||||
# Process this file with autoconf to produce a configure script.
|
||||
|
||||
AC_PREREQ(2.57)
|
||||
AC_INIT(libprojectM, 0.98, psperl@sourceforge.net)
|
||||
AC_CONFIG_SRCDIR([src/projectM.cc])
|
||||
AC_CONFIG_HEADER([config.h])
|
||||
AC_PROG_LIBTOOL
|
||||
|
||||
AM_INIT_AUTOMAKE
|
||||
|
||||
# Checks for programs.
|
||||
AC_PROG_INSTALL
|
||||
|
||||
AC_PROG_CC
|
||||
AC_PROG_CXX
|
||||
|
||||
AX_CHECK_GL
|
||||
|
||||
# Checks for header files.
|
||||
AC_HEADER_DIRENT
|
||||
AC_HEADER_STDC
|
||||
AC_CHECK_HEADERS([malloc.h stdlib.h string.h sys/time.h unistd.h])
|
||||
|
||||
# Checks for typedefs, structures, and compiler characteristics.
|
||||
AC_C_CONST
|
||||
AC_C_INLINE
|
||||
AC_TYPE_SIZE_T
|
||||
AC_HEADER_TIME
|
||||
|
||||
# Checks for library functions.
|
||||
AC_FUNC_CLOSEDIR_VOID
|
||||
AC_FUNC_FORK
|
||||
AC_FUNC_MALLOC
|
||||
AC_FUNC_STRTOD
|
||||
AC_CHECK_FUNCS([floor gettimeofday memset pow setenv sqrt strcasecmp strchr strstr strtol strverscmp])
|
||||
|
||||
PKG_CHECK_MODULES(FTGL, ftgl >= 2.0.0, [libft="yes"], [libft="no"])
|
||||
if test x$libft = xno; then
|
||||
AC_MSG_ERROR([*** ftgl not found.
|
||||
libftgl is needed to build this package./])
|
||||
fi
|
||||
AC_SUBST(FTGL_LIBS)
|
||||
AC_SUBST(FTGL_CFLAGS)
|
||||
|
||||
|
||||
|
||||
AC_CONFIG_FILES([Makefile
|
||||
src/Makefile
|
||||
libprojectM.pc])
|
||||
AC_OUTPUT
|
||||
14
libprojectM/libprojectM.pc.in
Normal file
14
libprojectM/libprojectM.pc.in
Normal file
@ -0,0 +1,14 @@
|
||||
prefix=@prefix@
|
||||
exec_prefix=@exec_prefix@
|
||||
libdir=@libdir@
|
||||
includedir=@includedir@
|
||||
pkgdatadir=@datadir@/projectM
|
||||
sysconfdir=@sysconfdir@/projectM
|
||||
|
||||
Name: libprojectM
|
||||
Version: @VERSION@
|
||||
Description: projectM - OpenGL Milkdrop
|
||||
Requires:
|
||||
Libs: -L${libdir}
|
||||
Cflags: -I${includedir}
|
||||
|
||||
238
libprojectM/m4/acx_pthread.m4
Normal file
238
libprojectM/m4/acx_pthread.m4
Normal file
@ -0,0 +1,238 @@
|
||||
dnl @synopsis ACX_PTHREAD([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
|
||||
dnl
|
||||
dnl @summary figure out how to build C programs using POSIX threads
|
||||
dnl
|
||||
dnl This macro figures out how to build C programs using POSIX threads.
|
||||
dnl It sets the PTHREAD_LIBS output variable to the threads library and
|
||||
dnl linker flags, and the PTHREAD_CFLAGS output variable to any special
|
||||
dnl C compiler flags that are needed. (The user can also force certain
|
||||
dnl compiler flags/libs to be tested by setting these environment
|
||||
dnl variables.)
|
||||
dnl
|
||||
dnl Also sets PTHREAD_CC to any special C compiler that is needed for
|
||||
dnl multi-threaded programs (defaults to the value of CC otherwise).
|
||||
dnl (This is necessary on AIX to use the special cc_r compiler alias.)
|
||||
dnl
|
||||
dnl NOTE: You are assumed to not only compile your program with these
|
||||
dnl flags, but also link it with them as well. e.g. you should link
|
||||
dnl with $PTHREAD_CC $CFLAGS $PTHREAD_CFLAGS $LDFLAGS ... $PTHREAD_LIBS
|
||||
dnl $LIBS
|
||||
dnl
|
||||
dnl If you are only building threads programs, you may wish to use
|
||||
dnl these variables in your default LIBS, CFLAGS, and CC:
|
||||
dnl
|
||||
dnl LIBS="$PTHREAD_LIBS $LIBS"
|
||||
dnl CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
|
||||
dnl CC="$PTHREAD_CC"
|
||||
dnl
|
||||
dnl In addition, if the PTHREAD_CREATE_JOINABLE thread-attribute
|
||||
dnl constant has a nonstandard name, defines PTHREAD_CREATE_JOINABLE to
|
||||
dnl that name (e.g. PTHREAD_CREATE_UNDETACHED on AIX).
|
||||
dnl
|
||||
dnl ACTION-IF-FOUND is a list of shell commands to run if a threads
|
||||
dnl library is found, and ACTION-IF-NOT-FOUND is a list of commands to
|
||||
dnl run it if it is not found. If ACTION-IF-FOUND is not specified, the
|
||||
dnl default action will define HAVE_PTHREAD.
|
||||
dnl
|
||||
dnl Please let the authors know if this macro fails on any platform, or
|
||||
dnl if you have any other suggestions or comments. This macro was based
|
||||
dnl on work by SGJ on autoconf scripts for FFTW (www.fftw.org) (with
|
||||
dnl help from M. Frigo), as well as ac_pthread and hb_pthread macros
|
||||
dnl posted by Alejandro Forero Cuervo to the autoconf macro repository.
|
||||
dnl We are also grateful for the helpful feedback of numerous users.
|
||||
dnl
|
||||
dnl @category InstalledPackages
|
||||
dnl @author Steven G. Johnson <stevenj@alum.mit.edu>
|
||||
dnl @version 2005-06-15
|
||||
dnl @license GPLWithACException
|
||||
|
||||
AC_DEFUN([ACX_PTHREAD], [
|
||||
AC_REQUIRE([AC_CANONICAL_HOST])
|
||||
AC_LANG_SAVE
|
||||
AC_LANG_C
|
||||
acx_pthread_ok=no
|
||||
|
||||
# We used to check for pthread.h first, but this fails if pthread.h
|
||||
# requires special compiler flags (e.g. on True64 or Sequent).
|
||||
# It gets checked for in the link test anyway.
|
||||
|
||||
# First of all, check if the user has set any of the PTHREAD_LIBS,
|
||||
# etcetera environment variables, and if threads linking works using
|
||||
# them:
|
||||
if test x"$PTHREAD_LIBS$PTHREAD_CFLAGS" != x; then
|
||||
save_CFLAGS="$CFLAGS"
|
||||
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
|
||||
save_LIBS="$LIBS"
|
||||
LIBS="$PTHREAD_LIBS $LIBS"
|
||||
AC_MSG_CHECKING([for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS])
|
||||
AC_TRY_LINK_FUNC(pthread_join, acx_pthread_ok=yes)
|
||||
AC_MSG_RESULT($acx_pthread_ok)
|
||||
if test x"$acx_pthread_ok" = xno; then
|
||||
PTHREAD_LIBS=""
|
||||
PTHREAD_CFLAGS=""
|
||||
fi
|
||||
LIBS="$save_LIBS"
|
||||
CFLAGS="$save_CFLAGS"
|
||||
fi
|
||||
|
||||
# We must check for the threads library under a number of different
|
||||
# names; the ordering is very important because some systems
|
||||
# (e.g. DEC) have both -lpthread and -lpthreads, where one of the
|
||||
# libraries is broken (non-POSIX).
|
||||
|
||||
# Create a list of thread flags to try. Items starting with a "-" are
|
||||
# C compiler flags, and other items are library names, except for "none"
|
||||
# which indicates that we try without any flags at all, and "pthread-config"
|
||||
# which is a program returning the flags for the Pth emulation library.
|
||||
|
||||
acx_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config"
|
||||
|
||||
# The ordering *is* (sometimes) important. Some notes on the
|
||||
# individual items follow:
|
||||
|
||||
# pthreads: AIX (must check this before -lpthread)
|
||||
# none: in case threads are in libc; should be tried before -Kthread and
|
||||
# other compiler flags to prevent continual compiler warnings
|
||||
# -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h)
|
||||
# -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able)
|
||||
# lthread: LinuxThreads port on FreeBSD (also preferred to -pthread)
|
||||
# -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads)
|
||||
# -pthreads: Solaris/gcc
|
||||
# -mthreads: Mingw32/gcc, Lynx/gcc
|
||||
# -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it
|
||||
# doesn't hurt to check since this sometimes defines pthreads too;
|
||||
# also defines -D_REENTRANT)
|
||||
# ... -mt is also the pthreads flag for HP/aCC
|
||||
# pthread: Linux, etcetera
|
||||
# --thread-safe: KAI C++
|
||||
# pthread-config: use pthread-config program (for GNU Pth library)
|
||||
|
||||
case "${host_cpu}-${host_os}" in
|
||||
*solaris*)
|
||||
|
||||
# On Solaris (at least, for some versions), libc contains stubbed
|
||||
# (non-functional) versions of the pthreads routines, so link-based
|
||||
# tests will erroneously succeed. (We need to link with -pthreads/-mt/
|
||||
# -lpthread.) (The stubs are missing pthread_cleanup_push, or rather
|
||||
# a function called by this macro, so we could check for that, but
|
||||
# who knows whether they'll stub that too in a future libc.) So,
|
||||
# we'll just look for -pthreads and -lpthread first:
|
||||
|
||||
acx_pthread_flags="-pthreads pthread -mt -pthread $acx_pthread_flags"
|
||||
;;
|
||||
esac
|
||||
|
||||
if test x"$acx_pthread_ok" = xno; then
|
||||
for flag in $acx_pthread_flags; do
|
||||
|
||||
case $flag in
|
||||
none)
|
||||
AC_MSG_CHECKING([whether pthreads work without any flags])
|
||||
;;
|
||||
|
||||
-*)
|
||||
AC_MSG_CHECKING([whether pthreads work with $flag])
|
||||
PTHREAD_CFLAGS="$flag"
|
||||
;;
|
||||
|
||||
pthread-config)
|
||||
AC_CHECK_PROG(acx_pthread_config, pthread-config, yes, no)
|
||||
if test x"$acx_pthread_config" = xno; then continue; fi
|
||||
PTHREAD_CFLAGS="`pthread-config --cflags`"
|
||||
PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`"
|
||||
;;
|
||||
|
||||
*)
|
||||
AC_MSG_CHECKING([for the pthreads library -l$flag])
|
||||
PTHREAD_LIBS="-l$flag"
|
||||
;;
|
||||
esac
|
||||
|
||||
save_LIBS="$LIBS"
|
||||
save_CFLAGS="$CFLAGS"
|
||||
LIBS="$PTHREAD_LIBS $LIBS"
|
||||
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
|
||||
|
||||
# Check for various functions. We must include pthread.h,
|
||||
# since some functions may be macros. (On the Sequent, we
|
||||
# need a special flag -Kthread to make this header compile.)
|
||||
# We check for pthread_join because it is in -lpthread on IRIX
|
||||
# while pthread_create is in libc. We check for pthread_attr_init
|
||||
# due to DEC craziness with -lpthreads. We check for
|
||||
# pthread_cleanup_push because it is one of the few pthread
|
||||
# functions on Solaris that doesn't have a non-functional libc stub.
|
||||
# We try pthread_create on general principles.
|
||||
AC_TRY_LINK([#include <pthread.h>],
|
||||
[pthread_t th; pthread_join(th, 0);
|
||||
pthread_attr_init(0); pthread_cleanup_push(0, 0);
|
||||
pthread_create(0,0,0,0); pthread_cleanup_pop(0); ],
|
||||
[acx_pthread_ok=yes])
|
||||
|
||||
LIBS="$save_LIBS"
|
||||
CFLAGS="$save_CFLAGS"
|
||||
|
||||
AC_MSG_RESULT($acx_pthread_ok)
|
||||
if test "x$acx_pthread_ok" = xyes; then
|
||||
break;
|
||||
fi
|
||||
|
||||
PTHREAD_LIBS=""
|
||||
PTHREAD_CFLAGS=""
|
||||
done
|
||||
fi
|
||||
|
||||
# Various other checks:
|
||||
if test "x$acx_pthread_ok" = xyes; then
|
||||
save_LIBS="$LIBS"
|
||||
LIBS="$PTHREAD_LIBS $LIBS"
|
||||
save_CFLAGS="$CFLAGS"
|
||||
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
|
||||
|
||||
# Detect AIX lossage: JOINABLE attribute is called UNDETACHED.
|
||||
AC_MSG_CHECKING([for joinable pthread attribute])
|
||||
attr_name=unknown
|
||||
for attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do
|
||||
AC_TRY_LINK([#include <pthread.h>], [int attr=$attr; return attr;],
|
||||
[attr_name=$attr; break])
|
||||
done
|
||||
AC_MSG_RESULT($attr_name)
|
||||
if test "$attr_name" != PTHREAD_CREATE_JOINABLE; then
|
||||
AC_DEFINE_UNQUOTED(PTHREAD_CREATE_JOINABLE, $attr_name,
|
||||
[Define to necessary symbol if this constant
|
||||
uses a non-standard name on your system.])
|
||||
fi
|
||||
|
||||
AC_MSG_CHECKING([if more special flags are required for pthreads])
|
||||
flag=no
|
||||
case "${host_cpu}-${host_os}" in
|
||||
*-aix* | *-freebsd* | *-darwin*) flag="-D_THREAD_SAFE";;
|
||||
*solaris* | *-osf* | *-hpux*) flag="-D_REENTRANT";;
|
||||
esac
|
||||
AC_MSG_RESULT(${flag})
|
||||
if test "x$flag" != xno; then
|
||||
PTHREAD_CFLAGS="$flag $PTHREAD_CFLAGS"
|
||||
fi
|
||||
|
||||
LIBS="$save_LIBS"
|
||||
CFLAGS="$save_CFLAGS"
|
||||
|
||||
# More AIX lossage: must compile with cc_r
|
||||
AC_CHECK_PROG(PTHREAD_CC, cc_r, cc_r, ${CC})
|
||||
else
|
||||
PTHREAD_CC="$CC"
|
||||
fi
|
||||
|
||||
AC_SUBST(PTHREAD_LIBS)
|
||||
AC_SUBST(PTHREAD_CFLAGS)
|
||||
AC_SUBST(PTHREAD_CC)
|
||||
|
||||
# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
|
||||
if test x"$acx_pthread_ok" = xyes; then
|
||||
ifelse([$1],,AC_DEFINE(HAVE_PTHREAD,1,[Define if you have POSIX threads libraries and header files.]),[$1])
|
||||
:
|
||||
else
|
||||
acx_pthread_ok=no
|
||||
$2
|
||||
fi
|
||||
AC_LANG_RESTORE
|
||||
])dnl ACX_PTHREAD
|
||||
95
libprojectM/m4/ax_check_gl.m4
Normal file
95
libprojectM/m4/ax_check_gl.m4
Normal file
@ -0,0 +1,95 @@
|
||||
dnl @synopsis AX_CHECK_GL
|
||||
dnl
|
||||
dnl Check for an OpenGL implementation. If GL is found, the required
|
||||
dnl compiler and linker flags are included in the output variables
|
||||
dnl "GL_CFLAGS" and "GL_LIBS", respectively. This macro adds the
|
||||
dnl configure option "--with-apple-opengl-framework", which users can
|
||||
dnl use to indicate that Apple's OpenGL framework should be used on Mac
|
||||
dnl OS X. If Apple's OpenGL framework is used, the symbol
|
||||
dnl "HAVE_APPLE_OPENGL_FRAMEWORK" is defined. If no GL implementation
|
||||
dnl is found, "no_gl" is set to "yes".
|
||||
dnl
|
||||
dnl @category InstalledPackages
|
||||
dnl @author Braden McDaniel <braden@endoframe.com>
|
||||
dnl @version 2004-11-15
|
||||
dnl @license AllPermissive
|
||||
|
||||
AC_DEFUN([AX_CHECK_GL],
|
||||
[AC_REQUIRE([AC_PATH_X])dnl
|
||||
AC_REQUIRE([ACX_PTHREAD])dnl
|
||||
|
||||
#
|
||||
# There isn't a reliable way to know we should use the Apple OpenGL framework
|
||||
# without a configure option. A Mac OS X user may have installed an
|
||||
# alternative GL implementation (e.g., Mesa), which may or may not depend on X.
|
||||
#
|
||||
AC_ARG_WITH([apple-opengl-framework],
|
||||
[AC_HELP_STRING([--with-apple-opengl-framework],
|
||||
[use Apple OpenGL framework (Mac OS X only)])])
|
||||
if test "X$with_apple_opengl_framework" = "Xyes"; then
|
||||
AC_DEFINE([HAVE_APPLE_OPENGL_FRAMEWORK], [1],
|
||||
[Use the Apple OpenGL framework.])
|
||||
GL_LIBS="-framework OpenGL"
|
||||
else
|
||||
AC_LANG_PUSH(C)
|
||||
|
||||
AX_LANG_COMPILER_MS
|
||||
if test X$ax_compiler_ms = Xno; then
|
||||
GL_CFLAGS="${PTHREAD_CFLAGS}"
|
||||
GL_LIBS="${PTHREAD_LIBS} -lm"
|
||||
fi
|
||||
|
||||
#
|
||||
# Use x_includes and x_libraries if they have been set (presumably by
|
||||
# AC_PATH_X).
|
||||
#
|
||||
if test "X$no_x" != "Xyes"; then
|
||||
if test -n "$x_includes"; then
|
||||
GL_CFLAGS="-I${x_includes} ${GL_CFLAGS}"
|
||||
fi
|
||||
if test -n "$x_libraries"; then
|
||||
GL_LIBS="-L${x_libraries} -lX11 ${GL_LIBS}"
|
||||
fi
|
||||
fi
|
||||
|
||||
AC_CHECK_HEADERS([windows.h])
|
||||
|
||||
AC_CACHE_CHECK([for OpenGL library], [ax_cv_check_gl_libgl],
|
||||
[ax_cv_check_gl_libgl="no"
|
||||
ax_save_CPPFLAGS="${CPPFLAGS}"
|
||||
CPPFLAGS="${GL_CFLAGS} ${CPPFLAGS}"
|
||||
ax_save_LIBS="${LIBS}"
|
||||
LIBS=""
|
||||
ax_check_libs="-lopengl32 -lGL"
|
||||
for ax_lib in ${ax_check_libs}; do
|
||||
if test X$ax_compiler_ms = Xyes; then
|
||||
ax_try_lib=`echo $ax_lib | sed -e 's/^-l//' -e 's/$/.lib/'`
|
||||
else
|
||||
ax_try_lib="${ax_lib}"
|
||||
fi
|
||||
LIBS="${ax_try_lib} ${GL_LIBS} ${ax_save_LIBS}"
|
||||
AC_LINK_IFELSE(
|
||||
[AC_LANG_PROGRAM([[
|
||||
# if HAVE_WINDOWS_H && defined(_WIN32)
|
||||
# include <windows.h>
|
||||
# endif
|
||||
# include <GL/gl.h>]],
|
||||
[[glBegin(0)]])],
|
||||
[ax_cv_check_gl_libgl="${ax_try_lib}"; break])
|
||||
done
|
||||
LIBS=${ax_save_LIBS}
|
||||
CPPFLAGS=${ax_save_CPPFLAGS}])
|
||||
|
||||
if test "X${ax_cv_check_gl_libgl}" = "Xno"; then
|
||||
no_gl="yes"
|
||||
GL_CFLAGS=""
|
||||
GL_LIBS=""
|
||||
else
|
||||
GL_LIBS="${ax_cv_check_gl_libgl} ${GL_LIBS}"
|
||||
fi
|
||||
AC_LANG_POP(C)
|
||||
fi
|
||||
|
||||
AC_SUBST([GL_CFLAGS])
|
||||
AC_SUBST([GL_LIBS])
|
||||
])dnl
|
||||
23
libprojectM/m4/ax_lang_compiler_ms.m4
Normal file
23
libprojectM/m4/ax_lang_compiler_ms.m4
Normal file
@ -0,0 +1,23 @@
|
||||
dnl @synopsis AX_LANG_COMPILER_MS
|
||||
dnl
|
||||
dnl Check whether the compiler for the current language is Microsoft.
|
||||
dnl
|
||||
dnl This macro is modeled after _AC_LANG_COMPILER_GNU in the GNU
|
||||
dnl Autoconf implementation.
|
||||
dnl
|
||||
dnl @category InstalledPackages
|
||||
dnl @author Braden McDaniel <braden@endoframe.com>
|
||||
dnl @version 2004-11-15
|
||||
dnl @license AllPermissive
|
||||
|
||||
AC_DEFUN([AX_LANG_COMPILER_MS],
|
||||
[AC_CACHE_CHECK([whether we are using the Microsoft _AC_LANG compiler],
|
||||
[ax_cv_[]_AC_LANG_ABBREV[]_compiler_ms],
|
||||
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [[#ifndef _MSC_VER
|
||||
choke me
|
||||
#endif
|
||||
]])],
|
||||
[ax_compiler_ms=yes],
|
||||
[ax_compiler_ms=no])
|
||||
ax_cv_[]_AC_LANG_ABBREV[]_compiler_ms=$ax_compiler_ms
|
||||
])])
|
||||
48
libprojectM/src/Makefile.am
Normal file
48
libprojectM/src/Makefile.am
Normal file
@ -0,0 +1,48 @@
|
||||
lib_LTLIBRARIES = libprojectM.la
|
||||
|
||||
libprojectM_la_SOURCES=\
|
||||
PCM.cc \
|
||||
beat_detect.cc \
|
||||
browser.cc \
|
||||
builtin_funcs.cc \
|
||||
console_interface.cc \
|
||||
custom_shape.cc \
|
||||
custom_wave.cc \
|
||||
editor.cc \
|
||||
eval.cc \
|
||||
fftsg.cc \
|
||||
func.cc \
|
||||
glConsole.cc \
|
||||
init_cond.cc \
|
||||
menu.cc \
|
||||
param.cc \
|
||||
parser.cc \
|
||||
pbuffer.cc \
|
||||
per_frame_eqn.cc \
|
||||
per_pixel_eqn.cc \
|
||||
preset.cc \
|
||||
projectM.cc \
|
||||
splaytree.cc \
|
||||
timer.cc \
|
||||
tree_types.cc \
|
||||
wipemalloc.cc
|
||||
|
||||
libprojectMincludedir = $(includedir)/projectM
|
||||
libprojectMinclude_HEADERS = projectM.h pbuffer.h event.h console_interface.h PCM.h
|
||||
|
||||
libprojectM_la_LDFLAGS = -version-info 0:0:0
|
||||
|
||||
AM_LIBS = @GL_LIBS@ @FTGL_LIBS@
|
||||
AM_CXXFLAGS= -DLINUX -D__CPLUSPLUS @GL_CFLAGS@ @FTGL_CFLAGS@
|
||||
|
||||
libprojectM_la_LIBADD = $(AM_LIBS)
|
||||
|
||||
libprojectMconfigdir = $(datadir)/projectM
|
||||
libprojectMconfig_DATA = share/config share/config.fastcomputers share/config.slowcomputers
|
||||
|
||||
libprojectMfontdir = $(datadir)/projectM/fonts
|
||||
libprojectMfont_DATA = share/fonts/*.ttf
|
||||
|
||||
libprojectMpresetdir = $(datadir)/projectM/presets
|
||||
libprojectMpreset_DATA= share/presets/*.milk
|
||||
|
||||
304
libprojectM/src/PCM.cc
Executable file
304
libprojectM/src/PCM.cc
Executable file
@ -0,0 +1,304 @@
|
||||
/**
|
||||
* projectM -- Milkdrop-esque visualisation SDK
|
||||
* Copyright (C)2003-2004 projectM Team
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
* See 'LICENSE.txt' included within this release
|
||||
*
|
||||
*/
|
||||
/**
|
||||
* $Id: PCM.c,v 1.3 2006/03/13 20:35:26 psperl Exp $
|
||||
*
|
||||
* Takes sound data from wherever and hands it back out.
|
||||
* Returns PCM Data or spectrum data, or the derivative of the PCM data
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include "wipemalloc.h"
|
||||
#include "fftsg.h"
|
||||
|
||||
|
||||
|
||||
float **PCMd; //data structure to store PCM data PCM[channels][maxsamples]
|
||||
int maxsamples; //size of PCM buffer
|
||||
int start; //where to add data next
|
||||
|
||||
int *ip; //working space for FFT routines
|
||||
double *w; //lookup table for FFT routines
|
||||
int newsamples; //how many new samples
|
||||
|
||||
#ifdef DEBUG
|
||||
extern FILE *debugFile;
|
||||
#endif
|
||||
|
||||
//initPCM(int samples)
|
||||
//
|
||||
//Initializes the PCM buffer to
|
||||
// number of samples specified.
|
||||
|
||||
void initPCM(int samples)
|
||||
{
|
||||
int i;
|
||||
|
||||
#ifdef DEBUG
|
||||
if ( debugFile != NULL ) {
|
||||
fprintf( debugFile, "initPCM()\n" );
|
||||
fflush( debugFile );
|
||||
}
|
||||
#endif
|
||||
|
||||
//Allocate memory for PCM data buffer
|
||||
PCMd = (float **)wipemalloc(2 * sizeof(float *));
|
||||
PCMd[0] = (float *)wipemalloc(samples * sizeof(float));
|
||||
PCMd[1] = (float *)wipemalloc(samples * sizeof(float));
|
||||
|
||||
maxsamples=samples;
|
||||
newsamples=0;
|
||||
|
||||
//Initialize buffers to 0
|
||||
for (i=0;i<samples;i++)
|
||||
{
|
||||
PCMd[0][i]=0;
|
||||
PCMd[1][i]=0;
|
||||
}
|
||||
|
||||
start=0;
|
||||
|
||||
//Allocate FFT workspace
|
||||
w= (double *)wipemalloc(maxsamples*sizeof(double));
|
||||
ip= (int *)wipemalloc(maxsamples*sizeof(int));
|
||||
ip[0]=0;
|
||||
}
|
||||
|
||||
|
||||
extern "C" void addPCMfloat(float *PCMdata, int samples)
|
||||
{
|
||||
int i,j;
|
||||
|
||||
|
||||
for(i=0;i<samples;i++)
|
||||
{
|
||||
j=i+start;
|
||||
|
||||
|
||||
|
||||
if ( PCMdata[i] != 0 && PCMdata[i] != 0 ) {
|
||||
|
||||
PCMd[0][j%maxsamples]=(float)PCMdata[i];
|
||||
PCMd[1][j%maxsamples]=(float)PCMdata[i];
|
||||
|
||||
} else {
|
||||
PCMd[0][j % maxsamples] =(float) 0;
|
||||
PCMd[1][j % maxsamples] =(float) 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// printf("Added %d samples %d %d %f\n",samples,start,(start+samples)%maxsamples,PCM[0][start+10]);
|
||||
|
||||
start+=samples;
|
||||
start=start%maxsamples;
|
||||
|
||||
newsamples+=samples;
|
||||
if (newsamples>maxsamples) newsamples=maxsamples;
|
||||
}
|
||||
|
||||
extern "C" void addPCM16Data(const short* pcm_data, short samples) {
|
||||
int i, j;
|
||||
|
||||
for (i = 0; i < samples; ++i) {
|
||||
j=i+start;
|
||||
PCMd[0][j % maxsamples]=(pcm_data[i * 2 + 0]/16384.0);
|
||||
PCMd[1][j % maxsamples]=(pcm_data[i * 2 + 1]/16384.0);
|
||||
}
|
||||
|
||||
start = (start + samples) % maxsamples;
|
||||
|
||||
newsamples+=samples;
|
||||
if (newsamples>maxsamples) newsamples=maxsamples;
|
||||
}
|
||||
|
||||
|
||||
extern "C" void addPCM16(short PCMdata[2][512])
|
||||
{
|
||||
int i,j;
|
||||
int samples=512;
|
||||
|
||||
|
||||
for(i=0;i<samples;i++)
|
||||
{
|
||||
j=i+start;
|
||||
if ( PCMdata[0][i] != 0 && PCMdata[1][i] != 0 ) {
|
||||
PCMd[0][j%maxsamples]=(PCMdata[0][i]/16384.0);
|
||||
PCMd[1][j%maxsamples]=(PCMdata[1][i]/16384.0);
|
||||
} else {
|
||||
PCMd[0][j % maxsamples] = (float)0;
|
||||
PCMd[1][j % maxsamples] = (float)0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// printf("Added %d samples %d %d %f\n",samples,start,(start+samples)%maxsamples,PCM[0][start+10]);
|
||||
|
||||
start+=samples;
|
||||
start=start%maxsamples;
|
||||
|
||||
newsamples+=samples;
|
||||
if (newsamples>maxsamples) newsamples=maxsamples;
|
||||
}
|
||||
|
||||
|
||||
extern "C" void addPCM8( unsigned char PCMdata[2][512])
|
||||
{
|
||||
int i,j;
|
||||
int samples=512;
|
||||
|
||||
|
||||
for(i=0;i<samples;i++)
|
||||
{
|
||||
j=i+start;
|
||||
if ( PCMdata[0][i] != 0 && PCMdata[1][i] != 0 ) {
|
||||
PCMd[0][j%maxsamples]=( (float)( PCMdata[0][i] - 128.0 ) / 64 );
|
||||
PCMd[1][j%maxsamples]=( (float)( PCMdata[1][i] - 128.0 ) / 64 );
|
||||
} else {
|
||||
PCMd[0][j % maxsamples] = 0;
|
||||
PCMd[1][j % maxsamples] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// printf("Added %d samples %d %d %f\n",samples,start,(start+samples)%maxsamples,PCM[0][start+10]);
|
||||
|
||||
start+=samples;
|
||||
start=start%maxsamples;
|
||||
|
||||
newsamples+=samples;
|
||||
if (newsamples>maxsamples) newsamples=maxsamples;
|
||||
}
|
||||
|
||||
|
||||
//puts sound data requested at provided pointer
|
||||
//
|
||||
//samples is number of PCM samples to return
|
||||
//freq = 0 gives PCM data
|
||||
//freq = 1 gives FFT data
|
||||
//smoothing is the smoothing coefficient
|
||||
|
||||
//returned values are normalized from -1 to 1
|
||||
|
||||
void getPCM(float *PCMdata, int samples, int channel, int freq, float smoothing, int derive)
|
||||
{
|
||||
int i,index;
|
||||
|
||||
index=start-1;
|
||||
|
||||
if (index<0) index=maxsamples+index;
|
||||
|
||||
PCMdata[0]=PCMd[channel][index];
|
||||
|
||||
for(i=1;i<samples;i++)
|
||||
{
|
||||
index=start-1-i;
|
||||
if (index<0) index=maxsamples+index;
|
||||
|
||||
PCMdata[i]=(1-smoothing)*PCMd[channel][index]+smoothing*PCMdata[i-1];
|
||||
}
|
||||
|
||||
//return derivative of PCM data
|
||||
if(derive)
|
||||
{
|
||||
for(i=0;i<samples-1;i++)
|
||||
{
|
||||
PCMdata[i]=PCMdata[i]-PCMdata[i+1];
|
||||
}
|
||||
PCMdata[samples-1]=0;
|
||||
}
|
||||
|
||||
//return frequency data instead of PCM (perform FFT)
|
||||
|
||||
if (freq)
|
||||
|
||||
{
|
||||
double temppcm[1024];
|
||||
|
||||
for (int i=0;i<samples;i++)
|
||||
{temppcm[i]=(double)PCMdata[i];}
|
||||
rdft(samples, 1, temppcm, ip, w);
|
||||
for (int j=0;j<samples;j++)
|
||||
{PCMdata[j]=(float)temppcm[j];}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
//getPCMnew
|
||||
//
|
||||
//Like getPCM except it returns all new samples in the buffer
|
||||
//the actual return value is the number of samples, up to maxsamples.
|
||||
//the passed pointer, PCMData, must bee able to hold up to maxsamples
|
||||
|
||||
int getPCMnew(float *PCMdata, int channel, int freq, float smoothing, int derive, int reset)
|
||||
{
|
||||
int i,index;
|
||||
|
||||
index=start-1;
|
||||
|
||||
if (index<0) index=maxsamples+index;
|
||||
|
||||
PCMdata[0]=PCMd[channel][index];
|
||||
|
||||
for(i=1;i<newsamples;i++)
|
||||
{
|
||||
index=start-1-i;
|
||||
if (index<0) index=maxsamples+index;
|
||||
|
||||
PCMdata[i]=(1-smoothing)*PCMd[channel][index]+smoothing*PCMdata[i-1];
|
||||
}
|
||||
|
||||
//return derivative of PCM data
|
||||
if(derive)
|
||||
{
|
||||
for(i=0;i<newsamples-1;i++)
|
||||
{
|
||||
PCMdata[i]=PCMdata[i]-PCMdata[i+1];
|
||||
}
|
||||
PCMdata[newsamples-1]=0;
|
||||
}
|
||||
|
||||
//return frequency data instead of PCM (perform FFT)
|
||||
// if (freq) rdft(samples, 1, PCMdata, ip, w);
|
||||
i=newsamples;
|
||||
if (reset) newsamples=0;
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
//Free stuff
|
||||
void freePCM()
|
||||
{
|
||||
free(PCMd[0]);
|
||||
free(PCMd[1]);
|
||||
free(PCMd);
|
||||
free(ip);
|
||||
free(w);
|
||||
|
||||
PCMd = NULL;
|
||||
ip = NULL;
|
||||
w = NULL;
|
||||
}
|
||||
41
libprojectM/src/PCM.h
Executable file
41
libprojectM/src/PCM.h
Executable file
@ -0,0 +1,41 @@
|
||||
/**
|
||||
* projectM -- Milkdrop-esque visualisation SDK
|
||||
* Copyright (C)2003-2004 projectM Team
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
* See 'LICENSE.txt' included within this release
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _PCM_H
|
||||
#define _PCM_H
|
||||
|
||||
void initPCM(int maxsamples);
|
||||
#ifdef __CPlUSCPLUS
|
||||
extern "C" void addPCMfloat(float *PCMdata, int samples);
|
||||
extern "C" void addPCM16(short [2][512]);
|
||||
extern "C" void addPCM16Data(const short* pcm_data, short samples);
|
||||
extern "C" void addPCM8( unsigned char [2][512]);
|
||||
#else
|
||||
extern void addPCMfloat(float *PCMdata, int samples);
|
||||
extern void addPCM16(short [2][512]);
|
||||
extern void addPCM16Data(const short* pcm_data, short samples);
|
||||
extern void addPCM8( unsigned char [2][512]);
|
||||
#endif
|
||||
void getPCM(float *data, int samples, int channel, int freq, float smoothing, int derive);
|
||||
void freePCM();
|
||||
int getPCMnew(float *PCMdata, int channel, int freq, float smoothing, int derive,int reset);
|
||||
|
||||
#endif /** !_PCM_H */
|
||||
151
libprojectM/src/beat_detect.cc
Executable file
151
libprojectM/src/beat_detect.cc
Executable file
@ -0,0 +1,151 @@
|
||||
/**
|
||||
* projectM -- Milkdrop-esque visualisation SDK
|
||||
* Copyright (C)2003-2004 projectM Team
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
* See 'LICENSE.txt' included within this release
|
||||
*
|
||||
*/
|
||||
/**
|
||||
* Takes sound data from wherever and returns beat detection values
|
||||
* Uses statistical Energy-Based methods. Very simple
|
||||
*
|
||||
* Some stuff was taken from Frederic Patin's beat-detection article,
|
||||
* you'll find it online
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include "projectM.h"
|
||||
#include "beat_detect.h"
|
||||
#include "wipemalloc.h"
|
||||
|
||||
float beat_buffer[32][80],beat_instant[32],beat_history[32];
|
||||
float *beat_val,*beat_att,*beat_variance;
|
||||
int beat_buffer_pos;
|
||||
|
||||
float vol_buffer[80],vol_instant,vol_history;
|
||||
|
||||
void initBeatDetect()
|
||||
{
|
||||
|
||||
int x,y;
|
||||
|
||||
vol_instant=0;
|
||||
vol_history=0;
|
||||
|
||||
for (y=0;y<80;y++)
|
||||
{
|
||||
vol_buffer[y]=0;
|
||||
}
|
||||
|
||||
beat_buffer_pos=0;
|
||||
|
||||
beat_val=(float *)wipemalloc(32*sizeof(float));
|
||||
beat_att=(float *)wipemalloc(32*sizeof(float));
|
||||
beat_variance=(float *)wipemalloc(32*sizeof(float));
|
||||
|
||||
for (x=0;x<32;x++)
|
||||
{
|
||||
beat_instant[x]=0;
|
||||
beat_history[x]=0;
|
||||
beat_val[x]=1.0;
|
||||
beat_att[x]=1.0;
|
||||
beat_variance[x]=0;
|
||||
for (y=0;y<80;y++)
|
||||
{
|
||||
beat_buffer[x][y]=0;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void getBeatVals(projectM_t *pm, float *vdataL,float *vdataR)
|
||||
{
|
||||
int linear=0;
|
||||
int x,y;
|
||||
float temp2=0;
|
||||
|
||||
vol_instant=0;
|
||||
|
||||
for ( x=0;x<16;x++)
|
||||
{
|
||||
|
||||
beat_instant[x]=0;
|
||||
for ( y=linear*2;y<(linear+8+x)*2;y++)
|
||||
{
|
||||
beat_instant[x]+=((vdataL[y]*vdataL[y])+(vdataR[y]*vdataR[y]))*(1.0/(8+x));
|
||||
// printf( "beat_instant[%d]: %f %f %f\n", x, beat_instant[x], vdataL[y], vdataR[y] );
|
||||
vol_instant+=((vdataL[y]*vdataL[y])+(vdataR[y]*vdataR[y]))*(1.0/512.0);
|
||||
|
||||
}
|
||||
|
||||
linear=y/2;
|
||||
beat_history[x]-=(beat_buffer[x][beat_buffer_pos])*.0125;
|
||||
beat_buffer[x][beat_buffer_pos]=beat_instant[x];
|
||||
beat_history[x]+=(beat_instant[x])*.0125;
|
||||
|
||||
beat_val[x]=(beat_instant[x])/(beat_history[x]);
|
||||
|
||||
beat_att[x]+=(beat_instant[x])/(beat_history[x]);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
vol_history-=(vol_buffer[beat_buffer_pos])*.0125;
|
||||
vol_buffer[beat_buffer_pos]=vol_instant;
|
||||
vol_history+=(vol_instant)*.0125;
|
||||
|
||||
pm->mid=0;
|
||||
for(x=1;x<10;x++)
|
||||
{
|
||||
pm->mid+=(beat_instant[x]);
|
||||
temp2+=(beat_history[x]);
|
||||
|
||||
}
|
||||
|
||||
pm->mid=pm->mid/(1.5*temp2);
|
||||
temp2=0;
|
||||
pm->treb=0;
|
||||
for(x=10;x<16;x++)
|
||||
{
|
||||
pm->treb+=(beat_instant[x]);
|
||||
temp2+=(beat_history[x]);
|
||||
}
|
||||
pm->treb=pm->treb/(1.5*temp2);
|
||||
// *vol=vol_instant/(1.5*vol_history);
|
||||
pm->vol=vol_instant/(1.5*vol_history);
|
||||
|
||||
pm->bass=(beat_instant[0])/(1.5*beat_history[0]);
|
||||
|
||||
pm->treb_att=.6 * pm->treb_att + .4 * pm->treb;
|
||||
pm->mid_att=.6 * pm->mid_att + .4 * pm->mid;
|
||||
pm->bass_att=.6 * pm->bass_att + .4 * pm->bass;
|
||||
// *vol=(beat_instant[3])/(beat_history[3]);
|
||||
beat_buffer_pos++;
|
||||
if( beat_buffer_pos>79)beat_buffer_pos=0;
|
||||
|
||||
}
|
||||
void freeBeatDetect()
|
||||
{
|
||||
free(beat_att);
|
||||
free(beat_val);
|
||||
free(beat_variance);
|
||||
|
||||
beat_att = NULL;
|
||||
beat_val = NULL;
|
||||
beat_variance = NULL;
|
||||
}
|
||||
30
libprojectM/src/beat_detect.h
Executable file
30
libprojectM/src/beat_detect.h
Executable file
@ -0,0 +1,30 @@
|
||||
/**
|
||||
* projectM -- Milkdrop-esque visualisation SDK
|
||||
* Copyright (C)2003-2004 projectM Team
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
* See 'LICENSE.txt' included within this release
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _BEAT_DETECT_H
|
||||
#define _BEAT_DETECT_H
|
||||
|
||||
#include "projectM.h"
|
||||
void initBeatDetect();
|
||||
void getBeatVals( projectM_t *pm, float *vdataL, float *vdataR);
|
||||
void freeBeatDetect();
|
||||
|
||||
#endif /** !_BEAT_DETECT_H */
|
||||
150
libprojectM/src/browser.cc
Executable file
150
libprojectM/src/browser.cc
Executable file
@ -0,0 +1,150 @@
|
||||
/**
|
||||
* projectM -- Milkdrop-esque visualisation SDK
|
||||
* Copyright (C)2003-2004 projectM Team
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
* See 'LICENSE.txt' included within this release
|
||||
*
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include "common.h"
|
||||
#include "fatal.h"
|
||||
|
||||
#include "preset_types.h"
|
||||
#include "preset.h"
|
||||
|
||||
#include "glConsole.h"
|
||||
|
||||
#include "interface_types.h"
|
||||
|
||||
#include "event.h"
|
||||
|
||||
extern interface_t current_interface;
|
||||
|
||||
gl_console_t * browser_console = NULL;
|
||||
int active_font2 = 0;
|
||||
char input_buffer[MAX_PATH_SIZE];
|
||||
int buf_pos = 0;
|
||||
|
||||
int loadBrowser() {
|
||||
|
||||
|
||||
|
||||
if ((browser_console = glConsoleCreate(40, 10, 80, 20, 1, 1, active_font2)) < 0)
|
||||
return PROJECTM_FAILURE;
|
||||
|
||||
glConsoleSetFGColor(CONSOLE_RED, browser_console);
|
||||
glConsoleSetBGColor(CONSOLE_BLACK, browser_console);
|
||||
glConsoleSetFlags(CONSOLE_FLAG_CURSOR_BLINKING | CONSOLE_FLAG_ALWAYS_DRAW_BACKGROUND, browser_console);
|
||||
glConsoleClearBuffer(browser_console);
|
||||
|
||||
buf_pos = 0;
|
||||
memset(input_buffer, 0, MAX_PATH_SIZE);
|
||||
|
||||
return PROJECTM_SUCCESS;
|
||||
}
|
||||
|
||||
int closeBrowser() {
|
||||
|
||||
|
||||
active_font2 = 0;
|
||||
|
||||
glConsoleDestroy(browser_console);
|
||||
browser_console = NULL;
|
||||
|
||||
return PROJECTM_SUCCESS;
|
||||
}
|
||||
|
||||
void browser_key_handler( projectMEvent event, projectMKeycode keycode, projectMModifier modifier ) {
|
||||
|
||||
char s[2];
|
||||
|
||||
s[0] = 0;
|
||||
s[1] = 0;
|
||||
|
||||
|
||||
switch( event ) {
|
||||
case PROJECTM_KEYDOWN:
|
||||
switch(keycode) {
|
||||
case PROJECTM_K_UP:
|
||||
glConsoleMoveCursorUp(browser_console);
|
||||
break;
|
||||
case PROJECTM_K_RETURN:
|
||||
loadPresetByFile(input_buffer);
|
||||
closeBrowser();
|
||||
current_interface = DEFAULT_INTERFACE;
|
||||
break;
|
||||
case PROJECTM_K_RIGHT:
|
||||
glConsoleMoveCursorForward(browser_console);
|
||||
break;
|
||||
case PROJECTM_K_LEFT:
|
||||
printf("CURSOR BACKWARD\n");
|
||||
glConsoleMoveCursorBackward(browser_console);
|
||||
break;
|
||||
case PROJECTM_K_DOWN:
|
||||
glConsoleMoveCursorDown(browser_console);
|
||||
break;
|
||||
case PROJECTM_K_PAGEUP:
|
||||
glConsoleAlignCursorUp(browser_console);
|
||||
break;
|
||||
case PROJECTM_K_PAGEDOWN:
|
||||
glConsoleAlignCursorDown(browser_console);
|
||||
break;
|
||||
case PROJECTM_K_INSERT:
|
||||
glConsoleAlignCursorLeft(browser_console);
|
||||
break;
|
||||
case PROJECTM_K_DELETE:
|
||||
glConsoleAlignCursorRight(browser_console);
|
||||
break;
|
||||
case PROJECTM_K_LSHIFT:
|
||||
break;
|
||||
case PROJECTM_K_RSHIFT:
|
||||
break;
|
||||
case PROJECTM_K_CAPSLOCK:
|
||||
break;
|
||||
case PROJECTM_K_ESCAPE:
|
||||
closeBrowser();
|
||||
current_interface = DEFAULT_INTERFACE;
|
||||
break;
|
||||
|
||||
default: /* All regular characters */
|
||||
if (buf_pos == MAX_PATH_SIZE) {
|
||||
buf_pos = 0;
|
||||
}
|
||||
input_buffer[buf_pos] = (char)keycode;
|
||||
if ((modifier == PROJECTM_KMOD_LSHIFT) || (modifier == PROJECTM_KMOD_RSHIFT) || (modifier == PROJECTM_KMOD_CAPS))
|
||||
input_buffer[buf_pos] -= 32;
|
||||
|
||||
*s = input_buffer[buf_pos];
|
||||
glConsolePrintString(s, browser_console);
|
||||
buf_pos++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
void refreshBrowser() {
|
||||
|
||||
// glConsoleClearBuffer(browser_console);
|
||||
// glConsoleSetCursorPos(1, 1, browser_console);
|
||||
//glConsolePrintString("Enter a file to load:\n", browser_console);
|
||||
//glConsolePrintString(input_buffer, browser_console);
|
||||
glConsoleDraw(browser_console);
|
||||
}
|
||||
|
||||
38
libprojectM/src/browser.h
Executable file
38
libprojectM/src/browser.h
Executable file
@ -0,0 +1,38 @@
|
||||
/**
|
||||
* projectM -- Milkdrop-esque visualisation SDK
|
||||
* Copyright (C)2003-2004 projectM Team
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
* See 'LICENSE.txt' included within this release
|
||||
*
|
||||
*/
|
||||
/**
|
||||
* $Id: browser.h,v 1.1.1.1 2005/12/23 18:05:03 psperl Exp $
|
||||
*
|
||||
* Browser interface
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _BROWSER_H
|
||||
#define _BROWSER_H
|
||||
|
||||
#include "event.h"
|
||||
|
||||
void browser_key_handler( projectMEvent event, projectMKeycode keycode, projectMModifier modifier );
|
||||
int loadBrowser();
|
||||
int closeBrowser();
|
||||
void refreshBrowser();
|
||||
|
||||
#endif /** !_BROWSER_H */
|
||||
205
libprojectM/src/builtin_funcs.cc
Executable file
205
libprojectM/src/builtin_funcs.cc
Executable file
@ -0,0 +1,205 @@
|
||||
/**
|
||||
* projectM -- Milkdrop-esque visualisation SDK
|
||||
* Copyright (C)2003-2004 projectM Team
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
* See 'LICENSE.txt' included within this release
|
||||
*
|
||||
*/
|
||||
|
||||
#include <math.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include "projectM.h"
|
||||
|
||||
/* Values to optimize the sigmoid function */
|
||||
#define R 32767
|
||||
#define RR 65534
|
||||
|
||||
float int_wrapper(float * arg_list) {
|
||||
|
||||
return floor(arg_list[0]);
|
||||
|
||||
}
|
||||
|
||||
|
||||
float sqr_wrapper(float * arg_list) {
|
||||
|
||||
return pow(2, arg_list[0]);
|
||||
}
|
||||
|
||||
|
||||
float sign_wrapper(float * arg_list) {
|
||||
|
||||
return -arg_list[0];
|
||||
}
|
||||
|
||||
float min_wrapper(float * arg_list) {
|
||||
|
||||
if (arg_list[0] > arg_list[1])
|
||||
return arg_list[1];
|
||||
|
||||
return arg_list[0];
|
||||
}
|
||||
|
||||
float max_wrapper(float * arg_list) {
|
||||
|
||||
if (arg_list[0] > arg_list[1])
|
||||
return arg_list[0];
|
||||
|
||||
return arg_list[1];
|
||||
}
|
||||
|
||||
/* consult your AI book */
|
||||
float sigmoid_wrapper(float * arg_list) {
|
||||
return (RR / (1 + exp( -(((float)(arg_list[0])) * arg_list[1]) / R) - R));
|
||||
}
|
||||
|
||||
|
||||
float bor_wrapper(float * arg_list) {
|
||||
|
||||
return (float)((int)arg_list[0] || (int)arg_list[1]);
|
||||
}
|
||||
|
||||
float band_wrapper(float * arg_list) {
|
||||
return (float)((int)arg_list[0] && (int)arg_list[1]);
|
||||
}
|
||||
|
||||
float bnot_wrapper(float * arg_list) {
|
||||
return (float)(!(int)arg_list[0]);
|
||||
}
|
||||
|
||||
float if_wrapper(float * arg_list) {
|
||||
|
||||
if ((int)arg_list[0] == 0)
|
||||
return arg_list[2];
|
||||
return arg_list[1];
|
||||
}
|
||||
|
||||
|
||||
float rand_wrapper(float * arg_list) {
|
||||
float l=1;
|
||||
|
||||
// printf("RAND ARG:(%d)\n", (int)arg_list[0]);
|
||||
if ((int)arg_list[0] > 0)
|
||||
l = (float)((rand()) % ((int)arg_list[0]));
|
||||
//printf("VAL: %f\n", l);
|
||||
return l;
|
||||
}
|
||||
|
||||
float equal_wrapper(float * arg_list) {
|
||||
|
||||
return (arg_list[0] == arg_list[1]);
|
||||
}
|
||||
|
||||
|
||||
float above_wrapper(float * arg_list) {
|
||||
|
||||
return (arg_list[0] > arg_list[1]);
|
||||
}
|
||||
|
||||
|
||||
float below_wrapper(float * arg_list) {
|
||||
|
||||
return (arg_list[0] < arg_list[1]);
|
||||
}
|
||||
|
||||
float sin_wrapper(float * arg_list) {
|
||||
return (sin (arg_list[0]));
|
||||
}
|
||||
|
||||
|
||||
float cos_wrapper(float * arg_list) {
|
||||
return (cos (arg_list[0]));
|
||||
}
|
||||
|
||||
float tan_wrapper(float * arg_list) {
|
||||
return (tan(arg_list[0]));
|
||||
}
|
||||
|
||||
float asin_wrapper(float * arg_list) {
|
||||
return (asin (arg_list[0]));
|
||||
}
|
||||
|
||||
float acos_wrapper(float * arg_list) {
|
||||
return (acos (arg_list[0]));
|
||||
}
|
||||
|
||||
float atan_wrapper(float * arg_list) {
|
||||
return (atan (arg_list[0]));
|
||||
}
|
||||
|
||||
float atan2_wrapper(float * arg_list) {
|
||||
return (atan2 (arg_list[0], arg_list[1]));
|
||||
}
|
||||
|
||||
float pow_wrapper(float * arg_list) {
|
||||
return (pow (arg_list[0], arg_list[1]));
|
||||
}
|
||||
|
||||
float exp_wrapper(float * arg_list) {
|
||||
return (exp(arg_list[0]));
|
||||
}
|
||||
|
||||
float abs_wrapper(float * arg_list) {
|
||||
return (fabs(arg_list[0]));
|
||||
}
|
||||
|
||||
float log_wrapper(float* arg_list) {
|
||||
return (log (arg_list[0]));
|
||||
}
|
||||
|
||||
float log10_wrapper(float * arg_list) {
|
||||
return (log10 (arg_list[0]));
|
||||
}
|
||||
|
||||
float sqrt_wrapper(float * arg_list) {
|
||||
return (sqrt (arg_list[0]));
|
||||
}
|
||||
|
||||
|
||||
float nchoosek_wrapper(float * arg_list) {
|
||||
unsigned long cnm = 1UL;
|
||||
int i, f;
|
||||
int n, m;
|
||||
|
||||
n = (int)arg_list[0];
|
||||
m = (int)arg_list[1];
|
||||
|
||||
if (m*2 >n) m = n-m;
|
||||
for (i=1 ; i <= m; n--, i++)
|
||||
{
|
||||
if ((f=n) % i == 0)
|
||||
f /= i;
|
||||
else cnm /= i;
|
||||
cnm *= f;
|
||||
}
|
||||
return (float)cnm;
|
||||
}
|
||||
|
||||
|
||||
float fact_wrapper(float * arg_list) {
|
||||
|
||||
|
||||
int result = 1;
|
||||
|
||||
int n = (int)arg_list[0];
|
||||
|
||||
while (n > 1) {
|
||||
result = result * n;
|
||||
n--;
|
||||
}
|
||||
return (float)result;
|
||||
}
|
||||
60
libprojectM/src/builtin_funcs.h
Executable file
60
libprojectM/src/builtin_funcs.h
Executable file
@ -0,0 +1,60 @@
|
||||
/**
|
||||
* projectM -- Milkdrop-esque visualisation SDK
|
||||
* Copyright (C)2003-2004 projectM Team
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
* See 'LICENSE.txt' included within this release
|
||||
*
|
||||
*/
|
||||
/* Wrappers for all the builtin functions
|
||||
The arg_list pointer is a list of floats. Its
|
||||
size is equal to the number of arguments the parameter
|
||||
takes */
|
||||
|
||||
#ifndef _BUILTIN_FUNCS_H
|
||||
#define _BUILTIN_FUNCS_H
|
||||
|
||||
inline float below_wrapper(float * arg_list);
|
||||
inline float above_wrapper(float * arg_list);
|
||||
inline float equal_wrapper(float * arg_list);
|
||||
inline float if_wrapper(float * arg_list);
|
||||
inline float bnot_wrapper(float * arg_list);
|
||||
inline float rand_wrapper(float * arg_list);
|
||||
inline float bor_wrapper(float * arg_list);
|
||||
inline float band_wrapper(float * arg_list);
|
||||
inline float sigmoid_wrapper(float * arg_list);
|
||||
inline float max_wrapper(float * arg_list);
|
||||
inline float min_wrapper(float * arg_list);
|
||||
inline float sign_wrapper(float * arg_list);
|
||||
inline float sqr_wrapper(float * arg_list);
|
||||
inline float int_wrapper(float * arg_list);
|
||||
inline float nchoosek_wrapper(float * arg_list);
|
||||
inline float sin_wrapper(float * arg_list);
|
||||
inline float cos_wrapper(float * arg_list);
|
||||
inline float tan_wrapper(float * arg_list);
|
||||
inline float fact_wrapper(float * arg_list);
|
||||
inline float asin_wrapper(float * arg_list);
|
||||
inline float acos_wrapper(float * arg_list);
|
||||
inline float atan_wrapper(float * arg_list);
|
||||
inline float atan2_wrapper(float * arg_list);
|
||||
|
||||
inline float pow_wrapper(float * arg_list);
|
||||
inline float exp_wrapper(float * arg_list);
|
||||
inline float abs_wrapper(float * arg_list);
|
||||
inline float log_wrapper(float *arg_list);
|
||||
inline float log10_wrapper(float * arg_list);
|
||||
inline float sqrt_wrapper(float * arg_list);
|
||||
|
||||
#endif /** !_BUILTIN_FUNCS_H */
|
||||
73
libprojectM/src/common.h
Executable file
73
libprojectM/src/common.h
Executable file
@ -0,0 +1,73 @@
|
||||
/**
|
||||
* projectM -- Milkdrop-esque visualisation SDK
|
||||
* Copyright (C)2003-2004 projectM Team
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
* See 'LICENSE.txt' included within this release
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef COMMON_H
|
||||
#define COMMON_H
|
||||
|
||||
#ifdef _MSC_VER
|
||||
# define strcasecmp(s, t) _strcmpi(s, t)
|
||||
#endif
|
||||
|
||||
#ifdef MACOS
|
||||
#include <stdio.h>
|
||||
extern FILE *fmemopen(void *buf, size_t len, const char *pMode);
|
||||
#endif /** MACOS */
|
||||
|
||||
#define DEFAULT_FONT_PATH "/home/carm/fonts/courier1.glf"
|
||||
#define MAX_TOKEN_SIZE 512
|
||||
#define MAX_PATH_SIZE 4096
|
||||
|
||||
#define STRING_BUFFER_SIZE 1024*150
|
||||
#define STRING_LINE_SIZE 1024
|
||||
|
||||
#ifndef TRUE
|
||||
#define TRUE 1
|
||||
#endif
|
||||
#ifndef FALSE
|
||||
#define FALSE 0
|
||||
#endif
|
||||
|
||||
#define PROJECTM_FILE_EXTENSION ".prjm"
|
||||
#define MILKDROP_FILE_EXTENSION ".milk"
|
||||
|
||||
#define MAX_DOUBLE_SIZE 10000000.0
|
||||
#define MIN_DOUBLE_SIZE -10000000.0
|
||||
|
||||
#define MAX_INT_SIZE 10000000
|
||||
#define MIN_INT_SIZE -10000000
|
||||
|
||||
#define DEFAULT_DOUBLE_IV 0.0 /* default float initial value */
|
||||
#define DEFAULT_DOUBLE_LB MIN_DOUBLE_SIZE /* default float lower bound */
|
||||
#define DEFAULT_DOUBLE_UB MAX_DOUBLE_SIZE /* default float upper bound */
|
||||
|
||||
#ifdef DEBUG
|
||||
#define DWRITE(msg) \
|
||||
if ( debugFile != NULL ) {\
|
||||
fprintf( debugFile, "%s", msg );\
|
||||
fflush( debugFile );\
|
||||
} else {\
|
||||
printf( "%s", msg );\
|
||||
}
|
||||
#else
|
||||
#define DWRITE(msg)
|
||||
#endif /** DWRITE */
|
||||
|
||||
#endif
|
||||
28
libprojectM/src/compare.h
Executable file
28
libprojectM/src/compare.h
Executable file
@ -0,0 +1,28 @@
|
||||
/**
|
||||
* projectM -- Milkdrop-esque visualisation SDK
|
||||
* Copyright (C)2003-2004 projectM Team
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
* See 'LICENSE.txt' included within this release
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _COMPARE_H
|
||||
#define _COMPARE_H
|
||||
|
||||
int compare_int(int * num1, int * num2);
|
||||
int compare_string(char * string1, char * string2);
|
||||
|
||||
#endif /** !_COMPARE_H */
|
||||
223
libprojectM/src/console_interface.cc
Executable file
223
libprojectM/src/console_interface.cc
Executable file
@ -0,0 +1,223 @@
|
||||
/**
|
||||
* projectM -- Milkdrop-esque visualisation SDK
|
||||
* Copyright (C)2003-2004 projectM Team
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
* See 'LICENSE.txt' included within this release
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "projectM.h"
|
||||
#include "common.h"
|
||||
#include "fatal.h"
|
||||
#include "menu.h"
|
||||
#include "interface_types.h"
|
||||
#include "console_interface.h"
|
||||
#include "preset_types.h"
|
||||
#include "preset.h"
|
||||
#include "browser.h"
|
||||
#include "editor.h"
|
||||
#include "event.h"
|
||||
|
||||
extern preset_t *active_preset;
|
||||
|
||||
interface_t current_interface = DEFAULT_INTERFACE;
|
||||
|
||||
void refreshConsole(void *) {
|
||||
|
||||
switch (current_interface) {
|
||||
|
||||
case MENU_INTERFACE:
|
||||
refreshMenu();
|
||||
break;
|
||||
case SHELL_INTERFACE:
|
||||
break;
|
||||
case EDITOR_INTERFACE:
|
||||
refreshEditor();
|
||||
break;
|
||||
case DEFAULT_INTERFACE:
|
||||
break;
|
||||
case BROWSER_INTERFACE:
|
||||
refreshBrowser();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
extern "C" void key_handler( projectM_t *PM, projectMEvent event, projectMKeycode keycode, projectMModifier modifier ) {
|
||||
|
||||
switch( event ) {
|
||||
|
||||
|
||||
case PROJECTM_KEYDOWN:
|
||||
|
||||
//default_key_handler();
|
||||
switch (current_interface)
|
||||
{
|
||||
|
||||
case MENU_INTERFACE:
|
||||
menu_key_handler(PM, event, keycode);
|
||||
break;
|
||||
case SHELL_INTERFACE:
|
||||
//shell_key_handler();
|
||||
break;
|
||||
case EDITOR_INTERFACE:
|
||||
editor_key_handler(event,keycode);
|
||||
break;
|
||||
case BROWSER_INTERFACE:
|
||||
browser_key_handler(event,keycode,modifier);
|
||||
break;
|
||||
case DEFAULT_INTERFACE:
|
||||
default_key_handler(PM,event,keycode);
|
||||
break;
|
||||
default:
|
||||
default_key_handler(PM,event,keycode);
|
||||
break;
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void default_key_handler(projectM_t *PM, projectMEvent event, projectMKeycode keycode) {
|
||||
|
||||
|
||||
|
||||
switch( event ) {
|
||||
|
||||
case PROJECTM_KEYDOWN:
|
||||
|
||||
switch( keycode )
|
||||
{
|
||||
case PROJECTM_K_UP:
|
||||
PM->beat_sensitivity += 0.25;
|
||||
if (PM->beat_sensitivity > 5.0) PM->beat_sensitivity = 5.0;
|
||||
break;
|
||||
case PROJECTM_K_DOWN:
|
||||
PM->beat_sensitivity -= 0.25;
|
||||
if (PM->beat_sensitivity < 0) PM->beat_sensitivity = 0;
|
||||
break;
|
||||
case PROJECTM_K_F1:
|
||||
PM->showhelp++;
|
||||
PM->showstats=0;
|
||||
PM->showfps=0;
|
||||
break;
|
||||
case PROJECTM_K_F5:
|
||||
if(PM->showhelp%2==0) PM->showfps++;
|
||||
break;
|
||||
case PROJECTM_K_F4:
|
||||
if(PM->showhelp%2==0) PM->showstats++;
|
||||
break;
|
||||
case PROJECTM_K_F3: {
|
||||
PM->showpreset++;
|
||||
printf( "F3 pressed: %d\n", PM->showpreset );
|
||||
break;
|
||||
}
|
||||
case PROJECTM_K_F2:
|
||||
PM->showtitle++;
|
||||
break;
|
||||
#ifndef MACOS
|
||||
case PROJECTM_K_F9:
|
||||
#else
|
||||
case PROJECTM_K_F8:
|
||||
#endif
|
||||
PM->studio++;
|
||||
break;
|
||||
|
||||
case PROJECTM_K_ESCAPE: {
|
||||
// exit( 1 );
|
||||
break;
|
||||
}
|
||||
case PROJECTM_K_f:
|
||||
|
||||
break;
|
||||
case PROJECTM_K_b:
|
||||
break;
|
||||
case PROJECTM_K_n:
|
||||
if (switchPreset(ALPHA_NEXT, HARD_CUT) < 0) {
|
||||
printf("WARNING: Bad preset file, loading idle preset\n");
|
||||
switchToIdlePreset();
|
||||
}
|
||||
break;
|
||||
case PROJECTM_K_r:
|
||||
if (switchPreset(RANDOM_NEXT, HARD_CUT) < 0) {
|
||||
printf("WARNING: Bad preset file, loading idle preset\n");
|
||||
switchToIdlePreset();
|
||||
}
|
||||
break;
|
||||
case PROJECTM_K_p:
|
||||
if ((switchPreset(ALPHA_PREVIOUS, HARD_CUT)) < 0){
|
||||
printf("WARNING: Bad preset file, loading idle preset\n");
|
||||
switchToIdlePreset();
|
||||
}
|
||||
break;
|
||||
case PROJECTM_K_l:
|
||||
if (PM->noSwitch==0)PM->noSwitch=1; else PM->noSwitch=0;
|
||||
// current_interface = BROWSER_INTERFACE;
|
||||
// loadBrowser();
|
||||
break;
|
||||
case PROJECTM_K_e:
|
||||
current_interface = EDITOR_INTERFACE;
|
||||
loadEditor(active_preset->per_frame_eqn_string_buffer,(void (*)()) reloadPerFrame,
|
||||
80, 24, 140, 60, 0, 0);
|
||||
break;
|
||||
case PROJECTM_K_s:
|
||||
current_interface = EDITOR_INTERFACE;
|
||||
loadEditor("[FILE NAME HERE]", (void (*)())savePreset,
|
||||
50, 1, 100, 5, 0, .92);
|
||||
case PROJECTM_K_i:
|
||||
#ifdef DEBUG
|
||||
fprintf( debugFile, "PROJECTM_K_i\n" );
|
||||
fflush( debugFile );
|
||||
#endif
|
||||
PM->doIterative = !PM->doIterative;
|
||||
break;
|
||||
case PROJECTM_K_z:
|
||||
break;
|
||||
case PROJECTM_K_0:
|
||||
PM->nWaveMode=0;
|
||||
break;
|
||||
case PROJECTM_K_6:
|
||||
PM->nWaveMode=6;
|
||||
break;
|
||||
case PROJECTM_K_7:
|
||||
PM->nWaveMode=7;
|
||||
break;
|
||||
case PROJECTM_K_m:
|
||||
PM->showhelp=0;
|
||||
PM->showstats=0;
|
||||
PM->showfps=0;
|
||||
current_interface = MENU_INTERFACE;
|
||||
showMenu();
|
||||
break;
|
||||
case PROJECTM_K_t:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
38
libprojectM/src/console_interface.h
Executable file
38
libprojectM/src/console_interface.h
Executable file
@ -0,0 +1,38 @@
|
||||
/**
|
||||
* projectM -- Milkdrop-esque visualisation SDK
|
||||
* Copyright (C)2003-2004 projectM Team
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
* See 'LICENSE.txt' included within this release
|
||||
*
|
||||
*/
|
||||
/**
|
||||
* $Id: console_interface.h,v 1.1.1.1 2005/12/23 18:05:03 psperl Exp $
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _CONSOLE_INTERFACE_H
|
||||
#define _CONSOLE_INTERFACE_H
|
||||
|
||||
#include "event.h"
|
||||
|
||||
void default_key_handler(projectM_t *PM, projectMEvent event, projectMKeycode keycode);
|
||||
void refreshConsole(void*);
|
||||
#ifdef __CPLUSPLUS
|
||||
extern "C" void key_handler(projectM_t *PM, projectMEvent event, projectMKeycode keycode, projectMModifier modifier );
|
||||
#else
|
||||
extern void key_handler(projectM_t *PM, projectMEvent event, projectMKeycode keycode, projectMModifier modifier );
|
||||
#endif
|
||||
#endif /** !_CONSOLE_INTERFACE_H */
|
||||
605
libprojectM/src/custom_shape.cc
Executable file
605
libprojectM/src/custom_shape.cc
Executable file
@ -0,0 +1,605 @@
|
||||
/**
|
||||
* projectM -- Milkdrop-esque visualisation SDK
|
||||
* Copyright (C)2003-2004 projectM Team
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
* See 'LICENSE.txt' included within this release
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "common.h"
|
||||
#include "fatal.h"
|
||||
|
||||
#include "param_types.h"
|
||||
#include "param.h"
|
||||
|
||||
#include "expr_types.h"
|
||||
#include "eval.h"
|
||||
|
||||
#include "splaytree_types.h"
|
||||
#include "splaytree.h"
|
||||
#include "tree_types.h"
|
||||
|
||||
#include "per_frame_eqn_types.h"
|
||||
#include "per_frame_eqn.h"
|
||||
|
||||
#include "init_cond_types.h"
|
||||
#include "init_cond.h"
|
||||
|
||||
#include "preset_types.h"
|
||||
|
||||
#include "custom_shape_types.h"
|
||||
#include "custom_shape.h"
|
||||
|
||||
#include "init_cond_types.h"
|
||||
#include "init_cond.h"
|
||||
|
||||
#include "wipemalloc.h"
|
||||
|
||||
custom_shape_t * interface_shape = NULL;
|
||||
int cwave_interface_id = 0;
|
||||
void eval_custom_shape_init_conds(custom_shape_t * custom_shape);
|
||||
void load_unspec_init_cond_shape(param_t * param);
|
||||
|
||||
void destroy_param_db_tree_shape(splaytree_t * tree);
|
||||
void destroy_per_frame_eqn_tree_shape(splaytree_t * tree);
|
||||
void destroy_per_frame_init_eqn_tree_shape(splaytree_t * tree);
|
||||
void destroy_init_cond_tree_shape(splaytree_t * tree);
|
||||
|
||||
custom_shape_t * new_custom_shape(int id) {
|
||||
|
||||
custom_shape_t * custom_shape;
|
||||
param_t * param;
|
||||
|
||||
if ((custom_shape = (custom_shape_t*)wipemalloc(sizeof(custom_shape_t))) == NULL)
|
||||
return NULL;
|
||||
|
||||
custom_shape->id = id;
|
||||
custom_shape->per_frame_count = 0;
|
||||
custom_shape->per_frame_eqn_string_index = 0;
|
||||
custom_shape->per_frame_init_eqn_string_index = 0;
|
||||
|
||||
/* Initialize tree data structures */
|
||||
|
||||
if ((custom_shape->param_tree =
|
||||
create_splaytree( (int (*)(void*,void*))compare_string, (void* (*)(void*)) copy_string,(void (*)(void*)) free_string)) == NULL) {
|
||||
free_custom_shape(custom_shape);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if ((custom_shape->per_frame_eqn_tree =
|
||||
create_splaytree((int (*)(void*, void*))compare_int, (void* (*)(void*))copy_int,(void (*)(void*)) free_int)) == NULL) {
|
||||
free_custom_shape(custom_shape);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if ((custom_shape->init_cond_tree =
|
||||
create_splaytree((int (*)(void*, void*))compare_string, (void* (*)(void*)) copy_string,(void (*)(void*)) free_string)) == NULL) {
|
||||
free_custom_shape(custom_shape);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if ((custom_shape->per_frame_init_eqn_tree =
|
||||
create_splaytree((int (*)(void*, void*)) compare_string, (void* (*)(void*))copy_string, (void (*)(void*))free_string)) == NULL) {
|
||||
free_custom_shape(custom_shape);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Start: Load custom shape parameters */
|
||||
|
||||
if ((param = new_param_float("r", P_FLAG_NONE, &custom_shape->r, NULL, 1.0, 0.0, .5)) == NULL) {
|
||||
free_custom_shape(custom_shape);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (insert_param(param, custom_shape->param_tree) < 0) {
|
||||
free_custom_shape(custom_shape);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if ((param = new_param_float("g", P_FLAG_NONE, &custom_shape->g, NULL, 1.0, 0.0, .5)) == NULL){
|
||||
free_custom_shape(custom_shape);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (insert_param(param, custom_shape->param_tree) < 0) {
|
||||
free_custom_shape(custom_shape);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if ((param = new_param_float("b", P_FLAG_NONE, &custom_shape->b, NULL, 1.0, 0.0, .5)) == NULL){
|
||||
free_custom_shape(custom_shape);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (insert_param(param, custom_shape->param_tree) < 0) {
|
||||
free_custom_shape(custom_shape);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if ((param = new_param_float("a", P_FLAG_NONE, &custom_shape->a, NULL, 1.0, 0.0, .5)) == NULL){
|
||||
free_custom_shape(custom_shape);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (insert_param(param, custom_shape->param_tree) < 0) {
|
||||
free_custom_shape(custom_shape);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if ((param = new_param_float("border_r", P_FLAG_NONE, &custom_shape->border_r, NULL, 1.0, 0.0, .5)) == NULL) {
|
||||
free_custom_shape(custom_shape);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (insert_param(param, custom_shape->param_tree) < 0) {
|
||||
free_custom_shape(custom_shape);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if ((param = new_param_float("border_g", P_FLAG_NONE, &custom_shape->border_g, NULL, 1.0, 0.0, .5)) == NULL){
|
||||
free_custom_shape(custom_shape);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (insert_param(param, custom_shape->param_tree) < 0) {
|
||||
free_custom_shape(custom_shape);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if ((param = new_param_float("border_b", P_FLAG_NONE, &custom_shape->border_b, NULL, 1.0, 0.0, .5)) == NULL){
|
||||
free_custom_shape(custom_shape);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (insert_param(param, custom_shape->param_tree) < 0) {
|
||||
free_custom_shape(custom_shape);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if ((param = new_param_float("border_a", P_FLAG_NONE, &custom_shape->border_a, NULL, 1.0, 0.0, .5)) == NULL){
|
||||
free_custom_shape(custom_shape);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (insert_param(param, custom_shape->param_tree) < 0) {
|
||||
free_custom_shape(custom_shape);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if ((param = new_param_float("r2", P_FLAG_NONE, &custom_shape->r2, NULL, 1.0, 0.0, .5)) == NULL) {
|
||||
free_custom_shape(custom_shape);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (insert_param(param, custom_shape->param_tree) < 0) {
|
||||
free_custom_shape(custom_shape);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if ((param = new_param_float("g2", P_FLAG_NONE, &custom_shape->g2, NULL, 1.0, 0.0, .5)) == NULL){
|
||||
free_custom_shape(custom_shape);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (insert_param(param, custom_shape->param_tree) < 0) {
|
||||
free_custom_shape(custom_shape);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if ((param = new_param_float("b2", P_FLAG_NONE, &custom_shape->b2, NULL, 1.0, 0.0, .5)) == NULL){
|
||||
free_custom_shape(custom_shape);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (insert_param(param, custom_shape->param_tree) < 0) {
|
||||
free_custom_shape(custom_shape);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if ((param = new_param_float("a2", P_FLAG_NONE, &custom_shape->a2, NULL, 1.0, 0.0, .5)) == NULL){
|
||||
free_custom_shape(custom_shape);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (insert_param(param, custom_shape->param_tree) < 0) {
|
||||
free_custom_shape(custom_shape);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if ((param = new_param_float("x", P_FLAG_NONE, &custom_shape->x, NULL, 1.0, 0.0, .5)) == NULL) {
|
||||
free_custom_shape(custom_shape);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (insert_param(param, custom_shape->param_tree) < 0) {
|
||||
free_custom_shape(custom_shape);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if ((param = new_param_float("y", P_FLAG_NONE, &custom_shape->y, NULL, 1.0, 0.0, .5)) == NULL) {
|
||||
free_custom_shape(custom_shape);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (insert_param(param, custom_shape->param_tree) < 0) {
|
||||
free_custom_shape(custom_shape);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if ((param = new_param_bool("thickOutline", P_FLAG_NONE, &custom_shape->thickOutline, 1, 0, 0)) == NULL) {
|
||||
free_custom_shape(custom_shape);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (insert_param(param, custom_shape->param_tree) < 0) {
|
||||
free_custom_shape(custom_shape);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if ((param = new_param_bool("enabled", P_FLAG_NONE, &custom_shape->enabled, 1, 0, 0)) == NULL) {
|
||||
free_custom_shape(custom_shape);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (insert_param(param, custom_shape->param_tree) < 0) {
|
||||
free_custom_shape(custom_shape);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if ((param = new_param_int("sides", P_FLAG_NONE, &custom_shape->sides, 100, 3, 3)) == NULL) {
|
||||
free_custom_shape(custom_shape);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (insert_param(param, custom_shape->param_tree) < 0) {
|
||||
free_custom_shape(custom_shape);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if ((param = new_param_bool("additive", P_FLAG_NONE, &custom_shape->additive, 1, 0, 0)) == NULL) {
|
||||
free_custom_shape(custom_shape);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (insert_param(param, custom_shape->param_tree) < 0) {
|
||||
free_custom_shape(custom_shape);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if ((param = new_param_bool("textured", P_FLAG_NONE, &custom_shape->textured, 1, 0, 0)) == NULL) {
|
||||
free_custom_shape(custom_shape);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (insert_param(param, custom_shape->param_tree) < 0) {
|
||||
free_custom_shape(custom_shape);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if ((param = new_param_float("rad", P_FLAG_NONE, &custom_shape->radius, NULL, MAX_DOUBLE_SIZE, 0, 0.0)) == NULL) {
|
||||
free_custom_shape(custom_shape);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (insert_param(param, custom_shape->param_tree) < 0) {
|
||||
free_custom_shape(custom_shape);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if ((param = new_param_float("ang", P_FLAG_NONE, &custom_shape->ang, NULL, MAX_DOUBLE_SIZE, -MAX_DOUBLE_SIZE, 0.0)) == NULL) {
|
||||
free_custom_shape(custom_shape);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (insert_param(param, custom_shape->param_tree) < 0) {
|
||||
free_custom_shape(custom_shape);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if ((param = new_param_float("tex_zoom", P_FLAG_NONE, &custom_shape->tex_zoom, NULL, MAX_DOUBLE_SIZE, .00000000001, 0.0)) == NULL) {
|
||||
free_custom_shape(custom_shape);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (insert_param(param, custom_shape->param_tree) < 0) {
|
||||
free_custom_shape(custom_shape);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if ((param = new_param_float("tex_ang", P_FLAG_NONE, &custom_shape->tex_ang, NULL, MAX_DOUBLE_SIZE, -MAX_DOUBLE_SIZE, 0.0)) == NULL) {
|
||||
free_custom_shape(custom_shape);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (insert_param(param, custom_shape->param_tree) < 0) {
|
||||
free_custom_shape(custom_shape);
|
||||
return NULL;
|
||||
}
|
||||
if ((param = new_param_float("t1", P_FLAG_TVAR, &custom_shape->t1, NULL, MAX_DOUBLE_SIZE, -MAX_DOUBLE_SIZE, 0.0)) == NULL) {
|
||||
free_custom_shape(custom_shape);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (insert_param(param, custom_shape->param_tree) < 0) {
|
||||
free_custom_shape(custom_shape);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if ((param = new_param_float("t2", P_FLAG_TVAR, &custom_shape->t2, NULL, MAX_DOUBLE_SIZE, -MAX_DOUBLE_SIZE, 0.0)) == NULL) {
|
||||
free_custom_shape(custom_shape);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (insert_param(param, custom_shape->param_tree) < 0) {
|
||||
free_custom_shape(custom_shape);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if ((param = new_param_float("t3", P_FLAG_TVAR, &custom_shape->t3, NULL, MAX_DOUBLE_SIZE, -MAX_DOUBLE_SIZE, 0.0)) == NULL) {
|
||||
free_custom_shape(custom_shape);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (insert_param(param, custom_shape->param_tree) < 0) {
|
||||
free_custom_shape(custom_shape);
|
||||
return NULL;
|
||||
}
|
||||
if ((param = new_param_float("t4", P_FLAG_TVAR, &custom_shape->t4, NULL, MAX_DOUBLE_SIZE, -MAX_DOUBLE_SIZE, 0.0)) == NULL) {
|
||||
free_custom_shape(custom_shape);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (insert_param(param, custom_shape->param_tree) < 0) {
|
||||
free_custom_shape(custom_shape);
|
||||
return NULL;
|
||||
}
|
||||
if ((param = new_param_float("t5", P_FLAG_TVAR, &custom_shape->t5, NULL, MAX_DOUBLE_SIZE, -MAX_DOUBLE_SIZE, 0.0)) == NULL) {
|
||||
free_custom_shape(custom_shape);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (insert_param(param, custom_shape->param_tree) < 0) {
|
||||
free_custom_shape(custom_shape);
|
||||
return NULL;
|
||||
}
|
||||
if ((param = new_param_float("t6", P_FLAG_TVAR, &custom_shape->t6, NULL, MAX_DOUBLE_SIZE, -MAX_DOUBLE_SIZE, 0.0)) == NULL) {
|
||||
free_custom_shape(custom_shape);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (insert_param(param, custom_shape->param_tree) < 0) {
|
||||
free_custom_shape(custom_shape);
|
||||
return NULL;
|
||||
}
|
||||
if ((param = new_param_float("t7", P_FLAG_TVAR, &custom_shape->t7, NULL, MAX_DOUBLE_SIZE, -MAX_DOUBLE_SIZE, 0.0)) == NULL) {
|
||||
free_custom_shape(custom_shape);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (insert_param(param, custom_shape->param_tree) < 0) {
|
||||
free_custom_shape(custom_shape);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if ((param = new_param_float("t8", P_FLAG_TVAR, &custom_shape->t8, NULL, MAX_DOUBLE_SIZE, -MAX_DOUBLE_SIZE, 0.0)) == NULL) {
|
||||
free_custom_shape(custom_shape);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (insert_param(param, custom_shape->param_tree) < 0) {
|
||||
free_custom_shape(custom_shape);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* End of parameter loading. Note that the read only parameters associated
|
||||
with custom shapes (ie, sample) are global variables, and not specific to
|
||||
the custom shape datastructure. */
|
||||
|
||||
|
||||
|
||||
return custom_shape;
|
||||
|
||||
}
|
||||
|
||||
void destroy_per_frame_init_eqn_tree_shape(splaytree_t * tree) {
|
||||
|
||||
if (!tree)
|
||||
return;
|
||||
|
||||
splay_traverse((void (*)(void*))free_init_cond, tree);
|
||||
destroy_splaytree(tree);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
void destroy_init_cond_tree_shape(splaytree_t * tree) {
|
||||
|
||||
if (!tree)
|
||||
return;
|
||||
|
||||
splay_traverse((void (*)(void*))free_init_cond, tree);
|
||||
destroy_splaytree(tree);
|
||||
|
||||
}
|
||||
|
||||
void destroy_per_frame_eqn_tree_shape(splaytree_t * tree) {
|
||||
|
||||
|
||||
if (!tree)
|
||||
return;
|
||||
|
||||
splay_traverse((void (*)(void*))free_per_frame_eqn, tree);
|
||||
destroy_splaytree(tree);
|
||||
|
||||
}
|
||||
|
||||
|
||||
void destroy_param_db_tree_shape(splaytree_t * tree) {
|
||||
|
||||
if (!tree)
|
||||
return;
|
||||
|
||||
splay_traverse((void (*)(void*))free_param, tree);
|
||||
destroy_splaytree(tree);
|
||||
|
||||
}
|
||||
|
||||
/* Frees a custom shape form object */
|
||||
void free_custom_shape(custom_shape_t * custom_shape) {
|
||||
|
||||
if (custom_shape == NULL)
|
||||
return;
|
||||
|
||||
if (custom_shape->param_tree == NULL)
|
||||
return;
|
||||
|
||||
destroy_per_frame_eqn_tree_shape(custom_shape->per_frame_eqn_tree);
|
||||
destroy_init_cond_tree_shape(custom_shape->init_cond_tree);
|
||||
destroy_param_db_tree_shape(custom_shape->param_tree);
|
||||
destroy_per_frame_init_eqn_tree_shape(custom_shape->per_frame_init_eqn_tree);
|
||||
|
||||
free(custom_shape);
|
||||
custom_shape = NULL;
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
|
||||
custom_shape_t * find_custom_shape(int id, preset_t * preset, int create_flag) {
|
||||
|
||||
custom_shape_t * custom_shape = NULL;
|
||||
|
||||
if (preset == NULL)
|
||||
return NULL;
|
||||
|
||||
if ((custom_shape = (custom_shape_t*)splay_find(&id, preset->custom_shape_tree)) == NULL) {
|
||||
|
||||
if (CUSTOM_SHAPE_DEBUG) { printf("find_custom_shape: creating custom shape (id = %d)...", id);fflush(stdout);}
|
||||
|
||||
if (create_flag == FALSE) {
|
||||
if (CUSTOM_SHAPE_DEBUG) printf("you specified not to (create flag = false), returning null\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if ((custom_shape = new_custom_shape(id)) == NULL) {
|
||||
if (CUSTOM_SHAPE_DEBUG) printf("failed...out of memory?\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (CUSTOM_SHAPE_DEBUG) { printf("success.Inserting..."); fflush(stdout);}
|
||||
|
||||
if (splay_insert(custom_shape, &custom_shape->id, preset->custom_shape_tree) < 0) {
|
||||
if (CUSTOM_SHAPE_DEBUG) printf("failed, probably a duplicated!!\n");
|
||||
free_custom_shape(custom_shape);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (CUSTOM_SHAPE_DEBUG) printf("done.\n");
|
||||
}
|
||||
|
||||
return custom_shape;
|
||||
}
|
||||
|
||||
void evalCustomShapeInitConditions(preset_t *preset) {
|
||||
splay_traverse((void (*)(void*))eval_custom_shape_init_conds, preset->custom_shape_tree);
|
||||
|
||||
}
|
||||
|
||||
void eval_custom_shape_init_conds(custom_shape_t * custom_shape) {
|
||||
|
||||
splay_traverse((void (*)(void*))eval_init_cond, custom_shape->per_frame_init_eqn_tree);
|
||||
}
|
||||
|
||||
|
||||
void load_unspecified_init_conds_shape(custom_shape_t * custom_shape) {
|
||||
|
||||
interface_shape = custom_shape;
|
||||
splay_traverse((void (*)(void*))load_unspec_init_cond_shape, interface_shape->param_tree);
|
||||
interface_shape = NULL;
|
||||
|
||||
}
|
||||
|
||||
void load_unspec_init_cond_shape(param_t * param) {
|
||||
|
||||
init_cond_t * init_cond;
|
||||
value_t init_val;
|
||||
|
||||
/* Don't count read only parameters as initial conditions */
|
||||
if (param->flags & P_FLAG_READONLY)
|
||||
return;
|
||||
if (param->flags & P_FLAG_QVAR)
|
||||
return;
|
||||
if (param->flags & P_FLAG_TVAR)
|
||||
return;
|
||||
if (param->flags & P_FLAG_USERDEF)
|
||||
return;
|
||||
|
||||
/* If initial condition was not defined by the preset file, force a default one
|
||||
with the following code */
|
||||
if ((init_cond =(init_cond_t*) splay_find(param->name, interface_shape->init_cond_tree)) == NULL) {
|
||||
|
||||
/* Make sure initial condition does not exist in the set of per frame initial equations */
|
||||
if ((init_cond = (init_cond_t*)splay_find(param->name, interface_shape->per_frame_init_eqn_tree)) != NULL)
|
||||
return;
|
||||
|
||||
if (param->type == P_TYPE_BOOL)
|
||||
init_val.bool_val = 0;
|
||||
|
||||
else if (param->type == P_TYPE_INT)
|
||||
init_val.int_val = *(int*)param->engine_val;
|
||||
|
||||
else if (param->type == P_TYPE_DOUBLE)
|
||||
init_val.float_val = *(float*)param->engine_val;
|
||||
|
||||
//printf("%s\n", param->name);
|
||||
/* Create new initial condition */
|
||||
if ((init_cond = new_init_cond(param, init_val)) == NULL)
|
||||
return;
|
||||
|
||||
/* Insert the initial condition into this presets tree */
|
||||
if (splay_insert(init_cond, init_cond->param->name, interface_shape->init_cond_tree) < 0) {
|
||||
free_init_cond(init_cond);
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/* Interface function. Makes another custom shape the current
|
||||
concern for per frame / point equations */
|
||||
custom_shape_t * nextCustomShape(preset_t *preset) {
|
||||
|
||||
if ((interface_shape = (custom_shape_t*) splay_find(&cwave_interface_id, preset->custom_shape_tree)) == NULL) {
|
||||
cwave_interface_id = 0;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
cwave_interface_id++;
|
||||
|
||||
/* Evaluate all per frame equations associated with this shape */
|
||||
splay_traverse((void (*)(void*))eval_init_cond, interface_shape->init_cond_tree);
|
||||
splay_traverse((void (*)(void*))eval_per_frame_eqn, interface_shape->per_frame_eqn_tree);
|
||||
|
||||
return interface_shape;
|
||||
}
|
||||
38
libprojectM/src/custom_shape.h
Executable file
38
libprojectM/src/custom_shape.h
Executable file
@ -0,0 +1,38 @@
|
||||
/**
|
||||
* projectM -- Milkdrop-esque visualisation SDK
|
||||
* Copyright (C)2003-2004 projectM Team
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
* See 'LICENSE.txt' included within this release
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _CUSTOM_SHAPE_H
|
||||
#define _CUSTOM_SHAPE_H
|
||||
|
||||
#define CUSTOM_SHAPE_DEBUG 0
|
||||
|
||||
#include "expr_types.h"
|
||||
#include "custom_shape_types.h"
|
||||
#include "preset_types.h"
|
||||
|
||||
void free_custom_shape(custom_shape_t * custom_shape);
|
||||
custom_shape_t * new_custom_shape(int id);
|
||||
custom_shape_t * find_custom_shape(int id, preset_t * preset, int create_flag);
|
||||
void load_unspecified_init_conds_shape(custom_shape_t * custom_shape);
|
||||
void evalCustomShapeInitConditions(preset_t *preset);
|
||||
custom_shape_t * nextCustomShape(preset_t *preset);
|
||||
|
||||
#endif /** !_CUSTOM_SHAPE_H */
|
||||
97
libprojectM/src/custom_shape_types.h
Executable file
97
libprojectM/src/custom_shape_types.h
Executable file
@ -0,0 +1,97 @@
|
||||
/**
|
||||
* projectM -- Milkdrop-esque visualisation SDK
|
||||
* Copyright (C)2003-2004 projectM Team
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
* See 'LICENSE.txt' included within this release
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _CUSTOM_SHAPE_TYPES_H
|
||||
#define _CUSTOM_SHAPE_TYPES_H
|
||||
|
||||
#include "common.h"
|
||||
#include "splaytree_types.h"
|
||||
#include "expr_types.h"
|
||||
|
||||
typedef struct CUSTOM_SHAPE_T {
|
||||
|
||||
/* Numerical id */
|
||||
int id;
|
||||
int per_frame_count;
|
||||
|
||||
/* Parameter tree associated with this custom shape */
|
||||
splaytree_t * param_tree;
|
||||
|
||||
|
||||
/* Engine variables */
|
||||
int sides;
|
||||
int thickOutline;
|
||||
int enabled;
|
||||
int additive;
|
||||
int textured;
|
||||
|
||||
float tex_zoom;
|
||||
float tex_ang;
|
||||
|
||||
float x; /* x position for per point equations */
|
||||
float y; /* y position for per point equations */
|
||||
float radius;
|
||||
float ang;
|
||||
|
||||
float r; /* red color value */
|
||||
float g; /* green color value */
|
||||
float b; /* blue color value */
|
||||
float a; /* alpha color value */
|
||||
|
||||
float r2; /* red color value */
|
||||
float g2; /* green color value */
|
||||
float b2; /* blue color value */
|
||||
float a2; /* alpha color value */
|
||||
|
||||
float border_r; /* red color value */
|
||||
float border_g; /* green color value */
|
||||
float border_b; /* blue color value */
|
||||
float border_a; /* alpha color value */
|
||||
|
||||
/* stupid t variables */
|
||||
float t1;
|
||||
float t2;
|
||||
float t3;
|
||||
float t4;
|
||||
float t5;
|
||||
float t6;
|
||||
float t7;
|
||||
float t8;
|
||||
|
||||
/* Data structure to hold per frame / per frame init equations */
|
||||
splaytree_t * init_cond_tree;
|
||||
splaytree_t * per_frame_eqn_tree;
|
||||
splaytree_t * per_frame_init_eqn_tree;
|
||||
|
||||
/* Denotes the index of the last character for each string buffer */
|
||||
int per_frame_eqn_string_index;
|
||||
int per_frame_init_eqn_string_index;
|
||||
|
||||
/* String buffers for per frame / per frame init equations */
|
||||
char per_frame_eqn_string_buffer[STRING_BUFFER_SIZE];
|
||||
char per_frame_init_eqn_string_buffer[STRING_BUFFER_SIZE];
|
||||
/* Per point equation array */
|
||||
|
||||
|
||||
} custom_shape_t;
|
||||
|
||||
|
||||
#endif /** !_CUSTOM_SHAPE_TYPES_H */
|
||||
754
libprojectM/src/custom_wave.cc
Executable file
754
libprojectM/src/custom_wave.cc
Executable file
@ -0,0 +1,754 @@
|
||||
/**
|
||||
* projectM -- Milkdrop-esque visualisation SDK
|
||||
* Copyright (C)2003-2004 projectM Team
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
* See 'LICENSE.txt' included within this release
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "projectM.h"
|
||||
|
||||
#include "common.h"
|
||||
#include "fatal.h"
|
||||
|
||||
#include "param_types.h"
|
||||
#include "param.h"
|
||||
|
||||
#include "expr_types.h"
|
||||
#include "eval.h"
|
||||
|
||||
#include "splaytree_types.h"
|
||||
#include "splaytree.h"
|
||||
#include "tree_types.h"
|
||||
|
||||
#include "per_frame_eqn_types.h"
|
||||
#include "per_frame_eqn.h"
|
||||
|
||||
#include "init_cond_types.h"
|
||||
#include "init_cond.h"
|
||||
|
||||
#include "preset_types.h"
|
||||
|
||||
#include "custom_wave_types.h"
|
||||
#include "custom_wave.h"
|
||||
|
||||
#include "init_cond_types.h"
|
||||
#include "init_cond.h"
|
||||
|
||||
#include "wipemalloc.h"
|
||||
|
||||
#define MAX_SAMPLE_SIZE 4096
|
||||
|
||||
extern int mesh_i;
|
||||
|
||||
custom_wave_t * interface_wave = NULL;
|
||||
int interface_id = 0;
|
||||
void eval_custom_wave_init_conds(custom_wave_t * custom_wave);
|
||||
void load_unspec_init_cond(param_t * param);
|
||||
void destroy_per_point_eqn_tree(splaytree_t * tree);
|
||||
void destroy_param_db_tree(splaytree_t * tree);
|
||||
void destroy_per_frame_eqn_tree(splaytree_t * tree);
|
||||
void destroy_per_frame_init_eqn_tree(splaytree_t * tree);
|
||||
void destroy_init_cond_tree(splaytree_t * tree);
|
||||
void evalPerPointEqn(per_point_eqn_t * per_point_eqn);
|
||||
|
||||
custom_wave_t * new_custom_wave(int id) {
|
||||
|
||||
custom_wave_t * custom_wave;
|
||||
param_t * param;
|
||||
|
||||
if ((custom_wave = (custom_wave_t*)wipemalloc(sizeof(custom_wave_t))) == NULL)
|
||||
return NULL;
|
||||
|
||||
custom_wave->id = id;
|
||||
custom_wave->per_frame_count = 0;
|
||||
|
||||
custom_wave->samples = 512;
|
||||
custom_wave->bSpectrum = 0;
|
||||
custom_wave->enabled = 1;
|
||||
custom_wave->sep = 1;
|
||||
custom_wave->smoothing = 0.0;
|
||||
custom_wave->bUseDots = 0;
|
||||
custom_wave->bAdditive = 0;
|
||||
custom_wave->r = custom_wave->g = custom_wave->b = custom_wave->a = 0.0;
|
||||
custom_wave->scaling = 1.0;
|
||||
custom_wave->per_frame_eqn_string_index = 0;
|
||||
custom_wave->per_frame_init_eqn_string_index = 0;
|
||||
custom_wave->per_point_eqn_string_index = 0;
|
||||
|
||||
custom_wave->r_mesh = (float*)wipemalloc(MAX_SAMPLE_SIZE*sizeof(float));
|
||||
custom_wave->g_mesh = (float*)wipemalloc(MAX_SAMPLE_SIZE*sizeof(float));
|
||||
custom_wave->b_mesh = (float*)wipemalloc(MAX_SAMPLE_SIZE*sizeof(float));
|
||||
custom_wave->a_mesh = (float*)wipemalloc(MAX_SAMPLE_SIZE*sizeof(float));
|
||||
custom_wave->x_mesh = (float*)wipemalloc(MAX_SAMPLE_SIZE*sizeof(float));
|
||||
custom_wave->y_mesh = (float*)wipemalloc(MAX_SAMPLE_SIZE*sizeof(float));
|
||||
custom_wave->value1 = (float*) wipemalloc(MAX_SAMPLE_SIZE*sizeof(float));
|
||||
custom_wave->value2 = (float*)wipemalloc(MAX_SAMPLE_SIZE*sizeof(float));
|
||||
custom_wave->sample_mesh = (float*)wipemalloc(MAX_SAMPLE_SIZE*sizeof(float));
|
||||
|
||||
/* Initialize tree data structures */
|
||||
|
||||
if ((custom_wave->param_tree =
|
||||
create_splaytree((int (*)(void*, void*))compare_string, (void* (*)(void*))copy_string, (void (*)(void*))free_string)) == NULL) {
|
||||
free_custom_wave(custom_wave);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if ((custom_wave->per_point_eqn_tree =
|
||||
create_splaytree((int (*)(void*, void*))compare_int, (void* (*)(void*))copy_int, (void (*)(void*))free_int)) == NULL) {
|
||||
free_custom_wave(custom_wave);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if ((custom_wave->per_frame_eqn_tree =
|
||||
create_splaytree((int (*)(void*, void*))compare_int,(void* (*)(void*)) copy_int,(void (*)(void*)) free_int)) == NULL) {
|
||||
free_custom_wave(custom_wave);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if ((custom_wave->init_cond_tree =
|
||||
create_splaytree((int (*)(void*, void*))compare_string, (void*(*)(void*))copy_string,(void (*)(void*)) free_string)) == NULL) {
|
||||
free_custom_wave(custom_wave);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if ((custom_wave->per_frame_init_eqn_tree =
|
||||
create_splaytree((int (*)(void*, void*))compare_string, (void*(*)(void*))copy_string, (void (*)(void*))free_string)) == NULL) {
|
||||
free_custom_wave(custom_wave);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
/* Start: Load custom wave parameters */
|
||||
|
||||
if ((param = new_param_float("r", P_FLAG_DONT_FREE_MATRIX | P_FLAG_PER_POINT, &custom_wave->r, custom_wave->r_mesh, 1.0, 0.0, .5)) == NULL) {
|
||||
free_custom_wave(custom_wave);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (insert_param(param, custom_wave->param_tree) < 0) {
|
||||
free_custom_wave(custom_wave);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if ((param = new_param_float("g", P_FLAG_DONT_FREE_MATRIX | P_FLAG_PER_POINT, &custom_wave->g, custom_wave->g_mesh, 1.0, 0.0, .5)) == NULL){
|
||||
free_custom_wave(custom_wave);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (insert_param(param, custom_wave->param_tree) < 0) {
|
||||
free_custom_wave(custom_wave);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if ((param = new_param_float("b", P_FLAG_DONT_FREE_MATRIX | P_FLAG_PER_POINT, &custom_wave->b, custom_wave->b_mesh, 1.0, 0.0, .5)) == NULL){
|
||||
free_custom_wave(custom_wave);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (insert_param(param, custom_wave->param_tree) < 0) {
|
||||
free_custom_wave(custom_wave);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if ((param = new_param_float("a", P_FLAG_DONT_FREE_MATRIX | P_FLAG_PER_POINT, &custom_wave->a, custom_wave->a_mesh, 1.0, 0.0, .5)) == NULL){
|
||||
free_custom_wave(custom_wave);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (insert_param(param, custom_wave->param_tree) < 0) {
|
||||
free_custom_wave(custom_wave);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if ((param = new_param_float("x", P_FLAG_DONT_FREE_MATRIX | P_FLAG_PER_POINT, &custom_wave->x, custom_wave->x_mesh, 1.0, 0.0, .5)) == NULL) {
|
||||
free_custom_wave(custom_wave);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (insert_param(param, custom_wave->param_tree) < 0) {
|
||||
free_custom_wave(custom_wave);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if ((param = new_param_float("y", P_FLAG_DONT_FREE_MATRIX | P_FLAG_PER_POINT, &custom_wave->y, custom_wave->y_mesh, 1.0, 0.0, .5)) == NULL) {
|
||||
free_custom_wave(custom_wave);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (insert_param(param, custom_wave->param_tree) < 0) {
|
||||
free_custom_wave(custom_wave);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if ((param = new_param_bool("enabled", P_FLAG_NONE, &custom_wave->enabled, 1, 0, 0)) == NULL) {
|
||||
free_custom_wave(custom_wave);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (insert_param(param, custom_wave->param_tree) < 0) {
|
||||
free_custom_wave(custom_wave);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if ((param = new_param_int("sep", P_FLAG_NONE, &custom_wave->sep, 100, -100, 0)) == NULL) {
|
||||
free_custom_wave(custom_wave);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (insert_param(param, custom_wave->param_tree) < 0) {
|
||||
free_custom_wave(custom_wave);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if ((param = new_param_bool("bSpectrum", P_FLAG_NONE, &custom_wave->bSpectrum, 1, 0, 0)) == NULL) {
|
||||
free_custom_wave(custom_wave);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (insert_param(param, custom_wave->param_tree) < 0) {
|
||||
free_custom_wave(custom_wave);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if ((param = new_param_bool("bDrawThick", P_FLAG_NONE, &custom_wave->bDrawThick, 1, 0, 0)) == NULL) {
|
||||
free_custom_wave(custom_wave);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (insert_param(param, custom_wave->param_tree) < 0) {
|
||||
free_custom_wave(custom_wave);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if ((param = new_param_bool("bUseDots", P_FLAG_NONE, &custom_wave->bUseDots, 1, 0, 0)) == NULL) {
|
||||
free_custom_wave(custom_wave);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (insert_param(param, custom_wave->param_tree) < 0) {
|
||||
free_custom_wave(custom_wave);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if ((param = new_param_bool("bAdditive", P_FLAG_NONE, &custom_wave->bAdditive, 1, 0, 0)) == NULL) {
|
||||
free_custom_wave(custom_wave);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (insert_param(param, custom_wave->param_tree) < 0) {
|
||||
free_custom_wave(custom_wave);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if ((param = new_param_int("samples", P_FLAG_NONE, &custom_wave->samples, 2048, 1, 512)) == NULL) {
|
||||
free_custom_wave(custom_wave);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (insert_param(param, custom_wave->param_tree) < 0) {
|
||||
free_custom_wave(custom_wave);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if ((param = new_param_float("sample", P_FLAG_READONLY | P_FLAG_DONT_FREE_MATRIX | P_FLAG_ALWAYS_MATRIX | P_FLAG_PER_POINT,
|
||||
&custom_wave->sample, custom_wave->sample_mesh, 1.0, 0.0, 0.0)) == NULL) {
|
||||
free_custom_wave(custom_wave);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (insert_param(param, custom_wave->param_tree) < 0) {
|
||||
printf("failed to insert sample\n");
|
||||
free_custom_wave(custom_wave);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if ((param = new_param_float("value1", P_FLAG_READONLY | P_FLAG_DONT_FREE_MATRIX | P_FLAG_ALWAYS_MATRIX | P_FLAG_PER_POINT, &custom_wave->v1, custom_wave->value1, 1.0, -1.0, 0.0)) == NULL) {
|
||||
free_custom_wave(custom_wave);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (insert_param(param, custom_wave->param_tree) < 0) {
|
||||
free_custom_wave(custom_wave);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if ((param = new_param_float("value2", P_FLAG_READONLY | P_FLAG_DONT_FREE_MATRIX | P_FLAG_ALWAYS_MATRIX | P_FLAG_PER_POINT, &custom_wave->v2, custom_wave->value2, 1.0, -1.0, 0.0)) == NULL) {
|
||||
free_custom_wave(custom_wave);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (insert_param(param, custom_wave->param_tree) < 0) {
|
||||
free_custom_wave(custom_wave);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if ((param = new_param_float("smoothing", P_FLAG_NONE, &custom_wave->smoothing, NULL, 1.0, 0.0, 0.0)) == NULL) {
|
||||
free_custom_wave(custom_wave);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (insert_param(param, custom_wave->param_tree) < 0) {
|
||||
free_custom_wave(custom_wave);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if ((param = new_param_float("scaling", P_FLAG_NONE, &custom_wave->scaling, NULL, MAX_DOUBLE_SIZE, 0.0, 1.0)) == NULL) {
|
||||
free_custom_wave(custom_wave);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (insert_param(param, custom_wave->param_tree) < 0) {
|
||||
free_custom_wave(custom_wave);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if ((param = new_param_float("t1", P_FLAG_PER_POINT | P_FLAG_TVAR, &custom_wave->t1, NULL, MAX_DOUBLE_SIZE, -MAX_DOUBLE_SIZE, 0.0)) == NULL) {
|
||||
free_custom_wave(custom_wave);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (insert_param(param, custom_wave->param_tree) < 0) {
|
||||
free_custom_wave(custom_wave);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if ((param = new_param_float("t2", P_FLAG_PER_POINT |P_FLAG_TVAR, &custom_wave->t2, NULL, MAX_DOUBLE_SIZE, -MAX_DOUBLE_SIZE, 0.0)) == NULL) {
|
||||
free_custom_wave(custom_wave);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (insert_param(param, custom_wave->param_tree) < 0) {
|
||||
free_custom_wave(custom_wave);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if ((param = new_param_float("t3", P_FLAG_PER_POINT |P_FLAG_TVAR, &custom_wave->t3, NULL, MAX_DOUBLE_SIZE, -MAX_DOUBLE_SIZE, 0.0)) == NULL) {
|
||||
free_custom_wave(custom_wave);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (insert_param(param, custom_wave->param_tree) < 0) {
|
||||
free_custom_wave(custom_wave);
|
||||
return NULL;
|
||||
}
|
||||
if ((param = new_param_float("t4", P_FLAG_PER_POINT |P_FLAG_TVAR, &custom_wave->t4, NULL, MAX_DOUBLE_SIZE, -MAX_DOUBLE_SIZE, 0.0)) == NULL) {
|
||||
free_custom_wave(custom_wave);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (insert_param(param, custom_wave->param_tree) < 0) {
|
||||
free_custom_wave(custom_wave);
|
||||
return NULL;
|
||||
}
|
||||
if ((param = new_param_float("t5", P_FLAG_TVAR, &custom_wave->t5, NULL, MAX_DOUBLE_SIZE, -MAX_DOUBLE_SIZE, 0.0)) == NULL) {
|
||||
free_custom_wave(custom_wave);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (insert_param(param, custom_wave->param_tree) < 0) {
|
||||
free_custom_wave(custom_wave);
|
||||
return NULL;
|
||||
}
|
||||
if ((param = new_param_float("t6", P_FLAG_TVAR | P_FLAG_PER_POINT, &custom_wave->t6, NULL, MAX_DOUBLE_SIZE, -MAX_DOUBLE_SIZE, 0.0)) == NULL) {
|
||||
free_custom_wave(custom_wave);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (insert_param(param, custom_wave->param_tree) < 0) {
|
||||
free_custom_wave(custom_wave);
|
||||
return NULL;
|
||||
}
|
||||
if ((param = new_param_float("t7", P_FLAG_TVAR | P_FLAG_PER_POINT, &custom_wave->t7, NULL, MAX_DOUBLE_SIZE, -MAX_DOUBLE_SIZE, 0.0)) == NULL) {
|
||||
free_custom_wave(custom_wave);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (insert_param(param, custom_wave->param_tree) < 0) {
|
||||
free_custom_wave(custom_wave);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if ((param = new_param_float("t8", P_FLAG_TVAR | P_FLAG_PER_POINT, &custom_wave->t8, NULL, MAX_DOUBLE_SIZE, -MAX_DOUBLE_SIZE, 0.0)) == NULL) {
|
||||
free_custom_wave(custom_wave);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (insert_param(param, custom_wave->param_tree) < 0) {
|
||||
free_custom_wave(custom_wave);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* End of parameter loading. Note that the read only parameters associated
|
||||
with custom waves (ie, sample) are global variables, and not specific to
|
||||
the custom wave datastructure. */
|
||||
|
||||
|
||||
return custom_wave;
|
||||
|
||||
}
|
||||
|
||||
void destroy_per_frame_init_eqn_tree(splaytree_t * tree) {
|
||||
|
||||
if (!tree)
|
||||
return;
|
||||
|
||||
splay_traverse((void (*)(void*))free_init_cond, tree);
|
||||
destroy_splaytree(tree);
|
||||
|
||||
}
|
||||
|
||||
|
||||
void destroy_per_point_eqn_tree(splaytree_t * tree) {
|
||||
|
||||
if (!tree)
|
||||
return;
|
||||
|
||||
splay_traverse((void (*)(void*))free_per_point_eqn, tree);
|
||||
destroy_splaytree(tree);
|
||||
|
||||
}
|
||||
|
||||
void destroy_init_cond_tree(splaytree_t * tree) {
|
||||
|
||||
if (!tree)
|
||||
return;
|
||||
|
||||
splay_traverse((void (*)(void*))free_init_cond, tree);
|
||||
destroy_splaytree(tree);
|
||||
|
||||
}
|
||||
|
||||
void destroy_per_frame_eqn_tree(splaytree_t * tree) {
|
||||
|
||||
|
||||
if (!tree)
|
||||
return;
|
||||
|
||||
splay_traverse((void (*)(void*))free_per_frame_eqn, tree);
|
||||
destroy_splaytree(tree);
|
||||
|
||||
}
|
||||
|
||||
|
||||
void destroy_param_db_tree(splaytree_t * tree) {
|
||||
|
||||
if (!tree)
|
||||
return;
|
||||
|
||||
splay_traverse((void (*)(void*))free_param, tree);
|
||||
destroy_splaytree(tree);
|
||||
|
||||
}
|
||||
|
||||
/* Frees a custom wave form object */
|
||||
void free_custom_wave(custom_wave_t * custom_wave) {
|
||||
|
||||
if (custom_wave == NULL)
|
||||
return;
|
||||
|
||||
if (custom_wave->param_tree == NULL)
|
||||
return;
|
||||
|
||||
destroy_per_point_eqn_tree(custom_wave->per_point_eqn_tree);
|
||||
destroy_per_frame_eqn_tree(custom_wave->per_frame_eqn_tree);
|
||||
destroy_init_cond_tree(custom_wave->init_cond_tree);
|
||||
destroy_param_db_tree(custom_wave->param_tree);
|
||||
destroy_per_frame_init_eqn_tree(custom_wave->per_frame_init_eqn_tree);
|
||||
|
||||
free(custom_wave->r_mesh);
|
||||
free(custom_wave->g_mesh);
|
||||
free(custom_wave->b_mesh);
|
||||
free(custom_wave->a_mesh);
|
||||
free(custom_wave->x_mesh);
|
||||
free(custom_wave->y_mesh);
|
||||
free(custom_wave->value1);
|
||||
free(custom_wave->value2);
|
||||
free(custom_wave->sample_mesh);
|
||||
|
||||
custom_wave->r_mesh = NULL;
|
||||
custom_wave->g_mesh = NULL;
|
||||
custom_wave->b_mesh = NULL;
|
||||
custom_wave->a_mesh = NULL;
|
||||
custom_wave->x_mesh = NULL;
|
||||
custom_wave->y_mesh = NULL;
|
||||
custom_wave->value1 = NULL;
|
||||
custom_wave->value2 = NULL;
|
||||
custom_wave->sample_mesh = NULL;
|
||||
|
||||
free(custom_wave);
|
||||
custom_wave = NULL;
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
int add_per_point_eqn(char * name, gen_expr_t * gen_expr, custom_wave_t * custom_wave) {
|
||||
|
||||
per_point_eqn_t * per_point_eqn;
|
||||
int index;
|
||||
param_t * param = NULL;
|
||||
|
||||
/* Argument checks */
|
||||
if (custom_wave == NULL)
|
||||
return PROJECTM_FAILURE;
|
||||
if (gen_expr == NULL)
|
||||
return PROJECTM_FAILURE;
|
||||
if (name == NULL)
|
||||
return PROJECTM_FAILURE;
|
||||
|
||||
if (CUSTOM_WAVE_DEBUG) printf("add_per_point_eqn: per pixel equation (name = \"%s\")\n", name);
|
||||
|
||||
/* Search for the parameter so we know what matrix the per pixel equation is referencing */
|
||||
|
||||
if ((param = find_param_db(name, custom_wave->param_tree, TRUE)) == NULL) {
|
||||
if (CUSTOM_WAVE_DEBUG) printf("add_per_point_eqn: failed to allocate a new parameter!\n");
|
||||
return PROJECTM_FAILURE;
|
||||
|
||||
}
|
||||
|
||||
/* Find most largest index in the splaytree */
|
||||
if ((per_point_eqn = (per_point_eqn_t*)splay_find_max(custom_wave->per_point_eqn_tree)) == NULL)
|
||||
index = 0;
|
||||
else
|
||||
index = per_point_eqn->index+1;
|
||||
|
||||
/* Create the per pixel equation given the index, parameter, and general expression */
|
||||
if ((per_point_eqn = new_per_point_eqn(index, param, gen_expr)) == NULL)
|
||||
return PROJECTM_FAILURE;
|
||||
if (CUSTOM_WAVE_DEBUG)
|
||||
printf("add_per_point_eqn: created new equation (index = %d) (name = \"%s\")\n", per_point_eqn->index, per_point_eqn->param->name);
|
||||
/* Insert the per pixel equation into the preset per pixel database */
|
||||
if (splay_insert(per_point_eqn, &per_point_eqn->index, custom_wave->per_point_eqn_tree) < 0) {
|
||||
free_per_point_eqn(per_point_eqn);
|
||||
return PROJECTM_FAILURE;
|
||||
}
|
||||
|
||||
/* Done */
|
||||
return PROJECTM_SUCCESS;
|
||||
}
|
||||
|
||||
per_point_eqn_t * new_per_point_eqn(int index, param_t * param, gen_expr_t * gen_expr) {
|
||||
|
||||
per_point_eqn_t * per_point_eqn;
|
||||
|
||||
if (param == NULL)
|
||||
return NULL;
|
||||
if (gen_expr == NULL)
|
||||
return NULL;
|
||||
|
||||
if ((per_point_eqn = (per_point_eqn_t*)wipemalloc(sizeof(per_point_eqn_t))) == NULL)
|
||||
return NULL;
|
||||
|
||||
|
||||
per_point_eqn->index = index;
|
||||
per_point_eqn->gen_expr = gen_expr;
|
||||
per_point_eqn->param = param;
|
||||
return per_point_eqn;
|
||||
}
|
||||
|
||||
|
||||
void free_per_point_eqn(per_point_eqn_t * per_point_eqn) {
|
||||
|
||||
if (per_point_eqn == NULL)
|
||||
return;
|
||||
|
||||
free_gen_expr(per_point_eqn->gen_expr);
|
||||
|
||||
free(per_point_eqn);
|
||||
per_point_eqn = NULL;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
custom_wave_t * find_custom_wave(int id, preset_t * preset, int create_flag) {
|
||||
|
||||
custom_wave_t * custom_wave = NULL;
|
||||
|
||||
if (preset == NULL)
|
||||
return NULL;
|
||||
|
||||
if ((custom_wave = (custom_wave_t*)splay_find(&id, preset->custom_wave_tree)) == NULL) {
|
||||
|
||||
if (CUSTOM_WAVE_DEBUG) { printf("find_custom_wave: creating custom wave (id = %d)...", id);fflush(stdout);}
|
||||
|
||||
if (create_flag == FALSE) {
|
||||
if (CUSTOM_WAVE_DEBUG) printf("you specified not to (create flag = false), returning null\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if ((custom_wave = new_custom_wave(id)) == NULL) {
|
||||
if (CUSTOM_WAVE_DEBUG) printf("failed...out of memory?\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (CUSTOM_WAVE_DEBUG) {printf("success.Inserting..."); fflush(stdout);}
|
||||
|
||||
if (splay_insert(custom_wave, &custom_wave->id, preset->custom_wave_tree) < 0) {
|
||||
if (CUSTOM_WAVE_DEBUG) printf("failed!\n");
|
||||
free_custom_wave(custom_wave);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (CUSTOM_WAVE_DEBUG) printf("done.\n");
|
||||
}
|
||||
|
||||
return custom_wave;
|
||||
}
|
||||
|
||||
void evalCustomWaveInitConditions(preset_t *preset) {
|
||||
splay_traverse((void (*)(void*))eval_custom_wave_init_conds, preset->custom_wave_tree);
|
||||
}
|
||||
|
||||
void eval_custom_wave_init_conds(custom_wave_t * custom_wave) {
|
||||
|
||||
splay_traverse((void (*)(void*))eval_init_cond, custom_wave->per_frame_init_eqn_tree);
|
||||
}
|
||||
|
||||
/* Interface function. Makes another custom wave the current
|
||||
concern for per frame / point equations */
|
||||
custom_wave_t * nextCustomWave(preset_t *preset) {
|
||||
|
||||
if ((interface_wave = (custom_wave_t*)splay_find(&interface_id, preset->custom_wave_tree)) == NULL) {
|
||||
interface_id = 0;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
interface_id++;
|
||||
|
||||
/* Evaluate all per frame equations associated with this wave */
|
||||
splay_traverse((void (*)(void*))eval_init_cond, interface_wave->init_cond_tree);
|
||||
splay_traverse((void (*)(void*))eval_per_frame_eqn, interface_wave->per_frame_eqn_tree);
|
||||
return interface_wave;
|
||||
}
|
||||
|
||||
|
||||
void evalPerPointEqns(void *) {
|
||||
|
||||
int x;
|
||||
|
||||
for (x = 0; x < interface_wave->samples; x++)
|
||||
interface_wave->r_mesh[x] = interface_wave->r;
|
||||
for (x = 0; x < interface_wave->samples; x++)
|
||||
interface_wave->g_mesh[x] = interface_wave->g;
|
||||
for (x = 0; x < interface_wave->samples; x++)
|
||||
interface_wave->b_mesh[x] = interface_wave->b;
|
||||
for (x = 0; x < interface_wave->samples; x++)
|
||||
interface_wave->a_mesh[x] = interface_wave->a;
|
||||
for (x = 0; x < interface_wave->samples; x++)
|
||||
interface_wave->x_mesh[x] = interface_wave->x;
|
||||
for (x = 0; x < interface_wave->samples; x++)
|
||||
interface_wave->y_mesh[x] = interface_wave->y;
|
||||
|
||||
|
||||
/* Evaluate per pixel equations */
|
||||
splay_traverse((void (*)(void*))evalPerPointEqn, interface_wave->per_point_eqn_tree);
|
||||
|
||||
/* Reset index */
|
||||
mesh_i = -1;
|
||||
}
|
||||
|
||||
/* Evaluates a per point equation for the current custom wave given by interface_wave ptr */
|
||||
void evalPerPointEqn(per_point_eqn_t * per_point_eqn) {
|
||||
|
||||
|
||||
int samples, size;
|
||||
float * param_matrix;
|
||||
gen_expr_t * eqn_ptr;
|
||||
|
||||
samples = interface_wave->samples;
|
||||
eqn_ptr = per_point_eqn->gen_expr;
|
||||
|
||||
if (per_point_eqn->param->matrix == NULL) {
|
||||
if ((param_matrix = (float*) (per_point_eqn->param->matrix = wipemalloc(size = samples*sizeof(float)))) == NULL)
|
||||
return;
|
||||
memset(param_matrix, 0, size);
|
||||
}
|
||||
else
|
||||
param_matrix = (float*)per_point_eqn->param->matrix;
|
||||
|
||||
for (mesh_i = 0; mesh_i < samples; mesh_i++) {
|
||||
param_matrix[mesh_i] = eval_gen_expr(eqn_ptr);
|
||||
}
|
||||
|
||||
/* Now that this parameter has been referenced with a per
|
||||
point equation, we let the evaluator know by setting
|
||||
this flag */
|
||||
per_point_eqn->param->matrix_flag = 1;
|
||||
|
||||
}
|
||||
|
||||
|
||||
void load_unspecified_init_conds(custom_wave_t * custom_wave) {
|
||||
|
||||
interface_wave = custom_wave;
|
||||
splay_traverse((void (*)(void*))load_unspec_init_cond, interface_wave->param_tree);
|
||||
interface_wave = NULL;
|
||||
|
||||
}
|
||||
|
||||
void load_unspec_init_cond(param_t * param) {
|
||||
|
||||
init_cond_t * init_cond;
|
||||
value_t init_val;
|
||||
|
||||
/* Don't count these parameters as initial conditions */
|
||||
if (param->flags & P_FLAG_READONLY)
|
||||
return;
|
||||
if (param->flags & P_FLAG_QVAR)
|
||||
return;
|
||||
if (param->flags & P_FLAG_TVAR)
|
||||
return;
|
||||
if (param->flags & P_FLAG_USERDEF)
|
||||
return;
|
||||
|
||||
/* If initial condition was not defined by the preset file, force a default one
|
||||
with the following code */
|
||||
if ((init_cond = (init_cond_t*)splay_find(param->name, interface_wave->init_cond_tree)) == NULL) {
|
||||
|
||||
/* Make sure initial condition does not exist in the set of per frame initial equations */
|
||||
if ((init_cond = (init_cond_t*)splay_find(param->name, interface_wave->per_frame_init_eqn_tree)) != NULL)
|
||||
return;
|
||||
|
||||
if (param->type == P_TYPE_BOOL)
|
||||
init_val.bool_val = 0;
|
||||
|
||||
else if (param->type == P_TYPE_INT)
|
||||
init_val.int_val = *(int*)param->engine_val;
|
||||
|
||||
else if (param->type == P_TYPE_DOUBLE)
|
||||
init_val.float_val = *(float*)param->engine_val;
|
||||
|
||||
//printf("%s\n", param->name);
|
||||
/* Create new initial condition */
|
||||
if ((init_cond = new_init_cond(param, init_val)) == NULL)
|
||||
return;
|
||||
|
||||
/* Insert the initial condition into this presets tree */
|
||||
if (splay_insert(init_cond, init_cond->param->name, interface_wave->init_cond_tree) < 0) {
|
||||
free_init_cond(init_cond);
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
45
libprojectM/src/custom_wave.h
Executable file
45
libprojectM/src/custom_wave.h
Executable file
@ -0,0 +1,45 @@
|
||||
/**
|
||||
* projectM -- Milkdrop-esque visualisation SDK
|
||||
* Copyright (C)2003-2004 projectM Team
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
* See 'LICENSE.txt' included within this release
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _CUSTOM_WAVE_H
|
||||
#define _CUSTOM_WAVE_H
|
||||
|
||||
#define CUSTOM_WAVE_DEBUG 0
|
||||
|
||||
#include "expr_types.h"
|
||||
#include "custom_wave_types.h"
|
||||
#include "preset_types.h"
|
||||
|
||||
void free_custom_wave(custom_wave_t * custom_wave);
|
||||
custom_wave_t * new_custom_wave(int id);
|
||||
|
||||
void free_per_point_eqn(per_point_eqn_t * per_point_eqn);
|
||||
per_point_eqn_t * new_per_point_eqn(int index, param_t * param,gen_expr_t * gen_expr);
|
||||
void reset_per_point_eqn_array(custom_wave_t * custom_wave);
|
||||
custom_wave_t * find_custom_wave(int id, preset_t * preset, int create_flag);
|
||||
|
||||
int add_per_point_eqn(char * name, gen_expr_t * gen_expr, custom_wave_t * custom_wave);
|
||||
void evalCustomWaveInitConditions(preset_t *preset);
|
||||
void evalPerPointEqns(void*);
|
||||
custom_wave_t * nextCustomWave(preset_t *preset);
|
||||
void load_unspecified_init_conds(custom_wave_t * custom_wave);
|
||||
|
||||
#endif /** !_CUSTOM_WAVE_H */
|
||||
114
libprojectM/src/custom_wave_types.h
Executable file
114
libprojectM/src/custom_wave_types.h
Executable file
@ -0,0 +1,114 @@
|
||||
/**
|
||||
* projectM -- Milkdrop-esque visualisation SDK
|
||||
* Copyright (C)2003-2004 projectM Team
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
* See 'LICENSE.txt' included within this release
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _CUSTOM_WAVE_TYPES_H
|
||||
#define _CUSTOM_WAVE_TYPES_H
|
||||
|
||||
#include "common.h"
|
||||
#include "splaytree_types.h"
|
||||
#include "expr_types.h"
|
||||
|
||||
#define X_POINT_OP 0
|
||||
#define Y_POINT_OP 1
|
||||
#define R_POINT_OP 2
|
||||
#define G_POINT_OP 3
|
||||
#define B_POINT_OP 4
|
||||
#define A_POINT_OP 5
|
||||
#define NUM_POINT_OPS 6
|
||||
|
||||
typedef struct PER_POINT_EQN_T {
|
||||
int index;
|
||||
param_t * param;
|
||||
gen_expr_t * gen_expr;
|
||||
} per_point_eqn_t;
|
||||
|
||||
typedef struct CUSTOM_WAVE_T {
|
||||
|
||||
/* Numerical id */
|
||||
int id;
|
||||
int per_frame_count;
|
||||
|
||||
/* Parameter tree associated with this custom wave */
|
||||
splaytree_t * param_tree;
|
||||
|
||||
|
||||
/* Engine variables */
|
||||
|
||||
float x; /* x position for per point equations */
|
||||
float y; /* y position for per point equations */
|
||||
float r; /* red color value */
|
||||
float g; /* green color value */
|
||||
float b; /* blue color value */
|
||||
float a; /* alpha color value */
|
||||
float * x_mesh;
|
||||
float * y_mesh;
|
||||
float * r_mesh;
|
||||
float * b_mesh;
|
||||
float * g_mesh;
|
||||
float * a_mesh;
|
||||
float * value1;
|
||||
float * value2;
|
||||
float * sample_mesh;
|
||||
|
||||
int enabled; /* if nonzero then wave is visible, hidden otherwise */
|
||||
int samples; /* number of samples associated with this wave form. Usually powers of 2 */
|
||||
float sample;
|
||||
int bSpectrum; /* spectrum data or pcm data */
|
||||
int bUseDots; /* draw wave as dots or lines */
|
||||
int bDrawThick; /* draw thicker lines */
|
||||
int bAdditive; /* add color values together */
|
||||
|
||||
float scaling; /* scale factor of waveform */
|
||||
float smoothing; /* smooth factor of waveform */
|
||||
int sep; /* no idea what this is yet... */
|
||||
|
||||
/* stupid t variables */
|
||||
float t1;
|
||||
float t2;
|
||||
float t3;
|
||||
float t4;
|
||||
float t5;
|
||||
float t6;
|
||||
float t7;
|
||||
float t8;
|
||||
float v1,v2;
|
||||
/* Data structure to hold per frame and per point equations */
|
||||
splaytree_t * init_cond_tree;
|
||||
splaytree_t * per_frame_eqn_tree;
|
||||
splaytree_t * per_point_eqn_tree;
|
||||
splaytree_t * per_frame_init_eqn_tree;
|
||||
|
||||
/* Denotes the index of the last character for each string buffer */
|
||||
int per_point_eqn_string_index;
|
||||
int per_frame_eqn_string_index;
|
||||
int per_frame_init_eqn_string_index;
|
||||
|
||||
/* String buffers for per point and per frame equations */
|
||||
char per_point_eqn_string_buffer[STRING_BUFFER_SIZE];
|
||||
char per_frame_eqn_string_buffer[STRING_BUFFER_SIZE];
|
||||
char per_frame_init_eqn_string_buffer[STRING_BUFFER_SIZE];
|
||||
/* Per point equation array */
|
||||
gen_expr_t * per_point_eqn_array[NUM_POINT_OPS];
|
||||
|
||||
} custom_wave_t;
|
||||
|
||||
|
||||
#endif /** !_CUSTOM_WAVE_TYPES_H */
|
||||
872
libprojectM/src/editor.cc
Executable file
872
libprojectM/src/editor.cc
Executable file
@ -0,0 +1,872 @@
|
||||
/**
|
||||
* projectM -- Milkdrop-esque visualisation SDK
|
||||
* Copyright (C)2003-2004 projectM Team
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
* See 'LICENSE.txt' included within this release
|
||||
*
|
||||
*/
|
||||
/* Editor written on top of glConsole */
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "projectM.h"
|
||||
|
||||
#ifdef MACOS
|
||||
#include <gl.h>
|
||||
#else
|
||||
#include <GL/gl.h>
|
||||
#endif /** MACOS */
|
||||
#include "common.h"
|
||||
#include "fatal.h"
|
||||
#include "event.h"
|
||||
|
||||
#include "preset_types.h"
|
||||
#include "preset.h"
|
||||
|
||||
#include "glConsole.h"
|
||||
|
||||
#include "editor.h"
|
||||
#include "interface_types.h"
|
||||
|
||||
#define MAX_BUFFER_SIZE 50000
|
||||
#define KEY_REFRESH_RATE 2
|
||||
#define KEY_DELAY_TIME 15
|
||||
|
||||
extern preset_t *active_preset;
|
||||
extern interface_t current_interface;
|
||||
|
||||
typedef enum {
|
||||
OVERWRITE,
|
||||
INSERT
|
||||
} edit_mode_t;
|
||||
|
||||
edit_mode_t edit_mode = OVERWRITE;
|
||||
|
||||
void refresh_from_cursor(char * s);
|
||||
void save_cursor_pos();
|
||||
void restore_cursor_pos();
|
||||
void writeChar(char c);
|
||||
void replace_char(char c);
|
||||
void insert_char(char c);
|
||||
void shift_buffer_right();
|
||||
void insert_newline();
|
||||
void shift_buffer_left();
|
||||
void delete_newline();
|
||||
void complete_refresh();
|
||||
|
||||
void moveCursorLeft();
|
||||
void moveCursorRight();
|
||||
|
||||
int moveCursorUp();
|
||||
int moveCursorDown();
|
||||
|
||||
int get_prev_newline_dist();
|
||||
int get_next_newline_dist();
|
||||
int key_delay_cnt = 0;
|
||||
int move_to_next_newline();
|
||||
int move_to_prev_newline();
|
||||
void handle_home();
|
||||
void handle_end();
|
||||
void handle_pageup();
|
||||
void handle_pagedown();
|
||||
|
||||
gl_console_t * editor_console = NULL;
|
||||
int current_font = 0;
|
||||
char editor_buffer[MAX_BUFFER_SIZE];
|
||||
int key_refresh_cnt = 0;
|
||||
int cursor_pos = 0;
|
||||
int backup_pos = -1;
|
||||
int cursorx = 0;
|
||||
int cursory = 0;
|
||||
int key_held_down = 0;
|
||||
projectMKeycode last_sdl_key = (projectMKeycode) 0;
|
||||
projectMEvent last_sdl_event;
|
||||
|
||||
void (*callfunc)(void*, void*) = NULL;
|
||||
|
||||
int loadEditor(char * string, void (*func)(), int screen_width, int screen_height,
|
||||
int scroll_width, int scroll_height, float start_x, float start_y) {
|
||||
|
||||
if (string == NULL)
|
||||
return PROJECTM_FAILURE;
|
||||
|
||||
|
||||
|
||||
if ((editor_console =
|
||||
glConsoleCreate(screen_width, screen_height, scroll_width, scroll_height, start_x, start_y, current_font)) < 0)
|
||||
return PROJECTM_FAILURE;
|
||||
|
||||
/* Set colors */
|
||||
glConsoleSetFGColor(CONSOLE_GREEN, editor_console);
|
||||
glConsoleSetBGColor(CONSOLE_BLACK, editor_console);
|
||||
glConsoleSetCursorColor(CONSOLE_RED, editor_console);
|
||||
|
||||
/* Set flags */
|
||||
glConsoleSetFlags(CONSOLE_FLAG_CURSOR_BLINKING|CONSOLE_FLAG_ALWAYS_DRAW_BACKGROUND, editor_console);
|
||||
|
||||
/* Clear the console buffer */
|
||||
// glConsoleClearBuffer(editor_console);
|
||||
|
||||
/* Print the characters of the passed string, realign cursor to top left */
|
||||
glConsolePrintString(string, editor_console);
|
||||
glConsoleAlignCursorLeft(editor_console);
|
||||
glConsoleAlignCursorUp(editor_console);
|
||||
|
||||
/* Copy string into editor buffer */
|
||||
strncpy(editor_buffer, string, MAX_BUFFER_SIZE-1);
|
||||
cursor_pos = 0;
|
||||
|
||||
callfunc = (void (*)(void*, void*))func;
|
||||
backup_pos = -1;
|
||||
edit_mode = OVERWRITE;
|
||||
glConsoleSetCursorStyle(BAR_STYLE, editor_console);
|
||||
return PROJECTM_SUCCESS;
|
||||
}
|
||||
|
||||
int closeEditor() {
|
||||
|
||||
|
||||
current_font = 0;
|
||||
key_held_down = 0;
|
||||
|
||||
glConsoleDestroy(editor_console);
|
||||
editor_console = NULL;
|
||||
callfunc = NULL;
|
||||
return PROJECTM_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
void key_helper( projectMKeycode key, projectMEvent event, projectMModifier modifier) {
|
||||
char c;
|
||||
|
||||
switch(key) {
|
||||
case PROJECTM_K_INSERT:
|
||||
if (edit_mode == OVERWRITE) {
|
||||
edit_mode = INSERT;
|
||||
glConsoleSetCursorStyle(UNDERLINE_STYLE, editor_console);
|
||||
}
|
||||
else {
|
||||
edit_mode = OVERWRITE;
|
||||
glConsoleSetCursorStyle(BAR_STYLE, editor_console);
|
||||
}
|
||||
break;
|
||||
case PROJECTM_K_RETURN:
|
||||
if (modifier== PROJECTM_KMOD_LCTRL) {
|
||||
callfunc(editor_buffer, active_preset);
|
||||
}
|
||||
else {
|
||||
writeChar('\n');
|
||||
}
|
||||
break;
|
||||
case PROJECTM_K_LCTRL:
|
||||
break;
|
||||
case PROJECTM_K_RIGHT:
|
||||
moveCursorRight();
|
||||
// glConsoleMoveCursorForward(editor_console);
|
||||
break;
|
||||
case PROJECTM_K_LEFT:
|
||||
moveCursorLeft();
|
||||
// glConsoleMoveCursorBackward(editor_console);
|
||||
break;
|
||||
case PROJECTM_K_UP:
|
||||
moveCursorUp();
|
||||
break;
|
||||
case PROJECTM_K_DOWN:
|
||||
moveCursorDown();
|
||||
// glConsoleMoveCursorDown(editor_console);
|
||||
break;
|
||||
case PROJECTM_K_PAGEUP:
|
||||
handle_pageup();
|
||||
// glConsoleAlignCursorUp(editor_console);
|
||||
break;
|
||||
case PROJECTM_K_PAGEDOWN:
|
||||
handle_pagedown();
|
||||
// glConsoleAlignCursorDown(editor_console);
|
||||
break;
|
||||
case PROJECTM_K_HOME:
|
||||
handle_home();
|
||||
// glConsoleAlignCursorLeft(editor_console);
|
||||
break;
|
||||
case PROJECTM_K_END:
|
||||
handle_end();
|
||||
// glConsoleAlignCursorRight(editor_console);
|
||||
break;
|
||||
case PROJECTM_K_LSHIFT:
|
||||
break;
|
||||
case PROJECTM_K_RSHIFT:
|
||||
break;
|
||||
case PROJECTM_K_CAPSLOCK:
|
||||
break;
|
||||
case PROJECTM_K_BACKSPACE:
|
||||
writeChar('\b');
|
||||
break;
|
||||
|
||||
case PROJECTM_K_ESCAPE:
|
||||
closeEditor();
|
||||
current_interface = DEFAULT_INTERFACE;
|
||||
break;
|
||||
|
||||
default:
|
||||
/* All regular characters */
|
||||
c = (char)key;
|
||||
|
||||
writeChar(c);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void editor_key_handler( projectMEvent event, projectMKeycode keycode ) {
|
||||
|
||||
switch( event ) {
|
||||
|
||||
case PROJECTM_KEYUP:
|
||||
// printf("KEY UP\n");
|
||||
key_held_down = 0;
|
||||
return;
|
||||
|
||||
case PROJECTM_KEYDOWN:
|
||||
// printf("KEY DOWN FIRST\n");
|
||||
key_held_down = 1;
|
||||
last_sdl_key = keycode;
|
||||
last_sdl_event = event;
|
||||
key_helper(last_sdl_key, event, (projectMModifier)0);
|
||||
key_delay_cnt = KEY_DELAY_TIME;
|
||||
return;
|
||||
|
||||
default:
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
void refreshEditor() {
|
||||
|
||||
/* Refresh the editor console */
|
||||
glConsoleDraw(editor_console);
|
||||
|
||||
/* Update keyboard related events */
|
||||
if (key_delay_cnt > 0)
|
||||
key_delay_cnt--;
|
||||
else if ((key_held_down) && ((key_refresh_cnt % KEY_REFRESH_RATE) == 0)) {
|
||||
key_helper(last_sdl_key, last_sdl_event, (projectMModifier)0);
|
||||
}
|
||||
|
||||
key_refresh_cnt++;
|
||||
|
||||
}
|
||||
|
||||
void moveCursorRight() {
|
||||
|
||||
/* Out of bounds check */
|
||||
if (cursor_pos >= (MAX_BUFFER_SIZE-1))
|
||||
return;
|
||||
|
||||
if (editor_buffer[cursor_pos+1] == 0)
|
||||
return;
|
||||
|
||||
/* If we are at a new line character jump down to next line */
|
||||
if (editor_buffer[cursor_pos] == '\n') {
|
||||
glConsoleAlignCursorLeft(editor_console);
|
||||
glConsoleMoveCursorDown(editor_console);
|
||||
|
||||
}
|
||||
|
||||
/* Otherwise just advance cursor forward */
|
||||
else
|
||||
glConsoleMoveCursorForward(editor_console);
|
||||
|
||||
//printf("editor: %c\n", editor_buffer[cursor_pos]);
|
||||
/* Move cursor forward in editor buffer */
|
||||
cursor_pos++;
|
||||
|
||||
}
|
||||
|
||||
void moveCursorLeft() {
|
||||
|
||||
/* Out of bounds check */
|
||||
if (cursor_pos <= 0)
|
||||
return;
|
||||
|
||||
/* If the previous (left) character is a new line jump up a line and all the way to the end of character string */
|
||||
if (editor_buffer[cursor_pos-1] == '\n') {
|
||||
glConsoleMoveCursorUp(editor_console);
|
||||
glConsoleCursorToNextChar('\n', editor_console);
|
||||
}
|
||||
|
||||
/* Otherwise just move cursor back a space */
|
||||
else
|
||||
glConsoleMoveCursorBackward(editor_console);
|
||||
|
||||
/* Move cursor forward in editor buffer */
|
||||
cursor_pos--;
|
||||
|
||||
}
|
||||
|
||||
|
||||
int moveCursorUp() {
|
||||
|
||||
|
||||
int dist1, dist2;
|
||||
int return_flag = PROJECTM_SUCCESS;
|
||||
|
||||
/* We need this distance to:
|
||||
1) move the cursor back to the previous new line
|
||||
2) position the cursor at the same column on the previous line
|
||||
*/
|
||||
|
||||
/* Move cursor to previous newline character */
|
||||
if (cursor_pos == 0)
|
||||
return PROJECTM_FAILURE;
|
||||
|
||||
dist1 = move_to_prev_newline();
|
||||
|
||||
if (cursor_pos == 0)
|
||||
return_flag = PROJECTM_FAILURE;
|
||||
else {
|
||||
moveCursorLeft();
|
||||
/* Again move to previous newline */
|
||||
dist2 = move_to_prev_newline();
|
||||
}
|
||||
|
||||
/* Move cursor forward appropiately, stopping prematurely if new line is reached */
|
||||
while ((dist1 > 1) && (editor_buffer[cursor_pos] !='\n') && (cursor_pos <= (MAX_BUFFER_SIZE-1))) {
|
||||
cursor_pos++;
|
||||
glConsoleMoveCursorForward(editor_console);
|
||||
dist1--;
|
||||
}
|
||||
|
||||
return return_flag;
|
||||
}
|
||||
|
||||
|
||||
int moveCursorDown() {
|
||||
|
||||
int dist1, dist2;
|
||||
|
||||
dist2 = get_prev_newline_dist();
|
||||
|
||||
//printf("prev new line distance: %d\n", dist2);
|
||||
/* Move cursor to next line, store the distance
|
||||
away from the newline. If this distance is
|
||||
less than (error value) or equal to zero do nothing */
|
||||
if ((dist1 = move_to_next_newline()) <= 0) {
|
||||
return PROJECTM_FAILURE;
|
||||
}
|
||||
// printf("distance away from next newline: %d\n", dist1);
|
||||
while ((cursor_pos != (MAX_BUFFER_SIZE-1)) && (editor_buffer[cursor_pos] != '\n') && (dist2 > 0)) {
|
||||
cursor_pos++;
|
||||
glConsoleMoveCursorForward(editor_console);
|
||||
dist2--;
|
||||
}
|
||||
|
||||
return PROJECTM_SUCCESS;
|
||||
;
|
||||
}
|
||||
|
||||
int get_prev_newline_dist() {
|
||||
|
||||
int cnt = 0;
|
||||
|
||||
if (cursor_pos == 0)
|
||||
return 0;
|
||||
|
||||
/* If we are already at the newline, then skip the first character
|
||||
and increment cnt */
|
||||
if (editor_buffer[cursor_pos] == '\n') {
|
||||
/* Top of buffer, return 0 */
|
||||
if (cursor_pos == 0)
|
||||
return 0;
|
||||
/* Otherwise set count to one */
|
||||
cnt++;
|
||||
}
|
||||
while (editor_buffer[cursor_pos-cnt] != '\n') {
|
||||
|
||||
/* In this case we are the top of the editor buffer, so stop */
|
||||
if ((cursor_pos-cnt) <= 0)
|
||||
return cnt;
|
||||
|
||||
cnt++;
|
||||
|
||||
}
|
||||
|
||||
//printf("Returning %d\n", cnt-1);
|
||||
return cnt-1;
|
||||
}
|
||||
|
||||
|
||||
int get_next_newline_dist() {
|
||||
|
||||
int cnt = 0;
|
||||
|
||||
|
||||
while (editor_buffer[cursor_pos+cnt] != '\n') {
|
||||
|
||||
/* In this case we have exceeded the cursor buffer, so abort action */
|
||||
if ((cursor_pos+cnt) >= (MAX_BUFFER_SIZE-1))
|
||||
return 0;
|
||||
|
||||
cnt++;
|
||||
|
||||
}
|
||||
|
||||
return cnt;
|
||||
}
|
||||
|
||||
/* Moves cursor to next line, returns length away from next one.
|
||||
If this is the last line, returns 0.
|
||||
On error returns -1 (PROJECTM_FAILURE)
|
||||
*/
|
||||
|
||||
int move_to_next_newline() {
|
||||
|
||||
int cnt = 0;
|
||||
|
||||
|
||||
while (editor_buffer[cursor_pos+cnt] != '\n') {
|
||||
|
||||
/* In this case we have exceeded the cursor buffer, so abort action */
|
||||
if ((cursor_pos+cnt) >= (MAX_BUFFER_SIZE-1))
|
||||
return 0;
|
||||
|
||||
cnt++;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/* New line is the last character in buffer, so quit */
|
||||
if ((cursor_pos+cnt+1) > (MAX_BUFFER_SIZE-1))
|
||||
return 0;
|
||||
|
||||
if (editor_buffer[cursor_pos+cnt+1] == 0)
|
||||
return 0;
|
||||
|
||||
/* One more time to skip past new line character */
|
||||
cnt++;
|
||||
|
||||
/* Now we can move the cursor position accordingly */
|
||||
cursor_pos += cnt;
|
||||
|
||||
/* Now move the console cursor to beginning of next line
|
||||
These functions are smart enough to not exceed the console
|
||||
without bounds checking */
|
||||
glConsoleMoveCursorDown(editor_console);
|
||||
glConsoleAlignCursorLeft(editor_console);
|
||||
|
||||
/* Finally, return distance cursor was away from the new line */
|
||||
return cnt;
|
||||
}
|
||||
|
||||
/* Moves cursor to previous line, returns length away from previous one.
|
||||
If this is the first line, returns 0.
|
||||
On error returns -1 (PROJECTM_FAILURE)
|
||||
More specifically, the cursor will be exactly at the new line character
|
||||
of the previous line.
|
||||
Now its the beginning of the line, not the newline
|
||||
*/
|
||||
|
||||
int move_to_prev_newline() {
|
||||
|
||||
int cnt = 0;
|
||||
|
||||
if (editor_buffer[cursor_pos] == '\n') {
|
||||
if (cursor_pos == 0)
|
||||
return 0;
|
||||
else {
|
||||
cnt++;
|
||||
glConsoleMoveCursorBackward(editor_console);
|
||||
}
|
||||
}
|
||||
while (((cursor_pos - cnt) > -1) && (editor_buffer[cursor_pos-cnt] != '\n')) {
|
||||
|
||||
|
||||
glConsoleMoveCursorBackward(editor_console);
|
||||
|
||||
cnt++;
|
||||
|
||||
}
|
||||
|
||||
//for (i=0;i < cnt; i++)
|
||||
|
||||
|
||||
/* New line is the last character in buffer, so quit */
|
||||
// if ((cursor_pos-cnt-1) <= 0)
|
||||
// return 0;
|
||||
|
||||
|
||||
/* Now we can move the cursor position accordingly */
|
||||
cursor_pos -= cnt-1;
|
||||
|
||||
/* Now move the console cursor to end of previous line
|
||||
These functions are smart enough to not exceed the console
|
||||
without bounds checking */ ;
|
||||
// glConsoleMoveCursorUp(editor_console);
|
||||
// glConsoleCursorToNextChar('\n', editor_console);
|
||||
|
||||
/* Finally, return distance cursor was away from the new line */
|
||||
return cnt;
|
||||
|
||||
}
|
||||
|
||||
void handle_return() {
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
void handle_backspace() {
|
||||
|
||||
|
||||
}
|
||||
|
||||
void handle_home() {
|
||||
|
||||
while ((cursor_pos > 0) && (editor_buffer[cursor_pos-1] != '\n')) {
|
||||
cursor_pos--;
|
||||
}
|
||||
|
||||
glConsoleAlignCursorLeft(editor_console);
|
||||
|
||||
}
|
||||
|
||||
void handle_end() {
|
||||
|
||||
while ((cursor_pos < (MAX_BUFFER_SIZE-1)) && (editor_buffer[cursor_pos+1] != 0) && (editor_buffer[cursor_pos] != '\n')) {
|
||||
cursor_pos++;
|
||||
glConsoleMoveCursorForward(editor_console);
|
||||
}
|
||||
|
||||
// glConsoleCursorToNextChar('\n', editor_console);
|
||||
|
||||
}
|
||||
|
||||
void handle_pageup() {
|
||||
|
||||
int dist1;
|
||||
|
||||
dist1 = move_to_prev_newline();
|
||||
|
||||
while (cursor_pos != 0)
|
||||
moveCursorLeft();
|
||||
|
||||
while ((dist1 > 1) && (cursor_pos < (MAX_BUFFER_SIZE-1)) && (editor_buffer[cursor_pos+1] != 0) && (editor_buffer[cursor_pos] != '\n')) {
|
||||
cursor_pos++;
|
||||
glConsoleMoveCursorForward(editor_console);
|
||||
dist1--;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
void handle_pagedown() {
|
||||
|
||||
int dist1;
|
||||
|
||||
dist1 = get_prev_newline_dist();
|
||||
|
||||
while (cursor_pos < (MAX_BUFFER_SIZE-2) && (editor_buffer[cursor_pos+1] != 0))
|
||||
moveCursorRight();
|
||||
|
||||
move_to_prev_newline();
|
||||
moveCursorRight();
|
||||
|
||||
while ((dist1 > 1) && (cursor_pos < (MAX_BUFFER_SIZE-1)) && (editor_buffer[cursor_pos+1] != 0) && (editor_buffer[cursor_pos] != '\n')) {
|
||||
cursor_pos++;
|
||||
glConsoleMoveCursorForward(editor_console);
|
||||
dist1--;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/* Writes a character to console and editor according to editor mode */
|
||||
void writeChar(char c) {
|
||||
|
||||
switch (edit_mode) {
|
||||
/* Overwrite mode, replaces cursor character with passed character.
|
||||
Cursor remains standing */
|
||||
case OVERWRITE:
|
||||
|
||||
/* Case on c to catch special characters */
|
||||
switch (c) {
|
||||
|
||||
case '\b': /* Backspace */
|
||||
// printf("backspace case, overwrite mode:\n");
|
||||
/* At beginning of buffer, do nothing */
|
||||
if (cursor_pos == 0)
|
||||
return;
|
||||
|
||||
/* At first character of current line.
|
||||
Default behavior is to delete the new line,
|
||||
and squeeze the rest of the editor buffer back one character */
|
||||
if (editor_buffer[cursor_pos-1] == '\n') {
|
||||
delete_newline();
|
||||
return;
|
||||
}
|
||||
|
||||
/* Normal overwrite back space case.
|
||||
Here the previous character is replaced with a space,
|
||||
and the cursor moves back one */
|
||||
|
||||
editor_buffer[--cursor_pos]= ' ';
|
||||
(editor_console->cursor_ptr-1)->symbol = ' ';
|
||||
glConsoleMoveCursorBackward(editor_console);
|
||||
return;
|
||||
case '\n': /* New line character */
|
||||
insert_newline();
|
||||
return;
|
||||
default: /* not a special character, do typical behavior */
|
||||
// printf("DEFAULT CASE: char = %c\n", c);
|
||||
|
||||
/* If cursor is sitting on the new line, then we
|
||||
squeeze the pressed character between the last character
|
||||
and the new line */
|
||||
if (editor_buffer[cursor_pos] == '\n') {
|
||||
insert_char(c);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Otherwise, replace character in editor buffer */
|
||||
replace_char(c);
|
||||
return;
|
||||
}
|
||||
|
||||
return;
|
||||
|
||||
case INSERT: /* Insert Mode */
|
||||
switch (c) {
|
||||
case '\b': /* Backspace case */
|
||||
|
||||
|
||||
if (editor_buffer[cursor_pos-1] == '\n') {
|
||||
delete_newline();
|
||||
return;
|
||||
}
|
||||
|
||||
shift_buffer_left();
|
||||
cursor_pos--;
|
||||
glConsoleMoveCursorBackward(editor_console);
|
||||
refresh_from_cursor(editor_buffer+cursor_pos);
|
||||
return;
|
||||
|
||||
case '\n':
|
||||
insert_newline();
|
||||
return;
|
||||
|
||||
default:
|
||||
// printf("insert_char: char = %c\n", c);
|
||||
insert_char(c);
|
||||
return;
|
||||
}
|
||||
default: /* Shouldn't happen */
|
||||
return;
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
void delete_newline() {
|
||||
|
||||
|
||||
if (cursor_pos == 0)
|
||||
return;
|
||||
|
||||
/* Move console cursor to previous line's end of character */
|
||||
glConsoleMoveCursorUp(editor_console);
|
||||
glConsoleCursorToNextChar('\n', editor_console);
|
||||
|
||||
shift_buffer_left();
|
||||
cursor_pos--;
|
||||
|
||||
/* Lazy unoptimal refresh here */
|
||||
complete_refresh();
|
||||
return;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
/* Refreshes entire console but retains initial cursor position */
|
||||
void complete_refresh() {
|
||||
|
||||
int sx, sy;
|
||||
|
||||
glConsoleGetCursorPos(&sx, &sy, editor_console);
|
||||
|
||||
glConsoleSetCursorPos(0, 0, editor_console);
|
||||
|
||||
glConsoleClearBuffer(editor_console);
|
||||
glConsolePrintString(editor_buffer, editor_console);
|
||||
glConsoleSetCursorPos(sx, sy, editor_console);
|
||||
|
||||
|
||||
}
|
||||
/* Helper function to insert a newline and adjust the graphical console
|
||||
accordingly. Behavior is same regardless of edit mode type */
|
||||
void insert_newline() {
|
||||
|
||||
|
||||
/* End of buffer, deny request */
|
||||
if (cursor_pos == (MAX_BUFFER_SIZE-1))
|
||||
return;
|
||||
|
||||
shift_buffer_right();
|
||||
editor_buffer[cursor_pos] = '\n';
|
||||
|
||||
/* Lazy unoptimal refresh */
|
||||
complete_refresh();
|
||||
|
||||
cursor_pos++;
|
||||
glConsoleAlignCursorLeft(editor_console);
|
||||
glConsoleMoveCursorDown(editor_console);
|
||||
}
|
||||
|
||||
/* Helper function to insert a character. Updates the console and editor buffer
|
||||
by inserting character at cursor position with passed argument, and moving
|
||||
the cursor forward if possible */
|
||||
void insert_char(char c) {
|
||||
|
||||
/* End of editor buffer, just replace the character instead */
|
||||
if (cursor_pos == (MAX_BUFFER_SIZE-1)) {
|
||||
editor_buffer[cursor_pos] = c;
|
||||
editor_console->cursor_ptr->symbol = c;
|
||||
return;
|
||||
}
|
||||
|
||||
//printf("EDITOR BUFFER WAS:\n%s\n-----------------------------------\n", editor_buffer+cursor_pos);
|
||||
|
||||
/* Shift contents of editor buffer right */
|
||||
shift_buffer_right();
|
||||
|
||||
|
||||
/* Now place the passed character at the desired location */
|
||||
editor_buffer[cursor_pos] = c;
|
||||
|
||||
// printf("EDITOR BUFFER IS NOW:\n%s\n-----------------------------------\n", editor_buffer+cursor_pos);
|
||||
|
||||
/* Refresh console from current cursor position */
|
||||
refresh_from_cursor(editor_buffer+cursor_pos);
|
||||
|
||||
/* Move cursor forward */
|
||||
cursor_pos++;
|
||||
glConsoleMoveCursorForward(editor_console);
|
||||
|
||||
}
|
||||
|
||||
/* Helper function to replace a character. Updates the console and editor buffer
|
||||
by replacing character at cursor position with passed argument, and
|
||||
moving the cursor forward if possible */
|
||||
void replace_char(char c) {
|
||||
|
||||
/* End of buffer, replace character but dont go forward */
|
||||
if (cursor_pos == (MAX_BUFFER_SIZE-1)) {
|
||||
editor_buffer[cursor_pos] = c;
|
||||
editor_console->cursor_ptr->symbol = c;
|
||||
return;
|
||||
}
|
||||
|
||||
/* Replace character, move cursor forward one */
|
||||
editor_buffer[cursor_pos++] = c;
|
||||
editor_console->cursor_ptr->symbol = c;
|
||||
glConsoleMoveCursorForward(editor_console);
|
||||
|
||||
}
|
||||
|
||||
|
||||
void save_cursor_pos() {
|
||||
|
||||
backup_pos = cursor_pos;
|
||||
glConsoleGetCursorPos(&cursorx, &cursory, editor_console);
|
||||
// printf("cursor_x: %d, cursor_y: %d\n", cursorx, cursory);
|
||||
}
|
||||
|
||||
void restore_cursor_pos() {
|
||||
|
||||
if (backup_pos == -1)
|
||||
return;
|
||||
cursor_pos = backup_pos;
|
||||
glConsoleSetCursorPos(cursorx, cursory, editor_console);
|
||||
backup_pos = -1;
|
||||
}
|
||||
|
||||
/* Primarily for optimization, this function refreshs the editor console from the cursor position onward
|
||||
rather than the entire screen buffer */
|
||||
void refresh_from_cursor(char * s) {
|
||||
|
||||
if (s == NULL)
|
||||
return;
|
||||
|
||||
save_cursor_pos();
|
||||
glConsolePrintString(s, editor_console);
|
||||
restore_cursor_pos();
|
||||
}
|
||||
|
||||
|
||||
/* Shifts editor buffer right from current cursor position */
|
||||
void shift_buffer_right() {
|
||||
|
||||
int i;
|
||||
char backup, backup2;
|
||||
|
||||
if (cursor_pos == (MAX_BUFFER_SIZE-1))
|
||||
return;
|
||||
|
||||
backup = editor_buffer[cursor_pos];
|
||||
|
||||
for (i = cursor_pos; i < (MAX_BUFFER_SIZE-1); i++) {
|
||||
backup2 = editor_buffer[i+1];
|
||||
editor_buffer[i+1] = backup;
|
||||
backup = backup2;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* Shifts editor buffer left from current position */
|
||||
void shift_buffer_left() {
|
||||
|
||||
|
||||
int i;
|
||||
char backup, backup2;
|
||||
|
||||
if (cursor_pos == 0)
|
||||
return;
|
||||
|
||||
//printf("cursor at: %c\n", editor_buffer[cursor_pos]);
|
||||
backup = editor_buffer[MAX_BUFFER_SIZE-1];
|
||||
|
||||
//printf("shift_buffer_left: [before]\n%s\n", editor_buffer);
|
||||
|
||||
for (i = MAX_BUFFER_SIZE-1; i >= cursor_pos; i--) {
|
||||
backup2 = editor_buffer[i-1];
|
||||
editor_buffer[i-1] = backup;
|
||||
backup = backup2;
|
||||
}
|
||||
// printf("shift_buffer_left: [after]\n%s\n", editor_buffer);
|
||||
|
||||
}
|
||||
46
libprojectM/src/editor.h
Executable file
46
libprojectM/src/editor.h
Executable file
@ -0,0 +1,46 @@
|
||||
/**
|
||||
* projectM -- Milkdrop-esque visualisation SDK
|
||||
* Copyright (C)2003-2004 projectM Team
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
* See 'LICENSE.txt' included within this release
|
||||
*
|
||||
*/
|
||||
/**
|
||||
* $Id: editor.h,v 1.1.1.1 2005/12/23 18:05:00 psperl Exp $
|
||||
*
|
||||
* Editor
|
||||
*
|
||||
* $Log: editor.h,v $
|
||||
* Revision 1.1.1.1 2005/12/23 18:05:00 psperl
|
||||
* Imported
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _EDITOR_H
|
||||
#define _EDITOR_H
|
||||
|
||||
#include "event.h"
|
||||
|
||||
void editor_key_handler( projectMEvent event, projectMKeycode keycode );
|
||||
void key_helper( projectMKeycode key, projectMEvent event, projectMModifier modifier);
|
||||
int loadEditor(char * s, void (*func)(), int screen_width, int screen_height,
|
||||
int scroll_width, int scroll_height, float start_x, float start_y);
|
||||
int closeEditor();
|
||||
void refreshEditor();
|
||||
|
||||
|
||||
|
||||
#endif /** !_EDITOR_H */
|
||||
685
libprojectM/src/eval.cc
Executable file
685
libprojectM/src/eval.cc
Executable file
@ -0,0 +1,685 @@
|
||||
/**
|
||||
* projectM -- Milkdrop-esque visualisation SDK
|
||||
* Copyright (C)2003-2004 projectM Team
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
* See 'LICENSE.txt' included within this release
|
||||
*
|
||||
*/
|
||||
/* Evaluation Code */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "projectM.h"
|
||||
#include "common.h"
|
||||
#include "fatal.h"
|
||||
|
||||
#include "param_types.h"
|
||||
#include "func_types.h"
|
||||
#include "expr_types.h"
|
||||
#include "eval.h"
|
||||
#include "builtin_funcs.h"
|
||||
#include "wipemalloc.h"
|
||||
#define EVAL_ERROR -1
|
||||
|
||||
/* All infix operators (except '=') are prototyped here */
|
||||
infix_op_t * infix_add, * infix_minus, * infix_div, * infix_mult,
|
||||
* infix_or, * infix_and, * infix_mod, * infix_negative, * infix_positive;
|
||||
int mesh_i=-1, mesh_j=-1;
|
||||
|
||||
static inline float eval_tree_expr(tree_expr_t * tree_expr);
|
||||
static inline float eval_prefun_expr(prefun_expr_t * prefun_expr);
|
||||
static inline float eval_val_expr(val_expr_t * val_expr);
|
||||
|
||||
|
||||
float eval_gen_expr(gen_expr_t * gen_expr) {
|
||||
float l;
|
||||
|
||||
if (gen_expr == NULL)
|
||||
return 0;
|
||||
|
||||
switch(gen_expr->type) {
|
||||
case VAL_T:
|
||||
return eval_val_expr((val_expr_t*)(gen_expr->item));
|
||||
case PREFUN_T:
|
||||
l = eval_prefun_expr((prefun_expr_t*)(gen_expr->item));
|
||||
//if (EVAL_DEBUG) printf("eval_gen_expr: prefix function return value: %f\n", l);
|
||||
return l;
|
||||
case TREE_T:
|
||||
return eval_tree_expr((tree_expr_t*)(gen_expr->item));
|
||||
default:
|
||||
#ifdef EVAL_DEBUG
|
||||
printf("eval_gen_expr: general expression matched no cases!\n");
|
||||
#endif
|
||||
return EVAL_ERROR;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* Evaluates functions in prefix form */
|
||||
static inline float eval_prefun_expr(prefun_expr_t * prefun_expr) {
|
||||
|
||||
int i;
|
||||
float rv;
|
||||
|
||||
|
||||
/* This is slightly less than safe, since
|
||||
who knows if the passed argument is valid. For
|
||||
speed purposes we'll go with this */
|
||||
float *arg_list = (float *)wipemalloc( sizeof( float ) * prefun_expr->num_args );
|
||||
|
||||
#ifdef EVAL_DEBUG_DOUBLE
|
||||
printf("fn[");
|
||||
fflush(stdout);
|
||||
#endif
|
||||
/* Evaluate each argument before calling the function itself */
|
||||
for (i = 0; i < prefun_expr->num_args; i++) {
|
||||
arg_list[i] = eval_gen_expr(prefun_expr->expr_list[i]);
|
||||
#ifdef EVAL_DEBUG_DOUBLE
|
||||
if (i < (prefun_expr->num_args - 1))
|
||||
printf(", ");
|
||||
fflush(stdout);
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef EVAL_DEBUG_DOUBLE
|
||||
printf("]");
|
||||
fflush(stdout);
|
||||
#endif
|
||||
|
||||
/* Now we call the function, passing a list of
|
||||
floats as its argument */
|
||||
|
||||
rv = (prefun_expr->func_ptr)(arg_list);
|
||||
free( arg_list );
|
||||
arg_list = NULL;
|
||||
return rv;
|
||||
}
|
||||
|
||||
/* Evaluates a value expression */
|
||||
static inline float eval_val_expr(val_expr_t * val_expr) {
|
||||
|
||||
/* Shouldn't happen */
|
||||
if (val_expr == NULL)
|
||||
return EVAL_ERROR;
|
||||
|
||||
/* Value is a constant, return the float value */
|
||||
if (val_expr->type == CONSTANT_TERM_T) {
|
||||
#ifdef EVAL_DEBUG
|
||||
printf("%.4f", val_expr->term.constant);
|
||||
fflush(stdout);
|
||||
#endif
|
||||
return (val_expr->term.constant);
|
||||
}
|
||||
|
||||
/* Value is variable, dereference it */
|
||||
if (val_expr->type == PARAM_TERM_T) {
|
||||
switch (val_expr->term.param->type) {
|
||||
|
||||
case P_TYPE_BOOL:
|
||||
#ifdef EVAL_DEBUG
|
||||
printf("(%s:%.4f)", val_expr->term.param->name, (float)(*((int*)(val_expr->term.param->engine_val))));
|
||||
fflush(stdout);
|
||||
#endif
|
||||
|
||||
|
||||
return (float)(*((int*)(val_expr->term.param->engine_val)));
|
||||
case P_TYPE_INT:
|
||||
#ifdef EVAL_DEBUG
|
||||
printf("(%s:%.4f)", val_expr->term.param->name, (float)(*((int*)(val_expr->term.param->engine_val))));
|
||||
fflush(stdout);
|
||||
#endif
|
||||
|
||||
|
||||
return (float)(*((int*)(val_expr->term.param->engine_val)));
|
||||
case P_TYPE_DOUBLE:
|
||||
#ifdef EVAL_DEBUG_DOUBLE
|
||||
printf("(%s:%.4f)", val_expr->term.param->name, (*((float*)val_expr->term.param->engine_val)));
|
||||
fflush(stdout);
|
||||
#endif
|
||||
|
||||
if (val_expr->term.param->matrix_flag | (val_expr->term.param->flags & P_FLAG_ALWAYS_MATRIX)) {
|
||||
/** Sanity check the matrix is there... */
|
||||
if ( val_expr->term.param->matrix == NULL ) {
|
||||
printf( "param->matrix == NULL! [%s]\tmesh: %d x %d\n", val_expr->term.param->name, mesh_i, mesh_j );
|
||||
return EVAL_ERROR;
|
||||
}
|
||||
if (mesh_i >= 0) {
|
||||
if (mesh_j >= 0) {
|
||||
return (((float**)val_expr->term.param->matrix)[mesh_i][mesh_j]);
|
||||
} else {
|
||||
return (((float*)val_expr->term.param->matrix)[mesh_i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
return *((float*)(val_expr->term.param->engine_val));
|
||||
default:
|
||||
return EVAL_ERROR;
|
||||
}
|
||||
}
|
||||
/* Unknown type, return failure */
|
||||
return PROJECTM_FAILURE;
|
||||
}
|
||||
|
||||
/* Evaluates an expression tree */
|
||||
static inline float eval_tree_expr(tree_expr_t * tree_expr) {
|
||||
|
||||
float left_arg, right_arg;
|
||||
infix_op_t * infix_op;
|
||||
|
||||
/* Shouldn't happen */
|
||||
if (tree_expr == NULL)
|
||||
return EVAL_ERROR;
|
||||
|
||||
/* A leaf node, evaluate the general expression. If the expression is null as well, return zero */
|
||||
if (tree_expr->infix_op == NULL) {
|
||||
if (tree_expr->gen_expr == NULL)
|
||||
return 0;
|
||||
else
|
||||
return eval_gen_expr(tree_expr->gen_expr);
|
||||
}
|
||||
|
||||
/* Otherwise, this node is an infix operator. Evaluate
|
||||
accordingly */
|
||||
|
||||
infix_op = (infix_op_t*)tree_expr->infix_op;
|
||||
#ifdef EVAL_DEBUG
|
||||
printf("(");
|
||||
fflush(stdout);
|
||||
#endif
|
||||
|
||||
left_arg = eval_tree_expr(tree_expr->left);
|
||||
|
||||
#ifdef EVAL_DEBUG
|
||||
|
||||
switch (infix_op->type) {
|
||||
case INFIX_ADD:
|
||||
printf("+");
|
||||
break;
|
||||
case INFIX_MINUS:
|
||||
printf("-");
|
||||
break;
|
||||
case INFIX_MULT:
|
||||
printf("*");
|
||||
break;
|
||||
case INFIX_MOD:
|
||||
printf("%%");
|
||||
break;
|
||||
case INFIX_OR:
|
||||
printf("|");
|
||||
break;
|
||||
case INFIX_AND:
|
||||
printf("&");
|
||||
break;
|
||||
case INFIX_DIV:
|
||||
printf("/");
|
||||
break;
|
||||
default:
|
||||
printf("?");
|
||||
}
|
||||
|
||||
fflush(stdout);
|
||||
#endif
|
||||
|
||||
right_arg = eval_tree_expr(tree_expr->right);
|
||||
|
||||
#ifdef EVAL_DEBUG
|
||||
printf(")");
|
||||
fflush(stdout);
|
||||
#endif
|
||||
|
||||
switch (infix_op->type) {
|
||||
case INFIX_ADD:
|
||||
return (left_arg + right_arg);
|
||||
case INFIX_MINUS:
|
||||
return (left_arg - right_arg);
|
||||
case INFIX_MULT:
|
||||
return (left_arg * right_arg);
|
||||
case INFIX_MOD:
|
||||
if ((int)right_arg == 0) {
|
||||
#ifdef EVAL_DEBUG
|
||||
printf("eval_tree_expr: modulo zero!\n");
|
||||
#endif
|
||||
return PROJECTM_DIV_BY_ZERO;
|
||||
}
|
||||
return ((int)left_arg % (int)right_arg);
|
||||
case INFIX_OR:
|
||||
return ((int)left_arg | (int)right_arg);
|
||||
case INFIX_AND:
|
||||
return ((int)left_arg & (int)right_arg);
|
||||
case INFIX_DIV:
|
||||
if (right_arg == 0) {
|
||||
#ifdef EVAL_DEBUG
|
||||
printf("eval_tree_expr: division by zero!\n");
|
||||
#endif
|
||||
return MAX_DOUBLE_SIZE;
|
||||
}
|
||||
return (left_arg / right_arg);
|
||||
default:
|
||||
#ifdef EVAL_DEBUG
|
||||
printf("eval_tree_expr: unknown infix operator!\n");
|
||||
#endif
|
||||
return EVAL_ERROR;
|
||||
}
|
||||
|
||||
return EVAL_ERROR;
|
||||
}
|
||||
|
||||
/* Converts a float value to a general expression */
|
||||
gen_expr_t * const_to_expr(float val) {
|
||||
|
||||
gen_expr_t * gen_expr;
|
||||
val_expr_t * val_expr;
|
||||
term_t term;
|
||||
|
||||
term.constant = val;
|
||||
|
||||
if ((val_expr = new_val_expr(CONSTANT_TERM_T, term)) == NULL)
|
||||
return NULL;
|
||||
|
||||
gen_expr = new_gen_expr(VAL_T, (void*)val_expr);
|
||||
|
||||
if (gen_expr == NULL) {
|
||||
free_val_expr(val_expr);
|
||||
}
|
||||
|
||||
return gen_expr;
|
||||
}
|
||||
|
||||
/* Converts a regular parameter to an expression */
|
||||
gen_expr_t * param_to_expr(param_t * param) {
|
||||
|
||||
gen_expr_t * gen_expr = NULL;
|
||||
val_expr_t * val_expr = NULL;
|
||||
term_t term;
|
||||
|
||||
if (param == NULL)
|
||||
return NULL;
|
||||
|
||||
/* This code is still a work in progress. We need
|
||||
to figure out if the initial condition is used for
|
||||
each per frame equation or not. I am guessing that
|
||||
it isn't, and it is thusly implemented this way */
|
||||
|
||||
/* Current guess of true behavior (08/01/03) note from carm
|
||||
First try to use the per_pixel_expr (with cloning).
|
||||
If it is null however, use the engine variable instead. */
|
||||
|
||||
/* 08/20/03 : Presets are now objects, as well as per pixel equations. This ends up
|
||||
making the parser handle the case where parameters are essentially per pixel equation
|
||||
substitutions */
|
||||
|
||||
|
||||
term.param = param;
|
||||
if ((val_expr = new_val_expr(PARAM_TERM_T, term)) == NULL)
|
||||
return NULL;
|
||||
|
||||
if ((gen_expr = new_gen_expr(VAL_T, (void*)val_expr)) == NULL) {
|
||||
free_val_expr(val_expr);
|
||||
return NULL;
|
||||
}
|
||||
return gen_expr;
|
||||
}
|
||||
|
||||
/* Converts a prefix function to an expression */
|
||||
gen_expr_t * prefun_to_expr(float (*func_ptr)(), gen_expr_t ** expr_list, int num_args) {
|
||||
|
||||
gen_expr_t * gen_expr;
|
||||
prefun_expr_t * prefun_expr;
|
||||
|
||||
|
||||
/* Malloc a new prefix function expression */
|
||||
prefun_expr = (prefun_expr_t*)wipemalloc(sizeof(prefun_expr_t));
|
||||
|
||||
if (prefun_expr == NULL)
|
||||
return NULL;
|
||||
|
||||
prefun_expr->num_args = num_args;
|
||||
prefun_expr->func_ptr =(float (*)(void*)) func_ptr;
|
||||
prefun_expr->expr_list = expr_list;
|
||||
|
||||
gen_expr = new_gen_expr(PREFUN_T, (void*)prefun_expr);
|
||||
|
||||
if (gen_expr == NULL)
|
||||
free_prefun_expr(prefun_expr);
|
||||
|
||||
return gen_expr;
|
||||
}
|
||||
|
||||
/* Creates a new tree expression */
|
||||
tree_expr_t * new_tree_expr(infix_op_t * infix_op, gen_expr_t * gen_expr, tree_expr_t * left, tree_expr_t * right) {
|
||||
|
||||
tree_expr_t * tree_expr;
|
||||
tree_expr = (tree_expr_t*)wipemalloc(sizeof(tree_expr_t));
|
||||
|
||||
if (tree_expr == NULL)
|
||||
return NULL;
|
||||
tree_expr->infix_op = infix_op;
|
||||
tree_expr->gen_expr = gen_expr;
|
||||
tree_expr->left = left;
|
||||
tree_expr->right = right;
|
||||
return tree_expr;
|
||||
}
|
||||
|
||||
|
||||
/* Creates a new value expression */
|
||||
val_expr_t * new_val_expr(int type, term_t term) {
|
||||
|
||||
val_expr_t * val_expr;
|
||||
val_expr = (val_expr_t*)wipemalloc(sizeof(val_expr_t));
|
||||
|
||||
if (val_expr == NULL)
|
||||
return NULL;
|
||||
|
||||
val_expr->type = type;
|
||||
val_expr->term = term;
|
||||
|
||||
return val_expr;
|
||||
}
|
||||
|
||||
/* Creates a new general expression */
|
||||
gen_expr_t * new_gen_expr(int type, void * item) {
|
||||
|
||||
gen_expr_t * gen_expr;
|
||||
|
||||
gen_expr = (gen_expr_t*)wipemalloc(sizeof(gen_expr_t));
|
||||
if (gen_expr == NULL)
|
||||
return NULL;
|
||||
gen_expr->type = type;
|
||||
gen_expr->item = item;
|
||||
|
||||
return gen_expr;
|
||||
}
|
||||
|
||||
/* Frees a general expression */
|
||||
int free_gen_expr(gen_expr_t * gen_expr) {
|
||||
|
||||
if (gen_expr == NULL)
|
||||
return PROJECTM_SUCCESS;
|
||||
|
||||
switch (gen_expr->type) {
|
||||
case VAL_T:
|
||||
free_val_expr((val_expr_t*)(gen_expr->item));
|
||||
break;
|
||||
case PREFUN_T:
|
||||
free_prefun_expr((prefun_expr_t*)(gen_expr->item));
|
||||
break;
|
||||
case TREE_T:
|
||||
free_tree_expr((tree_expr_t*)(gen_expr->item));
|
||||
break;
|
||||
default:
|
||||
return PROJECTM_FAILURE;
|
||||
}
|
||||
|
||||
free(gen_expr);
|
||||
gen_expr = NULL;
|
||||
return PROJECTM_SUCCESS;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/* Frees a function in prefix notation */
|
||||
int free_prefun_expr(prefun_expr_t * prefun_expr) {
|
||||
|
||||
int i;
|
||||
if (prefun_expr == NULL)
|
||||
return PROJECTM_SUCCESS;
|
||||
|
||||
/* Free every element in expression list */
|
||||
for (i = 0 ; i < prefun_expr->num_args; i++) {
|
||||
free_gen_expr(prefun_expr->expr_list[i]);
|
||||
}
|
||||
free(prefun_expr->expr_list);
|
||||
free(prefun_expr);
|
||||
prefun_expr = NULL;
|
||||
return PROJECTM_SUCCESS;
|
||||
}
|
||||
|
||||
/* Frees values of type VARIABLE and CONSTANT */
|
||||
int free_val_expr(val_expr_t * val_expr) {
|
||||
|
||||
if (val_expr == NULL)
|
||||
return PROJECTM_SUCCESS;
|
||||
|
||||
free(val_expr);
|
||||
val_expr = NULL;
|
||||
return PROJECTM_SUCCESS;
|
||||
}
|
||||
|
||||
/* Frees a tree expression */
|
||||
int free_tree_expr(tree_expr_t * tree_expr) {
|
||||
|
||||
if (tree_expr == NULL)
|
||||
return PROJECTM_SUCCESS;
|
||||
|
||||
/* free left tree */
|
||||
free_tree_expr(tree_expr->left);
|
||||
|
||||
/* free general expression object */
|
||||
free_gen_expr(tree_expr->gen_expr);
|
||||
|
||||
/* Note that infix operators are always
|
||||
stored in memory unless the program
|
||||
exits, so we don't remove them here */
|
||||
|
||||
/* free right tree */
|
||||
free_tree_expr(tree_expr->right);
|
||||
|
||||
|
||||
/* finally, free the struct itself */
|
||||
free(tree_expr);
|
||||
tree_expr = NULL;
|
||||
return PROJECTM_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Initializes all infix operators */
|
||||
int init_infix_ops() {
|
||||
|
||||
infix_add = new_infix_op(INFIX_ADD, 4);
|
||||
infix_minus = new_infix_op(INFIX_MINUS, 3);
|
||||
infix_div = new_infix_op(INFIX_DIV, 2);
|
||||
infix_or = new_infix_op(INFIX_OR, 5);
|
||||
infix_and = new_infix_op(INFIX_AND,4);
|
||||
infix_mod = new_infix_op(INFIX_MOD, 1);
|
||||
infix_mult = new_infix_op(INFIX_MULT, 2);
|
||||
|
||||
/* Prefix operators */
|
||||
infix_positive = new_infix_op(INFIX_ADD, 0);
|
||||
infix_negative = new_infix_op(INFIX_MINUS, 0);
|
||||
|
||||
return PROJECTM_SUCCESS;
|
||||
}
|
||||
|
||||
/* Destroys the infix operator list. This should
|
||||
be done on program exit */
|
||||
int destroy_infix_ops()
|
||||
{
|
||||
|
||||
free(infix_add);
|
||||
free(infix_minus);
|
||||
free(infix_div);
|
||||
free(infix_or);
|
||||
free(infix_and);
|
||||
free(infix_mod);
|
||||
free(infix_mult);
|
||||
free(infix_positive);
|
||||
free(infix_negative);
|
||||
|
||||
infix_add = NULL;
|
||||
infix_minus = NULL;
|
||||
infix_div = NULL;
|
||||
infix_or = NULL;
|
||||
infix_and = NULL;
|
||||
infix_mod = NULL;
|
||||
infix_mult = NULL;
|
||||
infix_positive = NULL;
|
||||
infix_negative = NULL;
|
||||
|
||||
return PROJECTM_SUCCESS;
|
||||
}
|
||||
|
||||
/* Initializes an infix operator */
|
||||
infix_op_t * new_infix_op(int type, int precedence) {
|
||||
|
||||
infix_op_t * infix_op;
|
||||
|
||||
infix_op = (infix_op_t*)wipemalloc(sizeof(infix_op_t));
|
||||
|
||||
if (infix_op == NULL)
|
||||
return NULL;
|
||||
|
||||
infix_op->type = type;
|
||||
infix_op->precedence = precedence;
|
||||
|
||||
return infix_op;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/* Clones a general expression */
|
||||
gen_expr_t * clone_gen_expr(gen_expr_t * gen_expr) {
|
||||
|
||||
gen_expr_t * new_gen_expr;
|
||||
val_expr_t * val_expr;
|
||||
tree_expr_t * tree_expr;
|
||||
prefun_expr_t * prefun_expr;
|
||||
|
||||
/* Null argument check */
|
||||
if (gen_expr == NULL)
|
||||
return NULL;
|
||||
|
||||
/* Out of memory */
|
||||
if ((new_gen_expr = (gen_expr_t*)wipemalloc(sizeof(gen_expr_t))) == NULL)
|
||||
return NULL;
|
||||
|
||||
/* Case on the type of general expression */
|
||||
switch (new_gen_expr->type = gen_expr->type) {
|
||||
|
||||
case VAL_T: /* val expression */
|
||||
if ((val_expr = clone_val_expr((val_expr_t*)gen_expr->item)) == NULL) {
|
||||
free(new_gen_expr);
|
||||
new_gen_expr = NULL;
|
||||
return NULL;
|
||||
}
|
||||
new_gen_expr->item = (void*)val_expr;
|
||||
break;
|
||||
|
||||
case PREFUN_T: /* prefix function expression */
|
||||
if ((prefun_expr = clone_prefun_expr((prefun_expr_t*)gen_expr->item)) == NULL) {
|
||||
free(new_gen_expr);
|
||||
new_gen_expr = NULL;
|
||||
return NULL;
|
||||
}
|
||||
new_gen_expr->item = (void*)prefun_expr;
|
||||
break;
|
||||
|
||||
case TREE_T: /* tree expression */
|
||||
if ((tree_expr = clone_tree_expr((tree_expr_t*)gen_expr->item)) == NULL) {
|
||||
free(new_gen_expr);
|
||||
new_gen_expr = NULL;
|
||||
return NULL;
|
||||
}
|
||||
new_gen_expr->item = (void*)tree_expr;
|
||||
break;
|
||||
|
||||
default: /* unknown type, ut oh.. */
|
||||
free(new_gen_expr);
|
||||
new_gen_expr = NULL;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return new_gen_expr; /* Return the new (cloned) general expression */
|
||||
}
|
||||
|
||||
|
||||
/* Clones a tree expression */
|
||||
tree_expr_t * clone_tree_expr(tree_expr_t * tree_expr) {
|
||||
|
||||
tree_expr_t * new_tree_expr;
|
||||
|
||||
/* Null argument */
|
||||
if (tree_expr == NULL)
|
||||
return NULL;
|
||||
|
||||
/* Out of memory */
|
||||
if ((new_tree_expr = (tree_expr_t*)wipemalloc(sizeof(tree_expr_t))) == NULL)
|
||||
return NULL;
|
||||
|
||||
/* Set each argument in tree_expr_t struct */
|
||||
new_tree_expr->infix_op = tree_expr->infix_op; /* infix operators are in shared memory */
|
||||
new_tree_expr->gen_expr = clone_gen_expr(tree_expr->gen_expr); /* clone the general expression */
|
||||
new_tree_expr->left = clone_tree_expr(tree_expr->left); /* clone the left tree expression */
|
||||
new_tree_expr->right = clone_tree_expr(tree_expr->right); /* clone the right tree expression */
|
||||
|
||||
return new_tree_expr; /* Return the new (cloned) tree expression */
|
||||
}
|
||||
|
||||
/* Clones a value expression, currently only passes the pointer to
|
||||
the value that this object represents, not a pointer to a copy of the value */
|
||||
val_expr_t * clone_val_expr(val_expr_t * val_expr) {
|
||||
|
||||
val_expr_t * new_val_expr;
|
||||
|
||||
/* Null argument */
|
||||
if (val_expr == NULL)
|
||||
return NULL;
|
||||
|
||||
/* Allocate space, check for out of memory */
|
||||
if ((new_val_expr = (val_expr_t*)wipemalloc(sizeof(val_expr_t))) == NULL)
|
||||
return NULL;
|
||||
|
||||
/* Set the values in the val_expr_t struct */
|
||||
new_val_expr->type = val_expr->type;
|
||||
new_val_expr->term = val_expr->term;
|
||||
|
||||
/* Return the new (cloned) value expression */
|
||||
return new_val_expr;
|
||||
}
|
||||
|
||||
/* Clones a prefix function with its arguments */
|
||||
prefun_expr_t * clone_prefun_expr(prefun_expr_t * prefun_expr) {
|
||||
|
||||
int i;
|
||||
prefun_expr_t * new_prefun_expr;
|
||||
|
||||
/* Null argument */
|
||||
if (prefun_expr == NULL)
|
||||
return NULL;
|
||||
|
||||
/* Out of memory */
|
||||
if ((new_prefun_expr = (prefun_expr_t*)wipemalloc(sizeof(prefun_expr_t))) == NULL)
|
||||
return NULL;
|
||||
|
||||
/* Set the function argument paired with its number of arguments */
|
||||
new_prefun_expr->num_args = prefun_expr->num_args;
|
||||
new_prefun_expr->func_ptr = prefun_expr->func_ptr;
|
||||
|
||||
/* Allocate space for the expression list pointers */
|
||||
if ((new_prefun_expr->expr_list = (gen_expr_t**)wipemalloc(sizeof(gen_expr_t*)*new_prefun_expr->num_args)) == NULL) {
|
||||
free(new_prefun_expr);
|
||||
new_prefun_expr = NULL;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Now copy each general expression from the argument expression list */
|
||||
for (i = 0; i < new_prefun_expr->num_args;i++)
|
||||
new_prefun_expr->expr_list[i] = clone_gen_expr(prefun_expr->expr_list[i]);
|
||||
|
||||
/* Finally, return the new (cloned) prefix function expression */
|
||||
return new_prefun_expr;
|
||||
}
|
||||
78
libprojectM/src/eval.h
Executable file
78
libprojectM/src/eval.h
Executable file
@ -0,0 +1,78 @@
|
||||
/**
|
||||
* projectM -- Milkdrop-esque visualisation SDK
|
||||
* Copyright (C)2003-2004 projectM Team
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
* See 'LICENSE.txt' included within this release
|
||||
*
|
||||
*/
|
||||
|
||||
/* eval.h: evaluation functions of expressions */
|
||||
#ifndef _EVAL_H
|
||||
#define _EVAL_H
|
||||
|
||||
#include "projectM.h"
|
||||
#include "func_types.h"
|
||||
#include "param_types.h"
|
||||
|
||||
//#define EVAL_DEBUG 0
|
||||
//#define EVAL_DEBUG_DOUBLE 2
|
||||
|
||||
#define VAL_T 1
|
||||
#define PREFUN_T 3
|
||||
#define TREE_T 4
|
||||
#define NONE_T 0
|
||||
|
||||
|
||||
#define CONSTANT_TERM_T 0
|
||||
#define PARAM_TERM_T 1
|
||||
|
||||
#define INFIX_ADD 0
|
||||
#define INFIX_MINUS 1
|
||||
#define INFIX_MOD 2
|
||||
#define INFIX_DIV 3
|
||||
#define INFIX_MULT 4
|
||||
#define INFIX_OR 5
|
||||
#define INFIX_AND 6
|
||||
|
||||
float eval_gen_expr(gen_expr_t * gen_expr);
|
||||
inline gen_expr_t * opt_gen_expr(gen_expr_t * gen_expr, int ** param_list);
|
||||
|
||||
gen_expr_t * const_to_expr(float val);
|
||||
gen_expr_t * param_to_expr(struct PARAM_T * param);
|
||||
gen_expr_t * prefun_to_expr(float (*func_ptr)(), gen_expr_t ** expr_list, int num_args);
|
||||
|
||||
tree_expr_t * new_tree_expr(infix_op_t * infix_op, gen_expr_t * gen_expr, tree_expr_t * left, tree_expr_t * right);
|
||||
gen_expr_t * new_gen_expr(int type, void * item);
|
||||
val_expr_t * new_val_expr(int type, term_t term);
|
||||
|
||||
int free_gen_expr(gen_expr_t * gen_expr);
|
||||
int free_prefun_expr(prefun_expr_t * prefun_expr);
|
||||
int free_tree_expr(tree_expr_t * tree_expr);
|
||||
int free_val_expr(val_expr_t * val_expr);
|
||||
|
||||
infix_op_t * new_infix_op(int type, int precedence);
|
||||
int init_infix_ops();
|
||||
int destroy_infix_ops();
|
||||
void reset_engine_vars();
|
||||
|
||||
gen_expr_t * clone_gen_expr(gen_expr_t * gen_expr);
|
||||
tree_expr_t * clone_tree_expr(tree_expr_t * tree_expr);
|
||||
val_expr_t * clone_val_expr(val_expr_t * val_expr);
|
||||
prefun_expr_t * clone_prefun_expr(prefun_expr_t * prefun_expr);
|
||||
|
||||
|
||||
|
||||
#endif /** !_EVAL_H */
|
||||
155
libprojectM/src/event.h
Executable file
155
libprojectM/src/event.h
Executable file
@ -0,0 +1,155 @@
|
||||
/**
|
||||
* projectM -- Milkdrop-esque visualisation SDK
|
||||
* Copyright (C)2003-2004 projectM Team
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
* See 'LICENSE.txt' included within this release
|
||||
*
|
||||
*/
|
||||
/**
|
||||
* $Id: event.h,v 1.1.1.1 2005/12/23 18:05:03 psperl Exp $
|
||||
*
|
||||
* projectM keycodes. Enables translation from various event schemes such as Win32, SDL
|
||||
* &c.
|
||||
*
|
||||
* $Log: event.h,v $
|
||||
* Revision 1.1.1.1 2005/12/23 18:05:03 psperl
|
||||
* Imported
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _PROJECTM_EVENT_H
|
||||
#define _PROJECTM_EVENT_H
|
||||
|
||||
typedef enum {
|
||||
/** Event types */
|
||||
PROJECTM_KEYUP,
|
||||
PROJECTM_KEYDOWN,
|
||||
PROJECTM_VIDEORESIZE,
|
||||
PROJECTM_VIDEOQUIT,
|
||||
PROJECTM_NONE,
|
||||
} projectMEvent;
|
||||
|
||||
typedef enum {
|
||||
/** Keycodes */
|
||||
PROJECTM_K_RETURN,
|
||||
PROJECTM_K_RIGHT,
|
||||
PROJECTM_K_LEFT,
|
||||
PROJECTM_K_UP,
|
||||
PROJECTM_K_DOWN,
|
||||
PROJECTM_K_PAGEUP,
|
||||
PROJECTM_K_PAGEDOWN,
|
||||
PROJECTM_K_INSERT,
|
||||
PROJECTM_K_DELETE,
|
||||
PROJECTM_K_ESCAPE,
|
||||
PROJECTM_K_LSHIFT,
|
||||
PROJECTM_K_RSHIFT,
|
||||
PROJECTM_K_CAPSLOCK,
|
||||
PROJECTM_K_LCTRL,
|
||||
PROJECTM_K_HOME,
|
||||
PROJECTM_K_END,
|
||||
PROJECTM_K_BACKSPACE,
|
||||
|
||||
PROJECTM_K_F1,
|
||||
PROJECTM_K_F2,
|
||||
PROJECTM_K_F3,
|
||||
PROJECTM_K_F4,
|
||||
PROJECTM_K_F5,
|
||||
PROJECTM_K_F6,
|
||||
PROJECTM_K_F7,
|
||||
PROJECTM_K_F8,
|
||||
PROJECTM_K_F9,
|
||||
PROJECTM_K_F10,
|
||||
PROJECTM_K_F11,
|
||||
PROJECTM_K_F12,
|
||||
|
||||
PROJECTM_K_0 = 48,
|
||||
PROJECTM_K_1,
|
||||
PROJECTM_K_2,
|
||||
PROJECTM_K_3,
|
||||
PROJECTM_K_4,
|
||||
PROJECTM_K_5,
|
||||
PROJECTM_K_6,
|
||||
PROJECTM_K_7,
|
||||
PROJECTM_K_8,
|
||||
PROJECTM_K_9,
|
||||
|
||||
PROJECTM_K_A = 65,
|
||||
PROJECTM_K_B,
|
||||
PROJECTM_K_C,
|
||||
PROJECTM_K_D,
|
||||
PROJECTM_K_E,
|
||||
PROJECTM_K_F,
|
||||
PROJECTM_K_G,
|
||||
PROJECTM_K_H,
|
||||
PROJECTM_K_I,
|
||||
PROJECTM_K_J,
|
||||
PROJECTM_K_K,
|
||||
PROJECTM_K_L,
|
||||
PROJECTM_K_M,
|
||||
PROJECTM_K_N,
|
||||
PROJECTM_K_O,
|
||||
PROJECTM_K_P,
|
||||
PROJECTM_K_Q,
|
||||
PROJECTM_K_R,
|
||||
PROJECTM_K_S,
|
||||
PROJECTM_K_T,
|
||||
PROJECTM_K_U,
|
||||
PROJECTM_K_V,
|
||||
PROJECTM_K_W,
|
||||
PROJECTM_K_X,
|
||||
PROJECTM_K_Y,
|
||||
PROJECTM_K_Z,
|
||||
|
||||
PROJECTM_K_a = 97,
|
||||
PROJECTM_K_b,
|
||||
PROJECTM_K_c,
|
||||
PROJECTM_K_d,
|
||||
PROJECTM_K_e,
|
||||
PROJECTM_K_f,
|
||||
PROJECTM_K_g,
|
||||
PROJECTM_K_h,
|
||||
PROJECTM_K_i,
|
||||
PROJECTM_K_j,
|
||||
PROJECTM_K_k,
|
||||
PROJECTM_K_l,
|
||||
PROJECTM_K_m,
|
||||
PROJECTM_K_n,
|
||||
PROJECTM_K_o,
|
||||
PROJECTM_K_p,
|
||||
PROJECTM_K_q,
|
||||
PROJECTM_K_r,
|
||||
PROJECTM_K_s,
|
||||
PROJECTM_K_t,
|
||||
PROJECTM_K_u,
|
||||
PROJECTM_K_v,
|
||||
PROJECTM_K_w,
|
||||
PROJECTM_K_x,
|
||||
PROJECTM_K_y,
|
||||
PROJECTM_K_z,
|
||||
PROJECTM_K_NONE,
|
||||
} projectMKeycode;
|
||||
|
||||
typedef enum {
|
||||
/** Modifiers */
|
||||
PROJECTM_KMOD_LSHIFT,
|
||||
PROJECTM_KMOD_RSHIFT,
|
||||
PROJECTM_KMOD_CAPS,
|
||||
PROJECTM_KMOD_LCTRL,
|
||||
PROJECTM_KMOD_RCTRL,
|
||||
} projectMModifier;
|
||||
|
||||
#endif /** !_PROJECTM_EVENT_H */
|
||||
|
||||
70
libprojectM/src/expr_types.h
Executable file
70
libprojectM/src/expr_types.h
Executable file
@ -0,0 +1,70 @@
|
||||
/**
|
||||
* projectM -- Milkdrop-esque visualisation SDK
|
||||
* Copyright (C)2003-2004 projectM Team
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
* See 'LICENSE.txt' included within this release
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _EXPR_TYPES_H
|
||||
#define _EXPR_TYPES_H
|
||||
|
||||
#include "param_types.h"
|
||||
|
||||
#define CONST_STACK_ELEMENT 0
|
||||
#define EXPR_STACK_ELEMENT 1
|
||||
|
||||
/* General Expression Type */
|
||||
typedef struct GEN_EXPR_T {
|
||||
int type;
|
||||
void * item;
|
||||
} gen_expr_t;
|
||||
|
||||
typedef union TERM_T {
|
||||
float constant; /* static variable */
|
||||
struct PARAM_T * param; /* pointer to a changing variable */
|
||||
} term_t;
|
||||
|
||||
/* Value expression, contains a term union */
|
||||
typedef struct VAL_EXPR_T {
|
||||
int type;
|
||||
term_t term;
|
||||
} val_expr_t;
|
||||
|
||||
/* Infix Operator Function */
|
||||
typedef struct INFIX_OP_T {
|
||||
int type;
|
||||
int precedence;
|
||||
} infix_op_t;
|
||||
|
||||
/* A binary expression tree ordered by operator precedence */
|
||||
typedef struct TREE_EXPR_T {
|
||||
infix_op_t * infix_op; /* null if leaf */
|
||||
gen_expr_t * gen_expr;
|
||||
struct TREE_EXPR_T * left, * right;
|
||||
} tree_expr_t;
|
||||
|
||||
/* A function expression in prefix form */
|
||||
typedef struct PREFUN_EXPR_T {
|
||||
float (*func_ptr)(void*);
|
||||
int num_args;
|
||||
gen_expr_t ** expr_list;
|
||||
} prefun_expr_t;
|
||||
|
||||
|
||||
|
||||
|
||||
#endif /** _EXPR_TYPES_H */
|
||||
42
libprojectM/src/fatal.h
Executable file
42
libprojectM/src/fatal.h
Executable file
@ -0,0 +1,42 @@
|
||||
/**
|
||||
* projectM -- Milkdrop-esque visualisation SDK
|
||||
* Copyright (C)2003-2004 projectM Team
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
* See 'LICENSE.txt' included within this release
|
||||
*
|
||||
*/
|
||||
/**
|
||||
* $Id: fatal.h,v 1.1.1.1 2005/12/23 18:05:05 psperl Exp $
|
||||
*
|
||||
* Error codes
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _FATAL_H
|
||||
#define _FATAL_H
|
||||
|
||||
/* Fatal Error Definitions */
|
||||
|
||||
#define PROJECTM_OUTOFMEM_ERROR -7; /* out of memory */
|
||||
#define PROJECTM_ERROR -1 /* non specific error */
|
||||
#define PROJECTM_SUCCESS 1
|
||||
#define PROJECTM_FAILURE -1
|
||||
#define PROJECTM_PARSE_ERROR -11
|
||||
#define PROJECTM_DIV_BY_ZERO -3
|
||||
#define PROJECTM_OK 2
|
||||
|
||||
#endif /** !_FATAL_H */
|
||||
|
||||
3314
libprojectM/src/fftsg.cc
Executable file
3314
libprojectM/src/fftsg.cc
Executable file
File diff suppressed because it is too large
Load Diff
34
libprojectM/src/fftsg.h
Executable file
34
libprojectM/src/fftsg.h
Executable file
@ -0,0 +1,34 @@
|
||||
/**
|
||||
* projectM -- Milkdrop-esque visualisation SDK
|
||||
* Copyright (C)2003-2004 projectM Team
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
* See 'LICENSE.txt' included within this release
|
||||
*
|
||||
*/
|
||||
/**
|
||||
* $Id: fftsg.h,v 1.1.1.1 2005/12/23 18:05:00 psperl Exp $
|
||||
*
|
||||
* Wrapper for rdft() and friends
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _FFTSG_H
|
||||
#define _FFTSG_H
|
||||
|
||||
extern void rdft(int n, int isgn, double *a, int *ip, double *w);
|
||||
|
||||
#endif /** !_FFTSG_H */
|
||||
|
||||
243
libprojectM/src/func.cc
Executable file
243
libprojectM/src/func.cc
Executable file
@ -0,0 +1,243 @@
|
||||
/**
|
||||
* projectM -- Milkdrop-esque visualisation SDK
|
||||
* Copyright (C)2003-2004 projectM Team
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
* See 'LICENSE.txt' included within this release
|
||||
*
|
||||
*/
|
||||
/* Function management */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "common.h"
|
||||
#include "fatal.h"
|
||||
|
||||
#include "func_types.h"
|
||||
#include "func.h"
|
||||
|
||||
#include "splaytree_types.h"
|
||||
#include "splaytree.h"
|
||||
#include "tree_types.h"
|
||||
#include "wipemalloc.h"
|
||||
#include "builtin_funcs.h"
|
||||
|
||||
/* A splay tree of builtin functions */
|
||||
splaytree_t * builtin_func_tree;
|
||||
|
||||
/* Private function prototypes */
|
||||
int compare_func(char * name, char * name2);
|
||||
int insert_func(func_t * name);
|
||||
void * copy_func_key(char * string);
|
||||
|
||||
|
||||
void * copy_func_key(char * string) {
|
||||
|
||||
char * clone_string;
|
||||
|
||||
if ((clone_string = (char*)wipemalloc(MAX_TOKEN_SIZE)) == NULL)
|
||||
return NULL;
|
||||
|
||||
strncpy(clone_string, string, MAX_TOKEN_SIZE-1);
|
||||
|
||||
return (void*)clone_string;
|
||||
}
|
||||
|
||||
|
||||
func_t * create_func (char * name, float (*func_ptr)(float*), int num_args) {
|
||||
|
||||
func_t * func;
|
||||
func = (func_t*)wipemalloc(sizeof(func_t));
|
||||
|
||||
if (func == NULL)
|
||||
return NULL;
|
||||
|
||||
|
||||
/* Clear name space */
|
||||
memset(func->name, 0, MAX_TOKEN_SIZE);
|
||||
|
||||
/* Copy given name into function structure */
|
||||
strncpy(func->name, name, MAX_TOKEN_SIZE);
|
||||
|
||||
/* Assign value pointer */
|
||||
func->func_ptr = func_ptr;
|
||||
func->num_args = num_args;
|
||||
/* Return instantiated function */
|
||||
return func;
|
||||
|
||||
}
|
||||
|
||||
/* Initialize the builtin function database.
|
||||
Should only be necessary once */
|
||||
int init_builtin_func_db() {
|
||||
int retval;
|
||||
|
||||
builtin_func_tree = create_splaytree((int (*)(void*,void*))compare_string, (void*(*)(void*))copy_string, (void(*)(void*))free_string);
|
||||
|
||||
if (builtin_func_tree == NULL)
|
||||
return PROJECTM_OUTOFMEM_ERROR;
|
||||
|
||||
retval = load_all_builtin_func();
|
||||
return PROJECTM_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/* Destroy the builtin function database.
|
||||
Generally, do this on projectm exit */
|
||||
int destroy_builtin_func_db() {
|
||||
|
||||
splay_traverse((void (*)(void*))free_func, builtin_func_tree);
|
||||
destroy_splaytree(builtin_func_tree);
|
||||
return PROJECTM_SUCCESS;
|
||||
|
||||
}
|
||||
|
||||
/* Insert a function into the database */
|
||||
int insert_func(func_t * func) {
|
||||
|
||||
if (func == NULL)
|
||||
return PROJECTM_ERROR;
|
||||
|
||||
splay_insert(func, func->name, builtin_func_tree);
|
||||
|
||||
return PROJECTM_SUCCESS;
|
||||
}
|
||||
|
||||
/* Frees a function type, real complicated... */
|
||||
void free_func(func_t * func) {
|
||||
free(func);
|
||||
func = NULL;
|
||||
}
|
||||
|
||||
/* Remove a function from the database */
|
||||
int remove_func(func_t * func) {
|
||||
|
||||
if (func == NULL)
|
||||
return PROJECTM_ERROR;
|
||||
|
||||
splay_delete(func->name, builtin_func_tree);
|
||||
|
||||
return PROJECTM_SUCCESS;
|
||||
}
|
||||
|
||||
/* Find a function given its name */
|
||||
func_t * find_func(char * name) {
|
||||
|
||||
func_t * func = NULL;
|
||||
|
||||
/* First look in the builtin database */
|
||||
func = (func_t *)splay_find(name, builtin_func_tree);
|
||||
|
||||
return func;
|
||||
|
||||
}
|
||||
|
||||
/* Compare string name with function name */
|
||||
int compare_func(char * name, char * name2) {
|
||||
|
||||
int cmpval;
|
||||
|
||||
/* Uses string comparison function */
|
||||
cmpval = strncmp(name, name2, MAX_TOKEN_SIZE-1);
|
||||
|
||||
return cmpval;
|
||||
}
|
||||
|
||||
/* Loads a builtin function */
|
||||
int load_builtin_func(char * name, float (*func_ptr)(float*), int num_args) {
|
||||
|
||||
func_t * func;
|
||||
int retval;
|
||||
|
||||
/* Create new function */
|
||||
func = create_func(name, func_ptr, num_args);
|
||||
|
||||
if (func == NULL)
|
||||
return PROJECTM_OUTOFMEM_ERROR;
|
||||
|
||||
retval = insert_func(func);
|
||||
|
||||
return retval;
|
||||
|
||||
}
|
||||
|
||||
/* Loads all builtin functions */
|
||||
int load_all_builtin_func() {
|
||||
|
||||
|
||||
if (load_builtin_func("int", int_wrapper, 1) < 0)
|
||||
return PROJECTM_ERROR;
|
||||
if (load_builtin_func("abs", abs_wrapper, 1) < 0)
|
||||
return PROJECTM_ERROR;
|
||||
if (load_builtin_func("sin", sin_wrapper, 1) < 0)
|
||||
return PROJECTM_ERROR;
|
||||
if (load_builtin_func("cos", cos_wrapper, 1) < 0)
|
||||
return PROJECTM_ERROR;
|
||||
if (load_builtin_func("tan", tan_wrapper, 1) < 0)
|
||||
return PROJECTM_ERROR;
|
||||
if (load_builtin_func("asin", asin_wrapper, 1) < 0)
|
||||
return PROJECTM_ERROR;
|
||||
if (load_builtin_func("acos", acos_wrapper, 1) < 0)
|
||||
return PROJECTM_ERROR;
|
||||
if (load_builtin_func("atan", atan_wrapper, 1) < 0)
|
||||
return PROJECTM_ERROR;
|
||||
if (load_builtin_func("sqr", sqr_wrapper, 1) < 0)
|
||||
return PROJECTM_ERROR;
|
||||
if (load_builtin_func("sqrt", sqrt_wrapper, 1) < 0)
|
||||
return PROJECTM_ERROR;
|
||||
if (load_builtin_func("pow", pow_wrapper, 2) < 0)
|
||||
return PROJECTM_ERROR;
|
||||
if (load_builtin_func("exp", exp_wrapper, 1) < 0)
|
||||
return PROJECTM_ERROR;
|
||||
if (load_builtin_func("log", log_wrapper, 1) < 0)
|
||||
return PROJECTM_ERROR;
|
||||
if (load_builtin_func("log10", log10_wrapper, 1) < 0)
|
||||
return PROJECTM_ERROR;
|
||||
if (load_builtin_func("sign", sign_wrapper, 1) < 0)
|
||||
return PROJECTM_ERROR;
|
||||
if (load_builtin_func("min", min_wrapper, 2) < 0)
|
||||
return PROJECTM_ERROR;
|
||||
if (load_builtin_func("max", max_wrapper, 2) < 0)
|
||||
return PROJECTM_ERROR;
|
||||
if (load_builtin_func("sigmoid", sigmoid_wrapper, 2) < 0)
|
||||
return PROJECTM_ERROR;
|
||||
if (load_builtin_func("atan2", atan2_wrapper, 2) < 0)
|
||||
return PROJECTM_ERROR;
|
||||
if (load_builtin_func("rand", rand_wrapper, 1) < 0)
|
||||
return PROJECTM_ERROR;
|
||||
if (load_builtin_func("band", band_wrapper, 2) < 0)
|
||||
return PROJECTM_ERROR;
|
||||
if (load_builtin_func("bor", bor_wrapper, 2) < 0)
|
||||
return PROJECTM_ERROR;
|
||||
if (load_builtin_func("bnot", bnot_wrapper, 1) < 0)
|
||||
return PROJECTM_ERROR;
|
||||
if (load_builtin_func("if", if_wrapper, 3) < 0)
|
||||
return PROJECTM_ERROR;
|
||||
if (load_builtin_func("equal", equal_wrapper, 2) < 0)
|
||||
return PROJECTM_ERROR;
|
||||
if (load_builtin_func("above", above_wrapper, 2) < 0)
|
||||
return PROJECTM_ERROR;
|
||||
if (load_builtin_func("below",below_wrapper, 2) < 0)
|
||||
return PROJECTM_ERROR;
|
||||
if (load_builtin_func("nchoosek", nchoosek_wrapper, 2) < 0)
|
||||
return PROJECTM_ERROR;
|
||||
if (load_builtin_func("fact", fact_wrapper, 1) < 0)
|
||||
return PROJECTM_ERROR;
|
||||
|
||||
|
||||
return PROJECTM_SUCCESS;
|
||||
}
|
||||
35
libprojectM/src/func.h
Executable file
35
libprojectM/src/func.h
Executable file
@ -0,0 +1,35 @@
|
||||
/**
|
||||
* projectM -- Milkdrop-esque visualisation SDK
|
||||
* Copyright (C)2003-2004 projectM Team
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
* See 'LICENSE.txt' included within this release
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _FUNC_H
|
||||
#define _FUNC_H
|
||||
|
||||
/* Public Prototypes */
|
||||
func_t * create_func (char * name, float (*func_ptr)(float*), int num_args);
|
||||
int remove_func(func_t * func);
|
||||
func_t * find_func(char * name);
|
||||
int init_builtin_func_db();
|
||||
int destroy_builtin_func_db();
|
||||
int load_all_builtin_func();
|
||||
int load_builtin_func(char * name, float (*func_ptr)(float*), int num_args);
|
||||
void free_func(func_t * func);
|
||||
|
||||
#endif /** !_FUNC_H */
|
||||
34
libprojectM/src/func_types.h
Executable file
34
libprojectM/src/func_types.h
Executable file
@ -0,0 +1,34 @@
|
||||
/**
|
||||
* projectM -- Milkdrop-esque visualisation SDK
|
||||
* Copyright (C)2003-2004 projectM Team
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
* See 'LICENSE.txt' included within this release
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _FUNC_TYPES_H
|
||||
#define _FUNC_TYPES_H
|
||||
|
||||
#include "common.h"
|
||||
|
||||
/* Function Type */
|
||||
typedef struct FUNC_T {
|
||||
char name[MAX_TOKEN_SIZE];
|
||||
float (*func_ptr)(float*);
|
||||
int num_args;
|
||||
} func_t;
|
||||
|
||||
#endif /** !_FUNC_TYPES_H */
|
||||
1018
libprojectM/src/glConsole.cc
Executable file
1018
libprojectM/src/glConsole.cc
Executable file
File diff suppressed because it is too large
Load Diff
110
libprojectM/src/glConsole.h
Executable file
110
libprojectM/src/glConsole.h
Executable file
@ -0,0 +1,110 @@
|
||||
/**
|
||||
* projectM -- Milkdrop-esque visualisation SDK
|
||||
* Copyright (C)2003-2004 projectM Team
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
* See 'LICENSE.txt' included within this release
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _GLCONSOLE_H
|
||||
#define _GLCONSOLE_H
|
||||
|
||||
#include "glf.h"
|
||||
|
||||
#define GL_CONSOLE_DEBUG 0
|
||||
#define MAX_CONSOLE_HEIGHT 500
|
||||
#define MAX_CONSOLE_WIDTH 500
|
||||
|
||||
#define CONSOLE_FLAG_NONE 0
|
||||
#define CONSOLE_FLAG_CURSOR_HIDDEN 1
|
||||
#define CONSOLE_FLAG_CURSOR_BLINKING (1 << 1)
|
||||
#define CONSOLE_FLAG_SCROLL_WRAP_RIGHT (1 << 3)
|
||||
#define CONSOLE_FLAG_SCROLL_WRAP_LEFT (1 << 4)
|
||||
#define CONSOLE_FLAG_SCROLL_WRAP_UP (1 << 5)
|
||||
#define CONSOLE_FLAG_SCROLL_WRAP_DOWN (1 << 6)
|
||||
#define CONSOLE_FLAG_ALWAYS_DRAW_BACKGROUND (1 << 7)
|
||||
|
||||
#define BAR_STYLE 0
|
||||
#define UNDERLINE_STYLE 1
|
||||
|
||||
typedef enum {
|
||||
CONSOLE_RED,
|
||||
CONSOLE_BLACK,
|
||||
CONSOLE_BLUE,
|
||||
CONSOLE_WHITE,
|
||||
CONSOLE_GREEN,
|
||||
CONSOLE_TRANS
|
||||
} color_t;
|
||||
|
||||
typedef struct CONSOLE_CHAR_T {
|
||||
char symbol;
|
||||
color_t fg_color;
|
||||
color_t bg_color;
|
||||
} console_char_t;
|
||||
|
||||
|
||||
typedef struct GL_CONSOLE_T {
|
||||
float start_x;
|
||||
float start_y;
|
||||
int screen_width;
|
||||
int screen_height;
|
||||
int scroll_width;
|
||||
int scroll_height;
|
||||
console_char_t * screen_buffer; /* start of current screen buffer */
|
||||
console_char_t * scroll_buffer; /* pointer to very top of buffer */
|
||||
int font_descriptor;
|
||||
int screen_x;
|
||||
int screen_y;
|
||||
int screen_start_x;
|
||||
int screen_start_y;
|
||||
int cursor_style;
|
||||
color_t current_fg;
|
||||
color_t current_bg;
|
||||
color_t cursor_color;
|
||||
console_char_t * cursor_ptr; /* pointer to position in console buffer */
|
||||
short int flags;
|
||||
} gl_console_t;
|
||||
|
||||
int glConsoleSetFGColor(color_t color, gl_console_t * gl_console);
|
||||
int glConsoleSetBGColor(color_t color, gl_console_t * gl_console);
|
||||
int glConsoleSetCursorColor(color_t color, gl_console_t * gl_console);
|
||||
int glConsoleSetCursorPos(int x, int y, gl_console_t * gl_console);
|
||||
int glConsoleGetCursorPos(int * x, int * y, gl_console_t * gl_console);
|
||||
int glConsoleShowCursor(gl_console_t * console);
|
||||
int glConsoleHideCursor(gl_console_t * console);
|
||||
int glConsoleDraw( gl_console_t * console);
|
||||
int glConsoleClearScreen(gl_console_t * console);
|
||||
int glConsoleClearBuffer(gl_console_t * console);
|
||||
int glConsolePrintString(char * s, gl_console_t * console);
|
||||
int glConsoleSetFlags(int flags, gl_console_t * console);
|
||||
int glConsoleSetCursorStyle(int style_num, gl_console_t * console);
|
||||
int glConsoleAlignCursorRight(gl_console_t * gl_console);
|
||||
int glConsoleAlignCursorLeft(gl_console_t * gl_console);
|
||||
int glConsoleAlignCursorUp(gl_console_t * gl_console);
|
||||
int glConsoleAlignCursorDown(gl_console_t * gl_console);
|
||||
|
||||
int glConsoleMoveCursorForward(gl_console_t * gl_console);
|
||||
int glConsoleMoveCursorBackward(gl_console_t * gl_console);
|
||||
int glConsoleMoveCursorUp(gl_console_t * gl_console);
|
||||
int glConsoleMoveCursorDown(gl_console_t * gl_console);
|
||||
int glConsoleStartShell(gl_console_t * gl_console);
|
||||
int glConsoleCopyBuffer(char * src, int len, gl_console_t * gl_console);
|
||||
int glConsoleCursorToNextChar(char c, gl_console_t * gl_console);
|
||||
gl_console_t * glConsoleCreate(int screen_width, int screen_height, int scroll_width, int scroll_height,
|
||||
float start_x, float start_y, int font_descriptor);
|
||||
int glConsoleDestroy(gl_console_t * console);
|
||||
|
||||
#endif /** !_GLCONSOLE_H */
|
||||
114
libprojectM/src/glf.h
Executable file
114
libprojectM/src/glf.h
Executable file
@ -0,0 +1,114 @@
|
||||
/*
|
||||
==============================================================================
|
||||
| GLF Library
|
||||
| Version 1.0 (Release)
|
||||
|
|
||||
| Author: Roman Podobedov
|
||||
| Email: romka@ut.ee
|
||||
| WEB: www.ut.ee/~romka
|
||||
| Date: 17 August 2000
|
||||
|
|
||||
| Copyright (C) 2000, Romka Graphics
|
||||
| This library is freely distributable without any license or permissions.
|
||||
| You can use this library in any program (commercial, educational
|
||||
| or individual), but in each program, where You use this library, You
|
||||
| should to keep this header (author name and coordinates)!
|
||||
==============================================================================
|
||||
*/
|
||||
#ifndef GLF_H
|
||||
#define GLF_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* CONSTANTS */
|
||||
|
||||
#define GLF_ERROR -1
|
||||
#define GLF_OK 0
|
||||
#define GLF_YES 1
|
||||
#define GLF_NO 2
|
||||
|
||||
#define GLF_CONSOLE_MESSAGES 10
|
||||
#define GLF_TEXTURING 11
|
||||
#define GLF_CONTOURING 12
|
||||
|
||||
#define GLF_LEFT_UP 20
|
||||
#define GLF_LEFT_CENTER 21
|
||||
#define GLF_LEFT_DOWN 22
|
||||
#define GLF_CENTER_UP 23
|
||||
#define GLF_CENTER_CENTER 24
|
||||
#define GLF_CENTER_DOWN 25
|
||||
#define GLF_RIGHT_UP 26
|
||||
#define GLF_RIGHT_CENTER 27
|
||||
#define GLF_RIGHT_DOWN 28
|
||||
#define GLF_CENTER 24
|
||||
|
||||
/* Console constants */
|
||||
#define GLF_CONSOLE_CURSOR 30
|
||||
|
||||
/* Library initialization (must be called before any usage of library) */
|
||||
void glfInit();
|
||||
|
||||
/* Font loading/unloading functions */
|
||||
int glfLoadFont(char *font_name); /* Load font to memory*/
|
||||
int glfUnloadFont(); /* Unload font from memory */
|
||||
int glfUnloadFontD(int font_descriptor); /* Unload font by font_descriptor */
|
||||
|
||||
/* Text drawing functions */
|
||||
void glfDrawWiredSymbol(char s); /* Draw wired symbol */
|
||||
void glfDrawWiredString(char *s); /* Draw wired string */
|
||||
void glfDrawSolidSymbol(char s); /* Draw solid symbol */
|
||||
void glfDrawSolidString(char *s); /* Draw wired string */
|
||||
void glfDraw3DWiredSymbol(char s); /* Draw 3D wired symbol */
|
||||
void glfDraw3DWiredString(char *s); /* Draw 3D wired string */
|
||||
void glfDraw3DSolidSymbol(char s); /* Draw 3D solid symbol */
|
||||
void glfDraw3DSolidString(char *s); /* Draw 3D solid string */
|
||||
|
||||
/* Text drawing functions by specified font */
|
||||
void glfDrawWiredSymbolF(int font_descriptor, char s);
|
||||
void glfDrawWiredStringF(int font_descriptor, char *s);
|
||||
void glfDrawSolidSymbolF(int font_descriptor, char s);
|
||||
void glfDrawSolidStringF(int font_descriptor, char *s);
|
||||
void glfDraw3DWiredSymbolF(int font_descriptor, char s);
|
||||
void glfDraw3DWiredStringF(int font_descriptor, char *s);
|
||||
void glfDraw3DSolidSymbolF(int font_descriptor, char s);
|
||||
void glfDraw3DSolidStringF(int font_descriptor, char *s);
|
||||
|
||||
/* Text control functions */
|
||||
void glfGetStringBoundsF(int fd, char *s, float *minx, float *miny, float *maxx, float *maxy);
|
||||
void glfGetStringBounds(char *s, float *minx, float *miny, float *maxx, float *maxy);
|
||||
|
||||
void glfSetSymbolSpace(float sp); /* Set space between symbols */
|
||||
float glfGetSymbolSpace(); /* Get space between symbols */
|
||||
void glfSetSpaceSize(float sp); /* Set space size */
|
||||
float glfGetSpaceSize(); /* Get current space size */
|
||||
|
||||
void glfSetSymbolDepth(float dpth); /* Set depth of 3D symbol */
|
||||
float glfGetSymbolDepth(); /* Get depth of 3D symbol */
|
||||
int glfSetCurrentFont(int Font_Descriptor); /* Set current font */
|
||||
int glfGetCurrentFont(); /* Get current font descriptor */
|
||||
|
||||
void glfSetAnchorPoint(int anchp); /* Set symbol anchor point */
|
||||
void glfSetContourColor(float r, float g, float b, float a); /* Contour color */
|
||||
/* Enable/Disable GLF features */
|
||||
|
||||
void glfEnable(int what); /* Enable GLF feature 'what' */
|
||||
void glfDisable(int what); /* Disable GLF feature 'what' */
|
||||
|
||||
/* Console functions */
|
||||
void glfSetConsoleParam(int width, int height);
|
||||
int glfSetConsoleFont(int Font_Descriptor);
|
||||
void glfConsoleClear();
|
||||
void glfPrint(char *s, int lenght);
|
||||
void glfPrintString(char *s);
|
||||
void glfPrintChar(char s);
|
||||
|
||||
void glfConsoleDraw();
|
||||
void glfSetCursorBlinkRate(int Rate);
|
||||
|
||||
#ifdef __cplusplus
|
||||
};
|
||||
#endif
|
||||
|
||||
#endif
|
||||
31
libprojectM/src/idle_preset.h
Executable file
31
libprojectM/src/idle_preset.h
Executable file
@ -0,0 +1,31 @@
|
||||
/**
|
||||
* projectM -- Milkdrop-esque visualisation SDK
|
||||
* Copyright (C)2003-2004 projectM Team
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
* See 'LICENSE.txt' included within this release
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _IDLE_PRESET_H
|
||||
#define _IDLE_PRESET_H
|
||||
|
||||
#include "preset_types.h"
|
||||
|
||||
#define IDLE_PRESET_STRING "[idlepreset]\n"
|
||||
|
||||
preset_t * idle_preset;
|
||||
|
||||
#endif /** !_IDLE_PRESET_H */
|
||||
165
libprojectM/src/init_cond.cc
Executable file
165
libprojectM/src/init_cond.cc
Executable file
@ -0,0 +1,165 @@
|
||||
/**
|
||||
* projectM -- Milkdrop-esque visualisation SDK
|
||||
* Copyright (C)2003-2004 projectM Team
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
* See 'LICENSE.txt' included within this release
|
||||
*
|
||||
*/
|
||||
/* Library functions to manipulate initial condition values */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "common.h"
|
||||
#include "fatal.h"
|
||||
|
||||
#include "param_types.h"
|
||||
#include "expr_types.h"
|
||||
#include "init_cond_types.h"
|
||||
#include "init_cond.h"
|
||||
#include "wipemalloc.h"
|
||||
#include "splaytree_types.h"
|
||||
#include "splaytree.h"
|
||||
char init_cond_string_buffer[STRING_BUFFER_SIZE];
|
||||
int init_cond_string_buffer_index = 0;
|
||||
|
||||
|
||||
void init_cond_to_string(init_cond_t * init_cond);
|
||||
|
||||
/* Frees initial condition structure */
|
||||
void free_init_cond(init_cond_t * init_cond) {
|
||||
free(init_cond);
|
||||
init_cond = NULL;
|
||||
}
|
||||
|
||||
/* Evaluate an initial conditon */
|
||||
void eval_init_cond(init_cond_t * init_cond) {
|
||||
|
||||
if (init_cond == NULL)
|
||||
return;
|
||||
|
||||
/* Parameter is of boolean type, either a 1 or 0 value integer */
|
||||
|
||||
/* Set matrix flag to zero. This ensures
|
||||
its constant value will be used rather than a matrix value
|
||||
*/
|
||||
init_cond->param->matrix_flag = 0;
|
||||
if (init_cond->param->type == P_TYPE_BOOL) {
|
||||
if (INIT_COND_DEBUG) printf("init_cond: %s = %d (TYPE BOOL)\n", init_cond->param->name, init_cond->init_val.bool_val);
|
||||
*((int*)init_cond->param->engine_val) = init_cond->init_val.bool_val;
|
||||
return;
|
||||
}
|
||||
|
||||
/* Parameter is an integer type, just like C */
|
||||
|
||||
if (init_cond->param->type == P_TYPE_INT) {
|
||||
if (INIT_COND_DEBUG) printf("init_cond: %s = %d (TYPE INT)\n", init_cond->param->name, init_cond->init_val.int_val);
|
||||
*((int*)init_cond->param->engine_val) = init_cond->init_val.int_val;
|
||||
return;
|
||||
}
|
||||
|
||||
/* Parameter is of a float type, just like C */
|
||||
|
||||
if (init_cond->param->type == P_TYPE_DOUBLE) {
|
||||
if (INIT_COND_DEBUG) {
|
||||
printf( "init_cond: %s = %f (TYPE DOUBLE) -> %f -> %X -> %X\n", init_cond->param->name,
|
||||
init_cond->init_val.float_val, *((float *)init_cond->param->engine_val),
|
||||
init_cond->param, init_cond->param->engine_val );
|
||||
}
|
||||
*((float*)init_cond->param->engine_val) = init_cond->init_val.float_val;
|
||||
return;
|
||||
}
|
||||
|
||||
/* Unknown type of parameter */
|
||||
return;
|
||||
}
|
||||
|
||||
/* Creates a new initial condition */
|
||||
init_cond_t * new_init_cond(param_t * param, value_t init_val) {
|
||||
|
||||
init_cond_t * init_cond;
|
||||
|
||||
init_cond = (init_cond_t*)wipemalloc(sizeof(init_cond_t));
|
||||
|
||||
if (init_cond == NULL)
|
||||
return NULL;
|
||||
|
||||
init_cond->param = param;
|
||||
init_cond->init_val = init_val;
|
||||
|
||||
if ( INIT_COND_DEBUG ) {
|
||||
printf( "new_init_cond: %s -> %X -> %X\n", init_cond->param->name, init_cond->param, init_cond->param->engine_val );
|
||||
}
|
||||
|
||||
return init_cond;
|
||||
}
|
||||
|
||||
/* WIP */
|
||||
void init_cond_to_string(init_cond_t * init_cond) {
|
||||
|
||||
int string_length;
|
||||
char string[MAX_TOKEN_SIZE];
|
||||
|
||||
if (init_cond == NULL)
|
||||
return;
|
||||
|
||||
/* Create a string "param_name=val" */
|
||||
switch (init_cond->param->type) {
|
||||
|
||||
case P_TYPE_BOOL:
|
||||
sprintf(string, "%s=%d\n", init_cond->param->name, init_cond->init_val.bool_val);
|
||||
break;
|
||||
case P_TYPE_INT:
|
||||
sprintf(string, "%s=%d\n", init_cond->param->name, init_cond->init_val.int_val);
|
||||
break;
|
||||
case P_TYPE_DOUBLE:
|
||||
sprintf(string, "%s=%f\n", init_cond->param->name, init_cond->init_val.float_val);
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
/* Compute the length of the string */
|
||||
string_length = strlen(string);
|
||||
|
||||
/* Buffer overflow check */
|
||||
if ((init_cond_string_buffer_index + string_length + 1) > (STRING_BUFFER_SIZE - 1))
|
||||
return;
|
||||
|
||||
/* Copy the string into the initial condition string buffer */
|
||||
|
||||
strncpy(init_cond_string_buffer + init_cond_string_buffer_index, string, string_length);
|
||||
|
||||
/* Increment the string buffer, offset by one for the null terminator, which will be
|
||||
overwritten by the next call to this function */
|
||||
init_cond_string_buffer_index+= string_length + 1;
|
||||
|
||||
}
|
||||
|
||||
|
||||
char * create_init_cond_string_buffer(splaytree_t * init_cond_tree) {
|
||||
|
||||
if (init_cond_tree == NULL)
|
||||
return NULL;
|
||||
|
||||
init_cond_string_buffer_index = 0;
|
||||
|
||||
splay_traverse((void (*)(void*))init_cond_to_string, init_cond_tree);
|
||||
|
||||
return init_cond_string_buffer;
|
||||
|
||||
}
|
||||
35
libprojectM/src/init_cond.h
Executable file
35
libprojectM/src/init_cond.h
Executable file
@ -0,0 +1,35 @@
|
||||
/**
|
||||
* projectM -- Milkdrop-esque visualisation SDK
|
||||
* Copyright (C)2003-2004 projectM Team
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
* See 'LICENSE.txt' included within this release
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _INIT_COND_H
|
||||
#define _INIT_COND_H
|
||||
|
||||
#define INIT_COND_DEBUG 0
|
||||
|
||||
#include "param_types.h"
|
||||
#include "splaytree_types.h"
|
||||
|
||||
void eval_init_cond(init_cond_t * init_cond);
|
||||
init_cond_t * new_init_cond(param_t * param, value_t init_val);
|
||||
void free_init_cond(init_cond_t * init_cond);
|
||||
char * create_init_cond_string_buffer(splaytree_t * init_cond_tree);
|
||||
|
||||
#endif /** !_INIT_COND_H */
|
||||
33
libprojectM/src/init_cond_types.h
Executable file
33
libprojectM/src/init_cond_types.h
Executable file
@ -0,0 +1,33 @@
|
||||
/**
|
||||
* projectM -- Milkdrop-esque visualisation SDK
|
||||
* Copyright (C)2003-2004 projectM Team
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
* See 'LICENSE.txt' included within this release
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _INIT_COND_TYPES_H
|
||||
#define _INIT_COND_TYPES_H
|
||||
|
||||
#include "param_types.h"
|
||||
#include "expr_types.h"
|
||||
|
||||
typedef struct INIT_COND_T {
|
||||
struct PARAM_T * param;
|
||||
value_t init_val;
|
||||
} init_cond_t;
|
||||
|
||||
#endif /** !_INIT_COND_TYPES_H */
|
||||
34
libprojectM/src/interface_types.h
Executable file
34
libprojectM/src/interface_types.h
Executable file
@ -0,0 +1,34 @@
|
||||
/**
|
||||
* projectM -- Milkdrop-esque visualisation SDK
|
||||
* Copyright (C)2003-2004 projectM Team
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
* See 'LICENSE.txt' included within this release
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _INTERFACE_TYPES_H
|
||||
#define _INTERFACE_TYPES_H
|
||||
|
||||
typedef enum {
|
||||
|
||||
MENU_INTERFACE,
|
||||
SHELL_INTERFACE,
|
||||
EDITOR_INTERFACE,
|
||||
DEFAULT_INTERFACE,
|
||||
BROWSER_INTERFACE
|
||||
} interface_t;
|
||||
|
||||
#endif /** !_INTERFACE_TYPES_H */
|
||||
1079
libprojectM/src/menu.cc
Executable file
1079
libprojectM/src/menu.cc
Executable file
File diff suppressed because it is too large
Load Diff
111
libprojectM/src/menu.h
Executable file
111
libprojectM/src/menu.h
Executable file
@ -0,0 +1,111 @@
|
||||
/**
|
||||
* projectM -- Milkdrop-esque visualisation SDK
|
||||
* Copyright (C)2003-2004 projectM Team
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
* See 'LICENSE.txt' included within this release
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _MENU_H
|
||||
#define _MENU_H
|
||||
|
||||
#include "event.h"
|
||||
#include "common.h"
|
||||
#include "param_types.h"
|
||||
|
||||
#define MENU_DEBUG 0
|
||||
|
||||
#define PARAM_ADJ_TYPE 0
|
||||
#define MENU_LINK_TYPE 1
|
||||
#define FUNCTION_MODE_TYPE 2
|
||||
|
||||
typedef struct MENU_LINK_T {
|
||||
char print_string[MAX_TOKEN_SIZE];
|
||||
struct MENU_T * sub_menu;
|
||||
} menu_link_t;
|
||||
|
||||
typedef struct PARAM_ADJ_T {
|
||||
char print_string[MAX_TOKEN_SIZE];
|
||||
param_t * param;
|
||||
} param_adj_t;
|
||||
|
||||
typedef struct FUNCTION_MODE_T {
|
||||
char print_string[MAX_TOKEN_SIZE];
|
||||
int (*func_ptr)();
|
||||
} function_mode_t;
|
||||
|
||||
typedef union MENU_ENTRY_T {
|
||||
menu_link_t menu_link;
|
||||
param_adj_t param_adj;
|
||||
function_mode_t function_mode;
|
||||
} menu_entry_t;
|
||||
|
||||
|
||||
typedef struct MENU_ITEM_T {
|
||||
int menu_entry_type;
|
||||
menu_entry_t * menu_entry;
|
||||
struct MENU_ITEM_T * up;
|
||||
struct MENU_ITEM_T * down;
|
||||
} menu_item_t;
|
||||
|
||||
|
||||
typedef struct MENU_T {
|
||||
menu_item_t * selected_item;
|
||||
menu_item_t * start_item;
|
||||
menu_item_t * locked_item;
|
||||
struct MENU_T * top_menu;
|
||||
} menu_t;
|
||||
|
||||
/* Direction types */
|
||||
typedef enum {
|
||||
UP,
|
||||
DOWN,
|
||||
LEFT,
|
||||
RIGHT,
|
||||
PAGEUP,
|
||||
PAGEDOWN
|
||||
} dir_t;
|
||||
|
||||
/* Adjustment types */
|
||||
typedef enum {
|
||||
BIG_INC,
|
||||
BIG_DEC,
|
||||
SMALL_INC,
|
||||
SMALL_DEC,
|
||||
VERY_BIG_INC,
|
||||
VERY_BIG_DEC,
|
||||
VERY_SMALL_INC,
|
||||
VERY_SMALL_DEC
|
||||
} adj_t;
|
||||
|
||||
typedef enum {
|
||||
SHOW,
|
||||
HIDE,
|
||||
SPECIAL
|
||||
} display_state;
|
||||
|
||||
|
||||
|
||||
int switchMenuState(dir_t dir);
|
||||
|
||||
int initMenu();
|
||||
int refreshMenu();
|
||||
int clearMenu();
|
||||
int showMenu();
|
||||
int hideMenu();
|
||||
void menu_key_handler( projectM_t *PM, projectMEvent event, projectMKeycode key );
|
||||
|
||||
#endif /** !_MENU_H */
|
||||
724
libprojectM/src/param.cc
Executable file
724
libprojectM/src/param.cc
Executable file
@ -0,0 +1,724 @@
|
||||
/**
|
||||
* projectM -- Milkdrop-esque visualisation SDK
|
||||
* Copyright (C)2003-2004 projectM Team
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
* See 'LICENSE.txt' included within this release
|
||||
*
|
||||
*/
|
||||
|
||||
/* Basic Parameter Functions */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include "projectM.h"
|
||||
|
||||
#include "fatal.h"
|
||||
#include "common.h"
|
||||
|
||||
#include "splaytree_types.h"
|
||||
#include "splaytree.h"
|
||||
#include "tree_types.h"
|
||||
|
||||
#include "param_types.h"
|
||||
#include "param.h"
|
||||
|
||||
#include "expr_types.h"
|
||||
#include "eval.h"
|
||||
#include "wipemalloc.h"
|
||||
|
||||
extern projectM_t *PM;
|
||||
|
||||
void reset_param(param_t * param);
|
||||
|
||||
int is_valid_param_string(char * string); /* true if string is valid variable or function name */
|
||||
|
||||
|
||||
/* A splay tree of builtin parameters */
|
||||
splaytree_t * builtin_param_tree = NULL;
|
||||
|
||||
int insert_param_alt_name(param_t * param, char * alt_name);
|
||||
|
||||
int insert_builtin_param(param_t * param);
|
||||
|
||||
/* Private function prototypes */
|
||||
int compare_param(char * name, char * name2);
|
||||
|
||||
int load_builtin_param_float(char * name, void * engine_val, void * matrix, short int flags,
|
||||
float init_val, float upper_bound, float lower_bound, char * alt_name);
|
||||
|
||||
int load_builtin_param_int(char * name, void * engine_val, short int flags,
|
||||
int init_val, int upper_bound, int lower_bound, char * alt_name);
|
||||
|
||||
int load_builtin_param_bool(char * name, void * engine_val, short int flags,
|
||||
int init_val, char * alt_name);
|
||||
|
||||
|
||||
|
||||
param_t * create_param (char * name, short int type, short int flags, void * engine_val, void * matrix,
|
||||
value_t default_init_val, value_t upper_bound, value_t lower_bound) {
|
||||
|
||||
param_t * param = NULL;
|
||||
|
||||
param = (param_t*)wipemalloc(sizeof(param_t));
|
||||
|
||||
if (param == NULL) {
|
||||
printf("create_param: out of memory!!!\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Clear name space, think the strncpy statement makes this redundant */
|
||||
//memset(param->name, 0, MAX_TOKEN_SIZE);
|
||||
|
||||
/* Copy given name into parameter structure */
|
||||
strncpy(param->name, name, MAX_TOKEN_SIZE-1);
|
||||
|
||||
/* Assign other entries in a constructor like fashion */
|
||||
param->type = type;
|
||||
param->flags = flags;
|
||||
param->matrix_flag = 0;
|
||||
param->matrix = matrix;
|
||||
param->engine_val = engine_val;
|
||||
param->default_init_val = default_init_val;
|
||||
//*param->init_val = default_init_val;
|
||||
param->upper_bound = upper_bound;
|
||||
param->lower_bound = lower_bound;
|
||||
|
||||
/* Return instantiated parameter */
|
||||
return param;
|
||||
|
||||
}
|
||||
|
||||
/* Creates a user defined parameter */
|
||||
param_t * create_user_param(char * name) {
|
||||
|
||||
param_t * param;
|
||||
value_t iv;
|
||||
value_t ub;
|
||||
value_t lb;
|
||||
float * engine_val;
|
||||
|
||||
/* Set initial values to default */
|
||||
iv.float_val = DEFAULT_DOUBLE_IV;
|
||||
ub.float_val = DEFAULT_DOUBLE_UB;
|
||||
lb.float_val = DEFAULT_DOUBLE_LB;
|
||||
|
||||
/* Argument checks */
|
||||
if (name == NULL)
|
||||
return NULL;
|
||||
|
||||
/* Allocate space for the engine variable */
|
||||
if ((engine_val = (float*)wipemalloc(sizeof(float))) == NULL)
|
||||
return NULL;
|
||||
|
||||
(*engine_val) = iv.float_val; /* set some default init value */
|
||||
|
||||
/* Create the new user parameter */
|
||||
if ((param = create_param(name, P_TYPE_DOUBLE, P_FLAG_USERDEF, engine_val, NULL, iv, ub, lb)) == NULL) {
|
||||
free(engine_val);
|
||||
engine_val = NULL;
|
||||
return NULL;
|
||||
}
|
||||
if (PARAM_DEBUG) printf("create_param: \"%s\" initialized\n", param->name);
|
||||
/* Return the instantiated parameter */
|
||||
return param;
|
||||
}
|
||||
|
||||
/* Initialize the builtin parameter database.
|
||||
Should only be necessary once */
|
||||
int init_builtin_param_db(projectM_t *PM) {
|
||||
|
||||
/* Create the builtin parameter splay tree (go Sleator...) */
|
||||
if ((builtin_param_tree = create_splaytree((int (*)(void*,void*))compare_string,(void* (*)(void*)) copy_string, (void (*)(void*))free_string)) == NULL) {
|
||||
if (PARAM_DEBUG) printf("init_builtin_param_db: failed to initialize database (FATAL)\n");
|
||||
return PROJECTM_OUTOFMEM_ERROR;
|
||||
}
|
||||
|
||||
if (PARAM_DEBUG) {
|
||||
printf("init_builtin_param: loading database...");
|
||||
fflush(stdout);
|
||||
}
|
||||
|
||||
/* Loads all builtin parameters into the database */
|
||||
if (load_all_builtin_param( PM ) < 0) {
|
||||
if (PARAM_DEBUG) printf("failed loading builtin parameters (FATAL)\n");
|
||||
return PROJECTM_ERROR;
|
||||
}
|
||||
|
||||
if (PARAM_DEBUG) printf("success!\n");
|
||||
|
||||
/* Finished, no errors */
|
||||
return PROJECTM_SUCCESS;
|
||||
}
|
||||
|
||||
/* Destroy the builtin parameter database.
|
||||
Generally, do this on projectm exit */
|
||||
int destroy_builtin_param_db() {
|
||||
|
||||
splay_traverse((void (*)(void*))free_param, builtin_param_tree);
|
||||
destroy_splaytree(builtin_param_tree);
|
||||
builtin_param_tree = NULL;
|
||||
return PROJECTM_SUCCESS;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/* Insert a parameter into the database with an alternate name */
|
||||
int insert_param_alt_name(param_t * param, char * alt_name) {
|
||||
|
||||
if (param == NULL)
|
||||
return PROJECTM_ERROR;
|
||||
if (alt_name == NULL)
|
||||
return PROJECTM_ERROR;
|
||||
|
||||
splay_insert_link(alt_name, param->name, builtin_param_tree);
|
||||
|
||||
return PROJECTM_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
param_t * find_builtin_param(char * name) {
|
||||
|
||||
/* Null argument checks */
|
||||
if (name == NULL)
|
||||
return NULL;
|
||||
|
||||
return (param_t*)splay_find(name, builtin_param_tree);
|
||||
|
||||
}
|
||||
|
||||
/* Find a parameter given its name, will create one if not found */
|
||||
param_t * find_param(char * name, preset_t * preset, int flags) {
|
||||
|
||||
param_t * param = NULL;
|
||||
|
||||
/* Null argument checks */
|
||||
if (name == NULL)
|
||||
return NULL;
|
||||
if (preset == NULL)
|
||||
return NULL;
|
||||
|
||||
/* First look in the builtin database */
|
||||
param = (param_t *)splay_find(name, builtin_param_tree);
|
||||
|
||||
/* If the search failed, check the user database */
|
||||
if (param == NULL) {
|
||||
param = (param_t*)splay_find(name, preset->user_param_tree);
|
||||
}
|
||||
/* If it doesn't exist in the user (or builtin) database and
|
||||
create_flag is set, then make it and insert into the database
|
||||
*/
|
||||
|
||||
if ((param == NULL) && (flags & P_CREATE)) {
|
||||
|
||||
/* Check if string is valid */
|
||||
if (!is_valid_param_string(name)) {
|
||||
if (PARAM_DEBUG) printf("find_param: invalid parameter name:\"%s\"\n", name);
|
||||
return NULL;
|
||||
}
|
||||
/* Now, create the user defined parameter given the passed name */
|
||||
if ((param = create_user_param(name)) == NULL) {
|
||||
if (PARAM_DEBUG) printf("find_param: failed to create a new user parameter!\n");
|
||||
return NULL;
|
||||
}
|
||||
/* Finally, insert the new parameter into this preset's proper splaytree */
|
||||
if (splay_insert(param, param->name, preset->user_param_tree) < 0) {
|
||||
if (PARAM_DEBUG) printf("PARAM \"%s\" already exists in user parameter tree!\n", param->name);
|
||||
free_param(param);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* Return the found (or created) parameter. Note that if P_CREATE is not set, this could be null */
|
||||
return param;
|
||||
|
||||
}
|
||||
|
||||
/* Compare string name with parameter name */
|
||||
int compare_param(char * name, char * name2) {
|
||||
|
||||
int cmpval;
|
||||
printf("am i used\n");
|
||||
/* Uses string comparison function */
|
||||
cmpval = strncmp(name, name2, MAX_TOKEN_SIZE-1);
|
||||
|
||||
return cmpval;
|
||||
}
|
||||
|
||||
/* Loads all builtin parameters, limits are also defined here */
|
||||
int load_all_builtin_param( projectM_t *pm ) {
|
||||
|
||||
load_builtin_param_float("fRating", (void*)&pm->fRating, NULL, P_FLAG_NONE, 0.0 , 5.0, 0.0, NULL);
|
||||
load_builtin_param_float("fWaveScale", (void*)&pm->fWaveScale, NULL, P_FLAG_NONE, 0.0, MAX_DOUBLE_SIZE, -MAX_DOUBLE_SIZE, NULL);
|
||||
load_builtin_param_float("gamma", (void*)&pm->fGammaAdj, NULL, P_FLAG_NONE, 0.0, MAX_DOUBLE_SIZE, 0, "fGammaAdj");
|
||||
load_builtin_param_float("echo_zoom", (void*)&pm->fVideoEchoZoom, NULL, P_FLAG_NONE, 0.0, MAX_DOUBLE_SIZE, 0, "fVideoEchoZoom");
|
||||
load_builtin_param_float("echo_alpha", (void*)&pm->fVideoEchoAlpha, NULL, P_FLAG_NONE, 0.0, MAX_DOUBLE_SIZE, 0, "fVideoEchoAlpha");
|
||||
load_builtin_param_float("wave_a", (void*)&pm->fWaveAlpha, NULL, P_FLAG_NONE, 0.0, 1.0, 0, "fWaveAlpha");
|
||||
load_builtin_param_float("fWaveSmoothing", (void*)&pm->fWaveSmoothing, NULL, P_FLAG_NONE, 0.0, 1.0, -1.0, NULL);
|
||||
load_builtin_param_float("fModWaveAlphaStart", (void*)&pm->fModWaveAlphaStart, NULL, P_FLAG_NONE, 0.0, 1.0, -1.0, NULL);
|
||||
load_builtin_param_float("fModWaveAlphaEnd", (void*)&pm->fModWaveAlphaEnd, NULL, P_FLAG_NONE, 0.0, 1.0, -1.0, NULL);
|
||||
load_builtin_param_float("fWarpAnimSpeed", (void*)&pm->fWarpAnimSpeed, NULL, P_FLAG_NONE, 0.0, 1.0, -1.0, NULL);
|
||||
// load_builtin_param_float("warp", (void*)&pm->warp, pm->warp_mesh, P_FLAG_NONE, 0.0, MAX_DOUBLE_SIZE, 0, NULL);
|
||||
|
||||
load_builtin_param_float("fShader", (void*)&pm->fShader, NULL, P_FLAG_NONE, 0.0, 1.0, -1.0, NULL);
|
||||
load_builtin_param_float("decay", (void*)&pm->decay, NULL, P_FLAG_NONE, 0.0, 1.0, 0, "fDecay");
|
||||
|
||||
load_builtin_param_int("echo_orient", (void*)&pm->nVideoEchoOrientation, P_FLAG_NONE, 0, 3, 0, "nVideoEchoOrientation");
|
||||
load_builtin_param_int("wave_mode", (void*)&pm->nWaveMode, P_FLAG_NONE, 0, 7, 0, "nWaveMode");
|
||||
|
||||
load_builtin_param_bool("wave_additive", (void*)&pm->bAdditiveWaves, P_FLAG_NONE, FALSE, "bAdditiveWaves");
|
||||
load_builtin_param_bool("bModWaveAlphaByVolume", (void*)&pm->bModWaveAlphaByVolume, P_FLAG_NONE, FALSE, NULL);
|
||||
load_builtin_param_bool("wave_brighten", (void*)&pm->bMaximizeWaveColor, P_FLAG_NONE, FALSE, "bMaximizeWaveColor");
|
||||
load_builtin_param_bool("wrap", (void*)&pm->bTexWrap, P_FLAG_NONE, FALSE, "bTexWrap");
|
||||
load_builtin_param_bool("darken_center", (void*)&pm->bDarkenCenter, P_FLAG_NONE, FALSE, "bDarkenCenter");
|
||||
load_builtin_param_bool("bRedBlueStereo", (void*)&pm->bRedBlueStereo, P_FLAG_NONE, FALSE, NULL);
|
||||
load_builtin_param_bool("brighten", (void*)&pm->bBrighten, P_FLAG_NONE, FALSE, "bBrighten");
|
||||
load_builtin_param_bool("darken", (void*)&pm->bDarken, P_FLAG_NONE, FALSE, "bDarken");
|
||||
load_builtin_param_bool("solarize", (void*)&pm->bSolarize, P_FLAG_NONE, FALSE, "bSolarize");
|
||||
load_builtin_param_bool("invert", (void*)&pm->bInvert, P_FLAG_NONE, FALSE, "bInvert");
|
||||
load_builtin_param_bool("bMotionVectorsOn", (void*)&pm->bMotionVectorsOn, P_FLAG_NONE, FALSE, NULL);
|
||||
load_builtin_param_bool("wave_dots", (void*)&pm->bWaveDots, P_FLAG_NONE, FALSE, "bWaveDots");
|
||||
load_builtin_param_bool("wave_thick", (void*)&pm->bWaveThick, P_FLAG_NONE, FALSE, "bWaveThick");
|
||||
|
||||
|
||||
|
||||
load_builtin_param_float("zoom", (void*)&pm->zoom, pm->zoom_mesh, P_FLAG_PER_PIXEL |P_FLAG_DONT_FREE_MATRIX, 0.0, MAX_DOUBLE_SIZE, 0, NULL);
|
||||
load_builtin_param_float("rot", (void*)&pm->rot, pm->rot_mesh, P_FLAG_PER_PIXEL |P_FLAG_DONT_FREE_MATRIX, 0.0, MAX_DOUBLE_SIZE, MIN_DOUBLE_SIZE, NULL);
|
||||
load_builtin_param_float("zoomexp", (void*)&pm->zoomexp, pm->zoomexp_mesh, P_FLAG_PER_PIXEL |P_FLAG_NONE, 0.0, MAX_DOUBLE_SIZE, 0, "fZoomExponent");
|
||||
|
||||
load_builtin_param_float("cx", (void*)&pm->cx, pm->cx_mesh, P_FLAG_PER_PIXEL | P_FLAG_DONT_FREE_MATRIX, 0.0, 1.0, 0, NULL);
|
||||
load_builtin_param_float("cy", (void*)&pm->cy, pm->cy_mesh, P_FLAG_PER_PIXEL | P_FLAG_DONT_FREE_MATRIX, 0.0, 1.0, 0, NULL);
|
||||
load_builtin_param_float("dx", (void*)&pm->dx, pm->dx_mesh, P_FLAG_PER_PIXEL | P_FLAG_DONT_FREE_MATRIX, 0.0, MAX_DOUBLE_SIZE, MIN_DOUBLE_SIZE, NULL);
|
||||
load_builtin_param_float("dy", (void*)&pm->dy, pm->dy_mesh, P_FLAG_PER_PIXEL |P_FLAG_DONT_FREE_MATRIX, 0.0, MAX_DOUBLE_SIZE, MIN_DOUBLE_SIZE, NULL);
|
||||
load_builtin_param_float("sx", (void*)&pm->sx, pm->sx_mesh, P_FLAG_PER_PIXEL |P_FLAG_DONT_FREE_MATRIX, 0.0, MAX_DOUBLE_SIZE, 0, NULL);
|
||||
load_builtin_param_float("sy", (void*)&pm->sy, pm->sy_mesh, P_FLAG_PER_PIXEL |P_FLAG_DONT_FREE_MATRIX, 0.0, MAX_DOUBLE_SIZE, 0, NULL);
|
||||
|
||||
load_builtin_param_float("wave_r", (void*)&pm->wave_r, NULL, P_FLAG_NONE, 0.0, 1.0, 0.0, NULL);
|
||||
load_builtin_param_float("wave_g", (void*)&pm->wave_g, NULL, P_FLAG_NONE, 0.0, 1.0, 0.0, NULL);
|
||||
load_builtin_param_float("wave_b", (void*)&pm->wave_b, NULL, P_FLAG_NONE, 0.0, 1.0, 0.0, NULL);
|
||||
load_builtin_param_float("wave_x", (void*)&pm->wave_x, NULL, P_FLAG_NONE, 0.0, 1.0, 0.0, NULL);
|
||||
load_builtin_param_float("wave_y", (void*)&pm->wave_y, NULL, P_FLAG_NONE, 0.0, 1.0, 0.0, NULL);
|
||||
load_builtin_param_float("wave_mystery", (void*)&pm->wave_mystery, NULL, P_FLAG_NONE, 0.0, 1.0, -1.0, "fWaveParam");
|
||||
|
||||
load_builtin_param_float("ob_size", (void*)&pm->ob_size, NULL, P_FLAG_NONE, 0.0, 0.5, 0, NULL);
|
||||
load_builtin_param_float("ob_r", (void*)&pm->ob_r, NULL, P_FLAG_NONE, 0.0, 1.0, 0.0, NULL);
|
||||
load_builtin_param_float("ob_g", (void*)&pm->ob_g, NULL, P_FLAG_NONE, 0.0, 1.0, 0.0, NULL);
|
||||
load_builtin_param_float("ob_b", (void*)&pm->ob_b, NULL, P_FLAG_NONE, 0.0, 1.0, 0.0, NULL);
|
||||
load_builtin_param_float("ob_a", (void*)&pm->ob_a, NULL, P_FLAG_NONE, 0.0, 1.0, 0.0, NULL);
|
||||
|
||||
load_builtin_param_float("ib_size", (void*)&pm->ib_size, NULL,P_FLAG_NONE, 0.0, .5, 0.0, NULL);
|
||||
load_builtin_param_float("ib_r", (void*)&pm->ib_r, NULL,P_FLAG_NONE, 0.0, 1.0, 0.0, NULL);
|
||||
load_builtin_param_float("ib_g", (void*)&pm->ib_g, NULL,P_FLAG_NONE, 0.0, 1.0, 0.0, NULL);
|
||||
load_builtin_param_float("ib_b", (void*)&pm->ib_b, NULL,P_FLAG_NONE, 0.0, 1.0, 0.0, NULL);
|
||||
load_builtin_param_float("ib_a", (void*)&pm->ib_a, NULL,P_FLAG_NONE, 0.0, 1.0, 0.0, NULL);
|
||||
|
||||
load_builtin_param_float("mv_r", (void*)&pm->mv_r, NULL,P_FLAG_NONE, 0.0, 1.0, 0.0, NULL);
|
||||
load_builtin_param_float("mv_g", (void*)&pm->mv_g, NULL,P_FLAG_NONE, 0.0, 1.0, 0.0, NULL);
|
||||
load_builtin_param_float("mv_b", (void*)&pm->mv_b, NULL,P_FLAG_NONE, 0.0, 1.0, 0.0, NULL);
|
||||
load_builtin_param_float("mv_x", (void*)&pm->mv_x, NULL,P_FLAG_NONE, 0.0, 64.0, 0.0, "nMotionVectorsX");
|
||||
load_builtin_param_float("mv_y", (void*)&pm->mv_y, NULL,P_FLAG_NONE, 0.0, 48.0, 0.0, "nMotionVectorsY");
|
||||
load_builtin_param_float("mv_l", (void*)&pm->mv_l, NULL,P_FLAG_NONE, 0.0, 5.0, 0.0, NULL);
|
||||
load_builtin_param_float("mv_dy", (void*)&pm->mv_dy, NULL, P_FLAG_NONE, 0.0, 1.0, -1.0, NULL);
|
||||
load_builtin_param_float("mv_dx", (void*)&pm->mv_dx, NULL,P_FLAG_NONE, 0.0, 1.0, -1.0, NULL);
|
||||
load_builtin_param_float("mv_a", (void*)&pm->mv_a, NULL,P_FLAG_NONE, 0.0, 1.0, 0.0, NULL);
|
||||
|
||||
load_builtin_param_float("time", (void*)&pm->Time, NULL,P_FLAG_READONLY, 0.0, MAX_DOUBLE_SIZE, 0.0, NULL);
|
||||
load_builtin_param_float("bass", (void*)&pm->bass, NULL,P_FLAG_READONLY, 0.0, MAX_DOUBLE_SIZE, 0.0, NULL);
|
||||
load_builtin_param_float("mid", (void*)&pm->mid, NULL,P_FLAG_READONLY, 0.0, MAX_DOUBLE_SIZE, 0, NULL);
|
||||
load_builtin_param_float("bass_att", (void*)&pm->bass_att, NULL,P_FLAG_READONLY, 0.0, MAX_DOUBLE_SIZE, 0, NULL);
|
||||
load_builtin_param_float("mid_att", (void*)&pm->mid_att, NULL,P_FLAG_READONLY, 0.0, MAX_DOUBLE_SIZE, 0, NULL);
|
||||
load_builtin_param_float("treb_att", (void*)&pm->treb_att, NULL,P_FLAG_READONLY, 0.0, MAX_DOUBLE_SIZE, 0, NULL);
|
||||
load_builtin_param_int("frame", (void*)&pm->frame, P_FLAG_READONLY, 0, MAX_INT_SIZE, 0, NULL);
|
||||
load_builtin_param_float("progress", (void*)&pm->progress, NULL,P_FLAG_READONLY, 0.0, 1, 0, NULL);
|
||||
load_builtin_param_int("fps", (void*)&pm->fps, P_FLAG_NONE, 15, MAX_INT_SIZE, 0, NULL);
|
||||
|
||||
|
||||
|
||||
load_builtin_param_float("x", (void*)&pm->x_per_pixel, pm->x_mesh, P_FLAG_PER_PIXEL |P_FLAG_ALWAYS_MATRIX | P_FLAG_READONLY | P_FLAG_DONT_FREE_MATRIX,
|
||||
0, MAX_DOUBLE_SIZE, -MAX_DOUBLE_SIZE, NULL);
|
||||
load_builtin_param_float("y", (void*)&pm->y_per_pixel, pm->y_mesh, P_FLAG_PER_PIXEL |P_FLAG_ALWAYS_MATRIX |P_FLAG_READONLY | P_FLAG_DONT_FREE_MATRIX,
|
||||
0, MAX_DOUBLE_SIZE, -MAX_DOUBLE_SIZE, NULL);
|
||||
load_builtin_param_float("ang", (void*)&pm->ang_per_pixel, pm->theta_mesh, P_FLAG_PER_PIXEL |P_FLAG_ALWAYS_MATRIX | P_FLAG_READONLY | P_FLAG_DONT_FREE_MATRIX,
|
||||
0, MAX_DOUBLE_SIZE, -MAX_DOUBLE_SIZE, NULL);
|
||||
load_builtin_param_float("rad", (void*)&pm->rad_per_pixel, pm->rad_mesh, P_FLAG_PER_PIXEL |P_FLAG_ALWAYS_MATRIX | P_FLAG_READONLY | P_FLAG_DONT_FREE_MATRIX,
|
||||
0, MAX_DOUBLE_SIZE, -MAX_DOUBLE_SIZE, NULL);
|
||||
|
||||
|
||||
load_builtin_param_float("q1", (void*)&pm->q1, NULL, P_FLAG_PER_PIXEL |P_FLAG_QVAR, 0, MAX_DOUBLE_SIZE, -MAX_DOUBLE_SIZE, NULL);
|
||||
load_builtin_param_float("q2", (void*)&pm->q2, NULL, P_FLAG_PER_PIXEL |P_FLAG_QVAR, 0, MAX_DOUBLE_SIZE, -MAX_DOUBLE_SIZE, NULL);
|
||||
load_builtin_param_float("q3", (void*)&pm->q3, NULL, P_FLAG_PER_PIXEL |P_FLAG_QVAR, 0, MAX_DOUBLE_SIZE, -MAX_DOUBLE_SIZE, NULL);
|
||||
load_builtin_param_float("q4", (void*)&pm->q4, NULL, P_FLAG_PER_PIXEL |P_FLAG_QVAR, 0, MAX_DOUBLE_SIZE, -MAX_DOUBLE_SIZE, NULL);
|
||||
load_builtin_param_float("q5", (void*)&pm->q5, NULL, P_FLAG_PER_PIXEL |P_FLAG_QVAR, 0, MAX_DOUBLE_SIZE, -MAX_DOUBLE_SIZE, NULL);
|
||||
load_builtin_param_float("q6", (void*)&pm->q6, NULL, P_FLAG_PER_PIXEL |P_FLAG_QVAR, 0, MAX_DOUBLE_SIZE, -MAX_DOUBLE_SIZE, NULL);
|
||||
load_builtin_param_float("q7", (void*)&pm->q7, NULL, P_FLAG_PER_PIXEL |P_FLAG_QVAR, 0, MAX_DOUBLE_SIZE, -MAX_DOUBLE_SIZE, NULL);
|
||||
load_builtin_param_float("q8", (void*)&pm->q8, NULL, P_FLAG_PER_PIXEL |P_FLAG_QVAR, 0, MAX_DOUBLE_SIZE, -MAX_DOUBLE_SIZE, NULL);
|
||||
|
||||
|
||||
|
||||
/* variables added in 1.04 */
|
||||
load_builtin_param_int("meshx", (void*)&pm->gx, P_FLAG_READONLY, 32, 96, 8, NULL);
|
||||
load_builtin_param_int("meshy", (void*)&pm->gy, P_FLAG_READONLY, 24, 72, 6, NULL);
|
||||
|
||||
return PROJECTM_SUCCESS;
|
||||
|
||||
}
|
||||
|
||||
/* Free's a parameter type */
|
||||
void free_param(param_t * param) {
|
||||
int x;
|
||||
if (param == NULL)
|
||||
return;
|
||||
|
||||
if (param->flags & P_FLAG_USERDEF) {
|
||||
free(param->engine_val);
|
||||
param->engine_val = NULL;
|
||||
|
||||
}
|
||||
//if (!(param->flags & P_FLAG_DONT_FREE_MATRIX)) {
|
||||
if (param->matrix && !(param->flags & P_FLAG_DONT_FREE_MATRIX)) {
|
||||
|
||||
if (param->flags & P_FLAG_PER_POINT) {
|
||||
free(param->matrix);
|
||||
param->matrix = NULL;
|
||||
}//FIX THIS NOW XMAS05
|
||||
else if (param->flags & P_FLAG_PER_PIXEL) {
|
||||
for(x = 0; x < PM->gx; x++)
|
||||
free(((float**)param->matrix)[x]);
|
||||
free(param->matrix);
|
||||
param->matrix = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if (PARAM_DEBUG) printf("free_param: freeing \"%s\".\n", param->name);
|
||||
free(param);
|
||||
param = NULL;
|
||||
|
||||
}
|
||||
|
||||
/* Loads a float parameter into the builtin database */
|
||||
int load_builtin_param_float(char * name, void * engine_val, void * matrix, short int flags,
|
||||
float init_val, float upper_bound, float lower_bound, char * alt_name) {
|
||||
|
||||
param_t * param = NULL;
|
||||
value_t iv, ub, lb;
|
||||
|
||||
iv.float_val = init_val;
|
||||
ub.float_val = upper_bound;
|
||||
lb.float_val = lower_bound;
|
||||
|
||||
/* Create new parameter of type float */
|
||||
if (PARAM_DEBUG == 2) {
|
||||
printf("load_builtin_param_float: (name \"%s\") (alt_name = \"%s\") ", name, alt_name);
|
||||
fflush(stdout);
|
||||
}
|
||||
|
||||
if ((param = create_param(name, P_TYPE_DOUBLE, flags, engine_val, matrix, iv, ub, lb)) == NULL) {
|
||||
return PROJECTM_OUTOFMEM_ERROR;
|
||||
}
|
||||
|
||||
if (PARAM_DEBUG == 2) {
|
||||
printf("created...");
|
||||
fflush(stdout);
|
||||
}
|
||||
|
||||
/* Insert the paremeter into the database */
|
||||
|
||||
if (insert_builtin_param(param) < 0) {
|
||||
free_param(param);
|
||||
return PROJECTM_ERROR;
|
||||
}
|
||||
|
||||
if (PARAM_DEBUG == 2) {
|
||||
printf("inserted...");
|
||||
fflush(stdout);
|
||||
}
|
||||
|
||||
/* If this parameter has an alternate name, insert it into the database as link */
|
||||
|
||||
if (alt_name != NULL) {
|
||||
insert_param_alt_name(param, alt_name);
|
||||
|
||||
if (PARAM_DEBUG == 2) {
|
||||
printf("alt_name inserted...");
|
||||
fflush(stdout);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
if (PARAM_DEBUG == 2) printf("finished\n");
|
||||
/* Finished, return success */
|
||||
return PROJECTM_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Loads a float parameter into the builtin database */
|
||||
param_t * new_param_float(char * name, short int flags, void * engine_val, void * matrix,
|
||||
float upper_bound, float lower_bound, float init_val) {
|
||||
|
||||
param_t * param;
|
||||
value_t iv, ub, lb;
|
||||
|
||||
iv.float_val = init_val;
|
||||
ub.float_val = upper_bound;
|
||||
lb.float_val = lower_bound;
|
||||
|
||||
if ((param = create_param(name, P_TYPE_DOUBLE, flags, engine_val, matrix,iv, ub, lb)) == NULL)
|
||||
return NULL;
|
||||
|
||||
|
||||
/* Finished, return success */
|
||||
return param;
|
||||
}
|
||||
|
||||
|
||||
/* Creates a new parameter of type int */
|
||||
param_t * new_param_int(char * name, short int flags, void * engine_val,
|
||||
int upper_bound, int lower_bound, int init_val) {
|
||||
|
||||
param_t * param;
|
||||
value_t iv, ub, lb;
|
||||
|
||||
iv.int_val = init_val;
|
||||
ub.int_val = upper_bound;
|
||||
lb.int_val = lower_bound;
|
||||
|
||||
if ((param = create_param(name, P_TYPE_INT, flags, engine_val, NULL, iv, ub, lb)) == NULL)
|
||||
return NULL;
|
||||
|
||||
|
||||
/* Finished, return success */
|
||||
return param;
|
||||
}
|
||||
|
||||
/* Creates a new parameter of type bool */
|
||||
param_t * new_param_bool(char * name, short int flags, void * engine_val,
|
||||
int upper_bound, int lower_bound, int init_val) {
|
||||
|
||||
param_t * param;
|
||||
value_t iv, ub, lb;
|
||||
|
||||
iv.bool_val = init_val;
|
||||
ub.bool_val = upper_bound;
|
||||
lb.bool_val = lower_bound;
|
||||
|
||||
if ((param = create_param(name, P_TYPE_BOOL, flags, engine_val, NULL, iv, ub, lb)) == NULL)
|
||||
return NULL;
|
||||
|
||||
|
||||
/* Finished, return success */
|
||||
return param;
|
||||
}
|
||||
|
||||
|
||||
/* Loads a integer parameter into the builtin database */
|
||||
int load_builtin_param_int(char * name, void * engine_val, short int flags,
|
||||
int init_val, int upper_bound, int lower_bound, char * alt_name) {
|
||||
|
||||
param_t * param;
|
||||
value_t iv, ub, lb;
|
||||
|
||||
iv.int_val = init_val;
|
||||
ub.int_val = upper_bound;
|
||||
lb.int_val = lower_bound;
|
||||
|
||||
param = create_param(name, P_TYPE_INT, flags, engine_val, NULL, iv, ub, lb);
|
||||
|
||||
if (param == NULL) {
|
||||
return PROJECTM_OUTOFMEM_ERROR;
|
||||
}
|
||||
|
||||
if (insert_builtin_param(param) < 0) {
|
||||
free_param(param);
|
||||
return PROJECTM_ERROR;
|
||||
}
|
||||
|
||||
if (alt_name != NULL) {
|
||||
insert_param_alt_name(param, alt_name);
|
||||
}
|
||||
|
||||
return PROJECTM_SUCCESS;
|
||||
|
||||
}
|
||||
|
||||
/* Loads a boolean parameter */
|
||||
int load_builtin_param_bool(char * name, void * engine_val, short int flags,
|
||||
int init_val, char * alt_name) {
|
||||
|
||||
param_t * param;
|
||||
value_t iv, ub, lb;
|
||||
|
||||
iv.int_val = init_val;
|
||||
ub.int_val = TRUE;
|
||||
lb.int_val = FALSE;
|
||||
|
||||
param = create_param(name, P_TYPE_BOOL, flags, engine_val, NULL, iv, ub, lb);
|
||||
|
||||
if (param == NULL) {
|
||||
return PROJECTM_OUTOFMEM_ERROR;
|
||||
}
|
||||
|
||||
if (insert_builtin_param(param) < 0) {
|
||||
free_param(param);
|
||||
return PROJECTM_ERROR;
|
||||
}
|
||||
|
||||
if (alt_name != NULL) {
|
||||
insert_param_alt_name(param, alt_name);
|
||||
}
|
||||
|
||||
return PROJECTM_SUCCESS;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/* Returns nonzero if the string is valid parameter name */
|
||||
int is_valid_param_string(char * string) {
|
||||
|
||||
if (string == NULL)
|
||||
return FALSE;
|
||||
|
||||
/* This ensures the first character is non numeric */
|
||||
if( ((*string) >= 48) && ((*string) <= 57))
|
||||
return FALSE;
|
||||
|
||||
/* These probably should never happen */
|
||||
if (*string == '.')
|
||||
return FALSE;
|
||||
|
||||
if (*string == '+')
|
||||
return FALSE;
|
||||
|
||||
if (*string == '-')
|
||||
return FALSE;
|
||||
|
||||
/* Could also add checks for other symbols. May do later */
|
||||
|
||||
return TRUE;
|
||||
|
||||
}
|
||||
|
||||
/* Inserts a parameter into the builtin database */
|
||||
int insert_builtin_param(param_t * param) {
|
||||
|
||||
if (param == NULL)
|
||||
return PROJECTM_FAILURE;
|
||||
|
||||
return splay_insert(param, param->name, builtin_param_tree);
|
||||
}
|
||||
|
||||
/* Inserts a parameter into the builtin database */
|
||||
int insert_param(param_t * param, splaytree_t * database) {
|
||||
|
||||
if (param == NULL)
|
||||
return PROJECTM_FAILURE;
|
||||
if (database == NULL)
|
||||
return PROJECTM_FAILURE;
|
||||
|
||||
return splay_insert(param, param->name, database);
|
||||
}
|
||||
|
||||
|
||||
/* Sets the parameter engine value to value val.
|
||||
clipping occurs if necessary */
|
||||
void set_param(param_t * param, float val) {
|
||||
|
||||
switch (param->type) {
|
||||
|
||||
case P_TYPE_BOOL:
|
||||
if (val < 0)
|
||||
*((int*)param->engine_val) = 0;
|
||||
else if (val > 0)
|
||||
*((int*)param->engine_val) = 1;
|
||||
else
|
||||
*((int*)param->engine_val) = 0;
|
||||
break;
|
||||
case P_TYPE_INT:
|
||||
/* Make sure value is an integer */
|
||||
val = floor(val);
|
||||
if (val < param->lower_bound.int_val)
|
||||
*((int*)param->engine_val) = param->lower_bound.int_val;
|
||||
else if (val > param->upper_bound.int_val)
|
||||
*((int*)param->engine_val) = param->upper_bound.int_val;
|
||||
else
|
||||
*((int*)param->engine_val) = val;
|
||||
break;
|
||||
case P_TYPE_DOUBLE:
|
||||
/* Make sure value is an integer */
|
||||
|
||||
|
||||
if (val < param->lower_bound.float_val)
|
||||
*((float*)param->engine_val) = param->lower_bound.float_val;
|
||||
else if (val > param->upper_bound.float_val)
|
||||
*((float*)param->engine_val) = param->upper_bound.float_val;
|
||||
else
|
||||
*((float*)param->engine_val) = val;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/* Search for parameter 'name' in 'database', if create_flag is true, then generate the parameter
|
||||
and insert it into 'database' */
|
||||
param_t * find_param_db(char * name, splaytree_t * database, int create_flag) {
|
||||
|
||||
param_t * param = NULL;
|
||||
|
||||
/* Null argument checks */
|
||||
if (name == NULL)
|
||||
return NULL;
|
||||
if (database == NULL)
|
||||
return NULL;
|
||||
|
||||
/* First look in the builtin database */
|
||||
param = (param_t *)splay_find(name, database);
|
||||
|
||||
|
||||
if (((param = (param_t *)splay_find(name, database)) == NULL) && (create_flag == TRUE)) {
|
||||
|
||||
/* Check if string is valid */
|
||||
if (!is_valid_param_string(name))
|
||||
return NULL;
|
||||
|
||||
/* Now, create the user defined parameter given the passed name */
|
||||
if ((param = create_user_param(name)) == NULL)
|
||||
return NULL;
|
||||
|
||||
/* Finally, insert the new parameter into this preset's proper splaytree */
|
||||
if (splay_insert(param, param->name, database) < 0) {
|
||||
free_param(param);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* Return the found (or created) parameter. Note that this could be null */
|
||||
return param;
|
||||
|
||||
}
|
||||
|
||||
59
libprojectM/src/param.h
Executable file
59
libprojectM/src/param.h
Executable file
@ -0,0 +1,59 @@
|
||||
/**
|
||||
* projectM -- Milkdrop-esque visualisation SDK
|
||||
* Copyright (C)2003-2004 projectM Team
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
* See 'LICENSE.txt' included within this release
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _PARAM_H
|
||||
#define _PARAM_H
|
||||
|
||||
#include "projectM.h"
|
||||
#include "preset_types.h"
|
||||
#include "splaytree_types.h"
|
||||
/* Debug level, zero for none */
|
||||
#define PARAM_DEBUG 0
|
||||
|
||||
/* Used to store a number of decidable type */
|
||||
|
||||
/* Function prototypes */
|
||||
param_t * create_param (char * name, short int type, short int flags, void * eqn_val, void * matrix,
|
||||
value_t default_init_val, value_t upper_bound, value_t lower_bound);
|
||||
param_t * create_user_param(char * name);
|
||||
int init_builtin_param_db(projectM_t *PM);
|
||||
int init_user_param_db();
|
||||
int destroy_user_param_db();
|
||||
int destroy_builtin_param_db();
|
||||
void set_param(param_t * param, float val);
|
||||
int remove_param(param_t * param);
|
||||
param_t * find_param(char * name, struct PRESET_T * preset, int flags);
|
||||
void free_param(param_t * param);
|
||||
int load_all_builtin_param( projectM_t *pm );
|
||||
int insert_param(param_t * param, splaytree_t * database);
|
||||
param_t * find_builtin_param(char * name);
|
||||
param_t * new_param_float(char * name, short int flags, void * engine_val, void * matrix,
|
||||
float upper_bound, float lower_bound, float init_val);
|
||||
|
||||
param_t * new_param_int(char * name, short int flags, void * engine_val,
|
||||
int upper_bound, int lower_bound, int init_val);
|
||||
|
||||
param_t * new_param_bool(char * name, short int flags, void * engine_val,
|
||||
int upper_bound, int lower_bound, int init_val);
|
||||
|
||||
param_t * find_param_db(char * name, splaytree_t * database, int create_flag);
|
||||
|
||||
#endif /** !_PARAM_H */
|
||||
64
libprojectM/src/param_types.h
Executable file
64
libprojectM/src/param_types.h
Executable file
@ -0,0 +1,64 @@
|
||||
/**
|
||||
* projectM -- Milkdrop-esque visualisation SDK
|
||||
* Copyright (C)2003-2004 projectM Team
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
* See 'LICENSE.txt' included within this release
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _PARAM_TYPES_H
|
||||
#define _PARAM_TYPES_H
|
||||
|
||||
#include "expr_types.h"
|
||||
#include "common.h"
|
||||
|
||||
#define P_CREATE 1
|
||||
#define P_NONE 0
|
||||
|
||||
#define P_TYPE_BOOL 0
|
||||
#define P_TYPE_INT 1
|
||||
#define P_TYPE_DOUBLE 2
|
||||
|
||||
#define P_FLAG_NONE 0
|
||||
#define P_FLAG_READONLY 1
|
||||
#define P_FLAG_USERDEF (1 << 1)
|
||||
#define P_FLAG_QVAR (1 << 2)
|
||||
#define P_FLAG_TVAR (1 << 3)
|
||||
#define P_FLAG_ALWAYS_MATRIX (1 << 4)
|
||||
#define P_FLAG_DONT_FREE_MATRIX (1 << 5)
|
||||
#define P_FLAG_PER_PIXEL (1 << 6)
|
||||
#define P_FLAG_PER_POINT (1 << 7)
|
||||
|
||||
typedef union VALUE_T {
|
||||
int bool_val;
|
||||
int int_val;
|
||||
float float_val;
|
||||
} value_t;
|
||||
|
||||
/* Parameter Type */
|
||||
typedef struct PARAM_T {
|
||||
char name[MAX_TOKEN_SIZE]; /* name of the parameter, not necessary but useful neverthless */
|
||||
short int type; /* parameter number type (int, bool, or float) */
|
||||
short int flags; /* read, write, user defined, etc */
|
||||
short int matrix_flag; /* for optimization purposes */
|
||||
void * engine_val; /* pointer to the engine variable */
|
||||
void * matrix; /* per pixel / per point matrix for this variable */
|
||||
value_t default_init_val; /* a default initial condition value */
|
||||
value_t upper_bound; /* this parameter's upper bound */
|
||||
value_t lower_bound; /* this parameter's lower bound */
|
||||
} param_t;
|
||||
|
||||
#endif /** !_PARAM_TYPES_H */
|
||||
2308
libprojectM/src/parser.cc
Executable file
2308
libprojectM/src/parser.cc
Executable file
File diff suppressed because it is too large
Load Diff
53
libprojectM/src/parser.h
Executable file
53
libprojectM/src/parser.h
Executable file
@ -0,0 +1,53 @@
|
||||
/**
|
||||
* projectM -- Milkdrop-esque visualisation SDK
|
||||
* Copyright (C)2003-2004 projectM Team
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
* See 'LICENSE.txt' included within this release
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _PARSER_H
|
||||
#define _PARSER_H
|
||||
|
||||
#define PARSE_DEBUG 0
|
||||
#include "expr_types.h"
|
||||
#include "per_frame_eqn_types.h"
|
||||
#include "init_cond_types.h"
|
||||
#include "preset_types.h"
|
||||
|
||||
per_frame_eqn_t * parse_per_frame_eqn(FILE * fs, int index, struct PRESET_T * preset);
|
||||
int parse_per_pixel_eqn(FILE * fs, preset_t * preset, char * init_string);
|
||||
init_cond_t * parse_init_cond(FILE * fs, char * name, struct PRESET_T * preset);
|
||||
int parse_preset_name(FILE * fs, char * name);
|
||||
int parse_top_comment(FILE * fs);
|
||||
int parse_line(FILE * fs, struct PRESET_T * preset);
|
||||
|
||||
typedef enum {
|
||||
NORMAL_LINE_MODE,
|
||||
PER_FRAME_LINE_MODE,
|
||||
PER_PIXEL_LINE_MODE,
|
||||
PER_FRAME_INIT_LINE_MODE,
|
||||
INIT_COND_LINE_MODE,
|
||||
CUSTOM_WAVE_PER_POINT_LINE_MODE,
|
||||
CUSTOM_WAVE_PER_FRAME_LINE_MODE,
|
||||
CUSTOM_WAVE_WAVECODE_LINE_MODE,
|
||||
CUSTOM_SHAPE_SHAPECODE_LINE_MODE,
|
||||
CUSTOM_SHAPE_PER_FRAME_LINE_MODE,
|
||||
CUSTOM_SHAPE_PER_FRAME_INIT_LINE_MODE,
|
||||
CUSTOM_WAVE_PER_FRAME_INIT_LINE_MODE
|
||||
} line_mode_t;
|
||||
|
||||
#endif /** !_PARSER_H */
|
||||
401
libprojectM/src/pbuffer.cc
Executable file
401
libprojectM/src/pbuffer.cc
Executable file
@ -0,0 +1,401 @@
|
||||
/**
|
||||
* projectM -- Milkdrop-esque visualisation SDK
|
||||
* Copyright (C)2003-2004 projectM Team
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
* See 'LICENSE.txt' included within this release
|
||||
*
|
||||
*/
|
||||
/**
|
||||
* $Id: pbuffer.c,v 1.1.1.1 2005/12/23 18:05:00 psperl Exp $
|
||||
*
|
||||
* Render target methods
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
//#include <GL/gl.h>
|
||||
#include "pbuffer.h"
|
||||
|
||||
#ifdef MACOS
|
||||
#include <agl.h>
|
||||
#endif /** MACOS */
|
||||
|
||||
|
||||
#ifdef DEBUG
|
||||
extern FILE *debugFile;
|
||||
#endif /** DEBUG */
|
||||
|
||||
|
||||
|
||||
/** Creates new pbuffers */
|
||||
void createPBuffers( int width, int height, RenderTarget *target ) {
|
||||
|
||||
int mindim = 0;
|
||||
int origtexsize = 0;
|
||||
|
||||
#ifdef LINUX
|
||||
|
||||
if(target->usePbuffers)
|
||||
{
|
||||
glGenTextures( 1, &target->textureID[0] );
|
||||
|
||||
glBindTexture( GL_TEXTURE_2D, target->textureID[0] );
|
||||
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
|
||||
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA,
|
||||
target->texsize,target->texsize,
|
||||
0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef MACOS
|
||||
#ifdef MACOSX_10_3
|
||||
/** PBuffers are only supported in MacOS X 10.3+ */
|
||||
AGLPbuffer pbuffer, pbuffer2;
|
||||
AGLPixelFormat pixelFormat;
|
||||
AGLContext context;
|
||||
GLint attrib[] =
|
||||
{ AGL_RGBA, AGL_PIXEL_SIZE, 32, AGL_ACCELERATED, AGL_NONE };
|
||||
|
||||
pixelFormat = aglChoosePixelFormat( NULL, 0, attrib );
|
||||
if ( pixelFormat == NULL ) {
|
||||
|
||||
goto fallback;
|
||||
} else {
|
||||
|
||||
}
|
||||
|
||||
/** Fetch the original context for rendering directly */
|
||||
/** Only AGL can be used, otherwise, it'll fall back to texhack */
|
||||
/** Try AGL first */
|
||||
target->origContext = (void *)aglGetCurrentContext();
|
||||
if ( target->origContext == NULL ) {
|
||||
/** Try NSGL */
|
||||
// target->origContext = (void *)nsglGetCurrentContext();
|
||||
target->origContext = NULL;
|
||||
if ( target->origContext == NULL ) {
|
||||
/** Try CGL */
|
||||
target->origContext = (void *)CGLGetCurrentContext();
|
||||
if ( target->origContext != NULL ) {
|
||||
target->origContext = NULL;
|
||||
target->origContextType = CGL_CONTEXT;
|
||||
}
|
||||
} else {
|
||||
target->origContext = NULL;
|
||||
target->origContextType = NSGL_CONTEXT;
|
||||
}
|
||||
} else {
|
||||
target->origContextType = AGL_CONTEXT;
|
||||
}
|
||||
|
||||
/**
|
||||
* If we can't stash the original context for switching, don't use
|
||||
* pbuffers
|
||||
*/
|
||||
if ( target->origContext == NULL ) {
|
||||
|
||||
goto fallback;
|
||||
} else {
|
||||
|
||||
}
|
||||
|
||||
context = aglCreateContext( pixelFormat, target->origContext );
|
||||
if ( context == NULL ) {
|
||||
|
||||
aglDestroyPixelFormat( pixelFormat );
|
||||
goto fallback;
|
||||
} else {
|
||||
aglDestroyPixelFormat( pixelFormat );
|
||||
|
||||
}
|
||||
|
||||
/** Stash the context and pbuffer */
|
||||
target->pbufferContext = (void *)context;
|
||||
|
||||
/** Create the pass1 pbuffer */
|
||||
aglCreatePBuffer( target->texsize, target->texsize, GL_TEXTURE_2D,
|
||||
GL_RGBA, 0, &pbuffer );
|
||||
if ( pbuffer == NULL ) {
|
||||
|
||||
} else {
|
||||
target->pbuffer = pbuffer;
|
||||
|
||||
}
|
||||
|
||||
/** Finally, bind the target texture ID */
|
||||
aglSetCurrentContext( target->origContext );
|
||||
glGenTextures( 2, &target->textureID[0] );
|
||||
|
||||
glBindTexture( GL_TEXTURE_2D, target->textureID[0] );
|
||||
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST );
|
||||
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST );
|
||||
|
||||
if ( aglTexImagePBuffer( target->origContext, target->pbuffer, GL_FRONT ) == 0 ) {
|
||||
|
||||
}
|
||||
glBindTexture( GL_TEXTURE_2D, 0 );
|
||||
|
||||
glBindTexture( GL_TEXTURE_2D, target->textureID[1] );
|
||||
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
|
||||
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
|
||||
glTexImage2D(GL_TEXTURE_2D,
|
||||
0,
|
||||
GL_RGB,
|
||||
target->texsize, target->texsize,
|
||||
0,
|
||||
GL_RGB,
|
||||
GL_UNSIGNED_BYTE,
|
||||
NULL);
|
||||
glBindTexture( GL_TEXTURE_2D, 0 );
|
||||
|
||||
glBindTexture( GL_TEXTURE_2D, target->textureID[0] );
|
||||
|
||||
return;
|
||||
|
||||
#endif /** MACOSX_10_3 */
|
||||
|
||||
goto fallback;
|
||||
|
||||
#else
|
||||
#endif /** !MACOS */
|
||||
|
||||
/** Successful creation */
|
||||
// return;
|
||||
|
||||
fallback:
|
||||
#ifdef DEBUG
|
||||
if ( debugFile != NULL ) {
|
||||
fprintf( debugFile, "using teximage hack fallback\n" );
|
||||
fflush( debugFile );
|
||||
}
|
||||
#endif
|
||||
|
||||
/** Fallback pbuffer creation via teximage hack */
|
||||
/** Check the texture size against the viewport size */
|
||||
/** If the viewport is smaller, then we'll need to scale the texture size down */
|
||||
/** If the viewport is larger, scale it up */
|
||||
mindim = width < height ? width : height;
|
||||
origtexsize = target->texsize;
|
||||
target->texsize = nearestPower2( mindim, SCALE_MINIFY );
|
||||
|
||||
/* Create the texture that will be bound to the render target */
|
||||
if ( glIsTexture( target->textureID[0] ) ) {
|
||||
#ifdef DEBUG
|
||||
if ( debugFile != NULL ) {
|
||||
fprintf( debugFile, "texture already exists\n" );
|
||||
fflush( debugFile );
|
||||
}
|
||||
#endif
|
||||
if ( target->texsize != origtexsize ) {
|
||||
#ifdef DEBUG
|
||||
if ( debugFile != NULL ) {
|
||||
fprintf( debugFile, "deleting existing texture due to resize\n" );
|
||||
fflush( debugFile );
|
||||
}
|
||||
#endif
|
||||
glDeleteTextures( 1, &target->textureID[0] );
|
||||
}
|
||||
}
|
||||
|
||||
if ( !glIsTexture( target->textureID[0] ) ) {
|
||||
glGenTextures(1, &target->textureID[0] );
|
||||
|
||||
#ifdef DEBUG
|
||||
if ( debugFile != NULL ) {
|
||||
fprintf( debugFile, "allocate texture: %d\ttexsize: %d x %d\n",
|
||||
target->textureID[0], target->texsize, target->texsize );
|
||||
fflush( debugFile );
|
||||
}
|
||||
#endif
|
||||
glBindTexture(GL_TEXTURE_2D, target->textureID[0] );
|
||||
//glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||
//glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
|
||||
glTexImage2D(GL_TEXTURE_2D,
|
||||
0,
|
||||
3,
|
||||
target->texsize, target->texsize,
|
||||
0,
|
||||
GL_RGB,
|
||||
GL_UNSIGNED_BYTE,
|
||||
NULL);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
/** Destroys the pbuffer */
|
||||
|
||||
/** Locks the pbuffer */
|
||||
void lockPBuffer( RenderTarget *target, PBufferPass pass ) {
|
||||
|
||||
#ifdef LINUX
|
||||
if(target->usePbuffers)
|
||||
{
|
||||
void (*lock)(void)= NULL;
|
||||
lock=target->lock_func;
|
||||
(*lock)();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef MACOS
|
||||
if ( target->pbufferContext != NULL &&
|
||||
target->pbuffer != NULL ) {
|
||||
GLint vs;
|
||||
#ifdef DEBUG
|
||||
if ( debugFile != NULL ) {
|
||||
fprintf( debugFile, "-> locking pbuffer: %d\n", pass );
|
||||
fflush( debugFile );
|
||||
}
|
||||
#endif
|
||||
if ( !aglSetCurrentContext( (AGLContext)target->pbufferContext ) ) {
|
||||
#ifdef DEBUG
|
||||
if ( debugFile != NULL ) {
|
||||
fprintf( debugFile, "lockPBuffer(): failed to set context\n" );
|
||||
fflush( debugFile );
|
||||
}
|
||||
#endif
|
||||
}
|
||||
vs = aglGetVirtualScreen ( (AGLContext)target->origContext );
|
||||
if ( pass == PBUFFER_PASS1 ) {
|
||||
aglSetPBuffer( (AGLContext)target->pbufferContext, (AGLPbuffer)target->pbuffer, 0, 0, vs );
|
||||
// glBindTexture( GL_TEXTURE_2D, target->textureID[0] );
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/** Unlocks the pbuffer */
|
||||
void unlockPBuffer( RenderTarget *target ) {
|
||||
|
||||
#ifdef LINUX
|
||||
|
||||
glCopyTexSubImage2D( GL_TEXTURE_2D,0, 0, 0, 0, 0,target->texsize, target->texsize );
|
||||
if(target->usePbuffers)
|
||||
{
|
||||
void (*unlock)(void)= NULL;
|
||||
unlock=target->unlock_func;
|
||||
(*unlock)();
|
||||
|
||||
}
|
||||
return;
|
||||
#endif
|
||||
|
||||
#ifdef MACOS
|
||||
if ( target->pbufferContext != NULL &&
|
||||
target->pbuffer != NULL ) {
|
||||
#ifdef DEBUG
|
||||
if ( debugFile != NULL ) {
|
||||
fprintf( debugFile, "<- unlocking pbuffer\n" );
|
||||
fflush( debugFile );
|
||||
}
|
||||
#endif
|
||||
/** Flush the pbuffer */
|
||||
glFlush();
|
||||
|
||||
/** Reset the texture ID to the pbuffer */
|
||||
glBindTexture( GL_TEXTURE_2D, target->textureID[0] );
|
||||
glBindTexture( GL_TEXTURE_2D, 0 );
|
||||
glBindTexture( GL_TEXTURE_2D, target->textureID[1] );
|
||||
glCopyTexSubImage2D( GL_TEXTURE_2D,
|
||||
0, 0, 0, 0, 0,
|
||||
target->texsize, target->texsize );
|
||||
glBindTexture( GL_TEXTURE_2D, 0 );
|
||||
glBindTexture( GL_TEXTURE_2D, target->textureID[0] );
|
||||
|
||||
/** Reset the OpenGL context to the original context */
|
||||
aglSetCurrentContext( NULL );
|
||||
if ( target->origContext != NULL ) {
|
||||
if ( !aglSetCurrentContext( target->origContext ) ) {
|
||||
#ifdef DEBUG
|
||||
if ( debugFile != NULL ) {
|
||||
fprintf( debugFile, "failed to setting origContext current\n" );
|
||||
fflush( debugFile );
|
||||
}
|
||||
#endif
|
||||
} else {
|
||||
#ifdef DEBUG
|
||||
if ( debugFile != NULL ) {
|
||||
fprintf( debugFile, "setting origContext current\n" );
|
||||
fflush( debugFile );
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
/** Fallback texture path */
|
||||
glCopyTexSubImage2D( GL_TEXTURE_2D,
|
||||
0, 0, 0, 0, 0,
|
||||
target->texsize, target->texsize );
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculates the nearest power of two to the given number using the
|
||||
* appropriate rule
|
||||
*/
|
||||
int nearestPower2( int value, TextureScale scaleRule ) {
|
||||
|
||||
int x = value;
|
||||
int power = 0;
|
||||
|
||||
#ifdef DEBUG
|
||||
if ( debugFile != NULL ) {
|
||||
fprintf( debugFile, "nearestPower2(): %d\n", value );
|
||||
fflush( debugFile );
|
||||
}
|
||||
#endif
|
||||
|
||||
while ( ( x & 0x01 ) != 1 ) {
|
||||
x >>= 1;
|
||||
}
|
||||
|
||||
if ( x == 1 ) {
|
||||
return value;
|
||||
} else {
|
||||
x = value;
|
||||
while ( x != 0 ) {
|
||||
x >>= 1;
|
||||
power++;
|
||||
}
|
||||
switch ( scaleRule ) {
|
||||
case SCALE_NEAREST:
|
||||
if ( ( ( 1 << power ) - value ) <= ( value - ( 1 << ( power - 1 ) ) ) ) {
|
||||
return 1 << power;
|
||||
} else {
|
||||
return 1 << ( power - 1 );
|
||||
}
|
||||
case SCALE_MAGNIFY:
|
||||
return 1 << power;
|
||||
case SCALE_MINIFY:
|
||||
return 1 << ( power - 1 );
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
87
libprojectM/src/pbuffer.h
Executable file
87
libprojectM/src/pbuffer.h
Executable file
@ -0,0 +1,87 @@
|
||||
/**
|
||||
* projectM -- Milkdrop-esque visualisation SDK
|
||||
* Copyright (C)2003-2004 projectM Team
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
* See 'LICENSE.txt' included within this release
|
||||
*
|
||||
*/
|
||||
/**
|
||||
* $Id: pbuffer.h,v 1.1.1.1 2005/12/23 18:05:00 psperl Exp $
|
||||
*
|
||||
* Opaque render target
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _RENDERTARGET_H
|
||||
#define _RENDERTARGET_H
|
||||
|
||||
#ifdef MACOS
|
||||
#include <gl.h>
|
||||
#endif /** MACOS */
|
||||
|
||||
#ifdef WIN32
|
||||
#include <windows.h>
|
||||
#include <GL/gl.h>
|
||||
#endif /** WIN32 */
|
||||
|
||||
#ifdef LINUX
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glx.h>
|
||||
#endif
|
||||
|
||||
typedef enum { SCALE_NEAREST, SCALE_MAGNIFY, SCALE_MINIFY } TextureScale;
|
||||
typedef enum {
|
||||
AGL_CONTEXT,
|
||||
CGL_CONTEXT,
|
||||
NSGL_CONTEXT,
|
||||
GLX_CONTEXT,
|
||||
WGL_CONTEXT,
|
||||
} ContextType;
|
||||
|
||||
typedef enum { PBUFFER_PASS1, PBUFFER_PASS2 } PBufferPass;
|
||||
|
||||
typedef struct RENDERTARGET {
|
||||
|
||||
/** Texture size */
|
||||
int texsize;
|
||||
|
||||
/** Application context */
|
||||
ContextType origContextType;
|
||||
|
||||
int usePbuffers;
|
||||
|
||||
#ifdef LINUX
|
||||
void (*lock_func)(void);
|
||||
void (*unlock_func)(void);
|
||||
#endif
|
||||
|
||||
/** Opaque pbuffer context and pbuffer */
|
||||
#ifdef MACOS
|
||||
void *origContext;
|
||||
void *pbufferContext;
|
||||
void *pbuffer;
|
||||
#endif
|
||||
|
||||
/** Render target texture ID for non-pbuffer systems */
|
||||
GLuint textureID[2];
|
||||
} RenderTarget;
|
||||
|
||||
extern void createPBuffers( int width, int height, RenderTarget *target );
|
||||
extern void lockPBuffer( RenderTarget *target, PBufferPass pass );
|
||||
extern void unlockPBuffer( RenderTarget *target );
|
||||
extern int nearestPower2( int value, TextureScale scaleRule );
|
||||
|
||||
#endif /** !_RENDERTARGET_H */
|
||||
115
libprojectM/src/per_frame_eqn.cc
Executable file
115
libprojectM/src/per_frame_eqn.cc
Executable file
@ -0,0 +1,115 @@
|
||||
/**
|
||||
* projectM -- Milkdrop-esque visualisation SDK
|
||||
* Copyright (C)2003-2004 projectM Team
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
* See 'LICENSE.txt' included within this release
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "fatal.h"
|
||||
#include "common.h"
|
||||
|
||||
#include "param.h"
|
||||
#include "per_frame_eqn_types.h"
|
||||
#include "per_frame_eqn.h"
|
||||
|
||||
#include "expr_types.h"
|
||||
#include "eval.h"
|
||||
|
||||
#include "wipemalloc.h"
|
||||
|
||||
/* Evaluate an equation */
|
||||
void eval_per_frame_eqn(per_frame_eqn_t * per_frame_eqn) {
|
||||
|
||||
if (per_frame_eqn == NULL)
|
||||
return;
|
||||
|
||||
if (PER_FRAME_EQN_DEBUG) {
|
||||
printf("per_frame_%d=%s= ", per_frame_eqn->index, per_frame_eqn->param->name);
|
||||
fflush(stdout);
|
||||
}
|
||||
|
||||
//*((float*)per_frame_eqn->param->engine_val) = eval_gen_expr(per_frame_eqn->gen_expr);
|
||||
set_param(per_frame_eqn->param, eval_gen_expr(per_frame_eqn->gen_expr));
|
||||
if (PER_FRAME_EQN_DEBUG) printf(" = %.4f\n", *((float*)per_frame_eqn->param->engine_val));
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
void eval_per_frame_init_eqn(per_frame_eqn_t * per_frame_eqn) {
|
||||
|
||||
float val;
|
||||
init_cond_t * init_cond;
|
||||
if (per_frame_eqn == NULL)
|
||||
return;
|
||||
|
||||
if (PER_FRAME_EQN_DEBUG) {
|
||||
printf("per_frame_init: %s = ", per_frame_eqn->param->name);
|
||||
fflush(stdout);
|
||||
}
|
||||
|
||||
|
||||
val = *((float*)per_frame_eqn->param->engine_val) = eval_gen_expr(per_frame_eqn->gen_expr);
|
||||
if (PER_FRAME_EQN_DEBUG) printf(" = %f\n", *((float*)per_frame_eqn->param->engine_val));
|
||||
|
||||
if (per_frame_eqn->param->flags & P_FLAG_QVAR) {
|
||||
|
||||
per_frame_eqn->param->init_val.float_val = val;
|
||||
if ((init_cond = new_init_cond(per_frame_eqn->param)) == NULL)
|
||||
return;
|
||||
|
||||
if ((list_append(init_cond_list, init_cond)) < 0) {
|
||||
free_init_cond(init_cond);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
/* Frees perframe equation structure */
|
||||
void free_per_frame_eqn(per_frame_eqn_t * per_frame_eqn) {
|
||||
|
||||
if (per_frame_eqn == NULL)
|
||||
return;
|
||||
|
||||
free_gen_expr(per_frame_eqn->gen_expr);
|
||||
free(per_frame_eqn);
|
||||
per_frame_eqn = NULL;
|
||||
}
|
||||
|
||||
/* Create a new per frame equation */
|
||||
per_frame_eqn_t * new_per_frame_eqn(int index, param_t * param, gen_expr_t * gen_expr) {
|
||||
|
||||
per_frame_eqn_t * per_frame_eqn;
|
||||
|
||||
per_frame_eqn = (per_frame_eqn_t*)wipemalloc(sizeof(per_frame_eqn_t));
|
||||
|
||||
if (per_frame_eqn == NULL)
|
||||
return NULL;
|
||||
|
||||
per_frame_eqn->param = param;
|
||||
per_frame_eqn->gen_expr = gen_expr;
|
||||
per_frame_eqn->index = index;
|
||||
/* Set per frame eqn name */
|
||||
// memset(per_frame_eqn->name, 0, MAX_TOKEN_SIZE);
|
||||
//strncpy(per_frame_eqn->name, name, MAX_TOKEN_SIZE-1);
|
||||
return per_frame_eqn;
|
||||
|
||||
}
|
||||
32
libprojectM/src/per_frame_eqn.h
Executable file
32
libprojectM/src/per_frame_eqn.h
Executable file
@ -0,0 +1,32 @@
|
||||
/**
|
||||
* projectM -- Milkdrop-esque visualisation SDK
|
||||
* Copyright (C)2003-2004 projectM Team
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
* See 'LICENSE.txt' included within this release
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _PER_FRAME_EQN_H
|
||||
#define _PER_FRAME_EQN_H
|
||||
|
||||
#define PER_FRAME_EQN_DEBUG 0
|
||||
|
||||
per_frame_eqn_t * new_per_frame_eqn(int index, param_t * param, struct GEN_EXPR_T * gen_expr);
|
||||
void eval_per_frame_eqn(per_frame_eqn_t * per_frame_eqn);
|
||||
void free_per_frame_eqn(per_frame_eqn_t * per_frame_eqn);
|
||||
void eval_per_frame_init_eqn(per_frame_eqn_t * per_frame_eqn);
|
||||
|
||||
#endif /** !_PER_FRAME_EQN_H */
|
||||
34
libprojectM/src/per_frame_eqn_types.h
Executable file
34
libprojectM/src/per_frame_eqn_types.h
Executable file
@ -0,0 +1,34 @@
|
||||
/**
|
||||
* projectM -- Milkdrop-esque visualisation SDK
|
||||
* Copyright (C)2003-2004 projectM Team
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
* See 'LICENSE.txt' included within this release
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _PER_FRAME_EQN_TYPES_H
|
||||
#define _PER_FRAME_EQN_TYPES_H
|
||||
|
||||
#include "param_types.h"
|
||||
#include "expr_types.h"
|
||||
|
||||
typedef struct PER_FRAME_EQN_T {
|
||||
int index;
|
||||
struct PARAM_T * param; /* parameter to be assigned a value */
|
||||
struct GEN_EXPR_T * gen_expr; /* expression that paremeter is equal to */
|
||||
} per_frame_eqn_t;
|
||||
|
||||
#endif /** !_PER_FRAME_EQN_TYPES_H */
|
||||
233
libprojectM/src/per_pixel_eqn.cc
Executable file
233
libprojectM/src/per_pixel_eqn.cc
Executable file
@ -0,0 +1,233 @@
|
||||
/**
|
||||
* projectM -- Milkdrop-esque visualisation SDK
|
||||
* Copyright (C)2003-2004 projectM Team
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
* See 'LICENSE.txt' included within this release
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "projectM.h"
|
||||
|
||||
#include "fatal.h"
|
||||
#include "common.h"
|
||||
|
||||
#include "expr_types.h"
|
||||
#include "eval.h"
|
||||
|
||||
#include "splaytree_types.h"
|
||||
#include "splaytree.h"
|
||||
|
||||
#include "param_types.h"
|
||||
#include "param.h"
|
||||
|
||||
#include "per_pixel_eqn.h"
|
||||
#include "per_pixel_eqn_types.h"
|
||||
|
||||
#include "wipemalloc.h"
|
||||
|
||||
extern preset_t *active_preset;
|
||||
extern projectM_t *PM;
|
||||
extern int mesh_i;
|
||||
extern int mesh_j;
|
||||
|
||||
/* Evaluates a per pixel equation */
|
||||
void evalPerPixelEqn( per_pixel_eqn_t * per_pixel_eqn) {
|
||||
|
||||
float ** param_matrix = NULL;
|
||||
gen_expr_t * eqn_ptr = NULL;
|
||||
int x,y;
|
||||
|
||||
eqn_ptr = per_pixel_eqn->gen_expr;
|
||||
if (per_pixel_eqn->param->matrix == NULL) {
|
||||
if (PER_PIXEL_EQN_DEBUG) printf("evalPerPixelEqn: [begin initializing matrix] (index = %d) (name = %s)\n",
|
||||
per_pixel_eqn->index, per_pixel_eqn->param->name);
|
||||
|
||||
param_matrix = (float**)wipemalloc(PM->gx*sizeof(float*));
|
||||
per_pixel_eqn->param->matrix = param_matrix;
|
||||
|
||||
for(x = 0; x < PM->gx; x++)
|
||||
param_matrix[x] = (float *)wipemalloc(PM->gy * sizeof(float));
|
||||
|
||||
for (x = 0; x < PM->gx; x++)
|
||||
for (y = 0; y < PM->gy; y++)
|
||||
param_matrix[x][y] = 0.0;
|
||||
|
||||
if (per_pixel_eqn->param->name == NULL)
|
||||
printf("null parameter?\n");
|
||||
|
||||
// printf("PARAM MATRIX: \"%s\" initialized.\n", per_pixel_eqn->param->name);
|
||||
}
|
||||
else
|
||||
param_matrix = (float**)per_pixel_eqn->param->matrix;
|
||||
|
||||
if (eqn_ptr == NULL || param_matrix == NULL )
|
||||
printf("something is seriously wrong...\n");
|
||||
for (mesh_i = 0; mesh_i < PM->gx; mesh_i++) {
|
||||
for (mesh_j = 0; mesh_j < PM->gy; mesh_j++) {
|
||||
param_matrix[mesh_i][mesh_j] = eval_gen_expr(eqn_ptr);
|
||||
}
|
||||
}
|
||||
|
||||
/* Now that this parameter has been referenced with a per
|
||||
pixel equation, we let the evaluator know by setting
|
||||
this flag */
|
||||
per_pixel_eqn->param->matrix_flag = 1;
|
||||
per_pixel_eqn->param->flags |= P_FLAG_PER_PIXEL;
|
||||
}
|
||||
|
||||
void evalPerPixelEqns(preset_t *preset) {
|
||||
|
||||
/* Evaluate all per pixel equations using splay traversal */
|
||||
splay_traverse((void (*)(void*))evalPerPixelEqn, preset->per_pixel_eqn_tree);
|
||||
|
||||
/* Set mesh i / j values to -1 so engine vars are used by default again */
|
||||
mesh_i = mesh_j = -1;
|
||||
|
||||
}
|
||||
/* Adds a per pixel equation according to its string name. This
|
||||
will be used only by the parser */
|
||||
|
||||
int add_per_pixel_eqn(char * name, gen_expr_t * gen_expr, preset_t * preset) {
|
||||
|
||||
per_pixel_eqn_t * per_pixel_eqn;
|
||||
int index;
|
||||
param_t * param = NULL;
|
||||
|
||||
/* Argument checks */
|
||||
if (preset == NULL)
|
||||
return PROJECTM_FAILURE;
|
||||
if (gen_expr == NULL)
|
||||
return PROJECTM_FAILURE;
|
||||
if (name == NULL)
|
||||
return PROJECTM_FAILURE;
|
||||
|
||||
if (PER_PIXEL_EQN_DEBUG) printf("add_per_pixel_eqn: per pixel equation (name = \"%s\")\n", name);
|
||||
|
||||
if (!strncmp(name, "dx", strlen("dx")))
|
||||
preset->per_pixel_flag[DX_OP] = TRUE;
|
||||
else if (!strncmp(name, "dy", strlen("dy")))
|
||||
preset->per_pixel_flag[DY_OP] = TRUE;
|
||||
else if (!strncmp(name, "cx", strlen("cx")))
|
||||
preset->per_pixel_flag[CX_OP] = TRUE;
|
||||
else if (!strncmp(name, "cy", strlen("cy")))
|
||||
preset->per_pixel_flag[CX_OP] = TRUE;
|
||||
else if (!strncmp(name, "zoom", strlen("zoom")))
|
||||
preset->per_pixel_flag[ZOOM_OP] = TRUE;
|
||||
else if (!strncmp(name, "zoomexp", strlen("zoomexp")))
|
||||
preset->per_pixel_flag[ZOOMEXP_OP] = TRUE;
|
||||
else if (!strncmp(name, "rot", strlen("rot")))
|
||||
preset->per_pixel_flag[ROT_OP] = TRUE;
|
||||
else if (!strncmp(name, "sx", strlen("sx")))
|
||||
preset->per_pixel_flag[SX_OP] = TRUE;
|
||||
else if (!strncmp(name, "sy", strlen("sy")))
|
||||
preset->per_pixel_flag[SY_OP] = TRUE;
|
||||
|
||||
|
||||
/* Search for the parameter so we know what matrix the per pixel equation is referencing */
|
||||
|
||||
param = find_param(name, preset, TRUE);
|
||||
if ( !param ) {
|
||||
if (PER_PIXEL_EQN_DEBUG) printf("add_per_pixel_eqn: failed to allocate a new parameter!\n");
|
||||
return PROJECTM_FAILURE;
|
||||
}
|
||||
|
||||
/**
|
||||
if ( !param->matrix ) {
|
||||
if (PER_PIXEL_EQN_DEBUG) printf( "add_per_pixel_eqn: failed to locate param matrix\n" );
|
||||
return PROJECTM_FAILURE;
|
||||
}
|
||||
*/
|
||||
|
||||
/* Find most largest index in the splaytree */
|
||||
// if ((per_pixel_eqn = splay_find_max(PM->active_preset->per_pixel_eqn_tree)) == NULL)
|
||||
// index = 0;
|
||||
// else
|
||||
index = splay_size(preset->per_pixel_eqn_tree);
|
||||
|
||||
/* Create the per pixel equation given the index, parameter, and general expression */
|
||||
if ((per_pixel_eqn = new_per_pixel_eqn(index, param, gen_expr)) == NULL) {
|
||||
if (PER_PIXEL_EQN_DEBUG) printf("add_per_pixel_eqn: failed to create new per pixel equation!\n");
|
||||
return PROJECTM_FAILURE;
|
||||
|
||||
}
|
||||
|
||||
if (PER_PIXEL_EQN_DEBUG) printf("add_per_pixel_eqn: new equation (index = %d,matrix=%X) (param = \"%s\")\n",
|
||||
per_pixel_eqn->index, per_pixel_eqn->param->matrix, per_pixel_eqn->param->name);
|
||||
/* Insert the per pixel equation into the preset per pixel database */
|
||||
if (splay_insert(per_pixel_eqn, &per_pixel_eqn->index, preset->per_pixel_eqn_tree) < 0) {
|
||||
free_per_pixel_eqn(per_pixel_eqn);
|
||||
printf("failed to add per pixel eqn!\n");
|
||||
return PROJECTM_FAILURE;
|
||||
}
|
||||
|
||||
/* Done */
|
||||
return PROJECTM_SUCCESS;
|
||||
}
|
||||
|
||||
per_pixel_eqn_t * new_per_pixel_eqn(int index, param_t * param, gen_expr_t * gen_expr) {
|
||||
|
||||
per_pixel_eqn_t * per_pixel_eqn;
|
||||
|
||||
if (index < 0)
|
||||
return NULL;
|
||||
if (param == NULL)
|
||||
return NULL;
|
||||
if (gen_expr == NULL)
|
||||
return NULL;
|
||||
|
||||
if ((per_pixel_eqn = (per_pixel_eqn_t*)wipemalloc(sizeof(per_pixel_eqn_t))) == NULL)
|
||||
return NULL;
|
||||
|
||||
|
||||
per_pixel_eqn->index = index;
|
||||
per_pixel_eqn->param = param;
|
||||
per_pixel_eqn->gen_expr = gen_expr;
|
||||
|
||||
return per_pixel_eqn;
|
||||
}
|
||||
|
||||
|
||||
void free_per_pixel_eqn(per_pixel_eqn_t * per_pixel_eqn) {
|
||||
|
||||
if (per_pixel_eqn == NULL)
|
||||
return;
|
||||
|
||||
free_gen_expr(per_pixel_eqn->gen_expr);
|
||||
|
||||
free(per_pixel_eqn);
|
||||
per_pixel_eqn = NULL;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
int isPerPixelEqn(int op) {
|
||||
|
||||
return active_preset->per_pixel_flag[op];
|
||||
|
||||
}
|
||||
|
||||
int resetPerPixelEqnFlags(preset_t * preset) {
|
||||
int i;
|
||||
|
||||
for (i = 0; i < NUM_OPS;i++)
|
||||
preset->per_pixel_flag[i] = FALSE;
|
||||
|
||||
return PROJECTM_SUCCESS;
|
||||
}
|
||||
37
libprojectM/src/per_pixel_eqn.h
Executable file
37
libprojectM/src/per_pixel_eqn.h
Executable file
@ -0,0 +1,37 @@
|
||||
/**
|
||||
* projectM -- Milkdrop-esque visualisation SDK
|
||||
* Copyright (C)2003-2004 projectM Team
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
* See 'LICENSE.txt' included within this release
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _PER_PIXEL_EQN_H
|
||||
#define _PER_PIXEL_EQN_H
|
||||
|
||||
#include "expr_types.h"
|
||||
#include "preset_types.h"
|
||||
|
||||
#define PER_PIXEL_EQN_DEBUG 0
|
||||
|
||||
void evalPerPixelEqns(preset_t *preset);
|
||||
int isPerPixelEqn(int index);
|
||||
int add_per_pixel_eqn(char * name, gen_expr_t * gen_expr, struct PRESET_T * preset);
|
||||
void free_per_pixel_eqn(per_pixel_eqn_t * per_pixel_eqn);
|
||||
per_pixel_eqn_t * new_per_pixel_eqn(int index, param_t * param, gen_expr_t * gen_expr);
|
||||
int resetPerPixelEqnFlags();
|
||||
|
||||
#endif /** !_PER_PIXEL_EQN_H */
|
||||
49
libprojectM/src/per_pixel_eqn_types.h
Executable file
49
libprojectM/src/per_pixel_eqn_types.h
Executable file
@ -0,0 +1,49 @@
|
||||
/**
|
||||
* projectM -- Milkdrop-esque visualisation SDK
|
||||
* Copyright (C)2003-2004 projectM Team
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
* See 'LICENSE.txt' included within this release
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _PER_PIXEL_EQN_TYPES_H
|
||||
#define _PER_PIXEL_EQN_TYPES_H
|
||||
|
||||
/* This is sort of ugly, but it is also the fastest way to access the per pixel equations */
|
||||
#include "common.h"
|
||||
#include "expr_types.h"
|
||||
|
||||
typedef struct PER_PIXEL_EQN_T {
|
||||
int index; /* used for splay tree ordering. */
|
||||
int flags; /* primarily to specify if this variable is user-defined */
|
||||
param_t * param;
|
||||
gen_expr_t * gen_expr;
|
||||
} per_pixel_eqn_t;
|
||||
|
||||
|
||||
#define ZOOM_OP 0
|
||||
#define ZOOMEXP_OP 1
|
||||
#define ROT_OP 2
|
||||
#define CX_OP 3
|
||||
#define CY_OP 4
|
||||
#define SX_OP 5
|
||||
#define SY_OP 6
|
||||
#define DX_OP 7
|
||||
#define DY_OP 8
|
||||
#define WARP_OP 9
|
||||
#define NUM_OPS 10 /* obviously, this number is dependent on the number of existing per pixel operations */
|
||||
|
||||
#endif /** !_PER_PIXEL_EQN_TYPES_H */
|
||||
34
libprojectM/src/per_point_types.h
Executable file
34
libprojectM/src/per_point_types.h
Executable file
@ -0,0 +1,34 @@
|
||||
/**
|
||||
* projectM -- Milkdrop-esque visualisation SDK
|
||||
* Copyright (C)2003-2004 projectM Team
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
* See 'LICENSE.txt' included within this release
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _PER_POINT_EQN_TYPES_H
|
||||
#define _PER_POINT_EQN_TYPES_H
|
||||
|
||||
#include "custom_wave_types.h"
|
||||
|
||||
typedef struct PER_POINT_EQN {
|
||||
|
||||
custom_wave_t * custom_wave;
|
||||
|
||||
|
||||
} per_point_eqn_t;
|
||||
|
||||
#endif /** !_PER_POINT_EQN_TYPES_H */
|
||||
1030
libprojectM/src/preset.cc
Executable file
1030
libprojectM/src/preset.cc
Executable file
File diff suppressed because it is too large
Load Diff
49
libprojectM/src/preset.h
Executable file
49
libprojectM/src/preset.h
Executable file
@ -0,0 +1,49 @@
|
||||
/**
|
||||
* projectM -- Milkdrop-esque visualisation SDK
|
||||
* Copyright (C)2003-2004 projectM Team
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
* See 'LICENSE.txt' included within this release
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _PRESET_H
|
||||
#define _PRESET_H
|
||||
|
||||
//#define PRESET_DEBUG 2 /* 0 for no debugging, 1 for normal, 2 for insane */
|
||||
|
||||
#define HARD_CUT 0
|
||||
#define SOFT_CUT 1
|
||||
|
||||
#include "preset_types.h"
|
||||
#include "projectM.h"
|
||||
|
||||
void evalInitConditions(preset_t *preset);
|
||||
void evalPerFrameEquations(preset_t *preset);
|
||||
|
||||
int switchPreset(switch_mode_t switch_mode, int cut_type);
|
||||
void switchToIdlePreset();
|
||||
int loadPresetDir(char * dir);
|
||||
int closePresetDir();
|
||||
int initPresetLoader(projectM_t *PM);
|
||||
int destroyPresetLoader();
|
||||
int loadPresetByFile(char * filename);
|
||||
void reloadPerFrame(char * s, preset_t * preset);
|
||||
void reloadPerFrameInit(char *s, preset_t * preset);
|
||||
void reloadPerPixel(char *s, preset_t * preset);
|
||||
void savePreset(char * name);
|
||||
|
||||
|
||||
#endif /** !_PRESET_H */
|
||||
67
libprojectM/src/preset_types.h
Executable file
67
libprojectM/src/preset_types.h
Executable file
@ -0,0 +1,67 @@
|
||||
/**
|
||||
* projectM -- Milkdrop-esque visualisation SDK
|
||||
* Copyright (C)2003-2004 projectM Team
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
* See 'LICENSE.txt' included within this release
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _PRESET_TYPES_H
|
||||
#define _PRESET_TYPES_H
|
||||
|
||||
#include "splaytree_types.h"
|
||||
#include "expr_types.h"
|
||||
#include "per_pixel_eqn_types.h"
|
||||
#include "per_frame_eqn_types.h"
|
||||
#include "custom_shape_types.h"
|
||||
#include "custom_wave_types.h"
|
||||
|
||||
|
||||
typedef enum {
|
||||
ALPHA_NEXT,
|
||||
ALPHA_PREVIOUS,
|
||||
RANDOM_NEXT,
|
||||
RESTART_ACTIVE,
|
||||
} switch_mode_t;
|
||||
|
||||
typedef struct PRESET_T {
|
||||
|
||||
char name[MAX_TOKEN_SIZE]; /* preset name as parsed in file */
|
||||
char file_path[MAX_PATH_SIZE]; /* Points to the preset file name */
|
||||
|
||||
int per_pixel_eqn_string_index;
|
||||
int per_frame_eqn_string_index;
|
||||
int per_frame_init_eqn_string_index;
|
||||
|
||||
int per_pixel_flag[NUM_OPS];
|
||||
char per_pixel_eqn_string_buffer[STRING_BUFFER_SIZE];
|
||||
char per_frame_eqn_string_buffer[STRING_BUFFER_SIZE];
|
||||
char per_frame_init_eqn_string_buffer[STRING_BUFFER_SIZE];
|
||||
|
||||
/* Data structures that contain equation and initial condition information */
|
||||
splaytree_t * per_frame_eqn_tree; /* per frame equations */
|
||||
splaytree_t * per_pixel_eqn_tree; /* per pixel equation tree */
|
||||
gen_expr_t * per_pixel_eqn_array[NUM_OPS]; /* per pixel equation array */
|
||||
splaytree_t * per_frame_init_eqn_tree; /* per frame initial equations */
|
||||
splaytree_t * init_cond_tree; /* initial conditions */
|
||||
splaytree_t * user_param_tree; /* user parameter splay tree */
|
||||
|
||||
splaytree_t * custom_wave_tree; /* custom wave forms for this preset */
|
||||
splaytree_t * custom_shape_tree; /* custom shapes for this preset */
|
||||
|
||||
} preset_t;
|
||||
|
||||
#endif /** !_PRESET_TYPES_H */
|
||||
2783
libprojectM/src/projectM.cc
Executable file
2783
libprojectM/src/projectM.cc
Executable file
File diff suppressed because it is too large
Load Diff
381
libprojectM/src/projectM.dsp
Executable file
381
libprojectM/src/projectM.dsp
Executable file
@ -0,0 +1,381 @@
|
||||
# Microsoft Developer Studio Project File - Name="projectM" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||
# ** DO NOT EDIT **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Static Library" 0x0104
|
||||
|
||||
CFG=projectM - Win32 Debug
|
||||
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||
!MESSAGE use the Export Makefile command and run
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "projectM.mak".
|
||||
!MESSAGE
|
||||
!MESSAGE You can specify a configuration when running NMAKE
|
||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "projectM.mak" CFG="projectM - Win32 Debug"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "projectM - Win32 Release" (based on "Win32 (x86) Static Library")
|
||||
!MESSAGE "projectM - Win32 Debug" (based on "Win32 (x86) Static Library")
|
||||
!MESSAGE
|
||||
|
||||
# Begin Project
|
||||
# PROP AllowPerConfigDependencies 0
|
||||
# PROP Scc_ProjName ""
|
||||
# PROP Scc_LocalPath ""
|
||||
CPP=cl.exe
|
||||
RSC=rc.exe
|
||||
|
||||
!IF "$(CFG)" == "projectM - Win32 Release"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir "Release"
|
||||
# PROP BASE Intermediate_Dir "Release"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "Release"
|
||||
# PROP Intermediate_Dir "Release"
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
|
||||
# ADD CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
|
||||
# ADD BASE RSC /l 0x409 /d "NDEBUG"
|
||||
# ADD RSC /l 0x409 /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LIB32=link.exe -lib
|
||||
# ADD BASE LIB32 /nologo
|
||||
# ADD LIB32 /nologo
|
||||
|
||||
!ELSEIF "$(CFG)" == "projectM - Win32 Debug"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 1
|
||||
# PROP BASE Output_Dir "Debug"
|
||||
# PROP BASE Intermediate_Dir "Debug"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir "Debug"
|
||||
# PROP Intermediate_Dir "Debug"
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /D "DEBUG" /FD /GZ /c
|
||||
# SUBTRACT CPP /YX
|
||||
# ADD BASE RSC /l 0x409 /d "_DEBUG"
|
||||
# ADD RSC /l 0x409 /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LIB32=link.exe -lib
|
||||
# ADD BASE LIB32 /nologo
|
||||
# ADD LIB32 /nologo
|
||||
|
||||
!ENDIF
|
||||
|
||||
# Begin Target
|
||||
|
||||
# Name "projectM - Win32 Release"
|
||||
# Name "projectM - Win32 Debug"
|
||||
# Begin Group "Source Files"
|
||||
|
||||
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\beat_detect.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\browser.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\builtin_funcs.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\console_interface.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\custom_shape.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\custom_wave.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\editor.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\eval.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\fftsg.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\func.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\glConsole.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\glf.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\init_cond.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\menu.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\param.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\parser.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\PCM.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\per_frame_eqn.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\per_pixel_eqn.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\preset.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\projectm.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\pbuffer.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\splaytree.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\timer.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\tree_types.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=".\win32-dirent.c"
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\wipemalloc.c
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Header Files"
|
||||
|
||||
# PROP Default_Filter "h;hpp;hxx;hm;inl"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\beat_detect.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\browser.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\builtin_funcs.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\common.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\compare.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\config.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\console_interface.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\custom_shape.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\custom_shape_types.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\custom_wave.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\custom_wave_types.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\editor.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\eval.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\event.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\expr_types.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\fatal.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\fftsg.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\func.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\func_types.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\glConsole.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\glf.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\idle_preset.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\init_cond.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\init_cond_types.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\interface_types.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\menu.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\param.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\param_types.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\parser.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\PCM.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\per_frame_eqn.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\per_frame_eqn_types.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\per_pixel_eqn.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\per_pixel_eqn_types.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\per_point_types.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\preset.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\preset_types.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\projectM.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\pbuffer.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\splaytree.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\splaytree_types.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\timer.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\tree_types.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=".\win32-dirent.h"
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\wipemalloc.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# End Target
|
||||
# End Project
|
||||
376
libprojectM/src/projectM.h
Executable file
376
libprojectM/src/projectM.h
Executable file
@ -0,0 +1,376 @@
|
||||
/*
|
||||
* projectM -- Milkdrop-esque visualisation SDK
|
||||
* Copyright (C)2003-2004 projectM Team
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
* See 'LICENSE.txt' included within this release
|
||||
*
|
||||
*/
|
||||
/**
|
||||
* $Id: projectM.h,v 1.1.1.1 2005/12/23 18:05:11 psperl Exp $
|
||||
*
|
||||
* Encapsulation of ProjectM engine
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _PROJECTM_H
|
||||
#define _PROJECTM_H
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef MACOS
|
||||
#include <MacWindows.h>
|
||||
#include <gl.h>
|
||||
#include <glu.h>
|
||||
#else
|
||||
#ifdef WIN32
|
||||
#include <windows.h>
|
||||
#endif /** WIN32 */
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glu.h>
|
||||
#endif /** MACOS */
|
||||
#ifdef WIN32
|
||||
#define inline
|
||||
#endif /** WIN32 */
|
||||
#ifndef WIN32
|
||||
#include <sys/time.h>
|
||||
#else
|
||||
#endif /** !WIN32 */
|
||||
|
||||
#include "pbuffer.h"
|
||||
|
||||
//#include <dmalloc.h>
|
||||
|
||||
#ifdef WIN32
|
||||
#pragma warning (disable:4244)
|
||||
#pragma warning (disable:4305)
|
||||
#endif /** WIN32 */
|
||||
|
||||
#ifdef MACOS
|
||||
#define inline
|
||||
#endif
|
||||
|
||||
/** KEEP THIS UP TO DATE! */
|
||||
#define PROJECTM_VERSION "0.99"
|
||||
#define PROJECTM_TITLE "projectM 0.99"
|
||||
|
||||
#ifdef MACOS
|
||||
#define kTVisualPluginName "\pprojectM"
|
||||
#define kTVisualPluginCreator 'hook'
|
||||
|
||||
#define kTVisualPluginMajorVersion 1
|
||||
#define kTVisualPluginMinorVersion 0
|
||||
#define kTVisualPluginReleaseStage finalStage
|
||||
#define kTVisualPluginNonFinalRelease 0
|
||||
#endif
|
||||
|
||||
/** Per-platform path separators */
|
||||
#define WIN32_PATH_SEPARATOR '\\'
|
||||
#define UNIX_PATH_SEPARATOR '/'
|
||||
#ifdef WIN32
|
||||
#define PATH_SEPARATOR WIN32_PATH_SEPARATOR
|
||||
#else
|
||||
#define PATH_SEPARATOR UNIX_PATH_SEPARATOR
|
||||
#endif /** WIN32 */
|
||||
|
||||
/** External debug file */
|
||||
#ifdef DEBUG
|
||||
extern FILE *debugFile;
|
||||
#endif
|
||||
|
||||
/** Thread state */
|
||||
typedef enum { GO, STOP } PMThreadState;
|
||||
|
||||
typedef struct PROJECTM {
|
||||
|
||||
char *presetURL;
|
||||
char *presetName;
|
||||
char *fontURL;
|
||||
|
||||
int hasInit;
|
||||
|
||||
int noSwitch;
|
||||
int pcmframes;
|
||||
int freqframes;
|
||||
int totalframes;
|
||||
|
||||
int showfps;
|
||||
int showtitle;
|
||||
int showpreset;
|
||||
int showhelp;
|
||||
int showstats;
|
||||
|
||||
int studio;
|
||||
|
||||
GLubyte *fbuffer;
|
||||
|
||||
|
||||
|
||||
#ifndef WIN32
|
||||
/* The first ticks value of the application */
|
||||
struct timeval startTime;
|
||||
#else
|
||||
long startTime;
|
||||
#endif /** !WIN32 */
|
||||
float Time;
|
||||
|
||||
/** Render target texture ID */
|
||||
RenderTarget *renderTarget;
|
||||
|
||||
char disp[80];
|
||||
|
||||
float wave_o;
|
||||
|
||||
//int texsize=1024; //size of texture to do actual graphics
|
||||
int fvw; //fullscreen dimensions
|
||||
int fvh;
|
||||
int wvw; //windowed dimensions
|
||||
int wvh;
|
||||
int vw; //runtime dimensions
|
||||
int vh;
|
||||
int fullscreen;
|
||||
|
||||
int maxsamples; //size of PCM buffer
|
||||
int numsamples; //size of new PCM info
|
||||
float *pcmdataL; //holder for most recent pcm data
|
||||
float *pcmdataR; //holder for most recent pcm data
|
||||
|
||||
int avgtime; //# frames per preset
|
||||
|
||||
char *title;
|
||||
int drawtitle;
|
||||
|
||||
int correction;
|
||||
|
||||
float vol;
|
||||
|
||||
//per pixel equation variables
|
||||
float **gridx; //grid containing interpolated mesh
|
||||
float **gridy;
|
||||
float **origtheta; //grid containing interpolated mesh reference values
|
||||
float **origrad;
|
||||
float **origx; //original mesh
|
||||
float **origy;
|
||||
float **origx2; //original mesh
|
||||
float **origy2;
|
||||
|
||||
/** Timing information */
|
||||
int mspf;
|
||||
int timed;
|
||||
int timestart;
|
||||
int nohard;
|
||||
int count;
|
||||
float realfps,
|
||||
fpsstart;
|
||||
|
||||
/** PCM data */
|
||||
float vdataL[512]; //holders for FFT data (spectrum)
|
||||
float vdataR[512];
|
||||
|
||||
/** Various toggles */
|
||||
int doPerPixelEffects;
|
||||
int doIterative;
|
||||
|
||||
/** ENGINE VARIABLES */
|
||||
/** From engine_vars.h */
|
||||
char preset_name[256];
|
||||
|
||||
/* PER FRAME CONSTANTS BEGIN */
|
||||
float zoom;
|
||||
float zoomexp;
|
||||
float rot;
|
||||
float warp;
|
||||
|
||||
float sx;
|
||||
float sy;
|
||||
float dx;
|
||||
float dy;
|
||||
float cx;
|
||||
float cy;
|
||||
|
||||
int gy;
|
||||
int gx;
|
||||
|
||||
float decay;
|
||||
|
||||
float wave_r;
|
||||
float wave_g;
|
||||
float wave_b;
|
||||
float wave_x;
|
||||
float wave_y;
|
||||
float wave_mystery;
|
||||
|
||||
float ob_size;
|
||||
float ob_r;
|
||||
float ob_g;
|
||||
float ob_b;
|
||||
float ob_a;
|
||||
|
||||
float ib_size;
|
||||
float ib_r;
|
||||
float ib_g;
|
||||
float ib_b;
|
||||
float ib_a;
|
||||
|
||||
int meshx;
|
||||
int meshy;
|
||||
|
||||
float mv_a ;
|
||||
float mv_r ;
|
||||
float mv_g ;
|
||||
float mv_b ;
|
||||
float mv_l;
|
||||
float mv_x;
|
||||
float mv_y;
|
||||
float mv_dy;
|
||||
float mv_dx;
|
||||
|
||||
float treb ;
|
||||
float mid ;
|
||||
float bass ;
|
||||
float bass_old ;
|
||||
float beat_sensitivity;
|
||||
float treb_att ;
|
||||
float mid_att ;
|
||||
float bass_att ;
|
||||
float progress ;
|
||||
int frame ;
|
||||
|
||||
/* PER_FRAME CONSTANTS END */
|
||||
|
||||
/* PER_PIXEL CONSTANTS BEGIN */
|
||||
|
||||
float x_per_pixel;
|
||||
float y_per_pixel;
|
||||
float rad_per_pixel;
|
||||
float ang_per_pixel;
|
||||
|
||||
/* PER_PIXEL CONSTANT END */
|
||||
|
||||
|
||||
float fRating;
|
||||
float fGammaAdj;
|
||||
float fVideoEchoZoom;
|
||||
float fVideoEchoAlpha;
|
||||
|
||||
int nVideoEchoOrientation;
|
||||
int nWaveMode;
|
||||
int bAdditiveWaves;
|
||||
int bWaveDots;
|
||||
int bWaveThick;
|
||||
int bModWaveAlphaByVolume;
|
||||
int bMaximizeWaveColor;
|
||||
int bTexWrap;
|
||||
int bDarkenCenter;
|
||||
int bRedBlueStereo;
|
||||
int bBrighten;
|
||||
int bDarken;
|
||||
int bSolarize;
|
||||
int bInvert;
|
||||
int bMotionVectorsOn;
|
||||
int fps;
|
||||
|
||||
float fWaveAlpha ;
|
||||
float fWaveScale;
|
||||
float fWaveSmoothing;
|
||||
float fWaveParam;
|
||||
float fModWaveAlphaStart;
|
||||
float fModWaveAlphaEnd;
|
||||
float fWarpAnimSpeed;
|
||||
float fWarpScale;
|
||||
float fShader;
|
||||
|
||||
|
||||
/* Q VARIABLES START */
|
||||
|
||||
float q1;
|
||||
float q2;
|
||||
float q3;
|
||||
float q4;
|
||||
float q5;
|
||||
float q6;
|
||||
float q7;
|
||||
float q8;
|
||||
|
||||
|
||||
/* Q VARIABLES END */
|
||||
|
||||
float **zoom_mesh;
|
||||
float **zoomexp_mesh;
|
||||
float **rot_mesh;
|
||||
|
||||
float **sx_mesh;
|
||||
float **sy_mesh;
|
||||
float **dx_mesh;
|
||||
float **dy_mesh;
|
||||
float **cx_mesh;
|
||||
float **cy_mesh;
|
||||
|
||||
float **x_mesh;
|
||||
float **y_mesh;
|
||||
float **rad_mesh;
|
||||
float **theta_mesh;
|
||||
} projectM_t;
|
||||
|
||||
/** Functions */
|
||||
#ifdef __CPLUSPLUS
|
||||
extern "C" void projectM_init(projectM_t *pm);
|
||||
extern "C" void projectM_reset( projectM_t *pm );
|
||||
extern "C" void projectM_resetGL( projectM_t *pm, int width, int height );
|
||||
extern "C" void projectM_setTitle( projectM_t *pm, char *title );
|
||||
extern "C" void renderFrame(projectM_t *pm);
|
||||
#else
|
||||
extern void projectM_init(projectM_t *pm);
|
||||
extern void projectM_reset( projectM_t *pm );
|
||||
extern void projectM_resetGL( projectM_t *pm, int width, int height );
|
||||
extern void projectM_setTitle( projectM_t *pm, char *title );
|
||||
extern void renderFrame(projectM_t *pm);
|
||||
#endif
|
||||
|
||||
void projectM_initengine(projectM_t *pm);
|
||||
void projectM_resetengine(projectM_t *pm);
|
||||
extern void draw_help(projectM_t *pm);
|
||||
extern void draw_fps(projectM_t *pm,float fps);
|
||||
extern void draw_preset(projectM_t *pm);
|
||||
extern void draw_title(projectM_t *pm);
|
||||
extern void draw_stats(projectM_t *pm);
|
||||
|
||||
extern void modulate_opacity_by_volume(projectM_t *pm);
|
||||
extern void maximize_colors(projectM_t *pm);
|
||||
extern void do_per_pixel_math(projectM_t *pm);
|
||||
extern void do_per_frame(projectM_t *pm);
|
||||
extern void render_texture_to_studio(projectM_t *pm);
|
||||
extern void darken_center(projectM_t *pm);
|
||||
|
||||
extern void render_interpolation(projectM_t *pm);
|
||||
extern void render_texture_to_screen(projectM_t *pm);
|
||||
extern void render_texture_to_studio(projectM_t *pm);
|
||||
extern void draw_motion_vectors(projectM_t *pm);
|
||||
extern void draw_borders(projectM_t *pm);
|
||||
extern void draw_shapes(projectM_t *pm);
|
||||
extern void draw_waveform(projectM_t *pm);
|
||||
extern void draw_custom_waves(projectM_t *pm);
|
||||
|
||||
extern void draw_title_to_screen(projectM_t *pm);
|
||||
extern void draw_title_to_texture(projectM_t *pm);
|
||||
extern void get_title(projectM_t *pm);
|
||||
|
||||
extern void reset_per_pixel_matrices(projectM_t *pm);
|
||||
extern void init_per_pixel_matrices(projectM_t *pm);
|
||||
extern void rescale_per_pixel_matrices(projectM_t *pm);
|
||||
|
||||
#endif /** !_PROJECTM_H */
|
||||
BIN
libprojectM/src/projectM.ncb
Executable file
BIN
libprojectM/src/projectM.ncb
Executable file
Binary file not shown.
BIN
libprojectM/src/projectM.opt
Executable file
BIN
libprojectM/src/projectM.opt
Executable file
Binary file not shown.
22
libprojectM/src/share/config
Normal file
22
libprojectM/src/share/config
Normal file
@ -0,0 +1,22 @@
|
||||
projectM Config file (ONLY CHANGE THE NUMBERS!!!!!!)
|
||||
------------------------------------------------------
|
||||
Texture Size (Must be power of 2) [256,512,1024,2048, etc]
|
||||
512
|
||||
Grid X Dimension (Higher is Better but much slower) 12-60
|
||||
32
|
||||
Grid Y Dimension (Higher is Better but much slower) 8-45
|
||||
24
|
||||
Windowed Width (Initial window width)
|
||||
512
|
||||
Windowed Height (Initial window width)
|
||||
512
|
||||
Fullscreen Width (set to your native screen resolution)
|
||||
1024
|
||||
Fullscreen Height (set to your native screen resolution)
|
||||
768
|
||||
FPS (Higher the Better) 30-90 is realisitc
|
||||
35
|
||||
Fullscreen on Startup (1=yes, 0=no)
|
||||
0
|
||||
X Server to Display projectM default is ":0.0"
|
||||
:0.0
|
||||
22
libprojectM/src/share/config.fastcomputers
Normal file
22
libprojectM/src/share/config.fastcomputers
Normal file
@ -0,0 +1,22 @@
|
||||
projectM Config file (ONLY CHANGE THE NUMBERS!!!!!!)
|
||||
------------------------------------------------------
|
||||
Texture Size (Must be power of 2) [256,512,1024,2048, etc]
|
||||
1024
|
||||
Grid X Dimension (Higher is Better but much slower) 12-60
|
||||
40
|
||||
Grid Y Dimension (Higher is Better but much slower) 8-45
|
||||
30
|
||||
Windowed Width (Initial window width)
|
||||
512
|
||||
Windowed Height (Initial window width)
|
||||
512
|
||||
Fullscreen Width (set to your native screen resolution)
|
||||
1024
|
||||
Fullscreen Height (set to your native screen resolution)
|
||||
768
|
||||
FPS (Higher the Better) 30-60 is realisitc
|
||||
60
|
||||
Fullscreen on Startup (1=yes, 0=no)
|
||||
0
|
||||
X Server to Display projectM default is ":0.0"
|
||||
:0.0
|
||||
22
libprojectM/src/share/config.slowcomputers
Normal file
22
libprojectM/src/share/config.slowcomputers
Normal file
@ -0,0 +1,22 @@
|
||||
projectM Config file (ONLY CHANGE THE NUMBERS!!!!!!)
|
||||
------------------------------------------------------
|
||||
Texture Size (Must be power of 2) [256,512,1024,2048, etc]
|
||||
512
|
||||
Grid X Dimension (Higher is Better but much slower) 12-60
|
||||
24
|
||||
Grid Y Dimension (Higher is Better but much slower) 8-45
|
||||
18
|
||||
Windowed Width (Initial window width)
|
||||
400
|
||||
Windowed Height (Initial window width)
|
||||
300
|
||||
Fullscreen Width (set to your native screen resolution)
|
||||
800
|
||||
Fullscreen Height (set to your native screen resolution)
|
||||
600
|
||||
FPS (Higher the Better) 30-60 is realisitc
|
||||
30
|
||||
Fullscreen on Startup (1=yes, 0=no)
|
||||
0
|
||||
X Server to Display projectM default is ":0.0"
|
||||
:0.0
|
||||
BIN
libprojectM/src/share/fonts/Vera.ttf
Normal file
BIN
libprojectM/src/share/fonts/Vera.ttf
Normal file
Binary file not shown.
BIN
libprojectM/src/share/fonts/VeraMono.ttf
Normal file
BIN
libprojectM/src/share/fonts/VeraMono.ttf
Normal file
Binary file not shown.
71
libprojectM/src/share/presets/#Rovastar - Cosmic Echoes 2.milk#
Executable file
71
libprojectM/src/share/presets/#Rovastar - Cosmic Echoes 2.milk#
Executable file
@ -0,0 +1,71 @@
|
||||
[preset00]
|
||||
fRating=2.000000
|
||||
fGammaAdj=1.840000
|
||||
fDecay=0.900000
|
||||
fVideoEchoZoom=2.215847
|
||||
fVideoEchoAlpha=0.000000
|
||||
nVideoEchoOrientation=0
|
||||
nWaveMode=7
|
||||
bAdditiveWaves=1
|
||||
bWaveDots=0
|
||||
bModWaveAlphaByVolume=1
|
||||
bMaximizeWaveColor=0
|
||||
bTexWrap=0
|
||||
bDarkenCenter=0
|
||||
bMotionVectorsOn=0
|
||||
bRedBlueStereo=0
|
||||
nMotionVectorsX=12
|
||||
nMotionVectorsY=9
|
||||
bBrighten=0
|
||||
bDarken=0
|
||||
bSolnarize=0
|
||||
bInvert=0
|
||||
fWaveAlpha=4.099998
|
||||
fWaveScale=0.130388
|
||||
fWaveSmoothing=0.540000
|
||||
fWaveParam=0.000000
|
||||
fModWaveAlphaStart=0.710000
|
||||
fModWaveAlphaEnd=1.300000
|
||||
fWarpAnimSpeed=1.000000
|
||||
fWarpScale=1.331000
|
||||
fZoomExponent=1.000000
|
||||
fShader=0.000000
|
||||
zoom=0.999514
|
||||
rot=0.000000
|
||||
cx=0.500000
|
||||
cy=0.500000
|
||||
dx=0.000000
|
||||
dy=0.000000
|
||||
warp=0.010000
|
||||
sx=1.000000
|
||||
sy=1.000000
|
||||
wave_r=0.650000
|
||||
wave_g=0.650000
|
||||
wave_b=0.650000
|
||||
wave_x=0.500000
|
||||
wave_y=1.000000
|
||||
ob_size=0.500000
|
||||
ob_r=0.010000
|
||||
ob_g=0.000000
|
||||
ob_b=0.000000
|
||||
ob_a=0.000000
|
||||
ib_size=0.260000
|
||||
ib_r=0.250000
|
||||
ib_g=0.250000
|
||||
ib_b=0.250000
|
||||
ib_a=0.000000
|
||||
per_frame_1=bass_thresh = above(bass_att,bass_thresh)*2 + (1-above(bass_att,bass_thresh))*((bass_thresh-1.4)*0.85+1.4);
|
||||
per_frame_2=treb_thresh = above(treb_att,treb_thresh)*2 + (1-above(treb_att,treb_thresh))*((treb_thresh-1.5)*0.75+1.5);
|
||||
per_frame_3=bass_on = above(bass_thresh,1.8);
|
||||
per_frame_4=treb_on = above(treb_thresh,1.9);
|
||||
per_frame_5=swapcolour = bass_on - treb_on;
|
||||
per_frame_6=red_aim = if(equal(swapcolour,1),1,if(equal(swapcolour,0),1,0));
|
||||
per_frame_7=green_aim = if(equal(swapcolour,1),0,if(equal(swapcolour,0),0.5,0.25));
|
||||
per_frame_8=blue_aim = if(equal(swapcolour,1),0,if(equal(swapcolour,0),0,1));
|
||||
per_frame_9=red = red + (red_aim - red)*if(equal(swapcolour,1),0.65,0.45);
|
||||
per_frame_10=green = green + (green_aim - green)*0.5;
|
||||
per_frame_11=blue = blue + (blue_aim - blue)*if(equal(swapcolour,1),0.45,0.65);
|
||||
per_frame_12=wave_r = red;
|
||||
per_frame_13=wave_g = green;
|
||||
per_frame_14=wave_b = blue;
|
||||
per_pixel_1=dy = if(above(y,0.5),sin(0.5-y)/10, log10(1/y)/35);
|
||||
69
libprojectM/src/share/presets/Aderrasi - Agitator.milk
Executable file
69
libprojectM/src/share/presets/Aderrasi - Agitator.milk
Executable file
@ -0,0 +1,69 @@
|
||||
[preset00]
|
||||
fRating=3.000000
|
||||
fGammaAdj=1.504000
|
||||
fDecay=0.900000
|
||||
fVideoEchoZoom=0.999592
|
||||
fVideoEchoAlpha=0.500000
|
||||
nVideoEchoOrientation=3
|
||||
nWaveMode=0
|
||||
bAdditiveWaves=0
|
||||
bWaveDots=0
|
||||
bWaveThick=0
|
||||
bModWaveAlphaByVolume=0
|
||||
bMaximizeWaveColor=1
|
||||
bTexWrap=1
|
||||
bDarkenCenter=0
|
||||
bRedBlueStereo=0
|
||||
bBrighten=0
|
||||
bDarken=0
|
||||
bSolarize=0
|
||||
bInvert=0
|
||||
fWaveAlpha=100.000000
|
||||
fWaveScale=0.311604
|
||||
fWaveSmoothing=0.450000
|
||||
fWaveParam=-0.500000
|
||||
fModWaveAlphaStart=0.710000
|
||||
fModWaveAlphaEnd=1.300000
|
||||
fWarpAnimSpeed=0.010000
|
||||
fWarpScale=0.438651
|
||||
fZoomExponent=0.999994
|
||||
fShader=0.000000
|
||||
zoom=1.000156
|
||||
rot=0.000000
|
||||
cx=0.500000
|
||||
cy=0.500000
|
||||
dx=0.000000
|
||||
dy=0.000000
|
||||
warp=0.010000
|
||||
sx=0.990099
|
||||
sy=0.990099
|
||||
wave_r=0.500000
|
||||
wave_g=0.500000
|
||||
wave_b=0.500000
|
||||
wave_x=0.500000
|
||||
wave_y=0.500000
|
||||
ob_size=0.100000
|
||||
ob_r=0.000000
|
||||
ob_g=0.600000
|
||||
ob_b=0.500000
|
||||
ob_a=0.100000
|
||||
ib_size=0.050000
|
||||
ib_r=0.000000
|
||||
ib_g=1.000000
|
||||
ib_b=1.000000
|
||||
ib_a=0.100000
|
||||
nMotionVectorsX=12.799995
|
||||
nMotionVectorsY=9.000000
|
||||
mv_dx=0.000000
|
||||
mv_dy=0.000000
|
||||
mv_l=5.000000
|
||||
mv_r=1.000000
|
||||
mv_g=1.000000
|
||||
mv_b=1.000000
|
||||
mv_a=0.000000
|
||||
per_frame_1=wave_r = wave_r + 0.5*sin(1.2*frame) + 0.3*sin(1.9*frame);
|
||||
per_frame_2=wave_g = wave_g + 0.7*sin(1.1*frame) + 0.4*cos(1.6*frame);
|
||||
per_frame_3=wave_b = wave_b + 0.2*sin(1.3*frame) + 0.4*sin(2*frame);
|
||||
per_pixel_1=rot=rot + (0.5 + 0.1*sin(bass)-rad)*pow(bass,3)/50;
|
||||
per_pixel_2=zoom= zoom + (0.5 + 0.3*tan(3*bass_att)-rad)*(cos(pow(rad,2.4))+(0.2*mid_att));
|
||||
per_pixel_3=warp = warp + if (above(bass,1.34), 0.5*(0.5+ 0.1*sin(bass)-rad)*(cos(pow(rad,2.4))+(5*bass_att)), 0);
|
||||
@ -0,0 +1,75 @@
|
||||
[preset00]
|
||||
fRating=3.000000
|
||||
fGammaAdj=1.000000
|
||||
fDecay=1.000000
|
||||
fVideoEchoZoom=1.000000
|
||||
fVideoEchoAlpha=0.000000
|
||||
nVideoEchoOrientation=3
|
||||
nWaveMode=0
|
||||
bAdditiveWaves=0
|
||||
bWaveDots=0
|
||||
bWaveThick=1
|
||||
bModWaveAlphaByVolume=0
|
||||
bMaximizeWaveColor=1
|
||||
bTexWrap=0
|
||||
bDarkenCenter=0
|
||||
bRedBlueStereo=0
|
||||
bBrighten=0
|
||||
bDarken=0
|
||||
bSolarize=0
|
||||
bInvert=0
|
||||
fWaveAlpha=100.000000
|
||||
fWaveScale=0.611434
|
||||
fWaveSmoothing=0.000000
|
||||
fWaveParam=-0.500000
|
||||
fModWaveAlphaStart=0.710000
|
||||
fModWaveAlphaEnd=1.300000
|
||||
fWarpAnimSpeed=1.000000
|
||||
fWarpScale=1.000000
|
||||
fZoomExponent=0.900000
|
||||
fShader=1.000000
|
||||
zoom=1.000000
|
||||
rot=0.000000
|
||||
cx=0.500000
|
||||
cy=0.500000
|
||||
dx=0.000000
|
||||
dy=0.000000
|
||||
warp=0.010000
|
||||
sx=1.000000
|
||||
sy=1.000000
|
||||
wave_r=0.500000
|
||||
wave_g=0.500000
|
||||
wave_b=0.500000
|
||||
wave_x=0.500000
|
||||
wave_y=0.500000
|
||||
ob_size=0.005000
|
||||
ob_r=0.010000
|
||||
ob_g=0.000000
|
||||
ob_b=0.000000
|
||||
ob_a=1.000000
|
||||
ib_size=0.260000
|
||||
ib_r=0.250000
|
||||
ib_g=0.250000
|
||||
ib_b=0.250000
|
||||
ib_a=0.000000
|
||||
nMotionVectorsX=64.000000
|
||||
nMotionVectorsY=48.000000
|
||||
mv_dx=0.000000
|
||||
mv_dy=0.000000
|
||||
mv_l=1.000000
|
||||
mv_r=1.000000
|
||||
mv_g=1.000000
|
||||
mv_b=1.000000
|
||||
mv_a=0.000000
|
||||
per_frame_1=wave_x = wave_x + 0.12*sin(0.2*time) - 0.15*cos(0.1*time) + 0.1*sin(0.2*time);
|
||||
per_frame_2=wave_y = wave_y + 0.1*sin(0.3*time) - 0.2*sin(0.88*time) + 0.13*cos(0.7*time);
|
||||
per_frame_3=dx = dx + 0.04*sin(1.24*time);
|
||||
per_frame_4=dy = dy + 0.04*sin(1.12*time);
|
||||
per_frame_5=wave_r = wave_r + 0.35*sin(1.13*time) + 0.1245*sin(2.34*time);
|
||||
per_frame_6=wave_g = wave_g + 0.35*sin(1.23*time) + 0.12*sin(2.134*time);
|
||||
per_frame_7=wave_b = wave_b + 0.35*sin(1.33*time) + 0.12*sin(2.5*time);
|
||||
per_frame_8=wave_mystery = wave_mystery + 0.00*sin(time);
|
||||
per_frame_9=turn = above(bass_att,turn)*2 + (1-above(bass_att,turn))*((turn-1.3)*0.96+1.3);
|
||||
per_frame_10=turnr = equal(turn,2)*0.089*sin(time*6.6) + (1-equal(turn,2))*turnr;
|
||||
per_frame_11=simp = simp * 0.35*sin(1.2*time) - 0.62*sin(0.7*time) + 1.5*sin(turn);
|
||||
per_frame_12=rot = rot + 1.05*((0.25*simp)*10*turnr);
|
||||
75
libprojectM/src/share/presets/Aderrasi - Aimless (Spirogravity Mix).milk
Executable file
75
libprojectM/src/share/presets/Aderrasi - Aimless (Spirogravity Mix).milk
Executable file
@ -0,0 +1,75 @@
|
||||
[preset00]
|
||||
fRating=3.000000
|
||||
fGammaAdj=1.000000
|
||||
fDecay=1.000000
|
||||
fVideoEchoZoom=1.000000
|
||||
fVideoEchoAlpha=0.000000
|
||||
nVideoEchoOrientation=3
|
||||
nWaveMode=0
|
||||
bAdditiveWaves=0
|
||||
bWaveDots=0
|
||||
bWaveThick=1
|
||||
bModWaveAlphaByVolume=0
|
||||
bMaximizeWaveColor=1
|
||||
bTexWrap=0
|
||||
bDarkenCenter=0
|
||||
bRedBlueStereo=0
|
||||
bBrighten=0
|
||||
bDarken=0
|
||||
bSolarize=0
|
||||
bInvert=0
|
||||
fWaveAlpha=100.000000
|
||||
fWaveScale=0.611434
|
||||
fWaveSmoothing=0.000000
|
||||
fWaveParam=-0.500000
|
||||
fModWaveAlphaStart=0.710000
|
||||
fModWaveAlphaEnd=1.300000
|
||||
fWarpAnimSpeed=1.000000
|
||||
fWarpScale=1.000000
|
||||
fZoomExponent=0.900000
|
||||
fShader=1.000000
|
||||
zoom=1.000000
|
||||
rot=0.000000
|
||||
cx=0.500000
|
||||
cy=0.500000
|
||||
dx=0.000000
|
||||
dy=0.000000
|
||||
warp=0.010000
|
||||
sx=1.000000
|
||||
sy=1.000000
|
||||
wave_r=0.500000
|
||||
wave_g=0.500000
|
||||
wave_b=0.500000
|
||||
wave_x=0.500000
|
||||
wave_y=0.500000
|
||||
ob_size=0.005000
|
||||
ob_r=0.010000
|
||||
ob_g=0.000000
|
||||
ob_b=0.000000
|
||||
ob_a=1.000000
|
||||
ib_size=0.260000
|
||||
ib_r=0.250000
|
||||
ib_g=0.250000
|
||||
ib_b=0.250000
|
||||
ib_a=0.000000
|
||||
nMotionVectorsX=64.000000
|
||||
nMotionVectorsY=48.000000
|
||||
mv_dx=0.000000
|
||||
mv_dy=0.000000
|
||||
mv_l=1.000000
|
||||
mv_r=1.000000
|
||||
mv_g=1.000000
|
||||
mv_b=1.000000
|
||||
mv_a=0.000000
|
||||
per_frame_1=wave_x = wave_x + 0.12*sin(0.2*time) - 0.15*cos(0.1*time) + 0.1*sin(0.2*time);
|
||||
per_frame_2=wave_y = wave_y + 0.1*sin(0.3*time) - 0.2*sin(0.88*time) + 0.13*cos(0.7*time);
|
||||
per_frame_3=dx = dx + 0.04*sin(1.24*time);
|
||||
per_frame_4=dy = dy + 0.04*sin(1.12*time);
|
||||
per_frame_5=wave_r = wave_r + 0.35*sin(1.13*time) + 0.1245*sin(2.34*time);
|
||||
per_frame_6=wave_g = wave_g + 0.35*sin(1.23*time) + 0.12*sin(2.134*time);
|
||||
per_frame_7=wave_b = wave_b + 0.35*sin(1.33*time) + 0.12*sin(2.5*time);
|
||||
per_frame_8=wave_mystery = wave_mystery + 0.00*sin(time);
|
||||
per_frame_9=turn = above(bass_att,turn)*2 + (1-above(bass_att,turn))*((turn-1.3)*0.96+1.3);
|
||||
per_frame_10=turnr = equal(turn,2)*0.089*sin(time*6.6) + (1-equal(turn,2))*turnr;
|
||||
per_frame_11=simp = simp * 0.35*sin(1.2*time) - 0.62*sin(0.7*time) + 1.5*sin(turn);
|
||||
per_frame_12=rot = rot + 1.05*((0.25*simp)*10*turnr);
|
||||
77
libprojectM/src/share/presets/Aderrasi - Airhandler (Menagerie Mix).milk
Executable file
77
libprojectM/src/share/presets/Aderrasi - Airhandler (Menagerie Mix).milk
Executable file
@ -0,0 +1,77 @@
|
||||
[preset00]
|
||||
fRating=3.000000
|
||||
fGammaAdj=1.700000
|
||||
fDecay=0.990000
|
||||
fVideoEchoZoom=0.999600
|
||||
fVideoEchoAlpha=0.500000
|
||||
nVideoEchoOrientation=3
|
||||
nWaveMode=1
|
||||
bAdditiveWaves=0
|
||||
bWaveDots=1
|
||||
bWaveThick=0
|
||||
bModWaveAlphaByVolume=0
|
||||
bMaximizeWaveColor=0
|
||||
bTexWrap=1
|
||||
bDarkenCenter=0
|
||||
bRedBlueStereo=0
|
||||
bBrighten=0
|
||||
bDarken=0
|
||||
bSolarize=0
|
||||
bInvert=0
|
||||
fWaveAlpha=100.000000
|
||||
fWaveScale=1.053726
|
||||
fWaveSmoothing=0.000000
|
||||
fWaveParam=0.000000
|
||||
fModWaveAlphaStart=0.710000
|
||||
fModWaveAlphaEnd=1.300000
|
||||
fWarpAnimSpeed=1.000000
|
||||
fWarpScale=1.331000
|
||||
fZoomExponent=1.000000
|
||||
fShader=0.000000
|
||||
zoom=0.999513
|
||||
rot=0.000000
|
||||
cx=0.500000
|
||||
cy=0.500000
|
||||
dx=0.000000
|
||||
dy=0.000000
|
||||
warp=0.010100
|
||||
sx=1.000000
|
||||
sy=1.000000
|
||||
wave_r=0.650000
|
||||
wave_g=0.650000
|
||||
wave_b=0.650000
|
||||
wave_x=0.500000
|
||||
wave_y=0.500000
|
||||
ob_size=0.005000
|
||||
ob_r=0.000000
|
||||
ob_g=0.000000
|
||||
ob_b=0.000000
|
||||
ob_a=0.900000
|
||||
ib_size=0.005000
|
||||
ib_r=0.000000
|
||||
ib_g=0.000000
|
||||
ib_b=0.000000
|
||||
ib_a=0.900000
|
||||
nMotionVectorsX=12.000000
|
||||
nMotionVectorsY=9.000000
|
||||
mv_dx=0.000000
|
||||
mv_dy=0.000000
|
||||
mv_l=0.900000
|
||||
mv_r=1.000000
|
||||
mv_g=1.000000
|
||||
mv_b=1.000000
|
||||
mv_a=0.000000
|
||||
per_frame_1=wave_r = wave_r + 0.5*sin(time*1.13);
|
||||
per_frame_2=wave_g = wave_g + 0.5*sin(time*1.23);
|
||||
per_frame_3=wave_b = wave_b + 0.5*sin(time*1.33);
|
||||
per_frame_4=
|
||||
per_frame_5=wave_x = wave_x + 0.05*sin(time);
|
||||
per_frame_6=wave_y = wave_y + 0.05*cos(time);
|
||||
per_frame_7=
|
||||
per_frame_8=ib_r = ib_r + 0.25*sin(time);
|
||||
per_frame_9=ib_g = ib_g + 0.25*cos(time);
|
||||
per_frame_10=ib_b = ib_b + 0.25*sin(0.5*time);
|
||||
per_pixel_1=zoom = zoom + 0.05*(sin(abs(50*sin(0.1*time))*rad) * sin(sin(time*2*sin(24*ang)*-rad))*3 * cos(rad));
|
||||
per_pixel_2=rot = rot + 0.1*sin(0.2+ 0.5*sin(time)-rad);
|
||||
per_pixel_3=cx = cx + 1.1*(0.99*(0.5-rad))*sin(0.733*time)*below(sin(time),cos(time));
|
||||
per_pixel_4=cy = cy + 1.1*(0.99*(0.5-rad))*cos(0.953*time)*above(sin(time),cos(0.5*time));
|
||||
82
libprojectM/src/share/presets/Aderrasi - Airs (Windy Mix).milk
Executable file
82
libprojectM/src/share/presets/Aderrasi - Airs (Windy Mix).milk
Executable file
@ -0,0 +1,82 @@
|
||||
[preset00]
|
||||
fRating=3.000000
|
||||
fGammaAdj=1.000000
|
||||
fDecay=1.000000
|
||||
fVideoEchoZoom=1.220183
|
||||
fVideoEchoAlpha=0.000000
|
||||
nVideoEchoOrientation=0
|
||||
nWaveMode=3
|
||||
bAdditiveWaves=1
|
||||
bWaveDots=0
|
||||
bWaveThick=0
|
||||
bModWaveAlphaByVolume=0
|
||||
bMaximizeWaveColor=0
|
||||
bTexWrap=0
|
||||
bDarkenCenter=0
|
||||
bRedBlueStereo=0
|
||||
bBrighten=0
|
||||
bDarken=0
|
||||
bSolarize=0
|
||||
bInvert=0
|
||||
fWaveAlpha=100.000000
|
||||
fWaveScale=0.241455
|
||||
fWaveSmoothing=0.000000
|
||||
fWaveParam=0.000000
|
||||
fModWaveAlphaStart=0.500000
|
||||
fModWaveAlphaEnd=1.000000
|
||||
fWarpAnimSpeed=1.000000
|
||||
fWarpScale=1.000000
|
||||
fZoomExponent=1.000000
|
||||
fShader=1.000000
|
||||
zoom=1.000000
|
||||
rot=0.000000
|
||||
cx=0.500000
|
||||
cy=0.500000
|
||||
dx=0.000010
|
||||
dy=0.000010
|
||||
warp=0.010000
|
||||
sx=1.000000
|
||||
sy=1.000000
|
||||
wave_r=0.500000
|
||||
wave_g=0.500000
|
||||
wave_b=0.500000
|
||||
wave_x=0.500000
|
||||
wave_y=0.500000
|
||||
ob_size=0.004500
|
||||
ob_r=1.000000
|
||||
ob_g=0.800000
|
||||
ob_b=0.000000
|
||||
ob_a=1.000000
|
||||
ib_size=0.005000
|
||||
ib_r=0.000000
|
||||
ib_g=0.000000
|
||||
ib_b=0.000000
|
||||
ib_a=0.500000
|
||||
nMotionVectorsX=3.000000
|
||||
nMotionVectorsY=48.000000
|
||||
mv_dx=0.000000
|
||||
mv_dy=0.000000
|
||||
mv_l=5.000000
|
||||
mv_r=0.000000
|
||||
mv_g=1.000000
|
||||
mv_b=1.000000
|
||||
mv_a=0.000000
|
||||
per_frame_1=wave_r = wave_r + 0.35*sin(1.4*time) + 0.15*sin(1.5*time);
|
||||
per_frame_2=wave_g = wave_g + 0.35*sin(1.7*time) + 0.15*sin(2.11*time);
|
||||
per_frame_3=wave_b = wave_b + 0.35*sin(1.84*time) + 0.15*sin(2.3*time);
|
||||
per_frame_4=
|
||||
per_frame_5=ib_r = wave_g;
|
||||
per_frame_6=ib_g = wave_b;
|
||||
per_frame_7=ib_b = wave_r;
|
||||
per_frame_8=ob_r = wave_b;
|
||||
per_frame_9=ob_g = wave_r;
|
||||
per_frame_10=ob_b = wave_g;
|
||||
per_pixel_1=thresh = above(bass_att,thresh)*2+(1-above(bass_att,thresh))*((thresh-1.3)*0.96+1.3);
|
||||
per_pixel_2=dx_r = equal(thresh,2)*0.015*sin(5*time)+(1-equal(thresh,2))*dx_r;
|
||||
per_pixel_3=dy_r = equal(thresh,2)*0.015*sin(6*time)+(1-equal(thresh,2))*dy_r;
|
||||
per_pixel_4=
|
||||
per_pixel_5=randomize = sin(time) - 0.75*cos(1.52*time) + 1.52*sin(5.5*time) - rand(2);
|
||||
per_pixel_6=dx = dx + 0.07*pow(rad,x*2)*sin(time) + dx_r*1.75*sin(0.25-rad*randomize);
|
||||
per_pixel_7=dy = dy + 0.07*pow(rad,x*2)*cos(time) + dy_r*1.75*sin(0.25-rad*randomize);
|
||||
per_pixel_8=zoom = zoom - 0.1*pow(rad,x*0.6 + y*0.6)*cos(rad*randomize)*2*sin(time);
|
||||
per_pixel_9=rot = rot - 0.25*(0.75*sin(1.25*time)*pow(rad,x)*sin(1.45*time))*sin(time);
|
||||
@ -0,0 +1,84 @@
|
||||
[preset00]
|
||||
fRating=2.000000
|
||||
fGammaAdj=1.700000
|
||||
fDecay=0.990000
|
||||
fVideoEchoZoom=0.451116
|
||||
fVideoEchoAlpha=0.000000
|
||||
nVideoEchoOrientation=3
|
||||
nWaveMode=5
|
||||
bAdditiveWaves=0
|
||||
bWaveDots=0
|
||||
bWaveThick=0
|
||||
bModWaveAlphaByVolume=0
|
||||
bMaximizeWaveColor=1
|
||||
bTexWrap=1
|
||||
bDarkenCenter=0
|
||||
bRedBlueStereo=0
|
||||
bBrighten=0
|
||||
bDarken=0
|
||||
bSolarize=0
|
||||
bInvert=0
|
||||
fWaveAlpha=100.000000
|
||||
fWaveScale=0.535239
|
||||
fWaveSmoothing=0.000000
|
||||
fWaveParam=-0.800000
|
||||
fModWaveAlphaStart=0.500000
|
||||
fModWaveAlphaEnd=1.000000
|
||||
fWarpAnimSpeed=1.000000
|
||||
fWarpScale=1.000000
|
||||
fZoomExponent=1.000000
|
||||
fShader=0.000000
|
||||
zoom=1.000000
|
||||
rot=0.000000
|
||||
cx=0.500000
|
||||
cy=0.500000
|
||||
dx=0.000010
|
||||
dy=0.000010
|
||||
warp=0.010000
|
||||
sx=1.000000
|
||||
sy=1.000000
|
||||
wave_r=0.500000
|
||||
wave_g=0.500000
|
||||
wave_b=0.500000
|
||||
wave_x=0.500000
|
||||
wave_y=0.500000
|
||||
ob_size=0.005000
|
||||
ob_r=0.000000
|
||||
ob_g=0.000000
|
||||
ob_b=0.000000
|
||||
ob_a=0.000000
|
||||
ib_size=0.005000
|
||||
ib_r=0.000000
|
||||
ib_g=0.000000
|
||||
ib_b=0.000000
|
||||
ib_a=1.000000
|
||||
nMotionVectorsX=0.000000
|
||||
nMotionVectorsY=0.000000
|
||||
mv_dx=0.000000
|
||||
mv_dy=0.000000
|
||||
mv_l=1.000000
|
||||
mv_r=1.000000
|
||||
mv_g=1.000000
|
||||
mv_b=1.000000
|
||||
mv_a=0.000000
|
||||
per_frame_1=wave_r = wave_r + 0.25*sin(1.4*time) + 0.25*sin(2.25*time);
|
||||
per_frame_2=wave_g = wave_g + 0.25*sin(1.7*time) + 0.25*sin(2.11*time);
|
||||
per_frame_3=wave_b = wave_b + 0.25*sin(1.84*time) + 0.25*sin(2.3*time);
|
||||
per_frame_4=warp = 0;
|
||||
per_frame_5=
|
||||
per_frame_6=ob_r = wave_b;
|
||||
per_frame_7=ob_g = wave_r;
|
||||
per_frame_8=ob_b = wave_g;
|
||||
per_pixel_1=thresh = above(bass_att,thresh)*2+(1-above(bass_att,thresh))*((thresh-1.3)*0.96+1.3);
|
||||
per_pixel_2=dx_r = equal(thresh,2)*0.015*sin(5*time)+(1-equal(thresh,2))*dx_r;
|
||||
per_pixel_3=dy_r = equal(thresh,2)*0.015*sin(6*time)+(1-equal(thresh,2))*dy_r;
|
||||
per_pixel_4=
|
||||
per_pixel_5=orb = ((0.5 - 0.5*sin(12*(sin(rad*time+ang))*(ang*time+rad)*time+rad))-2*rad);
|
||||
per_pixel_6=
|
||||
per_pixel_7=zoom = zoom + 0.1*sin(0.6*cos(0.33*(0.6*sin(1.52*time)*orb + (orb*0.8*cos(2.2*time))+ ((cos(orb))*0.7*sin(time)))))*(above(zoom,0.3)*0);
|
||||
per_pixel_8=
|
||||
per_pixel_9=sx = sx + (orb)*0.2*abs((above(sin(1.2*time),0))*sin(0.8*time));
|
||||
per_pixel_10=sy = sy + (-orb)*0.2*abs((below(sin(1.45*time),0))*cos(0.63*time));
|
||||
per_pixel_11=
|
||||
per_pixel_12=dx = dx + 2*dx_r;
|
||||
per_pixel_13=dy = dy+ 2*dy_r;
|
||||
80
libprojectM/src/share/presets/Aderrasi - Anchorpulse (Verified Mix).milk
Executable file
80
libprojectM/src/share/presets/Aderrasi - Anchorpulse (Verified Mix).milk
Executable file
@ -0,0 +1,80 @@
|
||||
[preset00]
|
||||
fRating=2.000000
|
||||
fGammaAdj=1.000000
|
||||
fDecay=0.950000
|
||||
fVideoEchoZoom=1.347848
|
||||
fVideoEchoAlpha=0.600000
|
||||
nVideoEchoOrientation=0
|
||||
nWaveMode=2
|
||||
bAdditiveWaves=0
|
||||
bWaveDots=1
|
||||
bWaveThick=0
|
||||
bModWaveAlphaByVolume=0
|
||||
bMaximizeWaveColor=0
|
||||
bTexWrap=0
|
||||
bDarkenCenter=0
|
||||
bRedBlueStereo=0
|
||||
bBrighten=0
|
||||
bDarken=0
|
||||
bSolarize=0
|
||||
bInvert=0
|
||||
fWaveAlpha=100.000000
|
||||
fWaveScale=0.266718
|
||||
fWaveSmoothing=0.500000
|
||||
fWaveParam=0.000000
|
||||
fModWaveAlphaStart=0.500000
|
||||
fModWaveAlphaEnd=1.000000
|
||||
fWarpAnimSpeed=1.000000
|
||||
fWarpScale=1.000000
|
||||
fZoomExponent=1.000000
|
||||
fShader=0.000000
|
||||
zoom=1.000000
|
||||
rot=0.000000
|
||||
cx=0.500000
|
||||
cy=0.500000
|
||||
dx=0.000010
|
||||
dy=0.000010
|
||||
warp=0.010000
|
||||
sx=1.000000
|
||||
sy=1.000000
|
||||
wave_r=0.500000
|
||||
wave_g=0.500000
|
||||
wave_b=0.500000
|
||||
wave_x=0.500000
|
||||
wave_y=0.500000
|
||||
ob_size=0.000000
|
||||
ob_r=0.000000
|
||||
ob_g=0.000000
|
||||
ob_b=0.000000
|
||||
ob_a=1.000000
|
||||
ib_size=0.000000
|
||||
ib_r=0.000000
|
||||
ib_g=0.000000
|
||||
ib_b=0.000000
|
||||
ib_a=0.000000
|
||||
nMotionVectorsX=0.000000
|
||||
nMotionVectorsY=0.000000
|
||||
mv_dx=0.000000
|
||||
mv_dy=0.000000
|
||||
mv_l=1.000000
|
||||
mv_r=1.000000
|
||||
mv_g=1.000000
|
||||
mv_b=1.000000
|
||||
mv_a=0.000000
|
||||
per_frame_1=wave_r = wave_r + 0.25*sin(1.4*time) + 0.25*sin(2.25*time);
|
||||
per_frame_2=wave_g = wave_g + 0.25*sin(1.7*time) + 0.25*sin(2.11*time);
|
||||
per_frame_3=wave_b = wave_b + 0.25*sin(1.84*time) + 0.25*sin(2.3*time);
|
||||
per_frame_4=warp = 0;
|
||||
per_pixel_1=thresh = above(bass_att,thresh)*2+(1-above(bass_att,thresh))*((thresh-1.3)*0.96+1.3);
|
||||
per_pixel_2=dx_r = equal(thresh,2)*0.015*sin(5*time)+(1-equal(thresh,2))*dx_r;
|
||||
per_pixel_3=dy_r = equal(thresh,2)*0.015*sin(6*time)+(1-equal(thresh,2))*dy_r;
|
||||
per_pixel_4=
|
||||
per_pixel_5=orb = (0.05 + 0.25*sin(0.6*time + 0.62*cos(time))-(0.5/rad));
|
||||
per_pixel_6=
|
||||
per_pixel_7=zoom = zoom + (bass_att)*abs(0.33*(0.6*sin(1.52*time)*(0.25-rad) + ((0.5-rad)*0.8*cos(2.2*time))+ ((2*orb+(2-rad))*0.7*sin(time))))*0.4;
|
||||
per_pixel_8=
|
||||
per_pixel_9=sx = sx + (0.5-rad)*0.2*abs((above(sin(time),0))*sin(time));
|
||||
per_pixel_10=sy = sy + (0.5-rad)*0.2*abs((below(sin(time),0))*cos(time));
|
||||
per_pixel_11=
|
||||
per_pixel_12=dx = dx + dx_r;
|
||||
per_pixel_13=dy = dy+ dy_r;
|
||||
@ -0,0 +1,77 @@
|
||||
[preset00]
|
||||
fRating=2.000000
|
||||
fGammaAdj=1.490000
|
||||
fDecay=1.000000
|
||||
fVideoEchoZoom=1.000000
|
||||
fVideoEchoAlpha=0.500000
|
||||
nVideoEchoOrientation=3
|
||||
nWaveMode=3
|
||||
bAdditiveWaves=0
|
||||
bWaveDots=0
|
||||
bWaveThick=1
|
||||
bModWaveAlphaByVolume=0
|
||||
bMaximizeWaveColor=0
|
||||
bTexWrap=0
|
||||
bDarkenCenter=0
|
||||
bRedBlueStereo=0
|
||||
bBrighten=0
|
||||
bDarken=0
|
||||
bSolarize=0
|
||||
bInvert=0
|
||||
fWaveAlpha=100.000000
|
||||
fWaveScale=0.972362
|
||||
fWaveSmoothing=0.500000
|
||||
fWaveParam=0.000000
|
||||
fModWaveAlphaStart=0.500000
|
||||
fModWaveAlphaEnd=1.000000
|
||||
fWarpAnimSpeed=1.000000
|
||||
fWarpScale=1.000000
|
||||
fZoomExponent=0.999998
|
||||
fShader=0.000000
|
||||
zoom=0.999998
|
||||
rot=0.000000
|
||||
cx=0.500000
|
||||
cy=0.500000
|
||||
dx=0.000010
|
||||
dy=0.000010
|
||||
warp=0.010000
|
||||
sx=1.000000
|
||||
sy=1.000000
|
||||
wave_r=0.500000
|
||||
wave_g=0.500000
|
||||
wave_b=0.500000
|
||||
wave_x=0.500000
|
||||
wave_y=0.500000
|
||||
ob_size=0.005000
|
||||
ob_r=0.000000
|
||||
ob_g=0.000000
|
||||
ob_b=0.000000
|
||||
ob_a=1.000000
|
||||
ib_size=0.000000
|
||||
ib_r=0.000000
|
||||
ib_g=0.000000
|
||||
ib_b=0.000000
|
||||
ib_a=0.000000
|
||||
nMotionVectorsX=64.000000
|
||||
nMotionVectorsY=48.000000
|
||||
mv_dx=0.000000
|
||||
mv_dy=0.000000
|
||||
mv_l=1.050000
|
||||
mv_r=0.000000
|
||||
mv_g=0.000000
|
||||
mv_b=0.800000
|
||||
mv_a=0.000000
|
||||
per_frame_1=wave_r = wave_r + 0.4*(0.25*sin(1.4*time)) + 0.25*sin(7.25*time);
|
||||
per_frame_2=wave_g = wave_g + 0.34*(0.25*sin(1.7*time)) + 0.25*sin(6.11*time);
|
||||
per_frame_3=wave_b = wave_b + 0.3*(0.25*sin(1.84*time)) + 0.25*sin(9.3*time);
|
||||
per_frame_4=warp = 0;
|
||||
per_pixel_1=thresh = above(bass_att,thresh)*2+(1-above(bass_att,thresh))*((thresh-1.3)*0.96+1.3);
|
||||
per_pixel_2=dx_r = equal(thresh,2)*0.025*sin(5*time)+(1-equal(thresh,2))*dx_r;
|
||||
per_pixel_3=dy_r = equal(thresh,2)*0.025*sin(6*time)+(1-equal(thresh,2))*dy_r;
|
||||
per_pixel_4=
|
||||
per_pixel_5=dx = dx + dx_r*(above(x,0.45+0.45*sin(1.5*time))*below(x,0.55+0.45*sin(1.5*time)));
|
||||
per_pixel_6=dy = dy + dy_r*(above(y,0.45+0.45*cos(1.25*time))*below(y,0.55+0.45*cos(1.25*time)));
|
||||
per_pixel_7=cx = cx + bass*(above(x,0.35+0.45*sin(1.05*time))*below(x,0.65+0.45*sin(1.05*time)));
|
||||
per_pixel_8=cy = cy + bass*(above(y,0.35+0.45*cos(1.75*time))*below(y,0.65+0.45*cos(1.75*time)));
|
||||
per_pixel_9=rot = rot + 0.15*((0.43*rad)*(5*cos(dx*dy-bass_att+(0.5-rad))*2-rad))*abs(0.5*(2*sin(0.2*time)));
|
||||
per_pixel_10=zoom = zoom - 0.02*(abs(cos(12*ang))+0.4*rad);
|
||||
81
libprojectM/src/share/presets/Aderrasi - Antidote (Aqualung Mix).milk
Executable file
81
libprojectM/src/share/presets/Aderrasi - Antidote (Aqualung Mix).milk
Executable file
@ -0,0 +1,81 @@
|
||||
[preset00]
|
||||
fRating=2.000000
|
||||
fGammaAdj=1.000000
|
||||
fDecay=1.000000
|
||||
fVideoEchoZoom=0.999837
|
||||
fVideoEchoAlpha=0.500000
|
||||
nVideoEchoOrientation=3
|
||||
nWaveMode=5
|
||||
bAdditiveWaves=0
|
||||
bWaveDots=0
|
||||
bWaveThick=0
|
||||
bModWaveAlphaByVolume=0
|
||||
bMaximizeWaveColor=0
|
||||
bTexWrap=1
|
||||
bDarkenCenter=0
|
||||
bRedBlueStereo=0
|
||||
bBrighten=0
|
||||
bDarken=0
|
||||
bSolarize=0
|
||||
bInvert=0
|
||||
fWaveAlpha=100.000000
|
||||
fWaveScale=1.599171
|
||||
fWaveSmoothing=0.900000
|
||||
fWaveParam=1.000000
|
||||
fModWaveAlphaStart=0.500000
|
||||
fModWaveAlphaEnd=1.000000
|
||||
fWarpAnimSpeed=20.009382
|
||||
fWarpScale=5.427911
|
||||
fZoomExponent=1.000000
|
||||
fShader=0.000000
|
||||
zoom=1.000000
|
||||
rot=0.000000
|
||||
cx=0.500000
|
||||
cy=0.500000
|
||||
dx=0.000010
|
||||
dy=0.000010
|
||||
warp=0.010000
|
||||
sx=1.000000
|
||||
sy=1.000000
|
||||
wave_r=0.000000
|
||||
wave_g=0.100000
|
||||
wave_b=1.000000
|
||||
wave_x=0.400000
|
||||
wave_y=0.500000
|
||||
ob_size=0.005000
|
||||
ob_r=0.000000
|
||||
ob_g=0.000000
|
||||
ob_b=0.000000
|
||||
ob_a=1.000000
|
||||
ib_size=0.005000
|
||||
ib_r=0.000000
|
||||
ib_g=1.000000
|
||||
ib_b=0.000000
|
||||
ib_a=1.000000
|
||||
nMotionVectorsX=6.400000
|
||||
nMotionVectorsY=4.800000
|
||||
mv_dx=0.000000
|
||||
mv_dy=0.000000
|
||||
mv_l=5.000000
|
||||
mv_r=1.000000
|
||||
mv_g=1.000000
|
||||
mv_b=1.000000
|
||||
mv_a=0.000000
|
||||
per_frame_1=wave_r = wave_r + 0.35*sin(4*time) + 0.15*sin(2.5*time);
|
||||
per_frame_2=wave_g = wave_g + 0.35*sin(3.7*time) + 0.15*sin(2.11*time);
|
||||
per_frame_3=wave_b = wave_b + 0.35*sin(3.84*time) + 0.15*sin(2.3*time);
|
||||
per_frame_4=//wave_y = wave_y + 0.24*sin(2.5*time);
|
||||
per_frame_5=wave_x = 0.5 + 0.25*sin(time);
|
||||
per_frame_6=wave_y = 0.5 + 0.25*cos(time);
|
||||
per_frame_7=ib_r = above(sin(0.2*time),-0.333)*1*below(sin(0.2*time),0.333);
|
||||
per_frame_8=ib_g = below(sin(0.2*time),-0.333)*1;
|
||||
per_frame_9=ib_b = above(sin(0.2*time),0.333)*1;
|
||||
per_pixel_1=thresh = above(bass_att,thresh)*2+(1-above(bass_att,thresh))*((thresh-1.3)*0.96+1.3);
|
||||
per_pixel_2=dx_r = equal(thresh,2)*0.015*sin(5*time)+(1-equal(thresh,2))*dx_r;
|
||||
per_pixel_3=dy_r = equal(thresh,2)*0.015*sin(6*time)+(1-equal(thresh,2))*dy_r;
|
||||
per_pixel_4=dy = dy + 0.001;
|
||||
per_pixel_5=//warp = warp + dy_r*50* (if (above(x*cos(1.2*time), sin(1.62*time)), if(below(x*sin(1.72*time),cos(1.8*time)), if(below(y,sin(3*time)), + 1*bass, 0), 0), 0));
|
||||
per_pixel_6=rot = rot + 0.4*(1-rad)*0.5*sin(70*dy_r+dx_r*60);
|
||||
per_pixel_7=zoom = zoom + 0.01*(1-rad*2)*0.03*(0.5-rad*0.1*sin(time));
|
||||
per_pixel_8=dy = dy + (0.005*sin(cos(x*time)*1.76*sin(0.52*time*cos(max(0.075*bass_att,0.0005*time)))));
|
||||
per_pixel_9=dx = dx + (0.005*cos(sin(y*time)*1.54*sin(0.79*time*sin(max(0.075*treb_att,0.0005*time)))));
|
||||
79
libprojectM/src/share/presets/Aderrasi - Antidote (Side Effects Mix).milk
Executable file
79
libprojectM/src/share/presets/Aderrasi - Antidote (Side Effects Mix).milk
Executable file
@ -0,0 +1,79 @@
|
||||
[preset00]
|
||||
fRating=2.000000
|
||||
fGammaAdj=1.000000
|
||||
fDecay=1.000000
|
||||
fVideoEchoZoom=5.427025
|
||||
fVideoEchoAlpha=0.500000
|
||||
nVideoEchoOrientation=3
|
||||
nWaveMode=6
|
||||
bAdditiveWaves=0
|
||||
bWaveDots=0
|
||||
bWaveThick=0
|
||||
bModWaveAlphaByVolume=0
|
||||
bMaximizeWaveColor=1
|
||||
bTexWrap=1
|
||||
bDarkenCenter=0
|
||||
bRedBlueStereo=0
|
||||
bBrighten=0
|
||||
bDarken=0
|
||||
bSolarize=0
|
||||
bInvert=0
|
||||
fWaveAlpha=100.000000
|
||||
fWaveScale=0.972360
|
||||
fWaveSmoothing=0.500000
|
||||
fWaveParam=1.000000
|
||||
fModWaveAlphaStart=0.500000
|
||||
fModWaveAlphaEnd=1.000000
|
||||
fWarpAnimSpeed=0.010000
|
||||
fWarpScale=1.766487
|
||||
fZoomExponent=1.000000
|
||||
fShader=0.000000
|
||||
zoom=1.000000
|
||||
rot=0.000000
|
||||
cx=0.500000
|
||||
cy=0.500000
|
||||
dx=0.000010
|
||||
dy=0.000010
|
||||
warp=0.010000
|
||||
sx=1.000000
|
||||
sy=1.000000
|
||||
wave_r=0.000000
|
||||
wave_g=0.000000
|
||||
wave_b=0.000000
|
||||
wave_x=0.400000
|
||||
wave_y=0.500000
|
||||
ob_size=0.000000
|
||||
ob_r=0.000000
|
||||
ob_g=0.000000
|
||||
ob_b=0.000000
|
||||
ob_a=1.000000
|
||||
ib_size=0.000000
|
||||
ib_r=0.000000
|
||||
ib_g=0.000000
|
||||
ib_b=0.000000
|
||||
ib_a=0.000000
|
||||
nMotionVectorsX=6.400000
|
||||
nMotionVectorsY=4.800000
|
||||
mv_dx=0.000000
|
||||
mv_dy=0.000000
|
||||
mv_l=5.000000
|
||||
mv_r=1.000000
|
||||
mv_g=1.000000
|
||||
mv_b=1.000000
|
||||
mv_a=0.000000
|
||||
per_frame_1=wave_r = wave_r + 0.35*sin(1.4*time) + 0.15*sin(2.5*time+2*mid);
|
||||
per_frame_2=wave_g = wave_g + 0.35*sin(1.7*time) + 0.15*sin(2.11*time+2.2*treb);
|
||||
per_frame_3=wave_b = wave_b + 0.35*sin(1.84*time) + 0.15*sin(2.3*time+2*bass);
|
||||
per_frame_4=//wave_y = wave_y + 0.24*sin(2.5*time);
|
||||
per_frame_5=wave_x = 0.75 + 0.45*sin(sin(0.5*bass_att-0.4*treb_att)*sin(time));
|
||||
per_frame_6=//warp = warp + (0.8*bass_att - 0.8*treb_att)*0.25;
|
||||
per_pixel_1=//thresh = above(bass_att,thresh)*2+(1-above(bass_att,thresh))*((thresh-1.3)*0.96+1.3);
|
||||
per_pixel_2=//dx_r = equal(thresh,2)*0.015*sin(5*time)+(1-equal(thresh,2))*dx_r;
|
||||
per_pixel_3=//dy_r = equal(thresh,2)*0.015*sin(6*time)+(1-equal(thresh,2))*dy_r;
|
||||
per_pixel_4=
|
||||
per_pixel_5=//warp = warp + dy_r*50* (if (above(x*cos(1.2*time), sin(1.62*time)), if(below(x*sin(1.72*time),cos(1.8*time)), if(below(y,sin(3*time)), + 1*bass, 0), 0), 0));
|
||||
per_pixel_6=
|
||||
per_pixel_7=dy = dy + (0.004*sin(cos(x*2.25*time)*0.86*sin(0.52*time*cos(max(0.075*bass_att,0.0005*time)))));
|
||||
per_pixel_8=dx = dx + (0.004*cos(sin(y*2.25*time)*0.94*sin(0.79*time*sin(max(0.075*treb_att,0.0005*time)))));
|
||||
per_pixel_9=dy = dy - sin((1+x)*time*0.94)*(0.005*above(y,sin(1.14*time+0.02*treb_att)));
|
||||
per_pixel_10=dx = dx + sin((0.25-y)*time*0.97)*(0.005*above(x,cos(1.2*time+0.02*bass_att)));
|
||||
76
libprojectM/src/share/presets/Aderrasi - Antidote.milk
Executable file
76
libprojectM/src/share/presets/Aderrasi - Antidote.milk
Executable file
@ -0,0 +1,76 @@
|
||||
[preset00]
|
||||
fRating=2.000000
|
||||
fGammaAdj=1.000000
|
||||
fDecay=1.000000
|
||||
fVideoEchoZoom=0.999837
|
||||
fVideoEchoAlpha=0.000000
|
||||
nVideoEchoOrientation=3
|
||||
nWaveMode=6
|
||||
bAdditiveWaves=0
|
||||
bWaveDots=0
|
||||
bWaveThick=0
|
||||
bModWaveAlphaByVolume=0
|
||||
bMaximizeWaveColor=0
|
||||
bTexWrap=1
|
||||
bDarkenCenter=0
|
||||
bRedBlueStereo=0
|
||||
bBrighten=0
|
||||
bDarken=0
|
||||
bSolarize=0
|
||||
bInvert=0
|
||||
fWaveAlpha=100.000000
|
||||
fWaveScale=0.972360
|
||||
fWaveSmoothing=0.500000
|
||||
fWaveParam=1.000000
|
||||
fModWaveAlphaStart=0.500000
|
||||
fModWaveAlphaEnd=1.000000
|
||||
fWarpAnimSpeed=20.009382
|
||||
fWarpScale=5.427911
|
||||
fZoomExponent=1.000000
|
||||
fShader=0.000000
|
||||
zoom=1.000000
|
||||
rot=0.000000
|
||||
cx=0.500000
|
||||
cy=0.500000
|
||||
dx=0.000010
|
||||
dy=0.000010
|
||||
warp=0.010000
|
||||
sx=1.000000
|
||||
sy=1.000000
|
||||
wave_r=0.500000
|
||||
wave_g=0.500000
|
||||
wave_b=0.500000
|
||||
wave_x=0.400000
|
||||
wave_y=0.500000
|
||||
ob_size=0.000000
|
||||
ob_r=0.000000
|
||||
ob_g=0.000000
|
||||
ob_b=0.000000
|
||||
ob_a=1.000000
|
||||
ib_size=0.000000
|
||||
ib_r=0.000000
|
||||
ib_g=0.000000
|
||||
ib_b=0.000000
|
||||
ib_a=0.000000
|
||||
nMotionVectorsX=6.400000
|
||||
nMotionVectorsY=4.800000
|
||||
mv_dx=0.000000
|
||||
mv_dy=0.000000
|
||||
mv_l=5.000000
|
||||
mv_r=1.000000
|
||||
mv_g=1.000000
|
||||
mv_b=1.000000
|
||||
mv_a=0.000000
|
||||
per_frame_1=wave_r = wave_r + 0.35*sin(4*time) + 0.15*sin(2.5*time);
|
||||
per_frame_2=wave_g = wave_g + 0.35*sin(3.7*time) + 0.15*sin(2.11*time);
|
||||
per_frame_3=wave_b = wave_b + 0.35*sin(3.84*time) + 0.15*sin(2.3*time);
|
||||
per_frame_4=//wave_y = wave_y + 0.24*sin(2.5*time);
|
||||
per_frame_5=wave_x = 0.5 + 0.15*sin(time);
|
||||
per_pixel_1=//thresh = above(bass_att,thresh)*2+(1-above(bass_att,thresh))*((thresh-1.3)*0.96+1.3);
|
||||
per_pixel_2=//dx_r = equal(thresh,2)*0.015*sin(5*time)+(1-equal(thresh,2))*dx_r;
|
||||
per_pixel_3=//dy_r = equal(thresh,2)*0.015*sin(6*time)+(1-equal(thresh,2))*dy_r;
|
||||
per_pixel_4=
|
||||
per_pixel_5=//warp = warp + dy_r*50* (if (above(x*cos(1.2*time), sin(1.62*time)), if(below(x*sin(1.72*time),cos(1.8*time)), if(below(y,sin(3*time)), + 1*bass, 0), 0), 0));
|
||||
per_pixel_6=
|
||||
per_pixel_7=dy = dy + (0.005*sin(cos(x*time)*1.76*sin(0.52*time*cos(max(0.075*bass_att,0.0005*time)))));
|
||||
per_pixel_8=dx = dx + (0.005*cos(sin(y*time)*1.54*sin(0.79*time*sin(max(0.075*treb_att,0.0005*time)))));
|
||||
79
libprojectM/src/share/presets/Aderrasi - Antique Abyss.milk
Executable file
79
libprojectM/src/share/presets/Aderrasi - Antique Abyss.milk
Executable file
@ -0,0 +1,79 @@
|
||||
[preset00]
|
||||
fRating=2.000000
|
||||
fGammaAdj=1.700000
|
||||
fDecay=0.980000
|
||||
fVideoEchoZoom=1.000000
|
||||
fVideoEchoAlpha=0.500000
|
||||
nVideoEchoOrientation=3
|
||||
nWaveMode=7
|
||||
bAdditiveWaves=1
|
||||
bWaveDots=0
|
||||
bWaveThick=1
|
||||
bModWaveAlphaByVolume=0
|
||||
bMaximizeWaveColor=0
|
||||
bTexWrap=1
|
||||
bDarkenCenter=0
|
||||
bRedBlueStereo=0
|
||||
bBrighten=0
|
||||
bDarken=0
|
||||
bSolarize=0
|
||||
bInvert=0
|
||||
fWaveAlpha=100.000000
|
||||
fWaveScale=2.000454
|
||||
fWaveSmoothing=0.540000
|
||||
fWaveParam=0.000000
|
||||
fModWaveAlphaStart=0.500000
|
||||
fModWaveAlphaEnd=1.000000
|
||||
fWarpAnimSpeed=1.000000
|
||||
fWarpScale=1.000000
|
||||
fZoomExponent=1.000000
|
||||
fShader=1.000000
|
||||
zoom=1.000000
|
||||
rot=0.000000
|
||||
cx=0.500000
|
||||
cy=0.500000
|
||||
dx=0.000010
|
||||
dy=0.000010
|
||||
warp=0.010000
|
||||
sx=1.000000
|
||||
sy=1.000000
|
||||
wave_r=0.500000
|
||||
wave_g=0.500000
|
||||
wave_b=0.500000
|
||||
wave_x=0.500000
|
||||
wave_y=0.700000
|
||||
ob_size=0.005000
|
||||
ob_r=0.000000
|
||||
ob_g=0.000000
|
||||
ob_b=0.300000
|
||||
ob_a=0.200000
|
||||
ib_size=0.050000
|
||||
ib_r=0.000000
|
||||
ib_g=0.200000
|
||||
ib_b=0.300000
|
||||
ib_a=0.100000
|
||||
nMotionVectorsX=25.599995
|
||||
nMotionVectorsY=33.600002
|
||||
mv_dx=0.000000
|
||||
mv_dy=0.000000
|
||||
mv_l=5.000000
|
||||
mv_r=0.300000
|
||||
mv_g=0.000000
|
||||
mv_b=0.000000
|
||||
mv_a=0.150000
|
||||
per_frame_1=wave_r = wave_r + (0.35*sin(1.4*time*bass) + 0.25*sin(2.5*time))*4*treb*time;
|
||||
per_frame_2=wave_g = wave_g + (0.35*sin(1.7*time*mid) - 0.25*sin(1.11*time))*4*bass*time;
|
||||
per_frame_3=wave_b = wave_b + (0.35*sin(1.84*time*treb) + 0.25*sin(2.3*time))*4*mid*time;
|
||||
per_frame_4=warp = 0;
|
||||
per_frame_5=mv_g = 0.3 + 0.25*sin(wave_r);
|
||||
per_frame_6=mv_r = 0.3 + 0.25*cos(wave_b);
|
||||
per_frame_7=mv_b = 0.3 + 0.15*sin(wave_g);
|
||||
per_frame_8=mv_x = mv_x - 3*bass;
|
||||
per_frame_9=mv_y = mv_y - 4*treb;
|
||||
per_pixel_1=thresh = above(bass_att,thresh)*2+(1-above(bass_att,thresh))*((thresh-1.3)*0.96+1.3);
|
||||
per_pixel_2=dx_r = equal(thresh,2)*0.015*sin(5*time)+(1-equal(thresh,2))*dx_r;
|
||||
per_pixel_3=dy_r = equal(thresh,2)*0.015*sin(6*time)+(1-equal(thresh,2))*dy_r;
|
||||
per_pixel_4=zoom = zoom - 0.26*rad*(0.7+0.1*sin(4*bass*time)-rad);
|
||||
per_pixel_5=dy= dy + 1.99*dy_r*(rad*sin(5*treb_att))*(1-rad);
|
||||
per_pixel_6=dx = dx + 1.5*dx_r *(rad*cos(5*bass_att))*(0.6*rad-0.7-rad);
|
||||
per_pixel_7=rot = rot + abs(0.8*(0.7*sin(bass*treb)*x-0.033*cos(ang))*(1-rad));
|
||||
80
libprojectM/src/share/presets/Aderrasi - Arise! (Padded Mix).milk
Executable file
80
libprojectM/src/share/presets/Aderrasi - Arise! (Padded Mix).milk
Executable file
@ -0,0 +1,80 @@
|
||||
[preset00]
|
||||
fRating=2.000000
|
||||
fGammaAdj=1.350000
|
||||
fDecay=1.000000
|
||||
fVideoEchoZoom=1.503739
|
||||
fVideoEchoAlpha=0.500000
|
||||
nVideoEchoOrientation=1
|
||||
nWaveMode=6
|
||||
bAdditiveWaves=1
|
||||
bWaveDots=0
|
||||
bWaveThick=0
|
||||
bModWaveAlphaByVolume=1
|
||||
bMaximizeWaveColor=0
|
||||
bTexWrap=1
|
||||
bDarkenCenter=0
|
||||
bRedBlueStereo=0
|
||||
bBrighten=0
|
||||
bDarken=0
|
||||
bSolarize=0
|
||||
bInvert=0
|
||||
fWaveAlpha=100.000000
|
||||
fWaveScale=2.905225
|
||||
fWaveSmoothing=0.360000
|
||||
fWaveParam=0.000000
|
||||
fModWaveAlphaStart=0.500000
|
||||
fModWaveAlphaEnd=1.000000
|
||||
fWarpAnimSpeed=1.000000
|
||||
fWarpScale=1.000000
|
||||
fZoomExponent=0.408391
|
||||
fShader=1.000000
|
||||
zoom=1.000000
|
||||
rot=0.000000
|
||||
cx=0.500000
|
||||
cy=0.500000
|
||||
dx=0.000010
|
||||
dy=0.000010
|
||||
warp=0.010000
|
||||
sx=1.000000
|
||||
sy=1.000000
|
||||
wave_r=0.500000
|
||||
wave_g=0.500000
|
||||
wave_b=0.500000
|
||||
wave_x=0.500000
|
||||
wave_y=0.500000
|
||||
ob_size=0.005000
|
||||
ob_r=0.000000
|
||||
ob_g=0.000000
|
||||
ob_b=0.000000
|
||||
ob_a=1.000000
|
||||
ib_size=0.000000
|
||||
ib_r=0.000000
|
||||
ib_g=0.000000
|
||||
ib_b=0.000000
|
||||
ib_a=0.000000
|
||||
nMotionVectorsX=0.000000
|
||||
nMotionVectorsY=0.000000
|
||||
mv_dx=0.000000
|
||||
mv_dy=0.000000
|
||||
mv_l=1.000000
|
||||
mv_r=1.000000
|
||||
mv_g=1.000000
|
||||
mv_b=1.000000
|
||||
mv_a=0.000000
|
||||
per_frame_1=wave_r = wave_r + 0.25*sin(1.4*time) + 0.25*sin(2.25*time);
|
||||
per_frame_2=wave_g = wave_g + 0.25*sin(1.7*time) + 0.25*sin(2.11*time);
|
||||
per_frame_3=wave_b = wave_b + 0.25*sin(1.84*time) + 0.25*sin(2.3*time);
|
||||
per_frame_4=warp = 0;
|
||||
per_frame_5=//decay = 0.995 + 0.004*sin(0.5*time);
|
||||
per_frame_6=wave_x = 0.01;
|
||||
per_pixel_1=thresh = above(bass_att,thresh)*2+(1-above(bass_att,thresh))*((thresh-1.3)*0.96+1.3);
|
||||
per_pixel_2=dx_r = equal(thresh,2)*0.015*sin(5*time)+(1-equal(thresh,2))*dx_r;
|
||||
per_pixel_3=dy_r = equal(thresh,2)*0.015*sin(6*time)+(1-equal(thresh,2))*dy_r;
|
||||
per_pixel_4=
|
||||
per_pixel_5=dy = dy - 0.025*(1-y)*above(y,0.95);
|
||||
per_pixel_6=dy = dy - 0.025*(y)*below(y,0.94);
|
||||
per_pixel_7=
|
||||
per_pixel_8=warp = warp + 0.25*(bass-treb)*above(y,0.9);
|
||||
per_pixel_9=zoom = zoom - 0.02*(rad)*(above(y,0.9));
|
||||
per_pixel_10=sx = sx - above(x, 0.35 + 0.35*sin(time))*below(x,0.65 + 0.35*sin(time))*
|
||||
per_pixel_11=above(y,0.8)*0.008*sin(time);
|
||||
70
libprojectM/src/share/presets/Aderrasi - Ashes Of Air (Remix).milk
Executable file
70
libprojectM/src/share/presets/Aderrasi - Ashes Of Air (Remix).milk
Executable file
@ -0,0 +1,70 @@
|
||||
[preset00]
|
||||
fRating=3.000000
|
||||
fGammaAdj=2.001000
|
||||
fDecay=1.000000
|
||||
fVideoEchoZoom=1.469141
|
||||
fVideoEchoAlpha=0.500000
|
||||
nVideoEchoOrientation=3
|
||||
nWaveMode=5
|
||||
bAdditiveWaves=0
|
||||
bWaveDots=1
|
||||
bWaveThick=0
|
||||
bModWaveAlphaByVolume=0
|
||||
bMaximizeWaveColor=0
|
||||
bTexWrap=0
|
||||
bDarkenCenter=0
|
||||
bRedBlueStereo=0
|
||||
bBrighten=0
|
||||
bDarken=0
|
||||
bSolarize=0
|
||||
bInvert=0
|
||||
fWaveAlpha=1.386134
|
||||
fWaveScale=1.568857
|
||||
fWaveSmoothing=0.000000
|
||||
fWaveParam=0.000000
|
||||
fModWaveAlphaStart=0.710000
|
||||
fModWaveAlphaEnd=1.300000
|
||||
fWarpAnimSpeed=1.000000
|
||||
fWarpScale=1.331000
|
||||
fZoomExponent=1.000000
|
||||
fShader=0.000000
|
||||
zoom=0.999513
|
||||
rot=0.000000
|
||||
cx=0.500000
|
||||
cy=0.500000
|
||||
dx=0.000000
|
||||
dy=0.000000
|
||||
warp=0.010100
|
||||
sx=1.000000
|
||||
sy=1.000000
|
||||
wave_r=0.650000
|
||||
wave_g=0.650000
|
||||
wave_b=0.650000
|
||||
wave_x=0.500000
|
||||
wave_y=0.500000
|
||||
ob_size=0.005000
|
||||
ob_r=0.000000
|
||||
ob_g=0.000000
|
||||
ob_b=0.000000
|
||||
ob_a=0.800000
|
||||
ib_size=0.000000
|
||||
ib_r=0.250000
|
||||
ib_g=0.250000
|
||||
ib_b=0.250000
|
||||
ib_a=0.000000
|
||||
nMotionVectorsX=12.000000
|
||||
nMotionVectorsY=9.000000
|
||||
mv_dx=0.000000
|
||||
mv_dy=0.000000
|
||||
mv_l=0.900000
|
||||
mv_r=1.000000
|
||||
mv_g=1.000000
|
||||
mv_b=1.000000
|
||||
mv_a=0.000000
|
||||
per_frame_1=wave_r = wave_r + 0.5*sin(time*1.13);
|
||||
per_frame_2=wave_g = wave_g + 0.5*sin(time*1.23);
|
||||
per_frame_3=wave_b = wave_b + 0.5*sin(time*1.33);
|
||||
per_pixel_1=zoom = zoom + 0.25*(0.05*bass_att + sin(sin(time+rad))*0.3 - cos(rad)*0.1);
|
||||
per_pixel_2=rot = 0.06*sin(rad);
|
||||
per_pixel_3=dx = dx + 0.008*(0.99*1-rad)*sin(0.733*time);
|
||||
per_pixel_4=dy = dy + 0.008*(0.99*1-rad)*cos(0.953*time);
|
||||
@ -0,0 +1,80 @@
|
||||
[preset00]
|
||||
fRating=2.000000
|
||||
fGammaAdj=1.000000
|
||||
fDecay=1.000000
|
||||
fVideoEchoZoom=2.448626
|
||||
fVideoEchoAlpha=0.000000
|
||||
nVideoEchoOrientation=0
|
||||
nWaveMode=7
|
||||
bAdditiveWaves=0
|
||||
bWaveDots=0
|
||||
bWaveThick=1
|
||||
bModWaveAlphaByVolume=0
|
||||
bMaximizeWaveColor=0
|
||||
bTexWrap=1
|
||||
bDarkenCenter=0
|
||||
bRedBlueStereo=0
|
||||
bBrighten=0
|
||||
bDarken=0
|
||||
bSolarize=0
|
||||
bInvert=0
|
||||
fWaveAlpha=100.000000
|
||||
fWaveScale=1.310603
|
||||
fWaveSmoothing=0.900000
|
||||
fWaveParam=0.000000
|
||||
fModWaveAlphaStart=0.500000
|
||||
fModWaveAlphaEnd=1.000000
|
||||
fWarpAnimSpeed=1.000000
|
||||
fWarpScale=1.000000
|
||||
fZoomExponent=0.999900
|
||||
fShader=0.000000
|
||||
zoom=0.999999
|
||||
rot=0.000000
|
||||
cx=0.500000
|
||||
cy=0.500000
|
||||
dx=0.000010
|
||||
dy=0.000010
|
||||
warp=0.010000
|
||||
sx=1.000000
|
||||
sy=1.000000
|
||||
wave_r=0.500000
|
||||
wave_g=0.500000
|
||||
wave_b=0.500000
|
||||
wave_x=0.500000
|
||||
wave_y=0.500000
|
||||
ob_size=0.005000
|
||||
ob_r=0.000000
|
||||
ob_g=0.000000
|
||||
ob_b=0.000000
|
||||
ob_a=1.000000
|
||||
ib_size=0.050000
|
||||
ib_r=0.000000
|
||||
ib_g=0.000000
|
||||
ib_b=0.000000
|
||||
ib_a=0.200000
|
||||
nMotionVectorsX=64.000000
|
||||
nMotionVectorsY=48.000000
|
||||
mv_dx=0.000000
|
||||
mv_dy=0.000000
|
||||
mv_l=0.000000
|
||||
mv_r=1.000000
|
||||
mv_g=0.600000
|
||||
mv_b=0.000000
|
||||
mv_a=0.000000
|
||||
per_frame_1=wave_r = wave_r + 0.25*sin(1.4*time) + 0.25*sin(2.25*time);
|
||||
per_frame_2=wave_g = wave_g + 0.25*sin(1.7*time) + 0.25*sin(2.11*time);
|
||||
per_frame_3=wave_b = wave_b + 0.25*sin(1.84*time) + 0.25*sin(2.3*time);
|
||||
per_frame_4=warp = 0;
|
||||
per_frame_5=ib_r =wave_r;
|
||||
per_frame_6=ib_g = wave_g;
|
||||
per_frame_7=ib_b = wave_b;
|
||||
per_frame_8=wave_mystery = wave_mystery + 0.3*time;
|
||||
per_pixel_1=thresh = above(bass_att,thresh)*2+(1-above(bass_att,thresh))*((thresh-1.3)*0.96+1.3);
|
||||
per_pixel_2=dx_r = equal(thresh,2)*0.015*sin(5*time)+(1-equal(thresh,2))*dx_r;
|
||||
per_pixel_3=dy_r = equal(thresh,2)*0.015*sin(6*time)+(1-equal(thresh,2))*dy_r;
|
||||
per_pixel_4=
|
||||
per_pixel_5=zoom = zoom - 0.2*(1.5-rad)*sin(bass/2*treb_att)*(rad*2*(rad*abs(sin(9*ang))));
|
||||
per_pixel_6=rot = rot + dy_r*(2-zoom)*0.3*cos(bass)*20;
|
||||
per_pixel_7=rot = rot - 0.4*(rad*cos(abs(12*ang)))*below(rad,0.3+ 0.4*sin(bass));
|
||||
per_pixel_8=dx = dx + 0.5*abs(rad+x-0.5*(bass/y*0.2))*dx_r;
|
||||
per_pixel_9=dy = dy + 0.5*abs(rad+y-0.5*(treb/x*0.2))*dy_r;
|
||||
73
libprojectM/src/share/presets/Aderrasi - Blender.milk
Executable file
73
libprojectM/src/share/presets/Aderrasi - Blender.milk
Executable file
@ -0,0 +1,73 @@
|
||||
[preset00]
|
||||
fRating=3.000000
|
||||
fGammaAdj=1.000000
|
||||
fDecay=0.980000
|
||||
fVideoEchoZoom=0.999997
|
||||
fVideoEchoAlpha=0.400000
|
||||
nVideoEchoOrientation=0
|
||||
nWaveMode=0
|
||||
bAdditiveWaves=0
|
||||
bWaveDots=0
|
||||
bWaveThick=1
|
||||
bModWaveAlphaByVolume=0
|
||||
bMaximizeWaveColor=0
|
||||
bTexWrap=1
|
||||
bDarkenCenter=1
|
||||
bRedBlueStereo=0
|
||||
bBrighten=0
|
||||
bDarken=0
|
||||
bSolarize=0
|
||||
bInvert=0
|
||||
fWaveAlpha=100.000000
|
||||
fWaveScale=3.915820
|
||||
fWaveSmoothing=0.500000
|
||||
fWaveParam=-0.400000
|
||||
fModWaveAlphaStart=0.500000
|
||||
fModWaveAlphaEnd=1.000000
|
||||
fWarpAnimSpeed=1.000000
|
||||
fWarpScale=1.000000
|
||||
fZoomExponent=1.000000
|
||||
fShader=0.000000
|
||||
zoom=1.000000
|
||||
rot=0.000000
|
||||
cx=0.500000
|
||||
cy=0.500000
|
||||
dx=0.000010
|
||||
dy=0.000010
|
||||
warp=0.010000
|
||||
sx=1.000000
|
||||
sy=1.000000
|
||||
wave_r=1.000000
|
||||
wave_g=1.000000
|
||||
wave_b=1.000000
|
||||
wave_x=0.500000
|
||||
wave_y=0.500000
|
||||
ob_size=0.005000
|
||||
ob_r=1.000000
|
||||
ob_g=0.000000
|
||||
ob_b=0.000000
|
||||
ob_a=1.000000
|
||||
ib_size=0.005000
|
||||
ib_r=1.000000
|
||||
ib_g=1.000000
|
||||
ib_b=1.000000
|
||||
ib_a=1.000000
|
||||
nMotionVectorsX=0.000000
|
||||
nMotionVectorsY=0.000000
|
||||
mv_dx=0.000000
|
||||
mv_dy=0.000000
|
||||
mv_l=1.000000
|
||||
mv_r=1.000000
|
||||
mv_g=1.000000
|
||||
mv_b=1.000000
|
||||
mv_a=0.000000
|
||||
per_frame_1=wave_x = wave_x + 0.15*sin(time);
|
||||
per_frame_2=wave_y = wave_y + 0.15*cos(time);
|
||||
per_frame_3=wave_r = wave_r + 0.9;
|
||||
per_frame_4=wave_g = 0.9 - 0.5*bass;
|
||||
per_frame_5=wave_b = 0.9 - 0.5*bass;
|
||||
per_pixel_1=rot = rot - 0.1*min((2-rad)*bass_att,(2-rad)*treb_att);
|
||||
per_pixel_2=grad = sqrt(x*x + y*y)*2;
|
||||
per_pixel_3=dx = dx - 0.02*(1-rad);
|
||||
per_pixel_4=dy = dy + 0.02*(1-rad);
|
||||
per_pixel_5=zoom = zoom - max(grad*(bass/8 - treb/8), 0);
|
||||
85
libprojectM/src/share/presets/Aderrasi - Bow To Gravity.milk
Executable file
85
libprojectM/src/share/presets/Aderrasi - Bow To Gravity.milk
Executable file
@ -0,0 +1,85 @@
|
||||
[preset00]
|
||||
fRating=2.000000
|
||||
fGammaAdj=1.000000
|
||||
fDecay=0.930000
|
||||
fVideoEchoZoom=0.999837
|
||||
fVideoEchoAlpha=0.500000
|
||||
nVideoEchoOrientation=1
|
||||
nWaveMode=6
|
||||
bAdditiveWaves=0
|
||||
bWaveDots=0
|
||||
bWaveThick=1
|
||||
bModWaveAlphaByVolume=0
|
||||
bMaximizeWaveColor=1
|
||||
bTexWrap=1
|
||||
bDarkenCenter=0
|
||||
bRedBlueStereo=0
|
||||
bBrighten=0
|
||||
bDarken=0
|
||||
bSolarize=0
|
||||
bInvert=0
|
||||
fWaveAlpha=100.000000
|
||||
fWaveScale=0.796896
|
||||
fWaveSmoothing=0.000000
|
||||
fWaveParam=0.000000
|
||||
fModWaveAlphaStart=0.500000
|
||||
fModWaveAlphaEnd=1.000000
|
||||
fWarpAnimSpeed=1.000000
|
||||
fWarpScale=1.000000
|
||||
fZoomExponent=0.999995
|
||||
fShader=0.000000
|
||||
zoom=1.000000
|
||||
rot=0.000000
|
||||
cx=0.500000
|
||||
cy=0.500000
|
||||
dx=0.000010
|
||||
dy=0.000010
|
||||
warp=0.010000
|
||||
sx=1.000000
|
||||
sy=1.000000
|
||||
wave_r=0.500000
|
||||
wave_g=0.500000
|
||||
wave_b=0.500000
|
||||
wave_x=0.500000
|
||||
wave_y=0.500000
|
||||
ob_size=0.010000
|
||||
ob_r=0.000000
|
||||
ob_g=0.000000
|
||||
ob_b=0.000000
|
||||
ob_a=0.500000
|
||||
ib_size=0.010000
|
||||
ib_r=0.000000
|
||||
ib_g=0.000000
|
||||
ib_b=0.000000
|
||||
ib_a=0.500000
|
||||
nMotionVectorsX=0.000000
|
||||
nMotionVectorsY=0.000000
|
||||
mv_dx=0.000000
|
||||
mv_dy=0.000000
|
||||
mv_l=1.900000
|
||||
mv_r=1.000000
|
||||
mv_g=1.000000
|
||||
mv_b=1.000000
|
||||
mv_a=0.000000
|
||||
per_frame_1=wave_r = wave_r + 0.25*sin(1.4*time) + 0.25*sin(2.25*time);
|
||||
per_frame_2=wave_g = wave_g + 0.25*sin(1.7*time) + 0.25*sin(2.11*time);
|
||||
per_frame_3=wave_b = wave_b + 0.25*sin(1.84*time) + 0.25*sin(2.3*time);
|
||||
per_frame_4=warp = 0;
|
||||
per_frame_5=ob_r = 0.5*wave_r;
|
||||
per_frame_6=ob_b = 0.5*wave_g;
|
||||
per_frame_7=ob_g = 0.5*wave_b;
|
||||
per_frame_8=ib_r = wave_g;
|
||||
per_frame_9=ib_g = wave_b;
|
||||
per_frame_10=ib_b = wave_r;
|
||||
per_frame_11=wave_mystery = wave_mystery + 25*sin(3-1*(sin(0.001*time)));
|
||||
per_pixel_1=thresh = above(bass_att,thresh)*2+(1-above(bass_att,thresh))*((thresh-1.3)*0.96+1.3);
|
||||
per_pixel_2=dx_r = equal(thresh,2)*0.015*sin(5*time)+(1-equal(thresh,2))*dx_r;
|
||||
per_pixel_3=dy_r = equal(thresh,2)*0.015*sin(6*time)+(1-equal(thresh,2))*dy_r;
|
||||
per_pixel_4=dx = dx + above(x,0.5)*x*0.005;
|
||||
per_pixel_5=dx = dx - below(x,0.5)*(1-x)*0.005;
|
||||
per_pixel_6=dy = dy + above(y,0.5)*y*0.005;
|
||||
per_pixel_7=dy = dy + below(y,0.5)*(1-y)*0.005;
|
||||
per_pixel_8=zoom = zoom - 100*((1-rad)*((1.5*rad)*0.005 + 0.004*sin(0.5*bass_att)));
|
||||
per_pixel_9=
|
||||
per_pixel_10=rot = rot + (cos(bass_att*treb_att)/(1-treb)+0.5*time)*0.0005;
|
||||
per_pixel_11=zoomexp = 0.8 + 1+sin(treb_att);
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user