Skip to content

Commit

Permalink
Merge pull request #41 from AlwinEsch/Nexus-change
Browse files Browse the repository at this point in the history
audiodecoder API Version 4.0.0 update
  • Loading branch information
AlwinEsch authored Nov 6, 2021
2 parents 7db88bc + 5c1a120 commit 5b37bc5
Show file tree
Hide file tree
Showing 9 changed files with 86 additions and 59 deletions.
22 changes: 19 additions & 3 deletions audiodecoder.snesapu/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="audiodecoder.snesapu"
version="20.0.0"
version="20.1.0"
name="SPC Audio Decoder"
provider-name="spiff">
<requires>@ADDON_DEPENDS@
Expand All @@ -10,20 +10,36 @@
<extension
point="kodi.audiodecoder"
name="spc"
extension=".spc|.spcstream|.rsn"
tags="true"
tracks="true"
library_@PLATFORM@="@LIBRARY_FILENAME@"/>
library_@PLATFORM@="@LIBRARY_FILENAME@">
<support>
<extension name=".spc">
<description>30200</description>
</extension>
<extension name=".rsn">
<description>30201</description>
</extension>
</support>
</extension>
<extension point="xbmc.addon.metadata">
<platform>@PLATFORM@</platform>
<license>GPL-2.0-or-later</license>
<source>https://github.com/xbmc/audiodecoder.snesapu</source>
<assets>
<icon>icon.png</icon>
</assets>
<summary lang="da_DK">SNES-SPC700 lydfil dataafkoder</summary>
<summary lang="de_DE">SNES-SPC700 Sound File Data Decoder</summary>
<summary lang="en_GB">SNES-SPC700 Sound File Data Decoder</summary>
<summary lang="ko_KR">SNES-SPC700 사운드 파일 데이터 디코더</summary>
<summary lang="ru_RU">Декодер данных звуковых файлов SNES-SPC700</summary>
<summary lang="zh_CN">SNES-SPC700 声音文件数据解码器</summary>
<description lang="da_DK">SPC-formatet indeholder Super Nintendo (SNES) spilmusik. Det er opkaldt efter Sonys SPC700-bidrag til SNES's S-SMP-lydchip. SNES var et stort spring i lydteknologi fra NES, hvilket muliggjorde stereolyd, flere kanaler og fuldt samplede instrumenter.</description>
<description lang="de_DE">Das SPC-Format enthält Super Nintendo (SNES) Spielmusik. Es ist nach Sonys SPC700-Beitrag zum S-SMP-Audio-Chip des SNES benannt. Das SNES war ein großer Sprung in der Audiotechnologie des NES, der Stereoklang, mehr Kanäle und vollständig gesampelte Instrumente ermöglichte.</description>
<description lang="en_GB">The SPC format holds Super Nintendo (SNES) game music. It is named after Sony's SPC700 contribution to the SNES's S-SMP audio chip. The SNES was a major jump in audio technology from the NES allowing for stereo sound, more channels, and fully sampled instruments.</description>
<description lang="ko_KR">SPC 형식에는 슈퍼 닌텐도(SNES) 게임 음악이 들어 있습니다. SNES의 S-SMP 오디오 칩에 대한 Sony의 SPC700 기여에서 이름 붙여졌습니다. SNES는 스테레오 사운드, 더 많은 채널 및 완전히 샘플링된 악기를 허용하는 NES에서 오디오 기술의 주요한 진보였습니다.</description>
<description lang="ru_RU">В формате SPC хранится музыка из игр Super Nintendo (SNES). Он назван в честь вклада компанией Sony SPC700 в аудиочип S-SMP. SNES была большим скачком в технологии обработки звука по сравнению с NES, позволяя получить стереозвук, больше каналов и полностью сэмплированные инструменты.</description>
<description lang="zh_CN">SPC 格式保存超级任天堂(SNES)游戏音乐。它是以索尼 SPC700 对 SNES s-SMP 音频芯片的贡献命名的。SNES 是从 NES 到立体声、更多声道和全采样乐器的音频技术的重大飞跃。</description>
</extension>
</addon>
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,27 @@
msgid ""
msgstr ""
"Project-Id-Version: KODI Addons\n"
"Report-Msgid-Bugs-To: https://github.com/xbmc/audiodecoder.snesapu/issues/\n"
"Report-Msgid-Bugs-To: [email protected]\n"
"POT-Creation-Date: YEAR-MO-DA HO:MI+ZONE\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: Automatically generated\n"
"Language-Team: none\n"
"PO-Revision-Date: 2021-10-21 12:30+0000\n"
"Last-Translator: Christian Gade <[email protected]>\n"
"Language-Team: Danish <https://kodi.weblate.cloud/projects/kodi-add-ons-audio-decodersencoders/audiodecoder-snesapu/da_dk/>\n"
"Language: da_dk\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"

msgctxt "Addon Summary"
msgid "SNES-SPC700 Sound File Data Decoder"
msgstr ""
msgstr "SNES-SPC700 lydfil dataafkoder"

msgctxt "Addon Description"
msgid "The SPC format holds Super Nintendo (SNES) game music. It is named after Sony's SPC700 contribution to the SNES's S-SMP audio chip. The SNES was a major jump in audio technology from the NES allowing for stereo sound, more channels, and fully sampled instruments."
msgstr ""
msgstr "SPC-formatet indeholder Super Nintendo (SNES) spilmusik. Det er opkaldt efter Sonys SPC700-bidrag til SNES's S-SMP-lydchip. SNES var et stort spring i lydteknologi fra NES, hvilket muliggjorde stereolyd, flere kanaler og fuldt samplede instrumenter."

#. Genre type of played game sound file
msgctxt "#30100"
msgid "Voice/Speech"
msgstr ""
msgstr "Stemme/tale"
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,17 @@
msgid ""
msgstr ""
"Project-Id-Version: KODI Addons\n"
"Report-Msgid-Bugs-To: https://github.com/xbmc/audiodecoder.snesapu/issues/\n"
"Report-Msgid-Bugs-To: [email protected]\n"
"POT-Creation-Date: YEAR-MO-DA HO:MI+ZONE\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: Kodi Translation Team\n"
"Language-Team: German (Germany) (http://www.transifex.com/projects/p/kodi-addons/language/de_DE/)\n"
"Language: de_DE\n"
"PO-Revision-Date: 2021-10-03 11:47+0000\n"
"Last-Translator: Kai Sommerfeld <[email protected]>\n"
"Language-Team: German <https://kodi.weblate.cloud/projects/kodi-add-ons-audio-decodersencoders/audiodecoder-snesapu/de_de/>\n"
"Language: de_de\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"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 4.8\n"

msgctxt "Addon Summary"
msgid "SNES-SPC700 Sound File Data Decoder"
Expand All @@ -27,4 +28,4 @@ msgstr "Das SPC-Format enthält Super Nintendo (SNES) Spielmusik. Es ist nach So
#. Genre type of played game sound file
msgctxt "#30100"
msgid "Voice/Speech"
msgstr ""
msgstr "Stimme/Sprache"
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,15 @@ msgstr ""
msgctxt "#30100"
msgid "Voice/Speech"
msgstr ""

#. Supported file extension description about ".spc"
#: audiodecoder.snesapu/addon.xml.in
msgctxt "#30200"
msgid "Nintendo SNES audio data, developed by Nintendo and released in 1990."
msgstr ""

#. Supported file extension description about ".rsn"
#: audiodecoder.snesapu/addon.xml.in
msgctxt "#30201"
msgid "A .RAR package renamed to .RSN, which is used to save .SPC files."
msgstr ""
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,27 @@
msgid ""
msgstr ""
"Project-Id-Version: KODI Addons\n"
"Report-Msgid-Bugs-To: https://github.com/xbmc/audiodecoder.snesapu/issues/\n"
"Report-Msgid-Bugs-To: [email protected]\n"
"POT-Creation-Date: YEAR-MO-DA HO:MI+ZONE\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: Automatically generated\n"
"Language-Team: none\n"
"PO-Revision-Date: 2021-10-03 11:47+0000\n"
"Last-Translator: Minho Park <[email protected]>\n"
"Language-Team: Korean <https://kodi.weblate.cloud/projects/kodi-add-ons-audio-decodersencoders/audiodecoder-snesapu/ko_kr/>\n"
"Language: ko_kr\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=1; plural=0;\n"
"X-Generator: Weblate 4.8\n"

msgctxt "Addon Summary"
msgid "SNES-SPC700 Sound File Data Decoder"
msgstr ""
msgstr "SNES-SPC700 사운드 파일 데이터 디코더"

msgctxt "Addon Description"
msgid "The SPC format holds Super Nintendo (SNES) game music. It is named after Sony's SPC700 contribution to the SNES's S-SMP audio chip. The SNES was a major jump in audio technology from the NES allowing for stereo sound, more channels, and fully sampled instruments."
msgstr ""
msgstr "SPC 형식에는 슈퍼 닌텐도(SNES) 게임 음악이 들어 있습니다. SNES의 S-SMP 오디오 칩에 대한 Sony의 SPC700 기여에서 이름 붙여졌습니다. SNES는 스테레오 사운드, 더 많은 채널 및 완전히 샘플링된 악기를 허용하는 NES에서 오디오 기술의 주요한 진보였습니다."

#. Genre type of played game sound file
msgctxt "#30100"
msgid "Voice/Speech"
msgstr ""
msgstr "음성/말하기"
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,27 @@
msgid ""
msgstr ""
"Project-Id-Version: KODI Addons\n"
"Report-Msgid-Bugs-To: https://github.com/xbmc/audiodecoder.snesapu/issues/\n"
"Report-Msgid-Bugs-To: [email protected]\n"
"POT-Creation-Date: YEAR-MO-DA HO:MI+ZONE\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: Automatically generated\n"
"Language-Team: none\n"
"PO-Revision-Date: 2021-10-03 11:47+0000\n"
"Last-Translator: vdkbsd <[email protected]>\n"
"Language-Team: Russian <https://kodi.weblate.cloud/projects/kodi-add-ons-audio-decodersencoders/audiodecoder-snesapu/ru_ru/>\n"
"Language: ru_ru\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n"
"X-Generator: Weblate 4.8\n"

msgctxt "Addon Summary"
msgid "SNES-SPC700 Sound File Data Decoder"
msgstr ""
msgstr "Декодер данных звуковых файлов SNES-SPC700"

msgctxt "Addon Description"
msgid "The SPC format holds Super Nintendo (SNES) game music. It is named after Sony's SPC700 contribution to the SNES's S-SMP audio chip. The SNES was a major jump in audio technology from the NES allowing for stereo sound, more channels, and fully sampled instruments."
msgstr ""
msgstr "В формате SPC хранится музыка из игр Super Nintendo (SNES). Он назван в честь вклада компанией Sony SPC700 в аудиочип S-SMP. SNES была большим скачком в технологии обработки звука по сравнению с NES, позволяя получить стереозвук, больше каналов и полностью сэмплированные инструменты."

#. Genre type of played game sound file
msgctxt "#30100"
msgid "Voice/Speech"
msgstr ""
msgstr "Голос/Речь"
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,27 @@
msgid ""
msgstr ""
"Project-Id-Version: KODI Addons\n"
"Report-Msgid-Bugs-To: https://github.com/xbmc/audiodecoder.snesapu/issues/\n"
"Report-Msgid-Bugs-To: [email protected]\n"
"POT-Creation-Date: YEAR-MO-DA HO:MI+ZONE\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: Automatically generated\n"
"Language-Team: none\n"
"PO-Revision-Date: 2021-10-03 11:47+0000\n"
"Last-Translator: taxigps <[email protected]>\n"
"Language-Team: Chinese (China) <https://kodi.weblate.cloud/projects/kodi-add-ons-audio-decodersencoders/audiodecoder-snesapu/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"

msgctxt "Addon Summary"
msgid "SNES-SPC700 Sound File Data Decoder"
msgstr ""
msgstr "SNES-SPC700 声音文件数据解码器"

msgctxt "Addon Description"
msgid "The SPC format holds Super Nintendo (SNES) game music. It is named after Sony's SPC700 contribution to the SNES's S-SMP audio chip. The SNES was a major jump in audio technology from the NES allowing for stereo sound, more channels, and fully sampled instruments."
msgstr ""
msgstr "SPC 格式保存超级任天堂(SNES)游戏音乐。它是以索尼 SPC700 对 SNES s-SMP 音频芯片的贡献命名的。SNES 是从 NES 到立体声、更多声道和全采样乐器的音频技术的重大飞跃。"

#. Genre type of played game sound file
msgctxt "#30100"
msgid "Voice/Speech"
msgstr ""
msgstr "语音/对白"
32 changes: 13 additions & 19 deletions src/SPCCodec.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ bool CSPCCodec::Init(const std::string& filename,
std::string toLoad(filename);
int track = GetTrackNumber(toLoad);

if (kodi::tools::StringUtils::EndsWith(filename, ".spcstream"))
if (kodi::tools::StringUtils::EndsWith(filename, ".spc" KODI_ADDON_AUDIODECODER_TRACK_EXT))
{
std::vector<kodi::vfs::CDirEntry> items;
if (kodi::vfs::GetDirectory("rar://" + URLEncode(toLoad) + "/", ".spc", items))
Expand Down Expand Up @@ -92,19 +92,19 @@ bool CSPCCodec::Init(const std::string& filename,
return true;
}

int CSPCCodec::ReadPCM(uint8_t* buffer, int size, int& actualsize)
int CSPCCodec::ReadPCM(uint8_t* buffer, size_t size, size_t& actualsize)
{
if (ctx.pos >= ctx.tag.play_len)
return -1;
return AUDIODECODER_READ_EOF;

spc_play(ctx.song, size / SPC_CHANNELS, (short*)buffer);
actualsize = size;
ctx.pos += actualsize / SPC_CHANNELS;

if (actualsize)
return 0;
return AUDIODECODER_READ_SUCCESS;

return 1;
return AUDIODECODER_READ_ERROR;
}

int64_t CSPCCodec::Seek(int64_t time)
Expand All @@ -128,7 +128,7 @@ bool CSPCCodec::ReadTag(const std::string& filename, kodi::addon::AudioDecoderIn
bool isRSNBaseRead = kodi::tools::StringUtils::EndsWith(filename, ".rsn");
std::vector<kodi::vfs::CDirEntry> items;

if (kodi::tools::StringUtils::EndsWith(filename, ".spcstream") || isRSNBaseRead)
if (kodi::tools::StringUtils::EndsWith(filename, ".spc" KODI_ADDON_AUDIODECODER_TRACK_EXT) || isRSNBaseRead)
{
if (kodi::vfs::GetDirectory("rar://" + URLEncode(toLoad) + "/", ".spc", items))
toLoad = items[track].Path();
Expand Down Expand Up @@ -294,18 +294,12 @@ int CSPCCodec::TrackCount(const std::string& filename)
int CSPCCodec::GetTrackNumber(std::string& toLoad)
{
int track = 0;
if (toLoad.rfind("stream") != std::string::npos)
{
size_t iStart = toLoad.rfind('-') + 1;
track = atoi(toLoad.substr(iStart, toLoad.size() - iStart - 10).c_str()) - 1;
// The directory we are in, is the file
// that contains the bitstream to play,
// so extract it
size_t slash = toLoad.rfind('\\');
if (slash == std::string::npos)
slash = toLoad.rfind('/');
toLoad = toLoad.substr(0, slash);
}
toLoad = kodi::addon::CInstanceAudioDecoder::GetTrack("spc", toLoad, track);

// Correct if packed sound file with several sounds
if (track > 0)
--track;

return track;
}

Expand Down Expand Up @@ -351,7 +345,7 @@ std::string CSPCCodec::URLEncode(const std::string& strURLData)

//------------------------------------------------------------------------------

class ATTRIBUTE_HIDDEN CMyAddon : public kodi::addon::CAddonBase
class ATTR_DLL_LOCAL CMyAddon : public kodi::addon::CAddonBase
{
public:
CMyAddon() = default;
Expand Down
4 changes: 2 additions & 2 deletions src/SPCCodec.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ struct SPCContext
uint8_t* data = nullptr;
};

class ATTRIBUTE_HIDDEN CSPCCodec : public kodi::addon::CInstanceAudioDecoder
class ATTR_DLL_LOCAL CSPCCodec : public kodi::addon::CInstanceAudioDecoder
{
public:
CSPCCodec(KODI_HANDLE instance, const std::string& version);
Expand All @@ -36,7 +36,7 @@ class ATTRIBUTE_HIDDEN CSPCCodec : public kodi::addon::CInstanceAudioDecoder
int& bitrate,
AudioEngineDataFormat& format,
std::vector<AudioEngineChannel>& channellist) override;
int ReadPCM(uint8_t* buffer, int size, int& actualsize) override;
int ReadPCM(uint8_t* buffer, size_t size, size_t& actualsize) override;
int64_t Seek(int64_t time) override;
int TrackCount(const std::string& filename) override;
bool ReadTag(const std::string& filename, kodi::addon::AudioDecoderInfoTag& tag) override;
Expand Down

0 comments on commit 5b37bc5

Please sign in to comment.