Skip to content

Commit

Permalink
SetVoiceName() suggested by @diyelectromusic
Browse files Browse the repository at this point in the history
  • Loading branch information
probonopd authored May 30, 2024
1 parent 8306fcd commit ae93f8e
Showing 1 changed file with 7 additions and 13 deletions.
20 changes: 7 additions & 13 deletions src/minidexed.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1763,20 +1763,14 @@ bool CMiniDexed::IsValidPerformanceBank(unsigned nBankID)
return m_PerformanceConfig.IsValidPerformanceBank(nBankID);
}

void CMiniDexed::SetVoiceName(std::string VoiceName, unsigned nTG)
void CMiniDexed::SetVoiceName (std::string VoiceName, unsigned nTG)
{
assert(nTG < CConfig::ToneGenerators);
assert(m_pTG[nTG]);

// Define a buffer with enough space for the string and null terminator
char Name[VoiceName.size() + 1];

// Copy the string and ensure null termination
strncpy(Name, VoiceName.c_str(), VoiceName.size());
Name[VoiceName.size()] = '\0';

// Pass the null-terminated string to getName
m_pTG[nTG]->getName(Name);
assert (nTG < CConfig::ToneGenerators);
assert (m_pTG[nTG]);
char Name[11];
strncpy(Name, VoiceName.c_str(),10);
Name[10] = '\0';
m_pTG[nTG]->getName (Name);
}

bool CMiniDexed::DeletePerformance(unsigned nID)
Expand Down

0 comments on commit ae93f8e

Please sign in to comment.