Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - theo Richard

Pages: [1]
1
Audio / question on SoundBuffer samples
« on: June 17, 2015, 10:38:07 pm »
Hi ! I'am discovering the SoundBuffer while currently working on a pretty basic project :

I load a "A4.wav" containing the A4 key sound (La, 440hz) in a SoundBuffer called La

I then load a second Soundbuffer called Do with the sample, count, and rate of La, but I divide the rate by 1.68176432 to have give it the C sound (Do, 261.6hz)

I then play the Do sound and it plays the note well but the duration of the sound is longer than the La sound.

I think thats because by dividing the rate, fewer bytes are being played each second which lowers the frequence of the sound and increase its duration.

440 (A4 - La) / 1.68176432 = 261.6 (C - Do)

So I tried dividing the count value of the Do sound by 1.68176432 too, and it actually worked since the SoundBuffer.duration is now equals to the La's SoundBuffer.duration. But the Sound doesnt play anymore and I dont really understand why... :(

I then tried to play around with the samples of the Do's buffer too maybe shorten its length accordingly to the new found count value. but I couldnt really understand how to really do that  :-\

So I'd like to know if someone had any idea why the Sound doesnt play anymore, thanks in advance  :)

2
Hi ! Im having great troubles compiling a simple test project using with SFML. I have seen many errors similar to the ones Im getting on the internet but everything i tried failed.

I am static linking sfml.

In the project's properties, I added the path to the SFML headers and the SFML libraries.

I have define the SFML_STATIC macro in the preprocessor options of my project.

I added modules and their dependencies like so :

sfml-audio-s-d.lib sfml-graphics-s-d.lib sfml-window-s-d.lib sfml-system-s-d.lib opengl32.lib freetype.lib jpeg.lib winmm.lib flac.lib vorbis.lib vorbisenc.lib vorbisfile.lib ogg.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib

I even added the dll files in my executable folder even though its not necessary when static building.

here is my code :

#include "stdafx.h"
#include <SFML/Audio.hpp>
#include <iostream>
#include <stdlib.h>

int _tmain(int argc, _TCHAR* argv[])
{
    std::cout << "helloo" << std::endl;
    sf::SoundBuffer buffer;
    if (!buffer.loadFromFile("A4.wav"))
        std::cout << "cant open file" << std::endl;
    sf::Sound sound;
    sound.setBuffer(buffer);
    sound.play();
    std::string test;
    std::cin >> test;
    return 42;
}
And now here is the errors I get :

EDIT

1>------ start of the global generation : Projet : AudioTest, Configuration : Debug Win32 ------
1>  Compilateur d'optimisation Microsoft (R) 32 bits C/C++ version 16.00.30319.01 for 80x86
1>  Copyright (C) Microsoft Corporation. Tous droits réservés.
1> 
1>  cl /c /I"C:\Users\theo-richard\Documents\Visual Studio 2010\SFML-2.0\include" /ZI /nologo- /W3 /WX- /Od /Oy- /D SFML_STATIC /D WIN32 /D _DEBUG /D _CONSOLE /D _UNICODE /D UNICODE /Gm /EHsc /RTC1 /MD /GS /fp:precise /Zc:wchar_t /Zc:forScope /Yc"StdAfx.h" /Fp"Debug\AudioTest.pch" /Fo"Debug\\" /Fd"Debug\vc100.pdb" /Gd /TP /analyze- /errorReport:prompt stdafx.cpp
1>cl :command line warning D9035: l'option 'nologo-' est déconseillée et sera supprimée dans une version ultérieure
1> 
1>  stdafx.cpp
1>  Compilateur d'optimisation Microsoft (R) 32 bits C/C++ version 16.00.30319.01 pour 80x86
1>  Copyright (C) Microsoft Corporation. Tous droits réservés.
1> 
1>  cl /c /I"C:\Users\theo-richard\Documents\Visual Studio 2010\SFML-2.0\include" /ZI /nologo- /W3 /WX- /Od /Oy- /D SFML_STATIC /D SFML_STATIC /D WIN32 /D _DEBUG /D _CONSOLE /D _UNICODE /D UNICODE /Gm /EHsc /RTC1 /MD /GS /fp:precise /Zc:wchar_t /Zc:forScope /Yu"StdAfx.h" /Fp"Debug\AudioTest.pch" /Fo"Debug\\" /Fd"Debug\vc100.pdb" /Gd /TP /analyze- /errorReport:prompt AudioTest.cpp
1>cl : Ligne de commande warning D9035: l'option 'nologo-' est déconseillée et sera supprimée dans une version ultérieure
1> 
1>  AudioTest.cpp
1>  Microsoft (R) Incremental Linker Version 10.00.30319.01
1>  Copyright (C) Microsoft Corporation.  All rights reserved.
1> 
1>  "/OUT:C:\Users\theo-richard\Documents\Visual Studio 2010\Projects\AudioTest\Debug\AudioTest.exe" /INCREMENTAL:NO "/LIBPATH:C:\Users\theo-richard\Documents\Visual Studio 2010\SFML-2.0\lib" "sfml-audio-s-d.lib" "sfml-graphics-s-d.lib" "sfml-window-s-d.lib" "sfml-system-s-d.lib" opengl32.lib freetype.lib jpeg.lib winmm.lib flac.lib vorbis.lib vorbisenc.lib vorbisfile.lib ogg.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /MANIFEST "/ManifestFile:Debug\AudioTest.exe.intermediate.manifest" "/MANIFESTUAC:level='asInvoker' uiAccess='false'" /DEBUG "/PDB:C:\Users\theo-richard\Documents\Visual Studio 2010\Projects\AudioTest\Debug\AudioTest.pdb" /SUBSYSTEM:CONSOLE /TLBID:1 /DYNAMICBASE /NXCOMPAT "/IMPLIB:C:\Users\theo-richard\Documents\Visual Studio 2010\Projects\AudioTest\Debug\AudioTest.lib" /MACHINE:X86 Debug\AudioTest.obj
1>  Debug\stdafx.obj

1>AudioTest.obj : error LNK2019: unresolved external symbol "public: __thiscall sf::SoundBuffer::~SoundBuffer(void)" (??1SoundBuffer@sf@@QAE@XZ)  referenced in function _wmain

1>AudioTest.obj : error LNK2019: unresolved external symbol "public: virtual __thiscall sf::Sound::~Sound(void)" (??1Sound@sf@@UAE@XZ) referenced in function _wmain

1>AudioTest.obj : error LNK2019: unresolved external symbol "public: void __thiscall sf::Sound::play(void)" (?play@Sound@sf@@QAEXXZ) referenced in function _wmain

1>AudioTest.obj : error LNK2019: unresolved external symbol "public: void __thiscall sf::Sound::setBuffer(class sf::SoundBuffer const &)" (?setBuffer@Sound@sf@@QAEXABVSoundBuffer@2@@Z) referenced in function _wmain

1>AudioTest.obj : error LNK2019: unresolved external symbol "public: __thiscall sf::Sound::Sound(void)" (??0Sound@sf@@QAE@XZ) referenced in function _wmain

1>AudioTest.obj : error LNK2019: unresolved external symbol "public: bool __thiscall sf::SoundBuffer::loadFromFile(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (?loadFromFile@SoundBuffer@sf@@QAE_NABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z) referenced in function _wmain

1>AudioTest.obj : error LNK2019: unresolved external symbol "public: __thiscall sf::SoundBuffer::SoundBuffer(void)" (??0SoundBuffer@sf@@QAE@XZ) referenced in function _wmain
additionnal infos :

Im using visual studio 2010 express.

I downloaded "SFML 2.3 Visual C++ 10 (2010) - 64-bit".

any help appreciated.

Pages: [1]