Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
Indented code properly contacteditor/frmContactEditor-Sound.cpp
authorSteve Brokenshire <sbrokenshire@xestia.co.uk>
Sun, 13 Mar 2016 11:25:32 +0000 (11:25 +0000)
committerSteve Brokenshire <sbrokenshire@xestia.co.uk>
Sun, 13 Mar 2016 11:25:32 +0000 (11:25 +0000)
source/contacteditor/frmContactEditor-Sound.cpp

index f6b6643..6138d97 100644 (file)
 
 void frmContactEditor::AddSound( wxCommandEvent& event )
 {
-    int intResult = 0;
-    
-    frmContactEditorSound *frameCESound = new frmContactEditorSound ( this );
-    frameCESound->SetEditorMode(FALSE);
-    intResult = GetLastInt(&ContactEditorData.SoundsList);
-    frameCESound->SetupPointers(&ContactEditorData.SoundsList,
-                                &ContactEditorData.SoundsListAltID,
-                                &ContactEditorData.SoundsListPID,
-                                &ContactEditorData.SoundsListType,
-                                &ContactEditorData.SoundsListAudioType,
-                                &ContactEditorData.SoundsListAudioEncType,
-                                &ContactEditorData.SoundsListTokens,
-                                &ContactEditorData.SoundsListMediatype,
-                                &ContactEditorData.SoundsListPref,
-                                lboSounds,
-                                (intValueSeek));
-    frameCESound->ShowModal();
-    delete frameCESound;
-    frameCESound = NULL;
+
+       int intResult = 0;
+    
+       frmContactEditorSound *frameCESound = new frmContactEditorSound ( this );
+       frameCESound->SetEditorMode(FALSE);
+       intResult = GetLastInt(&ContactEditorData.SoundsList);
+       frameCESound->SetupPointers(&ContactEditorData.SoundsList,
+               &ContactEditorData.SoundsListAltID,
+                &ContactEditorData.SoundsListPID,
+               &ContactEditorData.SoundsListType,
+                &ContactEditorData.SoundsListAudioType,
+                &ContactEditorData.SoundsListAudioEncType,
+                &ContactEditorData.SoundsListTokens,
+                &ContactEditorData.SoundsListMediatype,
+                &ContactEditorData.SoundsListPref,
+                lboSounds,
+                (intValueSeek));
+       frameCESound->ShowModal();
+       delete frameCESound;
+       frameCESound = NULL;
+       
 }
 
 void frmContactEditor::ModifySound( wxCommandEvent& event )
 {
-    long longSelected = -1;
-    int intSelectedData = 0;
+       
+       long longSelected = -1;
+       int intSelectedData = 0;
     
-    if (!GetSelectedItem(lboSounds,
-                         &longSelected,
-                         &intSelectedData)){
-        return;
-    }
-    
-    frmContactEditorSound *frameCESound = new frmContactEditorSound ( this );
-    frameCESound->SetupPointers(&ContactEditorData.SoundsList,
-                                &ContactEditorData.SoundsListAltID,
-                                &ContactEditorData.SoundsListPID,
-                                &ContactEditorData.SoundsListType,
-                                &ContactEditorData.SoundsListAudioType,
-                                &ContactEditorData.SoundsListAudioEncType,
-                                &ContactEditorData.SoundsListTokens,
-                                &ContactEditorData.SoundsListMediatype,
-                                &ContactEditorData.SoundsListPref,
-                                lboSounds,
-                                intSelectedData);
-    frameCESound->SetEditorMode(TRUE);
-    frameCESound->ShowModal();
-    delete frameCESound;
-    frameCESound = NULL;
+       if (!GetSelectedItem(lboSounds,
+               &longSelected,
+                &intSelectedData)){
+               return;
+       }
+    
+       frmContactEditorSound *frameCESound = new frmContactEditorSound ( this );
+       frameCESound->SetupPointers(&ContactEditorData.SoundsList,
+               &ContactEditorData.SoundsListAltID,
+               &ContactEditorData.SoundsListPID,
+               &ContactEditorData.SoundsListType,
+               &ContactEditorData.SoundsListAudioType,
+               &ContactEditorData.SoundsListAudioEncType,
+               &ContactEditorData.SoundsListTokens,
+               &ContactEditorData.SoundsListMediatype,
+               &ContactEditorData.SoundsListPref,
+               lboSounds,
+                intSelectedData);
+       frameCESound->SetEditorMode(TRUE);
+       frameCESound->ShowModal();
+       delete frameCESound;
+       frameCESound = NULL;
+       
 }
 
 void frmContactEditor::DeleteSound( wxCommandEvent& event )
 {
-    long longSelected = -1;
-    int intSelectedData = 0;
-    
-    if (!GetSelectedItem(lboSounds,
-                         &longSelected,
-                         &intSelectedData)){
-        return;
-    }
+       
+       long longSelected = -1;
+       int intSelectedData = 0;
     
-    lboSounds->DeleteItem(longSelected);
+       if (!GetSelectedItem(lboSounds,
+               &longSelected,
+               &intSelectedData)){
+               return;
+       }
     
-    DeleteMapData(intSelectedData, &ContactEditorData.SoundsList, &ContactEditorData.SoundsListAltID,
-                  &ContactEditorData.SoundsListPID, &ContactEditorData.SoundsListType, &ContactEditorData.SoundsListAudioType,
-                  &ContactEditorData.SoundsListAudioEncType, &ContactEditorData.SoundsListTokens, &ContactEditorData.SoundsListMediatype,
-                  &ContactEditorData.SoundsListPref);
+       lboSounds->DeleteItem(longSelected);
     
+       DeleteMapData(intSelectedData, &ContactEditorData.SoundsList, &ContactEditorData.SoundsListAltID,
+               &ContactEditorData.SoundsListPID, &ContactEditorData.SoundsListType, &ContactEditorData.SoundsListAudioType,
+               &ContactEditorData.SoundsListAudioEncType, &ContactEditorData.SoundsListTokens, &ContactEditorData.SoundsListMediatype,
+               &ContactEditorData.SoundsListPref);
+
 }
 
 void frmContactEditor::PlaySoundDetach()
 {
     
-    if (!AudioStreamPlayback.openFromMemory(base64dec.c_str(), base64declen)){
+       if (!AudioStreamPlayback.openFromMemory(base64dec.c_str(), base64declen)){
         
-        // Can't load file. We must flee...
-        // Also show an error message too.
+               // Can't load file. We must flee...
+               // Also show an error message too.
         
-        wxMessageBox(_("This file is in an audio format that is unsupported or is not an audio file."), _("Error opening audio file"), wxICON_ERROR);
+               wxMessageBox(_("This file is in an audio format that is unsupported or is not an audio file."), _("Error opening audio file"), wxICON_ERROR);
         
-        return;
+               return;
         
-    }
+       }
     
-    btnStop->Enable();
+       btnStop->Enable();
     
-    //AudioStreamPlayback.setbuffer(AudioBuffer);
-    AudioStreamPlayback.play();
+       //AudioStreamPlayback.setbuffer(AudioBuffer);
+       AudioStreamPlayback.play();
     
-    /*timespec n1, n2;
+       /*timespec n1, n2;
      
-     n1.tv_sec = 0;
-     n1.tv_nsec = 100000000L;*/
+       n1.tv_sec = 0;
+       n1.tv_nsec = 100000000L;*/
     
-    //while (TimeA != TimeB){
-    while (AudioStreamPlayback.getStatus() == sf::SoundSource::Playing){
+       //while (TimeA != TimeB){
+       while (AudioStreamPlayback.getStatus() == sf::SoundSource::Playing){
         
-        // We poll this every 100ms in order to conserve CPU usage.
+               // We poll this every 100ms in order to conserve CPU usage.
         
-        SleepFor(100000000);
+               SleepFor(100000000);
         
-    }
+       }
     
-    btnStop->Disable();
+       btnStop->Disable();
     
 }
 
 void frmContactEditor::PlaySound( wxCommandEvent& event )
 {
     
-    //sf::Music *AudioPlayback = new sf::Music;
-    //AudioStream *AudioStreamPlayback = new AudioStream;
-    //sf::SoundBuffer *AudioBuffer = new sf::SoundBuffer;
+       //sf::Music *AudioPlayback = new sf::Music;
+       //AudioStream *AudioStreamPlayback = new AudioStream;
+       //sf::SoundBuffer *AudioBuffer = new sf::SoundBuffer;
     
-    //sf::Sound *AudioPlayback = new sf::Sound;
+       //sf::Sound *AudioPlayback = new sf::Sound;
     
-    //delete(AudioPlayback);
+       //delete(AudioPlayback);
     
-    //delete(AudioPlayback);
-    //delete(AudioStreamPlayback);
-    //delete(AudioBuffer);
+       //delete(AudioPlayback);
+       //delete(AudioStreamPlayback);
+       //delete(AudioBuffer);
     
-    //AudioPlayback = NULL;
-    //AudioStreamPlayback = NULL;
-    //AudioBuffer = NULL;
+       //AudioPlayback = NULL;
+       //AudioStreamPlayback = NULL;
+       //AudioBuffer = NULL;
     
-    //return;
+       //return;
     
-    long longSelected = -1;
-    int intSelectedData = 0;
+       long longSelected = -1;
+       int intSelectedData = 0;
     
-    // Check if sound is still being played and if it is, stop it.
+       // Check if sound is still being played and if it is, stop it.
     
-    if (AudioStreamPlayback.getStatus() == sf::SoundSource::Playing){
+       if (AudioStreamPlayback.getStatus() == sf::SoundSource::Playing){
         
-        AudioStreamPlayback.stop();
+               AudioStreamPlayback.stop();
         
-    }
+       }
     
-    if (!GetSelectedItem(lboSounds,
-                         &longSelected,
-                         &intSelectedData)){
-        return;
-    }
+       if (!GetSelectedItem(lboSounds,
+               &longSelected,
+               &intSelectedData)){
+               return;
+       }
     
-    std::map<int, std::string>::iterator initier;
+       std::map<int, std::string>::iterator initier;
     
-    initier = ContactEditorData.SoundsList.find(intSelectedData);
+       initier = ContactEditorData.SoundsList.find(intSelectedData);
     
-    base64dec = base64_decode(initier->second);
-    base64declen = base64dec.size();
+       base64dec = base64_decode(initier->second);
+       base64declen = base64dec.size();
     
-    std::thread AudioPlaybackThread(&frmContactEditor::PlaySoundDetach, this);
-    AudioPlaybackThread.detach();
+       std::thread AudioPlaybackThread(&frmContactEditor::PlaySoundDetach, this);
+       AudioPlaybackThread.detach();
     
-    return;
+       return;
     
 }
 
 void frmContactEditor::StopSound( wxCommandEvent& event )
 {
     
-    if (AudioStreamPlayback.getStatus() == sf::SoundSource::Playing){
+       if (AudioStreamPlayback.getStatus() == sf::SoundSource::Playing){
         
-        AudioStreamPlayback.stop();
+               AudioStreamPlayback.stop();
         
-    }
-    
-    btnStop->Disable();
+       }
     
-    return;
+       btnStop->Disable();
+
+       return;
     
 }
 
Xestia Software Development
Yn Maystri
© 2006 - 2019 Xestia Software Development
Software

Xestia Address Book
Xestia Calendar
Development

Xestia Gelforn
Everything else

About
News
Privacy Policy