Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6158323
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T20:56:18+00:00 2026-05-23T20:56:18+00:00

The pointer to the audio buffer of the XAUDIO_BUFFER structure in XAudio2 is defined

  • 0

The pointer to the audio buffer of the XAUDIO_BUFFER structure in XAudio2 is defined as BYTE *pAudioData. When I was using 16-bit Integer PCM, this is what my program looked like:

void buildWaveBuffer(std::vector<unsigned char> &vec)
{
    std::string lineString;
    int lineInt;
    unsigned char lowByte, highByte;
    std::ifstream myfile("sineInt16");

    if (myfile.is_open())
    {
        while(myfile.good())
        {
            std::getline(myfile,lineString,',');
            lineInt = atoi(lineString.c_str());
            highByte = (lineInt >> 8) & 0x00FF;
            lowByte = lineInt & 0x00FF;
            vec.push_back(lowByte);
            vec.push_back(highByte);
        }
        myfile.close();
    }
}

"sineInt16" being a .csv file. Since the vector is organized sequentially in the memory, I would simply do pAudioData = &vec[0] and it would work. What if I want to change the format of my .csv to float? How do I give a pointer to the first byte in the vector? Should I use another container like a simple array of chars?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T20:56:19+00:00Added an answer on May 23, 2026 at 8:56 pm

    How do I give a pointer to the first byte in the vector?

    The exact same way, but I’m not sure it will do what you expect. Read the comments to your question.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to extract level data from a PCM audio file using core
This is the blurb accompanying the Audio Services function AudioServicesSetProperty. Its a bit over
Using pointer arithmetic, it's possible to assign characters from one array to another. My
I have a function pointer defined by: typedef void (*EventFunction)(int nEvent); Is there a
I'm developing an audio processing app using core audio that records sounds through the
I have been working on reading in an audio asset using AVAssetReader so that
I'm writing a console program that uses DirectSound API to render some audio data.
I am getting problems in playing audio(mp3) files this music files are like click
the constructor for my engine constructs audio, video and input objects with a pointer
So I have a pointer to an array of pointers. If I delete it

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.