private void SetPlaybackState(PlaybackState newState)
        {
            // If the playback state has not changed, return
            if (currentPlaybackState == newState)
            {
                return;
            }

            // Otherwise, make changes to the UI based on the new state
            switch (newState)
            {
            // For the no open file state, disable all playback controls apart from the home button and the
            // open file button
            case PlaybackState.NoOpenFile:
                SetUiStates(true, true, false, false, false, false, false);
                break;

            // If the open file button is selected, open the panel with this set of controls visible and disable
            // the toolbar buttons apart from the home button. Also, disable the playback controls whilst the
            // panel is open
            case PlaybackState.OpenFileSelected:
                SetUiStates(true, false, false, true, true, false, false);
                if (playbackManager.IsPlaying)
                {
                    playbackManager.StopPlaying();
                }

                // Remove this line once download is implemented
                DownloadButton.interactable = false;
                break;

            // Downloading file state not implemented
            case PlaybackState.DownloadingFile:
                break;

            // If the user has selected a file to open, disable all UI controls whilst it loads the file info
            case PlaybackState.OpeningFileInfo:
                SetUiStates(false, false, false, false, false, false, false);

                // Indicate to the playback manager that it should begin opening the specified file
                // and add a event handler to the file info finished loading event
                playbackManager.OpenFile(currentOpenFileName);

                // Instantiate a loading bar prefab and get a reference to its manager class
                GameObject loadingBar = Instantiate(LoadingBar, gameObject.transform) as GameObject;
                loadingManager = loadingBar.GetComponent <LoadingBarManager>();

                // Then, initialise it with 1 data item and the loading file info message before showing
                // it in the canvas
                loadingManager.InitialiseLoading(loadingFileInfoMessage, 1);
                loadingManager.ShowLoading();

                // Finally, set the file info ready flag to false
                fileInfoReady = false;
                break;

            // If the file info has been loaded in and chunk data is now being loaded in, disable all UI
            // controls whilst this happens
            case PlaybackState.OpeningFileData:
                SetUiStates(false, false, false, false, false, false, false);

                // An instance of the loading bar should be available with a reference to its manager
                // cached, so reinitialise the loading bar with the new chunk queue data
                loadingManager.InitialiseLoading(loadingChunksMessage, playbackManager.GetChunksToLoadCount());
                loadingManager.ShowLoading();
                break;

            // If the user has opened a file and they are playing it or they have paused it, everything will be enabled
            // apart from the options panel
            case PlaybackState.PausedFile:
                SetUiStates(true, true, true, false, false, false, true);

                if (playbackManager.IsPlaying)
                {
                    playbackManager.StopPlaying();
                }
                sliderManager.StopPlaying();
                break;

            case PlaybackState.PlayingFile:
                SetUiStates(true, true, true, false, false, false, true);

                if (!playbackManager.IsPlaying)
                {
                    playbackManager.StartPlaying();
                }
                sliderManager.StartPlaying();
                break;

            // If the file is buffering, everything should be disabled to prevent errors from occurring
            case PlaybackState.BufferingFile:
                SetUiStates(false, false, false, false, false, false, false);
                sliderManager.StopPlaying();

                // Instantiate a loading bar prefab and get a reference to its manager class
                GameObject bufferingBar = Instantiate(LoadingBar, gameObject.transform) as GameObject;
                loadingManager = bufferingBar.GetComponent <LoadingBarManager>();

                // Then, initialise it with the chunks to load count from the playback manager and the
                // buffering messgae before showing it in the canvas
                loadingManager.InitialiseLoading(bufferingMessage, playbackManager.GetChunksToLoadCount());
                loadingManager.ShowLoading();
                break;

            // If the upload file button is selected, open the panel with this set of controls visible and disable
            // the toolbar buttons apart from the home button. Also, disable the playback controls whilst the
            // panel is open
            case PlaybackState.UploadFileSelected:
                SetUiStates(true, false, false, true, false, true, false);
                if (playbackManager.IsPlaying)
                {
                    playbackManager.StopPlaying();
                }

                // Remove this line once upload is implemented
                UploadRecordingButton.interactable = false;

                break;

            // Uploading file state not implemented
            case PlaybackState.UploadingFile:
                break;
            }

            // Store the new state
            currentPlaybackState = newState;
        }
        private void SetRecordingState(RecordingState newState)
        {
            // If the recording state has not changed, return
            if (currentRecordingState == newState)
            {
                return;
            }

            // Otherwise, make changes to the UI based on the new state
            switch (newState)
            {
            // For the no data state, disable all recording controls apart from the home button
            case RecordingState.NoData:
                SetUiStates(true, false, false, false, false);
                break;

            // If data is coming in but no file has been created, only enable the home button and
            // new recording button
            case RecordingState.NoFile:
                SetUiStates(true, true, false, false, false);
                break;

            // If the user has indicated that they wish to create a new file, disable all controls apart
            // from the home button and options panel
            case RecordingState.InputNewFile:
                SetUiStates(true, false, true, false, false);
                break;

            // If the user has created a file and is ready to record, disable the panel but reenable
            // everything else
            case RecordingState.FileReady:
                SetUiStates(true, true, false, true, false);
                break;

            // If the user has begun recording, disable everything apart from the recording controls and
            // change their appearence to indicate recording
            case RecordingState.RecordingData:
                SetUiStates(false, false, false, true, true);

                // Also indicate to the recording manager that it should start recording data
                recordingManager.StartRecording(currentOpenFileName);
                break;

            // Once the user has stopped recording, keep everything disabled but also change the recording
            // button state and then disable it as well
            case RecordingState.StopRecording:
                SetUiStates(false, false, false, false, false);

                // Also indicate to the recording manager that it should stop recording data
                recordingManager.StopRecording();

                // Finally, if the recording manager is still processing the file, instantiate the loading
                // bar prefab and cache a reference to its loading manager component. Then, initialise it
                // with the loading message and show the component. Finally, store the total data items left
                // using the recording manager data queue count
                if (recordingManager.IsProcessingFile)
                {
                    GameObject loadingBar = Instantiate(LoadingBar, gameObject.transform) as GameObject;
                    loadingManager = loadingBar.GetComponent <LoadingBarManager>();
                    loadingManager.InitialiseLoading(loadingFileMessage, recordingManager.GetDataQueueCount());
                    loadingManager.ShowLoading();
                }
                break;
            }

            // Store the new state
            currentRecordingState = newState;
        }