Skip to content

Commit

Permalink
Merge pull request #32 from AlwinEsch/Nexus-change
Browse files Browse the repository at this point in the history
[Nexus] API related update
  • Loading branch information
AlwinEsch authored Jan 1, 2022
2 parents 9b0e99e + e38abaf commit f61ca8a
Show file tree
Hide file tree
Showing 6 changed files with 71 additions and 63 deletions.
44 changes: 22 additions & 22 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,27 +149,27 @@ CVisualizationMatrix::CVisualizationMatrix()
m_magnitudeBuffer(new float[NUM_BANDS]()),
m_pcm(new float[AUDIO_BUFFER]())
{
m_currentPreset = kodi::GetSettingInt("lastpresetidx");
m_dotMode = static_cast<float>(kodi::GetSettingBoolean("dotmode"));
m_currentPreset = kodi::addon::GetSettingInt("lastpresetidx");
m_dotMode = static_cast<float>(kodi::addon::GetSettingBoolean("dotmode"));
if (m_dotMode)
{
m_dotSize = static_cast<float>(kodi::GetSettingInt("dotsize"));
m_dotSize = static_cast<float>(kodi::addon::GetSettingInt("dotsize"));
}
else
{
if (Height() <= 900) m_dotSize = 3.;
else if (Height() <= 1500) m_dotSize = 4.;
else m_dotSize = 5.;
}
m_fallSpeed = static_cast<float>(kodi::GetSettingInt("fallspeed")) * .01;
m_distortThreshold = static_cast<float>(kodi::GetSettingInt("distortthreshold")) * .005;
m_rainHighlights = static_cast<float>(kodi::GetSettingInt("rainhighlights")) * .016;
m_dotColor.red = static_cast<float>(kodi::GetSettingInt("red")) / 255.f;
m_dotColor.green = static_cast<float>(kodi::GetSettingInt("green")) / 255.f;
m_dotColor.blue = static_cast<float>(kodi::GetSettingInt("blue")) / 255.f;
m_lowpower = kodi::GetSettingBoolean("lowpower");
m_noiseFluctuation = m_lowpower ? (static_cast<float>(kodi::GetSettingInt("noisefluctuation")) * 0.0002f)/m_fallSpeed * 0.25f : (static_cast<float>(kodi::GetSettingInt("noisefluctuation")) * 0.0004f)/m_fallSpeed * 0.25f;
m_crtCurve = kodi::GetSettingBoolean("crtcurve");
m_fallSpeed = static_cast<float>(kodi::addon::GetSettingInt("fallspeed")) * .01;
m_distortThreshold = static_cast<float>(kodi::addon::GetSettingInt("distortthreshold")) * .005;
m_rainHighlights = static_cast<float>(kodi::addon::GetSettingInt("rainhighlights")) * .016;
m_dotColor.red = static_cast<float>(kodi::addon::GetSettingInt("red")) / 255.f;
m_dotColor.green = static_cast<float>(kodi::addon::GetSettingInt("green")) / 255.f;
m_dotColor.blue = static_cast<float>(kodi::addon::GetSettingInt("blue")) / 255.f;
m_lowpower = kodi::addon::GetSettingBoolean("lowpower");
m_noiseFluctuation = m_lowpower ? (static_cast<float>(kodi::addon::GetSettingInt("noisefluctuation")) * 0.0002f)/m_fallSpeed * 0.25f : (static_cast<float>(kodi::addon::GetSettingInt("noisefluctuation")) * 0.0004f)/m_fallSpeed * 0.25f;
m_crtCurve = kodi::addon::GetSettingBoolean("crtcurve");
m_lastAlbumChange = 0.0;
}

Expand Down Expand Up @@ -273,7 +273,7 @@ bool CVisualizationMatrix::NextPreset()
m_currentPreset = (m_currentPreset + 1) % g_presets.size();
Launch(m_currentPreset);
UpdateAlbumart();
kodi::SetSettingInt("lastpresetidx", m_currentPreset);
kodi::addon::SetSettingInt("lastpresetidx", m_currentPreset);
return true;
}

Expand All @@ -282,7 +282,7 @@ bool CVisualizationMatrix::PrevPreset()
m_currentPreset = (m_currentPreset - 1) % g_presets.size();
Launch(m_currentPreset);
UpdateAlbumart();
kodi::SetSettingInt("lastpresetidx", m_currentPreset);
kodi::addon::SetSettingInt("lastpresetidx", m_currentPreset);
return true;
}

Expand All @@ -292,7 +292,7 @@ bool CVisualizationMatrix::LoadPreset(int select)
m_currentPreset = select % g_presets.size();
Launch(m_currentPreset);
UpdateAlbumart();
kodi::SetSettingInt("lastpresetidx", m_currentPreset);
kodi::addon::SetSettingInt("lastpresetidx", m_currentPreset);
return true;
}

Expand All @@ -301,7 +301,7 @@ bool CVisualizationMatrix::RandomPreset()
m_currentPreset = (int)((std::rand() / (float)RAND_MAX) * g_presets.size());
Launch(m_currentPreset);
UpdateAlbumart();
kodi::SetSettingInt("lastpresetidx", m_currentPreset);
kodi::addon::SetSettingInt("lastpresetidx", m_currentPreset);
return true;
}

Expand All @@ -313,7 +313,7 @@ bool CVisualizationMatrix::GetPresets(std::vector<std::string>& presets)
std::string name;
for (auto preset : g_presets)
{
name = kodi::GetLocalizedString(preset.labelId, preset.name);
name = kodi::addon::GetLocalizedString(preset.labelId, preset.name);
presets.push_back(name);
}
return true;
Expand Down Expand Up @@ -357,7 +357,7 @@ bool CVisualizationMatrix::UpdateAlbumart(std::string albumart)
return true;
}

m_channelTextures[3] = CreateTexture(kodi::GetAddonPath("resources/textures/logo.png"), GL_RGBA, GL_LINEAR, GL_CLAMP_TO_EDGE);
m_channelTextures[3] = CreateTexture(kodi::addon::GetAddonPath("resources/textures/logo.png"), GL_RGBA, GL_LINEAR, GL_CLAMP_TO_EDGE);

return false;
}
Expand Down Expand Up @@ -498,12 +498,12 @@ void CVisualizationMatrix::Launch(int preset)

UnloadTextures();

m_usedShaderFile = kodi::GetAddonPath("resources/shaders/" + g_presets[preset].file);
m_usedShaderFile = kodi::addon::GetAddonPath("resources/shaders/" + g_presets[preset].file);
for (int i = 0; i < 4; i++)
{
if (g_presets[preset].channel[i] >= 0 && g_presets[preset].channel[i] < static_cast< int > (g_fileTextures.size()))
{
m_shaderTextures[i].texture = kodi::GetAddonPath("resources/textures/" + g_fileTextures[g_presets[preset].channel[i]]);
m_shaderTextures[i].texture = kodi::addon::GetAddonPath("resources/textures/" + g_fileTextures[g_presets[preset].channel[i]]);
}
else if (g_presets[preset].channel[i] == 99) // framebuffer
{
Expand Down Expand Up @@ -554,7 +554,7 @@ void CVisualizationMatrix::LoadPreset(const std::string& shaderPath)
{
UnloadPreset();
GatherDefines();
std::string vertMatrixShader = kodi::GetAddonPath("resources/shaders/main_matrix_" GL_TYPE_STRING ".vert.glsl");
std::string vertMatrixShader = kodi::addon::GetAddonPath("resources/shaders/main_matrix_" GL_TYPE_STRING ".vert.glsl");
if (!m_matrixShader.LoadShaderFiles(vertMatrixShader, shaderPath) ||
!m_matrixShader.CompileAndLink("", "", m_defines, ""))
{
Expand Down Expand Up @@ -694,7 +694,7 @@ float CVisualizationMatrix::LinearToDecibels(float linear)
int CVisualizationMatrix::DetermineBitsPrecision()
{
m_state.fbwidth = 32, m_state.fbheight = 26*10;
LoadPreset(kodi::GetAddonPath("resources/shaders/main_test.frag.glsl"));
LoadPreset(kodi::addon::GetAddonPath("resources/shaders/main_test.frag.glsl"));
RenderTo(m_matrixShader.ProgramHandle(), m_state.effect_fb);
glFinish();

Expand Down
2 changes: 1 addition & 1 deletion src/main.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

#include "kissfft/kiss_fft.h"

class ATTRIBUTE_HIDDEN CVisualizationMatrix
class ATTR_DLL_LOCAL CVisualizationMatrix
: public kodi::addon::CAddonBase
, public kodi::addon::CInstanceVisualization
{
Expand Down
6 changes: 5 additions & 1 deletion visualization.matrix/addon.xml.in
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<addon
id="visualization.matrix"
version="20.0.0"
version="20.1.0"
name="Matrix"
provider-name="Sarbes">
<requires>@ADDON_DEPENDS@</requires>
Expand All @@ -19,8 +19,12 @@
<summary lang="da_DK">Matrix-inspireret visualisering til Kodi.</summary>
<summary lang="de_DE">Von &quot;Matrix&quot; inspirierte Musikvisualierung für Kodi.</summary>
<summary lang="en_GB">Matrix inspired visualization for Kodi.</summary>
<summary lang="es_MX">Visualización inspirada en Matrix para Kodi.</summary>
<summary lang="zh_CN">受矩阵启发的KODI可视化。</summary>
<description lang="da_DK">Denne musikvisualisering er inspireret af filmen &quot;Matrix&quot;. Den har otte forudindstillinger.</description>
<description lang="de_DE">Diese Musikvisualisierung wurde durch den Film &quot;Matrix&quot; inspiriert. Sie bietet acht verschiedene Presets.</description>
<description lang="en_GB">This music visualization is inspired by the movie &quot;Matrix&quot;. It features eight presets.</description>
<description lang="es_MX">Esta visualización musical está inspirada en la película &quot;Matrix&quot;. Contiene 8 preajustes.</description>
<description lang="zh_CN">这次音乐可视化的灵感来自电影《黑客帝国》。它有八个预置。</description>
</extension>
</addon>
4 changes: 4 additions & 0 deletions visualization.matrix/changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
20.1.0
- Translation updates by Weblate
- Kodi main API update to version 2.0.0

20.0.0
- Update dependency kissfft to version 131.1.0 (16. Feb. 2021)
- Update dependency stb_image.h to version 2.27 (11. Jul. 2021)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,25 @@
msgid ""
msgstr ""
"Project-Id-Version: KODI Addons\n"
"Report-Msgid-Bugs-To: https://github.com/xbmc/visualization.matrix/issues\n"
"Report-Msgid-Bugs-To: [email protected]\n"
"POT-Creation-Date: YEAR-MO-DA HO:MI+ZONE\n"
"PO-Revision-Date: 2021-04-03 07:37+0000\n"
"PO-Revision-Date: 2021-12-15 06:13+0000\n"
"Last-Translator: Edson Armando <[email protected]>\n"
"Language-Team: Spanish (Mexico) <https://kodi.weblate.cloud/projects/kodi-add-ons-look-and-feel/visualization-matrix/es_mx/>\n"
"Language: es_mx\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 4.5.3\n"
"X-Generator: Weblate 4.9.1\n"

msgctxt "Addon Summary"
msgid "Matrix inspired visualization for Kodi."
msgstr ""
msgstr "Visualización inspirada en Matrix para Kodi."

msgctxt "Addon Description"
msgid "This music visualization is inspired by the movie \"Matrix\". It features eight presets."
msgstr ""
msgstr "Esta visualización musical está inspirada en la película \"Matrix\". Contiene 8 preajustes."

msgctxt "#30000"
msgid "General"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,138 +5,138 @@
msgid ""
msgstr ""
"Project-Id-Version: KODI Addons\n"
"Report-Msgid-Bugs-To: https://github.com/xbmc/visualization.matrix/issues\n"
"Report-Msgid-Bugs-To: [email protected]\n"
"POT-Creation-Date: YEAR-MO-DA HO:MI+ZONE\n"
"PO-Revision-Date: 2021-09-12 18:51+0000\n"
"Last-Translator: taxigps <taxigps@sina.com>\n"
"PO-Revision-Date: 2021-11-03 07:32+0000\n"
"Last-Translator: 撷星芒 <mofa2020@qq.com>\n"
"Language-Team: Chinese (China) <https://kodi.weblate.cloud/projects/kodi-add-ons-look-and-feel/visualization-matrix/zh_cn/>\n"
"Language: zh_cn\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 4.8\n"
"X-Generator: Weblate 4.8.1\n"

msgctxt "Addon Summary"
msgid "Matrix inspired visualization for Kodi."
msgstr ""
msgstr "受矩阵启发的KODI可视化。"

msgctxt "Addon Description"
msgid "This music visualization is inspired by the movie \"Matrix\". It features eight presets."
msgstr ""
msgstr "这次音乐可视化的灵感来自电影《黑客帝国》。它有八个预置。"

msgctxt "#30000"
msgid "General"
msgstr "常规"

msgctxt "#30001"
msgid "Pixel size"
msgstr ""
msgstr "像素大小"

msgctxt "#30002"
msgid "Size of a \"pixel\" which forms the rain."
msgstr ""
msgstr "形成雨水的“像素”的大小。"

msgctxt "#30003"
msgid "Rain fall speed"
msgstr ""
msgstr "降雨速度"

msgctxt "#30004"
msgid "The speed how fast the rain is falling."
msgstr ""
msgstr "雨下得多快。"

msgctxt "#30005"
msgid "Noise fluctuation"
msgstr ""
msgstr "噪声波动"

msgctxt "#30006"
msgid "The speed how fast the noise is changing."
msgstr ""
msgstr "噪音变化的速度。"

msgctxt "#30007"
msgid "Distort threshold"
msgstr ""
msgstr "扭曲阈值"

msgctxt "#30008"
msgid "Threshold of loudness at which vertical distortion occurs."
msgstr ""
msgstr "发生垂直失真的响度阈值。"

msgctxt "#30009"
msgid "User defined pixel size"
msgstr ""
msgstr "用户定义的像素大小"

msgctxt "#30010"
msgid "Enables the manual setting of the size of the dots."
msgstr ""
msgstr "启用手动设置点的大小。"

msgctxt "#30011"
msgid "Strength of rain highlights"
msgstr ""
msgstr "雨点高光的强度"

msgctxt "#30012"
msgid "Sets the colour intensity of individual raindrops at music peaks."
msgstr ""
msgstr "在音乐峰值上设置各个雨滴的颜色强度。"

msgctxt "#30050"
msgid "Red"
msgstr ""
msgstr ""

msgctxt "#30051"
msgid "Green"
msgstr ""
msgstr "绿"

msgctxt "#30052"
msgid "Blue"
msgstr ""
msgstr ""

msgctxt "#30053"
msgid "The color of the \"pixels\"."
msgstr ""
msgstr "“像素”的颜色。"

msgctxt "#30060"
msgid "Enable performance optimizations"
msgstr ""
msgstr "启用性能优化"

msgctxt "#30061"
msgid "Lowers the quality of some shader calculations in order to boost performance (FPS) on slower systems."
msgstr ""
msgstr "降低了一些着色器计算的质量,以便在较慢的系统上提升性能(FPS)。"

msgctxt "#30062"
msgid "CRT effect"
msgstr ""
msgstr "CRT效果"

msgctxt "#30063"
msgid "Adds a CRT-like distortion effect."
msgstr ""
msgstr "增加了类似CRT的失真效果。"

msgctxt "#30100"
msgid "Kodi"
msgstr ""
msgstr "KODI"

msgctxt "#30101"
msgid "Album"
msgstr ""
msgstr "专辑"

msgctxt "#30102"
msgid "Rain only"
msgstr ""
msgstr "仅下雨"

msgctxt "#30103"
msgid "Rain with waveform"
msgstr ""
msgstr "下雨与波型"

msgctxt "#30104"
msgid "Rain with waveform envelope"
msgstr ""
msgstr "波形包裹下雨"

msgctxt "#30105"
msgid "Clean rain"
msgstr ""
msgstr "简洁下雨"

msgctxt "#30106"
msgid "Clean rain with waveform"
msgstr ""
msgstr "简洁下雨与波型"

msgctxt "#30107"
msgid "Clean rain with waveform envelope"
msgstr ""
msgstr "波形包裹简洁下雨"

0 comments on commit f61ca8a

Please sign in to comment.