Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(125)

Side by Side Diff: examples/audio/openal-ogg/openal_ogg.c

Issue 12114013: Fix openal NaCl port. (Closed) Base URL: http://naclports.googlecode.com/svn/trunk/src
Patch Set: Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « examples/audio/openal-ogg/nacl-openal-ogg.sh ('k') | examples/audio/openal-ogg/openal_ogg.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2012 The Native Client Authors. All rights reserved. 2 * Copyright (c) 2012 The Native Client Authors. All rights reserved.
3 * Use of this source code is governed by a BSD-style license that can be 3 * Use of this source code is governed by a BSD-style license that can be
4 * found in the LICENSE file. 4 * found in the LICENSE file.
5 */ 5 */
6 6
7 7
8 /* This example loads an ogg file using the C Pepper URLLoader interface, 8 /* This example loads an ogg file using the C Pepper URLLoader interface,
9 * decodes the file using libvorbis/libogg, and loop plays the file using 9 * decodes the file using libvorbis/libogg, and loop plays the file using
10 * OpenAL. Various properties of the audio source and listener can be changed 10 * OpenAL. Various properties of the audio source and listener can be changed
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 struct PP_CompletionCallback cb = 199 struct PP_CompletionCallback cb =
200 PP_MakeCompletionCallback(ReadCallback, data); 200 PP_MakeCompletionCallback(ReadCallback, data);
201 int32_t read_ret = g_MyState.loader_interface->ReadResponseBody( 201 int32_t read_ret = g_MyState.loader_interface->ReadResponseBody(
202 (PP_Resource)data, 202 (PP_Resource)data,
203 ogg_file_contents + ogg_file_size, 203 ogg_file_contents + ogg_file_size,
204 BUFFER_READ_SIZE, 204 BUFFER_READ_SIZE,
205 cb); 205 cb);
206 assert(read_ret == PP_OK_COMPLETIONPENDING); 206 assert(read_ret == PP_OK_COMPLETIONPENDING);
207 } 207 }
208 208
209 /* This function is part of the NaCl libopenal port and is
210 * required to be called before OpenAL initialization.
211 */
212 extern void alSetPpapiInfo(PP_Instance, PPB_GetInterface);
213
214 void* InitializeOpenAL(void* data) { 209 void* InitializeOpenAL(void* data) {
215 /* PPAPI should be the default device in NaCl, hence 'NULL'. */ 210 /* PPAPI should be the default device in NaCl, hence 'NULL'. */
216 g_MyState.alc_device = alcOpenDevice(NULL); 211 g_MyState.alc_device = alcOpenDevice(NULL);
217 assert(g_MyState.alc_device != NULL); 212 assert(g_MyState.alc_device != NULL);
218 213
219 g_MyState.alc_context = alcCreateContext(g_MyState.alc_device, 0); 214 g_MyState.alc_context = alcCreateContext(g_MyState.alc_device, 0);
220 assert(g_MyState.alc_context != NULL); 215 assert(g_MyState.alc_context != NULL);
221 216
222 alcMakeContextCurrent(g_MyState.alc_context); 217 alcMakeContextCurrent(g_MyState.alc_context);
223 alGenBuffers(1, &g_MyState.buffer); 218 alGenBuffers(1, &g_MyState.buffer);
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
403 PP_EXPORT void PPP_ShutdownModule() { 398 PP_EXPORT void PPP_ShutdownModule() {
404 } 399 }
405 400
406 PP_EXPORT const void* PPP_GetInterface(const char* interface_name) { 401 PP_EXPORT const void* PPP_GetInterface(const char* interface_name) {
407 if (strcmp(interface_name, PPP_INSTANCE_INTERFACE) == 0) 402 if (strcmp(interface_name, PPP_INSTANCE_INTERFACE) == 0)
408 return &instance_interface; 403 return &instance_interface;
409 if (strcmp(interface_name, PPP_MESSAGING_INTERFACE) == 0) 404 if (strcmp(interface_name, PPP_MESSAGING_INTERFACE) == 0)
410 return &messaging_interface; 405 return &messaging_interface;
411 return NULL; 406 return NULL;
412 } 407 }
OLDNEW
« no previous file with comments | « examples/audio/openal-ogg/nacl-openal-ogg.sh ('k') | examples/audio/openal-ogg/openal_ogg.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698