Skip to content
This repository has been archived by the owner on Feb 6, 2023. It is now read-only.

Commit

Permalink
Merge pull request #25 from adct-the-experimenter/sync_multiple_sources
Browse files Browse the repository at this point in the history
Fixed issue of sound producer track selection of sound producer reset…
  • Loading branch information
adct-the-experimenter authored Sep 3, 2019
2 parents b3f3bd1 + d1a3d63 commit c4e2761
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 6 deletions.
5 changes: 5 additions & 0 deletions include/soundproducer-registry.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,17 @@ class SoundProducerRegistry
//function to add reference to combo box to combo_box_ptr_vec
void AddReferenceToComboBox(wxComboBox* thisComboBox);

//function to remove a combo box pointer from container, use when soundproducer track is removed
void RemoveLastComboBoxReference();

//function to update all comboboxes list, used for updating list after removal of a selection that is being edited by a soundproducer track
void UpdateAllComboBoxesList();

//function to remove a string name from all combo boxes except for one
void RemoveThisNameFromAllComboBoxesExceptThisOne(std::string thisName, wxComboBox* thisCombobox);



private:

//list of names for combo box
Expand Down
2 changes: 2 additions & 0 deletions src/openalsoftaudioengine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ bool OpenAlSoftAudioEngine::initOpenALSoft()
{
std::cout << "OpenAL Soft was unable to initialize! \n";
std::cout << "Unable to initialize default audio device! \n";
std::cout << alGetString(alGetError()) << std::endl;
return false;
}

Expand All @@ -61,6 +62,7 @@ bool OpenAlSoftAudioEngine::initOpenALSoft()
{
std::cout << "OpenAL Soft was unable to initialize! \n";
std::cout << "Unable to initialize OpenAL context! \n";
std::cout << alGetString(alGetError()) << std::endl;
return false;
}
else{alcMakeContextCurrent(alContext);}
Expand Down
10 changes: 6 additions & 4 deletions src/osgViewerWX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -605,10 +605,11 @@ void MainFrame::CreateSoundProducer(std::string& name, std::string& filePath, AL
soundproducer_registry.AddRecentSoundProducerMadeToRegistry();

//update lists of all sound producer tracks
for(size_t i=0; i < m_soundproducer_track_vec.size(); i++)
{
m_soundproducer_track_vec[i]->UpdateComboBoxListFromSoundProducerRegistry();
}
//for(size_t i=0; i < m_soundproducer_track_vec.size(); i++)
//{
// m_soundproducer_track_vec[i]->UpdateComboBoxListFromSoundProducerRegistry();
//}
soundproducer_registry.UpdateAllComboBoxesList();
}

void MainFrame::OnEditMultipleSoundProducers(wxCommandEvent& event)
Expand Down Expand Up @@ -835,6 +836,7 @@ void MainFrame::OnRemoveSoundProducerTrack(wxCommandEvent& event)
//destroy last soundproducertrack from vector containing soundproducertracks
m_soundproducer_track_vec.pop_back();
soundproducertrack_manager_ptr->RemoveSourceOfLastTrackFromSoundProducerTrackManager();
soundproducer_registry.RemoveLastComboBoxReference();

std::cout << "\nItem Count: " << timeFrame->GetTimelineWindow()->GetSizer()->GetItemCount() << std::endl;
}
Expand Down
14 changes: 12 additions & 2 deletions src/soundproducer-registry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,11 @@ void SoundProducerRegistry::AddReferenceToComboBox(wxComboBox* thisComboBox)
combo_box_ptr_vec.push_back(thisComboBox);
}

void SoundProducerRegistry::RemoveLastComboBoxReference()
{
combo_box_ptr_vec.pop_back();
}

void SoundProducerRegistry::UpdateAllComboBoxesList()
{
for(size_t i=0; i < combo_box_ptr_vec.size(); i++)
Expand All @@ -117,8 +122,9 @@ void SoundProducerRegistry::UpdateAllComboBoxesList()

combo_box_ptr_vec[i]->Clear();
combo_box_ptr_vec[i]->Append(soundproducers_to_edit_wxstring);
combo_box_ptr_vec[i]->Append(currentNameSelected);
combo_box_ptr_vec[i]->SetValue(currentNameSelected);

int select_index = combo_box_ptr_vec[i]->FindString(currentNameSelected,true); //case sensitive = true
combo_box_ptr_vec[i]->SetSelection(select_index);
}
}

Expand All @@ -137,6 +143,10 @@ void SoundProducerRegistry::RemoveThisNameFromAllComboBoxesExceptThisOne(std::st
combo_box_ptr_vec[i]->Clear();
combo_box_ptr_vec[i]->Append(soundproducers_to_edit_wxstring);

int select_index = combo_box_ptr_vec[i]->FindString(currentSelectionString,true); //case sensitive = true
combo_box_ptr_vec[i]->SetSelection(select_index);
}
}
}


5 changes: 5 additions & 0 deletions src/soundproducer-track.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,11 @@ void SoundProducerTrack::SelectSoundProducerByName(std::string name)
{
thisSoundProducer->SetReferenceToTrackSource(&track_source);
SoundProducerTrack::SetReferenceToSoundProducerToManipulate(thisSoundProducer);

if(soundproducer_registry_ptr == nullptr)
{
soundproducer_registry_ptr->RemoveThisNameFromAllComboBoxesExceptThisOne(name,m_combo_box);
}
}

}
Expand Down

0 comments on commit c4e2761

Please sign in to comment.