2 Copyright (C) 2014 Carl Hetherington <cth@carlh.net>
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 #include <boost/test/unit_test.hpp>
22 #include "lib/dcp_content_type.h"
23 #include "lib/ratio.h"
24 #include "lib/sndfile_content.h"
25 #include "lib/audio_buffers.h"
26 #include "lib/player.h"
30 using boost::shared_ptr;
34 process_audio (shared_ptr<const AudioBuffers> buffers, int* samples)
36 cout << "weeeeeeeeee " << buffers->frames() << "\n";
37 *samples += buffers->frames ();
40 /** Test the situation where a piece of SndfileContent has its video
41 * frame rate specified (i.e. the rate that it was prepared for),
42 * and hence might need resampling.
44 BOOST_AUTO_TEST_CASE (audio_with_specified_video_frame_rate_test)
46 /* Make a film using staircase.wav with the DCP at 30fps and the audio specified
47 as being prepared for 29.97.
50 shared_ptr<Film> film = new_test_film ("audio_with_specified_video_frame_rate_test");
51 film->set_dcp_content_type (DCPContentType::from_dci_name ("FTR"));
52 film->set_container (Ratio::from_id ("185"));
53 film->set_name ("audio_with_specified_video_frame_rate_test");
55 shared_ptr<SndfileContent> content (new SndfileContent (film, "test/data/sine_440.wav"));
56 content->set_video_frame_rate (29.97);
57 film->examine_and_add_content (content);
61 film->set_video_frame_rate (30);
63 BOOST_CHECK_EQUAL (content->content_audio_frame_rate(), 48000);
64 BOOST_CHECK_EQUAL (content->output_audio_frame_rate(), 47952);