// // Removes a Sender from the set of Sender names // bool spoutSenderNames::ReleaseSenderName(const char* Sendername) { std::set<std::string> SenderNames; std::string namestring; char name[SpoutMaxSenderNameLen]; // Create the shared memory for the sender name set if it does not exist if(!CreateSenderSet()) return false; char *pBuf = m_senderNames.Lock(); if (!pBuf) return false; namestring = Sendername; auto foundSender = m_senders->find(namestring); if (foundSender != m_senders->end()) { delete foundSender->second; m_senders->erase(namestring); } readSenderSetFromBuffer(pBuf, SenderNames, m_MaxSenders); // Discovered that the project properties had been set to CLI // Properties -> General -> Common Language Runtime Support // and this caused the set "find" function not to work. // It also disabled intellisense. // Get the current map to update the list if(SenderNames.find(Sendername) != SenderNames.end() ) { SenderNames.erase(Sendername); // erase the matching Sender writeBufferFromSenderSet(SenderNames, pBuf, m_MaxSenders); // Is there a set left ? if(SenderNames.size() > 0) { // This should be OK because the user selects the active sender // Was it the active sender ? if( (getActiveSenderName(name) && strcmp(name, Sendername) == 0) || SenderNames.size() == 1) { // It was, so choose the first in the list std::set<std::string>::iterator iter = SenderNames.begin(); namestring = *iter; strcpy_s(name, namestring.c_str()); // Set it as the active sender setActiveSenderName(name); } } m_senderNames.Unlock(); return true; } m_senderNames.Unlock(); return false; // Sender name not in the set or no set in shared mempry } // end RemoveSender
// Function for clients to retrieve the current active Sender name bool spoutSenderNames::GetActiveSender(char Sendername[SpoutMaxSenderNameLen]) { char ActiveSender[SpoutMaxSenderNameLen]; SharedTextureInfo info; if(getActiveSenderName(ActiveSender)) { // Does it still exist ? if(getSharedInfo(ActiveSender, &info)) { strcpy_s(Sendername, SpoutMaxSenderNameLen, ActiveSender); return true; } else { // Erase the map ? } } return false; } // end GetActiveSender