44100Hz was hardcoded which is sad. Use the information from the command line
or the writer node group if available.
Also add a channels count option for future use.
--- /dev/null
+section "osx options"
+#####################
+
+option "channels" c
+#~~~~~~~~~~~~~~~~~~
+"number of channels (only neccessary for raw
+audio)"
+
+ int typestr="num"
+ default="2"
+ optional
+
+option "samplerate" s
+#~~~~~~~~~~~~~~~~~~~~~
+
+"force given sample rate (only neccessary for
+raw audio)"
+
+ int typestr="num"
+ default="44100"
+ optional
sem_t *semaphore;
osx_buffer *from; /* Current buffers */
osx_buffer *to;
sem_t *semaphore;
osx_buffer *from; /* Current buffers */
osx_buffer *to;
AudioStreamBasicDescription format;
char s[10];
int m, ret;
AudioStreamBasicDescription format;
char s[10];
int m, ret;
+ struct writer_node_group *wng = wn->wng;
+ struct osx_write_args_info *conf = wn->conf;
wn->private_data = powd;
/* where did that default audio output go? */
wn->private_data = powd;
/* where did that default audio output go? */
* AND you want the DefaultOutputUnit to do any format conversions
* necessary from your format to the device's format.
*/
* AND you want the DefaultOutputUnit to do any format conversions
* necessary from your format to the device's format.
*/
- format.mSampleRate = 44100.0; /* The sample rate of the audio stream */
+ if (!conf->samplerate_given && wng->samplerate)
+ powd->samplerate = *wng->samplerate;
+ else
+ powd->samplerate = conf->samplerate_arg;
+ format.mSampleRate = powd->samplerate;
/* The specific encoding type of audio stream*/
format.mFormatID = kAudioFormatLinearPCM;
/* flags specific to each format */
/* The specific encoding type of audio stream*/
format.mFormatID = kAudioFormatLinearPCM;
/* flags specific to each format */