| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include <math.h> | 5 #include <math.h> |
| 6 #include <memory> | 6 #include <memory> |
| 7 | 7 |
| 8 #include "mojo/public/c/system/main.h" | 8 #include "mojo/public/c/system/main.h" |
| 9 #include "mojo/public/cpp/application/application_delegate.h" | 9 #include "mojo/public/cpp/application/application_delegate.h" |
| 10 #include "mojo/public/cpp/application/application_impl.h" | 10 #include "mojo/public/cpp/application/application_impl.h" |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 Cleanup(); | 110 Cleanup(); |
| 111 return; | 111 return; |
| 112 } | 112 } |
| 113 | 113 |
| 114 // Configure our sink for 16-bit 48KHz mono. | 114 // Configure our sink for 16-bit 48KHz mono. |
| 115 AudioTrackConfigurationPtr cfg = AudioTrackConfiguration::New(); | 115 AudioTrackConfigurationPtr cfg = AudioTrackConfiguration::New(); |
| 116 cfg->max_frames = USecToBytes(BUF_DEPTH_USEC) / FRAME_BYTES; | 116 cfg->max_frames = USecToBytes(BUF_DEPTH_USEC) / FRAME_BYTES; |
| 117 | 117 |
| 118 LpcmMediaTypeDetailsPtr pcm_cfg = LpcmMediaTypeDetails::New(); | 118 LpcmMediaTypeDetailsPtr pcm_cfg = LpcmMediaTypeDetails::New(); |
| 119 pcm_cfg->sample_format = LpcmSampleFormat::SIGNED_16; | 119 pcm_cfg->sample_format = LpcmSampleFormat::SIGNED_16; |
| 120 pcm_cfg->samples_per_frame = 1; | 120 pcm_cfg->interleaved = true; |
| 121 pcm_cfg->channels = 1; |
| 121 pcm_cfg->frames_per_second = SAMP_FREQ; | 122 pcm_cfg->frames_per_second = SAMP_FREQ; |
| 122 | 123 |
| 123 cfg->media_type = MediaType::New(); | 124 cfg->media_type = MediaType::New(); |
| 124 cfg->media_type->scheme = MediaTypeScheme::LPCM; | 125 cfg->media_type->scheme = MediaTypeScheme::LPCM; |
| 125 cfg->media_type->details = MediaTypeDetails::New(); | 126 cfg->media_type->details = MediaTypeDetails::New(); |
| 126 cfg->media_type->details->set_lpcm(pcm_cfg.Pass()); | 127 cfg->media_type->details->set_lpcm(pcm_cfg.Pass()); |
| 127 | 128 |
| 128 MediaPipePtr pipe; | 129 MediaPipePtr pipe; |
| 129 { | 130 { |
| 130 auto cbk = [&result](MediaResult res) { | 131 auto cbk = [&result](MediaResult res) { |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 239 | 240 |
| 240 } // namespace examples | 241 } // namespace examples |
| 241 } // namespace audio | 242 } // namespace audio |
| 242 } // namespace media | 243 } // namespace media |
| 243 } // namespace mojo | 244 } // namespace mojo |
| 244 | 245 |
| 245 MojoResult MojoMain(MojoHandle app_request) { | 246 MojoResult MojoMain(MojoHandle app_request) { |
| 246 mojo::ApplicationRunner runner(new mojo::media::audio::examples::PlayToneApp); | 247 mojo::ApplicationRunner runner(new mojo::media::audio::examples::PlayToneApp); |
| 247 return runner.Run(app_request); | 248 return runner.Run(app_request); |
| 248 } | 249 } |
| OLD | NEW |