Commit 9a692b7b authored by jpbl's avatar jpbl

cleaned the example03.cpp

parent bd722d03
/*
* Copyright (C) 2004-2005 Savoir-Faire Linux inc.
* Author: Jean-Philippe Barrette-LaPierre
* <jean-philippe.barrette-lapierre@savoirfairelinux.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include "NullSource.hpp"
SFLAudio::NullSource::NullSource()
: Source(0, 0)
{}
bool
SFLAudio::NullSource::isPlaying()
{return true;}
void
SFLAudio::NullSource::play(void *, int)
{}
void
SFLAudio::NullSource::stop()
{}
......@@ -51,8 +51,8 @@ int main(int argc, char* argv[])
Info *infos = new Info[argc-1];
ALenum error;
// Load wav files
for(int i = 0; i < 2; i++) {
// Load test.wav
alutLoadWAVFile(files[i],
&infos[i].format,
&infos[i].data,
......@@ -68,24 +68,26 @@ int main(int argc, char* argv[])
i++;
}
// Start the wav playing.
for(int i = 0; i < argc - 1; i++) {
Source *source = context->createSource(infos[i].format, infos[i].freq);
source->play(&infos[i].data, infos[i].size);
}
// Unload wav files
for(int i = 0; i < argc - 1; i++) {
// Unload wav files
alutUnloadWAV(infos[i].format,
infos[i].data,
infos[i].size,
infos[i].freq);
error = alGetError();
if (error != AL_NO_ERROR) {
std::cerr << "OpenAL: unloadWAV : " << alGetString(error);
}
}
std::cin.get();
error = alGetError();
if (error != AL_NO_ERROR) {
std::cerr << "OpenAL: unloadWAV : " << alGetString(error);
}
// Wait for user input.
std::cout << "Press any key to quit the program." << std::endl;
std::cin.get();
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment