MCPcopy Create free account
hub / github.com/OpenFodder/openfodder / devicePrepare

Method devicePrepare

Source/Amiga/Sound_Amiga.cpp:119–151  ·  view source on GitHub ↗

Prepare the local audio device

Source from the content-addressed store, hash-verified

117
118// Prepare the local audio device
119bool cSound_Amiga::devicePrepare() {
120 SDL_AudioSpec *desired;
121
122 desired = new SDL_AudioSpec();
123 mAudioSpec = new SDL_AudioSpec();
124
125 // FM Quality, 16Bit Signed, Mono
126 desired->freq=44100;
127 desired->format=AUDIO_S16LSB;
128 desired->channels=2;
129
130 // 2048 Samples, at 2 bytes per sample
131 desired->samples=0x800;
132
133 // Function to call when the audio playback buffer is empty
134 desired->callback = cSound_AudioCallback;
135
136 // Pass a ptr to this class
137 desired->userdata = this;
138
139 // Open the audio device
140 mVal = SDL_OpenAudioDevice(NULL, 0, desired, mAudioSpec, 0);
141
142 delete desired;
143
144 if(mVal < 0 ) {
145 std::cout << "Audio Device Initialization failed: " << SDL_GetError();
146 std::cout << std::endl;
147 return false;
148 }
149
150 return true;
151}
152
153int16 cSound_Amiga::Track_Load( sSound* pSound, int16 pTrack, int16 pSong = -1) {
154 int16 Number = 0;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected