PEBL 2.2
Psychology Experiment Building Language - Cross-platform psychological experiment development system
AudioOutTest.cpp File Reference
#include "../devices/PAudioOut.h"
#include "../platforms/sdl/PlatformAudioOut.h"
#include "../base/Loader.h"
#include "../base/PComplexData.h"
#include "../base/PList.h"
#include "../base/FunctionMap.h"
#include "../base/VariableMap.h"
#include "../base/Variant.h"
#include "../base/Evaluator.h"
#include "../devices/PEventLoop.h"
#include "SDL/SDL.h"
#include <iostream>

Go to the source code of this file.

Functions

int main (int argc, char *argv[])
 

Function Documentation

◆ main()

int main ( int  argc,
char *  argv[] 
)

Definition at line 55 of file AudioOutTest.cpp.

56{
57
58 cout << "\n\n\n==========================================================\n";
59 cout << "Testing the PAudioOut class\n";
60 cout << "==========================================================\n";
61
62 //Set up the search path.
63 std::list<char*> tmp;
64 tmp.push_back("./");
66
67 /* Load the SDL library */
68 if ( SDL_Init(SDL_INIT_AUDIO | SDL_INIT_VIDEO) < 0 ) {
69 fprintf(stderr, "Couldn't initialize SDL: %s\n",SDL_GetError());
70 exit(1);
71 }
72
73 atexit(SDL_Quit);
74
75 cout << "Audio Initialized: " << SDL_WasInit(SDL_INIT_AUDIO) << "--" << SDL_INIT_AUDIO << endl;
76
77
78 cout << "Constructing Audio\n";
79 PlatformAudioOut * myAudioOut = new PlatformAudioOut();
80 PlatformAudioOut * myAudioOut2 = new PlatformAudioOut();
81
82 myAudioOut->LoadSoundFile("buzz500ms.wav");
83
84
85 myAudioOut->PlayForeground();
86 cout << "Playing\n";
87 SDL_Delay(500);
88 myAudioOut->PlayForeground();
89 cout << "Playing\n";
90
91
92 char name[32];
93 printf("Using audio driver: %s\n", SDL_AudioDriverName(name, 32));
94
95
96
97
98
99
100
101 cout << "Finished" << endl;
102 return 0;
103}
static PEBLPath gPath
void Initialize(std::list< std::string >)
Definition PEBLPath.cpp:60
bool LoadSoundFile(const char *filename)

References Evaluator::gPath, PEBLPath::Initialize(), PlatformAudioOut::LoadSoundFile(), and PlatformAudioOut::PlayForeground().