portaudio (Битва версий) (Pa_Initialize())

Модератор: Модераторы разделов

xfree86
Сообщения: 97

portaudio (Битва версий)

Сообщение xfree86 »

Добрый день!

Возникла проблема с portaudio

Начнем с малого...
Есть маленький кусок кода, где всего лишь происходит инициализация... Вот в нем и проблема

Код: Выделить всё

#include <iostream>
#include <cstdlib>
#include <portaudio/pa_common/portaudio.h>


using namespace std;

int main(int argc, char *argv[])
{
      cout << "Hello, world, it is portAudio !" << endl;
    // Инициализация
    PaError err = Pa_Initialize();
    if( err != paNoError )
    {
        cout << "PortAudio error:\n" << Pa_GetErrorText( err ) << endl;
        return EXIT_SUCCESS;
    }

  return EXIT_SUCCESS;
}


Так вот пробую данный код с двумя версиями библиотеки 18_1 (предпоследняя) и 19 (последняя)
С 18_1
Hello, world, it is portAudio !
PortAudio error:
Host error.


С 19
Hello, world, it is portAudio !


Казалось бы, что может быть проще, чем просто взять 19 и не заморачиваться, НО!
Этот код, всего лишь тест, на самом деле есть большое приложение, часть которого основана на portaudio, которое было написано под 18_1
А в 19 интерфейс изменился...
Нет так чтобы очень сильно , но изменился...
Поборол все... Изменил код, но есть маленькая проблема...

В 18_1

Код: Выделить всё

typedef struct
{
    int structVersion;
    const char *name;
    int maxInputChannels;
    int maxOutputChannels;
    /* Number of discrete rates, or -1 if range supported. */
    int numSampleRates;
    /* Array of supported sample rates, or {min,max} if range supported. */
    const double *sampleRates;
    PaSampleFormat nativeSampleFormats;
}
PaDeviceInfo;


В 19

Код: Выделить всё

typedef struct PaDeviceInfo
{
    int structVersion;  /* this is struct version 2 */
    const char *name;
    PaHostApiIndex hostApi; /* note this is a host API index, not a type id*/

    int maxInputChannels;
    int maxOutputChannels;

    /* Default latency values for interactive performance. */
    PaTime defaultLowInputLatency;
    PaTime defaultLowOutputLatency;
    /* Default latency values for robust non-interactive applications (eg. playing sound files). */
    PaTime defaultHighInputLatency;
    PaTime defaultHighOutputLatency;

    double defaultSampleRate;
} PaDeviceInfo;


В "моем" коде часто используется numSampleRates и sampleRates, которых в 19 уже не найти, а где взять я не знаю
А если использовать 18_1, то просто не инициализируется ничего((((

Как решить?
Почему такая разница... В одном случает все ок, а в другом все очень плохо
Спасибо сказали: