Could anyone give me a suggestion or an example of how I would loop through the samples of CAF (Core Audio Format) file? Like taking the first 1000 samples and changing them to 0?
Something like:
for(int i=0; i < numberOfSamples; i++)
{
cafFile.sample[i] = methodThatUsesSampleValue(cafFile.sample[i]);
}
Keep in mind:
I don't need to do this live. No buffers, etc. needed.
I would like to do this in C, C++ or Objective-C.
Would like to be able to use the code on the iOS platform.
Any help appreciated!
The libsndfile C++ library is well-known and provides -among lot of other functions - a function to read AIFF-files: http://www.mega-nerd.com/libsndfile/, the lib is distributed under the "Gnu Lesser General Public License". I don't know if that is an issue.
Recently I stumbled over the amazing OpenFrameWorks library: http://www.openframeworks.cc/about And I know it compiles on MacOS and iPhone. Amongst many(!) other libs it come with an interface to rtAudio: http://www.music.mcgill.ca/~gary/rtaudio/index.html. You might want to consider also using that directly. Hope that helps.
Related
Trying to run this USB Serial example (bottom) to learn MBED, but I get the following compilation error:
class "USBSerial" has no member "printf"
Is it possible it isn't implemented for the STM32F411? Or is this a problem with MBED itself?
Seems like this should be basic functionality. Not finding much useful info on google when searching for this error. Has anyone else seen this error before?
potentially useful details:
IDE: vscode/platformIO
platformio.ini:
[env:nucleo f411re]
platform = ststm32
framework = mbed
board = nucleo_f411re
monitor_speed = 115200
MBED version: 6.2 (as I recall from memory, though I doubt it matters since I checked the docs for a few versions and the API and example appears unchanged)
The method printf() (which is a C, not C++ concept anyway) does not exist, simple as that. Use sprintf() if that's what you're familar with, then USBSerial.write(), perhaps.
I'd like to embed R into a c++ winforms app. It will output the graphs to a pictureBox, and output the numbers to a richTextBox. It takes commands from a textbox. I tried the header file RInside.h, but there is no such file.
Pseudo code:
#include <someDirToImbedR>
ExecuteButton_Click(args) {
RExecute(commandTextBox->Text);
outputGraphPictureBox->Load(output_graph);
richTextBox1->Text = OutputString;
}
I found this post on SO concerning (may be) the same problem.
Here is the Link to a repository by Dirk Eddelbuettel. It has even sample code in c++ to try for yourself.
Also this Link might be helpful.
Hope this can bring you on track. Unfortunately I personally used R only in C#.
I wanted to implement a QR encoder in an iOS application. I have found a solution for this..
QR Encoder for iPhone
However, this is using a C++ complier and wanted a better solution.
I found this:
Objective-C QR Encoder
However, the programme developed this for the OS X not the iOS.
Is the anyone out there that might have a working solution?
iOS 7 provide built in classes for QR code generation
https://github.com/shu223/iOS7-Sampler
I recently evaluated different Barcode Encoder SDKs to generate EAN-13, DataMatrix, and Interleaved 2of5 barcodes in an iPhone App. These are the ones I could find:
OnBarcode
http://www.onbarcode.com
Commercial, binary library (no armv64 support)
Zint
http://sourceforge.net/projects/zint/
GPL-licensed, C library
Best API of the SDKs, but the license makes it unsuited for close-sourced iPhone Apps
Cocoa-Touch-Barcodes
https://github.com/netshade/Cocoa-Touch-Barcodes
BSD-licensed, Objective-C library
No ARC-support, no DataMatrix encoder
RSBarcodes
https://github.com/yeahdongcn/RSBarcodes
MIT-licensed, Objective-C library
No DataMatrix and Interleaved2of5 encoders
iOS-QR-Code-Encoder
https://github.com/moqod/iOS-QR-Code-Encoder
MIT-licensed, Objective-C library
Only supports QR-Codes
QR-Code-Encoder-for-Objective-C
https://github.com/myang-git/QR-Code-Encoder-for-Objective-C
Apache-licensed, Objective-C/C++ library
Only supports QR-Codes
libdmtx
http://www.libdmtx.org
Simplified BSD-licensed, C library (Cocoa-Wrapper available)
Only supports DataMatrix
You could use zint http://sourceforge.net/projects/zint/
It is written in C and you can just use it in Objective C.
USE THIS:
https://github.com/angrauel/QR-Code-Encoder-for-Objective-C (UPDATED FOR IOS 6)
If you get an error when putting into device:
Go to Build Settings -> Architectures
then remove the default values "Standard (armv7, armv7s)" and add two new values: "armv6"; "armv7".
This should fix all problems.
when I'm trying to compile it gives me 26 errors however everything is at its right place
but won't able to understand the errors mostly constant is too long.
Plz help I want to play a mp3 file through C programming.
*errors are shown in the jpg image
#include "inc/fmod.h"
FMUSIC_MODULE* handle;
int main ()
{
// init FMOD sound system
FSOUND_Init (44100, 32, 0);
// load song
handle=FMUSIC_LoadSong ("don.mp3");
// play song only once
// when you want to play a midi file you have to disable looping
// BEFORE playing the song else this command has no effect!
FMUSIC_SetLooping (handle, false);
// play song
FMUSIC_PlaySong (handle);
// wait until the users hits a key to end the app
while (!_kbhit())
{
}
//clean up
FMUSIC_FreeSong (handle);
FSOUND_Close();
}
http://i.stack.imgur.com/JH4Ts.jpg
Borland Turbo C++ pre-dates most C++ standards and modern C. I would not expect FMOD or any modern library to work with this compiler.
Visual C++ is free to use in the Express form, and is a vastly better compiler.
The code you have listed is FMOD 3 code, yet you are using FMOD 4 headers (and probably libs too). This will not work, I can see from your error pic you have other troubles too, perhaps include paths not being set correctly.
We provide a Borland lib that you will need to link with: 'fmodex_bc.lib' but again this is FMOD 4 code, I would highly recommend looking at the 'playstream' example that ships with the SDK, it demonstrates MP3 playback.
I'm new to coding C++ programs in Visual Studio. When I am coding C# programs in VS, code formatter changes code that looked like this
for(int i= 0; i<(n+ m) ; i++){
}
into
for(int i = 0; i < (n + m); i++)
{
}
which is way easier to read. When I write the same thing in C++, nothing happens. I tried to select the text and press Ctrl+E, F, but that didn't work. Is there a way to improve the C++ code formatter in visual studio?
Visual Studio can't format C++-Code. Maybe there is a VS extension. I searched a long time, but never found a suitable one for free.
A very good, free, but not easy to use code formatter is GreatCode. Its a command line tool.
You can configure it as "External Tool":
After unpacking GreatCode on your HD just go Tools->External Tools->Add and insert the following settings...
Whenever you call that Tool, the actual opened file is being formatted.
You can configure GreatCode as you like in the gc.cfg. I tried many options, some are easy, some are complex.
If you want a Microsoft-like looking, just use my settings as a template and fine tune yourself:
-code_constructor_style-1
-code_split_fctdef_style-5
-code_split_decl_style-2
-overwrite_read_only-
-verbose-
-tab_out-
-space_if-
-space_return-
-space_fctcall_inparam-
-no-space_fctcall_firstparam-
-no-space_cast_after-
-space_affect_style-0
-space_autoaffect_style-0
-code_len-180
-code_keep_more_empty_lines-
-code_decl_access_to_type-
-code_decl_break_template-
-code_remove_return_paren-
-code_align_max_blanks-80
-code_class_access_eol_after-1
-code_class_access_eol_before-1
-code_split_fctcall_style-1
-code_constructor_style-1
-no-code_split_bool_before-
-no-stmt_concat_else_if-
-no-stmt_decl_remove_empty-
-no-stmt_concat_if_remove_empty-
-no-stmt_concat_else_if-
-stmt_force_brace-1
-stmt_break_dowhile-
-stmt_switch_style-1
-stmt_switch_eol-0
-stmt_class_indent-0
-stmt_static_init_style-2
-stmt_concat_inline_class-
-pp_align_to_code-
-pp_style-1
-pp_align_breakline-
-no-cmt_first_space_cpp-
-cmt_dont_modify-
-no-cmt_add_class_access-
-no-cmt_add_gc_tag-
-no-cmt_add_fct_def_class-
-no-cmt_decl_before-
-no-cmt_decl-
-no-cmt_first_line_break_first-
-no-cmt_first_line_break_last-
-no-code_split_bool_before-
-catch_eol_before-1
-no-stmt_decl_remove_empty-
-no-cmt_add_fct_def_class-
-no-cmt_add_class_access-
-no-stmt_break_alone-
-stmt_concat_inline_class-
-cmt_keep_cpp-
Good luck!
I use exactly the same approach as DirkMausF except the formatting tool itself. I would suggest you to use Artistic Style formatter:
http://astyle.sourceforge.net/
It is well documented and comes with a lot of predefined formatting styles so it is very easy to use.
If you have cash to spend, you might want to look in to Visual Assist. See also, this question.
For a long time, I was writing all the C++ code in Netbeans and I was compiling it in Visual Studio. Netbeans is formatting code perfectly (with ALT+SHIFT+F) and there are many formatting options.