Пример #1
0
void Audio_Queue::stop(bool stopImmediately)
{
    if (!m_audioQueueStarted) {
        AQ_TRACE("%s: audio queue already stopped, return!\n", __PRETTY_FUNCTION__);
        return;
    }
    m_audioQueueStarted = false;
    
    AQ_TRACE("%s: enter\n", __PRETTY_FUNCTION__);

    if (AudioQueueFlush(m_outAQ) != 0) {
        AQ_TRACE("%s: AudioQueueFlush failed!\n", __PRETTY_FUNCTION__);
    }
    
    if (stopImmediately) {
        AudioQueueRemovePropertyListener(m_outAQ,
                                         kAudioQueueProperty_IsRunning,
                                         audioQueueIsRunningCallback,
                                         this);
    }
    
    if (AudioQueueStop(m_outAQ, stopImmediately) != 0) {
        AQ_TRACE("%s: AudioQueueStop failed!\n", __PRETTY_FUNCTION__);
    }
    
    if (stopImmediately) {
        setState(IDLE);
    }
    
    AQ_TRACE("%s: leave\n", __PRETTY_FUNCTION__);
}
void AudioQueueStreamOut::AQBufferCallback(void *					inUserData,
                                            AudioQueueRef			inAQ,
                                            AudioQueueBufferRef		inCompleteAQBuffer)
{
	AudioQueueStreamOut * pThis = (AudioQueueStreamOut *)inUserData;
	if (pThis->mInfo.mDone) return;
    if(pThis->mInfo.m_SeekToPacket != -1)
    {
        pThis->mInfo.mCurrentPacket = pThis->mInfo.m_SeekToPacket;
        pThis->mInfo.m_SeekToPacket = -1; 
    }        
	UInt32 numBytes;
	UInt32 nPackets = pThis->mInfo.mNumPacketsToRead;

	if ((AudioFileReadPackets(pThis->mInfo.mAudioFile, false, &numBytes, pThis->mInfo.mPacketDescs, pThis->mInfo.mCurrentPacket, &nPackets, 
								inCompleteAQBuffer->mAudioData) == 0)
                                
		
	 && (nPackets > 0)) {
		inCompleteAQBuffer->mAudioDataByteSize = numBytes;		
        AudioQueueParameterEvent event;
        event.mID = kAudioQueueParam_Volume;
        event.mValue = pThis->m_Volume; 
		AudioQueueEnqueueBufferWithParameters(inAQ, inCompleteAQBuffer, (pThis->mInfo.mPacketDescs ? nPackets : 0), pThis->mInfo.mPacketDescs,0,0,1, &event,NULL,NULL);
		
		pThis->mInfo.mCurrentPacket += nPackets;
	} 
    else 
    {
		AudioQueueStop(pThis->mInfo.mQueue, false);
			// reading nPackets == 0 is our EOF condition
		pThis->mInfo.mDone = true;
	}
}
Пример #3
0
static void
gst_atdec_destroy_queue (GstATDec * atdec, gboolean drain)
{
  AudioQueueStop (atdec->queue, drain);
  AudioQueueDispose (atdec->queue, true);
  atdec->queue = NULL;
}
Пример #4
0
 void seekToPacket(uint64_t packet) {
     AudioQueueStop(aqData.mQueue, true);
     aqData.mCurrentPacket = rand()%1000;
     primeBuffer();
     AudioQueueStart(aqData.mQueue, NULL);
     
 }
Пример #5
0
void Audio_Queue::cleanup()
{
    if (!initialized()) {
        AQ_TRACE("%s: warning: attempt to cleanup an uninitialized audio queue. return.\n", __PRETTY_FUNCTION__);
        
        return;
    }
    
    Stream_Configuration *config = Stream_Configuration::configuration();
    
    if (m_state != IDLE) {
        AQ_TRACE("%s: attemping to cleanup the audio queue when it is still playing, force stopping\n",
                 __PRETTY_FUNCTION__);
        
        AudioQueueRemovePropertyListener(m_outAQ,
                                         kAudioQueueProperty_IsRunning,
                                         audioQueueIsRunningCallback,
                                         this);
        
        AudioQueueStop(m_outAQ, true);
        setState(IDLE);
    }
    
    if (AudioQueueDispose(m_outAQ, true) != 0) {
        AQ_TRACE("%s: AudioQueueDispose failed!\n", __PRETTY_FUNCTION__);
    }
    m_outAQ = 0;
    m_fillBufferIndex = m_bytesFilled = m_packetsFilled = m_buffersUsed = 0;
    
    for (size_t i=0; i < config->bufferCount; i++) {
        m_bufferInUse[i] = false;
    }
    
    m_lastError = noErr;
}
Пример #6
0
BOOL mf_peer_rdpsnd_stop()
{
	recorderState.isRunning = false;
	AudioQueueStop(recorderState.queue, true);
	
	return TRUE;
}
Пример #7
0
static void AQTestBufferCallback(void *					inUserData,
								AudioQueueRef			inAQ,
								AudioQueueBufferRef		inCompleteAQBuffer) 
{
	AQTestInfo * myInfo = (AQTestInfo *)inUserData;
	if (myInfo->mDone) return;
		
	UInt32 numBytes;
	UInt32 nPackets = myInfo->mNumPacketsToRead;

	OSStatus result = AudioFileReadPackets(myInfo->mAudioFile, false, &numBytes, myInfo->mPacketDescs, myInfo->mCurrentPacket, &nPackets, 
								inCompleteAQBuffer->mAudioData);
	if (result) {
		DebugMessageN1 ("Error reading from file: %d\n", (int)result);
		exit(1);
	}
	
	if (nPackets > 0) {
		inCompleteAQBuffer->mAudioDataByteSize = numBytes;		

		AudioQueueEnqueueBuffer(inAQ, inCompleteAQBuffer, (myInfo->mPacketDescs ? nPackets : 0), myInfo->mPacketDescs);
		
		myInfo->mCurrentPacket += nPackets;
	} else {
		result = AudioQueueStop(myInfo->mQueue, false);
		if (result) {
			DebugMessageN1 ("AudioQueueStop(false) failed: %d", (int)result);
			exit(1);
		}
			// reading nPackets == 0 is our EOF condition
		myInfo->mDone = true;
	}
}
    void AudioOutputDeviceCoreAudio::HandleOutputBuffer (
        void                 *aqData,
        AudioQueueRef        inAQ,
        AudioQueueBufferRef  inBuffer
    ) {
        AQPlayerState* pAqData = (AQPlayerState*) aqData;
        if (atomic_read(&(pAqData->mIsRunning)) == 0) {
            AudioQueueFlush(pAqData->mQueue);
            AudioQueueStop (pAqData->mQueue, true);
            return;
        }

        if(atomic_read(&(pAqData->pDevice->restartQueue))) return;

        uint bufferSize = pAqData->pDevice->uiBufferSize;

        // let all connected engines render 'fragmentSize' sample points
        pAqData->pDevice->RenderAudio(bufferSize);

        Float32* pDataBuf = (Float32*)(inBuffer->mAudioData);

        uint uiCoreAudioChannels = pAqData->pDevice->uiCoreAudioChannels;
        for (int c = 0; c < uiCoreAudioChannels; c++) {
            float* in  = pAqData->pDevice->Channels[c]->Buffer();
            for (int i = 0, o = c; i < bufferSize; i++ , o += uiCoreAudioChannels) {
                pDataBuf[o] = in[i];
            }
        }

        inBuffer->mAudioDataByteSize = (uiCoreAudioChannels * 4) * bufferSize;

        OSStatus res = AudioQueueEnqueueBuffer(pAqData->mQueue, inBuffer, 0, NULL);
        if(res) std::cerr << "AudioQueueEnqueueBuffer: Error " << res << std::endl;
    }
Пример #9
0
bool QueueAudioData::stop()
      {
      printf("QueueAudioData::stop()\n");
      AudioQueueStop(audioQueue, true); // stop immediately, synchronously
      running = false;
      return true;
      }
Пример #10
0
void snd_audio_queue_output_callback(void *inUserData, AudioQueueRef inAQ, AudioQueueBufferRef inBuffer)
{
	OSStatus status = AudioQueueStop(inAQ, true);
	if (status != noErr) {
		printf("AudioQueueStop: %ld\n", (long)status);
	}
}
Пример #11
0
void IPhoneSoundDevice::Enable(bool fEnable)
{
    base::CritScope cs(&m_crit);

    if (fEnable) {
        if (!m_fEnable) {
            memset(m_achnl, 0, sizeof(m_achnl));
            m_tSilence = 0;
            m_fEnable = true;
            for (int i = 0; i < kcBuffers; i++) {
                InitAudioBuffer(m_apaqb[i]);
            }
            AudioQueuePrime(m_haq, 0, NULL);
            AudioQueueStart(m_haq, NULL);
            SetSoundServiceDevice(this);
        }
    } else {
        if (m_fEnable) {
            m_fEnable = false;
            memset(m_achnl, 0, sizeof(m_achnl));
            m_tSilence = 0;
            AudioQueueStop(m_haq, false);
            SetSoundServiceDevice(NULL);
        }
    }
}
Пример #12
0
static void auplay_destructor(void *arg)
{
	struct auplay_st *st = arg;
	uint32_t i;

	pthread_mutex_lock(&st->mutex);
	st->wh = NULL;
	pthread_mutex_unlock(&st->mutex);

	audio_session_disable();

	if (st->queue) {
		AudioQueuePause(st->queue);
		AudioQueueStop(st->queue, true);

		for (i=0; i<ARRAY_SIZE(st->buf); i++)
			if (st->buf[i])
				AudioQueueFreeBuffer(st->queue, st->buf[i]);

		AudioQueueDispose(st->queue, true);
	}

	mem_deref(st->ap);

	pthread_mutex_destroy(&st->mutex);
}
Пример #13
0
void AudioEnginePropertyListenerProc (void *inUserData, AudioQueueRef inAQ, AudioQueuePropertyID inID) {
    //We are only interested in the property kAudioQueueProperty_IsRunning
    if (inID != kAudioQueueProperty_IsRunning) return;

	struct myAQStruct *myInfo = (struct myAQStruct *)inUserData;

	/* Get the current status of the AQ, running or stopped */ 
    UInt32 isQueueRunning = false;
    UInt32 size = sizeof(isQueueRunning);
    AudioQueueGetProperty(myInfo->mQueue, kAudioQueueProperty_IsRunning, &isQueueRunning, &size);

	/* The callback event is the start of the queue */
    if (isQueueRunning) {
		/* reset current packet counter */
        myInfo->mCurrentPacket = 0;

        for (int i = 0; i < 3; i++) {
			/*
			 * For the first time allocate buffers for this AQ.
			 * Buffers are reused in turns until the AQ stops 
			 */
            AudioQueueAllocateBuffer(myInfo->mQueue, bufferSizeInSamples * 4, &myInfo->mBuffers[i]);

            UInt32 bytesRead = bufferSizeInSamples * 4;
            UInt32 packetsRead = bufferSizeInSamples;

			/*
			 * Read data from audio source into the buffer of AQ
			 * supplied in this callback event. Buffers are used in turns
			 * to hide the latency
			 */
            AudioFileReadPacketData(
					myInfo->mAudioFile,
					false, /* isUseCache, set to false */
					&bytesRead,
					NULL,
					myInfo->mCurrentPacket,
					&packetsRead,
					myInfo->mBuffers[i]->mAudioData);
			/* in case the buffer size is smaller than bytes requestd to read */ 
            myInfo->mBuffers[i]->mAudioDataByteSize = bytesRead;
            myInfo->mCurrentPacket += packetsRead;

            AudioQueueEnqueueBuffer(myInfo->mQueue, myInfo->mBuffers[i], 0, NULL);
        }
    } else {
		/* The callback event is the state of AQ changed to not running */
        if (myInfo->mAudioFile != NULL) {
			AudioQueueStop(myInfo->mQueue, false);
            AudioFileClose(myInfo->mAudioFile);
            myInfo->mAudioFile = NULL;

            for (int i = 0; i < 3; i++) {
                AudioQueueFreeBuffer(myInfo->mQueue, myInfo->mBuffers[i]);
                myInfo->mBuffers[i] = NULL;
            }
			CFRunLoopStop(CFRunLoopGetCurrent());
        }
    }
}
Пример #14
0
static void rdpsnd_audio_close(rdpsndDevicePlugin* device)
{
	rdpsndAudioQPlugin* aq_plugin_p = (rdpsndAudioQPlugin*) device;
    
	AudioQueueStop(aq_plugin_p->aq_ref, 0);
	aq_plugin_p->is_open = 0;
}
Пример #15
0
static void HandleOutputBuffer (void                *aqData,
                                AudioQueueRef       inAQ,
                                AudioQueueBufferRef inBuffer) {
  AQPlayerState *pAqData = (AQPlayerState *) aqData;

  if (pAqData->mIsRunning == 0) return;
  UInt32 numBytesReadFromFile;
  UInt32 numPackets = pAqData->mNumPacketsToRead;

  AudioFileReadPackets (pAqData->mAudioFile,
                        false,
                        &numBytesReadFromFile,
                        pAqData->mPacketDescs,
                        pAqData->mCurrentPacket,
                        &numPackets,
                        inBuffer->mAudioData);
  if (numPackets > 0) {
    inBuffer->mAudioDataByteSize = numBytesReadFromFile;
    AudioQueueEnqueueBuffer (pAqData->mQueue,
                             inBuffer,
                             (pAqData->mPacketDescs ? numPackets : 0),
                             pAqData->mPacketDescs);
    pAqData->mCurrentPacket += numPackets;
  } else {
    AudioQueueStop (pAqData->mQueue,
                    false);
    //printf("Play Stopped!\n");
    pAqData->mIsRunning = false;
  }
}
static void MyAQOutputCallback(void *inUserData, AudioQueueRef inAQ, AudioQueueBufferRef inCompleteAQBuffer) 
{
	MyPlayer *aqp = (MyPlayer*)inUserData;
	if (aqp->isDone) return;
	
	// read audio data from file into supplied buffer
	UInt32 numBytes;
	UInt32 nPackets = aqp->numPacketsToRead;	
	CheckError(AudioFileReadPackets(aqp->playbackFile,
									false,
									&numBytes,
									aqp->packetDescs,
									aqp->packetPosition,
									&nPackets,
									inCompleteAQBuffer->mAudioData),
			   "AudioFileReadPackets failed");
	
	// enqueue buffer into the Audio Queue
	// if nPackets == 0 it means we are EOF (all data has been read from file)
	if (nPackets > 0)
	{
		inCompleteAQBuffer->mAudioDataByteSize = numBytes;		
		AudioQueueEnqueueBuffer(inAQ,
								inCompleteAQBuffer,
								(aqp->packetDescs ? nPackets : 0),
								aqp->packetDescs);
		aqp->packetPosition += nPackets;
	}
	else
	{
		CheckError(AudioQueueStop(inAQ, false), "AudioQueueStop failed");
		aqp->isDone = true;
	}
}
Пример #17
0
// Define a playback audio queue callback function
static void AQTestBufferCallback(
    void                   *inUserData,
    AudioQueueRef          inAQ,
    AudioQueueBufferRef    inCompleteAQBuffer
)
{
    struct myAQStruct *myInfo = (struct myAQStruct *)inUserData;
    if (myInfo->mDone) return;
    UInt32 numBytes;
    UInt32 nPackets = myInfo->mNumPacketsToRead;
 
	printf("called\n");
    UInt32 bytesRead = bufferSizeInSamples * 4;
    UInt32 packetsRead = bufferSizeInSamples;

    AudioFileReadPacketData(
			myInfo->mAudioFile,
			false,
			&bytesRead,
			NULL,
			currentPacket,
			&packetsRead,
			inCompleteAQBuffer->mAudioData);
    inCompleteAQBuffer->mAudioDataByteSize = bytesRead;
    currentPacket += packetsRead;

    if (bytesRead == 0) {
        AudioQueueStop(inAQ, false);
    } else {
        AudioQueueEnqueueBuffer(inAQ, inCompleteAQBuffer, 0, NULL);
    }
    /* printf("called\n"); */
    /* AudioFileReadPacketData( */
        /* myInfo->mAudioFile, */
        /* false, */
        /* &numBytes, */
        /* myInfo->mPacketDescs, */
        /* myInfo->mCurrentPacket, */
        /* &nPackets, */
        /* inCompleteAQBuffer->mAudioData */
    /* ); */
    /* printf("read %d packets %d bytes\n", numBytes, nPackets); */
    /* if (nPackets > 0) { */
        /* inCompleteAQBuffer->mAudioDataByteSize = numBytes; */
        /* AudioQueueEnqueueBuffer ( */
            /* inAQ, */
            /* inCompleteAQBuffer, */
            /* (myInfo->mPacketDescs ? nPackets : 0), */
            /* myInfo->mPacketDescs */
        /* ); */
        /* myInfo->mCurrentPacket += nPackets; */
    /* } else { */
        /* AudioQueueStop ( */
            /* myInfo->mQueue, */
            /* false */
        /* ); */
        /* myInfo->mDone = true; */
    /* } */
}
Пример #18
0
OSStatus
darwin_free_context (
                     darwin_context* io_context
                     )
{
  OSStatus result = kAudio_ParamError;
  
  if( NULL != io_context )
  {
    CPC_LOG_STRING( CPC_LOG_LEVEL_DEBUG, "Stopping audio queue..." );
    
    result = AudioQueueStop( io_context->audio_queue, true );
    
    CPC_LOG_STRING( CPC_LOG_LEVEL_DEBUG, "Stopped audio queue." );
    
    if( noErr == result )
    {
      for( UINT32 i = 0; i < io_context->number_of_buffers; i++ )
      {
        if( NULL != io_context->audio_buffers[ i ] )
        {
          result =
          AudioQueueFreeBuffer  (
                                 io_context->audio_queue,
                                 io_context->audio_buffers[ i ]
                                 );
          
          if( result )
          {
            CPC_ERROR (
                       "Could not free queue buffer: 0x%x.",
                       result
                       );
            
            CPC_PRINT_CODE( CPC_LOG_LEVEL_ERROR, result );
          }
        }
      }
      
      result =
      AudioQueueDispose( io_context->audio_queue, true );
      
      if( result )
      {
        CPC_ERROR( "Could not dispose of queue: 0x%x.", result );
        
        CPC_PRINT_CODE( CPC_LOG_LEVEL_ERROR, result );
      }
    }
    else
    {
      CPC_ERROR( "Could not stop audio queue: 0x%x.", result );
      
      CPC_PRINT_CODE( CPC_LOG_LEVEL_ERROR, result );
    }
  }
  
  return( result );
}
Пример #19
0
void
Moose::Sound::CMusicClip::Stop()
{
    m_bRunning = false;
    //pthread_mutex_lock(&m_pData->mutex); 
	AudioQueueStop(m_pData->audioQueue, TRUE);
    //pthread_mutex_unlock(&m_pData->mutex);
}
Пример #20
0
static void AQTestBufferCallback(void *inUserData, AudioQueueRef inAQ, AudioQueueBufferRef inCompleteAQBuffer) 
{
	AQTestInfo * myInfo = (AQTestInfo *)inUserData;
	if (myInfo->mDone) return;
		
	UInt32 numBytes;
	UInt32 nPackets = myInfo->mNumPacketsToRead;
	OSStatus result = AudioFileReadPackets(myInfo->mAudioFile,      // The audio file from which packets of audio data are to be read.
                                           false,                   // Set to true to cache the data. Otherwise, set to false.
                                           &numBytes,               // On output, a pointer to the number of bytes actually returned.
                                           myInfo->mPacketDescs,    // A pointer to an array of packet descriptions that have been allocated.
                                           myInfo->mCurrentPacket,  // The packet index of the first packet you want to be returned.
                                           &nPackets,               // On input, a pointer to the number of packets to read. On output, the number of packets actually read.
                                           inCompleteAQBuffer->mAudioData); // A pointer to user-allocated memory.
	if (result) {
		DebugMessageN1 ("Error reading from file: %d\n", (int)result);
		exit(1);
	}
    
    // we have some data
	if (nPackets > 0) {
		inCompleteAQBuffer->mAudioDataByteSize = numBytes;
        
		result = AudioQueueEnqueueBuffer(inAQ,                                  // The audio queue that owns the audio queue buffer.
                                         inCompleteAQBuffer,                    // The audio queue buffer to add to the buffer queue.
                                         (myInfo->mPacketDescs ? nPackets : 0), // The number of packets of audio data in the inBuffer parameter. See Docs.
                                         myInfo->mPacketDescs);                 // An array of packet descriptions. Or NULL. See Docs.
		if (result) {
			DebugMessageN1 ("Error enqueuing buffer: %d\n", (int)result);
			exit(1);
		}
        
		myInfo->mCurrentPacket += nPackets;
        
	} else {
        // **** This ensures that we flush the queue when done -- ensures you get all the data out ****
		
        if (!myInfo->mFlushed) {
			result = AudioQueueFlush(myInfo->mQueue);
			
            if (result) {
				DebugMessageN1("AudioQueueFlush failed: %d", (int)result);
				exit(1);
			}
            
			myInfo->mFlushed = true;
		}
		
		result = AudioQueueStop(myInfo->mQueue, false);
		if (result) {
			DebugMessageN1("AudioQueueStop(false) failed: %d", (int)result);
			exit(1);
		}
        
		// reading nPackets == 0 is our EOF condition
		myInfo->mDone = true;
	}
}
long AudioStreamDecoder::Stop()
{
	long err = 0;

	if (mStream)
	{
		err = AudioFileStreamClose(mStream);
		CARP_IF(err, "AudioFileStreamClose returned %ld\n", err);

		mStream = NULL;
	}

	if (mStarted)
	{
		err = AudioQueueFlush(mQueue);
		BAIL_IF(err, "AudioQueueFlush returned %ld\n", err);

		err = AudioQueueStop(mQueue, true);
		BAIL_IF(err, "AudioQueueStop returned %ld\n", err);

		err = pthread_mutex_lock(&mMutex);
		BAIL_IF(err, "pthread_mutex_lock returned %ld\n", err);

		if (!mFinished)
		{
			err = pthread_cond_wait(&mCond, &mMutex);
			BAIL_IF(err, "pthread_cond_wait returned %ld\n", err);
		}

		err = pthread_mutex_unlock(&mMutex);
		BAIL_IF(err, "pthread_mutex_unlock returned %ld\n", err);

		mStarted = false;
		mFinished = false;
	}

	if (mQueue)
	{
		for (int i = 0; i < kBufferCount; i++)
		{
			if (mBuffers[i])
			{
				err = AudioQueueFreeBuffer(mQueue, mBuffers[i]);
				CARP_IF(err, "AudioQueueFreeBuffer returned %ld\n", err);
			}
		}

		err = AudioQueueDispose(mQueue, true);
		CARP_IF(err, "AudioQueueDispose returned %ld\n", err);

		mQueue = NULL;
	}

bail:
	return err;
}
Пример #22
0
		OSStatus Stop(Boolean inStopAtEnd)
		{
			if (inStopAtEnd)
			{
				mStopAtEnd = true;
				return noErr;
			}
			else
				return AudioQueueStop(mQueue, true);
		}
Пример #23
0
/*****************************************************************************
 * Close: close the audio device
 *****************************************************************************/
static void Close ( vlc_object_t *p_this )
{
    aout_instance_t *p_aout = (aout_instance_t *)p_this;
    struct aout_sys_t * p_sys = p_aout->output.p_sys;

    msg_Dbg(p_aout, "Stopping AudioQueue");
    AudioQueueStop(p_sys->audioQueue, false);
    msg_Dbg(p_aout, "Disposing of AudioQueue");
    AudioQueueDispose(p_sys->audioQueue, false);
    free (p_sys);
}
Пример #24
0
OSStatus DZAudioQueuePlayer::stop(bool immediately)
{
    if (this->_queue == NULL || (this->_status != DZAudioQueuePlayerStatus_Paused
                                 && this->_status != DZAudioQueuePlayerStatus_Running)) {
        return dzDebug(!noErr, "Audio queue cannot stop because it is not started.");
    }
    OSStatus ret = dzDebug(AudioQueueStop(this->_queue, immediately), "Fail to stop audio queue.");
    if (ret == noErr) {
        this->_status = DZAudioQueuePlayerStatus_Stopped;
    }
    return ret;
}
Пример #25
0
/*****************************************************************************
 * Close: close the audio device
 *****************************************************************************/
static void Close ( vlc_object_t *p_this )
{
    audio_output_t *p_aout = (audio_output_t *)p_this;
    struct aout_sys_t * p_sys = p_aout->sys;

    msg_Dbg(p_aout, "Stopping AudioQueue");
    AudioQueueStop(p_sys->audioQueue, false);
    msg_Dbg(p_aout, "Disposing of AudioQueue");
    AudioQueueDispose(p_sys->audioQueue, false);
    aout_PacketDestroy(p_aout);
    free (p_sys);
}
Пример #26
0
/** @internal @This destroys the current audioqueue
 * @param upipe description structure of the pipe
 */
static void upipe_osx_audioqueue_sink_remove(struct upipe *upipe)
{
    struct upipe_osx_audioqueue_sink *osx_audioqueue =
        upipe_osx_audioqueue_sink_from_upipe(upipe);
    if (unlikely(!osx_audioqueue->queue)) {
        return;
    }

    AudioQueueStop(osx_audioqueue->queue, true);
    AudioQueueDispose(osx_audioqueue->queue, true);
    osx_audioqueue->queue = NULL;
    upipe_notice(upipe, "audioqueue destroyed");
}
Пример #27
0
void SoundRecorder::stop(void)
	{
	/* Do nothing if not started: */
	if(!active)
		return;
	
	/* Stop recording: */
	AudioQueueStop(queue,true);
	active=false;
	
	/* Set the audio file's magic cookie (might have been updated during recording): */
	setAudioFileMagicCookie();
	}
Пример #28
0
void Recorder::stop()
{
	AudioQueueStop (                                     // 6
		aqData.mQueue,                                   // 7
		true                                             // 8
	);
	aqData.mIsRunning = false;                          // 9
	AudioQueueDispose (                                 // 1
		aqData.mQueue,                                  // 2
		true                                            // 3
	);
 
	AudioFileClose (aqData.mAudioFile);                 // 4
}
Пример #29
0
    music_obj<audio_queue_driver>::~music_obj()
    {
        if (is_playing()) 
        {
            AudioQueueStop(queue_, true);
        }
        
        AudioQueueDispose(queue_, true);
		AudioFileClose(audio_file_);   
        
        if(packet_descriptions_ != NULL)
        {
            free(packet_descriptions_);
        }
    }
Пример #30
0
static void aq_stop_w(MSFilter * f)
{
	AQData *d = (AQData *) f->data;
	if (d->write_started == TRUE) {
		ms_mutex_lock(&d->mutex);
		d->write_started = FALSE;	/* avoid a deadlock related to buffer conversion in callback */
		ms_mutex_unlock(&d->mutex);
#if 0
		AudioConverterDispose(d->writeAudioConverter);
#endif
		AudioQueueStop(d->writeQueue, true);

		AudioQueueDispose(d->writeQueue, true);
	}
}