arts Library: kconverttest.cc Source File (arts Library)

| # arts Library API Documentation
Overview | Class Hierarchy | Classes | Classes (annotated) | Members | Namespaces | Source Files

# kconverttest.cc

    00001 #include <stdio.h>
    00002
    00003 #include <qfile.h>
    00004 #include <qobject.h>
    00005
    00006 #include <klocale.h>
    00007 #include <kaboutdata.h>
    00008 #include <kcmdlineargs.h>
    00009 #include <kapplication.h>
    00010
    00011 #include <flowsystem.h>
    00012 #include <kplayobject.h>
    00013 #include <kartsdispatcher.h>
    00014 #include <kplayobjectfactory.h>
    00015 #include <kaudioconverter.h>
    00016 #include "kconverttest.moc"
    00017
    00018 using namespace std;
    00019 using namespace Arts;
    00020
    00021 static KCmdLineOptions options[] =
    00022 {
    00023     { "+[URL]", I18N_NOOP("URL to open"), 0 },
    00024     KCmdLineLastOption
    00025 };
    00026
    00027 KConvertTest::KConvertTest()
    00028 {
    00029 }
    00030
    00031 void KConvertTest::slotRawStreamStart()
    00032 {
    00033 //  cout << "[START]\n\n" << endl;
    00034 }
    00035
    00036 void KConvertTest::slotNewBlockSize(long blockSize)
    00037 {
    00038     m_blockSize = blockSize;
    00039 }
    00040
    00041 void KConvertTest::slotNewBlockPointer(long blockPointer)
    00042 {
    00043     m_blockPointer = blockPointer;
    00044 }
    00045
    00046 void KConvertTest::slotNewData()
    00047 {
    00048     fwrite((void *) m_blockPointer, 1, m_blockSize, stdout);
    00049 }
    00050
    00051 void KConvertTest::slotRawStreamFinished()
    00052 {
    00053 //  cout << "\n\n[END]" << endl;
    00054 }
    00055
    00056 int main(int argc, char **argv)
    00057 {
    00058     KAboutData aboutData("kconverttest", I18N_NOOP("KConvertTest"), I18N_NOOP("0.1"), "", KAboutData::License_GPL, "");
    00059
    00060     KCmdLineArgs::init(argc, argv, &aboutData);
    00061     KCmdLineArgs::addCmdLineOptions(options);
    00062     KApplication app;
    00063
    00064     KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
    00065
    00066     KURL url;
    00067
    00068     if(args->count())
    00069         url = args->arg(0);
    00070     else
    00071         exit(1);
    00072
    00073     args->clear();
    00074
    00075     KConvertTest *get = new KConvertTest();
    00076
    00077     KArtsDispatcher dispatcher;
    00078     KAudioConverter converter;
    00079
    00080     // FIXME: crashes
    00081     // converter.setup(44100);
    00082     converter.requestPlayObject(url);
    00083
    00084     QObject::connect(&converter, SIGNAL(rawStreamStart()), get, SLOT(slotRawStreamStart()));
    00085
    00086     QObject::connect(&converter, SIGNAL(newBlockSize(long)), get, SLOT(slotNewBlockSize(long)));
    00087     QObject::connect(&converter, SIGNAL(newBlockPointer(long)), get, SLOT(slotNewBlockPointer(long)));
    00088     QObject::connect(&converter, SIGNAL(newData()), get, SLOT(slotNewData()));
    00089
    00090     QObject::connect(&converter, SIGNAL(rawStreamFinished()), get, SLOT(slotRawStreamFinished()));
    00091
    00092     converter.start();
    00093
    00094     app.exec();
    00095 }
    00096

This file is part of the documentation for arts Library Version 3.4.1.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sat Jun 11 20:27:55 2005 by doxygen 1.4.1 written by Dimitri van Heesch, © 1997-2003