blob: 226db5c3f319e51dee6de2fb77246bd4e2285d1e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
#include <portaudio.h>
#include <stdint.h>
#include <stdio.h>
#include "shared.h"
static PaStream *apu_stream;
uint32_t Audio_Init()
{
Pa_Initialize();
PaStreamParameters outputParameters;
outputParameters.device = Pa_GetDefaultOutputDevice();
if (outputParameters.device == paNoDevice)
{
printf("No sound output\n");
return 1;
}
outputParameters.channelCount = 2;
outputParameters.sampleFormat = paInt16;
outputParameters.hostApiSpecificStreamInfo = NULL;
Pa_OpenStream( &apu_stream, NULL, &outputParameters, SOUND_OUTPUT_FREQUENCY, SOUND_SAMPLES_SIZE, paNoFlag, NULL, NULL);
Pa_StartStream( apu_stream );
return 0;
}
void Audio_Write(int16_t* restrict buffer, uint32_t buffer_size)
{
Pa_WriteStream( apu_stream, buffer, buffer_size);
}
void Audio_Close()
{
//Pa_Close();
}
|