├── LICENSE
├── PainterEngine_Filter
├── PainterEngine_Filter.opensdf
├── PainterEngine_Filter.sln
├── PainterEngine_Filter.suo
└── PainterEngine_Filter
│ ├── Filter_Main.c
│ ├── Filter_Main.h
│ ├── Filter_Text.h
│ ├── Filters
│ └── common.filter
│ ├── PainterEngine_Application.c
│ ├── PainterEngine_Application.h
│ ├── PainterEngine_Filter.aps
│ ├── PainterEngine_Filter.rc
│ ├── PainterEngine_Filter.vcxproj
│ ├── PainterEngine_Filter.vcxproj.filters
│ ├── PainterEngine_Filter.vcxproj.user
│ ├── PainterEngine_Startup.c
│ ├── PainterEngine_Startup.h
│ ├── Resources
│ ├── flogo.traw
│ ├── fox.ico
│ ├── switch.traw
│ └── volume.traw
│ ├── __main.c
│ └── resource.h
└── PainterEngine_SoundLab
├── PainterEngine_SoundLab.opensdf
├── PainterEngine_SoundLab.sln
├── PainterEngine_SoundLab.suo
├── PainterEngine_SoundLab
├── PainterEngine_Application.c
├── PainterEngine_Application.h
├── PainterEngine_SoundLab.aps
├── PainterEngine_SoundLab.rc
├── PainterEngine_SoundLab.vcxproj
├── PainterEngine_SoundLab.vcxproj.filters
├── PainterEngine_SoundLab.vcxproj.user
├── PainterEngine_Startup.c
├── PainterEngine_Startup.h
├── Resources
│ ├── ann.traw
│ ├── en32.pxf
│ ├── file.traw
│ ├── fox.ico
│ ├── logo.traw
│ ├── play.traw
│ ├── recorder.traw
│ ├── recordfinish.traw
│ ├── recording.traw
│ ├── reset.traw
│ ├── sampling.traw
│ ├── save.traw
│ ├── stop.traw
│ └── test.traw
├── SoundLab_Data.h
├── SoundLab_Main.c
├── SoundLab_Main.h
├── SoundLab_Startup.c
├── SoundLab_Startup.h
├── SoundLab_Text.h
├── __main.c
└── resource.h
├── soundlab.png
└── soundlab.psd
/LICENSE:
--------------------------------------------------------------------------------
1 | GNU GENERAL PUBLIC LICENSE
2 | Version 3, 29 June 2007
3 |
4 | Copyright (C) 2007 Free Software Foundation, Inc.
5 | Everyone is permitted to copy and distribute verbatim copies
6 | of this license document, but changing it is not allowed.
7 |
8 | Preamble
9 |
10 | The GNU General Public License is a free, copyleft license for
11 | software and other kinds of works.
12 |
13 | The licenses for most software and other practical works are designed
14 | to take away your freedom to share and change the works. By contrast,
15 | the GNU General Public License is intended to guarantee your freedom to
16 | share and change all versions of a program--to make sure it remains free
17 | software for all its users. We, the Free Software Foundation, use the
18 | GNU General Public License for most of our software; it applies also to
19 | any other work released this way by its authors. You can apply it to
20 | your programs, too.
21 |
22 | When we speak of free software, we are referring to freedom, not
23 | price. Our General Public Licenses are designed to make sure that you
24 | have the freedom to distribute copies of free software (and charge for
25 | them if you wish), that you receive source code or can get it if you
26 | want it, that you can change the software or use pieces of it in new
27 | free programs, and that you know you can do these things.
28 |
29 | To protect your rights, we need to prevent others from denying you
30 | these rights or asking you to surrender the rights. Therefore, you have
31 | certain responsibilities if you distribute copies of the software, or if
32 | you modify it: responsibilities to respect the freedom of others.
33 |
34 | For example, if you distribute copies of such a program, whether
35 | gratis or for a fee, you must pass on to the recipients the same
36 | freedoms that you received. You must make sure that they, too, receive
37 | or can get the source code. And you must show them these terms so they
38 | know their rights.
39 |
40 | Developers that use the GNU GPL protect your rights with two steps:
41 | (1) assert copyright on the software, and (2) offer you this License
42 | giving you legal permission to copy, distribute and/or modify it.
43 |
44 | For the developers' and authors' protection, the GPL clearly explains
45 | that there is no warranty for this free software. For both users' and
46 | authors' sake, the GPL requires that modified versions be marked as
47 | changed, so that their problems will not be attributed erroneously to
48 | authors of previous versions.
49 |
50 | Some devices are designed to deny users access to install or run
51 | modified versions of the software inside them, although the manufacturer
52 | can do so. This is fundamentally incompatible with the aim of
53 | protecting users' freedom to change the software. The systematic
54 | pattern of such abuse occurs in the area of products for individuals to
55 | use, which is precisely where it is most unacceptable. Therefore, we
56 | have designed this version of the GPL to prohibit the practice for those
57 | products. If such problems arise substantially in other domains, we
58 | stand ready to extend this provision to those domains in future versions
59 | of the GPL, as needed to protect the freedom of users.
60 |
61 | Finally, every program is threatened constantly by software patents.
62 | States should not allow patents to restrict development and use of
63 | software on general-purpose computers, but in those that do, we wish to
64 | avoid the special danger that patents applied to a free program could
65 | make it effectively proprietary. To prevent this, the GPL assures that
66 | patents cannot be used to render the program non-free.
67 |
68 | The precise terms and conditions for copying, distribution and
69 | modification follow.
70 |
71 | TERMS AND CONDITIONS
72 |
73 | 0. Definitions.
74 |
75 | "This License" refers to version 3 of the GNU General Public License.
76 |
77 | "Copyright" also means copyright-like laws that apply to other kinds of
78 | works, such as semiconductor masks.
79 |
80 | "The Program" refers to any copyrightable work licensed under this
81 | License. Each licensee is addressed as "you". "Licensees" and
82 | "recipients" may be individuals or organizations.
83 |
84 | To "modify" a work means to copy from or adapt all or part of the work
85 | in a fashion requiring copyright permission, other than the making of an
86 | exact copy. The resulting work is called a "modified version" of the
87 | earlier work or a work "based on" the earlier work.
88 |
89 | A "covered work" means either the unmodified Program or a work based
90 | on the Program.
91 |
92 | To "propagate" a work means to do anything with it that, without
93 | permission, would make you directly or secondarily liable for
94 | infringement under applicable copyright law, except executing it on a
95 | computer or modifying a private copy. Propagation includes copying,
96 | distribution (with or without modification), making available to the
97 | public, and in some countries other activities as well.
98 |
99 | To "convey" a work means any kind of propagation that enables other
100 | parties to make or receive copies. Mere interaction with a user through
101 | a computer network, with no transfer of a copy, is not conveying.
102 |
103 | An interactive user interface displays "Appropriate Legal Notices"
104 | to the extent that it includes a convenient and prominently visible
105 | feature that (1) displays an appropriate copyright notice, and (2)
106 | tells the user that there is no warranty for the work (except to the
107 | extent that warranties are provided), that licensees may convey the
108 | work under this License, and how to view a copy of this License. If
109 | the interface presents a list of user commands or options, such as a
110 | menu, a prominent item in the list meets this criterion.
111 |
112 | 1. Source Code.
113 |
114 | The "source code" for a work means the preferred form of the work
115 | for making modifications to it. "Object code" means any non-source
116 | form of a work.
117 |
118 | A "Standard Interface" means an interface that either is an official
119 | standard defined by a recognized standards body, or, in the case of
120 | interfaces specified for a particular programming language, one that
121 | is widely used among developers working in that language.
122 |
123 | The "System Libraries" of an executable work include anything, other
124 | than the work as a whole, that (a) is included in the normal form of
125 | packaging a Major Component, but which is not part of that Major
126 | Component, and (b) serves only to enable use of the work with that
127 | Major Component, or to implement a Standard Interface for which an
128 | implementation is available to the public in source code form. A
129 | "Major Component", in this context, means a major essential component
130 | (kernel, window system, and so on) of the specific operating system
131 | (if any) on which the executable work runs, or a compiler used to
132 | produce the work, or an object code interpreter used to run it.
133 |
134 | The "Corresponding Source" for a work in object code form means all
135 | the source code needed to generate, install, and (for an executable
136 | work) run the object code and to modify the work, including scripts to
137 | control those activities. However, it does not include the work's
138 | System Libraries, or general-purpose tools or generally available free
139 | programs which are used unmodified in performing those activities but
140 | which are not part of the work. For example, Corresponding Source
141 | includes interface definition files associated with source files for
142 | the work, and the source code for shared libraries and dynamically
143 | linked subprograms that the work is specifically designed to require,
144 | such as by intimate data communication or control flow between those
145 | subprograms and other parts of the work.
146 |
147 | The Corresponding Source need not include anything that users
148 | can regenerate automatically from other parts of the Corresponding
149 | Source.
150 |
151 | The Corresponding Source for a work in source code form is that
152 | same work.
153 |
154 | 2. Basic Permissions.
155 |
156 | All rights granted under this License are granted for the term of
157 | copyright on the Program, and are irrevocable provided the stated
158 | conditions are met. This License explicitly affirms your unlimited
159 | permission to run the unmodified Program. The output from running a
160 | covered work is covered by this License only if the output, given its
161 | content, constitutes a covered work. This License acknowledges your
162 | rights of fair use or other equivalent, as provided by copyright law.
163 |
164 | You may make, run and propagate covered works that you do not
165 | convey, without conditions so long as your license otherwise remains
166 | in force. You may convey covered works to others for the sole purpose
167 | of having them make modifications exclusively for you, or provide you
168 | with facilities for running those works, provided that you comply with
169 | the terms of this License in conveying all material for which you do
170 | not control copyright. Those thus making or running the covered works
171 | for you must do so exclusively on your behalf, under your direction
172 | and control, on terms that prohibit them from making any copies of
173 | your copyrighted material outside their relationship with you.
174 |
175 | Conveying under any other circumstances is permitted solely under
176 | the conditions stated below. Sublicensing is not allowed; section 10
177 | makes it unnecessary.
178 |
179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
180 |
181 | No covered work shall be deemed part of an effective technological
182 | measure under any applicable law fulfilling obligations under article
183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or
184 | similar laws prohibiting or restricting circumvention of such
185 | measures.
186 |
187 | When you convey a covered work, you waive any legal power to forbid
188 | circumvention of technological measures to the extent such circumvention
189 | is effected by exercising rights under this License with respect to
190 | the covered work, and you disclaim any intention to limit operation or
191 | modification of the work as a means of enforcing, against the work's
192 | users, your or third parties' legal rights to forbid circumvention of
193 | technological measures.
194 |
195 | 4. Conveying Verbatim Copies.
196 |
197 | You may convey verbatim copies of the Program's source code as you
198 | receive it, in any medium, provided that you conspicuously and
199 | appropriately publish on each copy an appropriate copyright notice;
200 | keep intact all notices stating that this License and any
201 | non-permissive terms added in accord with section 7 apply to the code;
202 | keep intact all notices of the absence of any warranty; and give all
203 | recipients a copy of this License along with the Program.
204 |
205 | You may charge any price or no price for each copy that you convey,
206 | and you may offer support or warranty protection for a fee.
207 |
208 | 5. Conveying Modified Source Versions.
209 |
210 | You may convey a work based on the Program, or the modifications to
211 | produce it from the Program, in the form of source code under the
212 | terms of section 4, provided that you also meet all of these conditions:
213 |
214 | a) The work must carry prominent notices stating that you modified
215 | it, and giving a relevant date.
216 |
217 | b) The work must carry prominent notices stating that it is
218 | released under this License and any conditions added under section
219 | 7. This requirement modifies the requirement in section 4 to
220 | "keep intact all notices".
221 |
222 | c) You must license the entire work, as a whole, under this
223 | License to anyone who comes into possession of a copy. This
224 | License will therefore apply, along with any applicable section 7
225 | additional terms, to the whole of the work, and all its parts,
226 | regardless of how they are packaged. This License gives no
227 | permission to license the work in any other way, but it does not
228 | invalidate such permission if you have separately received it.
229 |
230 | d) If the work has interactive user interfaces, each must display
231 | Appropriate Legal Notices; however, if the Program has interactive
232 | interfaces that do not display Appropriate Legal Notices, your
233 | work need not make them do so.
234 |
235 | A compilation of a covered work with other separate and independent
236 | works, which are not by their nature extensions of the covered work,
237 | and which are not combined with it such as to form a larger program,
238 | in or on a volume of a storage or distribution medium, is called an
239 | "aggregate" if the compilation and its resulting copyright are not
240 | used to limit the access or legal rights of the compilation's users
241 | beyond what the individual works permit. Inclusion of a covered work
242 | in an aggregate does not cause this License to apply to the other
243 | parts of the aggregate.
244 |
245 | 6. Conveying Non-Source Forms.
246 |
247 | You may convey a covered work in object code form under the terms
248 | of sections 4 and 5, provided that you also convey the
249 | machine-readable Corresponding Source under the terms of this License,
250 | in one of these ways:
251 |
252 | a) Convey the object code in, or embodied in, a physical product
253 | (including a physical distribution medium), accompanied by the
254 | Corresponding Source fixed on a durable physical medium
255 | customarily used for software interchange.
256 |
257 | b) Convey the object code in, or embodied in, a physical product
258 | (including a physical distribution medium), accompanied by a
259 | written offer, valid for at least three years and valid for as
260 | long as you offer spare parts or customer support for that product
261 | model, to give anyone who possesses the object code either (1) a
262 | copy of the Corresponding Source for all the software in the
263 | product that is covered by this License, on a durable physical
264 | medium customarily used for software interchange, for a price no
265 | more than your reasonable cost of physically performing this
266 | conveying of source, or (2) access to copy the
267 | Corresponding Source from a network server at no charge.
268 |
269 | c) Convey individual copies of the object code with a copy of the
270 | written offer to provide the Corresponding Source. This
271 | alternative is allowed only occasionally and noncommercially, and
272 | only if you received the object code with such an offer, in accord
273 | with subsection 6b.
274 |
275 | d) Convey the object code by offering access from a designated
276 | place (gratis or for a charge), and offer equivalent access to the
277 | Corresponding Source in the same way through the same place at no
278 | further charge. You need not require recipients to copy the
279 | Corresponding Source along with the object code. If the place to
280 | copy the object code is a network server, the Corresponding Source
281 | may be on a different server (operated by you or a third party)
282 | that supports equivalent copying facilities, provided you maintain
283 | clear directions next to the object code saying where to find the
284 | Corresponding Source. Regardless of what server hosts the
285 | Corresponding Source, you remain obligated to ensure that it is
286 | available for as long as needed to satisfy these requirements.
287 |
288 | e) Convey the object code using peer-to-peer transmission, provided
289 | you inform other peers where the object code and Corresponding
290 | Source of the work are being offered to the general public at no
291 | charge under subsection 6d.
292 |
293 | A separable portion of the object code, whose source code is excluded
294 | from the Corresponding Source as a System Library, need not be
295 | included in conveying the object code work.
296 |
297 | A "User Product" is either (1) a "consumer product", which means any
298 | tangible personal property which is normally used for personal, family,
299 | or household purposes, or (2) anything designed or sold for incorporation
300 | into a dwelling. In determining whether a product is a consumer product,
301 | doubtful cases shall be resolved in favor of coverage. For a particular
302 | product received by a particular user, "normally used" refers to a
303 | typical or common use of that class of product, regardless of the status
304 | of the particular user or of the way in which the particular user
305 | actually uses, or expects or is expected to use, the product. A product
306 | is a consumer product regardless of whether the product has substantial
307 | commercial, industrial or non-consumer uses, unless such uses represent
308 | the only significant mode of use of the product.
309 |
310 | "Installation Information" for a User Product means any methods,
311 | procedures, authorization keys, or other information required to install
312 | and execute modified versions of a covered work in that User Product from
313 | a modified version of its Corresponding Source. The information must
314 | suffice to ensure that the continued functioning of the modified object
315 | code is in no case prevented or interfered with solely because
316 | modification has been made.
317 |
318 | If you convey an object code work under this section in, or with, or
319 | specifically for use in, a User Product, and the conveying occurs as
320 | part of a transaction in which the right of possession and use of the
321 | User Product is transferred to the recipient in perpetuity or for a
322 | fixed term (regardless of how the transaction is characterized), the
323 | Corresponding Source conveyed under this section must be accompanied
324 | by the Installation Information. But this requirement does not apply
325 | if neither you nor any third party retains the ability to install
326 | modified object code on the User Product (for example, the work has
327 | been installed in ROM).
328 |
329 | The requirement to provide Installation Information does not include a
330 | requirement to continue to provide support service, warranty, or updates
331 | for a work that has been modified or installed by the recipient, or for
332 | the User Product in which it has been modified or installed. Access to a
333 | network may be denied when the modification itself materially and
334 | adversely affects the operation of the network or violates the rules and
335 | protocols for communication across the network.
336 |
337 | Corresponding Source conveyed, and Installation Information provided,
338 | in accord with this section must be in a format that is publicly
339 | documented (and with an implementation available to the public in
340 | source code form), and must require no special password or key for
341 | unpacking, reading or copying.
342 |
343 | 7. Additional Terms.
344 |
345 | "Additional permissions" are terms that supplement the terms of this
346 | License by making exceptions from one or more of its conditions.
347 | Additional permissions that are applicable to the entire Program shall
348 | be treated as though they were included in this License, to the extent
349 | that they are valid under applicable law. If additional permissions
350 | apply only to part of the Program, that part may be used separately
351 | under those permissions, but the entire Program remains governed by
352 | this License without regard to the additional permissions.
353 |
354 | When you convey a copy of a covered work, you may at your option
355 | remove any additional permissions from that copy, or from any part of
356 | it. (Additional permissions may be written to require their own
357 | removal in certain cases when you modify the work.) You may place
358 | additional permissions on material, added by you to a covered work,
359 | for which you have or can give appropriate copyright permission.
360 |
361 | Notwithstanding any other provision of this License, for material you
362 | add to a covered work, you may (if authorized by the copyright holders of
363 | that material) supplement the terms of this License with terms:
364 |
365 | a) Disclaiming warranty or limiting liability differently from the
366 | terms of sections 15 and 16 of this License; or
367 |
368 | b) Requiring preservation of specified reasonable legal notices or
369 | author attributions in that material or in the Appropriate Legal
370 | Notices displayed by works containing it; or
371 |
372 | c) Prohibiting misrepresentation of the origin of that material, or
373 | requiring that modified versions of such material be marked in
374 | reasonable ways as different from the original version; or
375 |
376 | d) Limiting the use for publicity purposes of names of licensors or
377 | authors of the material; or
378 |
379 | e) Declining to grant rights under trademark law for use of some
380 | trade names, trademarks, or service marks; or
381 |
382 | f) Requiring indemnification of licensors and authors of that
383 | material by anyone who conveys the material (or modified versions of
384 | it) with contractual assumptions of liability to the recipient, for
385 | any liability that these contractual assumptions directly impose on
386 | those licensors and authors.
387 |
388 | All other non-permissive additional terms are considered "further
389 | restrictions" within the meaning of section 10. If the Program as you
390 | received it, or any part of it, contains a notice stating that it is
391 | governed by this License along with a term that is a further
392 | restriction, you may remove that term. If a license document contains
393 | a further restriction but permits relicensing or conveying under this
394 | License, you may add to a covered work material governed by the terms
395 | of that license document, provided that the further restriction does
396 | not survive such relicensing or conveying.
397 |
398 | If you add terms to a covered work in accord with this section, you
399 | must place, in the relevant source files, a statement of the
400 | additional terms that apply to those files, or a notice indicating
401 | where to find the applicable terms.
402 |
403 | Additional terms, permissive or non-permissive, may be stated in the
404 | form of a separately written license, or stated as exceptions;
405 | the above requirements apply either way.
406 |
407 | 8. Termination.
408 |
409 | You may not propagate or modify a covered work except as expressly
410 | provided under this License. Any attempt otherwise to propagate or
411 | modify it is void, and will automatically terminate your rights under
412 | this License (including any patent licenses granted under the third
413 | paragraph of section 11).
414 |
415 | However, if you cease all violation of this License, then your
416 | license from a particular copyright holder is reinstated (a)
417 | provisionally, unless and until the copyright holder explicitly and
418 | finally terminates your license, and (b) permanently, if the copyright
419 | holder fails to notify you of the violation by some reasonable means
420 | prior to 60 days after the cessation.
421 |
422 | Moreover, your license from a particular copyright holder is
423 | reinstated permanently if the copyright holder notifies you of the
424 | violation by some reasonable means, this is the first time you have
425 | received notice of violation of this License (for any work) from that
426 | copyright holder, and you cure the violation prior to 30 days after
427 | your receipt of the notice.
428 |
429 | Termination of your rights under this section does not terminate the
430 | licenses of parties who have received copies or rights from you under
431 | this License. If your rights have been terminated and not permanently
432 | reinstated, you do not qualify to receive new licenses for the same
433 | material under section 10.
434 |
435 | 9. Acceptance Not Required for Having Copies.
436 |
437 | You are not required to accept this License in order to receive or
438 | run a copy of the Program. Ancillary propagation of a covered work
439 | occurring solely as a consequence of using peer-to-peer transmission
440 | to receive a copy likewise does not require acceptance. However,
441 | nothing other than this License grants you permission to propagate or
442 | modify any covered work. These actions infringe copyright if you do
443 | not accept this License. Therefore, by modifying or propagating a
444 | covered work, you indicate your acceptance of this License to do so.
445 |
446 | 10. Automatic Licensing of Downstream Recipients.
447 |
448 | Each time you convey a covered work, the recipient automatically
449 | receives a license from the original licensors, to run, modify and
450 | propagate that work, subject to this License. You are not responsible
451 | for enforcing compliance by third parties with this License.
452 |
453 | An "entity transaction" is a transaction transferring control of an
454 | organization, or substantially all assets of one, or subdividing an
455 | organization, or merging organizations. If propagation of a covered
456 | work results from an entity transaction, each party to that
457 | transaction who receives a copy of the work also receives whatever
458 | licenses to the work the party's predecessor in interest had or could
459 | give under the previous paragraph, plus a right to possession of the
460 | Corresponding Source of the work from the predecessor in interest, if
461 | the predecessor has it or can get it with reasonable efforts.
462 |
463 | You may not impose any further restrictions on the exercise of the
464 | rights granted or affirmed under this License. For example, you may
465 | not impose a license fee, royalty, or other charge for exercise of
466 | rights granted under this License, and you may not initiate litigation
467 | (including a cross-claim or counterclaim in a lawsuit) alleging that
468 | any patent claim is infringed by making, using, selling, offering for
469 | sale, or importing the Program or any portion of it.
470 |
471 | 11. Patents.
472 |
473 | A "contributor" is a copyright holder who authorizes use under this
474 | License of the Program or a work on which the Program is based. The
475 | work thus licensed is called the contributor's "contributor version".
476 |
477 | A contributor's "essential patent claims" are all patent claims
478 | owned or controlled by the contributor, whether already acquired or
479 | hereafter acquired, that would be infringed by some manner, permitted
480 | by this License, of making, using, or selling its contributor version,
481 | but do not include claims that would be infringed only as a
482 | consequence of further modification of the contributor version. For
483 | purposes of this definition, "control" includes the right to grant
484 | patent sublicenses in a manner consistent with the requirements of
485 | this License.
486 |
487 | Each contributor grants you a non-exclusive, worldwide, royalty-free
488 | patent license under the contributor's essential patent claims, to
489 | make, use, sell, offer for sale, import and otherwise run, modify and
490 | propagate the contents of its contributor version.
491 |
492 | In the following three paragraphs, a "patent license" is any express
493 | agreement or commitment, however denominated, not to enforce a patent
494 | (such as an express permission to practice a patent or covenant not to
495 | sue for patent infringement). To "grant" such a patent license to a
496 | party means to make such an agreement or commitment not to enforce a
497 | patent against the party.
498 |
499 | If you convey a covered work, knowingly relying on a patent license,
500 | and the Corresponding Source of the work is not available for anyone
501 | to copy, free of charge and under the terms of this License, through a
502 | publicly available network server or other readily accessible means,
503 | then you must either (1) cause the Corresponding Source to be so
504 | available, or (2) arrange to deprive yourself of the benefit of the
505 | patent license for this particular work, or (3) arrange, in a manner
506 | consistent with the requirements of this License, to extend the patent
507 | license to downstream recipients. "Knowingly relying" means you have
508 | actual knowledge that, but for the patent license, your conveying the
509 | covered work in a country, or your recipient's use of the covered work
510 | in a country, would infringe one or more identifiable patents in that
511 | country that you have reason to believe are valid.
512 |
513 | If, pursuant to or in connection with a single transaction or
514 | arrangement, you convey, or propagate by procuring conveyance of, a
515 | covered work, and grant a patent license to some of the parties
516 | receiving the covered work authorizing them to use, propagate, modify
517 | or convey a specific copy of the covered work, then the patent license
518 | you grant is automatically extended to all recipients of the covered
519 | work and works based on it.
520 |
521 | A patent license is "discriminatory" if it does not include within
522 | the scope of its coverage, prohibits the exercise of, or is
523 | conditioned on the non-exercise of one or more of the rights that are
524 | specifically granted under this License. You may not convey a covered
525 | work if you are a party to an arrangement with a third party that is
526 | in the business of distributing software, under which you make payment
527 | to the third party based on the extent of your activity of conveying
528 | the work, and under which the third party grants, to any of the
529 | parties who would receive the covered work from you, a discriminatory
530 | patent license (a) in connection with copies of the covered work
531 | conveyed by you (or copies made from those copies), or (b) primarily
532 | for and in connection with specific products or compilations that
533 | contain the covered work, unless you entered into that arrangement,
534 | or that patent license was granted, prior to 28 March 2007.
535 |
536 | Nothing in this License shall be construed as excluding or limiting
537 | any implied license or other defenses to infringement that may
538 | otherwise be available to you under applicable patent law.
539 |
540 | 12. No Surrender of Others' Freedom.
541 |
542 | If conditions are imposed on you (whether by court order, agreement or
543 | otherwise) that contradict the conditions of this License, they do not
544 | excuse you from the conditions of this License. If you cannot convey a
545 | covered work so as to satisfy simultaneously your obligations under this
546 | License and any other pertinent obligations, then as a consequence you may
547 | not convey it at all. For example, if you agree to terms that obligate you
548 | to collect a royalty for further conveying from those to whom you convey
549 | the Program, the only way you could satisfy both those terms and this
550 | License would be to refrain entirely from conveying the Program.
551 |
552 | 13. Use with the GNU Affero General Public License.
553 |
554 | Notwithstanding any other provision of this License, you have
555 | permission to link or combine any covered work with a work licensed
556 | under version 3 of the GNU Affero General Public License into a single
557 | combined work, and to convey the resulting work. The terms of this
558 | License will continue to apply to the part which is the covered work,
559 | but the special requirements of the GNU Affero General Public License,
560 | section 13, concerning interaction through a network will apply to the
561 | combination as such.
562 |
563 | 14. Revised Versions of this License.
564 |
565 | The Free Software Foundation may publish revised and/or new versions of
566 | the GNU General Public License from time to time. Such new versions will
567 | be similar in spirit to the present version, but may differ in detail to
568 | address new problems or concerns.
569 |
570 | Each version is given a distinguishing version number. If the
571 | Program specifies that a certain numbered version of the GNU General
572 | Public License "or any later version" applies to it, you have the
573 | option of following the terms and conditions either of that numbered
574 | version or of any later version published by the Free Software
575 | Foundation. If the Program does not specify a version number of the
576 | GNU General Public License, you may choose any version ever published
577 | by the Free Software Foundation.
578 |
579 | If the Program specifies that a proxy can decide which future
580 | versions of the GNU General Public License can be used, that proxy's
581 | public statement of acceptance of a version permanently authorizes you
582 | to choose that version for the Program.
583 |
584 | Later license versions may give you additional or different
585 | permissions. However, no additional obligations are imposed on any
586 | author or copyright holder as a result of your choosing to follow a
587 | later version.
588 |
589 | 15. Disclaimer of Warranty.
590 |
591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
599 |
600 | 16. Limitation of Liability.
601 |
602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
610 | SUCH DAMAGES.
611 |
612 | 17. Interpretation of Sections 15 and 16.
613 |
614 | If the disclaimer of warranty and limitation of liability provided
615 | above cannot be given local legal effect according to their terms,
616 | reviewing courts shall apply local law that most closely approximates
617 | an absolute waiver of all civil liability in connection with the
618 | Program, unless a warranty or assumption of liability accompanies a
619 | copy of the Program in return for a fee.
620 |
621 | END OF TERMS AND CONDITIONS
622 |
623 | How to Apply These Terms to Your New Programs
624 |
625 | If you develop a new program, and you want it to be of the greatest
626 | possible use to the public, the best way to achieve this is to make it
627 | free software which everyone can redistribute and change under these terms.
628 |
629 | To do so, attach the following notices to the program. It is safest
630 | to attach them to the start of each source file to most effectively
631 | state the exclusion of warranty; and each file should have at least
632 | the "copyright" line and a pointer to where the full notice is found.
633 |
634 |
635 | Copyright (C)
636 |
637 | This program is free software: you can redistribute it and/or modify
638 | it under the terms of the GNU General Public License as published by
639 | the Free Software Foundation, either version 3 of the License, or
640 | (at your option) any later version.
641 |
642 | This program is distributed in the hope that it will be useful,
643 | but WITHOUT ANY WARRANTY; without even the implied warranty of
644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
645 | GNU General Public License for more details.
646 |
647 | You should have received a copy of the GNU General Public License
648 | along with this program. If not, see .
649 |
650 | Also add information on how to contact you by electronic and paper mail.
651 |
652 | If the program does terminal interaction, make it output a short
653 | notice like this when it starts in an interactive mode:
654 |
655 | Copyright (C)
656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
657 | This is free software, and you are welcome to redistribute it
658 | under certain conditions; type `show c' for details.
659 |
660 | The hypothetical commands `show w' and `show c' should show the appropriate
661 | parts of the General Public License. Of course, your program's commands
662 | might be different; for a GUI interface, you would use an "about box".
663 |
664 | You should also get your employer (if you work as a programmer) or school,
665 | if any, to sign a "copyright disclaimer" for the program, if necessary.
666 | For more information on this, and how to apply and follow the GNU GPL, see
667 | .
668 |
669 | The GNU General Public License does not permit incorporating your program
670 | into proprietary programs. If your program is a subroutine library, you
671 | may consider it more useful to permit linking proprietary applications with
672 | the library. If this is what you want to do, use the GNU Lesser General
673 | Public License instead of this License. But first, please read
674 | .
675 |
--------------------------------------------------------------------------------
/PainterEngine_Filter/PainterEngine_Filter.opensdf:
--------------------------------------------------------------------------------
1 | m a t r i D E S K T O P - G H C U N 2 N
--------------------------------------------------------------------------------
/PainterEngine_Filter/PainterEngine_Filter.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 11.00
3 | # Visual Studio 2010
4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PainterEngine_Filter", "PainterEngine_Filter\PainterEngine_Filter.vcxproj", "{9865D88D-9769-4E95-99C4-83070808C793}"
5 | EndProject
6 | Global
7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
8 | Debug|Win32 = Debug|Win32
9 | Release|Win32 = Release|Win32
10 | EndGlobalSection
11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
12 | {9865D88D-9769-4E95-99C4-83070808C793}.Debug|Win32.ActiveCfg = Debug|Win32
13 | {9865D88D-9769-4E95-99C4-83070808C793}.Debug|Win32.Build.0 = Debug|Win32
14 | {9865D88D-9769-4E95-99C4-83070808C793}.Release|Win32.ActiveCfg = Release|Win32
15 | {9865D88D-9769-4E95-99C4-83070808C793}.Release|Win32.Build.0 = Release|Win32
16 | EndGlobalSection
17 | GlobalSection(SolutionProperties) = preSolution
18 | HideSolutionNode = FALSE
19 | EndGlobalSection
20 | EndGlobal
21 |
--------------------------------------------------------------------------------
/PainterEngine_Filter/PainterEngine_Filter.suo:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/matrixcascade/SoundLab/7685ecf7cf9b3966be156bf3689b9628457baf04/PainterEngine_Filter/PainterEngine_Filter.suo
--------------------------------------------------------------------------------
/PainterEngine_Filter/PainterEngine_Filter/Filter_Main.c:
--------------------------------------------------------------------------------
1 | #include "Filter_Main.h"
2 |
3 |
4 | px_bool PX_FilterMain_LoadFilter(px_memorypool *mp,FilterMain_Filter *filter,const px_char *filepath)
5 | {
6 | SOUNDLAB_FILTER_HEADER header;
7 | PX_IO_Data data;
8 | data=PX_LoadFileToIOData(filepath);
9 | if (!data.size)
10 | {
11 | return PX_FALSE;
12 | }
13 | if (data.sizefilter,header.filter,sizeof(header.filter));
25 | filter->pitchshift=header.pitchshift;
26 |
27 | if (!PX_ANNImport(mp,&filter->ann,data.buffer+sizeof(header),data.size-sizeof(header)))
28 | {
29 | goto _ERROR;
30 | }
31 | PX_FreeIOData(&data);
32 | return PX_TRUE;
33 |
34 | _ERROR:
35 | PX_FreeIOData(&data);
36 | return PX_FALSE;
37 |
38 | }
39 |
40 | px_bool PX_FilterMainInitialize(PX_Instance *Ins,Filter_Main *pfm)
41 | {
42 | WIN32_FIND_DATA data;
43 | HANDLE fhandle;
44 |
45 | pfm->Activate=PX_FALSE;
46 |
47 | pfm->Ins=Ins;
48 | pfm->pitchAdapt=PX_TRUE;
49 | pfm->filterAdapt=PX_TRUE;
50 | pfm->CaptureCacheSize=0;
51 | PX_memset(pfm->banks,0,sizeof(pfm->banks));
52 | PX_TuningInitialize(&Ins->runtime.mp_game,&pfm->tuning,1.0,1.0,PX_NULL,PX_NULL,PX_NULL,PX_TUNING_WINDOW_SIZE_1024);
53 | PX_MFCCInitialize(&pfm->mfcc,PX_SOUNDLAB_WINDOW_WIDTH,44100,80,2000);
54 |
55 | if(!PX_AudioCaptureOpen(GUID_NULL,1))
56 | {
57 | MessageBox(PX_GetWindowHwnd(),"No microphone found.","Error",MB_OK);
58 | return PX_FALSE;
59 | }
60 |
61 | //load filter bank
62 |
63 | if((fhandle=FindFirstFile(FILTER_TEXT_PATH_FILTER,&data))==INVALID_HANDLE_VALUE)
64 | {
65 | MessageBox(PX_GetWindowHwnd(),"No model found.\nUse SoundLab to create a acoustic model.","Error",MB_OK);
66 | return PX_FALSE;
67 | }
68 | do
69 | {
70 | px_char fullpath[MAX_PATH];
71 | PX_sprintf2(fullpath,sizeof(fullpath),"%1/%2",PX_STRINGFORMAT_STRING(FILTER_TEXT_FILTER_FOLDER),PX_STRINGFORMAT_STRING(data.cFileName));
72 | if(!PX_FilterMain_LoadFilter(&pfm->Ins->runtime.mp_game,&pfm->banks[pfm->activateCount],fullpath))
73 | {
74 | FindClose(fhandle);
75 | return PX_FALSE;
76 | }
77 | pfm->activateCount++;
78 | } while (FindNextFile(fhandle,&data));
79 |
80 | FindClose(fhandle);
81 |
82 | if (pfm->activateCount==0)
83 | {
84 | MessageBox(PX_GetWindowHwnd(),"No model found.\nUse SoundLab to create a acoustic model.","Error",MB_OK);
85 | return PX_FALSE;
86 | }
87 | return PX_TRUE;
88 | }
89 |
90 | /*
91 | inPCM=(px_short *)captureBuffer;
92 | outPCM=(px_short *)pfm->CaptureCache;
93 | for (i=0;iCaptureCacheSize=sizeof(captureBuffer)*2;
100 | */
101 | px_void PX_FilterMainUpdate(Filter_Main *pfm,px_dword elpased)
102 | {
103 | px_int i;
104 | px_byte captureBuffer[PX_SOUNDLAB_WINDOW_WIDTH];//512 samples
105 |
106 | px_double ddata[PX_SOUNDLAB_WINDOW_WIDTH];
107 | PX_MFCC_FEATURE feature;
108 | px_double max;
109 | px_double _out[2];
110 | px_double mine,e;
111 | px_short *inPCM,*outPCM;
112 | px_int min_e_index,tuningSize;
113 | px_double CaptureCached[PX_SOUNDLAB_WINDOW_WIDTH*2];
114 | px_dword freesize;
115 |
116 |
117 | if (pfm->CaptureCacheSize==0)
118 | {
119 | //Capture
120 | if(PX_AudioCaptureReadEx(captureBuffer,sizeof(captureBuffer),sizeof(captureBuffer)))
121 | {
122 | inPCM=(px_short *)captureBuffer;
123 |
124 | for (i=0;ituning,ddata,sizeof(captureBuffer)/2,CaptureCached);
135 |
136 | for (i=0;iactivateCount>1)
145 | {
146 | //MFCC
147 | PX_MFCCParse(&pfm->mfcc,ddata,&feature);
148 | feature.factor[0]=0;
149 |
150 | max=0;
151 |
152 | for (i=0;i<32;i++)
153 | {
154 | feature.factor[i]*=feature.factor[i];
155 | }
156 |
157 | for (i=0;i<32;i++)
158 | {
159 | if (PX_ABS(feature.factor[i])>max)
160 | {
161 | max=PX_ABS(feature.factor[i]);
162 | }
163 | }
164 | for (i=0;i<32;i++)
165 | {
166 | feature.factor[i]/=max;
167 | }
168 |
169 | mine=2;
170 | min_e_index=0;
171 |
172 | for (i=0;iactivateCount;i++)
173 | {
174 | PX_ANNForward(&pfm->banks[i].ann,feature.factor+1);
175 | PX_ANNGetOutput(&pfm->banks[i].ann,_out);
176 | e=(_out[0]-0.99999)*(_out[0]-0.99999)+(_out[1]-0.00001)*(_out[1]-0.00001);
177 | if (epitchAdapt)
190 | {
191 | PX_TuningSetPitchShift(&pfm->tuning,pfm->banks[min_e_index].pitchshift);
192 | }
193 | else
194 | {
195 | PX_TuningSetPitchShift(&pfm->tuning,pfm->banks[0].pitchshift);
196 | }
197 |
198 | if (pfm->filterAdapt)
199 | {
200 | PX_TuningSetFilter(&pfm->tuning,pfm->banks[min_e_index].filter);
201 | }
202 | else
203 | {
204 | PX_TuningSetFilter(&pfm->tuning,pfm->banks[0].filter);
205 | }
206 |
207 | outPCM=(px_short *)pfm->CaptureCache;
208 |
209 | for (i=0;iCaptureCacheSize=tuningSize*2*2;
215 | }
216 | }
217 |
218 | }
219 |
220 |
221 | //Write tuning data
222 | if (pfm->CaptureCacheSize)
223 | {
224 | freesize=PX_AudioGetStandbyBufferSize();
225 | if (freesize>=(px_dword)pfm->CaptureCacheSize)
226 | {
227 | PX_AudioWriteBuffer(pfm->CaptureCache,pfm->CaptureCacheSize);
228 | //clear
229 | pfm->CaptureCacheSize=0;
230 | }
231 | }
232 |
233 |
234 |
235 | }
236 |
237 |
--------------------------------------------------------------------------------
/PainterEngine_Filter/PainterEngine_Filter/Filter_Main.h:
--------------------------------------------------------------------------------
1 | #ifndef FILTER_MAIN_H
2 | #define FILTER_MAIN_H
3 | #include "PainterEngine_Startup.h"
4 | #include "Filter_Text.h"
5 | #include
6 |
7 | #define PX_SOUNDLAB_WINDOW_WIDTH 1024
8 | #define FILTERMAIN_MAX_BANKS 64
9 |
10 | typedef struct
11 | {
12 | px_dword magic;//sinc
13 | px_double pitchshift;
14 | px_double filter[PX_SOUNDLAB_WINDOW_WIDTH];
15 | }SOUNDLAB_FILTER_HEADER;
16 |
17 | typedef struct
18 | {
19 | px_double filter[PX_SOUNDLAB_WINDOW_WIDTH];
20 | px_double pitchshift;
21 | PX_ANN ann;
22 | }FilterMain_Filter;
23 |
24 | typedef struct
25 | {
26 | PX_Instance *Ins;
27 | PX_Tuning tuning;
28 | FilterMain_Filter banks[FILTERMAIN_MAX_BANKS];
29 | px_int activateCount;
30 | px_bool Activate;
31 | volatile px_bool pitchAdapt;
32 | volatile px_bool filterAdapt;
33 | volatile int CaptureCacheSize;
34 | px_byte CaptureCache[PX_SOUNDLAB_WINDOW_WIDTH*2*8];
35 | PX_MFCC mfcc;
36 | }Filter_Main;
37 |
38 | px_bool PX_FilterMainInitialize(PX_Instance *Ins,Filter_Main *pfm);
39 | px_void PX_FilterMainUpdate(Filter_Main *pfm,px_dword elpased);
40 |
41 |
42 | #endif
--------------------------------------------------------------------------------
/PainterEngine_Filter/PainterEngine_Filter/Filter_Text.h:
--------------------------------------------------------------------------------
1 | #ifndef FILTER_TEXT_H
2 | #define FILTER_TEXT_H
3 |
4 | #define FILTER_TEXT_PATH_FILTER "./filters/*.filter"
5 | #define FILTER_TEXT_FILTER_FOLDER "./filters"
6 | #define FILTER_PATH_VOLUME "./resources/volume.traw"
7 | #define FILTER_PATH_LOGO "./resources/flogo.traw"
8 |
9 | #endif
10 |
--------------------------------------------------------------------------------
/PainterEngine_Filter/PainterEngine_Filter/Filters/common.filter:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/matrixcascade/SoundLab/7685ecf7cf9b3966be156bf3689b9628457baf04/PainterEngine_Filter/PainterEngine_Filter/Filters/common.filter
--------------------------------------------------------------------------------
/PainterEngine_Filter/PainterEngine_Filter/PainterEngine_Application.c:
--------------------------------------------------------------------------------
1 | #include "PainterEngine_Application.h"
2 |
3 | PX_Application App;
4 |
5 | DWORD WINAPI PX_ApplicationOnSync(void *ptr)
6 | {
7 | PX_Application *App=(PX_Application *)ptr;
8 | DWORD time,elpased;
9 | DWORD lastUpdateTime=timeGetTime();
10 | SetThreadPriority(GetCurrentThread(),THREAD_PRIORITY_ABOVE_NORMAL);
11 |
12 | while (PX_TRUE)
13 | {
14 | time=timeGetTime();
15 | elpased=time-lastUpdateTime;
16 | lastUpdateTime=time;
17 | PX_FilterMainUpdate(&App->filterMain,elpased);
18 | }
19 |
20 |
21 | }
22 |
23 | px_void PX_ApplicationOnVolumeChange(PX_Object *pObject,PX_Object_Event e,px_void *ptr)
24 | {
25 | px_int vol;
26 | PX_Application *App=(PX_Application *)ptr;
27 |
28 | vol=PX_Object_SliderBarGetValue(App->sliderbar_volume);
29 |
30 | PX_AudioSetVolume(vol*10-1000);
31 | }
32 |
33 | px_bool PX_ApplicationInitialize(PX_Application *App)
34 | {
35 | DWORD threadId;
36 | if(!PX_LoadShapeFromFile(&App->Instance.runtime.mp_resources,&App->shape_volume,FILTER_PATH_VOLUME)) return PX_FALSE;
37 | if(!PX_LoadTextureFromFile(&App->Instance.runtime.mp_resources,&App->tex_logo,FILTER_PATH_LOGO)) return PX_FALSE;
38 | App->ui_root=PX_ObjectCreate(&App->Instance.runtime.mp_ui,PX_NULL,0,0,0,0,0,0);
39 | if(!App->ui_root) return PX_FALSE;
40 |
41 | App->btn_switch=PX_Object_PushButtonCreate(&App->Instance.runtime.mp_ui,App->ui_root,PX_WINDOW_WIDTH/2-48,PX_WINDOW_HEIGHT/2-48-12,96,96,"",PX_COLOR(0,0,0,0));
42 | PX_Object_PushButtonSetBorderColor(App->btn_switch,PX_COLOR(0,0,0,0));
43 | PX_Object_PushButtonSetCursorColor(App->btn_switch,PX_COLOR(0,0,0,0));
44 | PX_Object_PushButtonSetPushColor(App->btn_switch,PX_COLOR(0,0,0,0));
45 | PX_Object_PushButtonSetBackgroundColor(App->btn_switch,PX_COLOR(0,0,0,0));
46 |
47 | App->sliderbar_volume=PX_Object_SliderBarCreate(&App->Instance.runtime.mp_ui,App->ui_root,48,PX_WINDOW_HEIGHT-32,PX_WINDOW_WIDTH-64,24,PX_OBJECT_SLIDERBAR_TYPE_HORIZONTAL,PX_OBJECT_SLIDERBAR_STYLE_BOX);
48 | PX_Object_SliderBarSetBackgroundColor(App->sliderbar_volume,PX_COLOR(255,0,0,0));
49 | PX_Object_SliderBarSetColor(App->sliderbar_volume,PX_COLOR(255,0,255,0));
50 | PX_Object_SliderBarSetSliderButtonLength(App->sliderbar_volume,32);
51 | PX_Object_SliderBarSetMax(App->sliderbar_volume,100);
52 | PX_Object_SliderBarSetValue(App->sliderbar_volume,100);
53 | PX_Object_GetSliderBar(App->sliderbar_volume)->lastValue=100;
54 | PX_ObjectRegisterEvent(App->sliderbar_volume,PX_OBJECT_EVENT_VALUECHAGE,PX_ApplicationOnVolumeChange,App);
55 |
56 |
57 | if(!PX_FilterMainInitialize(&App->Instance,&App->filterMain)) return PX_FALSE;
58 |
59 | CreateThread(NULL, 0, PX_ApplicationOnSync, App, 0, &threadId);
60 |
61 | return PX_TRUE;
62 | }
63 |
64 | px_void PX_ApplicationUpdate(PX_Application *App,px_dword elpased)
65 | {
66 |
67 | }
68 |
69 | px_void PX_ApplicationRender(PX_Application *App,px_dword elpased)
70 | {
71 | px_char content[64];
72 | PX_SurfaceClear(&App->Instance.runtime.RenderSurface,0,0,App->Instance.runtime.width-1,App->Instance.runtime.height-1,PX_COLOR(255,0,0,0));
73 | PX_ObjectRender(&App->Instance.runtime.RenderSurface,App->ui_root,elpased);
74 | PX_ShapeRender(&App->Instance.runtime.RenderSurface,&App->shape_volume,24,PX_WINDOW_HEIGHT-20,PX_TEXTURERENDER_REFPOINT_CENTER,PX_COLOR(255,0,255,0));
75 | PX_TextureRender(&App->Instance.runtime.RenderSurface,&App->tex_logo,PX_WINDOW_WIDTH/2,PX_WINDOW_HEIGHT/2-12,PX_TEXTURERENDER_REFPOINT_CENTER,PX_NULL);
76 |
77 | PX_sprintf1(content,sizeof(content),"Tuning with %1 filters",PX_STRINGFORMAT_INT(App->filterMain.activateCount));
78 | PX_FontDrawText(&App->Instance.runtime.RenderSurface,PX_WINDOW_WIDTH/2,5,content,PX_COLOR(255,0,255,0),PX_FONT_ALIGN_XCENTER);
79 |
80 | }
81 |
82 | px_void PX_ApplicationPostEvent(PX_Application *App,PX_Object_Event e)
83 | {
84 | PX_ObjectPostEvent(App->ui_root,e);
85 | }
86 |
87 |
--------------------------------------------------------------------------------
/PainterEngine_Filter/PainterEngine_Filter/PainterEngine_Application.h:
--------------------------------------------------------------------------------
1 | #ifndef PAINTERENGINE_APPLICATION_H
2 | #define PAINTERENGINE_APPLICATION_H
3 | #include "Filter_Main.h"
4 |
5 | //////////////////////////////////////////////////////////////////////////
6 | //Configures
7 | #define PX_WINDOW_NAME "PainterEngine Filter"
8 |
9 | #define PX_WINDOW_WIDTH 240
10 | #define PX_WINDOW_HEIGHT 180
11 |
12 | //memorypool for runtime(bytes)
13 | #define PX_MEMORY_UI_SIZE (1024*1024*2)
14 | #define PX_MEMORY_RESOURCES_SIZE (1024*1024*2)
15 | #define PX_MEMORY_GAME_SIZE (1024*1024*16)
16 | //////////////////////////////////////////////////////////////////////////
17 |
18 | typedef struct
19 | {
20 | Filter_Main filterMain;
21 | PX_Instance Instance;
22 | px_shape shape_volume;
23 | px_texture tex_logo;
24 | PX_Object *ui_root,*btn_switch,*sliderbar_volume;
25 | }PX_Application;
26 |
27 | extern PX_Application App;
28 |
29 | px_bool PX_ApplicationInitialize(PX_Application *App);
30 | px_void PX_ApplicationUpdate(PX_Application *App,px_dword elpased);
31 | px_void PX_ApplicationRender(PX_Application *App,px_dword elpased);
32 | px_void PX_ApplicationPostEvent(PX_Application *App,PX_Object_Event e);
33 |
34 | #endif
35 |
--------------------------------------------------------------------------------
/PainterEngine_Filter/PainterEngine_Filter/PainterEngine_Filter.aps:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/matrixcascade/SoundLab/7685ecf7cf9b3966be156bf3689b9628457baf04/PainterEngine_Filter/PainterEngine_Filter/PainterEngine_Filter.aps
--------------------------------------------------------------------------------
/PainterEngine_Filter/PainterEngine_Filter/PainterEngine_Filter.rc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/matrixcascade/SoundLab/7685ecf7cf9b3966be156bf3689b9628457baf04/PainterEngine_Filter/PainterEngine_Filter/PainterEngine_Filter.rc
--------------------------------------------------------------------------------
/PainterEngine_Filter/PainterEngine_Filter/PainterEngine_Filter.vcxproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | Win32
7 |
8 |
9 | Release
10 | Win32
11 |
12 |
13 |
14 | {9865D88D-9769-4E95-99C4-83070808C793}
15 | PainterEngine_Filter
16 |
17 |
18 |
19 | Application
20 | true
21 | MultiByte
22 |
23 |
24 | Application
25 | false
26 | true
27 | MultiByte
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 | Level3
43 | Disabled
44 |
45 |
46 | true
47 |
48 |
49 |
50 |
51 | Level3
52 | MaxSpeed
53 | true
54 | true
55 |
56 |
57 | true
58 | true
59 | true
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 |
161 |
162 |
163 |
164 |
165 |
166 |
167 |
168 |
169 |
170 |
171 |
172 |
173 |
174 |
175 |
176 |
177 |
178 |
179 |
180 |
181 |
182 |
183 |
184 |
185 |
186 |
187 |
188 |
189 |
190 |
191 |
192 |
193 |
194 |
195 |
196 |
197 |
198 |
199 |
200 |
201 |
--------------------------------------------------------------------------------
/PainterEngine_Filter/PainterEngine_Filter/PainterEngine_Filter.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
7 |
8 |
9 | {93995380-89BD-4b04-88EB-625FBE52EBFB}
10 | h;hpp;hxx;hm;inl;inc;xsd
11 |
12 |
13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
15 |
16 |
17 | {1aa91a55-6992-4975-9bf3-32dc3426e4b4}
18 |
19 |
20 |
21 |
22 | PainterEngine
23 |
24 |
25 | PainterEngine
26 |
27 |
28 | PainterEngine
29 |
30 |
31 | PainterEngine
32 |
33 |
34 | PainterEngine
35 |
36 |
37 | PainterEngine
38 |
39 |
40 | PainterEngine
41 |
42 |
43 | PainterEngine
44 |
45 |
46 | PainterEngine
47 |
48 |
49 | PainterEngine
50 |
51 |
52 | PainterEngine
53 |
54 |
55 | PainterEngine
56 |
57 |
58 | PainterEngine
59 |
60 |
61 | PainterEngine
62 |
63 |
64 | PainterEngine
65 |
66 |
67 | PainterEngine
68 |
69 |
70 | PainterEngine
71 |
72 |
73 | PainterEngine
74 |
75 |
76 | PainterEngine
77 |
78 |
79 | PainterEngine
80 |
81 |
82 | PainterEngine
83 |
84 |
85 | PainterEngine
86 |
87 |
88 | PainterEngine
89 |
90 |
91 | PainterEngine
92 |
93 |
94 | PainterEngine
95 |
96 |
97 | PainterEngine
98 |
99 |
100 | PainterEngine
101 |
102 |
103 | PainterEngine
104 |
105 |
106 | PainterEngine
107 |
108 |
109 | PainterEngine
110 |
111 |
112 | PainterEngine
113 |
114 |
115 | PainterEngine
116 |
117 |
118 | PainterEngine
119 |
120 |
121 | PainterEngine
122 |
123 |
124 | PainterEngine
125 |
126 |
127 | PainterEngine
128 |
129 |
130 | PainterEngine
131 |
132 |
133 | PainterEngine
134 |
135 |
136 | PainterEngine
137 |
138 |
139 | PainterEngine
140 |
141 |
142 | PainterEngine
143 |
144 |
145 | PainterEngine
146 |
147 |
148 | PainterEngine
149 |
150 |
151 | PainterEngine
152 |
153 |
154 | PainterEngine
155 |
156 |
157 | PainterEngine
158 |
159 |
160 | PainterEngine
161 |
162 |
163 | PainterEngine
164 |
165 |
166 | PainterEngine
167 |
168 |
169 | PainterEngine
170 |
171 |
172 | PainterEngine
173 |
174 |
175 | PainterEngine
176 |
177 |
178 | PainterEngine
179 |
180 |
181 | PainterEngine
182 |
183 |
184 | 源文件
185 |
186 |
187 | 源文件
188 |
189 |
190 | 源文件
191 |
192 |
193 | PainterEngine
194 |
195 |
196 | PainterEngine
197 |
198 |
199 | 源文件
200 |
201 |
202 |
203 |
204 | PainterEngine
205 |
206 |
207 | PainterEngine
208 |
209 |
210 | PainterEngine
211 |
212 |
213 | PainterEngine
214 |
215 |
216 | PainterEngine
217 |
218 |
219 | PainterEngine
220 |
221 |
222 | PainterEngine
223 |
224 |
225 | PainterEngine
226 |
227 |
228 | PainterEngine
229 |
230 |
231 | PainterEngine
232 |
233 |
234 | PainterEngine
235 |
236 |
237 | PainterEngine
238 |
239 |
240 | PainterEngine
241 |
242 |
243 | PainterEngine
244 |
245 |
246 | PainterEngine
247 |
248 |
249 | PainterEngine
250 |
251 |
252 | PainterEngine
253 |
254 |
255 | PainterEngine
256 |
257 |
258 | PainterEngine
259 |
260 |
261 | PainterEngine
262 |
263 |
264 | PainterEngine
265 |
266 |
267 | PainterEngine
268 |
269 |
270 | PainterEngine
271 |
272 |
273 | PainterEngine
274 |
275 |
276 | PainterEngine
277 |
278 |
279 | PainterEngine
280 |
281 |
282 | PainterEngine
283 |
284 |
285 | PainterEngine
286 |
287 |
288 | PainterEngine
289 |
290 |
291 | PainterEngine
292 |
293 |
294 | PainterEngine
295 |
296 |
297 | PainterEngine
298 |
299 |
300 | PainterEngine
301 |
302 |
303 | PainterEngine
304 |
305 |
306 | PainterEngine
307 |
308 |
309 | PainterEngine
310 |
311 |
312 | PainterEngine
313 |
314 |
315 | PainterEngine
316 |
317 |
318 | PainterEngine
319 |
320 |
321 | PainterEngine
322 |
323 |
324 | PainterEngine
325 |
326 |
327 | PainterEngine
328 |
329 |
330 | PainterEngine
331 |
332 |
333 | PainterEngine
334 |
335 |
336 | PainterEngine
337 |
338 |
339 | PainterEngine
340 |
341 |
342 | PainterEngine
343 |
344 |
345 | PainterEngine
346 |
347 |
348 | PainterEngine
349 |
350 |
351 | PainterEngine
352 |
353 |
354 | PainterEngine
355 |
356 |
357 | PainterEngine
358 |
359 |
360 | PainterEngine
361 |
362 |
363 | PainterEngine
364 |
365 |
366 | PainterEngine
367 |
368 |
369 | PainterEngine
370 |
371 |
372 | PainterEngine
373 |
374 |
375 | PainterEngine
376 |
377 |
378 | PainterEngine
379 |
380 |
381 | 头文件
382 |
383 |
384 | 头文件
385 |
386 |
387 | PainterEngine
388 |
389 |
390 | PainterEngine
391 |
392 |
393 | 头文件
394 |
395 |
396 | 头文件
397 |
398 |
399 | 头文件
400 |
401 |
402 |
403 |
404 | 资源文件
405 |
406 |
407 |
408 |
409 | 资源文件
410 |
411 |
412 |
--------------------------------------------------------------------------------
/PainterEngine_Filter/PainterEngine_Filter/PainterEngine_Filter.vcxproj.user:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/PainterEngine_Filter/PainterEngine_Filter/PainterEngine_Startup.c:
--------------------------------------------------------------------------------
1 | #include "PainterEngine_Startup.h"
2 |
3 |
4 | //////////////////////////////////////////////////////////////////////////
5 | //Functions
6 |
7 | px_bool PX_InstanceInitialize(PX_Instance *Instance,px_char *name,px_int width,px_int height,px_uint ui_size,px_uint resource_size,px_uint game_size)
8 | {
9 | px_int allocSize;
10 |
11 | PX_srand(timeGetTime());
12 |
13 | if (!PX_CreateWindow(width,height,name,PX_FALSE))
14 | {
15 | return 0;
16 | }
17 |
18 | allocSize=ui_size+resource_size+game_size+1024*1024*16;
19 |
20 | if (!PX_RuntimeInitialize(&Instance->runtime,width,height,malloc(allocSize),allocSize,ui_size,resource_size,game_size))
21 | return PX_FALSE;
22 |
23 | if (!PX_ConsoleInitialize(&Instance->runtime,&Instance->console))
24 | return PX_FALSE;
25 |
26 | return PX_TRUE;
27 | }
28 |
29 |
30 |
31 |
32 | PX_IO_Data PX_LoadFileToIOData(const px_char *path)
33 | {
34 | PX_IO_Data io;
35 | px_int fileoft=0;
36 | FILE *pf=fopen(path,"rb");
37 | px_int filesize;
38 | if (!pf)
39 | {
40 | goto _ERROR;
41 | }
42 | fseek(pf,0,SEEK_END);
43 | filesize=ftell(pf);
44 | fseek(pf,0,SEEK_SET);
45 |
46 | io.buffer=(px_byte *)malloc(filesize+1);
47 | if (!io.buffer)
48 | {
49 | goto _ERROR;
50 | }
51 |
52 | while (!feof(pf))
53 | {
54 | fileoft+=(px_int)fread(io.buffer+fileoft,1,1024,pf);
55 | }
56 | fclose(pf);
57 |
58 | io.buffer[filesize]='\0';
59 | io.size=filesize;
60 | return io;
61 | _ERROR:
62 | io.buffer=PX_NULL;
63 | io.size=0;
64 | return io;
65 | }
66 |
67 | px_void PX_FreeIOData(PX_IO_Data *io)
68 | {
69 | if (io->size&&io->buffer)
70 | {
71 | free(io->buffer);
72 | io->size=0;
73 | io->buffer=PX_NULL;
74 | }
75 | }
76 |
77 | px_bool PX_LoadTextureFromFile(px_memorypool *mp,px_texture *tex,px_char *path)
78 | {
79 | PX_IO_Data io;
80 |
81 | #ifdef PAINTERENGINE_IMAGEDECODER_H
82 | if (PX_TextureCreateFromPngFile(mp,tex,path))
83 | {
84 | return PX_TRUE;
85 | }
86 | if (PX_TextureCreateFromJpegFile(mp,tex,path))
87 | {
88 | return PX_TRUE;
89 | }
90 | #endif
91 |
92 | io=PX_LoadFileToIOData(path);
93 | if (!io.size)
94 | {
95 | return PX_FALSE;
96 | }
97 | if (PX_TextureCreateFromMemory(mp,io.buffer,io.size,tex))
98 | {
99 | PX_FreeIOData(&io);
100 | return PX_TRUE;
101 | }
102 | PX_FreeIOData(&io);
103 | return PX_FALSE;
104 | }
105 |
106 | px_bool PX_LoadShapeFromFile(px_memorypool *mp,px_shape *shape,px_char *path)
107 | {
108 | PX_IO_Data io=PX_LoadFileToIOData(path);
109 | if (!io.size)
110 | {
111 | return PX_FALSE;
112 | }
113 | if (PX_ShapeCreateFromMemory(mp,io.buffer,io.size,shape))
114 | {
115 | PX_FreeIOData(&io);
116 | return PX_TRUE;
117 | }
118 | PX_FreeIOData(&io);
119 | return PX_FALSE;
120 |
121 | }
122 |
123 |
124 | px_bool PX_LoadSoundFromFile(px_memorypool *mp,px_shape *shape,px_char *path)
125 | {
126 | PX_IO_Data io=PX_LoadFileToIOData(path);
127 | if (!io.size)
128 | {
129 | return PX_FALSE;
130 | }
131 | if (PX_ShapeCreateFromMemory(mp,io.buffer,io.size,shape))
132 | {
133 | PX_FreeIOData(&io);
134 | return PX_TRUE;
135 | }
136 | PX_FreeIOData(&io);
137 | return PX_FALSE;
138 | }
139 |
140 |
141 | px_bool PX_LoadAnimationLibraryFromFile(px_memorypool *mp,px_animationlibrary *lib,px_char *path)
142 | {
143 | PX_IO_Data io;
144 | io=PX_LoadFileToIOData(path);
145 | if (!io.size)
146 | {
147 | return PX_FALSE;
148 | }
149 | if (PX_AnimationLibraryCreateFromMemory(mp,lib,io.buffer,io.size))
150 | {
151 | PX_FreeIOData(&io);
152 | return PX_TRUE;
153 | }
154 | PX_FreeIOData(&io);
155 | return PX_FALSE;
156 |
157 | }
158 |
159 | px_bool PX_LoadScriptFromFile(px_memory *code,px_char *path)
160 | {
161 | PX_IO_Data io=PX_LoadFileToIOData(path);
162 | if (!io.size)
163 | {
164 | return PX_FALSE;
165 | }
166 | if(!PX_MemoryCopy(code,io.buffer,0,io.size))
167 | goto _ERROR;
168 |
169 | PX_FreeIOData(&io);
170 | return PX_TRUE;
171 | _ERROR:
172 | PX_FreeIOData(&io);
173 | return PX_FALSE;
174 |
175 | }
176 |
177 |
178 | px_bool PX_LoadScriptInstanceFromFile(px_memorypool *mp,PX_ScriptVM_Instance *ins,px_char *path)
179 | {
180 | PX_IO_Data io=PX_LoadFileToIOData(path);
181 | if (!io.size)
182 | {
183 | return PX_FALSE;
184 | }
185 | if(!PX_ScriptVM_InstanceInit(ins,mp,io.buffer,io.size))
186 | goto _ERROR;
187 |
188 | PX_FreeIOData(&io);
189 | return PX_TRUE;
190 | _ERROR:
191 | PX_FreeIOData(&io);
192 | return PX_FALSE;
193 | }
194 |
195 | px_bool PX_LoadTextureToResource(PX_Runtime *runtime,px_char Path[],px_char key[])
196 | {
197 | PX_IO_Data io;
198 | io=PX_LoadFileToIOData(Path);
199 | if (!io.size)goto _ERROR;
200 | if(!PX_ResourceLibraryLoad(&runtime->ResourceLibrary,PX_RESOURCE_TYPE_TEXTURE,io.buffer,io.size,key)) goto _ERROR;
201 | PX_FreeIOData(&io);
202 | return PX_TRUE;
203 | _ERROR:
204 | PX_FreeIOData(&io);
205 | return PX_FALSE;
206 | }
207 |
208 | px_bool PX_LoadShapeToResource(PX_Runtime *runtime,px_char Path[],px_char key[])
209 | {
210 | PX_IO_Data io;
211 | io=PX_LoadFileToIOData(Path);
212 | if (!io.size)goto _ERROR;
213 | if(!PX_ResourceLibraryLoad(&runtime->ResourceLibrary,PX_RESOURCE_TYPE_SHAPE,io.buffer,io.size,key)) goto _ERROR;
214 | PX_FreeIOData(&io);
215 | return PX_TRUE;
216 | _ERROR:
217 | PX_FreeIOData(&io);
218 | return PX_FALSE;
219 | }
220 |
221 | px_bool PX_LoadAnimationToResource(PX_Runtime *runtime,px_char Path[],px_char key[])
222 | {
223 | PX_IO_Data io;
224 | io=PX_LoadFileToIOData(Path);
225 | if (!io.size)goto _ERROR;
226 | if(!PX_ResourceLibraryLoad(&runtime->ResourceLibrary,PX_RESOURCE_TYPE_ANIMATIONLIBRARY,io.buffer,io.size,key)) goto _ERROR;
227 | PX_FreeIOData(&io);
228 | return PX_TRUE;
229 | _ERROR:
230 | PX_FreeIOData(&io);
231 | return PX_FALSE;
232 | }
233 |
234 | px_bool PX_LoadScriptToResource(PX_Runtime *runtime,px_char Path[],px_char key[])
235 | {
236 | PX_IO_Data io;
237 | io=PX_LoadFileToIOData(Path);
238 | if (!io.size)goto _ERROR;
239 | if(!PX_ResourceLibraryLoad(&runtime->ResourceLibrary,PX_RESOURCE_TYPE_SCRIPT,io.buffer,io.size,key)) goto _ERROR;
240 | PX_FreeIOData(&io);
241 | return PX_TRUE;
242 | _ERROR:
243 | PX_FreeIOData(&io);
244 | return PX_FALSE;
245 | }
246 |
247 |
248 | px_bool PX_LoadSoundToResource(PX_Runtime *runtime,px_char Path[],px_char key[])
249 | {
250 | PX_IO_Data io;
251 | io=PX_LoadFileToIOData(Path);
252 | if (!io.size)goto _ERROR;
253 | if(!PX_ResourceLibraryLoad(&runtime->ResourceLibrary,PX_RESOURCE_TYPE_SOUND,io.buffer,io.size,key)) goto _ERROR;
254 | PX_FreeIOData(&io);
255 | return PX_TRUE;
256 | _ERROR:
257 | PX_FreeIOData(&io);
258 | return PX_FALSE;
259 | }
260 |
--------------------------------------------------------------------------------
/PainterEngine_Filter/PainterEngine_Filter/PainterEngine_Startup.h:
--------------------------------------------------------------------------------
1 | #ifndef PAINTERENGINE_STARTUP_H
2 | #define PAINTERENGINE_STARTUP_H
3 |
4 | #include "../../../PainterEngine/platform/windows/Platform_Windows_D2D.h"
5 | #include "../../../PainterEngine/Architecture/PainterEngine_Console.h"
6 | #include "../../../PainterEngine/platform/windows/Platform_Windows_Audio.h"
7 |
8 | typedef struct
9 | {
10 | PX_Runtime runtime;
11 | PX_Console console;
12 | PX_SoundPlay soundplay;
13 | }PX_Instance;
14 |
15 |
16 | //////////////////////////////////////////////////////////////////////////
17 |
18 | typedef struct
19 | {
20 | px_byte *buffer;
21 | px_uint size;
22 | }PX_IO_Data;
23 |
24 | px_bool PX_InstanceInitialize(PX_Instance *Instance,px_char *name,px_int width,px_int height,px_uint ui_size,px_uint resource_size,px_uint game_size);
25 | PX_IO_Data PX_LoadFileToIOData(const px_char *path);
26 | px_void PX_FreeIOData(PX_IO_Data *io);
27 | px_bool PX_LoadTextureFromFile(px_memorypool *mp,px_texture *tex,px_char *path);
28 | px_bool PX_LoadShapeFromFile(px_memorypool *mp,px_shape *shape,px_char *path);
29 | px_bool PX_LoadSoundFromFile(px_memorypool *mp,px_shape *shape,px_char *path);
30 | px_bool PX_LoadAnimationLibraryFromFile(px_memorypool *mp,px_animationlibrary *lib,px_char *path);
31 | px_bool PX_LoadScriptFromFile(px_memory *code,px_char *path);
32 | px_bool PX_LoadScriptInstanceFromFile(px_memorypool *mp,PX_ScriptVM_Instance *ins,px_char *path);
33 | px_bool PX_LoadTextureToResource(PX_Runtime *runtime,px_char Path[],px_char key[]);
34 | px_bool PX_LoadShapeToResource(PX_Runtime *runtime,px_char Path[],px_char key[]);
35 | px_bool PX_LoadAnimationToResource(PX_Runtime *runtime,px_char Path[],px_char key[]);
36 | px_bool PX_LoadScriptToResource(PX_Runtime *runtime,px_char Path[],px_char key[]);
37 | px_bool PX_LoadSoundToResource(PX_Runtime *runtime,px_char Path[],px_char key[]);
38 |
39 |
40 | #endif
41 |
--------------------------------------------------------------------------------
/PainterEngine_Filter/PainterEngine_Filter/Resources/flogo.traw:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/matrixcascade/SoundLab/7685ecf7cf9b3966be156bf3689b9628457baf04/PainterEngine_Filter/PainterEngine_Filter/Resources/flogo.traw
--------------------------------------------------------------------------------
/PainterEngine_Filter/PainterEngine_Filter/Resources/fox.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/matrixcascade/SoundLab/7685ecf7cf9b3966be156bf3689b9628457baf04/PainterEngine_Filter/PainterEngine_Filter/Resources/fox.ico
--------------------------------------------------------------------------------
/PainterEngine_Filter/PainterEngine_Filter/Resources/switch.traw:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/matrixcascade/SoundLab/7685ecf7cf9b3966be156bf3689b9628457baf04/PainterEngine_Filter/PainterEngine_Filter/Resources/switch.traw
--------------------------------------------------------------------------------
/PainterEngine_Filter/PainterEngine_Filter/Resources/volume.traw:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/matrixcascade/SoundLab/7685ecf7cf9b3966be156bf3689b9628457baf04/PainterEngine_Filter/PainterEngine_Filter/Resources/volume.traw
--------------------------------------------------------------------------------
/PainterEngine_Filter/PainterEngine_Filter/__main.c:
--------------------------------------------------------------------------------
1 | #include "PainterEngine_Application.h"
2 |
3 | //mouse informations
4 | POINT main_zoomPoint;
5 | px_int main_ZoomRegion;
6 | //////////////////////////////////////////////////////////////////////////
7 | DWORD WINAPI DEMO_RenderThreadFunc(LPVOID p)
8 | {
9 | DWORD time,elpased;
10 | PX_Object_Event e;
11 | WM_MESSAGE msg;
12 | static POINT LastDownPoint;
13 | LastDownPoint.x=-1;
14 | LastDownPoint.y=-1;
15 | /* px_char *keyBoardString;*/
16 | //////////////////////////////////////////////////////////////////////////
17 | //CreateWindow
18 |
19 | time=timeGetTime();
20 |
21 | while(1)
22 | {
23 |
24 | PX_SystemReadDeviceState();
25 |
26 | elpased=timeGetTime()-time;
27 | time=timeGetTime();
28 |
29 |
30 | while (PX_GetWinMessage(&msg))
31 | {
32 | px_char text[2]={0};
33 | e.Event=PX_OBJECT_EVENT_ANY;
34 | switch(msg.uMsg)
35 | {
36 | case WM_MOUSEMOVE:
37 | {
38 | if (msg.wparam&MK_LBUTTON)
39 | {
40 | e.Event=PX_OBJECT_EVENT_CURSORDRAG;
41 | }
42 | else
43 | {
44 | e.Event=PX_OBJECT_EVENT_CURSORMOVE;
45 | }
46 |
47 | e.Param_uint[0]=((msg.lparam)&0xffff);
48 | e.Param_uint[1]=((msg.lparam>>16)&0xffff);
49 | }
50 | break;
51 | case WM_LBUTTONDOWN:
52 | {
53 | e.Event=PX_OBJECT_EVENT_CURSORDOWN;
54 | e.Param_uint[0]=((msg.lparam)&0xffff);
55 | e.Param_uint[1]=((msg.lparam>>16)&0xffff);
56 | LastDownPoint.x=((msg.lparam)&0xffff);
57 | LastDownPoint.y=((msg.lparam>>16)&0xffff);
58 | }
59 | break;
60 | case WM_LBUTTONUP:
61 | {
62 | if (((msg.lparam)&0xffff)==LastDownPoint.x&&((msg.lparam>>16)&0xffff)==LastDownPoint.y)
63 | {
64 | e.Event=PX_OBJECT_EVENT_CURSORCLICK;
65 | e.Param_uint[0]=((msg.lparam)&0xffff);
66 | e.Param_uint[1]=((msg.lparam>>16)&0xffff);
67 | LastDownPoint.x=-1;
68 | LastDownPoint.y=-1;
69 | PX_ApplicationPostEvent(&App,e);
70 | PX_ConsolePostEvent(&App.Instance.console,e);
71 | }
72 | e.Event=PX_OBJECT_EVENT_CURSORUP;
73 | e.Param_uint[0]=((msg.lparam)&0xffff);
74 | e.Param_uint[1]=((msg.lparam>>16)&0xffff);
75 |
76 | }
77 | break;
78 | case WM_KEYDOWN:
79 | {
80 | e.Event=PX_OBJECT_EVENT_KEYDOWN;
81 | e.Param_uint[0]=msg.wparam;
82 | }
83 | break;
84 | case WM_MOUSEWHEEL:
85 | {
86 | RECT rect;
87 | GetWindowRect(PX_GetWindowHwnd(),&rect);
88 | e.Event=PX_OBJECT_EVENT_CURSORWHEEL;
89 | e.Param_int[0]=((msg.lparam)&0xffff)-rect.left;
90 | e.Param_int[1]=((msg.lparam>>16)&0xffff)-rect.top;
91 | e.Param_int[2]=(short)((msg.wparam>>16)&0xffff);
92 |
93 | }
94 | break;
95 | case WM_CHAR:
96 | {
97 |
98 | text[0]=(px_char)msg.wparam;
99 | e.Event=PX_OBJECT_EVENT_STRING;
100 | e.Param_ptr[0]=text;
101 | }
102 | break;
103 | case WM_GESTURE:
104 | {
105 | GESTUREINFO gi;
106 | BOOL bHandled;
107 | BOOL bResult;
108 | ZeroMemory(&gi, sizeof(GESTUREINFO));
109 |
110 | gi.cbSize = sizeof(GESTUREINFO);
111 |
112 | bResult = GetGestureInfo((HGESTUREINFO)msg.lparam, &gi);
113 | bHandled = FALSE;
114 |
115 | if (bResult){
116 | // now interpret the gesture
117 | switch (gi.dwID){
118 | case GID_ZOOM:
119 | // Code for zooming goes here
120 |
121 | if (25>(main_zoomPoint.x-gi.ptsLocation.x)*(main_zoomPoint.x-gi.ptsLocation.x)+(main_zoomPoint.y-gi.ptsLocation.y)*(main_zoomPoint.y-gi.ptsLocation.y))
122 | {
123 | e.Event=PX_OBJECT_EVENT_SCALE;
124 | e.Param_int[0]=gi.ptsLocation.x;
125 | e.Param_int[1]=gi.ptsLocation.y;
126 | e.Param_int[2]=(px_int)gi.ullArguments-main_ZoomRegion;
127 | }
128 |
129 | main_zoomPoint.x=gi.ptsLocation.x;
130 | main_zoomPoint.y=gi.ptsLocation.y;
131 | main_ZoomRegion=(px_int)gi.ullArguments;
132 |
133 | bHandled = TRUE;
134 | break;
135 | case GID_PAN:
136 | // Code for panning goes here
137 | bHandled = TRUE;
138 | break;
139 | case GID_ROTATE:
140 | // Code for rotation goes here
141 | bHandled = TRUE;
142 | break;
143 | case GID_TWOFINGERTAP:
144 | // Code for two-finger tap goes here
145 | bHandled = TRUE;
146 | break;
147 | case GID_PRESSANDTAP:
148 | // Code for roll over goes here
149 | bHandled = TRUE;
150 | break;
151 | default:
152 | // A gesture was not recognized
153 | break;
154 | }
155 | CloseGestureInfoHandle((HGESTUREINFO)msg.lparam);
156 | }else{
157 | DWORD dwErr = GetLastError();
158 | if (dwErr > 0){
159 | //MessageBoxW(hWnd, L"Error!", L"Could not retrieve a GESTUREINFO structure.", MB_OK);
160 | }
161 | }
162 | }
163 | break;
164 | default:
165 | continue;
166 | }
167 |
168 | if(e.Event!=PX_OBJECT_EVENT_ANY)
169 | {
170 | PX_ApplicationPostEvent(&App,e);
171 | PX_ConsolePostEvent(&App.Instance.console,e);
172 | }
173 |
174 | }
175 | PX_ApplicationUpdate(&App,elpased);
176 | PX_ApplicationRender(&App,elpased);
177 | PX_SystemRender(App.Instance.runtime.RenderSurface.surfaceBuffer,PX_WINDOW_WIDTH,PX_WINDOW_HEIGHT);
178 | Sleep(0);
179 | }
180 | return 0;
181 | }
182 | //int main()
183 | int WINAPI WinMain( __in HINSTANCE hInstance, __in_opt HINSTANCE hPrevInstance, __in LPSTR lpCmdLine, __in int nShowCmd )
184 | {
185 | HANDLE hThread;
186 | DWORD threadId;
187 | PX_srand(314159);
188 | if(!PX_InstanceInitialize(&App.Instance,PX_WINDOW_NAME,PX_WINDOW_WIDTH,PX_WINDOW_HEIGHT,PX_MEMORY_UI_SIZE,PX_MEMORY_RESOURCES_SIZE,PX_MEMORY_GAME_SIZE)) return 0;
189 | if(!PX_ApplicationInitialize(&App))return 0;
190 | //////////////////////////////////////////////////////////////////////////
191 | //CreateThread
192 |
193 | hThread = CreateThread(NULL, 0, DEMO_RenderThreadFunc, 0, 0, &threadId);
194 | PX_AudioInitialize(PX_GetWindowHwnd(),&App.Instance.soundplay,PX_FALSE);
195 |
196 | while(PX_SystemLoop()){};
197 |
198 | return 0;
199 | }
200 |
201 |
202 |
--------------------------------------------------------------------------------
/PainterEngine_Filter/PainterEngine_Filter/resource.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/matrixcascade/SoundLab/7685ecf7cf9b3966be156bf3689b9628457baf04/PainterEngine_Filter/PainterEngine_Filter/resource.h
--------------------------------------------------------------------------------
/PainterEngine_SoundLab/PainterEngine_SoundLab.opensdf:
--------------------------------------------------------------------------------
1 | m a t r i D E S K T O P - G H C U N 2 N
--------------------------------------------------------------------------------
/PainterEngine_SoundLab/PainterEngine_SoundLab.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 11.00
3 | # Visual Studio 2010
4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PainterEngine_SoundLab", "PainterEngine_SoundLab\PainterEngine_SoundLab.vcxproj", "{C4F72E54-6D64-4ABF-A4C0-B0AD0B263C26}"
5 | EndProject
6 | Global
7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
8 | Debug|Win32 = Debug|Win32
9 | Release|Win32 = Release|Win32
10 | EndGlobalSection
11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
12 | {C4F72E54-6D64-4ABF-A4C0-B0AD0B263C26}.Debug|Win32.ActiveCfg = Debug|Win32
13 | {C4F72E54-6D64-4ABF-A4C0-B0AD0B263C26}.Debug|Win32.Build.0 = Debug|Win32
14 | {C4F72E54-6D64-4ABF-A4C0-B0AD0B263C26}.Release|Win32.ActiveCfg = Release|Win32
15 | {C4F72E54-6D64-4ABF-A4C0-B0AD0B263C26}.Release|Win32.Build.0 = Release|Win32
16 | EndGlobalSection
17 | GlobalSection(SolutionProperties) = preSolution
18 | HideSolutionNode = FALSE
19 | EndGlobalSection
20 | EndGlobal
21 |
--------------------------------------------------------------------------------
/PainterEngine_SoundLab/PainterEngine_SoundLab.suo:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/matrixcascade/SoundLab/7685ecf7cf9b3966be156bf3689b9628457baf04/PainterEngine_SoundLab/PainterEngine_SoundLab.suo
--------------------------------------------------------------------------------
/PainterEngine_SoundLab/PainterEngine_SoundLab/PainterEngine_Application.c:
--------------------------------------------------------------------------------
1 | #include "PainterEngine_Application.h"
2 |
3 | PX_Application App;
4 |
5 | #define PX_SOUNDLAB_SAMPLE_WINDOW 1024
6 | px_bool PX_ApplicationInitialize(PX_Application *App)
7 | {
8 | if (!SoundLab_Startup_Initialize(&App->Instance,&App->startup))
9 | {
10 | return PX_FALSE;
11 | }
12 |
13 | if (!SoundLab_Main_Initialize(&App->Instance,&App->smain))
14 | {
15 | return PX_FALSE;
16 | }
17 | App->status=PX_SOUNDLAB_STATUS_STARTUP;
18 |
19 |
20 |
21 | return PX_TRUE;
22 | }
23 |
24 | px_void PX_ApplicationUpdate(PX_Application *App,px_dword elpased)
25 | {
26 | switch(App->status)
27 | {
28 | case PX_SOUNDLAB_STATUS_STARTUP:
29 | {
30 | SoundLab_Startup_Update(&App->startup,elpased);
31 | if(App->startup.bend) App->status=PX_SOUNDLAB_STATUS_MAIN;
32 | }
33 | break;
34 | case PX_SOUNDLAB_STATUS_MAIN:
35 | {
36 | SoundLab_Main_Update(&App->smain,elpased);
37 | }
38 | break;
39 | }
40 | }
41 |
42 | px_void PX_ApplicationRender(PX_Application *App,px_dword elpased)
43 | {
44 | PX_SurfaceClear(&App->Instance.runtime.RenderSurface,0,0,App->Instance.runtime.RenderSurface.width-1,App->Instance.runtime.RenderSurface.height-1,PX_COLOR(255,96,96,96));
45 | switch(App->status)
46 | {
47 | case PX_SOUNDLAB_STATUS_STARTUP:
48 | {
49 | SoundLab_Startup_Render(&App->startup,elpased);
50 | }
51 | break;
52 | case PX_SOUNDLAB_STATUS_MAIN:
53 | {
54 | SoundLab_Main_Render(&App->Instance.runtime.RenderSurface,&App->smain,elpased);
55 | }
56 | break;
57 | }
58 | }
59 |
60 | px_void PX_ApplicationPostEvent(PX_Application *App,PX_Object_Event e)
61 | {
62 | switch(App->status)
63 | {
64 | case PX_SOUNDLAB_STATUS_STARTUP:
65 | {
66 | SoundLab_Startup_PostEvent(&App->startup,e);
67 | }
68 | break;
69 | case PX_SOUNDLAB_STATUS_MAIN:
70 | {
71 | SoundLab_Main_PostEvent(&App->smain,e);
72 | }
73 | break;
74 | }
75 | }
76 |
77 |
--------------------------------------------------------------------------------
/PainterEngine_SoundLab/PainterEngine_SoundLab/PainterEngine_Application.h:
--------------------------------------------------------------------------------
1 | #ifndef PAINTERENGINE_APPLICATION_H
2 | #define PAINTERENGINE_APPLICATION_H
3 | #include "PainterEngine_Startup.h"
4 | #include "SoundLab_Startup.h"
5 | #include "SoundLab_Main.h"
6 | //////////////////////////////////////////////////////////////////////////
7 | //Configures
8 | #define PX_WINDOW_NAME "SoundLab"
9 |
10 | #define PX_WINDOW_WIDTH 1200
11 | #define PX_WINDOW_HEIGHT 800
12 |
13 | //memorypool for runtime(bytes)
14 | #define PX_MEMORY_UI_SIZE (1024*1024*32)
15 | #define PX_MEMORY_RESOURCES_SIZE (1024*1024*2)
16 | #define PX_MEMORY_GAME_SIZE (1024*1024*256)
17 | //////////////////////////////////////////////////////////////////////////
18 |
19 | typedef enum
20 | {
21 | PX_SOUNDLAB_STATUS_STARTUP,
22 | PX_SOUNDLAB_STATUS_MAIN,
23 | }PX_SOUNDLAB_STATUS;
24 |
25 |
26 | typedef struct
27 | {
28 | PX_SOUNDLAB_STATUS status;
29 | SoundLab_Startup startup;
30 | SoundLab_Main smain;
31 | PX_Instance Instance;
32 | }PX_Application;
33 |
34 | extern PX_Application App;
35 |
36 | px_bool PX_ApplicationInitialize(PX_Application *App);
37 | px_void PX_ApplicationUpdate(PX_Application *App,px_dword elpased);
38 | px_void PX_ApplicationRender(PX_Application *App,px_dword elpased);
39 | px_void PX_ApplicationPostEvent(PX_Application *App,PX_Object_Event e);
40 |
41 | #endif
42 |
--------------------------------------------------------------------------------
/PainterEngine_SoundLab/PainterEngine_SoundLab/PainterEngine_SoundLab.aps:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/matrixcascade/SoundLab/7685ecf7cf9b3966be156bf3689b9628457baf04/PainterEngine_SoundLab/PainterEngine_SoundLab/PainterEngine_SoundLab.aps
--------------------------------------------------------------------------------
/PainterEngine_SoundLab/PainterEngine_SoundLab/PainterEngine_SoundLab.rc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/matrixcascade/SoundLab/7685ecf7cf9b3966be156bf3689b9628457baf04/PainterEngine_SoundLab/PainterEngine_SoundLab/PainterEngine_SoundLab.rc
--------------------------------------------------------------------------------
/PainterEngine_SoundLab/PainterEngine_SoundLab/PainterEngine_SoundLab.vcxproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | Win32
7 |
8 |
9 | Release
10 | Win32
11 |
12 |
13 |
14 | {C4F72E54-6D64-4ABF-A4C0-B0AD0B263C26}
15 | PainterEngine_SoundLab
16 |
17 |
18 |
19 | Application
20 | true
21 | MultiByte
22 |
23 |
24 | Application
25 | false
26 | true
27 | MultiByte
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 | Level3
43 | Disabled
44 |
45 |
46 | true
47 | 16777216
48 |
49 |
50 |
51 |
52 | Level3
53 | MaxSpeed
54 | true
55 | true
56 |
57 |
58 | true
59 | true
60 | true
61 | 16777216
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 |
161 |
162 |
163 |
164 |
165 |
166 |
167 |
168 |
169 |
170 |
171 |
172 |
173 |
174 |
175 |
176 |
177 |
178 |
179 |
180 |
181 |
182 |
183 |
184 |
185 |
186 |
187 |
188 |
189 |
190 |
191 |
192 |
193 |
194 |
195 |
196 |
197 |
198 |
199 |
200 |
201 |
202 |
203 |
204 |
205 |
206 |
--------------------------------------------------------------------------------
/PainterEngine_SoundLab/PainterEngine_SoundLab/PainterEngine_SoundLab.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
7 |
8 |
9 | {93995380-89BD-4b04-88EB-625FBE52EBFB}
10 | h;hpp;hxx;hm;inl;inc;xsd
11 |
12 |
13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
15 |
16 |
17 | {4e8ff05a-979e-4cb7-a082-491b2c1efa3a}
18 |
19 |
20 |
21 |
22 | 源文件
23 |
24 |
25 | 源文件
26 |
27 |
28 | PainterEngine
29 |
30 |
31 | PainterEngine
32 |
33 |
34 | PainterEngine
35 |
36 |
37 | PainterEngine
38 |
39 |
40 | PainterEngine
41 |
42 |
43 | PainterEngine
44 |
45 |
46 | PainterEngine
47 |
48 |
49 | PainterEngine
50 |
51 |
52 | PainterEngine
53 |
54 |
55 | PainterEngine
56 |
57 |
58 | PainterEngine
59 |
60 |
61 | PainterEngine
62 |
63 |
64 | PainterEngine
65 |
66 |
67 | PainterEngine
68 |
69 |
70 | PainterEngine
71 |
72 |
73 | PainterEngine
74 |
75 |
76 | PainterEngine
77 |
78 |
79 | PainterEngine
80 |
81 |
82 | PainterEngine
83 |
84 |
85 | PainterEngine
86 |
87 |
88 | PainterEngine
89 |
90 |
91 | PainterEngine
92 |
93 |
94 | PainterEngine
95 |
96 |
97 | PainterEngine
98 |
99 |
100 | PainterEngine
101 |
102 |
103 | PainterEngine
104 |
105 |
106 | PainterEngine
107 |
108 |
109 | PainterEngine
110 |
111 |
112 | PainterEngine
113 |
114 |
115 | PainterEngine
116 |
117 |
118 | PainterEngine
119 |
120 |
121 | PainterEngine
122 |
123 |
124 | PainterEngine
125 |
126 |
127 | PainterEngine
128 |
129 |
130 | PainterEngine
131 |
132 |
133 | PainterEngine
134 |
135 |
136 | PainterEngine
137 |
138 |
139 | PainterEngine
140 |
141 |
142 | PainterEngine
143 |
144 |
145 | PainterEngine
146 |
147 |
148 | PainterEngine
149 |
150 |
151 | PainterEngine
152 |
153 |
154 | PainterEngine
155 |
156 |
157 | PainterEngine
158 |
159 |
160 | PainterEngine
161 |
162 |
163 | PainterEngine
164 |
165 |
166 | PainterEngine
167 |
168 |
169 | PainterEngine
170 |
171 |
172 | PainterEngine
173 |
174 |
175 | PainterEngine
176 |
177 |
178 | PainterEngine
179 |
180 |
181 | PainterEngine
182 |
183 |
184 | PainterEngine
185 |
186 |
187 | 源文件
188 |
189 |
190 | PainterEngine
191 |
192 |
193 | 源文件
194 |
195 |
196 | 源文件
197 |
198 |
199 | PainterEngine
200 |
201 |
202 | PainterEngine
203 |
204 |
205 |
206 |
207 | 头文件
208 |
209 |
210 | PainterEngine
211 |
212 |
213 | PainterEngine
214 |
215 |
216 | PainterEngine
217 |
218 |
219 | PainterEngine
220 |
221 |
222 | PainterEngine
223 |
224 |
225 | PainterEngine
226 |
227 |
228 | PainterEngine
229 |
230 |
231 | PainterEngine
232 |
233 |
234 | PainterEngine
235 |
236 |
237 | PainterEngine
238 |
239 |
240 | PainterEngine
241 |
242 |
243 | PainterEngine
244 |
245 |
246 | PainterEngine
247 |
248 |
249 | PainterEngine
250 |
251 |
252 | PainterEngine
253 |
254 |
255 | PainterEngine
256 |
257 |
258 | PainterEngine
259 |
260 |
261 | PainterEngine
262 |
263 |
264 | PainterEngine
265 |
266 |
267 | PainterEngine
268 |
269 |
270 | PainterEngine
271 |
272 |
273 | PainterEngine
274 |
275 |
276 | PainterEngine
277 |
278 |
279 | PainterEngine
280 |
281 |
282 | PainterEngine
283 |
284 |
285 | PainterEngine
286 |
287 |
288 | PainterEngine
289 |
290 |
291 | PainterEngine
292 |
293 |
294 | PainterEngine
295 |
296 |
297 | PainterEngine
298 |
299 |
300 | PainterEngine
301 |
302 |
303 | PainterEngine
304 |
305 |
306 | PainterEngine
307 |
308 |
309 | PainterEngine
310 |
311 |
312 | PainterEngine
313 |
314 |
315 | PainterEngine
316 |
317 |
318 | PainterEngine
319 |
320 |
321 | PainterEngine
322 |
323 |
324 | PainterEngine
325 |
326 |
327 | PainterEngine
328 |
329 |
330 | PainterEngine
331 |
332 |
333 | PainterEngine
334 |
335 |
336 | PainterEngine
337 |
338 |
339 | PainterEngine
340 |
341 |
342 | PainterEngine
343 |
344 |
345 | PainterEngine
346 |
347 |
348 | PainterEngine
349 |
350 |
351 | PainterEngine
352 |
353 |
354 | PainterEngine
355 |
356 |
357 | PainterEngine
358 |
359 |
360 | PainterEngine
361 |
362 |
363 | PainterEngine
364 |
365 |
366 | PainterEngine
367 |
368 |
369 | PainterEngine
370 |
371 |
372 | PainterEngine
373 |
374 |
375 | PainterEngine
376 |
377 |
378 | PainterEngine
379 |
380 |
381 | 头文件
382 |
383 |
384 | PainterEngine
385 |
386 |
387 | PainterEngine
388 |
389 |
390 | 源文件
391 |
392 |
393 | 源文件
394 |
395 |
396 | 源文件
397 |
398 |
399 | 头文件
400 |
401 |
402 | PainterEngine
403 |
404 |
405 | PainterEngine
406 |
407 |
408 |
409 |
410 | 源文件
411 |
412 |
413 | 资源文件
414 |
415 |
416 |
417 |
418 | 资源文件
419 |
420 |
421 |
--------------------------------------------------------------------------------
/PainterEngine_SoundLab/PainterEngine_SoundLab/PainterEngine_SoundLab.vcxproj.user:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/PainterEngine_SoundLab/PainterEngine_SoundLab/PainterEngine_Startup.c:
--------------------------------------------------------------------------------
1 | #include "PainterEngine_Startup.h"
2 |
3 |
4 | //////////////////////////////////////////////////////////////////////////
5 | //Functions
6 |
7 | px_bool PX_InstanceInitialize(PX_Instance *Instance,px_char *name,px_int width,px_int height,px_uint ui_size,px_uint resource_size,px_uint game_size)
8 | {
9 | px_int allocSize;
10 |
11 | PX_srand(timeGetTime());
12 |
13 | if (!PX_CreateWindow(width,height,name,PX_FALSE))
14 | {
15 | return 0;
16 | }
17 |
18 | allocSize=ui_size+resource_size+game_size+1024*1024*16;
19 |
20 | if (!PX_RuntimeInitialize(&Instance->runtime,width,height,malloc(allocSize),allocSize,ui_size,resource_size,game_size))
21 | return PX_FALSE;
22 |
23 | if (!PX_ConsoleInitialize(&Instance->runtime,&Instance->console))
24 | return PX_FALSE;
25 |
26 | if (!PX_SoundPlayInit(&Instance->runtime.mp_game,&Instance->soundplay))
27 | return PX_FALSE;
28 |
29 |
30 | return PX_TRUE;
31 | }
32 |
33 |
34 |
35 |
36 | PX_IO_Data PX_LoadFileToIOData(px_char *path)
37 | {
38 | PX_IO_Data io;
39 | px_int fileoft=0;
40 | FILE *pf=fopen(path,"rb");
41 | px_int filesize;
42 | if (!pf)
43 | {
44 | goto _ERROR;
45 | }
46 | fseek(pf,0,SEEK_END);
47 | filesize=ftell(pf);
48 | fseek(pf,0,SEEK_SET);
49 |
50 | io.buffer=(px_byte *)malloc(filesize+1);
51 | if (!io.buffer)
52 | {
53 | goto _ERROR;
54 | }
55 |
56 | while (!feof(pf))
57 | {
58 | fileoft+=(px_int)fread(io.buffer+fileoft,1,1024,pf);
59 | }
60 | fclose(pf);
61 |
62 | io.buffer[filesize]='\0';
63 | io.size=filesize;
64 | return io;
65 | _ERROR:
66 | io.buffer=PX_NULL;
67 | io.size=0;
68 | return io;
69 | }
70 |
71 | px_void PX_FreeIOData(PX_IO_Data *io)
72 | {
73 | if (io->size&&io->buffer)
74 | {
75 | free(io->buffer);
76 | io->size=0;
77 | io->buffer=PX_NULL;
78 | }
79 | }
80 |
81 | px_bool PX_LoadTextureFromFile(px_memorypool *mp,px_texture *tex,px_char *path)
82 | {
83 | PX_IO_Data io;
84 |
85 | #ifdef PAINTERENGINE_IMAGEDECODER_H
86 | if (PX_TextureCreateFromPngFile(mp,tex,path))
87 | {
88 | return PX_TRUE;
89 | }
90 | if (PX_TextureCreateFromJpegFile(mp,tex,path))
91 | {
92 | return PX_TRUE;
93 | }
94 | #endif
95 |
96 | io=PX_LoadFileToIOData(path);
97 | if (!io.size)
98 | {
99 | return PX_FALSE;
100 | }
101 | if (PX_TextureCreateFromMemory(mp,io.buffer,io.size,tex))
102 | {
103 | PX_FreeIOData(&io);
104 | return PX_TRUE;
105 | }
106 | PX_FreeIOData(&io);
107 | return PX_FALSE;
108 | }
109 |
110 | px_bool PX_LoadShapeFromFile(px_memorypool *mp,px_shape *shape,px_char *path)
111 | {
112 | PX_IO_Data io=PX_LoadFileToIOData(path);
113 | if (!io.size)
114 | {
115 | return PX_FALSE;
116 | }
117 | if (PX_ShapeCreateFromMemory(mp,io.buffer,io.size,shape))
118 | {
119 | PX_FreeIOData(&io);
120 | return PX_TRUE;
121 | }
122 | PX_FreeIOData(&io);
123 | return PX_FALSE;
124 |
125 | }
126 |
127 |
128 | px_bool PX_LoadSoundFromFile(px_memorypool *mp,PX_SoundData *soundData,px_char *path)
129 | {
130 | PX_IO_Data io=PX_LoadFileToIOData(path);
131 | if (!io.size)
132 | {
133 | return PX_FALSE;
134 | }
135 | if (PX_SoundStaticDataCreate(soundData,mp,io.buffer,io.size))
136 | {
137 | PX_FreeIOData(&io);
138 | return PX_TRUE;
139 | }
140 | PX_FreeIOData(&io);
141 | return PX_FALSE;
142 | }
143 |
144 |
145 | px_bool PX_LoadAnimationLibraryFromFile(px_memorypool *mp,px_animationlibrary *lib,px_char *path)
146 | {
147 | PX_IO_Data io;
148 | io=PX_LoadFileToIOData(path);
149 | if (!io.size)
150 | {
151 | return PX_FALSE;
152 | }
153 | if (PX_AnimationLibraryCreateFromMemory(mp,lib,io.buffer,io.size))
154 | {
155 | PX_FreeIOData(&io);
156 | return PX_TRUE;
157 | }
158 | PX_FreeIOData(&io);
159 | return PX_FALSE;
160 |
161 | }
162 |
163 | px_bool PX_LoadScriptFromFile(px_memory *code,px_char *path)
164 | {
165 | PX_IO_Data io=PX_LoadFileToIOData(path);
166 | if (!io.size)
167 | {
168 | return PX_FALSE;
169 | }
170 | if(!PX_MemoryCopy(code,io.buffer,0,io.size))
171 | goto _ERROR;
172 |
173 | PX_FreeIOData(&io);
174 | return PX_TRUE;
175 | _ERROR:
176 | PX_FreeIOData(&io);
177 | return PX_FALSE;
178 |
179 | }
180 |
181 |
182 | px_bool PX_LoadScriptInstanceFromFile(px_memorypool *mp,PX_ScriptVM_Instance *ins,px_char *path)
183 | {
184 | PX_IO_Data io=PX_LoadFileToIOData(path);
185 | if (!io.size)
186 | {
187 | return PX_FALSE;
188 | }
189 | if(!PX_ScriptVM_InstanceInit(ins,mp,io.buffer,io.size))
190 | goto _ERROR;
191 |
192 | PX_FreeIOData(&io);
193 | return PX_TRUE;
194 | _ERROR:
195 | PX_FreeIOData(&io);
196 | return PX_FALSE;
197 | }
198 |
199 | px_bool PX_LoadTextureToResource(PX_Runtime *runtime,px_char Path[],px_char key[])
200 | {
201 | PX_IO_Data io;
202 | io=PX_LoadFileToIOData(Path);
203 | if (!io.size)goto _ERROR;
204 | if(!PX_ResourceLibraryLoad(&runtime->ResourceLibrary,PX_RESOURCE_TYPE_TEXTURE,io.buffer,io.size,key)) goto _ERROR;
205 | PX_FreeIOData(&io);
206 | return PX_TRUE;
207 | _ERROR:
208 | PX_FreeIOData(&io);
209 | return PX_FALSE;
210 | }
211 |
212 | px_bool PX_LoadShapeToResource(PX_Runtime *runtime,px_char Path[],px_char key[])
213 | {
214 | PX_IO_Data io;
215 | io=PX_LoadFileToIOData(Path);
216 | if (!io.size)goto _ERROR;
217 | if(!PX_ResourceLibraryLoad(&runtime->ResourceLibrary,PX_RESOURCE_TYPE_SHAPE,io.buffer,io.size,key)) goto _ERROR;
218 | PX_FreeIOData(&io);
219 | return PX_TRUE;
220 | _ERROR:
221 | PX_FreeIOData(&io);
222 | return PX_FALSE;
223 | }
224 |
225 | px_bool PX_LoadAnimationToResource(PX_Runtime *runtime,px_char Path[],px_char key[])
226 | {
227 | PX_IO_Data io;
228 | io=PX_LoadFileToIOData(Path);
229 | if (!io.size)goto _ERROR;
230 | if(!PX_ResourceLibraryLoad(&runtime->ResourceLibrary,PX_RESOURCE_TYPE_ANIMATIONLIBRARY,io.buffer,io.size,key)) goto _ERROR;
231 | PX_FreeIOData(&io);
232 | return PX_TRUE;
233 | _ERROR:
234 | PX_FreeIOData(&io);
235 | return PX_FALSE;
236 | }
237 |
238 | px_bool PX_LoadScriptToResource(PX_Runtime *runtime,px_char Path[],px_char key[])
239 | {
240 | PX_IO_Data io;
241 | io=PX_LoadFileToIOData(Path);
242 | if (!io.size)goto _ERROR;
243 | if(!PX_ResourceLibraryLoad(&runtime->ResourceLibrary,PX_RESOURCE_TYPE_SCRIPT,io.buffer,io.size,key)) goto _ERROR;
244 | PX_FreeIOData(&io);
245 | return PX_TRUE;
246 | _ERROR:
247 | PX_FreeIOData(&io);
248 | return PX_FALSE;
249 | }
250 |
251 |
252 | px_bool PX_LoadSoundToResource(PX_Runtime *runtime,px_char Path[],px_char key[])
253 | {
254 | PX_IO_Data io;
255 | io=PX_LoadFileToIOData(Path);
256 | if (!io.size)goto _ERROR;
257 | if(!PX_ResourceLibraryLoad(&runtime->ResourceLibrary,PX_RESOURCE_TYPE_SOUND,io.buffer,io.size,key)) goto _ERROR;
258 | PX_FreeIOData(&io);
259 | return PX_TRUE;
260 | _ERROR:
261 | PX_FreeIOData(&io);
262 | return PX_FALSE;
263 | }
264 |
265 | px_bool PX_LoadFontModuleFromFile(PX_FontModule *fm,px_char Path[])
266 | {
267 | PX_IO_Data io;
268 | io=PX_LoadFileToIOData(Path);
269 | if (!io.size)goto _ERROR;
270 | if(!PX_FontModuleLoad(fm,io.buffer,io.size)) goto _ERROR;
271 | PX_FreeIOData(&io);
272 | return PX_TRUE;
273 | _ERROR:
274 | PX_FreeIOData(&io);
275 | return PX_FALSE;
276 | }
277 |
--------------------------------------------------------------------------------
/PainterEngine_SoundLab/PainterEngine_SoundLab/PainterEngine_Startup.h:
--------------------------------------------------------------------------------
1 | #ifndef PAINTERENGINE_STARTUP_H
2 | #define PAINTERENGINE_STARTUP_H
3 |
4 | #include "../../../PainterEngine/platform/windows/Platform_Windows_D2D.h"
5 | #include "../../../PainterEngine/Architecture/PainterEngine_Console.h"
6 | #include "../../../PainterEngine/Architecture/PainterEngine_MessageBox.h"
7 | #include "../../../PainterEngine/platform/windows/Platform_Windows_Audio.h"
8 | #include "SoundLab_Text.h"
9 |
10 | typedef struct
11 | {
12 | PX_Runtime runtime;
13 | PX_Console console;
14 | PX_SoundPlay soundplay;
15 | }PX_Instance;
16 |
17 |
18 | //////////////////////////////////////////////////////////////////////////
19 |
20 | typedef struct
21 | {
22 | px_byte *buffer;
23 | px_uint size;
24 | }PX_IO_Data;
25 |
26 | px_bool PX_InstanceInitialize(PX_Instance *Instance,px_char *name,px_int width,px_int height,px_uint ui_size,px_uint resource_size,px_uint game_size);
27 | PX_IO_Data PX_LoadFileToIOData(px_char *path);
28 | px_void PX_FreeIOData(PX_IO_Data *io);
29 | px_bool PX_LoadTextureFromFile(px_memorypool *mp,px_texture *tex,px_char *path);
30 | px_bool PX_LoadShapeFromFile(px_memorypool *mp,px_shape *shape,px_char *path);
31 | px_bool PX_LoadSoundFromFile(px_memorypool *mp,PX_SoundData *soundData,px_char *path);
32 | px_bool PX_LoadAnimationLibraryFromFile(px_memorypool *mp,px_animationlibrary *lib,px_char *path);
33 | px_bool PX_LoadScriptFromFile(px_memory *code,px_char *path);
34 | px_bool PX_LoadScriptInstanceFromFile(px_memorypool *mp,PX_ScriptVM_Instance *ins,px_char *path);
35 | px_bool PX_LoadTextureToResource(PX_Runtime *runtime,px_char Path[],px_char key[]);
36 | px_bool PX_LoadShapeToResource(PX_Runtime *runtime,px_char Path[],px_char key[]);
37 | px_bool PX_LoadAnimationToResource(PX_Runtime *runtime,px_char Path[],px_char key[]);
38 | px_bool PX_LoadScriptToResource(PX_Runtime *runtime,px_char Path[],px_char key[]);
39 | px_bool PX_LoadSoundToResource(PX_Runtime *runtime,px_char Path[],px_char key[]);
40 | px_bool PX_LoadFontModuleFromFile(PX_FontModule *fm,px_char Path[]);
41 |
42 | #endif
43 |
--------------------------------------------------------------------------------
/PainterEngine_SoundLab/PainterEngine_SoundLab/Resources/ann.traw:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/matrixcascade/SoundLab/7685ecf7cf9b3966be156bf3689b9628457baf04/PainterEngine_SoundLab/PainterEngine_SoundLab/Resources/ann.traw
--------------------------------------------------------------------------------
/PainterEngine_SoundLab/PainterEngine_SoundLab/Resources/en32.pxf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/matrixcascade/SoundLab/7685ecf7cf9b3966be156bf3689b9628457baf04/PainterEngine_SoundLab/PainterEngine_SoundLab/Resources/en32.pxf
--------------------------------------------------------------------------------
/PainterEngine_SoundLab/PainterEngine_SoundLab/Resources/file.traw:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/matrixcascade/SoundLab/7685ecf7cf9b3966be156bf3689b9628457baf04/PainterEngine_SoundLab/PainterEngine_SoundLab/Resources/file.traw
--------------------------------------------------------------------------------
/PainterEngine_SoundLab/PainterEngine_SoundLab/Resources/fox.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/matrixcascade/SoundLab/7685ecf7cf9b3966be156bf3689b9628457baf04/PainterEngine_SoundLab/PainterEngine_SoundLab/Resources/fox.ico
--------------------------------------------------------------------------------
/PainterEngine_SoundLab/PainterEngine_SoundLab/Resources/logo.traw:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/matrixcascade/SoundLab/7685ecf7cf9b3966be156bf3689b9628457baf04/PainterEngine_SoundLab/PainterEngine_SoundLab/Resources/logo.traw
--------------------------------------------------------------------------------
/PainterEngine_SoundLab/PainterEngine_SoundLab/Resources/play.traw:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/matrixcascade/SoundLab/7685ecf7cf9b3966be156bf3689b9628457baf04/PainterEngine_SoundLab/PainterEngine_SoundLab/Resources/play.traw
--------------------------------------------------------------------------------
/PainterEngine_SoundLab/PainterEngine_SoundLab/Resources/recorder.traw:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/matrixcascade/SoundLab/7685ecf7cf9b3966be156bf3689b9628457baf04/PainterEngine_SoundLab/PainterEngine_SoundLab/Resources/recorder.traw
--------------------------------------------------------------------------------
/PainterEngine_SoundLab/PainterEngine_SoundLab/Resources/recordfinish.traw:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/matrixcascade/SoundLab/7685ecf7cf9b3966be156bf3689b9628457baf04/PainterEngine_SoundLab/PainterEngine_SoundLab/Resources/recordfinish.traw
--------------------------------------------------------------------------------
/PainterEngine_SoundLab/PainterEngine_SoundLab/Resources/recording.traw:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/matrixcascade/SoundLab/7685ecf7cf9b3966be156bf3689b9628457baf04/PainterEngine_SoundLab/PainterEngine_SoundLab/Resources/recording.traw
--------------------------------------------------------------------------------
/PainterEngine_SoundLab/PainterEngine_SoundLab/Resources/reset.traw:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/matrixcascade/SoundLab/7685ecf7cf9b3966be156bf3689b9628457baf04/PainterEngine_SoundLab/PainterEngine_SoundLab/Resources/reset.traw
--------------------------------------------------------------------------------
/PainterEngine_SoundLab/PainterEngine_SoundLab/Resources/sampling.traw:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/matrixcascade/SoundLab/7685ecf7cf9b3966be156bf3689b9628457baf04/PainterEngine_SoundLab/PainterEngine_SoundLab/Resources/sampling.traw
--------------------------------------------------------------------------------
/PainterEngine_SoundLab/PainterEngine_SoundLab/Resources/save.traw:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/matrixcascade/SoundLab/7685ecf7cf9b3966be156bf3689b9628457baf04/PainterEngine_SoundLab/PainterEngine_SoundLab/Resources/save.traw
--------------------------------------------------------------------------------
/PainterEngine_SoundLab/PainterEngine_SoundLab/Resources/stop.traw:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/matrixcascade/SoundLab/7685ecf7cf9b3966be156bf3689b9628457baf04/PainterEngine_SoundLab/PainterEngine_SoundLab/Resources/stop.traw
--------------------------------------------------------------------------------
/PainterEngine_SoundLab/PainterEngine_SoundLab/Resources/test.traw:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/matrixcascade/SoundLab/7685ecf7cf9b3966be156bf3689b9628457baf04/PainterEngine_SoundLab/PainterEngine_SoundLab/Resources/test.traw
--------------------------------------------------------------------------------
/PainterEngine_SoundLab/PainterEngine_SoundLab/SoundLab_Data.h:
--------------------------------------------------------------------------------
1 | #ifndef SOUNDLAB_DATA_H
2 | #define SOUNDLAB_DATA_H
3 |
4 | #define SOUNDLAB_FEATURE_DATA_MFCC_SIZE 128
5 | #define SOUNDLAB_WINDOW_WIDTH 1024
6 | #define SOUNDLAB_DEFAULT_TIMEDOMAIN_SIZE 2048
7 | #define SOUNDLAB_SOUNDANALYSIS_INDEX 0
8 | #define SOUNDLAB_SOUNDCAPTURE_INDEX 1
9 | #define SOUNDLAB_SOUNDCAPTURE_BLOCKSIZE 2048
10 | #define SOUNDLAB_SOUNDCAPTURE_BLOCKCOUNT 16
11 | #define SOUNDLAB_SOUNDCAPTURE_BLOCKWAIT 4
12 | #define SOUNDLAB_TRAIN_MFCC_SAMPLE_FACTOR_COUNT 24
13 | #define SOUNDLAB_TRAIN_MFCC_ARRAY_COUNT 128
14 | #define SOUBDLAB_TRAIN_TARGET_EPOCH 10000
15 | #define SOUNDLAB_OVERTONE_MARK_COUNT 20
16 | #define SOUNDLAB_DEFLAUT_THRESHOLD 2048
17 | typedef struct
18 | {
19 | px_dword magic;//sinc
20 | px_double pitchshift;
21 | px_double filter[SOUNDLAB_WINDOW_WIDTH];
22 | px_double fix[SOUNDLAB_WINDOW_WIDTH];
23 | PX_MFCC_FEATURE mfcc[SOUNDLAB_FEATURE_DATA_MFCC_SIZE];
24 | }SOUNDLAB_FEATURE_DATA;
25 |
26 | #endif
--------------------------------------------------------------------------------
/PainterEngine_SoundLab/PainterEngine_SoundLab/SoundLab_Main.h:
--------------------------------------------------------------------------------
1 | #ifndef SOUNDLAB_MAIN_H
2 | #define SOUNDLAB_MAIN_H
3 | #include "PainterEngine_Startup.h"
4 | #include "SoundLab_Data.h"
5 |
6 |
7 |
8 | typedef enum
9 | {
10 | SOUNDLAB_MAIN_STATUS_STOP,
11 | SOUNDLAB_MAIN_STATUS_PLAY,
12 | SOUNDLAB_MAIN_STATUS_ANALYSISING,
13 | SOUNDLAB_MAIN_STATUS_EXPORTING,
14 | SOUNDLAB_MAIN_STATUS_TUNING,
15 | SOUNDLAB_MAIN_STATUS_RECORDING,
16 | SOUNDLAB_MAIN_STATUS_ANN,
17 | }SOUNDLAB_MAIN_STATUS;
18 |
19 |
20 | typedef enum
21 | {
22 | SOUNDLAB_MAIN_DISPLAY_STFT,
23 | SOUNDLAB_MAIN_DISPLAY_SPECTRUM,
24 | SOUNDLAB_MAIN_DISPLAY_CEPSTRUM,
25 | SOUNDLAB_MAIN_DISPLAY_ADAPT,
26 | SOUNDLAB_MAIN_DISPLAY_RECORDING,
27 | SOUNDLAB_MAIN_DISPLAY_ANALYSISING,
28 | SOUNDLAB_MAIN_DISPLAY_ANN,
29 | }SOUNDLAB_MAIN_DISPLAY;
30 |
31 | typedef struct
32 | {
33 | px_double mfcc_factor[SOUNDLAB_TRAIN_MFCC_SAMPLE_FACTOR_COUNT];
34 | }SOUNDLAB_TRAIN_MFCC_SAMPLE;
35 |
36 |
37 |
38 | typedef enum
39 | {
40 | SOUNDLAB_MAIN_ADAPT_MODE_SHIFT,
41 | SOUNDLAB_MAIN_ADAPT_MODE_FILTER,
42 | SOUNDLAB_MAIN_ADAPT_MODE_FIXER,
43 | }SOUNDLAB_MAIN_ADAPT_MODE;
44 |
45 | typedef struct
46 | {
47 | PX_Instance *Ins;
48 | px_int wave_max;
49 | px_int wave_min;
50 | px_dword offset;
51 | px_double PowerThreshold;
52 | px_int TimeDomainDurationCount;
53 | px_double rotAnimationAngle;
54 | PX_Tuning DebugTuning;
55 | px_texture tex_play,tex_pause,tex_file,tex_reset,tex_record,tex_recording,tex_recordfinish,tex_ann,tex_sampling,tex_save;
56 | px_texture tex_Spectrum_renderTarget;
57 | px_texture tex_Spectrum;
58 |
59 | PX_Object *root;
60 | PX_Object *btn_OpenFile,*btn_Play,*btn_Record,*btn_Pause,*btn_reset,*btn_stft,*btn_spectrum,*btn_cepstrum,*btn_adapt,*btn_ann,*btn_save;
61 | PX_Object *btn_AdaptApply,*btn_FilterMode,*btn_FixerMode,*btn_ShiftMode,*btn_ResetAdapt,*btn_RecordFinish;
62 | PX_Object *btn_AnnReset;
63 | PX_Object *SliderBar_PitchShift,*SliderBar_TimeScale;
64 | PX_Object *SpectrumCursor;
65 | PX_Object *Map_TimeDomain;
66 | PX_Object *Map_PreviewTimeDomain;
67 | PX_Object *Map_Spectrum;
68 | PX_Object *Map_Cepstrum;
69 | PX_Object *Map_Adapt;
70 | PX_Object *Map_Ann;
71 | PX_Object *FilterEditor,*FixEditor;
72 |
73 | px_byte *sourcePCM;
74 | px_int sourcePCMSize;
75 |
76 | SOUNDLAB_MAIN_ADAPT_MODE AdaptMode;
77 |
78 | px_double SpectrumX[SOUNDLAB_WINDOW_WIDTH];
79 | px_double SpectrumY[SOUNDLAB_WINDOW_WIDTH];
80 |
81 | px_double PreviewSpectrumX[SOUNDLAB_WINDOW_WIDTH];
82 | px_double PreviewSpectrumY[SOUNDLAB_WINDOW_WIDTH];
83 |
84 | px_double CepstrumX[SOUNDLAB_WINDOW_WIDTH];
85 | px_double CepstrumY[SOUNDLAB_WINDOW_WIDTH];
86 |
87 | px_double SnapshotSampleData[SOUNDLAB_WINDOW_WIDTH*8];
88 |
89 |
90 | px_double ann_time[100];
91 | px_int currentAnnOffset;
92 | volatile px_int AnnEpoch;
93 | volatile px_int AnnSucceeded;
94 | px_bool EnterTestMode;
95 | px_int TestIndex;
96 | px_int threshold;
97 | px_double trainloss[100];
98 | px_double testloss[100];
99 |
100 | PX_ANN ann;
101 |
102 | volatile px_double schedule;
103 | volatile px_double process_memories;
104 | px_char lastError[64];
105 | volatile px_bool bDone;
106 | px_double MaxPower;
107 | PX_SoundData SoundData;
108 | PX_FontModule fm;
109 | PX_MessageBox messagebox;
110 | PX_MFCC mfcc;
111 | SOUNDLAB_TRAIN_MFCC_SAMPLE mfccsample[SOUNDLAB_TRAIN_MFCC_ARRAY_COUNT];
112 | px_int mfccsamplecount;
113 | volatile px_double currenttrainloss,currenttestloss;
114 | volatile px_bool bTrain,bTest;
115 | volatile px_bool bTrainRun;
116 |
117 | px_char recordCache[1024*1024*16];//32M for record
118 | px_int recorderWCursorByte;
119 |
120 | px_char MessageText[128];
121 | px_char FilePath[MAX_PATH];
122 | px_byte RecorderCache[SOUNDLAB_SOUNDCAPTURE_BLOCKSIZE*SOUNDLAB_SOUNDCAPTURE_BLOCKCOUNT*2];//16 blocks
123 | PX_SoundData recorderSoundData;
124 | px_double TimeDomainDataVertical[SOUNDLAB_DEFAULT_TIMEDOMAIN_SIZE],TimeDomainDataHorizontal[SOUNDLAB_DEFAULT_TIMEDOMAIN_SIZE];
125 | px_double PreviewTimeDomainDataVertical[SOUNDLAB_WINDOW_WIDTH],PreviewTimeDomainDataHorizontal[SOUNDLAB_WINDOW_WIDTH];
126 | SOUNDLAB_MAIN_STATUS status;
127 | SOUNDLAB_MAIN_DISPLAY displayMode;
128 | }SoundLab_Main;
129 |
130 |
131 | px_bool SoundLab_Main_Initialize(PX_Instance *Ins,SoundLab_Main *pMain);
132 | px_void SoundLab_Main_Update(SoundLab_Main *pMain,px_dword elpased);
133 | px_void SoundLab_Main_Render(px_surface *psurface,SoundLab_Main *pMain,px_dword elpased);
134 | px_void SoundLab_Main_PostEvent(SoundLab_Main *pMain,PX_Object_Event e);
135 |
136 | typedef struct
137 | {
138 | px_int xOffset,yOffset;
139 | px_bool bshow;
140 | SoundLab_Main *pMain;
141 | }SoundLab_SpectrumCursor;
142 | PX_Object * SoundLab_SpectrumCursorCreate(px_memorypool *mp,PX_Object *Parent,SoundLab_Main *pMain);
143 | #endif
--------------------------------------------------------------------------------
/PainterEngine_SoundLab/PainterEngine_SoundLab/SoundLab_Startup.c:
--------------------------------------------------------------------------------
1 | #include "SoundLab_Startup.h"
2 |
3 | px_bool SoundLab_Startup_Initialize(PX_Instance *pIns,SoundLab_Startup *startup)
4 | {
5 | startup->elpased=0;
6 | startup->instance=pIns;
7 | startup->bend=PX_FALSE;
8 | if(!PX_LoadTextureFromFile(&pIns->runtime.mp_resources,&startup->logo,SOUNDLAB_PATH_LOGO))return PX_FALSE;
9 | return PX_TRUE;
10 | }
11 |
12 | px_void SoundLab_Startup_Update(SoundLab_Startup *startup,px_dword elpased)
13 | {
14 | startup->elpased+=elpased;
15 | if (startup->elpased>6000)
16 | {
17 | //switch
18 | startup->bend=PX_TRUE;
19 | startup->elpased=0;
20 | }
21 | }
22 |
23 | px_void SoundLab_Startup_Render(SoundLab_Startup *startup,px_dword elpased)
24 | {
25 | PX_TEXTURERENDER_BLEND blend;
26 | px_int Threshold;
27 | px_texture *prenderTarget=&startup->instance->runtime.RenderSurface;
28 |
29 | Threshold=startup->elpased%2000;
30 | if(Threshold>1000) Threshold=2000-Threshold;
31 |
32 | blend.alpha=1.0f;
33 | blend.hdr_R=0.75f+(Threshold)/4000.0f;
34 | blend.hdr_G=0.75f+(Threshold)/4000.0f;
35 | blend.hdr_B=0.75f+(Threshold)/4000.0f;
36 |
37 | PX_TextureRender(prenderTarget,&startup->logo,prenderTarget->width/2,prenderTarget->height/2,PX_TEXTURERENDER_REFPOINT_CENTER,&blend);
38 | PX_FontDrawText(prenderTarget,startup->instance->runtime.width-10,startup->instance->runtime.height-24,"Code By DBinary all rights reserved.(matrixcascade@gmail.com)",PX_COLOR(255,128,255,64),PX_FONT_ALIGN_XRIGHT);
39 | }
40 |
41 | px_void SoundLab_Startup_PostEvent(SoundLab_Startup *startup,PX_Object_Event e)
42 | {
43 | if (e.Event==PX_OBJECT_EVENT_CURSORCLICK)
44 | {
45 | startup->bend=PX_TRUE;
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/PainterEngine_SoundLab/PainterEngine_SoundLab/SoundLab_Startup.h:
--------------------------------------------------------------------------------
1 | #ifndef SOUNDLAB_STARTUP_H
2 | #define SOUNDLAB_STARTUP_H
3 |
4 | #include "PainterEngine_Startup.h"
5 |
6 | typedef struct
7 | {
8 | PX_Instance *instance;
9 | px_texture logo;
10 | px_dword elpased;
11 | px_bool bend;
12 | }SoundLab_Startup;
13 |
14 |
15 | px_bool SoundLab_Startup_Initialize(PX_Instance *pIns,SoundLab_Startup *startup);
16 | px_void SoundLab_Startup_Update(SoundLab_Startup *startup,px_dword elpased);
17 | px_void SoundLab_Startup_Render(SoundLab_Startup *startup,px_dword elpased);
18 | px_void SoundLab_Startup_PostEvent(SoundLab_Startup *startup,PX_Object_Event e);
19 |
20 | #endif
--------------------------------------------------------------------------------
/PainterEngine_SoundLab/PainterEngine_SoundLab/SoundLab_Text.h:
--------------------------------------------------------------------------------
1 | #ifndef SOUNDLAB_TEXT_H
2 | #define SOUNDLAB_TEXT_H
3 |
4 | #define SOUNDLAB_PATH_LOGO "./Resources/logo.traw"
5 | #define SOUNDLAB_PATH_PLAY "./Resources/play.traw"
6 | #define SOUNDLAB_PATH_STOP "./Resources/stop.traw"
7 | #define SOUNDLAB_PATH_FILE "./Resources/file.traw"
8 | #define SOUNDLAB_PATH_RECORD "./Resources/recorder.traw"
9 | #define SOUNDLAB_PATH_RECORDING "./Resources/recording.traw"
10 | #define SOUNDLAB_PATH_RECORDFINISH "./Resources/recordfinish.traw"
11 | #define SOUNDLAB_PATH_ANN "./Resources/ann.traw"
12 | #define SOUNDLAB_PATH_RESET "./Resources/reset.traw"
13 | #define SOUNDLAB_PATH_SAMPLING "./Resources/sampling.traw"
14 | #define SOUNDLAB_PATH_SAVE "./Resources/save.traw"
15 | #define SOUNDLAB_PATH_EN32 "./Resources/en32.pxf"
16 | #define SOUNDLAB_KEY_LOGO "logo"
17 | #endif
18 |
--------------------------------------------------------------------------------
/PainterEngine_SoundLab/PainterEngine_SoundLab/__main.c:
--------------------------------------------------------------------------------
1 | #include "PainterEngine_Application.h"
2 |
3 | //mouse informations
4 | POINT main_zoomPoint;
5 | px_int main_ZoomRegion;
6 | //////////////////////////////////////////////////////////////////////////
7 | DWORD WINAPI DEMO_RenderThreadFunc(LPVOID p)
8 | {
9 | DWORD time,elpased;
10 | PX_Object_Event e;
11 | WM_MESSAGE msg;
12 | static POINT LastDownPoint;
13 | LastDownPoint.x=-1;
14 | LastDownPoint.y=-1;
15 | /* px_char *keyBoardString;*/
16 | //////////////////////////////////////////////////////////////////////////
17 | //CreateWindow
18 |
19 | time=timeGetTime();
20 |
21 | while(1)
22 | {
23 |
24 | PX_SystemReadDeviceState();
25 |
26 | elpased=timeGetTime()-time;
27 | time=timeGetTime();
28 |
29 |
30 | while (PX_GetWinMessage(&msg))
31 | {
32 | px_char text[2]={0};
33 | e.Event=PX_OBJECT_EVENT_ANY;
34 | switch(msg.uMsg)
35 | {
36 | case WM_MOUSEMOVE:
37 | {
38 | if (msg.wparam&MK_LBUTTON)
39 | {
40 | e.Event=PX_OBJECT_EVENT_CURSORDRAG;
41 | }
42 | else
43 | {
44 | e.Event=PX_OBJECT_EVENT_CURSORMOVE;
45 | }
46 |
47 | e.Param_uint[0]=((msg.lparam)&0xffff);
48 | e.Param_uint[1]=((msg.lparam>>16)&0xffff);
49 | }
50 | break;
51 | case WM_LBUTTONDOWN:
52 | {
53 | e.Event=PX_OBJECT_EVENT_CURSORDOWN;
54 | e.Param_uint[0]=((msg.lparam)&0xffff);
55 | e.Param_uint[1]=((msg.lparam>>16)&0xffff);
56 | LastDownPoint.x=((msg.lparam)&0xffff);
57 | LastDownPoint.y=((msg.lparam>>16)&0xffff);
58 | }
59 | break;
60 | case WM_LBUTTONUP:
61 | {
62 | if (((msg.lparam)&0xffff)==LastDownPoint.x&&((msg.lparam>>16)&0xffff)==LastDownPoint.y)
63 | {
64 | e.Event=PX_OBJECT_EVENT_CURSORCLICK;
65 | e.Param_uint[0]=((msg.lparam)&0xffff);
66 | e.Param_uint[1]=((msg.lparam>>16)&0xffff);
67 | LastDownPoint.x=-1;
68 | LastDownPoint.y=-1;
69 | PX_ApplicationPostEvent(&App,e);
70 | PX_ConsolePostEvent(&App.Instance.console,e);
71 | }
72 | e.Event=PX_OBJECT_EVENT_CURSORUP;
73 | e.Param_uint[0]=((msg.lparam)&0xffff);
74 | e.Param_uint[1]=((msg.lparam>>16)&0xffff);
75 |
76 | }
77 | break;
78 | case WM_KEYDOWN:
79 | {
80 | e.Event=PX_OBJECT_EVENT_KEYDOWN;
81 | e.Param_uint[0]=msg.wparam;
82 | }
83 | break;
84 | case WM_MOUSEWHEEL:
85 | {
86 | RECT rect;
87 | GetWindowRect(PX_GetWindowHwnd(),&rect);
88 | e.Event=PX_OBJECT_EVENT_CURSORWHEEL;
89 | e.Param_int[0]=((msg.lparam)&0xffff)-rect.left;
90 | e.Param_int[1]=((msg.lparam>>16)&0xffff)-rect.top;
91 | e.Param_int[2]=(short)((msg.wparam>>16)&0xffff);
92 |
93 | }
94 | break;
95 | case WM_CHAR:
96 | {
97 |
98 | text[0]=(px_char)msg.wparam;
99 | e.Event=PX_OBJECT_EVENT_STRING;
100 | e.Param_ptr[0]=text;
101 | }
102 | break;
103 | case WM_GESTURE:
104 | {
105 | GESTUREINFO gi;
106 | BOOL bHandled;
107 | BOOL bResult;
108 | ZeroMemory(&gi, sizeof(GESTUREINFO));
109 |
110 | gi.cbSize = sizeof(GESTUREINFO);
111 |
112 | bResult = GetGestureInfo((HGESTUREINFO)msg.lparam, &gi);
113 | bHandled = FALSE;
114 |
115 | if (bResult){
116 | // now interpret the gesture
117 | switch (gi.dwID){
118 | case GID_ZOOM:
119 | // Code for zooming goes here
120 |
121 | if (25>(main_zoomPoint.x-gi.ptsLocation.x)*(main_zoomPoint.x-gi.ptsLocation.x)+(main_zoomPoint.y-gi.ptsLocation.y)*(main_zoomPoint.y-gi.ptsLocation.y))
122 | {
123 | e.Event=PX_OBJECT_EVENT_SCALE;
124 | e.Param_int[0]=gi.ptsLocation.x;
125 | e.Param_int[1]=gi.ptsLocation.y;
126 | e.Param_int[2]=(px_int)gi.ullArguments-main_ZoomRegion;
127 | }
128 |
129 | main_zoomPoint.x=gi.ptsLocation.x;
130 | main_zoomPoint.y=gi.ptsLocation.y;
131 | main_ZoomRegion=(px_int)gi.ullArguments;
132 |
133 | bHandled = TRUE;
134 | break;
135 | case GID_PAN:
136 | // Code for panning goes here
137 | bHandled = TRUE;
138 | break;
139 | case GID_ROTATE:
140 | // Code for rotation goes here
141 | bHandled = TRUE;
142 | break;
143 | case GID_TWOFINGERTAP:
144 | // Code for two-finger tap goes here
145 | bHandled = TRUE;
146 | break;
147 | case GID_PRESSANDTAP:
148 | // Code for roll over goes here
149 | bHandled = TRUE;
150 | break;
151 | default:
152 | // A gesture was not recognized
153 | break;
154 | }
155 | CloseGestureInfoHandle((HGESTUREINFO)msg.lparam);
156 | }else{
157 | DWORD dwErr = GetLastError();
158 | if (dwErr > 0){
159 | //MessageBoxW(hWnd, L"Error!", L"Could not retrieve a GESTUREINFO structure.", MB_OK);
160 | }
161 | }
162 | }
163 | break;
164 | default:
165 | continue;
166 | }
167 |
168 | if(e.Event!=PX_OBJECT_EVENT_ANY)
169 | {
170 | PX_ApplicationPostEvent(&App,e);
171 | PX_ConsolePostEvent(&App.Instance.console,e);
172 | }
173 |
174 | }
175 | PX_ApplicationUpdate(&App,elpased);
176 | PX_ApplicationRender(&App,elpased);
177 | PX_SystemRender(App.Instance.runtime.RenderSurface.surfaceBuffer,PX_WINDOW_WIDTH,PX_WINDOW_HEIGHT);
178 | Sleep(0);
179 | }
180 | return 0;
181 | }
182 | //int main()
183 | int WINAPI WinMain( __in HINSTANCE hInstance, __in_opt HINSTANCE hPrevInstance, __in LPSTR lpCmdLine, __in int nShowCmd )
184 | {
185 | HANDLE hThread;
186 | DWORD threadId;
187 | PX_srand(314159);
188 | if(!PX_InstanceInitialize(&App.Instance,PX_WINDOW_NAME,PX_WINDOW_WIDTH,PX_WINDOW_HEIGHT,PX_MEMORY_UI_SIZE,PX_MEMORY_RESOURCES_SIZE,PX_MEMORY_GAME_SIZE)) return 0;
189 | if(!PX_ApplicationInitialize(&App))return 0;
190 | //////////////////////////////////////////////////////////////////////////
191 | //CreateThread
192 |
193 | hThread = CreateThread(NULL, 0, DEMO_RenderThreadFunc, 0, 0, &threadId);
194 | PX_AudioInitialize(PX_GetWindowHwnd(),&App.Instance.soundplay,PX_TRUE);
195 | while(PX_SystemLoop()){};
196 |
197 | return 0;
198 | }
199 |
200 |
201 |
--------------------------------------------------------------------------------
/PainterEngine_SoundLab/PainterEngine_SoundLab/resource.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/matrixcascade/SoundLab/7685ecf7cf9b3966be156bf3689b9628457baf04/PainterEngine_SoundLab/PainterEngine_SoundLab/resource.h
--------------------------------------------------------------------------------
/PainterEngine_SoundLab/soundlab.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/matrixcascade/SoundLab/7685ecf7cf9b3966be156bf3689b9628457baf04/PainterEngine_SoundLab/soundlab.png
--------------------------------------------------------------------------------
/PainterEngine_SoundLab/soundlab.psd:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/matrixcascade/SoundLab/7685ecf7cf9b3966be156bf3689b9628457baf04/PainterEngine_SoundLab/soundlab.psd
--------------------------------------------------------------------------------