• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
schedule silence of n length
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

schedule silence of n length


  • Subject: schedule silence of n length
  • From: "Mazzaroth M." <email@hidden>
  • Date: Wed, 27 Aug 2014 17:21:00 -0400

Hi, I have a simple AUGraph with a AUFilePlayer and DefaultOutput node. I schedule playback of a short sample from a file. I'd like schedule a brief gap of silence after that, then schedule the sample again. I'm basically making a simple metronome and the length of the gap of silence should be configurable. I'm not sure how to do this. Here is a snippet of how I schedule the original file:

    UInt64 nPackets;
    UInt32 propsize = sizeof(nPackets);
    CheckError(AudioFileGetProperty
               (player_->inputFile, kAudioFilePropertyAudioDataPacketCount, &propsize, &nPackets),
               "AudioFileGetProperty[kAudioFilePropertyAudioDataPacketCount] failed");
    
    // set the start frame to the new position. position_ is always 0.
    player_->startFrame = _audioFileInfo.frames * position_;
    
    ScheduledAudioFileRegion rgn;
    memset (&rgn.mTimeStamp, 0, sizeof(rgn.mTimeStamp));
    rgn.mTimeStamp.mFlags = kAudioTimeStampSampleTimeValid;
    rgn.mTimeStamp.mSampleTime = 0;
    rgn.mCompletionProc = NULL;
    rgn.mCompletionProcUserData = NULL;
    rgn.mAudioFile = player_->inputFile;
    rgn.mLoopCount = -1;
    rgn.mStartFrame = player_->startFrame;
    rgn.mFramesToPlay = _audioFileInfo.frames - player_->startFrame;
    
    NSLog(@"  %ld mFramesToPlay | @ rgn.mStartFrame %qd | player_->totalFrames: %llu | player_->startFrame: %f", (long int)rgn.mFramesToPlay, rgn.mStartFrame, _audioFileInfo.frames, player_->startFrame);

regards,
Michael

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Prev by Date: Re: Does CoreAudio support DTS-HD and Dolby TrueHD passthrough via HDMI?
  • Next by Date: Re: CoreAudio SDK for Xcode 4?
  • Previous by thread: Re: Does CoreAudio support DTS-HD and Dolby TrueHD passthrough via HDMI?
  • Next by thread: Re: CoreAudio SDK for Xcode 4?
  • Index(es):
    • Date
    • Thread