/************************************************************************************** OggTest - A simple program to play an ogg file using libmustux AUTHOR : Luciano Giordana This software is distributed under the terms of the GNU General Public License as specified in the COPYING file. *************************************************************************************** */ #include #include int main(int argc, char **argv) { OggFile* audio = new OggFile(); if (audio->open("test.ogg")<0) { PERROR("Cannot open (test.ogg)"); return -1; } audio->read_header(); audio->rewind_audio(); MustuxAudioDeviceMapper::init(); int bus = 0; MustuxAudioDeviceMapper::open_bus_out(bus, audio->rate, audio->bitDepth, audio->channels); char* buf = MustuxAudioDeviceMapper::get_bus_out_transfer_buffer(bus, MustuxAudioDeviceMapper::STEREO); int bufSize = MustuxAudioDeviceMapper::get_bus_out_transfer_size(bus); printf("\ntest.ogg : rate=%d channels=%d bitDepth=%d\n",audio->rate,audio->channels,audio->bitDepth); printf("Ogg Test starting ...\n\n"); while (!audio->eof()) { int bytesRead = audio->read_fragment(buf,bufSize); printf("Transferring %d bytes...\n",bytesRead); MustuxAudioDeviceMapper::bus_out_transfer(bus); } printf("Ogg Test finished.\n"); audio->close_file(); MustuxAudioDeviceMapper::close_all_playback_buses(); delete audio; return 1; }