Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- use DesktopAudio version 1.0
- string String {}
- AudioIn[0] >> String;
- -------------------------------------------
- // #include <iostream>
- #include "ReadWriteClasses.hpp"
- #include "Synchronization.hpp"
- #include "Helper.hpp"
- //[[Includes]]
- #include <iostream>
- #include <iomanip>
- #include <string>
- ///////////////////////////
- //[[/Includes]]
- //[[Declarations]]
- constexpr int NUM_IN_CHANNELS = 2;
- constexpr int NUM_OUT_CHANNELS = 2;
- constexpr int NUM_SAMPLES = 44100;
- float inbuf[NUM_SAMPLES * NUM_IN_CHANNELS];
- float outbuf[NUM_SAMPLES * NUM_OUT_CHANNELS];
- std::string String;
- int audio_buffer_process()
- {
- int nBufferFrames = NUM_SAMPLES;
- float *in = inbuf;
- float *out = outbuf;
- while(nBufferFrames-- > 0) {
- // Stream begin: /home/andres/Documents/src/Stride/Stride/strideroot/frameworks/RtAudio/1.0/_tests/simple/16_string.stride:5
- String = std::to_string(in[0]);
- in += NUM_IN_CHANNELS;
- out += NUM_OUT_CHANNELS;
- }
- return 0;
- }
- ///////////////////////////
- //[[/Declarations]]
- //[[Instances]]
- //[[/Instances]]
- //[[Processing]]
- ///////////////////////////
- //[[/Processing]]
- //[[OSC:Processing]]
- //[[/OSC:Processing]]
- //[[SerialIn:Processing]]
- //[[/SerialIn:Processing]]
- //[[SerialOut:Processing]]
- //[[/SerialOut:Processing]]
- int main() {
- // std::cout << "app started" << std::endl;
- //[[GlobalInitialization]]
- ///////////////////////////
- //[[/GlobalInitialization]]
- //[[Initialization]]
- for(int i = 0; i < NUM_SAMPLES; i++) {
- inbuf[i* NUM_IN_CHANNELS] = (i * 2.0 / (NUM_SAMPLES-1)) - 1; // -1 -> 1
- inbuf[i* NUM_IN_CHANNELS + 1] = 1 - (i * 2.0 / (NUM_SAMPLES-1)); // 1 -> -1
- }
- audio_buffer_process();
- ///////////////////////////
- //[[/Initialization]]
- // char input;
- // std::cout << "\nRunning ... press <enter> to quit.\n";
- // std::cin.get(input);
- //[[Cleanup]]
- for(int i = 0; i < NUM_SAMPLES * NUM_IN_CHANNELS; i++) {
- std::cout << std::setprecision(10) << outbuf[i] << std::endl;
- }
- ///////////////////////////
- //[[/Cleanup]]
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement