Ejemplo n.º 1
0
        public Dictionary <String, List <SoundFile> > constructSoundFiles()
        {
            //First off check for null or empty data - don't run this if true
            if (FilePaths == null || FilePaths.Count() == 0)
            {
                return(null);
            }
            Dictionary <String, List <SoundFile> > soundData = new Dictionary <string, List <SoundFile> >();

            //Now iterate through each filepath
            foreach (String filePath in FilePaths)
            {
                //Split the filepath
                String[] fileSplit = filePath.Split('\\');
                //Get the length of the Sound Effect
                TimeSpan  duration = RecordHelper.getSoundDuration(filePath);
                SoundFile newFile  = new SoundFile(fileSplit[fileSplit.Count() - 1], filePath, duration, fileSplit[fileSplit.Count() - 2]);
                //Check if we have an existing group or not
                if (!soundData.ContainsKey(newFile.groupName))
                {
                    soundData[newFile.groupName] = new List <SoundFile>();
                }
                soundData[newFile.groupName].Add(newFile);
            }
            return(soundData);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Flip the Boolean and change the state of recording based off of it
        /// </summary>
        public void toggleRecordingState(int deviceNumber, String soundPath)
        {
            Recording = !Recording;
            //Change Behavior based off of the new boolean, not the previous boolean
            if (Recording)
            {
                //Double check that memory is properly disposed of
                resetRecordingPlaybackPlayer();
                //Signify that the program is currently Recording

                //Instatiate the recorder and the file writer
                String recordingPath = soundPath + "\\Recording\\Temp.wav";

                //Instatiate the WaveIn
                AudioRecorder = new WaveIn();
                AudioRecorder.DeviceNumber = deviceNumber;
                RecordHelper.StartRecordingIn(AudioWriter, AudioRecorder, recordingPath);
            }
            else
            {
                //Thanks to the event handlers setup in the Start Recording section - only one method needs to be called
                AudioRecorder.StopRecording();
            }
        }