~ubuntu-branches/debian/sid/flightgear/sid

« back to all changes in this revision

Viewing changes to 3rdparty/iaxclient/lib/portmixer/px_tests/px_test.c

  • Committer: Package Import Robot
  • Author(s): Markus Wanner, Markus Wanner, Rebecca Palmer
  • Date: 2014-01-21 22:31:02 UTC
  • mfrom: (1.3.1) (15.1.2 experimental)
  • Revision ID: package-import@ubuntu.com-20140121223102-cjw7g9le25acd119
Tags: 3.0.0~git20140204+c99ea4-1
[ Markus Wanner ]
* Upload to unstable.
* Adjust B-D to allow building on kfreebsd-*. Closes: #724686.
* Add a lintian-overrides on autotools; we use cmake.
* Upstream corrected the fgfs manpage. Closes: #556362.
* Drop unnecessary man page for gl-info. Closes: #698308.
* Drop README.Linux: it's outdated to the point of uselessness.
  Closes: #574173.
* Add an upper limit of libsimgear-dev versions that flightgear can be
  built with. Closes: #738436.
* Drop the libsvn-dev dependency, neither flightgear nor simgear depend
  on libsvn, anymore. Closes: #682947.
* List icons in debian/install rather than copying around from rules.
* Update menu entry for flightgear, add one for fgcom; add .xpm icons.
  Closes: #713924.
* flightgear.desktop: add German translation
* Bump Standards-Version to 3.9.5; no changes needed.

[ Rebecca Palmer ]
* New upstream release.
* Install the icons (based on code by Saikrishna Arcot).  (Not a
  complete fix for LP908153 as it only sets the menu/Dash icon, not the
  running window's icon, but better than nothing).
* Disable screensaver while running. Closes: LP#793599. Add required
  libdbus-1-dev dependency.
* Remove outdated README.Debian.
* Terrasync now works after just ticking the box. Closes: #252899.
* Always set Terrasync directory.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#include <stdio.h>
 
2
 
 
3
#include "portmixer.h"
 
4
#include "portaudio.h"
 
5
 
 
6
static int DummyCallbackFunc(const void *inputBuffer, 
 
7
                             void *outputBuffer,
 
8
                             unsigned long framesPerBuffer,
 
9
                             const PaStreamCallbackTimeInfo* timeInfo,
 
10
                             PaStreamCallbackFlags statusFlags,
 
11
                             void *userData )
 
12
{
 
13
   return 0;
 
14
}
 
15
#define NUM_CHANNELS    (2)
 
16
#define PA_SAMPLE_TYPE  paFloat32
 
17
#define SAMPLE_RATE         (44100)
 
18
#define FRAMES_PER_BUFFER   (1024)
 
19
 
 
20
int main(int argc, char **argv)
 
21
{
 
22
   int num_mixers;
 
23
   int i;
 
24
   PaError          error;
 
25
   PaStream*       stream;
 
26
   PaStreamParameters inputParameters;
 
27
   PaStreamParameters outputParameters;
 
28
 
 
29
   error = Pa_Initialize();
 
30
   if ( error != paNoError ) {
 
31
      printf("PortAudio error %d: %s\n", error, Pa_GetErrorText(error));
 
32
      return -1;
 
33
   }
 
34
   inputParameters.device = Pa_GetDefaultInputDevice();
 
35
   inputParameters.channelCount = NUM_CHANNELS;
 
36
   inputParameters.sampleFormat = PA_SAMPLE_TYPE;
 
37
   inputParameters.suggestedLatency = 
 
38
       Pa_GetDeviceInfo(inputParameters.device )->defaultLowInputLatency;
 
39
   inputParameters.hostApiSpecificStreamInfo = NULL;
 
40
 
 
41
   outputParameters.device = Pa_GetDefaultOutputDevice(); /* default output device */
 
42
   outputParameters.channelCount = 2;       /* stereo output */
 
43
   outputParameters.sampleFormat = paFloat32; /* 32 bit floating point output */
 
44
   outputParameters.suggestedLatency = 
 
45
       Pa_GetDeviceInfo( outputParameters.device )->defaultLowOutputLatency;
 
46
   outputParameters.hostApiSpecificStreamInfo = NULL;
 
47
 
 
48
 
 
49
 
 
50
   error = Pa_OpenStream(&stream, &inputParameters, &outputParameters, 
 
51
                         SAMPLE_RATE,FRAMES_PER_BUFFER,
 
52
                         paClipOff | paDitherOff,
 
53
                         DummyCallbackFunc, NULL);
 
54
 
 
55
   if (error) {
 
56
      printf("PortAudio error %d: %s\n", error, Pa_GetErrorText(error));
 
57
      return -1;
 
58
   }
 
59
   
 
60
   num_mixers = Px_GetNumMixers(stream);
 
61
   printf("Number of mixers: %d\n", num_mixers);
 
62
   for(i=0; i<num_mixers; i++) {
 
63
      PxMixer *mixer;
 
64
      int num;
 
65
      int j;
 
66
 
 
67
      printf("Mixer %d: %s\n", i, Px_GetMixerName(stream, i));
 
68
      mixer = Px_OpenMixer(stream, i);
 
69
      if (!mixer) {
 
70
         printf("  Could not open mixer!\n");
 
71
         continue;
 
72
      }
 
73
      
 
74
      printf("  Master volume: %.2f\n", Px_GetMasterVolume(mixer));
 
75
      printf("  PCM output volume: %.2f\n", Px_GetPCMOutputVolume(mixer));
 
76
 
 
77
      num = Px_GetNumOutputVolumes(mixer);
 
78
      printf("  Num outputs: %d\n", num);
 
79
      for(j=0; j<num; j++) {
 
80
         printf("    Output %d (%s): %.2f\n",
 
81
                j,
 
82
                Px_GetOutputVolumeName(mixer, j),
 
83
                Px_GetOutputVolume(mixer, j));
 
84
      }
 
85
 
 
86
      num = Px_GetNumInputSources(mixer);
 
87
      printf("  Num input sources: %d\n", num);
 
88
      for(j=0; j<num; j++) {
 
89
         printf("    Input %d (%s) %s\n",
 
90
                j,
 
91
                Px_GetInputSourceName(mixer, j),
 
92
                (Px_GetCurrentInputSource(mixer)==j?
 
93
                 "SELECTED": ""));
 
94
      }
 
95
      printf("  Input volume: %.2f\n", Px_GetInputVolume(mixer));
 
96
 
 
97
      Px_CloseMixer(mixer);
 
98
   }
 
99
 
 
100
   Pa_CloseStream(stream);
 
101
 
 
102
   return 0;
 
103
}