mirror of
https://github.com/AxioDL/amuse.git
synced 2025-12-09 05:27:57 +00:00
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fe78a675d7 | ||
|
|
3427515960 |
@@ -132,7 +132,7 @@ struct AppCallback : boo::IApplicationCallback
|
|||||||
int8_t m_lastChanProg = -1;
|
int8_t m_lastChanProg = -1;
|
||||||
|
|
||||||
/* Control state */
|
/* Control state */
|
||||||
float m_volume = 0.5f;
|
float m_volume = 0.8f;
|
||||||
float m_modulation = 0.f;
|
float m_modulation = 0.f;
|
||||||
float m_pitchBend = 0.f;
|
float m_pitchBend = 0.f;
|
||||||
bool m_updateDisp = false;
|
bool m_updateDisp = false;
|
||||||
@@ -724,8 +724,27 @@ struct AppCallback : boo::IApplicationCallback
|
|||||||
int idx = 0;
|
int idx = 0;
|
||||||
for (const auto& pair : songs)
|
for (const auto& pair : songs)
|
||||||
{
|
{
|
||||||
|
const amuse::ContainerRegistry::SongData& sngData = pair.second;
|
||||||
|
int16_t grpId = sngData.m_groupId;
|
||||||
|
int16_t setupId = sngData.m_setupId;
|
||||||
|
if (sngData.m_groupId == -1 && sngData.m_setupId != -1)
|
||||||
|
{
|
||||||
|
for (const auto& pair : allSongGroups)
|
||||||
|
{
|
||||||
|
for (const auto& setup : pair.second.second->m_midiSetups)
|
||||||
|
{
|
||||||
|
if (setup.first == sngData.m_setupId)
|
||||||
|
{
|
||||||
|
grpId = pair.first;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (grpId != -1)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
amuse::Printf(_S(" %d %s (Group %d, Setup %d)\n"), idx++,
|
amuse::Printf(_S(" %d %s (Group %d, Setup %d)\n"), idx++,
|
||||||
pair.first.c_str(), pair.second.m_groupId, pair.second.m_setupId);
|
pair.first.c_str(), grpId, setupId);
|
||||||
}
|
}
|
||||||
|
|
||||||
int userSel = 0;
|
int userSel = 0;
|
||||||
@@ -757,7 +776,25 @@ struct AppCallback : boo::IApplicationCallback
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get group selection from user */
|
/* Get group selection via setup search */
|
||||||
|
if (m_groupId == -1 && m_setupId != -1)
|
||||||
|
{
|
||||||
|
for (const auto& pair : allSongGroups)
|
||||||
|
{
|
||||||
|
for (const auto& setup : pair.second.second->m_midiSetups)
|
||||||
|
{
|
||||||
|
if (setup.first == m_setupId)
|
||||||
|
{
|
||||||
|
m_groupId = pair.first;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (m_groupId != -1)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Get group selection via user */
|
||||||
if (m_groupId != -1)
|
if (m_groupId != -1)
|
||||||
{
|
{
|
||||||
if (allSongGroups.find(m_groupId) != allSongGroups.end())
|
if (allSongGroups.find(m_groupId) != allSongGroups.end())
|
||||||
|
|||||||
@@ -1679,6 +1679,72 @@ static std::vector<std::pair<SystemString, IntrusiveAudioGroupData>> LoadRS3(FIL
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool ValidateStarFoxAdvSongs(FILE* fp)
|
||||||
|
{
|
||||||
|
size_t endPos = FileLength(fp);
|
||||||
|
if (endPos > 2 * 1024 * 1024)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
std::unique_ptr<uint8_t[]> data(new uint8_t[endPos]);
|
||||||
|
fread(data.get(), 1, endPos, fp);
|
||||||
|
|
||||||
|
const uint32_t* lengths = reinterpret_cast<const uint32_t*>(data.get());
|
||||||
|
size_t totalLen = 0;
|
||||||
|
int i=0;
|
||||||
|
for (; i<128 ; ++i)
|
||||||
|
{
|
||||||
|
uint32_t len = SBig(lengths[i]);
|
||||||
|
if (len == 0)
|
||||||
|
break;
|
||||||
|
totalLen += len;
|
||||||
|
totalLen = ((totalLen + 31) & ~31);
|
||||||
|
}
|
||||||
|
totalLen += (((i*4) + 31) & ~31);
|
||||||
|
|
||||||
|
return totalLen == endPos;
|
||||||
|
}
|
||||||
|
|
||||||
|
static std::vector<std::pair<SystemString, ContainerRegistry::SongData>> LoadStarFoxAdvSongs(FILE* midifp)
|
||||||
|
{
|
||||||
|
std::vector<std::pair<SystemString, ContainerRegistry::SongData>> ret;
|
||||||
|
|
||||||
|
size_t endPos = FileLength(midifp);
|
||||||
|
if (endPos > 2 * 1024 * 1024)
|
||||||
|
return {};
|
||||||
|
|
||||||
|
std::unique_ptr<uint8_t[]> data(new uint8_t[endPos]);
|
||||||
|
fread(data.get(), 1, endPos, midifp);
|
||||||
|
|
||||||
|
const uint32_t* lengths = reinterpret_cast<const uint32_t*>(data.get());
|
||||||
|
int i=0;
|
||||||
|
for (; i<128 ; ++i)
|
||||||
|
{
|
||||||
|
uint32_t len = SBig(lengths[i]);
|
||||||
|
if (len == 0)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
size_t sngCount = i;
|
||||||
|
size_t cur = (((sngCount*4) + 31) & ~31);
|
||||||
|
for (i=0; i<sngCount ; ++i)
|
||||||
|
{
|
||||||
|
uint32_t len = SBig(lengths[i]);
|
||||||
|
if (len == 0)
|
||||||
|
break;
|
||||||
|
|
||||||
|
SystemChar name[128];
|
||||||
|
SNPrintf(name, 128, _S("Song%u"), i);
|
||||||
|
std::unique_ptr<uint8_t[]> song(new uint8_t[len]);
|
||||||
|
memmove(song.get(), data.get() + cur, len);
|
||||||
|
ret.emplace_back(name, ContainerRegistry::SongData(std::move(song), len, -1, i));
|
||||||
|
|
||||||
|
cur += len;
|
||||||
|
cur = ((cur + 31) & ~31);
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
ContainerRegistry::Type ContainerRegistry::DetectContainerType(const SystemChar* path)
|
ContainerRegistry::Type ContainerRegistry::DetectContainerType(const SystemChar* path)
|
||||||
{
|
{
|
||||||
FILE* fp;
|
FILE* fp;
|
||||||
@@ -2062,6 +2128,13 @@ ContainerRegistry::LoadSongs(const SystemChar* path)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ValidateStarFoxAdvSongs(fp))
|
||||||
|
{
|
||||||
|
auto ret = LoadStarFoxAdvSongs(fp);
|
||||||
|
fclose(fp);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -356,6 +356,15 @@ void Sequencer::setCtrlValue(uint8_t chan, uint8_t ctrl, int8_t val)
|
|||||||
if (chan > 15)
|
if (chan > 15)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (ctrl == 0x66)
|
||||||
|
{
|
||||||
|
printf("Loop Start\n");
|
||||||
|
}
|
||||||
|
else if (ctrl == 0x67)
|
||||||
|
{
|
||||||
|
printf("Loop End\n");
|
||||||
|
}
|
||||||
|
|
||||||
if (!m_chanStates[chan])
|
if (!m_chanStates[chan])
|
||||||
m_chanStates[chan].emplace(*this, chan);
|
m_chanStates[chan].emplace(*this, chan);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user