protux-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Protux-devel] Open Task


From: Martin Herren
Subject: Re: [Protux-devel] Open Task
Date: Mon, 30 Jun 2003 12:15:54 +0200
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:0.9.4) Gecko/20011128 Netscape6/6.2.1

Luciano Giordana wrote:

You dont need to go so far, I have a standard routine using libmustux (which 
makes it pretty simple)
take a look (please reihard, save this example for libmustux documentation )

       int busId=0; // or 1 or 2, and so on.. must be any valid busId.
        int channels =  MustuxAudioDeviceMapper::STEREO;
        int rate=44100;
        int bitDepth = 16;
       if (MustuxAudioDeviceMapper::open_bus_out(busId, rate, bitDepth)<0)
                {
                // error
                }
       buf = MustuxAudioDeviceMapper::get_bus_out_transfer_buffer(busId, 
channels);
        bufSize = MustuxAudioDeviceMapper::get_bus_out_transfer_size(busId);

       while (!feof(file))
               {
               fread(buf,1,bufsize,file);
               int r=MustuxAudioDeviceMapper::bus_out_transfer(bus);
               if (r==MustuxAudioDeviceMapper::ERROR_UNDERRUN)
                       {
                        // Error...
                       }
               }

        MustuxAudioDeviceMapper::close_bus_out(busId);

any doubts, please feel free to ask


thanks... got a first playback working, not commited yet as there are still a lot of error conditions to check. I don't use fread, but PrafFile::get_fragment(), i think that's why this function is there ;-)

Just a question: what happens at the end of the praf clip, when fread() (or get_fragment()) reads less than bufsize. That would mean that the end of the buffer contains old audio data, which would lead to a 'noisy click' at the end of playback (at the edge of the new and the old data). Or i am completely wrong ? I think the return value of fread should be checked, and given as an argument to bus_out_transfer().... or is this problem handled somewhere else ? Like padding the praf audio data with zeros to achieve and audio size which is a multiple of bufsize ? (But bufsize depends on the hardware, no ?).

thanks

/Martin





reply via email to

[Prev in Thread] Current Thread [Next in Thread]