Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

panda/src/audio/test_audio.cxx

Go to the documentation of this file.
00001 // Filename: test_audio.cxx
00002 // Created by:  cary (24Sep00)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) 2001, Disney Enterprises, Inc.  All rights reserved
00008 //
00009 // All use of this software is subject to the terms of the Panda 3d
00010 // Software license.  You should have received a copy of this license
00011 // along with this source code; you will also find a current copy of
00012 // the license at http://www.panda3d.org/license.txt .
00013 //
00014 // To contact the maintainers of this program write to
00015 // panda3d@yahoogroups.com .
00016 //
00017 ////////////////////////////////////////////////////////////////////
00018 
00019 #include <pandabase.h>
00020 #include "audio.h"
00021 
00022 #include "config_audio.h"
00023 #include <ipc_traits.h>
00024 
00025 int
00026 main(int argc, char* argv[]) {
00027 
00028   AudioManager::spawn_update();
00029   {
00030     {
00031       PT(AudioSound) tester = AudioPool::load_sound(argv[1]);
00032       AudioManager::play(tester);
00033       AudioPool::release_all_sounds();
00034       cerr << "all sounds but 1 released" << endl;
00035     }
00036     cerr << "all sounds released" << endl;
00037   }
00038 
00039   /*
00040   if (! AudioPool::verify_sound("test.mp3")) {
00041     audio_cat->fatal() << "could not locate 'test.mp3'" << endl;
00042     exit(-1);
00043   }
00044   AudioSound* sample = AudioPool::load_sound("test.mp3");
00045   audio_cat->info() << "test.wav is " << sample->length() << " sec long"
00046                      << endl;
00047   audio_cat->info() << "Playing test.wav" << endl;
00048   AudioManager::play(sample);
00049   while (sample->status() == AudioSound::PLAYING) {
00050     AudioManager::update();
00051     ipc_traits::sleep(0, 1000000);
00052   }
00053 
00054   //   AudioMidi foo("test.midi");
00055   if (! AudioPool::verify_sound("test.midi")) {
00056     audio_cat->fatal() << "could not locate 'test.midi'" << endl;
00057     exit(-1);
00058   }
00059   AudioSound* music = AudioPool::load_sound("test.midi");
00060   audio_cat->info() << "Playing test.midi" << endl;
00061   AudioManager::play(music);
00062   while (music->status() == AudioSound::PLAYING) {
00063     AudioManager::update();
00064     ipc_traits::sleep(0, 1000000);
00065   }
00066   */
00067   return 0;
00068 }

Generated on Fri May 2 00:34:30 2003 for Panda by doxygen1.3