Skip to content

Instantly share code, notes, and snippets.

@joelpryde
Created November 13, 2013 22:27
Show Gist options
  • Save joelpryde/7457637 to your computer and use it in GitHub Desktop.
Save joelpryde/7457637 to your computer and use it in GitHub Desktop.
Changes to allow Cinder to do multi-channel QT audio
+void MovieBase::setAudioDevice(const std::string& audioDeviceName, float audioBalance)
+{
+ // create a QT Audio Context and set it on a Movie
+ ::QTAudioContextRef audioContext;
+ ::CFStringRef deviceId = ::CFStringCreateWithCString( kCFAllocatorDefault, audioDeviceName.c_str(), kCFStringEncodingUTF8 );
+ OSStatus status = ::QTAudioContextCreateForAudioDevice(kCFAllocatorDefault, deviceId, NULL, &audioContext);
+ if (status)
+ throw QuickTimePathInvalidExc();
+
+ if (NULL != audioContext)
+ status = SetMovieAudioContext(getObj()->mMovie, audioContext);
+
+ status = SetMovieAudioBalance(getObj()->mMovie, audioBalance, 0);
+}
+
//! Gets the audio playback volume ranging from [0 - 1.0]
float getVolume() const;
+ //! Sets the audio device we should use for this movie's playback
+ void setAudioDevice(const std::string& audioDeviceName, float audioBalance = 0.0f);
+
//! Sets up Fourier analysis on the movie using \a numBands distinct bands in a single (mono) channel. This data is only available during playback.
void setupMonoFft( uint32_t numBands );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment