|
From: <pst...@us...> - 2010-07-12 01:55:17
|
Revision: 791
http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=791&view=rev
Author: pstieber
Date: 2010-07-12 01:55:11 +0000 (Mon, 12 Jul 2010)
Log Message:
-----------
Updated the Linux version.
Modified Paths:
--------------
trunk/jazz/src/AlsaDriver.cpp
trunk/jazz/src/AlsaDriver.h
trunk/jazz/src/AudioDriver.cpp
trunk/jazz/src/AudioDriver.h
Modified: trunk/jazz/src/AlsaDriver.cpp
===================================================================
--- trunk/jazz/src/AlsaDriver.cpp 2010-07-12 01:21:59 UTC (rev 790)
+++ trunk/jazz/src/AlsaDriver.cpp 2010-07-12 01:55:11 UTC (rev 791)
@@ -127,7 +127,7 @@
{
mpAudioBuffer = new tEventArray();
mInstalled = false;
- audio_enabled = 0;
+ mAudioEnabled = false;
mpListener = 0;
mCanDuplex = 0; // no duplex yet.
pcm[PLAYBACK] = NULL;
@@ -139,7 +139,7 @@
// FIXME
mCanDuplex = 1;
mInstalled = true;
- audio_enabled = 1;
+ mAudioEnabled = true;
}
@@ -181,7 +181,7 @@
mSamples.StartPlay(clock);
tAlsaPlayer::StartPlay(clock, loopClock, cont);
- if (!audio_enabled)
+ if (!mAudioEnabled)
{
return;
}
@@ -213,7 +213,7 @@
if (running_mode == 0)
{
- audio_enabled = 0;
+ mAudioEnabled = false;
return;
}
@@ -241,7 +241,7 @@
void tAlsaAudioPlayer::OpenDsp(int mode, int sync_mode)
{
- if (!audio_enabled)
+ if (!mAudioEnabled)
{
return;
}
@@ -260,7 +260,7 @@
format = SND_PCM_FORMAT_S16_LE;
frame_shift[mode]++;
}
- channels = mSamples.GetChannels();
+ channels = mSamples.GetChannelCount();
if (channels > 1)
{
frame_shift[mode]++;
@@ -276,7 +276,7 @@
SND_PCM_NONBLOCK) < 0)
{
perror("snd_pcm_open");
- audio_enabled = 0;
+ mAudioEnabled = false;
return;
}
@@ -298,9 +298,11 @@
perror("cannot set audio channels");
goto __error;
}
- if (snd_pcm_hw_params_set_rate(pcm[mode], hw, mSamples.GetSpeed(), 0) < 0)
+ if (
+ snd_pcm_hw_params_set_rate(pcm[mode], hw, mSamples.GetSamplingRate(), 0) <
+ 0)
{
- cerr << "cannot set audio rate: " << mSamples.GetSpeed() << endl;
+ cerr << "cannot set audio rate: " << mSamples.GetSamplingRate() << endl;
goto __error;
}
@@ -354,7 +356,7 @@
__error:
snd_pcm_close(pcm[mode]);
pcm[mode] = NULL;
- audio_enabled = 0;
+ mAudioEnabled = false;
return;
}
@@ -405,7 +407,7 @@
void tAlsaAudioPlayer::Notify()
{
- if (audio_enabled)
+ if (mAudioEnabled)
{
if (pcm[PLAYBACK])
{
@@ -446,7 +448,7 @@
int tAlsaAudioPlayer::WriteSamples()
{
- if (!audio_enabled || pcm[PLAYBACK] == NULL)
+ if (!mAudioEnabled || pcm[PLAYBACK] == NULL)
{
return 0;
}
@@ -495,7 +497,7 @@
void tAlsaAudioPlayer::ReadSamples()
{
- if (!audio_enabled || pcm[CAPTURE] == NULL)
+ if (!mAudioEnabled || pcm[CAPTURE] == NULL)
{
return;
}
@@ -535,7 +537,7 @@
void tAlsaAudioPlayer::MidiSync()
{
- if (!audio_enabled)
+ if (!mAudioEnabled)
{
return;
}
@@ -615,7 +617,7 @@
{
mSamples.StopPlay();
tAlsaPlayer::StopPlay();
- if (!audio_enabled)
+ if (!mAudioEnabled)
{
return;
}
@@ -640,7 +642,7 @@
void tAlsaAudioPlayer::ListenAudio(int key, int start_stop_mode)
{
- if (!audio_enabled)
+ if (!mAudioEnabled)
{
return;
}
@@ -670,7 +672,7 @@
void tAlsaAudioPlayer::ListenAudio(tSample& spl, long fr_smpl, long to_smpl)
{
- if (!audio_enabled)
+ if (!mAudioEnabled)
{
return;
}
Modified: trunk/jazz/src/AlsaDriver.h
===================================================================
--- trunk/jazz/src/AlsaDriver.h 2010-07-12 01:21:59 UTC (rev 790)
+++ trunk/jazz/src/AlsaDriver.h 2010-07-12 01:55:11 UTC (rev 791)
@@ -47,13 +47,13 @@
{
return mInstalled && tAlsaPlayer::IsInstalled();
}
- virtual int GetAudioEnabled() const
+ virtual bool GetAudioEnabled() const
{
- return audio_enabled;
+ return mAudioEnabled;
}
- virtual void SetAudioEnabled(int x)
+ virtual void SetAudioEnabled(bool AudioEnabled)
{
- audio_enabled = x;
+ mAudioEnabled = AudioEnabled;
}
virtual void ListenAudio(int key, int start_stop_mode = 1);
virtual void ListenAudio(tSample &spl, long fr_smpl, long to_smpl);
@@ -100,8 +100,10 @@
int running_mode;
int midi_speed; // start speed in bpm
int curr_speed; // actual speed in bpm
- int audio_enabled; // 0 means midi only
+ // False means MIDI only.
+ bool mAudioEnabled;
+
int card; // card number in config
std::string mDeviceNames[2]; // device names
long frag_size[2];
Modified: trunk/jazz/src/AudioDriver.cpp
===================================================================
--- trunk/jazz/src/AudioDriver.cpp 2010-07-12 01:21:59 UTC (rev 790)
+++ trunk/jazz/src/AudioDriver.cpp 2010-07-12 01:55:11 UTC (rev 791)
@@ -121,11 +121,9 @@
tAudioPlayer::tAudioPlayer(JZSong* pSong)
: tSeq2Player(pSong)
{
- long dummy = 0;
mpAudioBuffer = new tEventArray();
mInstalled = false;
- dummy = gpConfig->GetValue(C_EnableAudio);
- audio_enabled = dummy;
+ mAudioEnabled = (gpConfig->GetValue(C_EnableAudio) != 0);
mpListener = 0;
mCanDuplex = 0; // no duplex yet.
dev = -1;
@@ -164,7 +162,7 @@
}
dev = -1; // closed
- audio_enabled = audio_enabled && mInstalled;
+ mAudioEnabled = mAudioEnabled && mInstalled;
}
@@ -191,7 +189,7 @@
void tAudioPlayer::StartAudio()
{
- if (!audio_enabled)
+ if (!mAudioEnabled)
{
return;
}
@@ -233,7 +231,7 @@
{
int tmp;
- if (!audio_enabled)
+ if (!mAudioEnabled)
{
return;
}
@@ -269,7 +267,7 @@
if (dev < 0)
{
perror(AUDIO_DEVICE);
- audio_enabled = 0;
+ mAudioEnabled = false;
return;
}
@@ -291,13 +289,13 @@
cerr << "Unable to set the sample size" << endl;
}
- tmp = (mSamples.GetChannels() == 1) ? 0 : 1;
+ tmp = (mSamples.GetChannelCount() == 1) ? 0 : 1;
if (ioctl (dev, SNDCTL_DSP_STEREO, &tmp) == -1)
{
cerr << "Unable to set mono/stereo" << endl;
}
- tmp = mSamples.GetSpeed();
+ tmp = mSamples.GetSamplingRate();
if (ioctl (dev, SNDCTL_DSP_SPEED, &tmp) == -1)
{
perror("ioctl DSP_SPEED");
@@ -346,7 +344,7 @@
void tAudioPlayer::Notify()
{
- if (audio_enabled)
+ if (mAudioEnabled)
{
if (PlaybackMode())
{
@@ -373,7 +371,7 @@
int tAudioPlayer::WriteSamples()
{
- if (!audio_enabled)
+ if (!mAudioEnabled)
{
return 0;
}
@@ -451,7 +449,7 @@
// everything works. In OSS, there are no docs and if it works
// with kernel x it wont with kernel y.
- if (!audio_enabled)
+ if (!mAudioEnabled)
{
return;
}
@@ -525,7 +523,7 @@
{
mSamples.StopPlay();
tSeq2Player::StopPlay();
- if (!audio_enabled)
+ if (!mAudioEnabled)
{
return;
}
@@ -552,7 +550,7 @@
void tAudioPlayer::ListenAudio(int key, int start_stop_mode)
{
- if (!audio_enabled)
+ if (!mAudioEnabled)
{
return;
}
@@ -582,7 +580,7 @@
void tAudioPlayer::ListenAudio(tSample &spl, long fr_smpl, long to_smpl)
{
- if (!audio_enabled)
+ if (!mAudioEnabled)
{
return;
}
Modified: trunk/jazz/src/AudioDriver.h
===================================================================
--- trunk/jazz/src/AudioDriver.h 2010-07-12 01:21:59 UTC (rev 790)
+++ trunk/jazz/src/AudioDriver.h 2010-07-12 01:55:11 UTC (rev 791)
@@ -65,14 +65,14 @@
return mInstalled && tSeq2Player::IsInstalled();
}
- virtual int GetAudioEnabled() const
+ virtual bool GetAudioEnabled() const
{
- return audio_enabled;
+ return mAudioEnabled;
}
- virtual void SetAudioEnabled(int x)
+ virtual void SetAudioEnabled(bool AudioEnabled)
{
- audio_enabled = x;
+ mAudioEnabled = AudioEnabled;
}
virtual void ListenAudio(int key, int start_stop_mode = 1);
@@ -113,8 +113,10 @@
long audio_bytes;
int midi_speed; // start speed in bpm
int curr_speed; // actual speed in bpm
- int audio_enabled; // 0 means midi only
+ // False means MIDI only.
+ int mAudioEnabled;
+
tAudioListener* mpListener;
tAudioRecordBuffer recbuffers;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|