Yes, I commented yesterday that I was unsure of the relationship
between streamtime and DacTime. I am very familiar with PortAudio, but
in the area of timing, I am pretty lost. The one thing I've ever had
to do with timing is synchronize audio to video and in that case the
latency is less than a video frame so you don't really have to worry
about this.
Anyway, I think that streamTime actually corresponds to currentTime in
the PaStreamCallbackTimeInfo structure, and I tried it that way and it
worked. Perhaps the reason it worked with the Dac was because, on the
mac or under certain circumstances or whatever, DacTime and StreamTime
are the same.
I will try to clean up my code a bit and resend.
bjorn
On Jan 10, 2011, at 9:57 PM, Roger Dannenberg wrote:
> I have some comments on pieces of code. I think this is at least
> close to correct, but see if my comments match your assumptions. If
> I had more time I'd try to construct equations for the output time
> of audio and output time of midi and show they are (or are not) equal.
>
>> PmTimestamp timeProc(void *timeData) {
>> PaStream *pas = (PaStream *) timeData ;
>> PaTime t = Pa_GetStreamTime( pas );
>> return (PmTimestamp) (int64_t) ( t * 1000 + .5 ) ;
> // so PortAudio timestamps correspond to Pa_GetStreamTime
> // (whatever that means)
>
>
>> data->start = (PmTimestamp) ( timeInfo->outputBufferDacTime *
>> 1000 + .5 );
> // midi is output with timestamps of data->start + N, where timestamps
> // correspond to Pa_GetStreamTime. How does this relate to
> // outputBufferDacTime?
>> Pm_WriteShort( data->midiStream,
>> data->start + (data->iterations)*1000,
>> Pm_Message( 0x90, 0x3C, 0x60 ) );
> // Midi output time will be data->start + N * 1000 + latency
> // It looks to me like you should subtract the midi latency parameter
> // from the timestamp here
>>
-----------------------------
Bjorn Roche
http://www.xonami.com
Audio Collaboration
_______________________________________________
media_api mailing list
[email protected]
http://lists.create.ucsb.edu/mailman/listinfo/media_api