• 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
Problem using MusicPlayer with AUGraph
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Problem using MusicPlayer with AUGraph


  • Subject: Problem using MusicPlayer with AUGraph
  • From: Mark Brophy <email@hidden>
  • Date: Wed, 1 Oct 2008 11:42:19 -0700 (PDT)

I am trying to use the MusicPlayer to play a MIDI file containing a few notes through a simple AUGraph consisting of a file player connected to the output. When I set the Boolean useAUGraph to false in the code below, the file plays 7 notes in succession, as I intended. However, if I set useAUGraph to true, the MusicPlayer plays the first 2 notes immediately in the first iteration of my loop, without waiting for the scheduled time, and fails to play the notes in subsequent loop iterations. What am I missing?


Mark Brophy


void TestPlaySequence()

{

MusicSequence mSequence;

AUGraph mGraph;

Boolean useAUGraph = true;

AudioFileID audioFile;

MusicPlayer mPlayer;

Boolean isPlaying;

MusicTimeStamp currentTime;

CreateSequence (&mSequence);

CreateSignalProcessingNetwork (&mGraph, &audioFile);

if (useAUGraph)

MusicSequenceSetAUGraph (mSequence, mGraph);

NewMusicPlayer(&mPlayer);

MusicPlayerSetSequence(mPlayer, mSequence);

MusicPlayerSetTime(mPlayer, 0.0);

MusicPlayerPreroll(mPlayer);

MusicPlayerStart(mPlayer);

while (MusicPlayerIsPlaying(mPlayer, &isPlaying) == noErr && isPlaying) {

[NSThread sleepUntilDate:[NSDate dateWithTimeIntervalSinceNow:1.0]];

if (MusicPlayerGetTime(mPlayer, &currentTime) != noErr || currentTime > 9.0)

break;

}

DisposeNetwork (mGraph, audioFile);

}


 _______________________________________________
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: decode error screws up audio queue ...
  • Next by Date: Multiport midi sequencing
  • Previous by thread: decode error screws up audio queue ...
  • Next by thread: Multiport midi sequencing
  • Index(es):
    • Date
    • Thread