To play a sequence with an audio player:
// Playing a sine wave // Set up the sine wave, the player, and a speaker. TSineWave* aSine= new TSineWave(440.,TMilliseconds(500)); TAudioPlayer* aPlayer =
TAudioPlayer::CreateDefaultAudioPlayer(aSine,
TAudioType::GetLinear16Bit44KHz()); TSpeaker* aSpeaker =
TSpeaker::CreateDefaultSpeaker(TAudioType::GetLinear16Bit44KHz()); // Connect the player to the speaker. TAudioOutputPortSurrogate* aPlayerOut = aPlayer->CreateLeftOutput(); TAudioInputPortSurrogate* aSpeakerIn = aSpeaker->CreateInput(); aPlayerOut->ConnectTo(*aSpeakerIn); // Play the sound from the current position. aPlayer->Play(); aPlayer->WaitUntilComplete();