Esempio n. 1
0
        // Prepares for recording and sets the state that the audio thread stream callback is monitoring
        void StartRecording(int numSamples)
        {
            if (_leftData != null)              // We've already recorded something, let's free the data
            {
                _leftData.Release();            // Note that releasing data won't stop playback, as the player retains it too.
                _rightData.Release();           // Also note that Release() only has an effect if it was allocated in G-Audio's virtual memory.
            }

            if (_useManagedMemory)
            {
                _leftData  = GATManager.GetDataContainer(numSamples);                   //Ask the manager for an empty container of appropriate size
                _rightData = GATManager.GetDataContainer(numSamples);
            }
            else
            {
                _leftData  = new GATData(new float[numSamples]);                    // Make the container ourselves, allocating float arrays manually.
                _rightData = new GATData(new float[numSamples]);
            }


            _leftData.Retain();              // Retain the data, otherwise the player will free it at the end of playback.
            _rightData.Retain();             // Just as Release, this has no effect on manually allocated arrays.

            _recOffset = 0;                  // reset the offset
            _state     = State.Recording;    // update state
        }
Esempio n. 2
0
 void OnEnable()
 {
     _manager = target as GATManager;
 }