teste
This commit is contained in:
1 parent
42da68afa0
commit
12c5b55bce
29 files changed
+162410
-343433
No files matched your search
+275
-77
@@ -112,22 +112,217 @@ title: "{{ page.file }}"
|
||||
|
||||
<div class="content mt-3">
|
||||
<ul style="list-style: none; padding-left: 0">
|
||||
{% for track in page.tracks %} {% assign tem_instr = false %}
|
||||
{% if track.instruments and track.instruments.size > 0 %} {%
|
||||
assign tem_instr = true %} {% endif %} {% if
|
||||
track.bassline_name or tem_instr %}
|
||||
{% for track in page.tracks %} {% if track.instruments and
|
||||
track.instruments.size > 0 %}
|
||||
<li class="mb-5">
|
||||
{% if tem_instr %}
|
||||
<div class="mb-2">
|
||||
<span class="tag is-dark">{{ track.bassline_name }}</span>
|
||||
</div>
|
||||
<ul class="pl-4">
|
||||
{% for instrument in track.instruments %} {% if
|
||||
instrument.instrument_name %} {% assign sample_src =
|
||||
{% for instrument in track.instruments %} {% assign
|
||||
plugin_name = instrument.instrument_name | downcase %} {%
|
||||
assign is_sample = false %} {% assign sample_src = "" %}
|
||||
{% if plugin_name == 'audiofileprocessor' or
|
||||
instrument.audiofileprocessor %} {% assign is_sample =
|
||||
true %} {% assign sample_src =
|
||||
instrument.audiofileprocessor.src | default: "" | strip %}
|
||||
{% assign has_sample = false %} {% if
|
||||
instrument.audiofileprocessor and sample_src != "" %} {%
|
||||
assign has_sample = true %} {% endif %}
|
||||
{% endif %} {% assign should_open = false %} {% if
|
||||
is_sample == false %} {% assign should_open = true %} {%
|
||||
elsif is_sample == true and sample_src != "" %} {% assign
|
||||
should_open = true %} {% endif %}
|
||||
|
||||
<li style="margin-bottom: 0.4rem">
|
||||
<details {% if has_sample %}open{% endif %}>
|
||||
<div
|
||||
class="instrument-wrapper mb-4"
|
||||
data-plugin-name="{{ plugin_name }}"
|
||||
data-params="{{ instrument | jsonify | escape }}"
|
||||
>
|
||||
<li style="list-style: none">
|
||||
<details {% if should_open %}open{% endif %}>
|
||||
<summary
|
||||
style="
|
||||
cursor: pointer;
|
||||
outline: none;
|
||||
margin-bottom: 0.5rem;
|
||||
"
|
||||
>
|
||||
<div
|
||||
style="
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
"
|
||||
>
|
||||
{% assign display_name =
|
||||
instrument.instrument_name %} {% if is_sample %}
|
||||
{% if display_name contains "audiofileprocessor"
|
||||
and instrument.patterns %} {% assign
|
||||
first_pattern_name = instrument.patterns | map:
|
||||
'name' | first %} {% if first_pattern_name and
|
||||
first_pattern_name != empty %} {% assign
|
||||
display_name = first_pattern_name | remove:
|
||||
".ogg" | remove: ".wav" | remove: ".flac" |
|
||||
remove: ".mp3" %} {% elsif
|
||||
instrument.audiofileprocessor.src %} {% assign
|
||||
src_parts = instrument.audiofileprocessor.src |
|
||||
split: '/' %} {% assign file_name = src_parts |
|
||||
last %} {% assign display_name = file_name |
|
||||
remove: ".ogg" | remove: ".wav" | remove:
|
||||
".flac" | remove: ".mp3" %} {% endif %} {% endif
|
||||
%} {% endif %} {% assign instrument_slug =
|
||||
display_name | replace: ' ', '+' %}
|
||||
<a
|
||||
href="{{ '/instruments/?instrument=' | append: instrument_slug | relative_url }}"
|
||||
class="tag is-info is-light"
|
||||
>
|
||||
<code>{{ display_name }}</code>
|
||||
{% unless is_sample %}
|
||||
<span class="ml-1" style="font-size: 0.7em"
|
||||
>(Synth 🎹)</span
|
||||
>{% endunless %}
|
||||
</a>
|
||||
</div>
|
||||
</summary>
|
||||
|
||||
{% for pattern in instrument.patterns %} {% assign
|
||||
pattern_steps = pattern.steps %} {% if pattern_steps
|
||||
and pattern_steps.size > 0 %}
|
||||
<div
|
||||
class="mt-2 ml-4"
|
||||
style="
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
"
|
||||
>
|
||||
{% assign bassline_index = forloop.index | minus:
|
||||
1 %}
|
||||
<span class="is-size-7 has-text-grey-light"
|
||||
>{{ track.bassline_name }}{{ bassline_index
|
||||
}}:</span
|
||||
>
|
||||
<div
|
||||
class="patterns-container"
|
||||
style="
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
flex-wrap: wrap;
|
||||
gap: 4px;
|
||||
"
|
||||
>
|
||||
{% assign total_steps = pattern_steps.size %} {%
|
||||
assign chunk_size = 4 %} {% assign num_chunks =
|
||||
total_steps | divided_by: chunk_size %} {%
|
||||
assign remainder = total_steps | modulo:
|
||||
chunk_size %} {% if remainder > 0 %}{% assign
|
||||
num_chunks = num_chunks | plus: 1 %}{% endif %}
|
||||
{% for i in (0..num_chunks) %} {% assign
|
||||
start_index = i | times: chunk_size %} {% assign
|
||||
current_chunk_array = pattern_steps | slice:
|
||||
start_index, chunk_size %} {% if
|
||||
current_chunk_array.size > 0 %} {% assign
|
||||
chunk_string = "" %} {% for step in
|
||||
current_chunk_array %} {% if step == true or
|
||||
step == 'true' or step == 1 %}{% assign
|
||||
chunk_string = chunk_string | append: '1' %}{%
|
||||
else %}{% assign chunk_string = chunk_string |
|
||||
append: '0' %}{% endif %} {% endfor %} {% assign
|
||||
search_url = '/pattern/?p=' | append:
|
||||
chunk_string | relative_url %}
|
||||
<a
|
||||
href="{{ search_url }}"
|
||||
title="Buscar padrão {{ chunk_string }}"
|
||||
style="display: inline-block"
|
||||
>
|
||||
<div
|
||||
style="
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
border: 1px solid #999;
|
||||
padding: 2px;
|
||||
border-radius: 2px;
|
||||
background-color: #f0f0f0;
|
||||
"
|
||||
>
|
||||
{% for step_active in current_chunk_array %}
|
||||
{% assign step_color = '#d9d9d9' %} {% if
|
||||
step_active == true or step_active == 'true'
|
||||
or step_active == 1 %} {% assign step_color
|
||||
= '#4caf50' %} {% endif %}
|
||||
<div
|
||||
style="width: 5px; height: 10px; background-color: {{ step_color }}; border-radius: 1px; margin-right: 1px;"
|
||||
></div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</a>
|
||||
{% endif %} {% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
{% endif %} {% endfor %}
|
||||
</details>
|
||||
|
||||
<div class="playback-controls mt-2 pl-4">
|
||||
{% if is_sample %} {% if sample_src != "" %} {%
|
||||
assign audio_filename_with_path = 'src/samples/' |
|
||||
append: sample_src %}
|
||||
<audio controls class="js-sample-player">
|
||||
<source
|
||||
src="{{ audio_filename_with_path | relative_url }}"
|
||||
type="audio/ogg"
|
||||
/>
|
||||
{% assign wav_path = audio_filename_with_path |
|
||||
replace: '.ogg', '.wav' %}
|
||||
<source
|
||||
src="{{ wav_path | relative_url }}"
|
||||
type="audio/wav"
|
||||
/>
|
||||
Seu navegador não suporta o elemento
|
||||
<code>audio</code>.
|
||||
</audio>
|
||||
{% else %}
|
||||
<p class="has-text-danger is-size-7">
|
||||
O sample **não foi enviado** 😢
|
||||
</p>
|
||||
{% endif %} {% else %}
|
||||
<button
|
||||
class="button is-small is-primary is-outlined js-play-synth-btn"
|
||||
>
|
||||
<span class="icon is-small"
|
||||
><i class="fa-solid fa-play"></i
|
||||
></span>
|
||||
<span>Testar Plugin</span>
|
||||
</button>
|
||||
<span class="is-size-7 has-text-grey ml-2"
|
||||
>Via Web Audio API</span
|
||||
>
|
||||
{% endif %}
|
||||
</div>
|
||||
</li>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
{% elsif track.instrument_name %} {% assign instrument = track
|
||||
%}
|
||||
<ul class="pl-4">
|
||||
{% assign plugin_name = instrument.instrument_name |
|
||||
downcase %} {% assign is_sample = false %} {% assign
|
||||
sample_src = "" %} {% if plugin_name == 'audiofileprocessor'
|
||||
or instrument.audiofileprocessor %} {% assign is_sample =
|
||||
true %} {% assign sample_src =
|
||||
instrument.audiofileprocessor.src | default: "" | strip %}
|
||||
{% endif %} {% assign should_open = false %} {% if is_sample
|
||||
== false %} {% assign should_open = true %} {% elsif
|
||||
is_sample == true and sample_src != "" %} {% assign
|
||||
should_open = true %} {% endif %}
|
||||
|
||||
<div
|
||||
class="instrument-wrapper mb-4"
|
||||
data-plugin-name="{{ plugin_name }}"
|
||||
data-params="{{ instrument | jsonify | escape }}"
|
||||
>
|
||||
<li style="list-style: none">
|
||||
<details {% if should_open %}open{% endif %}>
|
||||
<summary
|
||||
style="
|
||||
cursor: pointer;
|
||||
@@ -143,46 +338,30 @@ title: "{{ page.file }}"
|
||||
"
|
||||
>
|
||||
{% assign display_name =
|
||||
instrument.instrument_name %} {% if display_name
|
||||
contains "audiofileprocessor" and
|
||||
instrument.patterns %} {% assign
|
||||
first_pattern_name = instrument.patterns | map:
|
||||
'name' | first %} {% if first_pattern_name and
|
||||
first_pattern_name != empty %} {% assign
|
||||
display_name = first_pattern_name | remove: ".ogg"
|
||||
| remove: ".wav" | remove: ".flac" | remove:
|
||||
".mp3" %} {% elsif
|
||||
instrument.audiofileprocessor.src %} {% assign
|
||||
src_parts = instrument.audiofileprocessor.src |
|
||||
split: '/' %} {% assign file_name = src_parts |
|
||||
last %} {% assign display_name = file_name |
|
||||
remove: ".ogg" | remove: ".wav" | remove: ".flac"
|
||||
| remove: ".mp3" %} {% endif %} {% endif %} {%
|
||||
assign instrument_slug = display_name | replace: '
|
||||
', '+' %}
|
||||
instrument.instrument_name %} {% assign
|
||||
instrument_slug = display_name | replace: ' ', '+'
|
||||
%}
|
||||
<a
|
||||
href="{{ '/instruments/?instrument=' | append: instrument_slug | relative_url }}"
|
||||
class="tag is-info is-light"
|
||||
>
|
||||
<code>{{ display_name }}</code>
|
||||
{% unless is_sample %}
|
||||
<span class="ml-1" style="font-size: 0.7em"
|
||||
>(Synth 🎹)</span
|
||||
>{% endunless %}
|
||||
</a>
|
||||
</div>
|
||||
</summary>
|
||||
|
||||
{% for pattern in instrument.patterns %} {% assign
|
||||
pattern_steps = pattern.steps %} {% if pattern_steps
|
||||
and pattern_steps.size > 0 %}
|
||||
{% if instrument.patterns %} {% for pattern in
|
||||
instrument.patterns %} {% assign pattern_steps =
|
||||
pattern.steps %} {% if pattern_steps and
|
||||
pattern_steps.size > 0 %}
|
||||
<div
|
||||
class="mt-2 ml-4"
|
||||
style="display: flex; align-items: center; gap: 4px"
|
||||
>
|
||||
{% assign bassline_index = forloop.index | minus: 1
|
||||
%}
|
||||
|
||||
<span class="is-size-7 has-text-grey-light">
|
||||
{{ track.bassline_name }}{{ bassline_index }}:
|
||||
</span>
|
||||
|
||||
<div
|
||||
class="patterns-container"
|
||||
style="
|
||||
@@ -196,21 +375,20 @@ title: "{{ page.file }}"
|
||||
assign chunk_size = 4 %} {% assign num_chunks =
|
||||
total_steps | divided_by: chunk_size %} {% assign
|
||||
remainder = total_steps | modulo: chunk_size %} {%
|
||||
if remainder > 0 %} {% assign num_chunks =
|
||||
num_chunks | plus: 1 %} {% endif %} {% for i in
|
||||
if remainder > 0 %}{% assign num_chunks =
|
||||
num_chunks | plus: 1 %}{% endif %} {% for i in
|
||||
(0..num_chunks) %} {% assign start_index = i |
|
||||
times: chunk_size %} {% assign current_chunk_array
|
||||
= pattern_steps | slice: start_index, chunk_size
|
||||
%} {% if current_chunk_array.size > 0 %} {% assign
|
||||
chunk_string = "" %} {% for step in
|
||||
current_chunk_array %} {% if step == true or step
|
||||
== 'true' or step == 1 %} {% assign chunk_string =
|
||||
chunk_string | append: '1' %} {% else %} {% assign
|
||||
chunk_string = chunk_string | append: '0' %} {%
|
||||
== 'true' or step == 1 %}{% assign chunk_string =
|
||||
chunk_string | append: '1' %}{% else %}{% assign
|
||||
chunk_string = chunk_string | append: '0' %}{%
|
||||
endif %} {% endfor %} {% assign search_url =
|
||||
'/pattern/?p=' | append: chunk_string |
|
||||
relative_url %}
|
||||
|
||||
<a
|
||||
href="{{ search_url }}"
|
||||
title="Buscar padrão {{ chunk_string }}"
|
||||
@@ -234,32 +412,20 @@ title: "{{ page.file }}"
|
||||
<div
|
||||
style="width: 5px; height: 10px; background-color: {{ step_color }}; border-radius: 1px; margin-right: 1px;"
|
||||
></div>
|
||||
{% endfor %} {% assign remaining_steps =
|
||||
chunk_size | minus: current_chunk_array.size
|
||||
%} {% if remaining_steps > 0 %} {% for j in
|
||||
(1..remaining_steps) %}
|
||||
<div
|
||||
style="
|
||||
width: 5px;
|
||||
height: 10px;
|
||||
background-color: #d9d9d9;
|
||||
border-radius: 1px;
|
||||
margin-right: 1px;
|
||||
"
|
||||
></div>
|
||||
{% endfor %} {% endif %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
</a>
|
||||
{% endif %} {% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
{% endif %} {% endfor %}
|
||||
{% endif %} {% endfor %} {% endif %}
|
||||
</details>
|
||||
|
||||
{% if has_sample %} {% assign audio_filename_with_path =
|
||||
'src/samples/' | append: sample_src %}
|
||||
<div class="audio-player-section mt-3 pl-4">
|
||||
<audio controls>
|
||||
<div class="playback-controls mt-2 pl-4">
|
||||
{% if is_sample %} {% if sample_src != "" %} {% assign
|
||||
audio_filename_with_path = 'src/samples/' | append:
|
||||
sample_src %}
|
||||
<audio controls class="js-sample-player">
|
||||
<source
|
||||
src="{{ audio_filename_with_path | relative_url }}"
|
||||
type="audio/ogg"
|
||||
@@ -270,20 +436,28 @@ title: "{{ page.file }}"
|
||||
src="{{ wav_path | relative_url }}"
|
||||
type="audio/wav"
|
||||
/>
|
||||
Seu navegador não suporta o elemento
|
||||
<code>audio</code>.
|
||||
</audio>
|
||||
{% else %}
|
||||
<p class="has-text-danger is-size-7">
|
||||
O sample **não foi enviado** 😢
|
||||
</p>
|
||||
{% endif %} {% else %}
|
||||
<button
|
||||
class="button is-small is-primary is-outlined js-play-synth-btn"
|
||||
>
|
||||
<span class="icon is-small"
|
||||
><i class="fa-solid fa-play"></i
|
||||
></span>
|
||||
<span>Testar Plugin</span>
|
||||
</button>
|
||||
<span class="is-size-7 has-text-grey ml-2"
|
||||
>Via Web Audio API</span
|
||||
>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% else %}
|
||||
<p class="has-text-danger is-size-7 mt-1 pl-4">
|
||||
O sample **não foi enviado** 😢
|
||||
</p>
|
||||
{% endif %}
|
||||
</li>
|
||||
{% endif %} {% endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
</li>
|
||||
</div>
|
||||
</ul>
|
||||
{% endif %} {% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
@@ -298,8 +472,7 @@ title: "{{ page.file }}"
|
||||
🛠️ Abra na Criação Colaborativa
|
||||
</h3>
|
||||
|
||||
{% comment %} CONSTRUÇÃO DA URL CORRIGIDA PARA AMBIENTES DE TESTE:
|
||||
{% endcomment %} {% assign creation_url =
|
||||
{% assign creation_url =
|
||||
'/~jotachina/mmpSearch/creation.html?project=' | append: page.file
|
||||
%}
|
||||
<span class="icon"
|
||||
@@ -339,3 +512,28 @@ title: "{{ page.file }}"
|
||||
</div>
|
||||
</main>
|
||||
</div>
|
||||
|
||||
<script type="module">
|
||||
import { InstrumentFactory } from '{{ "/assets/js/audio/InstrumentFactory.js" | relative_url }}';
|
||||
|
||||
document.addEventListener("DOMContentLoaded", () => {
|
||||
const factory = new InstrumentFactory();
|
||||
|
||||
const synthButtons = document.querySelectorAll(".js-play-synth-btn");
|
||||
|
||||
synthButtons.forEach((btn) => {
|
||||
btn.addEventListener("click", (e) => {
|
||||
const wrapper = e.target.closest(".instrument-wrapper");
|
||||
if (wrapper && wrapper.dataset.params) {
|
||||
const rawData = wrapper.dataset.params;
|
||||
try {
|
||||
const instrumentData = JSON.parse(rawData);
|
||||
factory.play(instrumentData);
|
||||
} catch (error) {
|
||||
console.error("Erro ao ler dados do instrumento:", error);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
Reference in new issue
Block a user