Minor cleanup
This commit is contained in:
@@ -2,46 +2,9 @@
|
||||
|
||||
#include <Event.h>
|
||||
|
||||
namespace ReMixer
|
||||
{
|
||||
namespace ReMixer {
|
||||
class Stream;
|
||||
|
||||
/// A managed sound handler object.
|
||||
class NuSound
|
||||
{
|
||||
public:
|
||||
virtual bool IsPlaying() = 0;
|
||||
virtual bool IsPaused() = 0;
|
||||
virtual bool IsFinished() = 0;
|
||||
float PlaybackLoudness();
|
||||
int ChannelCount();
|
||||
bool Looped();
|
||||
float PlaybackSpeed();
|
||||
float TimeLength();
|
||||
float TimePosition();
|
||||
float Volume();
|
||||
|
||||
|
||||
void SetTimePosition(float timePos);
|
||||
void SetVolume(float vol);
|
||||
void SetPlaybackSpeed(float speed);
|
||||
|
||||
|
||||
virtual void Pause() = 0;
|
||||
virtual void Play() = 0;
|
||||
void Resume();
|
||||
void Stop();
|
||||
|
||||
Event<int> DidLoop;
|
||||
Event<> Ended;
|
||||
Event<> Paused;
|
||||
Event<> Played;
|
||||
Event<> Resumed;
|
||||
protected:
|
||||
private:
|
||||
};
|
||||
|
||||
|
||||
/// TODO: Equalizer Effect
|
||||
/// TODO: Compressor Effect
|
||||
/// TODO: Reverb Effect
|
||||
@@ -54,10 +17,7 @@ namespace ReMixer
|
||||
/// TODO: Positional Sound Object?
|
||||
|
||||
/// Physical representation of Pulse-Code-Modulated sound data.
|
||||
class PCM
|
||||
{
|
||||
|
||||
};
|
||||
class PCM { };
|
||||
|
||||
class Decibels { };
|
||||
|
||||
@@ -94,7 +54,6 @@ namespace ReMixer
|
||||
void SetPlaybackDevice();
|
||||
void SetRecordingDevice();
|
||||
|
||||
|
||||
void SetMasterVolume(Decibels db);
|
||||
|
||||
protected:
|
||||
|
@@ -59,12 +59,10 @@ namespace ReMixer {
|
||||
static Sound
|
||||
FromPCMBuffer(std::vector<char> buffer, uint sampleRate = 44.1_kHz, StreamMode streamMode = StreamMode::STEREO);
|
||||
|
||||
|
||||
/// Returns a single-channel sound object generated from a trigonometric sine function.
|
||||
/// @see https://en.wikipedia.org/wiki/Sine_wave
|
||||
static Sound FromSineWave(float length, float wavelength, float amplitude, float phase);
|
||||
|
||||
|
||||
/// Returns a single-channel sound object generated from a sawtooth wave function.
|
||||
/// Sawtooth waves of constant period contain odd and even harmonics that decrease at -6 dB / octave.
|
||||
/// @see https://en.wikipedia.org/wiki/Sawtooth_wave
|
||||
@@ -144,8 +142,6 @@ namespace ReMixer {
|
||||
uint sample_rate;
|
||||
std::vector<char> audio_data;
|
||||
StreamMode stream_mode;
|
||||
|
||||
|
||||
};
|
||||
|
||||
/// Class that holds a short sound that can fit in memory and requires no latency. (i.e. footsteps or gun shots).
|
||||
|
15
main.cpp
15
main.cpp
@@ -52,25 +52,10 @@
|
||||
server.Play(test_stream, square_sound);
|
||||
server.Play(test_stream, test_sound);
|
||||
|
||||
|
||||
//test_sound = test_sound + ogg_test_sound;
|
||||
|
||||
//std::cout << "Sound Playback Length: " << wave_test.PlaybackLength() << " seconds." << std::endl;
|
||||
|
||||
//std::thread playback_thread([](PulseAudioSubsystem system, PulseStream stream, Sound sound){
|
||||
//system.Play(stream, sound);
|
||||
//}, test, test_stream, wave_test);
|
||||
|
||||
|
||||
|
||||
while (true) {
|
||||
std::this_thread::sleep_for(25ms);
|
||||
}
|
||||
|
||||
//test.Play(test_stream2, ogg_test_sound);
|
||||
|
||||
std::cout << "This text will print after the sound plays." << std::endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@@ -3,7 +3,6 @@
|
||||
#include <uuid/uuid.h>
|
||||
#include <iostream>
|
||||
|
||||
|
||||
void ReMixer::Stream::SetName(const std::string& name)
|
||||
{
|
||||
this->name = name;
|
||||
@@ -25,7 +24,6 @@ void ReMixer::PulseStream::SetSampleRate(uint sampleRate)
|
||||
Stream::SetSampleRate(sampleRate);
|
||||
pa_operation* op;
|
||||
|
||||
|
||||
op = pa_stream_update_sample_rate(this->stream, sampleRate, OnStreamSuccess, this);
|
||||
|
||||
pa_operation_unref(op);
|
||||
|
Reference in New Issue
Block a user