Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

audio source and buffer #438

Open
LarryMoe11 opened this issue Feb 6, 2024 · 1 comment
Open

audio source and buffer #438

LarryMoe11 opened this issue Feb 6, 2024 · 1 comment

Comments

@LarryMoe11
Copy link

I'm attempting to update delta-studio, but I'm failing to find any decent documentation stating how to use audio sources and buffers. I started to adapt previous code, but I'm getting errors stating expression must have class type but it has type "ysAudioSource**

this is the section of code I'm referring to:

m_audioBuffer.initialize(44100, 44100);
m_audioBuffer.m_writePointer = (int)(44100 * 0.1);

ysAudioParameters params;
params.m_bitsPerSample = 16;
params.m_channelCount = 1;
params.m_sampleRate = 44100;
m_engine.GetAudioDevice()->CreateBuffer(&params, 44100, m_outputAudioBuffer);
m_engine.GetAudioDevice()->CreateSource(&params, 44100, m_audioSource);
m_audioSource.SetMode((m_simulator->getEngine() != nullptr)
    ? ysAudioSource::Mode::Loop
    : ysAudioSource::Mode::Stop);
m_audioSource->SetPan(0.0f);
m_audioSource->SetVolume(1.0f);
@LarryMoe11
Copy link
Author

fixed it with the following...

    m_audioBuffer.initialize(44100, 44100);
    m_audioBuffer.m_writePointer = (int)(44100 * 0.1);

    ysAudioParameters params;
    params.m_bitsPerSample = 16;
    params.m_channelCount = 1;
    params.m_sampleRate = 44100;
    m_engine.GetAudioDevice()->CreateBuffer(&params, 44100, m_outputAudioBuffer);
    m_engine.GetAudioDevice()->CreateSource(&params, 44100, m_audioSource);

    ysAudioSource m_audioSource = ysAudioSource::ysAudioSource(m_engine.GetAudioDevice()->GetAPI());
    ysAudioBuffer m_outputAudioBuffer = ysAudioBuffer::ysAudioBuffer(m_engine.GetAudioDevice()->GetAPI());

    m_audioSource.SetMode((m_simulator->getEngine() != nullptr)
        ? ysAudioSource::Mode::Loop
        : ysAudioSource::Mode::Stop);
    m_audioSource.SetPan(0.0f);
    m_audioSource.SetVolume(1.0f);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant